So I need to write a very basic disassembler for class and I'm having a hard time figuring out how the S that can be appended to Thumb instructions is encoded.
For example, the instruction 0x0011 corresponds with the following assembly code:
movs r1, r2
Why wouldn't it just be a regular mov?
Likewise, 0x1889 corresponds with:
adds r1, r1, r2
As far as I can tell from reading the reference manual, this is the same encoding as the regular add instruction without the S. Is this the case? How is the instruction for updating condition flags sent?
Thumb doesn't use the S
condition field for each instruction, so every instruction is unconditional (aside from the conditional branches, obviously). Part of the reduction from 32-bit ARM to 16-bit Thumb involved getting rid of it. The examples you provided shouldn't have the s
to begin with, in my opinion (they don't get used in this manual).
Condition codes in Thumb are set implicitly by your ALU instructions (same as ARM), but to access them you need to use conditional branches.