Guides:Coin Case ACE: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
m (TimoVM moved page Guides:Coin Case ACE with stat experience redirection to Guides:Coin Case ACE: Misspelled title: Stat Experience is no longer involved in the setup) |
|||
Line 349: | Line 349: | ||
===Effect of the Coin Case=== |
===Effect of the Coin Case=== |
||
The effects of the Coin Case are described in more detail on the following [http://Coin%20Case%20glitches#cause wiki page]. Relevant to this setup is that the |
The effects of the Coin Case are described in more detail on the following [http://Coin%20Case%20glitches#cause wiki page]. Relevant to this setup is that the used movement pattern will redirect execution to address $EEEE (echo ram copy of $CEEE), which is the second character of the last read mail. During this redirection, the stack pointer gets incremented once and an address gets popped from the stack. The global effect is that the stack pointer is decremented once compared to when the Coin Case was used. |
||
===Effect of party pokémon #3=== |
|||
Defeating the provided list of pokémon will result in the following values at the following addresses, assuming the pokémon is in party slot #3: |
|||
<pre> |
|||
DA95 00 nop |
|||
DA96 75 ld [hl], l |
|||
DA97 00 nop |
|||
DA98 94 sub a, h |
|||
DA99 00 nop |
|||
DA9A C3 |
|||
DA9B 00 |
|||
DA9C CF jp $CF00 |
|||
DA9D 00 nop |
|||
DA9E 6E ld l, [hl] |
|||
</pre> |
|||
Executing Coin Case at the location described in the setup will cause execution to jump to $DA98. It will then harmlessly slide through the sub a, h and nop instructions, after which execution will jump to $CF00, which is in the middle of the last buffered mail. |
|||
===Effect of the mail=== |
===Effect of the mail=== |
||
Line 375: | Line 356: | ||
<pre> |
<pre> |
||
A7 and a ; Filler |
|||
⚫ | |||
80 add a, b |
|||
D4 B9 F8 call nc, $F8B9 ; Box names start at $D8BF/F8BF, setting the active box to box 1 will ensure we can safely slide through. |
|||
80 add a, b |
|||
E1 pop hl ; Additional pop to clear return address of call to screen data |
|||
80 add a, b |
|||
D1 pop de ; Set de to $0075, which holds value $00. Ensures that print function will end immediately after resuming |
|||
80 add a, b |
|||
E8 FF add sp, -1 ; Fix the effect of increasing the stack pointer |
|||
80 add a, b |
|||
F1 pop af ; a = $03 |
|||
E0 9F ld ($FF9F), a ; Ensures return to ROM bank 3 after resuming execution |
|||
80 add a, b |
|||
A7 and a ; Reset carry flag. Not strictly necessary, but added for safety for now |
|||
80 add a, b |
|||
D0 ret nc |
|||
80 add a, b |
|||
80 add a, b |
|||
80 add a, b |
|||
80 add a, b |
|||
80 add a, b |
|||
80 add a, b |
|||
4E ld c, (hl) ; Newline control character. |
|||
80 add a, b |
|||
80 add a, b |
|||
AF xor a ; Located at $CF00, all values before this address are filler and will not be executed. |
|||
D6 FD sub $FD ; Set a to $03. |
|||
E0 9F ld (hRomBank), a; Set current ROM bank to bank 3. This ROM bank contains item and pack data and ensures safe return. |
|||
E8 FF add sp, $FF ; $FF is interpreted as a singed integer, stack pointer gets decremented and the stack is now properly aligned again. |
|||
D1 pop de |
|||
D1 pop de |
|||
D1 pop de ; Pop text command related addresses so that returning from ACE execution will resume normal game operation. |
|||
⚫ | |||
D2 B9 F8 jp nc, $F8B9 ; Jump to echo ram copy of $D8B9, which lies a few bytes before box data. |
|||
</pre> |
</pre> |
||
Line 421: | Line 384: | ||
The code overwrites part of itself to call the byteFill function. This will fill the area between $D57E and $D5AF with $FF values, setting all 50 TM quantities to 255. |
The code overwrites part of itself to call the byteFill function. This will fill the area between $D57E and $D5AF with $FF values, setting all 50 TM quantities to 255. |
||
Separately, this code overwrites the latter half of party pokémon # |
Separately, this code overwrites the latter half of party pokémon #3's stat experience data, allowing it to function as a TM25 bootstrap that redirects execution to the Mail Writer. |
||
Lastly, the value of the first item ID in the main item pocket is overwritten so that it becomes a TM25. |
Lastly, the value of the first item ID in the main item pocket is overwritten so that it becomes a TM25. |
||
Line 455: | Line 418: | ||
Box 5: $D8E3 |
Box 5: $D8E3 |
||
E6 84 and $84 ; a = $04 |
E6 84 and $84 ; a = $04 |
||
EA |
EA 9B FA ld ($FA9B), a |
||
D6 86 sub $86 ; a = $7E |
D6 86 sub $86 ; a = $7E |
||
FB ei |
FB ei |
||
Line 462: | Line 425: | ||
Box 6: $D8EC |
Box 6: $D8EC |
||
EA F5 F8 ld ($F8F5), a |
EA F5 F8 ld ($F8F5), a |
||
EA |
EA 9D FA ld ($FA9D), a |
||
F6 FF or $FF ; a = $FF, reset carry flag |
F6 FF or $FF ; a = $FF, reset carry flag |
||
21 |
21 |
||
Line 474: | Line 437: | ||
Box 8: $D907 |
Box 8: $D907 |
||
E6 D2 and $D2 ; a = $D2 |
E6 D2 and $D2 ; a = $D2 |
||
EA |
EA 9C FA ld ($FA9C), a |
||
D6 FA sub $FA ; a = $D8, TM25's item ID |
D6 FA sub $FA ; a = $D8, TM25's item ID |
||
FB ei |
FB ei |
||
Line 482: | Line 445: | ||
EA B8 F5 ld (wItems), a ; Main item pocket, first item ID |
EA B8 F5 ld (wItems), a ; Main item pocket, first item ID |
||
D6 E3 sub $E3 ; a = $F5 |
D6 E3 sub $E3 ; a = $F5 |
||
EA |
EA 9E FA ld ($FA9E), a |
||
50 ld d, b |
50 ld d, b |
||
Box 10: $D919 |
Box 10: $D919 |
||
D6 B7 sub $B7 ; a = 3E, reset carry flag |
D6 B7 sub $B7 ; a = 3E, reset carry flag |
||
EA |
EA 9A FA ld ($FA9A), a |
||
D0 ret nc |
D0 ret nc |
||
50 ld d, b |
50 ld d, b |