Jump to content

Guides:SRAM Glitch ACE Setups (Yellow): Difference between revisions

m
no edit summary
m (TimoVM moved page User:TimoVM/Fast SRAM Glitch ACE Setups (Yellow) to Guides:SRAM Glitch ACE Setups (Yellow): Migrating page to the main wiki)
mNo edit summary
 
(13 intermediate revisions by the same user not shown)
Line 273:
===Setting up 4F to execute item codes===
 
Next, we'll be entering a list of fivethree nicknames that gives us the glitch item named "4F" and the necessary bootstrap. This ensures that using 4F will activate the item code.
 
{| class="wikitable"
Line 286:
* Open the item bag. Swap the original contents of item slot #41 with the X Accuracy x243. This will deactivate Map Script ACE.
* Finally, verify that 4F works by using it. If the game doesn't crash, 4F was set up correctly.
 
'''Note: due to item layouts and translation differences between languages, 4F goes by different item names across multiple languages. '''
* '''French: 3EME ETAGE'''
* '''German: S3'''
* '''Italian: 3°P'''
* '''Spanish: P3'''
 
{| class="wikitable"
Line 301 ⟶ 307:
===Setting up the Nickname Writer===
 
* Next, we'll be entering a list of fourteenthirteen nicknames. This will form a small program that, when activated using 4F, will allow us to easily write large amount of arbitrary code using the nickname screen. For the Italian version, please ensure to pick the correct list of codes for your language.
 
{| class="wikitable"
Line 313 ⟶ 319:
 
* Pick up Eevees and enter the nicknames in the above screenshot one by one. '''The nicknames from this list needs to be entered in this exact order from the top to the bottom.'''
* Once all nicknames have been entered, look at your trainer card, then use 4F. This should open a screen in which you're asked to enter a pokémon's nickname
* Exit the room and head to the pokémon center. We'll be testing out the Nickname writer.
* Once you're at the pokémon center, use 4F. This should open a screen in which you're asked to enter a pokémon's nickname
* For now, press START to end writing the nickname. This should display the main menu, a number should be written on screen.
* Press SELECT to exit the Nickname Writer safely.
 
===Using the nickname writer===
 
From this point onward, whenever you use the ACE item, you should be able to open the nickname writer. Please make sure to respectkeep note of the following:
* TheSince the Nickname Writer only works whenindependently you have the Eevee-filled box set asof the current active box., '''Attemptingyou tocan usechange the Nickname Writer with any other boxes set ascurrent active willbox likelyhowever crashmuch theyou gamelike.'''
* When writing data, the Nickname Writer will overwrite enemy party data. While this does not have any effect outside of battle, it is recommended to not use the Nickname Writer in battle.
* Make sure to only use the Nickname Writer inside a pokémon center to ensure that the checksums are correctly displayed.'''
* As a side effect, the Nickname Writer will overwrite the nicknames of the first party pokémon.
 
The program works as follows:
Line 330 ⟶ 334:
* This nickname then gets converted to a sequence of five bytes.
* All five bytes are written starting from the starting location
* The program displays a glitched overworld view, along with a checksum (sum of all written byte values) towards the top right of the screen to confirm that you correctly entered the code. '''If the printed checksum doesn't match the expected checksum, you made a mistake entering a code.''' The glitched overworld view is temporary and will not affect your game.
* Afterwards, it waits for the user to decide what to do.
 
During the input phase, the controls are as follows:
* '''Press A''' for the program to ask for a new nickname and convert that to the next five bytes to be written.
* '''Press B''' to go back one byte at a time. The checksum will automatically be overwritten by the value written at the current selected address, giving you a measure of how far back you're going. If a name is incorrect, press B five times before pressing A, entering the nickname again to overwrite the incorrect nickname.
* '''Press START''' to immediately start executing the newly written program. '''Only do this when you've finished writing everything.'''
* '''Press SELECT''' to safely quit the Nickname Writer, without executing the newly written code.
 
{| class="wikitable"
! Write mode !! Input mode
|-
! [[File:RB Name writer write mode.png|thumb]]!![[File:RB Name writer input mode.png|thumb]]
! [[File:RB Name writer input mode.png]]
|-
| PressEnter nickname, press select to switch between uppercase/lowercase || Checksum ("4E", in this case) is displayed rightas nexta tohex value on the top right ITEMquadrant
|}
 
During the input phase, the controls are as follows:
* '''Press A''' for the program to ask for a new nickname and convert that to the next five bytes to be written.
* '''Press B''' to go back one byte at a time. The checksum will automatically be overwritten by the value written at the current selected address, giving you a measure of how far back you're going. '''This function is only needed if you accidentally confirmed a nickname without writing all 10 characters.'''
* '''Press START''' to immediately start executing the newly written program. '''Only do this when you've finished writing everything.'''
* '''Press SELECT''' to safely quit the Nickname Writer, without executing the newly written code.
* '''Press any button on the D-pad''' to go back five bytes and ask for a new nickname to correct errors. '''Use this if the printed checksum does not match the predicted checksum and the last written nickname contained ten characters.'''
 
==Step 6: Returning the game state to normal==
Line 389 ⟶ 393:
D3 21 65 DA 36
6E 23 36 D6 01
01 59 CDC3 42 3E
</pre>
|-
Line 409 ⟶ 413:
D3 21 65 DA 36
6E 23 36 D6 01
01 59 CDC3 44 3E
</pre>
|-
Line 429 ⟶ 433:
D3 21 65 DA 36
6E 23 36 D6 01
01 59 CDC3 3D 3E
</pre>
|-
Line 449 ⟶ 453:
D3 21 65 DA 36
6E 23 36 D6 01
01 59 CDC3 44 3E
</pre>
|}
Line 467 ⟶ 471:
** Alters the exit of the poké center to lead out to Pallet Town
 
From this point onward, you can exit the Poké Centerpenthouse and continue the story as normal.
 
==Additional applications of the Nickname Writer==
 
The Nickname Writer allows you to easily write and execute arbitrary payloads. You can either make and execute your own codes, or head to the [[Guides:Nickname Writer Codes|Nickname Writer codes]] page. This page contains a collection of assembly for nickname codes that can be used for a variety of common purposes such as editing pokémon and items, editing player stats, resetting legendaries etc..
 
[[Guides:Nickname Writer Codes|Nickname Writer Codes]]
 
=Addendum: raw text transcripts of nickname codes=
Line 493 ⟶ 499:
|-
|<pre>
g . [ X. w] w, k Mn (* vPk
a* Pk( u z qz g ., [, . w] w,
a MnPk z pq yR ,r ,k .Mn gPk .X
z q Q P w w w w w w
g . Pk X w v w w : )
</pre>||<pre>
öü wu *v *ö wö wk ü m dM dl
ÜMn ;y wy wr üz u, v, ö. w] w,
aÜ Mn; zw pw y* ,* ,ü .m üv u
z p Q P w w w w w w
ü u u * w v w w * *
</pre>
|}
Line 513 ⟶ 515:
|-
| <pre>
ha Mnb Lv lv ) l L Ll tC td (d
tj v? u) tV t v uv tv sl tMn
jq ?p (y ty v] vz vy vp ;g [F
ta zPk j ? (t )K tK vb vc vc
aR qj Hj hm Hv Zw yw yP pP Qp
rl rl PM pv yU rU ju ?l ): )
sP kx lw lv :v ;W :M Vm Um Uw
qA yB [r xq wx vPk :z *g *g Mnh
Zi Pkz Z, *[ *o ]w Yo Mnx Mnw Lx
A( H) ]) .) w) ;, , :] u] k.
zj p! pU *? (? )u )w )v )u ,!
Sa jPk Ay Ho gx . p q A( A?
jr up lO l; u; z[ Mn: S; Mn: ];
q r A a i I h H h H
</pre>
|| <pre>
äa kb Lv lv l L L tÜ kU mÖ
lä üs uR tj t v uv tv sÜ tu
äq sp Sy äy vo v) v] vPk ;) [)
Äa ]- ä s St lK lK üb vc vc
aR qj Hj hm Hv Zw yw yP )P yp
rl rl PM pv qV äV äu sl )u )ü
sP kx lw lv Kv ÖW :M Vm Vm Vw
sA uB uÄ LS Üü ;ü ;Ü U u ?L
rT r- z- r A BÄ Ä S üZ üPk z r
AQ Hp h) Mn) T) -, -, Ä] Ä] S.
zÄ pz oy /[ ( )W )w )v )ü ,ü
Sa jPk Mn ü? ü! uU ÜM Kv Au Au
jr up lO l; w; v[ V: y; y: .;
t l L K L Ü : ; : ;
</pre>
|| <pre>
ha Mnb Lv lv ) l L Ll tC td (d
tj v? u) tV t v uv tv sl tMn
jq ?p (y ty v] vz vy vp ;g [F
tu zu j ? (t )K tK vb vc vc
aR qj Hj hm Hv Zw yw yP pP Qp
rl rl RM lv uV V u j ?l ): )
sP kx lw lv :v ;W :M Vm Vm Vw
qA yB [r xq wx vPk :z *g *g Mnh
Zi Pkz Z, *[ *o ]w Yo Mnx Mnw Lx
A( H) ]) .) w) ;, , :] u] k.
zj p! pU *? (? )u )w )v )u ,!
Sa jPk B A] g y . P p q Ap Ax
jr up lO l; v; x[ x: o; x: ;
q r A a i I h H h H
</pre>
|| <pre>
ha Mnb Lv lv ) l L Ll tC td (d
tj v? u) tV t v uv tv sl tMn
jq ?p (y ty v] vz vy vp ;g [F
ta z- j ? (t )K tK vb vc vc
aR qj Hj hm Hv Zw yw yP pP Qp
rl rl PM pv zV rV ju ?l ): )
sP kx lw lv :v ;W :M Vm Vm Vw
qA yB [r xq wx vPk :z *g *g Mnh
Zi Pkz Z, *[ *o ]w Yo Mnx Mnw Lx
A( H) ]) .) w) ;, , :] u] k.
zj p! pU *? (? )u )w )v )u ,!
ba LPk D, D, m- ?: s: kV Au Au
jr up lO l; u; z[ Z: Mn; Mn: ];
q r A a i I h H h H
</pre>
|}
Line 584 ⟶ 582:
===Explanation===
 
