is it possible to load into every address with those following instructions?
whatever I saw this in a code...
example:
load into address 80133700,80133702,8013507
lis r18,0x8013
ori r18,r18,0x3700
ori r18,r18,0x3702
ori r18,r18,0x3507
lis r9,0x4080
ori r9,r9,0x0000
stw r9,0(r18)
it should write 40800000 to all addresses with only one lis instruction.
Quote from: Deathwolf on October 17, 2010, 07:09:27 PM
is it possible to load into every address with those following instructions?
whatever I saw this in a code...
example:
load into address 80133700,80133702,8013507
lis r18,0x8013
ori r18,r18,0x3700
ori r18,r18,0x3702
ori r18,r18,0x3507
lis r9,0x4080
ori r9,r9,0x0000
stw r9,0(r18)
it should write 40800000 to all addresses with only one lis instruction.
no, it would only write to "3507"
note that the instructions are executed after each other, so you will need to write:
lis r18,0x8013
ori r18,r18,0x3700
lis r9,0x4080
ori r9,r9,0x0000
stw r9,0(r18)ori r18,r18,0x3702
lis r9,0x4080
ori r9,r9,0x0000
stw r9,0(r18)ori r18,r18,0x3507
lis r9,0x4080
ori r9,r9,0x0000
stw r9,0(r18)NOW it write to all of those 3 adresses... :p
correct me, if I am wrong.
Quote from: Bully@Wiiplaza on October 17, 2010, 08:34:48 PM
Quote from: Deathwolf on October 17, 2010, 07:09:27 PM
is it possible to load into every address with those following instructions?
whatever I saw this in a code...
example:
load into address 80133700,80133702,8013507
lis r18,0x8013
ori r18,r18,0x3700
ori r18,r18,0x3702
ori r18,r18,0x3507
lis r9,0x4080
ori r9,r9,0x0000
stw r9,0(r18)
it should write 40800000 to all addresses with only one lis instruction.
no, it would only write to "3507"
note that the instructions are executed after each other, so you will need to write:
lis r18,0x8013
ori r18,r18,0x3700
lis r9,0x4080
ori r9,r9,0x0000
stw r9,0(r18)
ori r18,r18,0x3702
lis r9,0x4080
ori r9,r9,0x0000
stw r9,0(r18)
ori r18,r18,0x3507
lis r9,0x4080
ori r9,r9,0x0000
stw r9,0(r18)
NOW it write to all of those 3 adresses... :p
correct me, if I am wrong.
it lose the hook address after stw!
that's why u everytime need lis and ori to load into new address after stw instruction.
load into address would be:
lis r18,0x8013
ori r18,r18,0x3700
lis r9,0x4080
ori r9,r9,0x0000
stw r9,0(r18)
lis r18,0x8013
ori r18,r18,0x3702
lis r9,0x4080
ori r9,r9,0x0000
stw r9,0(r18)
lis r18,0x8013
ori r18,r18,0x3507
lis r9,0x4080
ori r9,r9,0x0000
stw r9,0(r18)
btw another thing are the registers. u have to use new registers by loading into address.
I'm sure it's possible to load into all 3 addresses with only 1 lis instructions.
idk how.
but thanks.
The first problem is that you're using stw, which implies 32-bit values, but one of your addresses is 16-bit aligned (80133702), while another is 8-bit aligned (80133507). So I'm going to change this; say you're trying to write to 80133700, 80133704, and 80133508.
lis r9,0x4080 # lis automatically zeroes the lower 16-bits
lis r18,0x8013 # load the upper half of r18
stw r9,0x3700(r18)
stw r9,0x3704(r18)
stw r9,0x3508(r18)
---
One thing to be careful! If the lower 16 bits are not less than 0x7FFF (i.e. 0x8000 to 0xFFFF), then you must add 1 to e.g. r18. This is because the displacement operand is signed, and 0x8000 to 0xFFFF are -32768 to -1.
ohh yes thanks, I used random addresses for example and forgot this...
so this is the new code?
lis r9,0x4080
lis r18,0x8013
stw r9,0x3700(r18)
stw r9,0x3704(r18)
stw r9,0x3508(r18)
why do u write first before you are loading into any address?
and why can you combinate stw with lis? you are loading into address 80130000 and store it 3700 bytes forward? (80130000+3700 )
I personally don't understand why u are using 0x at stw because there is never any hex.
btw just another thing. this is better for C0 codes right?
for C2 u need to use first a instruction without "load into address"...
lis changes the register. stw changes the memory. You must make sure r9 has the correct value in it before you stw it to memory.
You have the address right. 0x80130000 + 0x3700. I use 0x here because 0x specifies hex; most people have a bad habit of dropping the 0x, and the assembler will interpret that as decimal, so stw r9,3700(r18) is different from stw r9,0x3700(r18). Once you put it into the assembler it will change the 0x3700 to the equivalent decimal value, 14080.
This won't work with offsets that are greater than 0x8000, because the offset is signed and it will be subtracted instead of added. That's why I always suggest using ori; ori will always work, but this method only works if it's less than 0x8000.
EDIT:
Yeah, C0 code is good if you know the address explicitly. Or if you find the right C2 address, you won't need to load r18 anymore, because it will already be loaded.