Scripting Compendium

Gold/Silver

Introduction:

-------------

 

Scripts are used in Pokémon games to make the interaction with persons, items and special events possible. This compendium relates to gold and silver! It will explain the structure of each single scripting code. These codes are found in form of bytes in the rom and this is what is called a script.

To find scripts, refer to the event structure and the script header to find documentation about script pointers.

This tutorial is not meant for beginners, because some elementary knowledge is required; People should make sure that they don’t confuse this with a Step-by-step tutorial for hacking.

 

- Tauwasser

 

 

Contents:

---------

 

-          Introduction

-          Scripting

-          Application examples

-          Additional table A

-          Additional table B

-          Additional data structures A

-          Additional documentations

-          Glossary

-          Event structure

-          In-text codes

-          Script header

-          Credits

 

 

Short overview:

---------------

 

00 = Pointer code [2b+ret]

01 = Pointer code [3b+ret]

02 = Pointer code [2b+3b+ret]

03 = Pointer code [2b]

04 = Pointer code [3b]

05 = Pointer code [2b+3b]

06 = RAM check [=byte]

07 = RAM check [<>byte]

08 = RAM check [=0]

09 = RAM check [<>0]

0A = RAM check [<byte]

0B = RAM check [>byte]

0C = 0C codes [xxyy]

0D = 0D codes [xxyy]

0E = ASM code1 [3b]

0F = 0F codes [xxyy]

10 = ASM code2 [2b]

11 = Trigger event check1 [xxyy]

12 = Activate trigger event from afar [xxyyzz]

13 = Trigger event check

14 = De-/activate trigger event [xx]

15 = Load variable into RAM [xx]

16 = Add variables [xx]

17 = Random number [xx]

18 = Version check

19 = Copy variable code1 [xxyy]

1A = Copy variable code2 [xxyy]

1B = Load variable [xxyyzz]

1C = Check codes [xx]

1D = Input code1 [xx]

1E = Input code2 [xxyy]

1F = Give item code [xxyy]

20 = Take item code [xxyy]

21 = Check for item code [xx]

22 = Give money code [xxyyzzaa]

23 = Take money code [xxyyzzaa]

24 = Check for money code [xxyyzzaa]

25 = Give coins code [xxyy]

26 = Take coins code [xxyy]

27 = Check for coins code [xxyy]

28 = Give cell phone number [xx]

29 = Take cell phone number [xx]

2A = Check for cell phone number [xx]

2B = Check time of day [xx]

2C = Check for PKMN [xx]

2D = Give PKMN [xxyyzzaa(+2b +2b)]

2E = Give EGG [xxyy]

2F = Attach item code [2B]

30 = Check letter code [2b]

31 = BitTable1 check [xxyy]

32 = BitTable1 reset [xxyy]

33 = BitTable1 set [xxyy]

34 = BitTable2 check [xxyy]

35 = BitTable2 reset [xxyy]

36 = BitTable2 set [xxyy]

37 = Deactivate PKMN battles

38 = Activate PKMN battles

39 = X/Y comparison [xxyy]

3A = Warp modifier [xxyyzz]

3B = Blackout modifier [xxyy]

3C = Warp code [xxyyzzaa]

3D = Account code [xxyy]

3E = Coin case code [xx]

3F = Display RAM [xx]

40 = Display PokéMon name [xxyy]

41 = Display item name [xxyy]

42 = Display location name [xx]

43 = Display trainer name [xxyyzz]

44 = Display strings [2b + xx]

45 = Stow away item code

46 = Full item pocket code

47 = Text box&font code

48 = Refresh code [xx]

49 = Load moving sprites

4A = Load byte to C1CE [xx]

4B = Display text [3b]

4C = Display text [2b]

4D = Repeat text [xxyy]

4E = YES/No box

4F = Menu data code [2b]

50 = Write backup code

51 = Text1 code [2b]

52 = Text2 code [2b]

53 = Close text box code

54 = Keep text box open code

55 = Pokémon picture code [xx]

56 = Pokémon picture YES/NO code

57 = Menu interpreter 1

58 = Menu interpreter 2

59 = Load Pikachu data

5A = Delete FightRAM/reset person check

5B = Load trainer data1

5C = Load Pokémon data [xxyy]

5D = Load trainer data2 [xxyy]

5E = Start battle

5F = Return to In game engine after battle

60 = Learn how to catch PKMN [xx]

61 = Trainer text code

62 = Trainer status code [xx]

63 = Pointer Win/Loss [2b + 2b]

64 = Script talk-after

65 = Script talk-after-cancel

66 = Script talk-after-check

67 = Set talked-to person [xx]

68 = Moving code [xx + 2b]

69 = Moving code for talked-to person [2b]

6A = Talk-to facing code

6B = Facing of people code [xxyy]

6C = Variable sprites [xxyy]

6D = Hide person [xx]

6E = Show person [xx]

6F = Following code1 [xxyy]

70 = Stop following code

71 = Move person [xxyyzz]

72 = Write person location [xx]

73 = Load emoticons [xx]

74 = Display emoticon [xxyyzz]

75 = Change facing [xxyy]

76 = Following code2 [xxyy]

77 = Earth quake [xx]

78 = Exchange map [3b]

79 = Change block code [xxyyzz]

7A = Reload map code

7B = Reload map part code

7C = Write command queue

7D = Delete command queue

7E = Song code1 [xxyy]

7F = Song code2

80 = Music fade-out code [xxyy][zz]

81 = Play map music code

82 = Map reload music code

83 = Cry code [xx00]

84 = Sound code [xxyy]

85 = Key-down code

86 = Warp sound

87 = Special sound

88 = Engine remote control [2b]

89 = Load map anew [xx]

8A = Waiting code [xx]

8B = Deactivate static facing [xx]

8C = Priority jump1 [2b]

8D = Warp check

8E = Priority jump2 [2b]

8F = Return code1

90 = Return code2

91 = Return code3

92 = Reset sophisticated functions

93 = Mart menu [xxyyzz]

94 = Elevator menu [2b]

95 = Trade menu [xx]

96 = Give cell phone number with YES/NO [xx]

97 = Call code [2b]

98 = Hang-up code

99 = Decoration code [xx]

9A = Fruit tree code [xx]

9B = Cell phone call code [xx00]

9C = Check cell phone call code

9D = Commented give item code [xxyy]

9E = Load special wild PKMN data [xxyy]

9F = Hall of Fame code

A0 = Credits code

A1 = Facing warp

A2 = MEMORY code [2b + Bank + xx]

A3 = Display any location name [xx]

 

 

00-05 Pointer codes:                                                     Top

--------------------

 

Codes :

 

00 = 2byte pointer points to script; when pointed script ends --> return to old script

01 = 3byte pointer points to script; when pointed script ends --> return to old script

02 = 2byte pointer points to 3byte pointer; when pointed script --> return to old script

03 = 2byte pointer points to script; new script is part of main script

04 = 3byte pointer points to script; new script is part of main script

05 = 2byte pointer points to 3byte pointer; new script is part of main script

 

 

Structures :

 

[Code][resp. pointer(2byte or 3byte)]

 

06-0B RAM checks:                                                        Top

-----------------

 

06: When [RAM]=byte ...

07: When [RAM]<>byte ...

08: When [RAM]=0 ...

09: When [RAM]<>0 ...

0A: When [RAM]<byte ...

0B: When [RAM]>byte ...

 

... then go to pointed script, else resume interpreting after the pointer

 

Structure :

 

[Code][2byte pointer]

 

See application example.

 

0C codes:                                                                Top

-----------

 

Calls predefined scripts. After this code the script ends.

 

Structure: [0C][xxyy]

 

yyxx:

 

Number

Event

0000

Dialogue: Healing in PKMN-Center

0001

Monologue: „It’s full of difficult books.“

0002

Monologue: „A whole collection of POKéMON picture books.“

0003

Monologue: „POKéMON magazines... POKéMON PAL, POKéMON HANDBOOK, POKéMON GRAPH...“

0004

Monologue: „TEAM ROCKET OATH/Steal POKéMON for profit! Exploit POKéMON for profit! All POKéMON exist fort he glory of TEAM ROCKET!“

0005

Monologue: „What is this? Oh, it’s an incense burner!“

0006

Monologue: „Lots of POKéMON merchandise!“

0007

Monologue: „It’s the TOWN MAP.“ (+ show map)

0008

Monologue: „My reflection! Looking good!“

0009

Monologue: „It’s a TV.“

000A

Monologue: „POKéMON JOURNAL HOME PAGE... It hasn’t been updated...“

000B

Radio show: POKéTALK

000C

Radio show: Lucky channel

000D

Monologue: „There’s nothing in here...“

000E

Dialogue: Move stone

000F

Dialogue: Rock smash stone

0010

Monologue: „Heal your POKéMON. POKéMON Center!“

0011

Monologue: „For all your POKéMON needs POKéMON MART“

0012

Deactivate bit number 06CD

0013

Event: Activate the Team Rocket take-over

Bit-Nr. 06CF, 06D1, 0756 is activated, Bit-Nr. 06CE and 0025 is deactivated, Bit-Nr. 0012 from BitTable2 is activated.

0014

Event: Play elevator sound

0015

Write the current day of the week into MEMORY1

0016

Event: Evaluation Bug Catching Contest (Taken from contest by clerk)

0017

Event: Evaluation Bug Catching Contest (Contest cancelled)

0018

De- and Activation of bit numbers. Usage in the beginning of the game.

0019

Monologue: „Wow! You’re pretty tough. Could I get your phone number? I’ll call you for a rematch.“

001A

Monologue: „Register the phone number?“

001B

Monologue: „HIRO registers MEMORY1’s number.“ (+sound 0093) See Display strings.

001C

Monologue: „I’ll call if anything comes up!“

001D

Monologue: „Oh, OK ... Just talk to me if you want to get my phone number.“

001E

Monologue: „Your phone doesn’t have enough memory for more numbers.“

001F

Monologue: „I was waiting for you. Let’s battle!“

0020

Monologue: „Wow, you’re good at battling. Want to give me your phone number? I’ll phone you for another battle!“

0021

Monologue: „Register the phone number?“

0022

Monologue: „HIRO registered SPEICHER1’s number.“ (+sound 0093) See Display strings.

0023

Monologue: „I’ll call you if something’s up.“

0024

Monologue: „Oh, fine then... If you want to get my phone number, just tell me.“

0025

Monologue: „Your phone doesn’t have enough memory for more numbers.““

0026

Monologue: „I waited for you. Let’s battle!“

0027

Monologue: „LOCATION NAME POKéMON ARENA“

0028

Monologue: „LOCATION NAME POKéMON ARENA LEADER: MEMORY2 WINNING TRAINERS: HIRO“

0029

Monologue: „HIRO received MEMORY2.“ (+sound 0001) See Display strings.

002A

Monologue: „HIRO received MEMORY2.“ (+sound 0096) See Display strings.

002B

Dialogue: POKéMON Center PC (+load font)

002C

Dialogue: Casino Coin counter

002D

Monologue: Happiness counseling for POKéMON according to Happiness of 1. PKMN

 

0D codes:                                                                Top

---------

 

Calls predefined scripts.

 

Structure: [0D][xxyy]

 

yyxx-List is the same as with the 0C codes. Difference: After this code is interpreted, the script goes on.

 

0E ASM code1:                                                            Top