The item code itself consists of two components. The first 10 items are used to write a program that takes text characters from the nicknames of characters currently within the active box, converts them, then writes the resulting values to unused memory starting from $D66AD66E.
 
Pairs of text characters are converted to single values through a [(2a + b)%256] formula, where a is the value of the first character and b the value of the second. text terminators are skipped, the code will stop and execute the newly written code once it either reads a $00 value or if values are being read past $DEFF.
 
<pre>
11 6F6E D6 ld de, UNUSED_MEMORY ; Memory between $D66F and $D6F4 goes unused
D5 push de
21 0B0A DE ld hl, wBoxNicks
.loop
2A ldi a, (hl)
Line 607 ⟶ 605:
</pre>
 
The last item, the LeafX StoneAccuracy, simply form a pointer to $F32FF32E. Due to echo RAM this address is equivalent to $D32FD32E, which correspond to item #67's item ID, the start of the item code. By replacing the map script pointer with this item, we can redirect the map script routine to execute the item code instead. This routine is executed on every frame, as long as the start menu isn't open.
 
===Raw Assembly===
 
<pre>
11 6F6E Max Potion x111x110
D6 D5 TM14 x213
21 0B0A Thunderstone x11x10
DA 2A TM22 x42
03 87 Great Ball x135
Line 623 ⟶ 621:
F4 C9 TM44 x201
 
