ASM Help

Started by Igglyboo, November 11, 2008, 12:16:40 AM

Previous topic - Next topic

brkirch

Quote from: TNTkryzt on November 12, 2008, 01:12:11 AM
I don't have the ASM convertor, if your trying to form an address I would follow the lis with a subi, ie;

address 805B9000

lis r1,32859 (805B)
subi r1,r1,28672 (10000 - 9000 = 7000 /28672 dec)

Of course that subi affects the lis so you must add 1 to the lis value;

lis r1,32860
subi r1,r1,28672

You don't need to use decimal to express the values, the assembler will accept 'lis r1,0x805B'.  Not to mention that you don't need to use addi/subi either, in this case it would make more sense to use ori since then you don't have to worry about the value being treated as signed.
So rewritten it looks like this:
lis r1,0x805B
ori r1,r1,0x9000

I would recommend against using r1 though, as it holds the stack pointer and bad things could happen if you overwrite it even if you restore immediately after.

TNTkryzt

I've never used the asm converter, I just write the asm directly into wird but it only accepts decimal.