Author Topic: question about arm/thumb instruction "ldsb"  (Read 150 times)


  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
question about arm/thumb instruction "ldsb"
« on: 2019-08-07 16:07:42 »
I'm debugging the GBA version of FF6  with vba-sdl-h to understand some game algorithms. But I found that the ldsb instruction behaved differently from the arm/thumb manual. According to the manual, it should extend a signed byte.

The memory data is below:
030027e4 f8 01

and this is the debug info:
R00=000001f8 R04=02001fa3 R08=1c000000 R12=02030780
R01=c0000000 R05=030027c8 R09=00000001 R13=03007ef4
R02=00000001 R06=030027e0 R10=00000000 R14=080092ed
R03=00000004 R07=03002930 R11=00000000 R15=0800930c
CPSR=2000003f (..C...T Mode: 1f)
08009308  5af0 ldsb r0, [r6, r3]
> 0800930a  3002 add r0, #0x2
0800930c  52f0 strh r0, [r6, r3]

Based on my understanding, r0 should be 0xfffffff8 since it should load a byte and extend its 7th bit. But seems like it just loads a halfword from that address?