2F2E F3 Leaf Stone x243
</pre>
 
Line 646 ⟶ 644:
==4F Boostrap Nicknames==
 
This set of nicknames, when converted, will modify item #1's ID to be 4F and writes a bootstrap so that using it will lead to execution of the item code from $D328D32E onward. It requires the presence of the Infinite Eevee Mode Nickname (see previous section) to properly return.
 
<pre>
3E 59 ld a, $59 ; 4F's item ID
21 22 D3 ld hl, wBagItems ; item #1's ID
2236 59 ldild (hl), a$59 ; 4F's item ID
AF7C xorld a, h ; a = $00D3
21 66 DA ld hl, 4F_Execution_Pointer +2
22 ldi (hl), a
2232 ldildd (hl), a
22 ldi (hl), a
22 ldi (hl), a ; clears a bunch of $FF values placed by swapping party pokémon
21 64 DA ld hl, 4F_Execution_Pointer
3E 21 ld a, $21
22 ldi (hl), a
3E 2E ld a, $2E
22 ldi (hl), a
3E36 D3C3 ld a(hl), $D3C3
22 ldi (hl), a
36 E9 ld hl, $E9
; The contents of the first nickname (see previous section) are written right after this, ensuring safe return.
</pre>
Line 671 ⟶ 661:
 
