Kodewerx
https://www.kodewerx.org/forum/

Thumb Assembly
https://www.kodewerx.org/forum/viewtopic.php?f=5&t=1258
Page 1 of 1

Author:  Hextator [ Tue Apr 03, 2007 11:23 am ]
Post subject:  Thumb Assembly

I do thumb just fine (I can assemble any opcodes by hand that I don't know how to enter into an assembler properly), but I'd rather just learn the syntax.

Anyhow, I have an
ldr r1, [TableBase]

and later on down is a

TableBase:

That works fine, but it says I'm missing an argument.

I slap a ", =$08000000" onto the end of the opcode to see if it will shut up, and it does. No more warnings. But of course, it didn't assemble either.

How do I tell it what the hell to do?

Author:  HyperHacker [ Tue Apr 03, 2007 7:53 pm ]
Post subject: 

ldr r1, [=TableBase]?

Author:  Hextator [ Wed Apr 04, 2007 1:15 pm ]
Post subject: 

That didn't work :\

How do I assemble a value (non opcode)?

Author:  kenobi [ Wed Apr 04, 2007 1:52 pm ]
Post subject: 

ldr r1,TableBase ?

Author:  Hextator [ Wed Apr 04, 2007 1:58 pm ]
Post subject: 

That's not working either.

Here's the full thing:

.org 801745e
nop
nop
nop

.org 802a02c
bl $80cb51a

.org 80cb51a
ldr r1, TableBase, =$080CB4DE
add r0, r0, r1
ldrb r0, [r0, #0x0]
bx lr
nop
TableBase:

.org 802a032
nop

I want it to allocate 0x080cb4de at the label TableBase and load from that address.

I've already assembled it by hand and posted a ROM patch for this at the Fire Emblem Sanctuary of Strategy (it's a patch for Fire Emblem 7).

I can't help but think the syntax is incredibly obvious, but I can't think of anything else to try.

I had to assemble it by hand anyhow because Renegade garbled the BL.

Edit: In case anyone who's seen how lazily I program is wondering why I put the ".org" in there even though it's apparently unnecessary, it's because I was originally planning to use devkitPro. I accidentally erased it earlier and decided not to download it again immediately once I remembered that Renegade has that lovely new Thumb assembler. Well, mostly lovely. The BL business is kind of ugly...

Edit: Using the immediate loading pseudo op was failing, so I decided to use the syntax "ldr r1, [PC, #0x8]" instead. Now it assembles fine.

Page 1 of 1 All times are UTC - 8 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/