Thread: [Tutorial] HackMew's Knowledge
View Single Post
Old July 7th, 2009, 08:15 AM
HackMew's Avatar
Mewtwo Strikes Back
Join Date: Jun 2006
Originally Posted by master_script_maker View Post
great tutorial, but i have one question. Why do you change the values of player_data and var at the end of the script?
  1. It's not a script.
  2. I don't change anything, I just assign a values for both. Pretty different.
  3. You should read the tutorial again, I guess.
Originally Posted by The blob of blobs View Post
Hey hackmew I tried to add the trainer id into the asm as well....
it is A instead of C right?
I did something wrong though the script freezes before the guy even faces player
which is weird cuz i called the asm after faceplayer, then called buffernumber 0x1 LASTRESULT (for the secret id) and buffernumber 0x2 (for the trainerid)
the music keeps playing so i think it's my problems with asm.
well anwyays here's my attempt for FireRed.

.align 2
.global lesson1

push {r0-r1, lr}
ldr r0, .PLAYER_DATA
ldr r0, [r0]
ldr r1, .VAR
ldrh r0, [r0, #0xC]
strh r0, [r1]
pop {pc}
push {lr}
ldr r0, .PLAYER_DATA
ldr r0, [r0]
ldr r1, .VAR2
ldrh r0, [r0, #0xA]
strh r0, [r1]
pop {r0-r1, pc}

.align 3
.word 0x02024EA4
.word 0x0201E8C2 + (0x800D * 2)
.word 0x0201E8C2 + (0x8001 * 2)

i haven't tried debugging it just yet....
Yes, it's 0xA instead of 0xC as it's 2 bytes before. Aside from that, your whole ASM routine is screwed up. Please read the guide again, as I never used .align 3 anywhere, for example. Your push/pop usage is also wrong.

Originally Posted by -DarK- View Post
Something goes wrong for me... Everything is fine up to the point where I paste the content from that lesson1.bin into my FR rom. When I try to play the ROM, it freezes as soon as I play A or let the gamefreak logo thing pass by. When I try loading it in A-Map, A-Map crashes... What went wrong then? I used the right offset (0x820000), it had plenty of free space, and yet nothing worked and my ROM got screwed up... And yes, I did assemble the fr lesson, I double checked it.
That's just because you screwed up your ROM. Remember you can't simple insert the new routine pasting it somewhere. That way, you increase the ROM size and screw up all the data after because the pointer will be mostly broken. So, when pasting, make sure to overwrite the right amount of space.
Reply With Quote