Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2010-12-29 02:21:45

88/703

Crystal scripting information

Tauwasser sent me a mail recently, so I thought I’d post some excerpts here. It was a response to my query in another thread:

IIMarckus wrote:

Do you know what 0x52 does in Crystal? Or the other commands that were added to the end, after 0xA4? As I recall Crystal’s 0x52 acted just like Crystal’s 0x51, but I didn’t check the code to be sure. (I haven’t looked at this in a long time and my numbers might be wrong, but you know what I mean.)

“First off, I double checked and it is 0x52, so you might have it confused.

“I have looked into 0x52 some time ago, basically it is a 3byte-version of the 0x51 command, so it’s pretty much redundant, since the text routine itself can target text outside of the current bank.

“The other stuff I haven’t really looked into. My notes suggest that 0x9F is another instance of a code being squeezed into there. So basically 9D → 9E, 9E → A0. (Gold Code → Crystal code, corrected for 0x52 and 0x9F).

“9F is a version of Gold’s 9D which can be used to give a number of items depending on values of ram entries checked by code 1C. However, the Crystal 1C table is somewhat different from Gold's IIRC.

“Old "9E Load special wild PKMN data" has also a boolean flag in front of map bank and map no (1 byte), for selecting an third alternate set of pokemon it seems.

“That's pretty much all my notes had to say about those two codes. …

