Possible issue with debugger and immediate values in ALU instructions
Jon Abbott (1421) 2652 posts |
The RO5.21 Debugger decodes &E2800130 to “ADD R0,R0,#&30,2”, I believe it should decode to “ADD R0,R0,#&C” RO3.1’s Debugger has a similar issue and decodes it to “ADD R0,R0,#&30,ROR #2” |
Jeffrey Lee (213) 6048 posts |
The Debugger is correct. Bits 0-7 give the 8 bit constant, bits 8-11 give the ROR value (as a multiple of two), so &…130 = &30 ROR 2. Usually (at least for objasm) a non-standard constant like that would be expressed as “#&30,2” (which itself appears to be stones-throw away from the syntax shown in the ARM ARM of ‘#imm, #rotate’) |
Jon Abbott (1421) 2652 posts |
Technically, it’s correct, I’ll give you that. Wouldn’t it me more intuitive to express immediate values as their actual value though? E28003FF is decoded as “ADD R0,R0,#&FC000003”, not “ADD R0,R0,#&FF,6” so why are two syntaxes used? |
Jeffrey Lee (213) 6048 posts |
Yes, but (a) different encodings of the same value can have different effects (due to the way the rotate effects the carry flag), and (b) because of (a) ARM have laid down some rules for what count as standard and non-standard encodings and how they should be represented in assemblers/disassemblers (with use of the non-standard encoding being deprecated). Check the ARM ARM for details. I would have copied & pasted the relevant bit here, but the PDF I’m looking at appears to be copy-protected. Nevertheless, a quick google will point you towards online copies which aren’t hidden behind ARM’s registration system |
fosjoas2015 (2631) 2 posts |
Thank you for your clarification, David and Andrew. |