<pre>
3E 59 21 22 D3 36 59
227C AF21 2266 22DA 2232
223E 212E 6432 DA36 3EC3
21 22 3E 2E 22
3E D3 22 36 E9
</pre>
 
Line 682 ⟶ 670:
===Explanation===
 
Using 4F, an invalid item, will cause the game to index the item effects table out of bounds, leading to an invalid execution pointer. For 4F, this causes the game to execute code from $FA65FA64 onward. Due to echo RAM, this address is equivalent to $DA65DA64. Thanks to the bootstrap that was applied earlier, this will then cause the game to jump to $D328D32E, corresponding to the start of the item code.
 
<pre>
21C3 2E D3 ldjp hl, ITEM_6_IDITEM_7_ID
E9 jp hl
</pre>
 
===Raw Assembly===
 
<pre>21C3 2E D3 E9</pre>
 
==Nickname Writer==
Line 704 ⟶ 691:
 
<pre>
11 A0B9 D8 ld de, $D8A0D8B9 ; location written to
D5 push de
.newMail
D5 push de
21 1E 63 ld hl, AskName + 39h ; Prepares data and calls DisplayNamingScreen
06 01 ld b, 01
CD 1A 39 call $391A ; sets b to 01, then jumps to Bankswitch, calling b:hl
21 56 63 ld hl, DisplayNameRaterScreen
CD 87 3E call BankSwitch ; Change rom banks and call b:hl
0E 80 ld c, $80 ; Ensure checksum consistency
21 4F CF ld hl, wStringBuffer ; Address where new name gets written to
Line 727 ⟶ 713:
18 F3 jp .newChar
.terminator
21 29 C4 ld hl, $C429 ; Corresponds to screen tile
0E 01 ld c, 01
D5 push de
21 00 C4 ld hl, $C400 ; Corresponds to screen tile
CD BC 13 call PrintBCDNumber.loop ; Prints c amount of bytes at de to hl in binary coded decimal format, prints checksum
0E 01 ld c, $01 ; How many bytes printed as numbers?
CD BC 13 call PrintBCDNumber.loop
.numLoop
2D dec l
CB FE set 7, (hl)
20 FB jp nz, .numLoop ; Repeat until hl == $C400
75 ld (hl), l ; Nulls out $C400
.inputLoop
CD 21 38 call JoypadLowSensitivity ; Halt execution until frame has passed, get joypad status and store result in hJoy5
F0 B5 ld a, (hJoy5)
E6 0F and $0F ; Set z flag if A, B, START, SELECT not pressed
28 F7 jp z, .inputLoop
1F rra ; Is A pressed? If yes, set c flag
D1 pop de
F038 B5CB ldjr ac, (hJoy5).newMail
A7 and a ; Check if no buttons are pressed
28 EE jp z, .terminator ; If no buttons pressed, keep displaying checksum
1F rra ; Shift all bits to the right, transfer former bit 7 to bit 1 and store status of this bit in c flag
38 CF jp c, .loop ; Is A is pressed, start new nickname
1B dec de ; If another button outside of A is pressed, either we're using the correction function, executing or stopping
1F rra ; is B pressed?
38 E7 jp c, .terminator ; If B is pressed, de has been decremented once so continue just displaying the new value de points towards
1F rra
1F rra ; Is START pressed?
D8 ret c ; Jump to $D89C, which was pushed to the stack at the start of the code and execute newly written code
1B dec de
1B dec de
1B dec de
1F rra ; Is B pressed? If yes, set c flag
1B dec de ; de's value has been decremented a total of 5 times, equal to a full nickname's worth of data
38 E1 jr c, .terminator
17 rla ; Shift all bits to the left, transfer former bit 7 to bit 1 and store status of this bit in c flag. Is SELECT pressed?
1F rra ; Is SELECT pressed? If yes, set c flag
30 C1 jp nc, loop ; If SELECT NOT pressed and dpad pressed instead, start new mail after de has been decremented a total of 5 times. Basically undoes a full nickname's worth of data
E1 pop hl ; Otherwise, pop the storedstarting address of $D89C from theto stackhl
C9D8 ret c ; SinceIf $D89CSELECT was poppedpressed, simply return to normal execution without executing newly written codeoperations
E9 jp hl ; If START pressed, jump to hl to execute newly written code
</pre>
 
Line 757 ⟶ 742:
 
<pre>
11 A0B9 D8 ld de, $D8A0D8B9 ; location written to
D5 push de
.newMail
D5 push de
21 AA 62 ld hl, AskName + 39h ; Prepares data and calls DisplayNamingScreen
06 01 ld b, 01
CD 1C 39 call $391C ; sets b to 01, then jumps to Bankswitch, calling b:hl
21 E2 62 ld hl, DisplayNameRaterScreen
CD 89 3E call BankSwitch ; Change rom banks and call b:hl
0E 80 ld c, $80 ; Ensure checksum consistency
21 4F CF ld hl, wStringBuffer ; Address where new name gets written to
Line 780 ⟶ 764:
18 F3 jp .newChar
.terminator
21 29 C4 ld hl, $C429 ; Corresponds to screen tile
0E 01 ld c, 01
D5 push de
21 00 C4 ld hl, $C400 ; Corresponds to screen tile
CD BF 13 call PrintBCDNumber.loop ; Prints c amount of bytes at de to hl in binary coded decimal format, prints checksum
0E 01 ld c, $01 ; How many bytes printed as numbers?
CD BF 13 call PrintBCDNumber.loop
.numLoop
2D dec l
CB FE set 7, (hl)
20 FB jp nz, .numLoop ; Repeat until hl == $C400
75 ld (hl), l ; Nulls out $C400
.inputLoop
CD 23 38 call JoypadLowSensitivity ; Halt execution until frame has passed, get joypad status and store result in hJoy5
F0 B5 ld a, (hJoy5)
E6 0F and $0F ; Set z flag if A, B, START, SELECT not pressed
28 F7 jp z, .inputLoop
1F rra ; Is A pressed? If yes, set c flag
D1 pop de
F038 B5CB ldjr ac, (hJoy5).newMail
A7 and a ; Check if no buttons are pressed
28 EE jp z, .terminator ; If no buttons pressed, keep displaying checksum
1F rra ; Shift all bits to the right, transfer former bit 7 to bit 1 and store status of this bit in c flag
38 CF jp c, .loop ; Is A is pressed, start new nickname
1B dec de ; If another button outside of A is pressed, either we're using the correction function, executing or stopping
1F rra ; is B pressed?
38 E7 jp c, .terminator ; If B is pressed, de has been decremented once so continue just displaying the new value de points towards
1F rra
1F rra ; Is START pressed?
D8 ret c ; Jump to $D89C, which was pushed to the stack at the start of the code and execute newly written code
1B dec de
1B dec de
1B dec de
1F rra ; Is B pressed? If yes, set c flag
1B dec de ; de's value has been decremented a total of 5 times, equal to a full nickname's worth of data
38 E1 jr c, .terminator
17 rla ; Shift all bits to the left, transfer former bit 7 to bit 1 and store status of this bit in c flag. Is SELECT pressed?
1F rra ; Is SELECT pressed? If yes, set c flag
30 C1 jp nc, loop ; If SELECT NOT pressed and dpad pressed instead, start new mail after de has been decremented a total of 5 times. Basically undoes a full nickname's worth of data
E1 pop hl ; Otherwise, pop the storedstarting address of $D89C from theto stackhl
C9D8 ret c ; SinceIf $D89CSELECT was poppedpressed, simply return to normal execution without executing newly written codeoperations
E9 jp hl ; If START pressed, jump to hl to execute newly written code
</pre>
 
Line 810 ⟶ 793:
 
<pre>
11 A0B9 D8 ld de, $D8A0D8B9 ; location written to
D5 push de
.newMail
D5 push de
21 E4 62 ld hl, AskName + 39h ; Prepares data and calls DisplayNamingScreen
06 01 ld b, 01
CD 15 39 call $3915 ; sets b to 01, then jumps to Bankswitch, calling b:hl
21 1C 63 ld hl, DisplayNameRaterScreen
CD 82 3E call BankSwitch ; Change rom banks and call b:hl
0E 80 ld c, $80 ; Ensure checksum consistency
21 4F CF ld hl, wStringBuffer ; Address where new name gets written to
Line 833 ⟶ 815:
18 F3 jp .newChar
.terminator
21 29 C4 ld hl, $C429 ; Corresponds to screen tile
0E 01 ld c, 01
D5 push de
21 00 C4 ld hl, $C400 ; Corresponds to screen tile
CD BF 13 call PrintBCDNumber.loop ; Prints c amount of bytes at de to hl in binary coded decimal format, prints checksum
0E 01 ld c, $01 ; How many bytes printed as numbers?
CD BF 13 call PrintBCDNumber.loop
.numLoop
2D dec l
CB FE set 7, (hl)
20 FB jp nz, .numLoop ; Repeat until hl == $C400
75 ld (hl), l ; Nulls out $C400
.inputLoop
CD 1C 38 call JoypadLowSensitivity ; Halt execution until frame has passed, get joypad status and store result in hJoy5
F0 B5 ld a, (hJoy5)
E6 0F and $0F ; Set z flag if A, B, START, SELECT not pressed
28 F7 jp z, .inputLoop
1F rra ; Is A pressed? If yes, set c flag
D1 pop de
F038 B5CB ldjr ac, (hJoy5).newMail
A7 and a ; Check if no buttons are pressed
28 EE jp z, .terminator ; If no buttons pressed, keep displaying checksum
1F rra ; Shift all bits to the right, transfer former bit 7 to bit 1 and store status of this bit in c flag
38 CF jp c, .loop ; Is A is pressed, start new nickname
1B dec de ; If another button outside of A is pressed, either we're using the correction function, executing or stopping
1F rra ; is B pressed?
38 E7 jp c, .terminator ; If B is pressed, de has been decremented once so continue just displaying the new value de points towards
1F rra
1F rra ; Is START pressed?
D8 ret c ; Jump to $D89C, which was pushed to the stack at the start of the code and execute newly written code
1B dec de
1B dec de
1B dec de
1F rra ; Is B pressed? If yes, set c flag
1B dec de ; de's value has been decremented a total of 5 times, equal to a full nickname's worth of data
38 E1 jr c, .terminator
17 rla ; Shift all bits to the left, transfer former bit 7 to bit 1 and store status of this bit in c flag. Is SELECT pressed?
1F rra ; Is SELECT pressed? If yes, set c flag
30 C1 jp nc, loop ; If SELECT NOT pressed and dpad pressed instead, start new mail after de has been decremented a total of 5 times. Basically undoes a full nickname's worth of data
E1 pop hl ; Otherwise, pop the storedstarting address of $D89C from theto stackhl
C9D8 ret c ; SinceIf $D89CSELECT was poppedpressed, simply return to normal execution without executing newly written codeoperations
E9 jp hl ; If START pressed, jump to hl to execute newly written code
</pre>
 