“Also, if you're interested in Phone Adapter stuff, I looked into that semi-recently (and found out that restoring or even using the adapter cannot easily be done, as all the code in the mainloop that checks for the adapter being plugged in during play is not called at all), I attached a small battle tower decompiled script which gives some insight into some of the functionality. Mind you, it's a US version script, so the functionality behind them between Japanese and US version differs (for instance with the GS Ball send, which was reworked into a possible give-away by editing the savegame, see http://tcrf.net/Pokémon_Crystal.”

Script Header:

02        - Two first parts
9D 63 00 00    - Script Trigger 0x00
D3 63 00 00    - Script Trigger 0x01
00        - No second part


Script Trigger 0x00:
15 09 0F 86 00    //Check mobile adapter 0x09
08 D1 63    //No: goto deactivateTrigger
15 02 0F 86 00     //Check mobile adapter 0x02
06 00 D1 63     //Case 0x00: goto deactivateTrigger
06 02 C4 63     //Case 0x02: goto invalidateChallenge
06 03 D1 63     //Case 0x03: goto deactivateTrigger
06 04 D1 63     //Case 0x04: goto deactivateTrigger

        //default:
47 4C 37 70 54 49    //Link battle ready, please follow.
8D 4E 64 91        //priority jump initFightRoom

invalidateChallenge:
8D 55 65     //priority jump invalidateChallengeText
15 04 0F 86 00     //check mobile adapter 0x04
15 06 0F 86 00     //check mobile adapter 0x06
        //$FALL-THROUGH$

Script Trigger 0x01:
deactivateTrigger:
14 01        //activate trigger 0x01
91        //end script

BattleTower Rules Signpost:
47 4C 3C 6D 4E 08 E0 63 4C 72 6D 54 49 91

//
15 02
.wait:
0F 86 00    //check mobile adapter 0x02
06 03 E4 74    //case 0x03: goto .wait
        //default:
47 4C AB 65 55    //"BATTLE TOWER welcomes you! I could show you to a BATTLE ROOM."
15 00 0F 86 00     //check mobile adapter 0x00
07 00 FC 63     //case !=0x00: goto explanationHeard
03 9E 64    //goto battleTowerExplanationText

explanationHeard
4C EA 65    //"Want to go into a BATTLE ROOM?"
15 01 0F 88 00    //?? 0x01
06 01 0F 64    //case 0x01: goto __640F
06 02 A5 64    //case 0x02: goto showExplanation
        //default:
03 B0 64    //goto hopeToServeYouAgain

__640F
15 1A 0F 86 00     //check mobile adapter 0x1A
0F 7C 00    //
07 00 BB 64    //case !=0x00: goto exitText

4C 1F 6F    //"Before entering the BATTLE ROOM, your progress will be saved."
4E 08 FC 63    //No: goto explanationHeard

14 00         //activate trigger 0x00
0F 04 00    //save game dialogue,
08 FC 63    //cancel goto explanationHeard

14 01         //activate trigger 0x01

15 01 0F 86 00    //check mobile adapter 0x01
0F 74 00
06 0A FC 63    //case 0x0A: goto explanationHeard
07 00 50 65    //case !=00: goto __6550
15 11 0F 86 00    //check mobile adapter 0x11
4C 0A 66 54 49    //"Right this way to your BATTLE ROOM."
15 1E 0F 86 00    //check mobile adapter 0x1E
03 54 64    //goto initFightRoomOtherCheck

initFightRoom:
49
15 08 0F 86 00    //check mobile adapter 0x08

initFightRoomOtherCheck
81 00 00 08    //music fade-out to off
12 16 0C 00    //activate trigger 0x00 on map 16.0C
12 16 0D 00    //activate trigger 0x00 on map 16.0D
12 16 0E 00    //activate trigger 0x00 on map 16.0E
70 02 00    //Person 0x00 follow person 0x02
69 02 71 65    //Person 0x02 go __6571
15 0A 0F 86 00    //check mobile adapter 0x0A
87        //warp sound
6E 02        //hide person 0x02
71        //stop following
69 00 76 65    //Person 0x00 go __6576
8E        //check warp under hero
91        //end script

__647A:
15 1C 0F 86 00    //check mobile adapter 0x1C
15 1B 0F 86 00    //check mobile adapter 0x1B
06 12 98 64    //case 0x12: goto
41 00 01    //Display item name 0x100??
1F FF 05    //Give 0x05 times last item no in RAM
4C 7E 6B     //"HERO got five @CD1A!"

15 1D 0F 86 00    //check mobile adapter 0x1D
49 91        //end script

packFull:
4C 94 6B    //"Oops, your PACK is stuffed full. Please make room and come back."

exitText:
54 49 91    //exit text box and end script

battleTowerExplanationText:
4C 3D 6C    //"Would you like to hear about the BATTLE TOWER?"
4E 08 A8 64    //No: goto .afterExplanation

showExplanation
4C 86 68    //Battle tower explanation

.afterExplanation
15 01 0F 86 00    //check mobile adapter 0x01
03 FC 63    //goto explanationHeard

hopeToServeYouAgain:
4C 09 6C 54 49 91    //"We hope to serve you again."

__64B6:
0F 8B 00 49 91

.endDialogue:
54 49 91

__64BE
4C 1F 6F    //"Before entering the BATTLE ROOM, your progress will be saved."
4E 08 FC 63    //No: goto explanationHeard
0F 04 00    //save game dialogue,
08 FC 63    //cancel goto explanationHeard

15 01 0F 86 00    //check mobile adapter 0x01
0F 75 00    //
06 0A FC 63    //case 0x0A: goto explanationHeard
07 00 50 65    //case !=0x00: goto __6550
        //case 0x00:
4C EB 69    //"Received a list of LEADERS on the HONOR ROLL."
76 02 02    //change facing of person 0x02 to 0x02
4C 1B 6A 54    //"Please confirm on*this monitor."
76 02 00    //change facing of person 0x02 to 0x00
49 91        //end script

__64EA:
15 18 0F 86 00    //check mobile adapter 0x18
07 00 42 65    //case !=0x00: goto levelExceeded
15 19 0F 86 00    //check mobile adapter 0x19
07 00 49 65    //case !=0x00: goto levelUnder70
0F 7C 00
07 00 BB 64    //case !=0x00: goto .endDialogue
15 05 0F 86 00    //check mobile adapter 0x05
06 00 12 65    //case 0x00: goto
4C B0 6C    //"Your record from the previous BATTLE ROOM can't be registered. Also, the existing record will be deleted. OK?"

03 15 65    //goto .question


4C 6D 6C    //"Your record from the previous BATTLE ROOM can't be registered. OK?"

.question:
4E 08 FC 63    //No: goto explanationHeard

4C 79 6F    //"Your record will be SAVED before you go back into the previous ROOM."
4E 08 FC 63    //No: goto explanationHeard
14 00        //activate trigger 0x00
0F 04 00    //save game dialogue,
08 FC 63    //cancel goto explanationHeard
14 01        //activate trigger 0x01
15 06 0F 86 00    //check mobile adapter 0x06
15 12 0F 86 00    //check mobile adapter 0x12
4C 0A 66 54    //"Right this way to your BATTLE ROOM."

03 4E 64    //goto initFightRoom


4C 76 70 54    //"You may enter only five BATTLE ROOMS each day. Please come back tomorrow."

03 B0 64    //goto hopeToServeYouAgain

levelExceeded:
4C E5 71 54    //"One or more of your POKéMON's levels exceeds @num(C2DD, 1 byte/3 figs)."

03 FC 63    //goto explanationHeard

levelUnder70:
4C 17 72 54    //"@CD49 may not enter a BATTLE ROOM under L70. This BATTLE ROOM is for L@num(C2DD, 1 byte/3 figs)."

03 FC 63    //goto explanationHeard

__6550:
0F 8B 00 49 91

invalidateChallengeText:
47 4C 18 6E 54
03 B0 64    //goto hopeToServeYouAgain

6B        //turn head to hero
47 4C 64 72 54    //"Destroyed by the first opponent in no time at all... I'm no good..."
49
76 03 03    //change facing of person 0x03 to 0x03
91        //end script

51 A4 72    //"There are lots of BATTLE ROOMS, but I'm going to win them all!"

51 5B 73    //"I'm trying to see how far I can go using just bug POKéMON. Don't let there be any fire POKéMON..."

51 E3 72    //"It's a grueling task, not being able to use items in battle. Making your POKéMON hold items is the key to winning battles."

__6571:
0D 0D 0D 0D 0D    //5 steps up
__6576:
0D 47        //1 step up, end walking

__6578:
0C 47 0F 0F 0F 0F 0D 0F 02 47 0E
0E 0E 0E 0E 0E 0D 0E 03 47 0D 0D 0D 0D 03 47 08
08 08 02 47 01 09 09 09 47 0B 0B 09 09 47 08 08
0A 0A 03 47 00 47 03 47

#2 2011-11-16 15:26:51

tysonrss
Member
From: US, Ohio
Registered: 2011-08-27
Post 150/649

Re: Crystal scripting information

i just merely changed a byte and the nurse gave me the gs ball, so hacking the save isn't required. just saying.


Pokemon Blue DX is reborn!

Offline

#3 2011-11-16 18:41:21

Tauwasser
Member
Registered: 2010-10-16
Post 218/452

Re: Crystal scripting information

tysonrss wrote:

i just merely changed a byte and the nurse gave me the gs ball, so hacking the save isn't required. just saying.

That part is obvious. It's just somewhat more proper to do it the right way :D

cYa,

Tauwasser

Offline

Board footer

Powered by FluxBB