Hi,
I've been trying to write an assembly code that corrupts any animated thing in a game during the first 85 seconds (2550 frames (0xA00). After that everything should be normal.
To do that I'm using the value that increases by 0x1 every frame after a level or cutscene is loaded.
First I'd like to load the address of the increasing value into r8. no problem so far.
then I want to load the value of this address into r10.
No problem, too.
Now I need to load the address where I want to write my custom value at into r8. Easy.
Now I want to immediately compare the value of r10 with 0xA00. I think I've done that all right.
Now I want to branch 0x18 ahead if r10 is lower than 0xA00. if not, the branch is skipped and the defauult value will be written to the address that is now in r8. The Problem is, that each time I want to assemble the blt instruction the disassembler starts nagging telling me the offset is out of range. But definitely isn't.
Any advice?

blt- 0x18, blt- 0x800035A4, blt 0x18, blt 0x800035A4 don't work
i even copied the syntax of an existing code being viewed through ASM <-> wiird converter
oh, well, here it is as text with all proper hex values to prevent any more confuseions:
lwz r31,12(r1) // original instruction. Coming from 800053C8
lis r8, 0x803D /* load address of the growing
ori r8, r8, 0x1F48 integer into r8 */
lwz r10, 0 (r8) // load growing Int from address in r8 (803D1F48) into r10
lis r8, 0x804C /* load animation
ori r8, r8, 0xB4EC corrutpor address */
cmpwi cr?,0, r10, 0xA00 // Compare r10 with 0xA00 ??????????????????
blt- 0x800035A4 // goto 800035A4 if r10 is lower than 0xA00 ?????????????
lis r9, 0x3B40 // load 0x3B40 into r9
stw r9, 0 (r8) /* store 0x3B400000
stw r9, 4 (r8) into address of r8 (804CB4EC)
stw r9, 8 (r8) */ + offsets
b 0x800035B4 // goto 800035B4
lis r9, 0x4040 // load 0x4040 into r9
stw r9, 0 (r8) /* store 0x40400000
stw r9, 4 (r8) into address of r8 (804CB4EC)
stw r9, 8 (r8) */ + offsets
lis r8, 0x0000 /* set all used
ori r8, r8, 0x0000 registers to
lis r9, 0x0000 their defaults
lis r10, 0x0000 to prevent
ori r10, r10, 0x0000 */ possible crashes
b 0x800053CC // goto 800053CC
Edit:
And is the comparing instruction right?
Nothing has changed.. i think the comparison fails
I've been trying to write an assembly code that corrupts any animated thing in a game during the first 85 seconds (2550 frames (0xA00). After that everything should be normal.
To do that I'm using the value that increases by 0x1 every frame after a level or cutscene is loaded.
First I'd like to load the address of the increasing value into r8. no problem so far.
then I want to load the value of this address into r10.
No problem, too.
Now I need to load the address where I want to write my custom value at into r8. Easy.
Now I want to immediately compare the value of r10 with 0xA00. I think I've done that all right.
Now I want to branch 0x18 ahead if r10 is lower than 0xA00. if not, the branch is skipped and the defauult value will be written to the address that is now in r8. The Problem is, that each time I want to assemble the blt instruction the disassembler starts nagging telling me the offset is out of range. But definitely isn't.
Any advice?
blt- 0x18, blt- 0x800035A4, blt 0x18, blt 0x800035A4 don't work

i even copied the syntax of an existing code being viewed through ASM <-> wiird converter
oh, well, here it is as text with all proper hex values to prevent any more confuseions:
lwz r31,12(r1) // original instruction. Coming from 800053C8
lis r8, 0x803D /* load address of the growing
ori r8, r8, 0x1F48 integer into r8 */
lwz r10, 0 (r8) // load growing Int from address in r8 (803D1F48) into r10
lis r8, 0x804C /* load animation
ori r8, r8, 0xB4EC corrutpor address */
cmpwi cr?,0, r10, 0xA00 // Compare r10 with 0xA00 ??????????????????
blt- 0x800035A4 // goto 800035A4 if r10 is lower than 0xA00 ?????????????
lis r9, 0x3B40 // load 0x3B40 into r9
stw r9, 0 (r8) /* store 0x3B400000
stw r9, 4 (r8) into address of r8 (804CB4EC)
stw r9, 8 (r8) */ + offsets
b 0x800035B4 // goto 800035B4
lis r9, 0x4040 // load 0x4040 into r9
stw r9, 0 (r8) /* store 0x40400000
stw r9, 4 (r8) into address of r8 (804CB4EC)
stw r9, 8 (r8) */ + offsets
lis r8, 0x0000 /* set all used
ori r8, r8, 0x0000 registers to
lis r9, 0x0000 their defaults
lis r10, 0x0000 to prevent
ori r10, r10, 0x0000 */ possible crashes
b 0x800053CC // goto 800053CC
Edit:
And is the comparing instruction right?
Nothing has changed.. i think the comparison fails
Comment