-------------

 

Calls a predefined routine by interpreting the ASM the pointer points to.

 

Structure:

 

[0E][3byte pointer]

 

0F codes:                                                                Top

---------

 

Calls predefined scripts.

 

Structure: [0F][xxyy]

 

yyxx :

 

Number

Event

Variables in RAM/in Ram before

Feedback

0000

Deactivate Bug Catching Contest (clock)

 

 

0001

Set “trade” as link central mode

 

 

0002

Check link port for voltage;

partner port

 

00 = None

01 = Voltage

0003

Check link port for further activity

 

00 = None

01 = Activity

0004

Part of save game dialogue

 

00 = Not saved

01 = Saved

0005

Test link central mode of friend;

Trade, Battle, Time capsule

 

00 = Not equal

01 = Equal

0006

Past transfer1;

Old editions see incompatibility/turn down

 

 

0007

Turn link port off

 

 

0008

Send 3x00 and then turn link port off

 

 

0009

Set “fight” as link central mode

 

 

000A

Set “time capsule” as link central mode

 

 

000B

Check for team/time capsule compatibility

Wrong PKMN: name in TEMPMEMORY1

Wrong ITEM: name in TEMPMEMORY 1

Wrong ATTACK: PKMNname in TEMPMEMORY1

              ATTACKname in TEMPMEMORY2

 

 

00 = Team compatible

01 = Wrong Pokémon

02 = Wrong ATTACK

03 = Wrong ITEM

000C

Past transfer2;

Old editions agree

 

 

000D

Trade automat

 

 

000E

Battle automat

 

 

000F

Time capsule automat

 

 

0010

Test whether transfer is active

 

00 = No

01 = Yes

0011

Trade/Mystery Gift item check; checks if item received

 

00 = No Item received

01 = Item received

0012

Give Trade/Mystery Gift item + Receive text

 

00 = Pack full

01 = Item received

0013

Activate Mystery Gift

 

 

0014

Cast bug catching contest winner

 

Rank 01 - 03

00 = No top3 rank

0015

Give bug catching contest POKéMON

 

00 = Given

01 = Box full

02 = Not given/No Pokémon defined

0016

Disable whole team but 1. POKéMON

 

00 = Disabled

01 = 1. PKMN defeated, not disabled

0017

Enable whole team

 

 

0018

Bug catching contest setup;

Gives 20 park balls and 20 minutes time

 

 

0019

Magicarp evaluation system

 

00 = No Magicarp selected

01 = Cancel

02 = No new record

03 = new record

001A

Text Magicarp record

 

 

001B

Heal Pokémon

 

 

001C

Open PC menu

 

 

001D

Open private PC

 

 

001E

DAY CARE MAN dialogue

 

 

001F

DAY CARE LADY dialogue

 

 

0020

DAY CARE EGG dialogue

 

00 = EGG not taken/

     EGG taken

01 = Team is full

 

0021

Attack deleter dialogue

 

 

0022

Mother menu savings/winter time/summer time

 

 

0023

Train ride

00 = Goldenrod-Saffron;

01 = Saffron-Goldenrod

 

0024

Name rival

 

 

0025

Set day of the week

 

 

0026

Show town map

 

 

0027

Alph Ruins printer

 

 

0028

Radio shows

00 = PKMN TALK1

01 = PKMN TALK2

02 = PKDEX show

03 = PKMN music

04 = Lucky Chan.

05 = Alph Ruins

06 = Loc & Pers

07 = PKMN marche

08 = Team Rocket

 

0029

Alph Ruins puzzles

00 = Kabuto

01 = Amaroso

02 = Aerodactyl

03 = Ho-Oh

00 = Not solved

01 = Solved

002A

One-armed bandit game

 

 

002B

Card game

 

 

002C

Memory game (buggy)

 

 

002D

BG/sprite palettes get filled with white; Map is reloaded

 

 

002E

BG palettes all become color 0|0 and sprite palettes all to x|0

(All first set palettes become 0|0)

(Fade effect)

 

 

002F

BG/sprite palettes all become x|3

(Fade effect)

 

 

0030

BG/sprite palettes get fade-in from x|0 (Fade effect)

 

 

0031

Sprite/BG palettes become normal (palette changes last)

 

 

0032

All BG palettes as well as sprite palette 0 and 1 become black

 

 

0033

BG/sprite palettes get filled with white

 

 

0034

Display BG/sprite pallet s again

 

 

0035

Fill screen with tile 0x7F

 

 

0036

Load sprites anew

 

 

0037

Load sprite tiles anew

 

 

0038

Mark Pokémon as caught in PokéDex and show entry (entry only if never caught before)

Pokémon-Nr.

 

0039

Mark Pokémon as caught in PokéDex

Pokémon-Nr.

 

003A

Wait until current Sound is finished

 

 

003B

Depending on movement (Bicycle, Slipping...) Start over music or map music

 

 

003C

Start map music over

 

 

003D

Display Poké balls and play music

(no healing effect)

00 = PokéCenter

01 = Laboratory

02 = Hall of Fame

 

003E

Load movement data for 1 step in facing direction into Ram. See Application example.

 

 

003F

Check level of Pokémon; 1 Pokémon needs to have at least the given level

Level

00 = < level

01 = >= Level

0040

Check happiness of Pokémon; 1 Pokémon needs to have the given happiness

Happiness

00 = > Happiness

01 = <= Happiness

0041

Team check; checks if POKéMON is in team

Pokémon-Nr.

00 = Not in team

01 = In team

0042

Pokémon ID check; checks if the given Pokémon was caught by the Player

Pokémon-Nr.

00 = Not player’s

01 = Player’s

0043

Checks if enough days have passed

D984 = Days

D985 = Day of last check

00 = Enough days

<> 00 = Days left

0044

Pokémon text DAY CARE MAN + Pokémon cry

Day Care Man must have PKMN

 

0045

Pokémon text DAY CARE LADY + Pokémon cry

Day Care Lady must have PKMN

 

0046

Bit numbers 0716 - 071F are deactivated and randomly 5 of them are activated again

(Bug Contest Trainers)

 

 

0047

Change fishing sets.

When fishing set = 0B and old rod selected then Set = 06;

When fishing set = 0C and good/super rod selected, then set = 07

01 = Old rod

02 = Good/super rod

 

0048

Load decoration into map (blocks)

 

 

0049

Load decoration into map (persons)

 

 

004A

Give Shuckle SHUCKIE

 

00 = Team full

01 = SHUCKIE given

004B

Pokémon list|Take Shuckle SHUCKIE

 

00 = Not SHUCKIE

01 = Cancelled

02 = SHUCKIE taken

03 = SHUCKIE is too happy to be taken away

04 = 1 Pokémon in Team

004C

Pokémon list|Write name of selected Pokémon into MEMORY1

 

00 = Cancelled

<> 00 = Pokémon nr.

004D

PokéRUS check; Checks if 1 team Pokémon has got PokéRUS

 

00 = No Pokémon or no PokéRUS
01 = at least 1 Pokémon has got PokéRUS

004E

Show COIN count on top right in a box

 

 

004F

Show MONEY count on top right in big box

 

 

0050

Show MONEY count on top right in small box

 

 

0051

Checks if a team or box Pokémon has the right ID and gives text feedback (Lucky number show)

 

00 = No figure right

01 = 5 figures right

02 = 3 figures right

03 = 2 figures right

0052

Checks if enough days have passed since last Lucky number show

D977 = Days

D978 = Day of last show

00 = No

01 = Yes

0053

Create new Lucky Number; if last show = same day, then take the old one

 

 

0054

Write Lucky Number to MEMORY1

 

 

0055

Create a dynamic list of all possible balls made from apricots; if berry is selected, then order ball

 

00 = No apricot or cancelled

<> 00 = apricot number

0056

Name rater dialogue

 

 

0057

Link battle statistics

 

 

0058

Read happiness of 1. Pokémon and write its name to MEMORY1

 

Happiness

0059

Read name of 1. Pokémon and write it to MEMORY1

 

00 = Regular PKMN

01 = EGG chosen

005A

Call „I just saw some rare PKMN in LOC NAME.“

D943 = Person called

00 = Call successful

01 = Trainer on map without PKMN/ randomly chosen PKMN is not rare/ Trainer already called

005B

Write randomly chosen PKMN name on map of called person to MEMORY2

D943 = Person called

 

005C

Write randomly chosen PKMN name of PKMN possessed by called person to MEMORY2

D943 = Person called

 

005D

Interpret script header scripts of type 04 in part2 and load sprite tiles anew

 

 

005E

Play predefined Pokémon call

Pokémon nr.

 

005F

Checks if HIRO is on a map with music 0x40 and if yes, is on spots X21Y08, X22Y0A, X23Y0A, X24Y08, X24Y09

 

00 = No

01 = Yes

0060

Pokémon list|Chosen PKMN becomes a little happier

Increase when 00-63|64-C7|C8-FF happiness

 

00 = Cancelled

01 = EGG chosen

02 = 01|01|01 happiness

03 = 03|03|01 happiness

04 = 05|05|02 happiness

0061

Pokémon list|Chosen PKMN becomes happier

Increase when 00-63|64-C7|C8-FF happiness

 

00 = Cancelled

01 = EGG chosen

02 = 01|01|01 happiness

03 = 03|03|01 happiness

04 = 05|05|02 happiness

0062

Pokémon list|Chosen PKMN becomes much happier

Increase when 00-63|64-C7|C8-FF happiness

 

00 = Cancelled

01 = EGG chosen

02 = 03|03|01 happiness

0063

Play cry of a chosen PKMN (e.g. chosen by a Pokémon list)

@D004 = Pokémon nr.

 

0064

PokéDEX evaluation

 

 

0065

Check for Gameboy Color feature

 

00 = Mono GB

01 = Unknown

02 = Color GB

0066

Checks if there has ever been a link battle

 

00 = No

<> 00 = Yes

0067

Photographer dialogue (print Pokémon data)

 

 

0068

Activate Raikou, Suicune, Entei

 

 

0069

Let music fade out fast

 

 

006A

Show trainer diploma

 

 

006B

Print trainer diploma

 

 

006C

Change to daylight saving time + text

 

 

006D

Change from daylight saving time + text

 

 

006E

Text „Now on Debug“

 

 

006F

Nothing

 

 

 

     

For (some) dialogues the font needs to be loaded with the Text box&font code.

 

10 ASM code2:                                                            Top

-------------

 

Call an ASM script via a 2byte pointer pointing to a 3byte pointer.

 

Structure:

 

[10][2byte pointer pointing to 3byte pointer pointing to ASM script]

 

11 Trigger event check1:                                                 Top

------------------------

 

Check the current number of the trigger event on map (map bank/map no).

 

Structure:

 

[11][MapBank][MapNo]

 

12 Activate trigger event from afar:                                          Top

------------------------------------

 

Changes trigger event number on map (map bank/map no) to xx.

 

xx = trigger event number that should be activated

 

Structure:

 

[12][MapBank][MapNo][xx]

 

13 Trigger event check2:                                                 Top

------------------------

 

Checks the number of the trigger events on the current map.

 

Structure:

 

[13]

 

14 De-/activate trigger events:                                          Top

-------------------------------

 

Changes trigger event number on current map to xx.

 

xx = trigger event number that should be activated

 

Structure:

 

[14][xx]

 

