Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mega_evolve:
- push {r0-r7, lr}
- @ Allocate space on the stack
- @ We're going to generate a dynamic battle script in the RAM
- mov r4, sp
- sub r4, #0xFF
- @ldr r4, =(0x020375D8)
- @ Write the call byte
- mov r0, r4
- mov r1, #0x41
- strb r1, [r0]
- @ Next, write the pointer of the target script
- adr r0, battle_script
- add r1, r4, #1
- bl unaligned_dword_write
- @ Write goto byte after the call command
- mov r1, #0x28
- strb r1, [r4, #5]
- @ Here we write the current battle script pointer. This makes it the target
- @ of the goto, so it will continue execution as normal after our little
- @ battle script...
- ldr r5, battle_script_insn_pointer
- ldr r0, [r5]
- add r1, r4, #6
- bl unaligned_dword_write
- @ Now we execute our script
- str r4, [r5]
- @ Change da species
- ldr r0, battle_participants
- ldr r1, battle_active
- ldrb r1, [r1]
- mov r2, #0x58
- mul r1, r2
- @add r0, r1
- mov r1, #3
- strh r1, [r0]
- pop {r0-r7, pc}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement