Guides:TMless 0x1500 ACE (JP): Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
mNo edit summary
No edit summary
 
Line 43: Line 43:
## If the newly deposited pokémon’s nickname was changed to a bunch of question marks, you can continue with the next step. If the pokémon wasn't saved, that means the reset too early. If the pokémon was cloned, this means the reset was too late.
## If the newly deposited pokémon’s nickname was changed to a bunch of question marks, you can continue with the next step. If the pokémon wasn't saved, that means the reset too early. If the pokémon was cloned, this means the reset was too late.
## If the amount of pokémon in the box exceeds 15, release the cloned pokémon and save the game afterwards to set the amount of stored pokémon to 15 before repeating step 2.
## If the amount of pokémon in the box exceeds 15, release the cloned pokémon and save the game afterwards to set the amount of stored pokémon to 15 before repeating step 2.
# Now that you have an unterminated name pokémon, '''put it in box 5'''. Either release or move all other pokémon in the box so that the unterminated name pokémon is the only pokémon left in box 5.
# Now that you have an unterminated name pokémon, '''put it in box 3'''. Either release or move all other pokémon in the box so that the unterminated name pokémon is the only pokémon left in box 3.
# Finally, make sure to set box 5 as the active box.
# Finally, make sure to set box 3 as the active box.


=Setting up a ACE environment=
=Setting up a ACE environment=
Line 55: Line 55:


To do that, we're going to use a box name code that does the following:
To do that, we're going to use a box name code that does the following:
- It will alter box names so that the Mail Writer can be used afterwards.
- It will alter box #7's name so that the Mail Writer can be used afterwards.
- It will change the first item in the main item pocket to a TM15
- It will change the first item in the main item pocket to a TM15
- It will modify data to ensure that using this TM15 will allow us to use the mail writer
- It will modify data to ensure that using this TM15 will allow us to use the mail writer
Line 71: Line 71:
|}
|}


Upon using 0x1500 ACE, this box code will be executed and will replace the first item of the main item pocket with a TM15. Alongside that, it will install a setup so that using this TM15 will execute box name codes. Finally, it will write two values to the box #7 and box #9's names that will allow the Mail Writer to properly function.
Upon using 0x1500 ACE, this box code will be executed and will replace the first item of the main item pocket with a TM15. Alongside that, it will install a setup so that using this TM15 will execute box name codes. Finally, it will write a $38 value to box #7's name, to allow the Mail Writer to properly function.


Once that is done, you can use TM15 at any time to run the Mail Writer. More details on the Mail Writer can be found in the next guide.
Once that is done, you can use TM15 at any time to run the Mail Writer. More details on the Mail Writer can be found in the next guide.
Line 82: Line 82:
* Slots 2-6 aren't relevant for this setup.
* Slots 2-6 aren't relevant for this setup.


Make sure that box 5 is set as the current active box, make sure that the unterminated name pokémon is the only pokémon present in box 5.
Make sure that box 3 is set as the current active box, make sure that the unterminated name pokémon is the only pokémon present in box 3.


In order to execute ACE, do the following actions:
In order to execute ACE, do the following actions:
Line 98: Line 98:
# Open the PC. Open the withdraw screen so that the unterminated name pokémon's name would be displayed. Displaying this name will trigger ACE. If the screen stays white, press "A" a couple of times until the box view reappears.
# Open the PC. Open the withdraw screen so that the unterminated name pokémon's name would be displayed. Displaying this name will trigger ACE. If the screen stays white, press "A" a couple of times until the box view reappears.


If the game doesn't crash, the setup was a success. You should now have a TM15 in the main item pocket, the names of box 7 and box 9 have now been changed.
If the game doesn't crash, the setup was a success. You should now have a TM15 in the main item pocket, the name of box 7 has now been changed.


==Step 5: Finishing the Mail Writer==
==Step 5: Finishing the Mail Writer==


Lastly, rename the names of boxes #1 through #5 so that all box names fit the following image. '''Make sure to not change the names of box #7 and box #9.'''
Lastly, rename the names of boxes #3 through #6 so that all box names fit the following image. '''Make sure to not change the names of box #7.'''


{| class="wikitable" style="margin-left: auto; margin-right: auto; border: none;"
{| class="wikitable" style="margin-left: auto; margin-right: auto; border: none;"
Line 130: Line 130:


Between entering mail codes, the mail writer will ask for user input.
Between entering mail codes, the mail writer will ask for user input.
* '''Press A''' to open a new mail and continue writing data.
* '''Press B''' to immediately jump to and start executing the newly written program. '''Only use this when you've finished every mail.'''
* '''Press B''' to immediately jump to and start executing the newly written program. '''Only use this when you've finished every mail.'''
* '''Press any other button''' to go back one byte at a time to correct errors. '''If the printed checksum doesn't match the expected checksum, press DOWN 16 times to retry the last mail.''' This will also overwrite the printed checksum with the value at the currently selected address, giving you a method to check how far back you're going.
* '''Press DOWN''' to go back one byte at a time to correct errors. '''If the printed checksum doesn't match the expected checksum, press DOWN 16 times to retry the last mail.''' This will also overwrite the printed checksum with the value at the currently selected address, giving you a method to check how far back you're going.
* '''Press any other button''' to open a new mail and continue writing data.


'''Due to space limitations, it is not possible to exit the Mail Writer without executing the newly written code. If you accidentally start the Mail Writer, you can safely exit by writing a mail with the contents "セス" and execute it.'''
'''Due to space limitations, it is not possible to exit the Mail Writer without executing the newly written code. If you accidentally start the Mail Writer, you can safely exit by writing a mail with the contents "セス" and execute it.'''
Line 148: Line 148:
* 0x1500 Control Code ACE box name code
* 0x1500 Control Code ACE box name code


<pre>       
<pre>       
   ぼ   に ジ
ゆ げ   ぼ   
    ヌ ゥ モ
   て エ ろ
が れ ぜ デ づ に セ づ
ゥ あ ろ ゅ の
ゅ ゅ て     
 て づ に    
       
       
ビ ヘ チ チ が ビ ブ ギ
ビ ヘ チ チ が ビ ブ ギ
ぜ セ げ ま き ぐ ァ 
ぜ セ げ ま き ぐ ァ 
    ダ リ だ 
    ダ リ だ 
</pre>
</pre>


* Setting up the Mail Writer
* Mail Writer


<pre>が       
<pre>が       ぜ ぜ
   ぼ   よ シ
ゆ げ   ぼ   
き き む ゅ ご き き よ
ゥ モ ろ ゥ あ ろ よ む
      ゅ の 
       
キ デ ド ア ぺ デ ご ?
キ デ ド ア ぺ デ ご ?
だ ! ズ が な ぜ ォ ギ
だ ! ズ が な ぜ ォ ギ
ビ ヘ チ  が ビ ブ ギ
ビ ヘ チ レ ッ ド が ビ ブ ギ
ぜ セ げ ま き ぐ ァ 
ぜ セ げ ま き ぐ ァ 
    ダ リ だ </pre>
    ダ リ だ </pre>


==In-depth explanation of the setup==
==In-depth explanation of the setup==
Line 241: Line 241:
7F ld a, a
7F ld a, a
7F ld a, a
7F ld a, a
E5 push hl
7F ld a, a
7F ld a, a
7F ld a, a
7F ld a, a
7F ld a, a
Line 252: Line 252:
7C ld a, h
7C ld a, h
7C ld a, h
7C ld a, h
AF xor a ; a = $00, name of the current active box is printed here
E1 pop hl
C6 DB add $DB ; a = $DB
E1 pop hl
C3 91 DB jp $DB91 ; 6th character of box name #5
C3 83 DB jp $DB83 ; 1st character of box name #4
</pre>
</pre>


===Effect of the box name code===
===Effect of the box name code===


In the context of 0x1500 Control Code ACE, only box name #1 through box name #5 are executed. Box name #6 through box name #9 are part of the Mail Writer and will be discussed in the next section only:
In the context of 0x1500 Control Code ACE, only box name #3 through box name #6 are executed. Box name #1, #2 and #7 through #9 are part of the Mail Writer and will be discussed in the section after this section:


<pre>
<pre>
Box 3: $DB7A ; Executed as part of screen data, see previous section
Box 1: $DB68
AF xor a ; a = $00
C6 DB add $DB ; a = $DB
C3 83 DB jp $DB83

26 DA ld h, $DA
26 DA ld h, $DA
2E 12 ld l, 12
2E 12 ld l, 12
Line 268: Line 272:
C6 50 add $50 ; a = $2B
C6 50 add $50 ; a = $2B


Box 4: $DB83 ; Landing point after screen data
Box 2: $DB71
C6 3D add $3D ; a = $68
26 DA ld h, $DA
2E 12 ld l, 12
32 ldd (hl), a
32 ldd (hl), a
C6 8D add $86 ; a = $68
32 ldd (hl), a
50 ld d, b

Box 5: $DB8C
3E C3 ld a, $C3 ; a = $C3
3E C3 ld a, $C3 ; a = $C3
32 ldd (hl), a
32 ldd (hl), a
C6 0B add $0B ; a = $CE
C6 0B add $0B ; a = $CE
EA 86 D8 ld(wItems), a
50 ld d, b
50 ld d, b


Box 3: $DB7A
Box 6: $DB95
EA 86 D8 ld(wItems), a
D6 96 sub $96 ; a = $38
D6 96 sub $96 ; a = $38
EA A1 DB ld($DBA1), a
EA A1 DB ld($DBA1), a
50 ld d, b
E1 pop hl

Box 4: $DB83
EA B1 DB ld($DBB1), a
E1 pop hl
E1 pop hl
C9 ret
C9 ret

Box 5: $DB8C ; first five characters aren't executed as box names and are instead buffered to screen data.

E1 pop hl
E1 pop hl
C3 91 DB jp $DB91 ; 6th character of box name #5
AF xor a ; Reset carry flag, entry point of jump from screen data
30 D4 jr nc, $D4 ; Will jump to $DB68, the start of box names
</pre>
</pre>


Line 312: Line 311:
29 add hl, hl ; hl = $5CA0
29 add hl, hl ; hl = $5CA0
2E EB ld l, $EB ; hl = $5CEB
2E EB ld l, $EB ; hl = $5CEB
3E 05 ld a, $05
3E 84 ld a, $84
CF rst08h ; farCall _ComposeMailMessage (a:hl = 04:5CEB), most significant bit gets ignored when changing ROM banks
3D dec a ; a = $04
42 ld b, d
2E 50 ld l, $50
50 ld d, b


Box 3: $DB7A
Box 3: $DB7A
B7 or a
B7 or a
B7 or a
CF rst08h ; farCall _ComposeMailMessage (a:hl = 04:5CEB)
D1 pop de
D1 pop de
E1 pop hl ; Set both hl and de to the start of the newly written mail
E1 pop hl ; Set both hl and de to the start of the newly written mail
Line 346: Line 344:


Box 6: $DB95
Box 6: $DB95
30 E7 jr nc, .loop
30 E9 jr nc, .loop
0C inc c ; .terminator, _ComposeMailMessage sets bc to 0000, so c = 01 after this part
0C inc c ; .terminator, _ComposeMailMessage sets bc to 0000, so c = 01 after this part
26 C5 ld h, $C5
26 C5 ld h, $C5
Line 354: Line 352:
Box 7: $DB9E
Box 7: $DB9E
1A ld a, (de)
1A ld a, (de)
CD 90 38 call PrintBCDNumber.loop + 01h ; PrintBCDNumber.loop itself can't be reached, so we skip forward one byte.
CD 90 38 call PrintBCDNumber.loop + 01h ; PrintBCDNumber.loop itself can't be reached, so we skip forward one byte. $38 is written by the previous box name code.
26 1A ld h, $1A ; .errorCorrection
26 1A ld h, $1A ; .errorCorrection
1B dec de ; Calling PrintBCDNumber.loop with c = 01 advances de by 1.
1B dec de ; Calling PrintBCDNumber.loop with c = 01 advances de by 1.
06 50 ld b, $50
06 50 ld b, $50


Box 8: $DBB0
Box 8: $DBA7
2E 8D ld l, $F4 ; hl = $1A8D
2E 8D ld l, $F4 ; hl = $1A8D
29 add hl, hl ; hl = $351A (address of JoyTextDelay_ForcehJoyDown)
29 add hl, hl ; hl = $351A (address of JoyTextDelay_ForcehJoyDown)
Line 365: Line 363:
B7 or a, a ; Are any buttons pressed? if not, ask for new button states
B7 or a, a ; Are any buttons pressed? if not, ask for new button states
28 E9 jr z, .terminator
28 E9 jr z, .terminator
D6 50 sub $50 ; if down is pressed, carry is reset if any other button is pressed, carry is set
42 ld b, d
50 ld d, b


Box 9: $D8FA
Box 9: $DBB0
D2 A2 DB jp nc, .errorCorrection
0F rlca ; Is the a button pressed? If yes, start a new mail
0F rlca
38 B9 jr c, .loop
0F rlca ; Is the b button pressed? If yes, carry is set
40 ld b, b
D8 ret c ; Exit and execute code if B is pressed. Else, start new mail
0F rlca ; Is the b button pressed? If yes, return and execute newly written program.
30 B4 jr nc, .loop
D8 ret c ; If not, another button was pressed, so decrement de to allow user to correct errors
30 EA jr nc, .errorCorrection
</pre>
</pre>