Deactivate:

 

Just activate a different trigger event number. There’s a limit of 1 active one.

 

15 Load variable into RAM:                                                  Top

--------------------------

 

Application example

 

Loads a variable into RAM.

 

Structure:

 

[15][xx]

 

16 Add variables:                                                              Top

-----------------

 

Adds xx and the variable in RAM.

 

Structure:

 

[16][xx]

 

17 Random number:                                                        Top

-----------------

 

Reads xx and creates a random number between 00 and xx -1.

According to this xx can be all but 00. Random number = [00; xx)

The nearer the random number is to xx, the rarer it occurs.

Random number gets written to RAM.

 

Structure:

 

[17][xx]

 

 

18 Version check:                                                        Top

-----------------

 

Check if version is gold or silver. Gives feedback:  00=Gold

                                                     01=Silver

 

Structure:

 

[18]

 

19 Copy variable code1:                                                       Top

-----------------------

 

Writes variable from ram address to RAM.

 

Structure:

 

[19][ram address (2byte)]

 

1A Copy variable code:                                                        Top

----------------------

 

Writes variable from RAM to ram address.

 

Structure:

 

[1A][ram address (2byte)]

 

1B Load variable:                                                        Top

-----------------

 

Writes zz to ram address.

 

Structure:

 

[1B][ram address (2byte)][zz]

 

1C Check codes:                                                               Top

---------------

 

Checks special game-technical values and writes then into RAM.

 

Structure:

 

[1C][following part][Ram check (when <> 08/09 see „numbers“ in list of following parts)]

 

Following part:                          Numbers in hex

 

01 = PKMN count in party           Numbers: 00-06

02 =

03 = Battle type of wild PKMN

04 =

05 = PokéDex caught                Numbers: 00 - FA

06 = PokéDex seen                   Numbers: 00 - FA

07 = Badge count                   Numbers: 00 - 10

08 = Movement                      Numbers: 00 = walk 01 = bike 02 = slipping 04 = sufer

08 =surfer pikachu

09 = HIRO’s facing                  Numbers: 00 (d) - 01 (u) - 02 (l) - 03 (r)

0A = Time in hours                 Numbers: 00 - 18

0B = Day                           Numbers: 00 (Mo) - 06 (Su)

0C = Map bank of current map

0D = Map no of current map
0E = Amount of different seen      Numbers: 00 - 1A

     unowns
0F = Action byte of map

10 = Amount of free spaces in       Numbers: 00 - 14

     Current PKMN box

11 = Minutes until end bug contest Numbers: 00 - 14

12 = X position of HIRO

13 = Y position of HIRO

14 = phone call number

 

See Additional table A.

 

1D Input code1:                                                               Top

---------------

 

Writes variable from RAM to special game-technical value offsets.

 

Structure:

 

[1D][following part]

 

Following part: (same as for 1C)

 

03 = Battle type of wild PKMN

08 = Movement (01 = bike, 02 = slipping ;only movement, no graphics)

 

See Additional table A.

 

1E Input code2:                                                               Top

---------------

 

Writes variable xx to special game-technical value offsets.

 

Structure:

 

[1E][following part][xx]

 

Following part see 1D code.

 

See Additional table A.

 

1F Give item code:                                                       Top

------------------

 

Gives item (item no) amount times. Gives feedback:   00 = bag full

                                                     01 = OK

Structure:

 

[1F][item no][amount]

 

20 Take item code:                                                       Top

------------------

 

Gives item (item no) amount times. Gives feedback:   00 = Not enough items

 

Structure:

 

[20][ item no][amount]

 

21 Check for item code:                                                       Top

-----------------------

 

Checks if item is possessed. Gives feedback:   00 = not possessed

                                               01 = possessed

Structure:

 

[21][item no]

 

22 Give money code:                                                      Top

-------------------

 

Gives zzyyxx money to HIRO/account.

 

zzyyxx = amount of money (000000 - 0F423F)

 

Structure:

 

[22][00-HIRO/01-account][xxyyzz]

 

23 Take money code:                                                      Top

-------------------

 

Takes zzyyxx money from HIRO/account.

 

zzyyxx = amount of money (000000 - 0F423F)

 

Structure:

 

[23][00-HIRO/01-account][xxyyzz]

 

24 Check for money code:                                                 Top

------------------------

 

Checks if HIRO/account has got zzyyxx money. Gives feedback:     00 = Enough money

                                                                 01 = Exact amount

                                                                 02 = Less money

 

zzyyxx = amount of money (000000 - 0F423F)

 

Structure:

 

[24][00-HIRO/01-account][xxyyzz]

 

25 Give coin code:                                                       Top

------------------

 

Gives coins to HIRO.

 

yyxx = amount of coins (0000 - 270F)

 

Structure:

 

[25][xxyy]

 

26 Take coins code:                                                      Top

-------------------

 

Takes coins away from HIRO.

 

yyxx = amount of coins (0000 - 270F)

 

Structure:

 

[26][xxyy]

 

 

 

27 Check for coins code:                                                       Top
------------------------

 

Checks if HIRO has enough coins. Gives feedback:     00 = Enough coins

                                                     01 = Exact amount

                                                     02 = Less coins

 

yyxx = amount of coins necessary (0000 - 270F)

 

Structure:

 

[27][xxyy]

 

28 Give cell phone number:                                                    Top

--------------------------

 

Gives number to HIRO. Gives feedback:          00 = Number was added

                                               01 = Number already added, or no memory

 

 

xx = number of person

 

Structure:

 

[28][xx]

 

xx:

 

01 = Mother

02 = Bike store

03 = Bill

04 = Elm

...

 

29 Delete cell phone number:                                                  Top

----------------------------

 

Deletes a number from the list. Gives feedback:            00 = Number deleted

                                                     01 = Number wasn’t in list

 

xx = number of person

 

Structure:

 

[29][xx]

 

xx see Give cell phone number.

 

2A Check for cell phone number:                                          Top

-------------------------------

 

Checks if a number is in the list. Gives feedback:   00 = Number is in list

                                                     01 = Number is not in list

 

xx = number to look for

 

Structure:

 

[2A][xx]

 

xx see Give cell phone number.

 

2B Check time of day:                                                         Top

---------------------

 

Checks the time of day. Gives Feedback:        00 = Time of day is the same

                                               01 = Time of day is not the same

 

Structure:

 

[2B][time of day (01morn-04night)]

 

2C Check for PKMN:                                                              Top
------------------

 

Checks if there is a certain PKMN in team. Gives Feedback: 00 = In team

                                                                 01 = Not in team

 

xx = PKMN no

 

Structure:

 

[2C][xx]

 

2D Give PKMN:                                                            Top

-------------

 

Gives a PKMN if there’s space. Gives Trainer-Id as feedback.

 

 

Structure:

 

[2D][PKMN][PKMNlvl][PKMNitem][TRAINER]

 

Trainer:

 

00 = HIRO

01 = after the main code there are 4 bytes added:

 

[2byte pointer to trainer’s name (max.0x0A figures + 0x50)][2byte pointer to nickname (max.0x0A figures + 0x50)]

 

2E Give EGG:                                                             Top

------------

 

Gives EGG if there’s space. Gives feedback :   00 = OK

                                               02 = Transaction not complete

 

Structure:

 

[2E][PKMN][PKMNlvl]

 

2F Attach item code:                                                                  Top

--------------------

 

Gives last PKMN in list an item and letter text if applicable. Replaces existing items.

 

Structure:

 

[2F][2byte pointer to item no + 0x20 bytes letter text]

 

30 Check letter code:                                                         Top

---------------------

 

Opens a PKMN list. Selected PKMN must have the right letter + the right contents. If OK, then PKMN is taken away

Gives feedback:   00 = wrong letter

                  01 = OK

                  02 = Cancelled

                  03 = Chosen PKMN has no letter

                  04 = Chosen PKMN is the only one in the list.

 

Structure:

 

[30][2byte pointer to letter item no + 0x20 bytes letter text]

 

See Additional table A.

 

31 BitTable1 check:                                                             Top

-------------------

 

Checks whether a bit of BitTable1 has the value 0 or 1. Gives feedback:     00 = Value 0 (OFF)

                                                                            01 = Value 1 (ON)

Structure:

[31][Bit no (2byte)]

 

Bit no: See Additional table B.

 

32 BitTable1 reset:                                                      Top

-------------------

 

Sets a bit of BitTable1 to value 0.

 

Structure;

 

[32][Bit no (2byte)]

 

Bit no: See Additional table B.

 

33 BitTable1 set:                                                        Top

-----------------

 

Sets a bit of BitTable1 to value 1.

 

Structure:

 

[33][Bit-No (2byte)]

 

Bit no: See Additional table B.

 

34 BitTable2 check:                                                             Top

-------------------

 

Checks whether a bit of BitTable2 has the value 0 or 1. Gives feedback:     00 = Value 0 (OFF)

                                                                            01 = Value 1 (ON)

Structure:

[34][Bit no (2byte)]

 

Bit no: See Additional table B.

 

35 BitTable2 reset:                                                      Top

-------------------

 

Sets a bit of BitTable2 to value 0.

 

Structure:

 

[35][Bit no (2byte)]

 

Bit no: See Additional table B.

 

36 BitTable2 set:                                                        Top

-----------------

 

Sets a bit of BitTable2 to value 1.

 

Structure:

 

[36][Bit no (2byte)]

 

Bit no: See Additional table B.

 

37 Deactivate PKMN battles:                                                   Top

---------------------------

 

This code turns all wild PKMN battles off.

 

Structure:

[37]

 

38 Activate PKMN battles:                                                      Top
-------------------------

 

This code turns all wild PKMN battles on.

 

Structure:

[38]

 

39 X/Y comparison:                                                              Top

-------------------

 

This code is buggy (Bug fix: 0x3021 --> C6) and can’t used as described without fix.

 

This code compares the X and Y coordinates of HIRO with the ones in a table (max. 20h XY pairs) on the current map. It sets or resets the 4 bytes D17C to D17F accordingly to this table, 1 bit for every table entry.

To be useful, this code can only be used in a command queue, because with every regular move of HIRO the bits are reset again.

This code is an alternative to the trigger events and can be used via the command queue code.

 

 

Structure:

 

[39][2byte pointer to table]

 

See Write command queue, Additional documentation: 3:4661 with c= index in table (start=00), hl=D171, b=01, d=00.

 

3A Warp modifier:                                                               Top

-----------------

 

Changes warp data for all warps of the current map that have a 0xFF for warp-to data.

 

Structure:

 

[3A][Nee warp-to][New map bank][New map no]

 

3B Blackout modifier:                                                                Top

---------------------

 

Changes the map HIRO arrives at, after having a blackout. There needs to be flying data for that map.

 

Structure:

 

[3B][Map bank][Map no]

 

See Additional documentation: 23C8.

 

3C Warp code:                                                                   Top

-------------

 

Warps to another map. If all data is 00s, then the current map is reloaded with the current X and Y coordinates. Old script is not finished without a [90].

 

[3C][Map bank][Map no][X][Y]

 

3D Account code:                                                                       Top

----------------

 

Reads amount of money in accounts of HIRO and mother and writes it to MEMORY1, 2 or 3 for later use in text.

 

Structure:

 

[3D][00 = HIRO| <> 00 = Mother][00-02 MEMORY]

 

See Usage of variable strings in text.

 

