Race Tracker [jawa]
#1
My first code post here!

The byte at XXXXYYYY will be 1 if you're in a race, and 0 if you aren't.

(Region free)


C0000000 00000006
3D8080E4 896C74A4
3D80XXXX 2C0B0001
40820008 4800000C
39400000 48000008
39400001 994CYYYY
60000000 00000000


Source:


Code:
head:
    .set RACE, XXXX #replace XXXX with the lower 16 bits of your address
    lis r12, 0x80E4
    
    lbz r11, 0x74A4(r12) #load value into r11
    
    lis r12, 0xYYYY #replace YYYY with the upper 16 bits of your address
    cmpwi r11, 1
    bne not #if value != 1, we are not in a race, branch to not
    b in #else branch to in

not:
    li r10, 0
    b end

in:
    li r10, 1

end:
    stb r10, RACE(r12) #finally, store r10 at your desired location
Reply
#2
The 0x80E474A4 address you're using isn't region free, and might not even be persistent between reboots on the original region since it's in dynamic/heap memory rather than in a data section of the dol/rel

Unrelated tip:

cmpwi r11, 1
bne not
b in
not:
li r10, 0
b end
in:
li r10, 1

Can be optimised to

li r10, 0
cmpwi r11, 1
bne end
li r10, 1
end:
Reply
#3
(11-15-2021, 01:02 PM)Seeky Wrote: The 0x80E474A4 address you're using isn't region free, and might not even be persistent between reboots on the original region since it's in dynamic/heap memory rather than in a data section of the dol/rel

Unrelated tip:

    cmpwi r11, 1
    bne not
    b in
not:
    li r10, 0
    b end
in:
    li r10, 1

Can be optimised to

li r10, 0
cmpwi r11, 1
bne end
li r10, 1
end:

yes, i am currently testing the code on PAL etc. I will be sure to change the post when i test it
Reply
#4
I tested it on PAL too, and it didn't work, so I think it's likely the address isn't consistent between reboots. This means there's probably a pointer to it (or a chain of pointers) at a static address you'll need to find
Reply
#5
Since the onlyavailable region/version of this code isn't working, I moved the thread to this subforum.

On another note, its nice to see you Jawa take the time to learn PPC ASM and attempt to make some codes. It may be time to shake the rust off and make some new codes myself, lol.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)