Line 863 ⟶ 844:
 
<pre>
11 A0B9 D8 ld de, $D8A0D8B9 ; location written to
D5 push de
.newMail
D5 push de
21 DC 62 ld hl, AskName + 39h ; Prepares data and calls DisplayNamingScreen
06 01 ld b, 01
CD 1C 39 call $391C ; sets b to 01, then jumps to Bankswitch, calling b:hl
21 14 63 ld hl, DisplayNameRaterScreen
CD 89 3E call BankSwitch ; Change rom banks and call b:hl
0E 80 ld c, $80 ; Ensure checksum consistency
21 4F CF ld hl, wStringBuffer ; Address where new name gets written to
Line 886 ⟶ 866:
18 F3 jp .newChar
.terminator
21 29 C4 ld hl, $C429 ; Corresponds to screen tile
0E 01 ld c, 01
D5 push de
21 00 C4 ld hl, $C400 ; Corresponds to screen tile
CD BF 13 call PrintBCDNumber.loop ; Prints c amount of bytes at de to hl in binary coded decimal format, prints checksum
0E 01 ld c, $01 ; How many bytes printed as numbers?
CD BF 13 call PrintBCDNumber.loop
.numLoop
2D dec l
CB FE set 7, (hl)
20 FB jp nz, .numLoop ; Repeat until hl == $C400
75 ld (hl), l ; Nulls out $C400
.inputLoop
CD 23 38 call JoypadLowSensitivity ; Halt execution until frame has passed, get joypad status and store result in hJoy5
F0 B5 ld a, (hJoy5)
E6 0F and $0F ; Set z flag if A, B, START, SELECT not pressed
28 F7 jp z, .inputLoop
1F rra ; Is A pressed? If yes, set c flag
D1 pop de
F038 B5CB ldjr ac, (hJoy5).newMail
A7 and a ; Check if no buttons are pressed
28 EE jp z, .terminator ; If no buttons pressed, keep displaying checksum
1F rra ; Shift all bits to the right, transfer former bit 7 to bit 1 and store status of this bit in c flag
38 CF jp c, .loop ; Is A is pressed, start new nickname
1B dec de ; If another button outside of A is pressed, either we're using the correction function, executing or stopping
1F rra ; is B pressed?
38 E7 jp c, .terminator ; If B is pressed, de has been decremented once so continue just displaying the new value de points towards
1F rra
1F rra ; Is START pressed?
D8 ret c ; Jump to $D89C, which was pushed to the stack at the start of the code and execute newly written code
1B dec de
1B dec de
1B dec de
1F rra ; Is B pressed? If yes, set c flag
1B dec de ; de's value has been decremented a total of 5 times, equal to a full nickname's worth of data
38 E1 jr c, .terminator
17 rla ; Shift all bits to the left, transfer former bit 7 to bit 1 and store status of this bit in c flag. Is SELECT pressed?
1F rra ; Is SELECT pressed? If yes, set c flag
30 C1 jp nc, loop ; If SELECT NOT pressed and dpad pressed instead, start new mail after de has been decremented a total of 5 times. Basically undoes a full nickname's worth of data
E1 pop hl ; Otherwise, pop the storedstarting address of $D89C from theto stackhl
C9D8 ret c ; SinceIf $D89CSELECT was poppedpressed, simply return to normal execution without executing newly written codeoperations
E9 jp hl ; If START pressed, jump to hl to execute newly written code
</pre>
 