3E Coin case code:                                                              Top

------------------

 

Reads amount of coins in coin case and writes it to MEMORY1, 2 or 3 for later use in text.

 

Structure:

 

[3E][00-02 MEMORY]

 

See Usage of variable strings in text.

 

3F Display ram:                                                                         Top

---------------

 

Reads RAM value and writes it to MEMORY1, 2 or 3 for later use in text.

 

Structure:

 

[3F][00-02 MEMORY]

 

See Usage of variable strings in text.

 

40 Display Pokémon name:                                                     Top

------------------------

 

Writes PokéMon name to MEMORY1, 2 or 3 for later use in text.

 

Structure:

 

[40][PKMN no][00-02 MEMORY]

 

See Usage of variable strings in text.

 

41 Display item name:                                                                                                       Top

---------------------

 

Writes item name to MEMORY1, 2 or 3 for later use in text.

 

Structure:

 

[41][Item no][00-02 MEMORY]

 

See Usage of variable strings in text.

 

42 Display location name:                                                                                                   Top

-------------------------

 

Writes current location’s name to MEMORY1, 2 or 3 for later use in text.

 

Structure:

 

[42][00-02 MEMORY]

 

See Usage of variable strings in text.

 

43 Display trainer name:                                                   Top

------------------------

 

Writes trainer name to MEMORY1, 2 or 3 for later use in text.

 

Structure:

 

[43][Trainer number][Trainer group][00-02 MEMORY]

 

See Usage of variable strings in text.

 

44 Display strings:                                                        Top

-------------------

 

Writes string to MEMORY1, 2 or 3 for later use in text.

 

Structure:

[44][2byte pointer to string (max. 0x0C figures + 0x50)][00-02 MEMORY]

 

See 0C codes: 0C2900, 0C2A00, 0C1B00, 0C2200, Usage of variable strings in text.

 

45 Stow away item code:                                                                                                      Top

-----------------------

 

Text box: „HIRO put the ITEMNAME in the ITEMPOCKET.” The item number has to have been loaded beforehand (e.g. by Give item code).

 

Structure:

 

[45]

 

46 Full item pocket code:                                                  Top

-------------------------

 

Text box: „ITEMPOCKET is full...” The item number has to have been loaded beforehand (e.g. by Give item code).

 

Structure:

 

[46]

 

47 Text box&font code:                                                                                                            Top

----------------------

 

Loads the font into the ram and opens a text box.

 

Structure:

[47]

 

See Application example.

 

48 Refresh code:                                                               Top
----------------

 

Executes a complete screen refresh.

 

Structure:

[48][xx]

 

xx is only a dummy byte.

 

49 Load moving sprites:                                                         Top

-----------------------

 

Loads moving sprites for person events into ram.

 

Structure:

 

[49]

 

4A Load byte to C1CE:                                                                                                            Top

---------------------

 

Loads a byte to C1CE. Seems to have no function in the game.

 

Structure:

 

[4A][Byte]

 

4B Display text:                                                                                                                                Top

----------------

 

Opens a text box and writes text. Doesn’t load font.

 

Structure:

 

[4B][Text bank][2byte text pointer]

 

4C Display text:                                                                                                                                Top

----------------

 

Opens a text box and writes text. Doesn’t load font.

 

Structure:

 

[4C][2byte text pointer]

 

4D Repeat text:                                                                                                                          Top

---------------

 

Opens a text box and writes the text written latest resp. whose address was put statically to D175-D177. Doesn’t load font.

 

Structure:

 

[4D][FF][FF]

 

Without FF for both bytes, no operation occurs

 

4E YES/NO box:                                                                                                                      Top

--------------

 

Displays a YES/NO box at X0F/Y07. Gives feedback:    00 = NO chosen

                                                     01 = YES chosen

Structure:

[4E]

 

4F Menu data code:                                                                                                           Top

------------------

 

Loads data for menus

 

Structure:

 

[4F][2byte pointer to menu data]

 

Menu data: See Additional data structures A.

 

50 Write Backup:                                                                                                                                Top

----------------

 

Writes backup of parts of the screen the box was overlapping.

 

Structure:

 

[50]

 

Write Backup: See Additional data structures A.

 

51 Text1 code:                                                             Top
--------------

 

Displays a text and lets person turn to HIRO. Afterwards there is no other script interpreted. Corresponds to 6A + 47 + 4C + 53 + 49 + 90

 

Structure:

 

[51][2byte textpointer]

 

52 Text2 code:                                                                                                                      Top

--------------

 

Displays a text. Afterwards there is no other script interpreted. Corresponds to 47 + 4C + 53 + 49 + 90

 

Structure:

[52[2byte textpointer]]

 

53 Close text box code:                                                                                                Top

-----------------------

 

Closes a text box which was opened by 47 resp. 4B/4C/4D.

 

Structure:

 

[53]

 

54 Keep text box open code:                                                     Top
---------------------------

 

Keeps a text box open which was opened by 47 resp. 4B/4C/4D.

 

Structure:

 

[54]

 

55 Pokémon picture code:                                                                                                     Top

------------------------

 

Opens a box and puts a Pokémon picture into it.

 

Structure:

[55][xx]

 

xx:   <>00 : Pokémon no

      = 00 : Pokémon no gets read from RAM

 

56 Pokémon picture YES/NO code:                                                                                             Top

-------------------------------

 

Displays a YES/NO box at X08/Y05. Gives feedback:    00 = NO chosen

                                                     01 = YES chosen

 

Structure:

 

[56]

 

57 Menu interpreter1:                                                                                                              Top

---------------------

 

Interprets menu data loaded by 4F. See also Menu interpreter2.

 

Structure:

 

[57]

 

Interpreter1: See Additional data structures A.

 

58 Menu interpreter2:                                                                                                              Top

---------------------

 

Interprets menu data loaded by 4F. See also Menu interpreter1.

 

Structure:

 

[58]

 

Interpreter2: See Additional data structures A.

 

59 Load Pikachu data:                                                                                                             Top

---------------------

 

Loads 0x19 (Pikachu) to PokéRAM and level 5 to LevelRAM.

 

Structure:

 

[59]

 

5A Delete FightRAM/reset person check:                                                                  Top

--------------------------------------

 

Deletes the value in BattleRAM. Turns off the check if the battle was started by entering a trainer’s area of view.

 

Structure:

 

[5A]

 

5B Load trainer data1:                                                          Top

----------------------

 

Loads trainer data when HIRO is in a trainer’s range of sight. Trainer group is read from CF2E and written to TrRAM1, the trainer number is read from CF2F and written to TrRAM2. 81 is written to BattleRAM.

 

Structure:

 

[5B]

 

5C Load Pokémon data:                                                                                                                    Top

---------------------

 

Loads Pokémon data. Writes 80 to BattleRAM.

 

Structure:

 

[5C][Poke no][Level]

 

5D Load trainer data2:                                                                                                     Top

----------------------

 

Loads trainer data. Trainer group --> TrRAM1, trainer number --> TrRAM2. Writes 81 to BattleRAM.

 

Structure:

 

[5D][Trainer group][Trainer no]

 

5E Start battle:                                                                                                                                Top

----------------

 

Starts trainer or Pokémon battle. BattleRAM: 80 = Poké battle; 81 = Trainer battle. Gives feedback:   00 = Win

            01 = Lose

 

Structure:

 

[5E]

 

See Application example.

 

5F Return to ingame engine after battle:                                                                      Top

----------------------------------------

 

Returns to ingame engine and evaluates battle. When lost then return to last Pokémon Center etc.

 

Structure:

 

[5F]

 

60 Learn how to catch PKMN:                                                                                                         Top

---------------------------

 

Starts a learn-how-to-catch battle with a Pokémon, whose data needs to be loaded beforehand (See Load Pokémon data). Player has to have at least 1 Pokémon for it to work. Items that are statically used: 1xPotion, 5xPoké ball.

 

Structure:

 

[60][xx]

 

xx: Between 01 and 03. If <> 03 then HIRO sprite instead of dude sprite and kills itself when using the item system.

 

61 Trainer text code:                                                                                                      Top

---------------------

 

Interprets the data of a in the event structure defined trainer. Xx decides which text to use.

 

Structure:

 

[61][xx]

 

xx: Between 00 and 03.

 

62 Trainer status code:                                                    Top

-----------------------

 

Checks/changes the status of a in the event structure defined trainer.

 

Structure:

 

[62][xx]

 

xx:

 

00 = Deactivate

01 = Activate

02 = Check

 

63 Pointer Win/Loss:                                                                                                 Top

--------------------

 

Writes the win/loss pointer of a battle into the ram.

 

Structure:

 

[63][2byte pointer to text Win][2byte pointer to text Loss*]

 

* When pointer = 0000 then „Blackout“ instead of return to gameplay.

 

64 Script talk-after:                                                                                                      Top

---------------------

 

Interprets which script is going to be run, when a in the event structure defined trainer is talked to again.

 

 

Structure:

 

[64]

 

65 Script talk-after-cancel:                                                                                                       Top

----------------------------

 

Cancels the talk-after script of the in the event structure defined trainer when talk-after script is executed just after the battle.

 

Structure:

 

[65]

 

66 Script talk-after-check:                                                                                                Top

---------------------------

 

Checks if the talk-after script of the event structure defined trainer is executed just after the battle or at a later point in time.

Gives feedback:   00 = No

                  01 = Yes

 

Structure:

 

[66]

 

67 Set talked-to person:                                                                                                      Top

------------------------

 

Sets the number of the last person talked to.

 

Structure:

 

[67][Person]

 

68 Moving code:                                                                                                                          Top

---------------

 

Moves the person using moving data.

 

Structure:

 

[68][Person][2byte pointer to moving data]

 

See Additional table B.

 

69 Moving code for talked-to person:                                                                                        Top

------------------------------------

 

Moves talked-to person using moving data.

 

Structure:

 

[69][2byte pointer to moving data]

 

See Additional table B.

 

6A Talk to facing code:                                                                                                Top

-----------------------

 

Turns the heads of the talked-to persons to HIRO.

 

Structure:

 

[6A]

 

6B Facing of people code:                                                                                                          Top

-------------------------

 

Turns the head of person1 to another person2.

 

Structure:

 

[6B][Person2][Person1]

 

Person2 = If number is greater than 0xFD, then use number of talked-to person.

Person1 = If number equals 0xFE, then take number of talked-to person.

 

6C Variable sprites:                                                                                                        Top

--------------------

 

Writes a number to the variable sprite RAM from D555 to D564 (see Compendium on the sprite system).

 

Structure:

 

[6C][xx][Sprite no]

 

xx: Number between 0x00 and 0x0F

 

6D Hide person:                                                                                                              Top

---------------

 

Hides a person.

 

Structure:

 

[6D][Person]

 

6E Show person:                                                                                                       Top

---------------

 

Shows a hidden person again.

 

Structure:

 

[6E][Person]

 

6F Follow code1:                                                                                                                        Top

----------------

 

A person1 follows another person2. The person1 that follows just repeats the movement of person2, even if the persons are not directly next to each other.

 

Structure:

 

[6F][Person2][Person1]

 

70 Stop following code:                                                                                                Top

-----------------------

 

Ends all current follow codes.

 

Structure:

 

[70]

 

71 Move person:                                                                                                                Top

---------------

 

