addi of large decimal in ASMWiiRD

Started by live2play, September 19, 2010, 06:17:18 PM

Previous topic - Next topic

live2play

For some reason, the following instruction won't convert to WiiRD code.  Is there a way to get this to work?

addi r10,r10,1070400

Would the following be the equivalent?

lis r9,0x0010
ori r9,r9,0x5540
add r10,r10,r9

Deathwolf

#1
I think the value is too big.
[addi] [r10],r10, 1[07][04] [00]

one line = 32 bit = 8 bytes.

with addi you only can use 16 bit values = 2 bytes
lolz

Romaap

Quote from: live2play on September 19, 2010, 06:17:18 PM
Would the following be the equivalent?

lis r9,0x0010
ori r9,r9,0x5540
add r10,r10,r9
Yes, this would be a good solution.

live2play

Thanks for the confirmation.  I do appreciate it.

dcx2

The "i" in "addi" stands for "immediate".  An immediate is a number that is provided as part of the instruction itself (notice that if you say "addi r0,r3,1", the last 16 bits of the instruction are "0001", which is the immediate).  Since instructions are 32 bits, if you were to specify a 32-bit immediate, there would be no room left for the op code, source registers, destination register, etc.  This is why you must load the 32-bit value into a register and then use the add instruction.