Line 918 ⟶ 897:
 
<pre>
11 A0B9 D8 D5 D5
06 01 21 561E 63 CD 1A
CD 87 3E39 0E 80 21 4F
21 4F CF D1 2A 87 30
87 30 09 86 12 13 23
13 23 81 12 4F 18 F3
18 F3D5 21 2900 C4 0E
0E 01 D5 CD BC 13 2D
13CB CDFE 2120 38FB D1CD
F021 B538 A7F0 28B5 EEE6
1F0F 3828 CFF7 1B1F 1FD1
38 E7CB 1F1B 1F D838
1BE1 1B1F 1BE1 1BD8 17E9
30 C1 E1 C9 00
</pre>
 
Line 937 ⟶ 915:
 
<pre>
11 A0B9 D8 D5 D5
06 01 21 E2AA 62 CD 1C
CD 89 3E39 0E 80 21 4F
21 4F CF D1 2A 87 30
87 30 09 86 12 13 23
13 23 81 12 4F 18 F3
18 F3D5 21 2900 C4 0E
0E 01 D5 CD BF 13 2D
13CB CDFE 2320 38FB D1CD
F023 B538 A7F0 28B5 EEE6
1F0F 3828 CFF7 1B1F 1FD1
38 E7CB 1F1B 1F D838
1BE1 1B1F 1BE1 1BD8 17E9
30 C1 E1 C9 00
</pre>
 
Line 956 ⟶ 933:
 
<pre>
11 A0B9 D8 D5 D5
0621 01E4 2162 1CCD 6315
CD 82 3E39 0E 80 21 4F
21 4F CF D1 2A 87 30
87 30 09 86 12 13 23
13 23 81 12 4F 18 F3
18 F3D5 21 2900 C4 0E
0E 01 D5 CD BF 13 2D
13CB CDFE 1C20 38FB D1CD
F01C B538 A7F0 28B5 EEE6
1F0F 3828 CFF7 1B1F 1FD1
38 E7CB 1F1B 1F D838
1BE1 1B1F 1BE1 1BD8 17E9
30 C1 E1 C9 00
</pre>
 
Line 975 ⟶ 951:
 
<pre>
11 A0B9 D8 D5 D5
0621 01DC 2162 14CD 631C
CD 89 3E39 0E 80 21 4F
21 4F CF D1 2A 87 30
87 30 09 86 12 13 23
13 23 81 12 4F 18 F3
18 F3D5 21 2900 C4 0E
0E 01 D5 CD BF 13 2D
13CB CDFE 2320 38FB D1CD
F023 B538 A7F0 28B5 EEE6
1F0F 3828 CFF7 1B1F 1FD1
38 E7CB 1F1B 1F D838
1BE1 1B1F 1BE1 1BD8 17E9
30 C1 E1 C9 00
</pre>
 
Line 1,321 ⟶ 1,296:
D3 21 65 DA 36
6E 23 36 D6 01
01 59 CDC3 42 3E
</pre>
 
Line 1,332 ⟶ 1,307:
D3 21 65 DA 36
6E 23 36 D6 01
01 59 CDC3 44 3E
</pre>
 
Line 1,343 ⟶ 1,318:
D3 21 65 DA 36
6E 23 36 D6 01
01 59 CDC3 3D 3E
</pre>
 
Line 1,354 ⟶ 1,329:
D3 21 65 DA 36
6E 23 36 D6 01
01 59 CDC3 44 3E
</pre>
 
1,514

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.