Sets the X/Y values of a person anew. The person doesn’t get shown immediately. Use hide&show. See Show person, Hide person.

 

Structure:

 

[71][Person][X][Y]

 

72 Write person location:                                                                                            Top

-------------------------

 

Writes the current X/Y values of a person into the ram. The person is going to stand at its current location even when it’s out of HIRO's sight and is not going to return to its old location until the next map load.

 

Structure:

 

[72][Person]

 

73 Load emoticons:                                                                                                    Top

------------------

 

Loads the emoticon bubble depending on the given bubble number.

 

Structure:

 

[73][Bubble]

 

xx: If xx = FF then take number from RAM.

 

00 = Exclamation mark

01 = Question mark

02 = Happy

03 = Sad

04 = Heart

05 = Flash

06 = Snoring

07 = Fish

 

74 Display emoticon:                                                                                                       Top

--------------------

 

Displays the bubble above a persons head for the given time period. Attention: Bubbles get loaded into ram!

 

Structure:

 

[74][Bubble][Person][Time]

 

xx:

 

00 = Exclamation mark

01 = Question mark

02 = Happy

03 = Sad

04 = Heart

05 = Flash

06 = Snoring

07 = Fish

 

75 Change facing:                                                                                                          Top

-----------------

 

Changes the facing of a person.

 

Structure:

 

[75][Person][Facing]

 

76 Follow code2:                                                                                                                        Top

----------------

 

A person1 follows a person2. The following person1 automatically clings to person2. Person1 just follows person2, but doesn’t make the exact same movements at person2.

 

Structure:

 

[76][Person2][Person1]

 

77 Earth quake:                                                                                                                                 Top

---------------

 

The screen shakes. xx gives time as well as displacement of the screen.

 

Structure:

 

[77][xx]

 

78 Exchange map:                                                                                                                        Top

----------------

 

This code draws another whole map as wide and high as the current map over the current map. The 3byte pointer points to the new map.

 

Structure:

 

[78][3byte pointer to new map data]

 

79 Change block code:                                                                                                            Top

---------------------

 

Changes a block on the current map by giving the new block number and its X/Y values measured in half-blocks.

 

Structure:

 

[79][X][Y][Block]

 

7A Reload map code:                                                                                                    Top

-------------------

 

Reloads and re-displays the map completely. Loads tileset and all map data anew. Screen gets light.

 

Structure:

 

[7A]

 

See Additional documentation: Map loading process No3.

 

7B Reload map part code:                                                   Top

------------------------

 

Reloads and re-displays the part of the map HIRO is on, without reloading any other map data or the tileset.

 

Structure:

 

[7B]

 

7C Write command queue:                                                                                                Top

-----------------------

 

Writes a command queue to the next free slot in ram. Max 4 command queues à 5 bytes. This code is buggy (bug fix: 25:7C74 --> 12).

 

Structure:

 

[7C][2byte pointer to 5byte command queue]

 

See Additional documentation: Command queue.

 

7D Delete command queue:                                                                                                     Top

------------------------

 

Deletes a command queue and frees a slot in ram.

 

Structure:

 

[7D][First command of the resp. queue]

 

See Write command queue, Additional documentation: Command queue.

 

 

7E Song code1:                                                                                                                             Top

--------------

 

Immediately plays the music.

 

Structure:

 

[7E][Music no (2byte)]

 

Music no: See the music archive that should accompany this document Thanks to Filb. He dumped all the songs via gameboy player and gave them to me.

 

7F Song code2:                                                                                                                     Top

--------------

 

Plays the music of the trainer group in TrRAM1. Takes music numbers from list at 3A:5027.

 

Structure:

 

[7F]

 

80 Music fade-out code:                                                                                                Top

-----------------------

 

The current music is faded out and the new music is played afterwards.

 

Structure:

 

[80][Music no (2byte)][Time to fade out (00-7F)]

 

81 Play map music code:                                                          Top

-----------------------

 

Starts playing the original map music. Includes special check for surfer and bug contest song.

 

Structure:

 

[81]

 

82 Map reload music code:                                                                                                Top

-------------------------

 

After a map reload no music is played.

 

Structure:

 

[82]

 

83 Cry code:                                                               Top

------------

 

Plays the Pokémon’s cry.

 

Structure:

 

[83][Cry no][00]

 

If the cry no = 00 then the number is taken from RAM..

 

84 Sound code:                                                             Top

--------------

 

Plays the sound.

 

Structure:

 

[84][Sound no (2byte)]

 

Sound no: See the music archive that should accompany this document Thanks to philb for this matter. He helped me to record a big part of these sounds.

 

85 Key-down code:                                                                                                            Top

-----------------

 

Waits for the Player to press a button.

 

Structure:

 

[85]

 

86 Warp sound:                                                                                                                      Top

--------------

 

Evaluates which sound is played when HIRO enters a Warp field. Usage via script ingame is rather not useful.

 

Structure:

 

[86]

 

87 Special sound:                                                                                                                   Top

-----------------

 

When last given/checked Item was a TM then it plays sound 0x9B. If not, then 0x01.

 

Structure:

 

[87]

 

88 Engine remote control:                                                  Top

-------------------------

 

This code controls the engine via “data stream”.

 

Structure:

 

[88][3byte pointer to control structure]

 

See Additional data structures A.

 

89 Load map anew:                                                                                                            Top

-----------------

 

The number decides which map loading process is used. The number must be 0xF0 + process number to work correctly.

 

Structure:

 

[89][Number]

 

See Additional documentation: Map loading processes.

 

8A Waiting code:                                                                                                                                Top

----------------

 

This code lets the game wait for 2 * xx time intervals.

 

Structure:

 

[8A][xx]

 

xx: Numbers from 0x01 to 0xFF. If 0x00 is chosen then the time can be manipulated by previously loading a number to RAM2.

 

8B Deactivate static facing:                                                                                              Top

----------------------------

 

Deactivates static facings on all persons on the screen after a time xx.

 

Structure:

 

[8B][xx]

 

8C Priority jump1:                                                                                                                  Top

------------------

 

The pointer acts like code 00, but with this higher functions like the bike etc. are not paid attention to, while the script is running.

 

Structure:

 

[8C][2byte pointer to script]

 

8D Warp check:                                                                                                                      Top

--------------

 

If HIRO is entering or leaving a warp then this code reactivates all the engine-checks.

 

Structure:

 

[8D]

 

8E Priority jump2:                                                                                                                         Top

------------------

 

The pointer acts like code 03, but with this code all higher functions wait for a cycle before the script gets interpreted.

 

Structure:

 

[8E][2byte pointer to script]

 

8F Return code1:                                                                                                                         Top

----------------

 

Ends the current script and loads the backup offset for “linked” scripts if applicable. The sophisticated functions are not affected and run like before the code. This code is mostly used for scripts called by the 2nd part of the script header, because else malfunctions occur.

 

Structure:

 

[8F]

 

90 Return code2:                                                                                                                         Top

----------------

 

Ends the current script and loads the backup offset for “linked” scripts if applicable.  The sophisticated functions get reset if no backup offset was loaded. This code is used to end most scripts.

 

Structure:

 

[90]

 

91 Return code3:                                                                                                                         Top

----------------

 

Reloads the map completely like the code 0x7A and else acts completely like Return code2

 

Structure:

 

[91]

 

See Reload map code, Return code2.

 

92 Reset sophisticated functions:                                                                                     Top

---------------------------------

 

Resets all sophisticated functions to 0.

 

Structure:

 

[92]

 

93 Mart menu:                                                                                                                       Top

-------------

 

Displays a whole mart menu, however, doesn’t load font to ram.

 

Structure:

 

[93][Dialog no][Mart no (2byte)]

 

See Application example, Additional table B.

 

94 Elevator menu:                                                                                                                               Top

-----------------

 

Displays a whole elevator menu, however, doesn’t load font to ram. Only works with warps with warp-to = 0xFF.

 

Structure:

 

[94][2byte pointer to floor list]

 

See Application example, Additional table B.

 

95 Trade menu:                                                                                                                      Top

--------------

 

Displays a whole trade menu, however, doesn’t load font to ram.

 

Structure:

 

[95][Trade no]

 

See Additional documentations: Trade.

 

96 Give cell phone number with YES/NO:                                                                                      Top

--------------------------------------

 

Gives a telephone number but asks for decision beforehand.

Gives feedback:         00 = OK

                        01 = Cell phone number already registered/Memory full

                        02 = NO chosen

 

Structure:

 

[96][Cell phone number]

 

97 Call code:                                                                  Top

-------------

 

Displays the upper cell phone box and displays a freely selectable name.

 

Structure:

 

[97][2byte pointer to name of caller]

 

98 Hang-up code:                                                                     Top

----------------

 

Simulates the hanging-up.

 

Structure:

 

[98]

 

99 Decoration code:                                                            Top

-------------------

 

Displays monologues according to the selected ornament.

 

Structure:

 

[99][xx]

 

xx:

 

00 = Map/Poster

01 = Ornament left

02 = Ornament right

03 = Huge doll

04 = Console

 

9A Fruit tree code:                                                            Top

-------------------

 

Creates a typical fruit tree monologue. There is a maximum of 32 fruit trees in the game. After this code the script ends.

 

Structure:

 

[9A][Fruit tree number]

 

Fruit tree number + 11:4091 is the offset where the item no of the berry is defined.

 

9B Cell phone call code:                                                           Top

------------------------

 

Initiates with the next step on a outer world map (permission byte) a phone call.

 

Structure:

 

[9B][Call no][00]

 

Call no:

 

01 = PokéRus

02 = Pokémon stolen

03 = Egg examined/ Assistant in Viola City

04 = Team Rocket on the radio

05 = PROF. ELM has got something for HIRO

06 = Bike shop gives bike away

07 = Mother is unhappy that HIRO didn’t talk to her before leaving

08 = PROF. ELM has got something for HIRO a second time

 

9C Check cell phone call code:                                                  Top

------------------------------

 

Checks if a phone call is “in the line”. Gives feedback:   00 = No

<> 00 = Call number

 

Structure:

 

[9C]

 

9D Commented give item code:                                                        Top

----------------------------

 

The same as 0x1F but this code comments where HIRO puts what item in a short monologue.

 

Structure:

 

[9D][Item][Amount]

 

9E Load special wild PKMN data:                                                     Top

-------------------------------

 

Activates the checks in the special tables for the wild Pokémon data.

 

[9E][Mapbank][Map no]

 

See Additional documentation: Wild Pokémon data.

 

9F Hall of Fame code:                                                             Top

---------------------

 

Saves and enters HIRO’s complete Team in the Hall of Fame. Shows the credits and restarts the game with HIRO located in New Bark Town.

 

Structure:

 

[9F]

 

A0 Credits code:                                                                   Top

----------------

 

Shows the credits and HIRO is located on the Silver mountain plateau.

 

Structure:

 

[A0]

 

A1 Facing warp:                                                                     Top

---------------

 

Acts like code 0x3C but defines the desired facing of HIRO.

 

Structure:

 

[A1][Facing (00-03)][Map bank][Map no][X][Y]

 

A2 MEMORY code:                                                                     Top

---------------

 

MEMORY1, 2 or 3 can directly be filled with a string from a different rom bank.

 

Structure:

 

[A2][2byte pointer][Bank][00-02 MEMORY]

 

A3 Display any location name:                                                    Top

-----------------------------

 

By the location number the name of that location is written to TEMPMEMORY1.

 

Structure:

 

[A3][Location no]

 

 

Application examples:                                                                                                              Top

---------------------

 

06-0B:                                                                                                                                     Back

------

 

Approximate values for Pokémon happiness check:

 

C7 - Pokémon is very, very happy

95 - Pokémon is very happy

63 - Pokémon is happy

31 - Pokémon is not very happy

 

0F3E00:                                                                                                                                  Back

-------

 

[0F][3E][00][68][00][F2][CE]

 

Lets HIRO walk 1 step in facing direction.

 

15:                                                                                                                                          Back

---

 

Predefine Pokémon call: (see 0F5E00)

 

15 = Code for loading variable

xx = Number of Pokémon

 

Structure: [15][xx][0F][5E][00]

 

Train ride: (see 0F2300)

 

15 = Code for loading variable

xx = Number 00 = Goldenrod to Saffron; 01 = Saffron to Goldenrod

 

Structure: [15][xx][0F][23][00]

 

4F,58,50:                                                                                                                                  Back

---------

 

[4F][Pointer][58][8A][Time][50]

 

The text box is kept open for some [time], if in the data structure2 the bit7 of the first byte equals 0.

 

Let Pokémon appear:                                                                                                   Back

-------------------

 

Set last talked to Person to 0xFF (“none”): [67][FF]

 

Load type of fight: [1E][03][Type of fight*]

 

Load Pokémon: [5C][Pokémon][Level]

 

Start battle: [5E]

 

( Musik aus: [82] )

 

Reload map: [7A]

 

 

* 09 for "A wild PKMNNAME appears."; Withdraw possible

* 08 for "PKMNNAME falls from tree."

* 07 for a shiny PKMN

* 06 for win without actual fight

* 05 for fight with possible withdraw

* 04 for "The caught PKMNNAME attacks." (Rod)

* 03 for fight with DUDE’s back pic

* 02 for fight with HIRO’s back pic

* 01 for fight with possible withdraw

* 00 for fight with possible withdraw

 

 

93:                                                                                                                                              Back

---

 

[6A][47][93][00][0000][53][49][90]

 

This script lets the talked-to person turn to HIRO, opens a dialog box and loads the font into ram, opens the mart menu, lets player do things in there and closes the box afterwards and returns to the ingame engine.

 

94:                                                                                                                                              Back

---

 

[47][94][2byte pointer][53][49][90]

 

2byte pointer: [03][010B0C][FF]

 

This script opens a dialog box, creates the elevator dialog with 1st floor (1L), lets player choose from the list, closes the bock and returns to the ingame engine.

 

Additional table A:                                                                                                          Top

-------------------

 

1C, 1D, 1E:                                                                                                                         Back

-----------

 

Load de and b from 3:418D + xx*3

b >=80 : Call de + code specific event (see documentation)

b >=40 : code specific event (see documentation)

b <40 : [de] --> CF7E, yy --> CF7E + Code specific event (see documentation)

 

Table at 03:418D:

 

Simple expressed events:

 

‘00 = CF7E --> CF7E

‘01 = DA22 --> CF7E

‘02 = [CFE9] AND 7F --> CF7E

03 = D119

‘04 = D157 --> CF7E

‘05 = Count used (=1) bits in 20bytes from DBE4 --> D151,D151 --> CF7E

‘06 = Count used (=1) bits in 20bytes from DC04 --> D151,D151 --> CF7E

‘07 = Count used (=1) bits in 2bytes from D57C --> D151,D151 --> CF7E

08 = D682

‘09 = ([D205] AND C) / 4 --> CF7E

‘0A = FF96 --> CF7E

‘0B = [D1F7] MOD 7 --> CF7E

‘0C = DA00 --> CF7E

‘0D = DA01 --> CF7E

‘0E = Number of Bytes that are <> 0 beginning from DC24 (Max 1A Bytes) --> CF7E

‘0F = D083 --> CF7E

‘10 = 14 - [1:AD6C] --> CF7E

‘11 = D193 --> CF7E

‘12 = DA03 --> CF7E

‘13 = DA02 --> CF7E

‘14 = D97B --> CF7E

 

‘ = no write-to possible because it’s only being written to a backup memory address..

 

30:                                                                                                                                              Back

---

 

Table at 0xBBAF7:

 

9E – Flower letter

B5 – Surf mail

B6 – Litebluemail

B7 – Portraitmail

B8 – Lovely mail

B9 – Eon mail

BA – Morph mail

BB – Bluesky mail

BC – Music mail

BD – Mirage mail

 

 

Additional table B:                                                                                                          Top

-------------------

 

31, 32, 33, 34, 35, 36:                                                                                                                Back

-----------------------

 

Table 1:

--------

 

This is only a small compendium and most of these are most likely not accurate or have only 1 function

 

* - are reset to 0 on every map change

 

0000*= free for any usage

0001*= free for any usage

0002*= free for any usage

0003*=

0004*=

0005*=

0006*=

0007*= disables advanced calling dialogs when calling MOM

0010 = TR in Azalea beaten, helped in Ilex Forest, charcoal not got

001A = Start Pokémon got

002B = TR in Azalea beaten, not helped in Ilex Forest

0049 = Door in underground1

004A = Doorkey for radio tower

004B = 2.Possibility 3rd floor Goldenrod Mart / Counter1

005B = Bike in bikeshop

005C = Bianca beaten/not beaten

005E = Helped slowpoke in Azalea, helped in Ilex Forest, charcoal got

005F = 1.Possibility 3rd floor Goldenrod Mart / Counter1

0061 = Blackbelt in Mt. Mortar beaten, Tyrogue got

00C9 = Transformer in power plant

00CA = Phone call in power plant

00CD = Transformer for power plant brought back

00DF = got TM in power plant

0209 = 1.Script of 1.room at Indigo Plateau

02E2 = Switch in Mahagony Town underground1

030A = TOP FOUR Will

030B = 1.Script of 2.room at Indigo Plateau

030C = TOP FOUR Koga

030D = 1.Script of 3.room at Indigo Plateau

030E = TOP FOUR Bruno

030F = 1.Script of 4.room at Indigo Plateau

0310 = TOP FOUR Karen

0311 = 1.Script von 5.room at Indigo Plateau

0312 = TOP FOUR CHAMP Lance

0305 = Left box pile in underground3 Goldenrod City there/not there

0306 = right box pile in underground3 Goldenrod City there/not there

0706 = Stone1 (counted from top) in Blackthorne City Arena

0707 = Stone2 (counted from top) in Blackthorne City Arena

0708 = Stone3 (counted from top) in Blackthorne City Arena

 

 

Table 2: Max = 5C

--------

 

* - are reset to 0 on every map change

+ - are reset to 0 on every change of the day

 

Customarily 1 always means on and 0 always means off. Exceptions to this are in the descriptions.

These are hardcoded and very accurate.

 

0000 = Radio module for POKéGEAR

0001 = Map module for PokéGEAR

0002 = Phone module for PokéGEAR

0003 = Special kit for PokéDEX

0004 = POKéGEAR

0005 = Pokémon in breeding laid EGG

0006 = Count steps1 (EggHatch)

0007 = Count steps 2 (EggHatch)

0008 = Mother saving menu for 0F2200

0009 = Mother intro dialogue for 0F2200

000B = PokéDEX

000C = Unown-Dex

000D = PokéRus

000E = Team Rocket radio signal on channel 20

000F = B button in credits

0010 = Bug contest (music, no wild PokéBattles, ParkBattles, ParkMenu etc.)

0011 = Bug contest, signifies clock turn off, when bit was set earlier

0012 = Music >7F--> Rocket(1)/Regular(0) (Radio tower)

0013 = Bikeshop call possible (HIRO still needs to do 1024 steps on the bike)

0014 = Set b5 D572                                             

0015 = Give random PokéRUS; and Berry juice for Shuckle with berry possible when trading

0016 = Mark Mahagony music Rocket(1)/Regular(0)

0017*= Strength

0018*= Surfer on(0)/off(1)

0019*= steady going down (Fuchsia bike path)

001A = Falkner

001B = Bugsy

001C = Whitney

001D = Morty

001E = Jasmine

001F = Chuck

0020 = Pryce

0021 = Clair

0022 = Kanto Badge1

0023 = Kanto Badge2

0024 = Kanto Badge3

0025 = Kanto Badge4

0026 = Kanto Badge5

0027 = Kanto Badge6

0028 = Kanto Badge7

0029 = Kanto Badge8

002A = Unown set1

002B = Unown set2

002C = Unown set3

002D = Unown set4

002E = Unown set5

002F = Unown set6

0030 = Unown set7

0031 = Unown set8

0032 = Fly destination 1

0033 = Fly destination 2

0034 = Fly destination 3

0035 = Fly destination 4

0036 = Fly destination 5

0037 = Fly destination 6

0038 = Fly destination 7

0039 = Fly destination 8

003A = Fly destination 9

003B = Fly destination 10

003C = Fly destination 11

003D = Fly destination 12

003E = Fly destination 13

003F = Fly destination 14

0040 = Fly destination 15

0041 = Fly destination 16

0042 = Fly destination 17

0043 = Fly destination 18

0044 = Fly destination 19

0045 = Fly destination 20

0046 = Fly destination 21

0047 = Fly destination 22

0048 = Fly destination 23

0049 = Fly destination 24

004A = Fly destination 25

004B = Fly destination 26

004C = Fly destination 27

004D = Lucky Number Show in Goldenrod City

004E = Set b3 D572

004F+= Kurt when forging PokéBalls

0050+= Bug Contest

0051+= Special wild Pokémon data loaded

0052+= time capsule (24h wait before first trade possible)

0053+= all fruit trees in the game

0054+= Shuckle given

0055+= Goldenrod Underground Person07 closed

0056+= Fighting Range in Viridian City

0057+= Mt. Moon event

0058+= Lapras event in Union Cave

0059+= Goldenrod Underground Person09 haircut done

005A+= Goldenrod Mall happiness event Floor05 Person07

005B+= Tea in Gary’s House

005C+= Indigo Plateau Pokémon Center challenge of rival

 

68, 69:                                                                                                                                    Back

-------

 

Always in order: down, up, left, right; always 4 per action

This rule ends from code 0x45 on. Items with variables in parentheses, (xx), have a variable after them.

 

Moving scripts:

 

00 = Turn head

04 = ½ step

08 = slow step

0C = step

10 = 1½ step

14 = slow slide 1 step

18 = slide 1 step

1C = fast slide 1 step

20 = Turn 1 step (Face opposite of HIRO)

24 = Turn 1 step (Facing HIRO)

28 = 1 step in waterfall mode (facing changes between down and right)

2C = slow jump over 1 step

30 = jump over 1 step

34 = fast jump over 1 step

3A = remove fixed facing

3B = fix facing

3D = hide person

45 = make move before command faster

46 = Wait for time (xx as time)

47 = End of moving script

49 = hide person

4C = Teleport from

4D = Teleport to

4E = Fall from above screen

4F = 5 whole turns

55 = Shake screen (xx as displacement)

 

93:                                                                                                                                              Back

---

 

Dialogues:

 

00 = „Welcome! How can I help you?“ dialogue

01 = bitter herb medicine dialogue

02 = rare items dialogue (exchanges mart inventory and every item can only be bought once)

03 = sell medicine dialogue

 

 

Marts:

 

00 = Cherrygrove City without PokéBalls

01 = Cherrygrove City with PokéBalls

02 = Violet City

03 = Azalea Town

04 =

05 = 2nd floor Goldenrod City Mart/ Counter1

06 = 2nd floor Goldenrod City Mart/ Counter2

07 = 3rd floor Goldenrod City Mart

08 = 4th floor Goldenrod City Mart

09 = 5th floor Goldenrod City Mart/ Counter1, if all ??? aren’t enabled

0A = 5th floor Goldenrod City Mart/ Counter1 when ???

0B = 5th floor Goldenrod City Mart/ Counter1 when ???

0C = 5th floor Goldenrod City Mart/ Counter1 when ???

0D =

0E =

0F =

10 = Mahagony town

11 = Blackthorne City

12 =

13 = Pewter City

14 = Cerulean City

15 = Lavender

16 = Vermillion City

17 = 2nd floor Prismania City Mart/ Counter1

18 = 2nd floor Prismania City Mart/ Counter2

19 = 3rd floor Prismania City Mart

1A = 4th floor Prismania City Mart

1B = 5th floor Prismania City Mart/ Counter1

1C = 5th floor Prismania City Mart/ Counter2

1D = Fuchsia City

1E =

1F = Mt. Moon-Shop

20 = Indigo Plateau

21 =

>=22 =

 

94:                                                                       Back

---

 

Floor list:

 

[Number of floors][Floor name][Warp-To-Data for elevator]

 

Number of floors:

 

Number of all floors and undergrounds.

 

Floor name:

 

Number for the floor name. Number:

 

00 = B4F

01 = B3F

02 = B2F

03 = B1F

04 = 1F

05 = 2F

06 = 3F

07 = 4F

08 = 5F

09 = 6F

0A = 7F

0B = 8F

0C = 9F

0D = 10F

0E = 11F

0F = ROOF

 

Warp-To-Data for elevator:

 

The same as the last 3 bytes of every warp: [Warp-To no.][Map bank][Map no.]

 

Additional datastructures A:                                                         Top

-----------------------------

 

4F:                                                                              Back

---

 

Data structure1:

[Byte][Y start][X start][Y end][X end][2b pointer to data structure2][Default index for arrow]

 

If 1.byte:

 

Bit3 = No button sounds (buggy; Bug fix : 0x1E64--> FA)

Bit4 = Interprets sprites via the OAM sprite routine (Ingame clear ram from C508 for C1 bytes!)

Bit6 = 1 --> Write backup of later menu tiles to ram; Set bit0 of the written data

Bit6 = 0; Bit7 = 1 --> Write backup of later menu tiles to ram; Set bit0 of the written data

Bit6 = 0; Bit7 = 0 --> Don’t write backup of later menu tiles to ram; Reset bit0 of the w data

 

 

In the ingame sprite engine is running, ingame sprites are hidden.

 

 

50:                                                                                                                                              Back

---

 

If no text box is on the screen (Attention: This doesn’t concern backup data):

 

Display text: “There are no windows available for the trade.” After that LOOP.

 

If bit0 of the 1.byte of the written data = 0: Don’t write last backup to screen

If bit0 of the 1.byte of the written data = 1: Write last backup to screen

 

57:                                                                                                                                       Back

---

 

Data structure2:

[Byte][Rows|Columns][Spacing][RomBankTXT][2b pointerTXT][RombankSCR][2b pointerSCR]

 

Byte:

 

Bit0 = 1 --> only allow A button

Bit0 = 0 --> allow A and B button

Bit1 = 1 --> Select button acts like “Yes” button (Select doesn’t play a button sound)

Bit5 = 1 --> Overscrolling horizontally/vertically possible

Bit6 = 0 --> Text starts at Y+2 in the text box

Bit7 = 1 --> Text starts at X+2 in the text box (X start Y start from data structure1)

 

Rows/Columns:

 

The “tens” give rows, the “ones” give columns. Items are always shown 2 rows below the last one.

 

Spacing:

 

Spacing between horizontal items.

 

RomBankTXT:

 

The rom bank of the text data. Is set by script so can be empty.

 

PointerTXT:

 

Points to items. Items are divided by 0x50.

 

RombankSCR:

 

Rom bank of an ASM script.

 

PointerSCR:

 

Points to an additional ASM script that is interpreted before creating any boxes.

If pointer = 0000, then no script is chosen.

 

58:                                                                                                                                              Back

---

 

Datastructure2: [Byte][Number of items][Items][Displacement][Title]

 

Byte:

 

Bit4 = 1 --> There is a box title after the items are finished

Bit6 = 0 --> Text starts at Y+2 in the text box

Bit7 = 1 --> Text starts at X+2 in the text box (X start Y start from data structure1)

Bit7 = 0 --> No option to select anything (see Application example)

 

Number of items:

 

Number of items. Items are always shown 2 rows after the last shown item.

 

Items:

 

Items are divided by 0x50.

 

Displacement:

 

Displacement of the title regarding the box start in direction of x. Only if bit4 of Byte = 1.

 

Title:

 

Title ends with 0x50.

 

88:                                                                                                                                              Back

---

 

The “data stream” consists always of [Button][Times] ...

 

Button:

 

00 = No button

01 = A button

02 = B button

04 = Select

08 = Start

10 = Left

20 = Right

40 = Up

80 = Down

FF = End of “datastream”

 

Times:

 

Defines how often the button is repeatedly hit. If times = 0xFF, then it’s an infinite loop, when <> FF then normal amount of hits.

 

Additional documentations:                                                    Top

--------------------------

 

3:4661:

-------

 

c = bit to check/set/reset

hl = address (RAM/ROM)

d = bank. If 00 then RAM, if <>00 then ROM. Only if used by check codes.

b = 1: set        2: check d=00=RAM d<>00=ROM        3:reset

 

23C8:

-----

During regular gameplay the map for blackout return is determined as follows (during warp on any map):

 

 

New map needs to have permission byte 01 or 02.

Old map needs to have permission byte 03, 04, 07 or 06.

New map must use tileset 06.

 

--> Old map is set to be blackout return map.

    This reflects the warp to a Pokémon Center.

 

 

Map loading processes:

---------------------

 

After all there are 11 different map loading processes:

 

00: 01 02 17 1A 14 22 23 1F 0A 0D 0E 10 16 00 11 21 13 07 09 1E 29 12 FF

   

01: 01 02 1B 1F 15 0A 0B 0D 0E 10 00 11 13 07 1E 29 12 FF

   

02: 06 1C 01 02 0A 0B 0E 10 00 11 13 08 1E 29 12 FF

   

03: 1D 24 27 01 02 17 1A 14 22 23 1F 0A 0D 0E 10 16 00 11 21 13 07 09 1E 29 12 FF

    After fight

04: 1D 19 1A 20 14 23 0A 0D 01 0E 10 28 00 16 11 13 05 1E 29 12 26 FF

   

05: 24 1D 19 1A 20 14 23 0A 0D 01 0E 10 28 00 16 11 13 05 1E 29 12 26 FF

    Enter warp

06: 2A 18 1A 14 23 0A 0F 0C 16 05 11 2B 12 26 29 FF

   

07: 06 01 02 14 0A 0D 0E 10 00 11 13 07 1E 29 12 2C FF

    Warpless map connection

08: 19 1A 20 14 23 0A 0D 01 0E 10 28 00 16 11 13 05 1E 29 12 26 FF

   

09: 0A 0B FF

   

0A: 17 1A 14 22 23 1F 0A 0D 01 0E 10 28 00 16 11 21 13 05 1E 29 12 FF

 

 

The codes are interpreted as follows:

 

00 = Turn LCD on

01 = Turn LCD off

02 = Turn speakers of

03 = Music check for current map/ special check for bug catcher contest

04 = Start map music anew

05 = Music check for current map / special check for Bug Contest/ music with FadeOut (old) and FadeIn

06 = Fill palettes with 7FFF (=white)

07 = If HIRO is on bike = bike music, else play map music

08 = Play map music

09 = Turn music to highest volume

0A = Write map data to MapRAM

0B = Compute map’s connection pars and write into MapRAM

0C = Write current part of map into temporary memory

0D = Write current part of map into read-from memory

0E = Write tileset header to ram/ load tileset/ load sprite tiles/ load special tiles

0F = Write tileset header to ram

10 = Compute time of day/ Update screen

11 = Load map palettes

12 = Load probabilities for wild Pokémon battles

13 = Delete sprite data and draw new sprites

14 = Check 2nd script header for 05 and 03 events

15 = Check 2nd script header for 03 events

16 = Analyze people data anew and check 2nd script header for 02 events

17 = Writes arrival data for arrival by flying/Blackout from table 05:5319 to ram

18 = Writes arrival data for entering a map by connection to ram

19 = Write warp data to ram when entering warp

1A = Load complete map data (5 bytes from primary map header, 12 bytes from secondary map header and events and scriptheader data) to ram

1B = Same as 1A, but some settings aren’t loaded new from the rom, such as hide function of the people events

1C = Fill palette data with FFFF (=white)

1D = All BG pallet color are converted to 0|0 (Pal0, Col0), all sprite colors to x|0 (FadeOut)

1E = Palette FadeIn

1F = Compute position of upper left-most block visible on screen

20 = Position computation when HIRO leaves a warp

21 = Set HIRO’s facing to “down”

22 = Prepare HIRO data for arrival by flight

23 = Compute HIRO x/y data anew

24 = Prolong sprite displaying

25 = Influence sprite displaying

26 = Delete sprites

27 = Compute chances to meet Raikou, Entei or Suicune

28 = Recover chances to meet Raikou, Entei or Suicune

29 = Temporarily stop music playing

2A = Activate animations

2B = Deactivate animations

2C = Recover all palettes

2D = Deactivate code prolonging

 

Command queues:                                                                  Back

---------------

 

1 command queue can have 5 bytes max, nevertheless most times only the first byte is the actual code, the rest is mostly backup memory.

 

Codes:

 

01 = Compare HIRO X/Y values with the ones of the by X/Y-Comparison loaded table

02 = Stone/Warp check

Checks if a stone on the screen is currently on a hole with collision data 0x60 or 0x68 and reads then from a table what script to run.

Structure of the data to be loaded:

 

[02][2byte pointer to Table in the same rom bank as originating script]

 

Table:

 

[Warp no.][People nr of stone][2byte pointer to Script] ... [FF]

 

03 = Nothing

04 = Shake screen

     Shakes screen for a short time

     Structure of data to be loaded:

 

     [04][03][Displacement y in pixels]

 

 

 

Trading:                                                                                                                                   Back

--------

 

The data for the trade Pokémon start at 3F:4C24. Every data structure looks like this:

 

[Dialog no.][Give Pokémon][Trade Pokémon][0x0A for PKMNNAME][2xDV][Item][2xID][0x0A for TRAINERNAME][Sex][00]

 

Dialog no.:

 

00 = „I collect Pokémon. Do you have a GP? Do you want to trade it for my TP?“

01 = „Hi, I’m looking for a Pokémon. If you have a GP would you trade it for my TP?“

02 = „@CF48 is cute, but I don’t have one. Do you have a GP? Do you want to trade it for my TP?“

 

Give Pokémon:

 

Pokémon number of Pokémon that needs to be given.

 

Trade Pokémon:

 

Pokémon number of Pokémon that is traded for.

 

PKMNNAME:

 

10 figures for a nickname + 0x50

 

DV:

 

2 bytes for the DV of the PKMN:

 

4 Bit each for attack, defense, initiative, special

 

Male/Female if attack > resp. < than 7.

 

Shiny status of:

 

-          Attack = 2,3,6,7,A,B, E or F

-          Initiative and special are A

-          Defense is redundant

 

Thanks to Pika. He made these things public domain on his website.

 

 

Item:

 

Number of item carried by the Pokémon.

 

ID:

 

2 bytes for the new Poké ID.

 

TRAINERNAME:

 

10 bytes for the trainer name + 0x50.

 

Sex:

 

00 = random

01 = male

02 = female

 

Wild Pokémon data:                                                                                                                         Back

------------------

 

There are 6 wild Pokémon tables in the game at 0A:77C0, 0A:6B35, 0A:7D43, 0A:7669, and 2 special tables at 0A:7E1C and 0A:7ED9.

 

The first 4 are used as follows; In case the current map music is 0x00 the last map music is taken:

 

0A:77C0 und 0A:6B35:                             0A:7D43 und 0A:7669:

 

 

The first is used if the music <> 0x5E of if greater than/same as 0x2E.

The second one is used if music = 0x5E or is smaller than 0x2E.

 

Special tables: 0A:7E1C                       0A:7ED9

 

The special tables are only checked if the map has been activated by code 0x9E.

 

Differences of the tables:

 

The tables on the right are only checked if the block or rather the block fourth HIRO is currently on has the collision data in table 3E:74BE + collision number a X1 (Water).

 

Structures of the tables:

 

The tables on the left all have the following structure:

 

[Map bank][Map no.][Chance morn][Chance midday][Chance eve] 0x17 * [Pokémon no.][Level]

 

The table on the right are as follows:

 

[Map bank][Map no.][Chance] 0x03 * [Level][Pokémon no.]

 

Glossary:                                                                                                                                   Top

---------

 

RAM = D173

RAM2 = D174

PokéRAM = D117

LevelRAM = D040

TrRAM1 = D118

TrRAM2 = D11B

BattleRAM = D180

TEMPMEMORY1 = CF6B

TEMPMEMORY2 = CF7E

MEMORY1 = CF91

MEMORY2 = CFA4

MEMORY3 = CFB7

MapRAM = C700+

 

Feedback is always stored in RAM.

2byte values like ram offsets or bit no. are always written bytes flipped around!

Numbers without a 0x in front are decimal, with are hexadecimal (mostly).

Especially for numbers with “+ value” no amount of anything is meant but rather a byte.

 

 

Event structure:                                                                                                                         Top

----------------

 

In every secondary (second) map header there is a pointer to 2 bytes before the actual events start. In general the structure of this data is as follows:

 

[Number of warps] Number * [Warp data][Number of triggers] Number * [Trigger data][Number of signposts] Number * [Signpost data][Number of people] Number * [People data]

 

What this data looks like for 1 event is shown in the following schemes:

 

Warps:

 

[Y position][X position][Warp-To][Map Bank][Map]

 

If Warp-To = 0xFF, then the warp can be edited by script. See Warp modifier, Elevator menus.

 

Trigger events:

 

[Number][Y position][X position][00][Script pointer (2byte)][00][00]

 

Number must be the same as the activated trigger number for the trigger to be active.

 

Signposts:

 

[Y position][X position][Function][Script pointer (2byte)]

 

Function:

 

00 = Sign can be read from all directions     

     Script pointer to script

 

01 = Sign can only be read from below

     Script pointer to script

 

02 = Sign can only be read from above

     Script pointer to script

 

03 = Sign can only be read from right

     Script pointer to script

 

04 = Sign can only be read from left

     Script pointer to script

 

05 = If bit of BitTable1 is set then pointer is interpreted

     Script pointer to [Bit-Nr. (2byte)][2byte pointer to script]

 

06 = If bit of BitTable1 is not set then pointer is interpreted

     Script pointer to [Bit-Nr. (2byte)][2byte pointer to script]

 

07 = If bit of BitTable1 is set then item is given

     Script pointer to [Bit-Nr. (2byte)][Item no.]

 

08 = No Action

     Script pointer to [Bit-Nr. (2byte)][??]

 

 

People events:

 

[Picture][Y from top+4][X from left+4][0-4 for regular, 6-9 for static facing][Movement][Clock-/Time setting (2byte)][Color|Function][Range of sight for trainers][2byte pointer to script][Bit no. of BitTable1 (Hidden if set)(FFFF for none)(2byte)]

 

Clock/Time setting:

 

If 1. Byte <> FF, then it’s a clock setting.

If 1. Byte = FF , then it’s a time setting.

 

Clock setting:

 

“2.byte < current hour < 1.byte“ must be true fort he people event to be hidden.

 

Time setting:

 

The 2.byte must be 01, 02 or 04. 01 for shown in morn, 02 for midday and 04 for evening.

 

There is a maximum of 14 people per map.

 

Color|Function:

 

The byte is split in 2x 4 bit.

 

The first half of 4 bits determines the color:

 

00 = standard color (from Person table)

<> 00 = color from a sprite palette

 

The second  half of 4 bits determines the function:

 

00 = regular script event : script pointer points to script

01 = Give item : script pointer points to this structure:

 

[Item no.][Amount]

 

The people event must have a bit no or else this can be accessed freely again and again!

 

02 = Trainer: scriptpointer points to this structure:

 

[Bit no. (2byte)][Trainer group][Trainer][2byte pointer to Text when seen]

[2byte pointer to text when trainer beaten][2byte pointer to script when lost (0000=Blackout)][2byte pointer to script if won/talked to again]

 

The bit no. tell the game later on if the trainer has been beaten already (bit = 1) or not (bit = 0). All Bit no. of BitTable1.

 

03 = Nothing

04 = Nothing

05 = Nothing

06 = Nothing

 

 

Special pointer for script pointer:

 

Object event     : 2812 (only for person events, head turn)

BG event         : 281A

Coordinates event: 2822

 

 

In-Text codes:                                                                   Top

--------------

 

Always when a script points to a text, it begins with a code. After any code can be any code again.

 

00 = Write text. Structure: [00][Text][0x50 (ends code)]

 

01 = Write text from ram. Structure: [01][Ram address (2byte)]

      For valid ram addresses see Glossary. This enables use of variable text strings.

 

02 = Write number from ram. Structure: [02][Ram address (2byte)][Byte]

 

      Byte:

     

      Bit5:Bit6:Bit7

         1:   1:   1 = PokéDollar| Don’t write zeros

         0:   1:   1 = Don’t write zeros

         0:   0:   1 = Spaces instead of zeros

         0:   0:   0 = Write zeros

         0:   1:   0 = Write zeros

         1:   0:   0 = PokéDollar

         1:   1:   0 = PokéDollar

         1:   0:   1 = Spaces instead of zeros| PokéDollar

 

      Number of figures = Byte AND 0x1F *2

      No Hex --> Dec Conversion

     

03 = Define new ram address to write to. Structure: [03][Ram address (2byte)]

 

04 = Write a box. Structure: [04][Ram address (2byte)][Y][X]

 

05 = New ram address to write to become 2. line of a text box. Structure: [05]

 

06 = Wait for key down + show arrows. Structure: [06]

 

07 = New ram address to write to become 2. line of a text box Textbox + show arrows. Structure: [07]

 

08 = After the code an ASM script starts. Structure: [08][Script]

 

09 = Write number from rom/ram in decimal. Structure: [09][Ram address/Pointer (2byte)][Byte]

 

      Byte:

 

      Is split: 1. 4 bits = Number of bytes to load. 0 = 3, 1 = 1, 2 = 2

                2. 4 bits = Number of figures of displayed number

                                                     0 = Don’t care

                                                     1 = Don’t care

                                                     >=2 = Number

 

0A = Interpret Data stream. Structure: [0A]

 

0B = Play sound 0x0000. Structure: [0B]

 

0C = Interpret Data stream. Structure: [0C][Number of codes to interpret]

 

      For every interpretation there is a“…“ written

 

0D = Wait for key down  display arrow. Structure: [0D]

 

0E = Play sound 0x0009. Structure: [0E]

 

0F = Play sound 0x0001. Structure: [0F]

 

10 = Play sound 0x0002. Structure: [10]

 

11 = Play sound 0x000A. Structure: [11]

 

12 = Play sound 0x002D. Structure: [12]

 

13 = Play sound 0x002C. Structure: [13]

 

14 = Display MEMORY. Structure: [14][Byte]

 

      Byte:

 

      00 = MEMORY1      01 = MEMORY2      02 = MEMORY

      04 = TEMPMEMORY2                 05 = TEMPMEMORY1

 

15 = Write current day. Structure: [15]

 

16 = 3byte pointer to new text follows. Structure: [16][2byte pointer][bank]

 

Script header:                                                                   Top  

--------------

 

In every secondary (second) map header there is a so-called “script pointer” which points to the script header. It that structure that allows the game to have e.g. one-time only events on a map or first enter events or permanent changes to the map or permanent script calls.

 

Structure:

 

[[Number1 of pointers] Number1 * [2byte pointer to script][00][00]][[Number2 of pointers] Number2 * [Number][2byte pointer to script]]

 

The first part (bold and in parentheses) and the second part (italic and bold in parentheses) differ greatly in function.

 

The first part requires the map to be in the table at 25:4000, the trigger table, because the triggers and first part scripts can only be controlled by a number which needs to be somewhere in ram.

The second part requires not any special values to be in the ram but it is checked differently often and on different times.

 

First part:

 

The first part uses the trigger numbers to decide which pointer to take. In addition to that the script is so often repeatedly executed until another trigger event is activated by De-/activate trigger events.

 

Scripts of the first part are customarily ended with the Return code2, but the pointer in the header point to a Priority jump1, so the sophisticated functions wait.

 

Second part:

 

The scripts of the second part get executed according to their number at different times while the map is loaded.

 

Number

Status of map

Checks as (as number x.)

01

Map data has already been loaded to ram, tileset and sprites still missing

Map change (3), Loading (2), Map connection (3),After Battle (1)

02

Map data, tileset and sprites are all loaded

Map change (5),

03

Neither map data not tilesets nor sprites are loaded

Map change (2), Loading (1), Map connection (2)

04

Map data and tileset loaded, sprites still missing

Map change (4), Loading (3),Sprite reload (1), Map connection (4), After battle (2)

05

Neither map data not tilesets nor sprites are loaded

Map change (1), Map connection (1)

 

Scripts of the second part are usually ended with the Return code1, or else they interrupt the sophisticated functions.

 

Credits:

--------

 

This material could only be created, because many people helped me out over all these years! Without these people, who always motivated me and helped me to still become better, I could not have completed writing this collection! I should greet especially the old FilbBoard team, which helped me at my beginnings as a rom hacker. I also want to thank Star-Trans – just because our Devil Children project trained me very much.

 

Many thanks are rightfully deserved by F-Zero, who gave me a doc about scripting – without I would have needed much more time preparing this compendium and the release would have been delayed by more than a year!

 

The people that I think of probably feel mentioned – nevertheless I want to especially thank the old FilbBoard moderator team and the Midnight team! Way to go guys!

 

Tauwasser  2004 - 2005