ref: 2d73d040d16a7836f935a7a6cb2a311aed2ca5a2
parent: 3e14c1f26e91b1fc1d18eed389518ae8454e938f
parent: 1cb364cc1825d1b149eb4e0fe09d1cab21006208
author: yenatch <yenatch@gmail.com>
date: Wed Jul 18 20:46:59 EDT 2018
Merge pull request #542 from mid-kid/master Miscellaneous fixes
--- a/audio/sfx.asm
+++ b/audio/sfx.asm
@@ -364,6 +364,7 @@
Sfx_Unknown5F:
musicheader 3, 5, Sfx_Unknown5F_Ch5
musicheader 1, 6, Sfx_Unknown5F_Ch6
+
Sfx_Sandstorm:
musicheader 1, 8, Sfx_Sandstorm_Ch8
--- a/charmap.asm
+++ b/charmap.asm
@@ -2,9 +2,12 @@
; Control characters (see home/text.asm)
+ charmap "<NULL>", $00
charmap "<PLAY_G>", $14 ; "<PLAYER>くん" or "<PLAYER>ちゃん"; same as "<PLAYER>" in English
+ charmap "<MOBILE>", $15
+ charmap "<CR>", $16
charmap "¯", $1f ; soft linebreak
- charmap "<LNBRK>", $22
+ charmap "<LF>", $22
charmap "<POKE>", $24 ; "<PO><KE>"
charmap "%", $25 ; soft linebreak in landmark names
charmap "<RED>", $38 ; wRedsName
--- a/constants/script_constants.asm
+++ b/constants/script_constants.asm
@@ -119,8 +119,14 @@
CMDQUEUE_ENTRY_SIZE EQU 6
CMDQUEUE_CAPACITY EQU 4
-; command queue types
-CMDQUEUE_STONETABLE EQU 2
+; HandleQueuedCommand.Jumptable indexes (see engine/overworld/events.asm)
+ const_def
+ const CMDQUEUE_NULL
+ const CMDQUEUE_NULL2
+ const CMDQUEUE_STONETABLE
+ const CMDQUEUE_TYPE3
+ const CMDQUEUE_TYPE4
+NUM_CMDQUEUE_TYPES EQU const_value
; elevfloor macro values
; ElevatorFloorNames indexes (see data/events/elevator_floors.asm)
--- a/data/phone/non_trainer_names.asm
+++ b/data/phone/non_trainer_names.asm
@@ -12,4 +12,4 @@
.bill: db "BILL:@"
.elm: db "PROF.ELM:@"
.bikeshop: db "BIKE SHOP:@"
-.buena: db "BUENA:<LNBRK> DISC JOCKEY@"
+.buena: db "BUENA:<LF> DISC JOCKEY@"
--- a/engine/battle/ai/scoring.asm
+++ b/engine/battle/ai/scoring.asm
@@ -1550,7 +1550,7 @@
dec [hl]
ret
-Function_0x38d16
+Function_0x38d16:
jp AIDiscourageMove
AI_Smart_DestinyBond:
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -8578,7 +8578,7 @@
db " 0 0 0@"
.Format:
- db " --- <LNBRK>"
+ db " --- <LF>"
db " - - -@"
.Record:
db "<PLAYER>'s RECORD@"
--- a/engine/battle_anims/anim_commands.asm
+++ b/engine/battle_anims/anim_commands.asm
@@ -284,7 +284,7 @@
.loop
call GetBattleAnimByte
- cp $ff
+ cp anim_ret_command
jr nz, .not_done_with_anim
; Return from a subroutine.
--- a/engine/events/battle_tower/battle_tower.asm
+++ b/engine/events/battle_tower/battle_tower.asm
@@ -270,7 +270,7 @@
; Check the nicknames for illegal characters, and replace bad nicknames
; with their species names.
- ld de, wBT_OTTempMon1Name ; $c643
+ ld de, wBT_OTTempMon1Name
ld c, MON_NAME_LENGTH
farcall CheckStringForErrors
jr nc, .skip_mon_1
@@ -280,35 +280,35 @@
call GetPokemonName
ld l, e
ld h, d
- ld de, wBT_OTTempMon1Name ; $c643
+ ld de, wBT_OTTempMon1Name
ld bc, MON_NAME_LENGTH
call CopyBytes
.skip_mon_1
- ld de, wBT_OTTempMon2Name ; $c67e
+ ld de, wBT_OTTempMon2Name
ld c, MON_NAME_LENGTH
farcall CheckStringForErrors
jr nc, .skip_mon_2
- ld a, [wBT_OTTempMon2] ; [$c64e]
+ ld a, [wBT_OTTempMon2]
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld l, e
ld h, d
- ld de, wBT_OTTempMon2Name ; $c67e
+ ld de, wBT_OTTempMon2Name
ld bc, MON_NAME_LENGTH
call CopyBytes
.skip_mon_2
- ld de, wBT_OTTempMon3Name ; $c686 + 51 = $c6b9
+ ld de, wBT_OTTempMon3Name
ld c, MON_NAME_LENGTH
farcall CheckStringForErrors
jr nc, .skip_mon_3
- ld a, [wBT_OTTempMon3] ; [$c689]
+ ld a, [wBT_OTTempMon3]
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld l, e
ld h, d
- ld de, wBT_OTTempMon3Name ; $c686 + 51 = $c6b9
+ ld de, wBT_OTTempMon3Name
ld bc, MON_NAME_LENGTH
call CopyBytes
@@ -315,9 +315,9 @@
.skip_mon_3
; Add the terminator character to each of these names
ld a, "@"
- ld [wBT_OTTempMon1NameEnd - 1], a ; $c64d
- ld [wBT_OTTempMon2NameEnd - 1], a ; $c688
- ld [wBT_OTTempMon3NameEnd - 1], a ; $c68a + 57 = $c6c3
+ ld [wBT_OTTempMon1NameEnd - 1], a
+ ld [wBT_OTTempMon2NameEnd - 1], a
+ ld [wBT_OTTempMon3NameEnd - 1], a
; Fix errors in the movesets
call CheckBTMonMovesForErrors
; Repair the trainer name if needed, then copy it to wOTPlayerName
--- a/engine/menus/options_menu.asm
+++ b/engine/menus/options_menu.asm
@@ -61,20 +61,20 @@
ret
StringOptions:
- db "TEXT SPEED<LNBRK>"
- db " :<LNBRK>"
- db "BATTLE SCENE<LNBRK>"
- db " :<LNBRK>"
- db "BATTLE STYLE<LNBRK>"
- db " :<LNBRK>"
- db "SOUND<LNBRK>"
- db " :<LNBRK>"
- db "PRINT<LNBRK>"
- db " :<LNBRK>"
- db "MENU ACCOUNT<LNBRK>"
- db " :<LNBRK>"
- db "FRAME<LNBRK>"
- db " :TYPE<LNBRK>"
+ db "TEXT SPEED<LF>"
+ db " :<LF>"
+ db "BATTLE SCENE<LF>"
+ db " :<LF>"
+ db "BATTLE STYLE<LF>"
+ db " :<LF>"
+ db "SOUND<LF>"
+ db " :<LF>"
+ db "PRINT<LF>"
+ db " :<LF>"
+ db "MENU ACCOUNT<LF>"
+ db " :<LF>"
+ db "FRAME<LF>"
+ db " :TYPE<LF>"
db "CANCEL@"
GetOptionPointer:
--- a/engine/overworld/events.asm
+++ b/engine/overworld/events.asm
@@ -1336,8 +1336,8 @@
ClearCmdQueue::
ld hl, wCmdQueue
- ld de, 6
- ld c, 4
+ ld de, CMDQUEUE_ENTRY_SIZE
+ ld c, CMDQUEUE_CAPACITY
xor a
.loop
ld [hl], a
@@ -1443,7 +1443,7 @@
ld hl, CMDQUEUE_TYPE
add hl, bc
ld a, [hl]
- cp 5
+ cp NUM_CMDQUEUE_TYPES
jr c, .okay
xor a
--- a/engine/pokedex/pokedex.asm
+++ b/engine/pokedex/pokedex.asm
@@ -1317,7 +1317,7 @@
call Pokedex_PlaceFrontpicAtHL
ld de, 0
ld b, 0
- ld c, 26
+ ld c, NUM_UNOWN
.loop
ld hl, wUnownDex
add hl, de
@@ -2486,11 +2486,11 @@
ld a, BANK(UnownFont)
call FarCopyBytes
ld hl, sScratch + $188
- ld bc, 27 tiles
+ ld bc, (NUM_UNOWN + 1) tiles
call Pokedex_InvertTiles
ld de, sScratch + $188
ld hl, vTiles2 tile $40
- lb bc, BANK(Pokedex_LoadUnownFont), 27
+ lb bc, BANK(Pokedex_LoadUnownFont), NUM_UNOWN + 1
call Request2bpp
call CloseSRAM
ret
--- a/engine/pokegear/townmap_convertlinebreakcharacters.asm
+++ b/engine/pokegear/townmap_convertlinebreakcharacters.asm
@@ -5,14 +5,14 @@
cp "@"
jr z, .end
cp "%"
- jr z, .line_break
+ jr z, .line_feed
cp "¯"
- jr z, .line_break
+ jr z, .line_feed
inc hl
jr .loop
-.line_break
- ld [hl], "<LNBRK>"
+.line_feed
+ ld [hl], "<LF>"
.end
ld de, wStringBuffer1
--- a/home/text.asm
+++ b/home/text.asm
@@ -178,26 +178,30 @@
CheckDict::
dict: MACRO
-if \1 == 0
+if \1 == "<NULL>"
and a
else
cp \1
endc
- jp z, \2
-ENDM
-dict2: MACRO
- cp \1
+if STRSUB("\2", 1, 1) == "\""
+; Replace a character with another one
jr nz, ._\@
ld a, \2
._\@:
+elif STRSUB("\2", 1, 1) == "."
+; Locals can use a short jump
+ jr z, \2
+else
+ jp z, \2
+endc
ENDM
- dict TX_DAY, DayOfWeekChar
+ dict "<MOBILE>", MobileScriptChar
dict "<LINE>", LineChar
dict "<NEXT>", NextLineChar
- dict TX_FAR, TextFar
- dict TX_START, NullChar
+ dict "<CR>", CarriageReturnChar
+ dict "<NULL>", NullChar
dict "<SCROLL>", _ContTextNoPause
dict "<_CONT>", _ContText
dict "<PARA>", Paragraph
@@ -215,7 +219,7 @@
dict "<TM>", TMChar
dict "<TRAINER>", TrainerChar
dict "<KOUGEKI>", PlaceKougeki
- dict "<LNBRK>", LineBreakChar
+ dict "<LF>", LineFeedChar
dict "<CONT>", ContText
dict "<……>", SixDotsChar
dict "<DONE>", DoneText
@@ -223,17 +227,14 @@
dict "<PKMN>", PlacePKMN
dict "<POKE>", PlacePOKE
dict "%", NextChar
- dict2 "¯", " "
+ dict "¯", " "
dict "<DEXEND>", PlaceDexEnd
dict "<TARGET>", PlaceMoveTargetsName
dict "<USER>", PlaceMoveUsersName
dict "<ENEMY>", PlaceEnemysName
dict "<PLAY_G>", PlaceGenderedPlayerName
-
- cp "゚"
- jr z, .place ; should be .diacritic
- cp "゙"
- jr z, .place ; should be .diacritic
+ dict "゚", .place ; should be .diacritic
+ dict "゙", .place ; should be .diacritic
jr .not_diacritic
.diacritic
@@ -276,10 +277,10 @@
call PrintLetterDelay
jp NextChar
-DayOfWeekChar::
+MobileScriptChar::
ld c, l
ld b, h
- farcall Function17f036
+ farcall RunMobileScript
jp PlaceNextChar
print_name: MACRO
@@ -409,7 +410,7 @@
push hl
jp NextChar
-LineBreakChar::
+LineFeedChar::
pop hl
ld bc, SCREEN_WIDTH
add hl, bc
@@ -416,7 +417,7 @@
push hl
jp NextChar
-TextFar::
+CarriageReturnChar::
pop hl
push de
ld bc, -wTileMap + $10000
@@ -681,32 +682,32 @@
TextCommands::
; entries correspond to TX_* constants (see macros/scripts/text.asm)
- dw Text_TX ; TX_START
- dw Text_TX_RAM ; TX_RAM
- dw Text_TX_BCD ; TX_BCD
- dw Text_TX_MOVE ; TX_MOVE
- dw Text_TX_BOX ; TX_BOX
- dw Text_TX_LOW ; TX_LOW
- dw Text_WAIT_BUTTON ; WAIT_BUTTON
- dw Text_TX_SCROLL ; TX_SCROLL
- dw Text_START_ASM ; START_ASM
- dw Text_TX_NUM ; TX_NUM
- dw Text_TX_EXIT ; TX_EXIT
- dw Text_PlaySound ; TX_SOUND_DEX_FANFARE_50_79
- dw Text_TX_DOTS ; TX_DOTS
- dw Text_LINK_WAIT_BUTTON ; TX_LINK_WAIT_BUTTON
- dw Text_PlaySound ; TX_SOUND_DEX_FANFARE_20_49
- dw Text_PlaySound ; TX_SOUND_ITEM
- dw Text_PlaySound ; TX_SOUND_CAUGHT_MON
- dw Text_PlaySound ; TX_SOUND_DEX_FANFARE_80_109
- dw Text_PlaySound ; TX_SOUND_FANFARE
- dw Text_PlaySound ; TX_SOUND_SLOT_MACHINE_START
- dw Text_TX_STRINGBUFFER ; TX_STRINGBUFFER
- dw Text_TX_DAY ; TX_DAY
- dw Text_TX_FAR ; TX_FAR
+ dw TextCommand_START ; TX_START
+ dw TextCommand_RAM ; TX_RAM
+ dw TextCommand_BCD ; TX_BCD
+ dw TextCommand_MOVE ; TX_MOVE
+ dw TextCommand_BOX ; TX_BOX
+ dw TextCommand_LOW ; TX_LOW
+ dw TextCommand_WAIT_BUTTON ; TX_WAIT_BUTTON
+ dw TextCommand_SCROLL ; TX_SCROLL
+ dw TextCommand_START_ASM ; TX_START_ASM
+ dw TextCommand_NUM ; TX_NUM
+ dw TextCommand_EXIT ; TX_EXIT
+ dw TextCommand_SOUND ; TX_SOUND_DEX_FANFARE_50_79
+ dw TextCommand_DOTS ; TX_DOTS
+ dw TextCommand_LINK_WAIT_BUTTON ; TX_LINK_WAIT_BUTTON
+ dw TextCommand_SOUND ; TX_SOUND_DEX_FANFARE_20_49
+ dw TextCommand_SOUND ; TX_SOUND_ITEM
+ dw TextCommand_SOUND ; TX_SOUND_CAUGHT_MON
+ dw TextCommand_SOUND ; TX_SOUND_DEX_FANFARE_80_109
+ dw TextCommand_SOUND ; TX_SOUND_FANFARE
+ dw TextCommand_SOUND ; TX_SOUND_SLOT_MACHINE_START
+ dw TextCommand_STRINGBUFFER ; TX_STRINGBUFFER
+ dw TextCommand_DAY ; TX_DAY
+ dw TextCommand_FAR ; TX_FAR
-Text_TX::
-; TX
+TextCommand_START::
+; text_start
; write text until "@"
; [$00]["...@"]
@@ -720,7 +721,7 @@
inc hl
ret
-Text_TX_RAM::
+TextCommand_RAM::
; text_from_ram
; write text from a ram address
; little endian
@@ -737,7 +738,7 @@
pop hl
ret
-Text_TX_FAR::
+TextCommand_FAR::
; text_jump
; write text from a different bank
; little endian
@@ -766,8 +767,8 @@
ld [MBC3RomBank], a
ret
-Text_TX_BCD::
-; TX_BCD
+TextCommand_BCD::
+; text_bcd
; write bcd from address, typically ram
; [$02][addr][flags]
; flags: see PrintBCDNumber
@@ -787,8 +788,8 @@
pop hl
ret
-Text_TX_MOVE::
-; TX_MOVE
+TextCommand_MOVE::
+; text_move
; move to a new tile
; [$03][addr]
@@ -800,8 +801,8 @@
ld b, a
ret
-Text_TX_BOX::
-; TX_BOX
+TextCommand_BOX::
+; text_box
; draw a box
; little endian
; [$04][addr][height][width]
@@ -821,8 +822,8 @@
pop hl
ret
-Text_TX_LOW::
-; TX_LOW
+TextCommand_LOW::
+; text_low
; write text at (1,16)
; [$05]
@@ -829,8 +830,8 @@
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
ret
-Text_WAIT_BUTTON::
-; TX_WAITBUTTON
+TextCommand_WAIT_BUTTON::
+; text_waitbutton
; wait for button press
; show arrow
; [06]
@@ -837,9 +838,9 @@
ld a, [wLinkMode]
cp LINK_COLOSSEUM
- jp z, Text_LINK_WAIT_BUTTON
+ jp z, TextCommand_LINK_WAIT_BUTTON
cp LINK_MOBILE
- jp z, Text_LINK_WAIT_BUTTON
+ jp z, TextCommand_LINK_WAIT_BUTTON
push hl
call LoadBlinkingCursor
@@ -850,7 +851,8 @@
pop hl
ret
-Text_TX_SCROLL::
+TextCommand_SCROLL::
+; text_scroll
; pushes text up two lines and sets the BC cursor to the border tile
; below the first character column of the text box.
push hl
@@ -861,8 +863,8 @@
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
ret
-Text_START_ASM::
-; TX_ASM
+TextCommand_START_ASM::
+; start_asm
bit 7, h
jr nz, .not_rom
@@ -873,8 +875,8 @@
ld [hl], a
ret
-Text_TX_NUM::
-; TX_NUM
+TextCommand_NUM::
+; deciram
; [$09][addr][hi:bytes lo:digits]
ld a, [hli]
ld e, a
@@ -898,7 +900,8 @@
pop hl
ret
-Text_TX_EXIT::
+TextCommand_EXIT::
+; interpret_data
push hl
push bc
call GetJoypad
@@ -912,7 +915,7 @@
pop hl
ret
-Text_PlaySound::
+TextCommand_SOUND::
; chars:
; $0b, $0e, $0f, $10, $11, $12, $13
; see TextSFX
@@ -948,7 +951,7 @@
ret
Unreferenced_Function1522::
-; TX_CRY
+; play_cry
push de
ld e, [hl]
inc hl
@@ -969,7 +972,8 @@
dbw TX_SOUND_SLOT_MACHINE_START, SFX_SLOT_MACHINE_START
db -1
-Text_TX_DOTS::
+TextCommand_DOTS::
+; limited_interpret_data
; [$0C][num]
ld a, [hli]
ld d, a
@@ -997,7 +1001,8 @@
pop hl
ret
-Text_LINK_WAIT_BUTTON::
+TextCommand_LINK_WAIT_BUTTON::
+; link_wait_button
; wait for key down
; display arrow
push hl
@@ -1007,7 +1012,8 @@
pop hl
ret
-Text_TX_STRINGBUFFER::
+TextCommand_STRINGBUFFER::
+; text_buffer
; Print a string from one of the following:
; 0: wStringBuffer3
; 1: wStringBuffer4
@@ -1035,8 +1041,8 @@
pop hl
ret
-Text_TX_DAY::
-; TX_DAY
+TextCommand_DAY::
+; current_day
call GetWeekday
push hl
--- a/hram.asm
+++ b/hram.asm
@@ -129,3 +129,4 @@
hMobile EQU $ffe9
hSystemBooted EQU $ffea
hClockResetTrigger EQU $ffeb
+hFFEC EQU $ffec
--- a/macros/scripts/battle_anims.asm
+++ b/macros/scripts/battle_anims.asm
@@ -295,7 +295,7 @@
dw \1 ; address
ENDM
- enum anim_ret_command ; $ff
+anim_ret_command EQU -1 ; $ff
anim_ret: MACRO
db anim_ret_command
ENDM
--- a/macros/scripts/text.asm
+++ b/macros/scripts/text.asm
@@ -46,9 +46,9 @@
db TX_LOW
ENDM
- enum WAIT_BUTTON ; $06
+ enum TX_WAIT_BUTTON ; $06
text_waitbutton: MACRO
- db WAIT_BUTTON
+ db TX_WAIT_BUTTON
ENDM
enum TX_SCROLL ; $07
@@ -56,9 +56,9 @@
db TX_SCROLL
ENDM
- enum START_ASM ; $08
+ enum TX_START_ASM ; $08
start_asm: MACRO
- db START_ASM
+ db TX_START_ASM
ENDM
enum TX_NUM ; $09
--- a/mobile/mobile_22.asm
+++ b/mobile/mobile_22.asm
@@ -3894,7 +3894,7 @@
ret
String_8aaf0:
- db "あたらしい めいし<PKMN>できまし<LNBRK>@"
+ db "あたらしい めいし<PKMN>できまし<LF>@"
Function8ab00:
ld de, String_8911c
--- a/mobile/mobile_5f.asm
+++ b/mobile/mobile_5f.asm
@@ -265,27 +265,27 @@
ret
Function17d0f3:
- ld a, [$c608 + 5]
+ ld a, [wc608 + 5]
ld [wOTTrademonSpecies], a
ld [wCurPartySpecies], a
ld a, [wcd81]
- ld [$c74e], a
- ld hl, $c63d
+ ld [wc74e], a
+ ld hl, wc608 + 53
ld de, wOTTrademonOTName
ld bc, 5
call CopyBytes
ld a, "@"
ld [de], a
- ld a, [$c608 + 11]
+ ld a, [wc608 + 11]
ld [wOTTrademonID], a
- ld a, [$c608 + 12]
+ ld a, [wc608 + 12]
ld [wOTTrademonID + 1], a
- ld hl, $c608 + 26
+ ld hl, wc608 + 26
ld a, [hli]
ld [wOTTrademonDVs], a
ld a, [hl]
ld [wOTTrademonDVs + 1], a
- ld bc, $c608 + 5
+ ld bc, wc608 + 5
farcall GetCaughtGender
ld a, c
ld [wOTTrademonCaughtData], a
@@ -324,7 +324,7 @@
Mobile_CopyDefaultOTName:
ld hl, Mobile5F_PlayersName
- ld de, $c63d
+ ld de, wc63d
ld bc, 5
call CopyBytes
ret
@@ -334,7 +334,7 @@
Mobile_CopyDefaultNickname:
ld hl, .DefaultNickname
- ld de, $c642
+ ld de, wc642
ld bc, 5
call CopyBytes
ret
@@ -344,11 +344,11 @@
Mobile_CopyDefaultMail:
ld a, "@"
- ld hl, $c647
+ ld hl, wc647
ld bc, MAIL_MSG_LENGTH + 1
call ByteFill
ld hl, .DefaultMessage
- ld de, $c647
+ ld de, wc647
ld bc, 6
call CopyBytes
ret
@@ -358,11 +358,11 @@
Mobile_CopyDefaultMailAuthor:
ld a, "@"
- ld de, $c668
+ ld de, wc668
ld bc, 5
call ByteFill
ld hl, Mobile5F_PlayersName
- ld de, $c668
+ ld de, wc668
ld bc, 5
call CopyBytes
ret
@@ -606,7 +606,7 @@
farcall ReloadMapPart
call DisableLCD
ld hl, vTiles0 tile $ee
- ld de, $c608
+ ld de, wc608
ld bc, 1 tiles
call CopyBytes
ld a, $1
@@ -619,7 +619,7 @@
ld hl, vTiles2 tile $7f
ld bc, 1 tiles
call ByteFill
- ld hl, $c608
+ ld hl, wc608
ld de, vTiles0 tile $ee
ld bc, 1 tiles
call CopyBytes
@@ -653,7 +653,7 @@
Function17d405:
call DisableLCD
ld hl, vTiles0 tile $ee
- ld de, $c608
+ ld de, wc608
ld bc, 1 tiles
call CopyBytes
ld a, $1
@@ -666,7 +666,7 @@
ld hl, vTiles2 tile $7f
ld bc, 1 tiles
call ByteFill
- ld hl, $c608
+ ld hl, wc608
ld de, vTiles0 tile $ee
ld bc, 1 tiles
call CopyBytes
@@ -713,7 +713,7 @@
Function17d48d:
ld hl, Palette_17eff6
- ld de, $c608
+ ld de, wc608
ld bc, $40
call CopyBytes
ld hl, TileAttrmap_17eb8e
@@ -765,7 +765,7 @@
.asm_17d4e0
ld a, [hli]
- ld de, $c608
+ ld de, wc608
ld c, $8
.asm_17d4e6
srl a
@@ -938,7 +938,7 @@
Function17d5f6:
ld a, $5
ld [rSVBK], a
- ld hl, $c608
+ ld hl, wc608
ld de, wBGPals1
ld bc, 8 palettes
call CopyBytes
@@ -950,7 +950,7 @@
ld a, $5
call GetSRAMBank
ld hl, $b1d3
- ld de, $c608
+ ld de, wc608
ld bc, $20
call CopyBytes
ld a, [$b1b1]
@@ -964,7 +964,7 @@
call CloseSRAM
ld a, $6
call GetSRAMBank
- ld de, $c708
+ ld de, wc708
ld a, c
and a
jr z, .asm_17d684
@@ -985,7 +985,7 @@
ld [wcd49], a
push hl
push de
- ld hl, $c608
+ ld hl, wc608
ld e, b
ld d, $0
add hl, de
@@ -1024,7 +1024,7 @@
call CloseSRAM
ld a, $5
call GetSRAMBank
- ld hl, $c708
+ ld hl, wc708
ld de, $b1b3
ld a, [$b1b1]
ld c, a
@@ -1307,7 +1307,7 @@
and a
jr nz, .asm_17d86c
pop hl
- ld de, $c608
+ ld de, wc608
ld c, $0
.asm_17d878
ld a, [hli]
@@ -1365,7 +1365,7 @@
push bc
ld a, $3
ld [rSVBK], a
- ld hl, $c608
+ ld hl, wc608
ld de, wBGPals1
ld b, $0
call CopyBytes
@@ -1426,7 +1426,7 @@
Function17d93a:
call IncCrashCheckPointer
- ld de, $c708
+ ld de, wc708
ld bc, $5
call CopyBytes
call HlToCrashCheckPointer
@@ -1435,19 +1435,19 @@
push af
ld a, $1
ld [rSVBK], a
- ld a, [$c70c]
+ ld a, [wc70c]
call Function17e6de
- ld a, [$c70a]
+ ld a, [wc70a]
ld [wCurPartySpecies], a
- ld a, [$c70c]
+ ld a, [wc70c]
ld e, a
farcall LoadMonPaletteAsNthBGPal
call SetPalettes
- ld a, [$c708]
+ ld a, [wc708]
ld l, a
- ld a, [$c709]
+ ld a, [wc709]
ld h, a
- ld a, [$c70b]
+ ld a, [wc70b]
ld c, a
decoord 0, 0
add hl, de
@@ -1461,7 +1461,7 @@
Function17d98b:
call IncCrashCheckPointer
- ld de, $c708
+ ld de, wc708
ld bc, $4
call CopyBytes
call HlToCrashCheckPointer
@@ -1470,17 +1470,17 @@
push af
ld a, $1
ld [rSVBK], a
- ld a, [$c70b]
+ ld a, [wc70b]
call Function17e6de
- ld a, [$c70a]
+ ld a, [wc70a]
ld [wTrainerClass], a
- ld a, [$c70b]
+ ld a, [wc70b]
ld e, a
farcall LoadTrainerClassPaletteAsNthBGPal
call SetPalettes
- ld a, [$c708]
+ ld a, [wc708]
ld e, a
- ld a, [$c709]
+ ld a, [wc709]
ld d, a
push de
ld de, vTiles2
@@ -1497,34 +1497,34 @@
Function17d9e3:
call IncCrashCheckPointer
- ld de, $c708
+ ld de, wc708
ld bc, $7
call CopyBytes
call HlToCrashCheckPointer
- ld a, [$c70b]
+ ld a, [wc70b]
push af
cp $c0
jr c, .asm_17da01
- ld a, [$c70c]
+ ld a, [wc70c]
ld [rSVBK], a
jr .asm_17da07
.asm_17da01
- ld a, [$c70c]
+ ld a, [wc70c]
call GetSRAMBank
.asm_17da07
- ld a, [$c708]
+ ld a, [wc708]
ld l, a
- ld a, [$c709]
+ ld a, [wc709]
ld h, a
- ld a, [$c70a]
+ ld a, [wc70a]
ld e, a
- ld a, [$c70b]
+ ld a, [wc70b]
ld d, a
- ld a, [$c70d]
+ ld a, [wc70d]
ld c, a
- ld a, [$c70e]
+ ld a, [wc70e]
ld b, a
call CopyBytes
pop af
@@ -1542,28 +1542,28 @@
Function17da31:
call IncCrashCheckPointer
- ld de, $c708
+ ld de, wc708
ld bc, $4
call CopyBytes
call HlToCrashCheckPointer
- ld a, [$c709]
+ ld a, [wc709]
push af
cp $c0
jr c, .asm_17da4f
- ld a, [$c70a]
+ ld a, [wc70a]
ld [rSVBK], a
jr .asm_17da55
.asm_17da4f
- ld a, [$c70a]
+ ld a, [wc70a]
call GetSRAMBank
.asm_17da55
- ld a, [$c708]
+ ld a, [wc708]
ld e, a
- ld a, [$c709]
+ ld a, [wc709]
ld d, a
- ld a, [$c70b]
+ ld a, [wc70b]
ld c, a
bit 7, c
jr nz, .asm_17da70
@@ -1824,7 +1824,7 @@
Function17dc1f:
call IncCrashCheckPointer
- ld de, $c688
+ ld de, wc688
ld bc, $6
call CopyBytes
call Function17e32b
@@ -1832,24 +1832,24 @@
push af
ld a, $1
ld [rSVBK], a
- ld hl, $c688
+ ld hl, wc688
ld a, $40
- ld [$c708], a
+ ld [wc708], a
ld a, [hli]
- ld [$c70a], a
+ ld [wc70a], a
add $5
- ld [$c70c], a
+ ld [wc70c], a
ld a, [hli]
- ld [$c709], a
+ ld [wc709], a
add $4
- ld [$c70b], a
+ ld [wc70b], a
ld a, $96
- ld [$c70d], a
+ ld [wc70d], a
ld a, $5c
- ld [$c70e], a
+ ld [wc70e], a
ld a, $1
- ld [$c70f], a
- ld hl, $c708
+ ld [wc70f], a
+ ld hl, wc708
call LoadMenuHeader
call VerticalMenu
jr nc, .asm_17dc6e
@@ -1863,16 +1863,16 @@
ld a, [wMenuCursorY]
cp $1
jr nz, .asm_17dc85
- ld a, [$c68a]
+ ld a, [wc68a]
ld l, a
- ld a, [$c68a + 1]
+ ld a, [wc68a + 1]
ld h, a
jr .asm_17dc8d
.asm_17dc85
- ld a, [$c68a + 2]
+ ld a, [wc68a + 2]
ld l, a
- ld a, [$c68a + 3]
+ ld a, [wc68a + 3]
ld h, a
.asm_17dc8d
@@ -2005,35 +2005,35 @@
Function17dd49:
call IncCrashCheckPointer
- ld de, $c708
+ ld de, wc708
ld bc, $a
call CopyBytes
- ld a, [$c711]
+ ld a, [wc711]
ld c, a
ld b, $0
call CopyBytes
- ld a, [$c70a]
+ ld a, [wc70a]
cp $c0
jr c, .sram
- ld a, [$c708]
+ ld a, [wc708]
ld [rSVBK], a
jr .got_bank
.sram
- ld a, [$c708]
+ ld a, [wc708]
call GetSRAMBank
.got_bank
- ld a, [$c709]
+ ld a, [wc709]
ld l, a
- ld a, [$c70a]
+ ld a, [wc70a]
ld h, a
- ld de, $c688
- ld a, [$c711]
+ ld de, wc688
+ ld a, [wc711]
ld c, a
ld b, $0
call CopyBytes
- ld a, [$c70a]
+ ld a, [wc70a]
cp $c0
jr c, .close_sram
ld a, $4
@@ -2044,10 +2044,10 @@
call CloseSRAM
.exited_bank
- ld a, [$c711]
+ ld a, [wc711]
ld c, a
- ld hl, $c712
- ld de, $c688
+ ld hl, wc712
+ ld de, wc688
.loop
ld a, [de]
inc de
@@ -2060,23 +2060,23 @@
.next
dec c
jr nz, .loop
- ld a, [$c70d]
+ ld a, [wc70d]
ld l, a
- ld a, [$c70e]
+ ld a, [wc70e]
ld h, a
jr .done
.load2
- ld a, [$c70f]
+ ld a, [wc70f]
ld l, a
- ld a, [$c710]
+ ld a, [wc710]
ld h, a
jr .done
.load
- ld a, [$c70b]
+ ld a, [wc70b]
ld l, a
- ld a, [$c70c]
+ ld a, [wc70c]
ld h, a
.done
@@ -2085,31 +2085,31 @@
Function17ddcd:
call IncCrashCheckPointer
- ld de, $c708
+ ld de, wc708
ld bc, $8
call CopyBytes
- ld a, [$c70a]
+ ld a, [wc70a]
cp $c0
jr c, .asm_17dde7
- ld a, [$c708]
+ ld a, [wc708]
ld [rSVBK], a
jr .asm_17dded
.asm_17dde7
- ld a, [$c708]
+ ld a, [wc708]
call GetSRAMBank
.asm_17dded
- ld a, [$c709]
+ ld a, [wc709]
ld e, a
- ld a, [$c70a]
+ ld a, [wc70a]
ld d, a
ld a, [de]
- ld [$c710], a
- ld a, [$c70b]
+ ld [wc710], a
+ ld a, [wc70b]
ld c, a
ld b, $0
- ld a, [$c70a]
+ ld a, [wc70a]
cp $c0
jr c, .asm_17de0c
ld a, $4
@@ -2124,20 +2124,20 @@
ld hl, Unknown_17da8c
add hl, bc
ld a, [hl]
- ld hl, $c710
+ ld hl, wc710
and [hl]
pop hl
jr nz, .asm_17de26
- ld a, [$c70e]
+ ld a, [wc70e]
ld l, a
- ld a, [$c70f]
+ ld a, [wc70f]
ld h, a
jr .asm_17de2e
.asm_17de26
- ld a, [$c70c]
+ ld a, [wc70c]
ld l, a
- ld a, [$c70d]
+ ld a, [wc70d]
ld h, a
.asm_17de2e
@@ -2146,10 +2146,10 @@
Function17de32:
call IncCrashCheckPointer
- ld de, $c708
+ ld de, wc708
ld bc, $9
call CopyBytes
- ld a, [$c710]
+ ld a, [wc710]
ld c, a
ld b, $0
call CopyBytes
@@ -2156,16 +2156,16 @@
ld a, $6
call GetSRAMBank
call Function17f4f6
- ld a, [$c708]
+ ld a, [wc708]
ld e, a
- ld a, [$c709]
+ ld a, [wc709]
ld d, a
add hl, de
ld e, l
ld d, h
- ld a, [$c710]
+ ld a, [wc710]
ld c, a
- ld hl, $c711
+ ld hl, wc711
.asm_17de61
ld a, [de]
inc de
@@ -2178,23 +2178,23 @@
.asm_17de6b
dec c
jr nz, .asm_17de61
- ld a, [$c70c]
+ ld a, [wc70c]
ld l, a
- ld a, [$c70d]
+ ld a, [wc70d]
ld h, a
jr .asm_17de8a
.asm_17de78
- ld a, [$c70e]
+ ld a, [wc70e]
ld l, a
- ld a, [$c70f]
+ ld a, [wc70f]
ld h, a
jr .asm_17de8a
.asm_17de82
- ld a, [$c70a]
+ ld a, [wc70a]
ld l, a
- ld a, [$c70b]
+ ld a, [wc70b]
ld h, a
.asm_17de8a
@@ -2204,20 +2204,20 @@
Function17de91:
call IncCrashCheckPointer
- ld de, $c708
+ ld de, wc708
ld bc, $7
call CopyBytes
ld a, $6
call GetSRAMBank
call Function17f4f6
- ld a, [$c708]
+ ld a, [wc708]
ld e, a
- ld a, [$c709]
+ ld a, [wc709]
ld d, a
add hl, de
ld e, l
ld d, h
- ld a, [$c70a]
+ ld a, [wc70a]
ld c, a
ld b, $0
ld hl, Unknown_17da8c
@@ -2227,16 +2227,16 @@
ld h, d
and [hl]
jr nz, .asm_17deca
- ld a, [$c70d]
+ ld a, [wc70d]
ld l, a
- ld a, [$c70e]
+ ld a, [wc70e]
ld h, a
jr .asm_17ded2
.asm_17deca
- ld a, [$c70b]
+ ld a, [wc70b]
ld l, a
- ld a, [$c70c]
+ ld a, [wc70c]
ld h, a
.asm_17ded2
@@ -2246,7 +2246,7 @@
Function17ded9:
call IncCrashCheckPointer
- ld de, $c708
+ ld de, wc708
ld bc, $1f
call CopyBytes
call Function17e32b
@@ -2254,7 +2254,7 @@
push af
ld a, $1
ld [rSVBK], a
- ld hl, $c708
+ ld hl, wc708
ld a, [hli]
ld [wCurPartySpecies], a
ld [wTempEnemyMonSpecies], a
@@ -2585,7 +2585,7 @@
Function17e0fd:
call IncCrashCheckPointer
- ld de, $c708
+ ld de, wc708
ld bc, $6
call CopyBytes
ld a, [rSVBK]
@@ -2592,7 +2592,7 @@
push af
ld a, $1
ld [rSVBK], a
- ld hl, $c708
+ ld hl, wc708
ld a, [hli]
ld [wCurItem], a
ld a, [hli]
@@ -2618,7 +2618,7 @@
Function17e133:
call IncCrashCheckPointer
- ld de, $c708
+ ld de, wc708
ld bc, $5
call CopyBytes
ld a, [rSVBK]
@@ -2625,7 +2625,7 @@
push af
ld a, $1
ld [rSVBK], a
- ld hl, $c708
+ ld hl, wc708
ld a, [hli]
ld [wScriptVar], a
push hl
@@ -2648,7 +2648,7 @@
Function17e165:
call IncCrashCheckPointer
- ld de, $c708
+ ld de, wc708
ld bc, $5
call CopyBytes
ld a, [rSVBK]
@@ -2655,7 +2655,7 @@
push af
ld a, $1
ld [rSVBK], a
- ld hl, $c708
+ ld hl, wc708
ld a, [hli]
ld [wCurItem], a
push hl
@@ -2684,31 +2684,31 @@
Function17e1a1:
call IncCrashCheckPointer
- ld de, $c708
+ ld de, wc708
ld bc, $d
call CopyBytes
- ld a, [$c70a]
+ ld a, [wc70a]
cp $c0
jr c, .asm_17e1bb
- ld a, [$c708]
+ ld a, [wc708]
ld [rSVBK], a
jr .asm_17e1c1
.asm_17e1bb
- ld a, [$c708]
+ ld a, [wc708]
call GetSRAMBank
.asm_17e1c1
- ld a, [$c709]
+ ld a, [wc709]
ld l, a
- ld a, [$c70a]
+ ld a, [wc70a]
ld h, a
- ld de, $c608
- ld a, [$c70b]
+ ld de, wc608
+ ld a, [wc70b]
ld c, a
ld b, $0
call CopyBytes
- ld a, [$c70a]
+ ld a, [wc70a]
cp $c0
jr c, .asm_17e1e2
ld a, $4
@@ -2719,28 +2719,28 @@
call CloseSRAM
.asm_17e1e5
- ld a, [$c70e]
+ ld a, [wc70e]
cp $c0
jr c, .asm_17e1f3
- ld a, [$c70c]
+ ld a, [wc70c]
ld [rSVBK], a
jr .asm_17e1f9
.asm_17e1f3
- ld a, [$c70c]
+ ld a, [wc70c]
call GetSRAMBank
.asm_17e1f9
- ld a, [$c70d]
+ ld a, [wc70d]
ld l, a
- ld a, [$c70e]
+ ld a, [wc70e]
ld h, a
- ld de, $c688
- ld a, [$c70b]
+ ld de, wc688
+ ld a, [wc70b]
ld c, a
ld b, $0
call CopyBytes
- ld a, [$c70e]
+ ld a, [wc70e]
cp $c0
jr c, .asm_17e21a
ld a, $4
@@ -2751,10 +2751,10 @@
call CloseSRAM
.asm_17e21d
- ld a, [$c70b]
+ ld a, [wc70b]
ld c, a
- ld hl, $c688
- ld de, $c608
+ ld hl, wc688
+ ld de, wc608
.asm_17e227
ld a, [de]
inc de
@@ -2767,23 +2767,23 @@
.asm_17e231
dec c
jr nz, .asm_17e227
- ld a, [$c711]
+ ld a, [wc711]
ld l, a
- ld a, [$c712]
+ ld a, [wc712]
ld h, a
jr .asm_17e250
.asm_17e23e
- ld a, [$c70f]
+ ld a, [wc70f]
ld l, a
- ld a, [$c710]
+ ld a, [wc710]
ld h, a
jr .asm_17e250
.asm_17e248
- ld a, [$c712 + 1]
+ ld a, [wc712 + 1]
ld l, a
- ld a, [$c712 + 2]
+ ld a, [wc712 + 2]
ld h, a
.asm_17e250
@@ -2927,7 +2927,7 @@
Function17e32b:
ld a, $5
call GetSRAMBank
- ld hl, $c608
+ ld hl, wc608
ld de, $b0b1
ld bc, $40
call CopyBytes
@@ -2941,7 +2941,7 @@
ld a, $5
call GetSRAMBank
ld hl, $b0b1
- ld de, $c608
+ ld de, wc608
ld bc, $40
call CopyBytes
ld de, wBGMapBuffer
@@ -3286,7 +3286,7 @@
ld h, a
bccoord 0, 0
add hl, bc
- ld bc, $ffec
+ ld bc, hFFEC
add hl, bc
ld a, [wMobileInactivityTimerSeconds]
ld c, a
@@ -3505,9 +3505,9 @@
Function17e6de:
push af
- ld a, [$c708]
+ ld a, [wc708]
ld l, a
- ld a, [$c709]
+ ld a, [wc709]
ld h, a
decoord 0, 0, wAttrMap
add hl, de
@@ -3570,25 +3570,25 @@
RGB 24, 16, 3
RGB 0, 0, 0
-Function17f036::
+RunMobileScript::
ld a, $6
call GetSRAMBank
inc de
-.asm_17f03c
- call Function17f047
- jr c, .asm_17f043
- jr .asm_17f03c
+.loop
+ call _RunMobileScript
+ jr c, .finished
+ jr .loop
-.asm_17f043
+.finished
call CloseSRAM
ret
-Function17f047:
+_RunMobileScript:
ld a, [de]
inc de
- cp $50
+ cp "@"
jr z, .finished
- cp $10
+ cp $10 ; jumptable size
jr nc, .finished
dec a
push de
@@ -3641,7 +3641,7 @@
ld b, $0
add hl, bc
ld a, [de]
- cp $50
+ cp "@"
jr z, .asm_17f09d
and a
ret
@@ -3726,7 +3726,7 @@
ld b, $0
add hl, bc
ld a, [de]
- cp $50
+ cp "@"
jr z, .asm_17f112
and a
ret
@@ -3749,15 +3749,15 @@
ld a, [wcd55]
ld d, a
add hl, de
- ld de, $c608
+ ld de, wc608
ld a, [wcd56]
ld c, a
ld b, $0
call CopyBytes
- ld a, $50
+ ld a, "@"
ld [de], a
pop hl
- ld de, $c608
+ ld de, wc608
call PlaceString
ld a, c
ld [wcd52], a
@@ -3778,7 +3778,7 @@
ld e, l
ld d, h
ld a, [de]
- cp $50
+ cp "@"
jr z, .asm_17f165
and a
ret
@@ -3823,7 +3823,7 @@
ld b, $0
add hl, bc
ld a, [de]
- cp $50
+ cp "@"
jr z, .asm_17f19b
and a
ret
@@ -3847,10 +3847,10 @@
add hl, de
ld a, [hl]
ld c, a
- ld de, $c608
+ ld de, wc608
farcall Function48c63
pop hl
- ld de, $c608
+ ld de, wc608
call PlaceString
ld a, c
ld [wcd52], a
@@ -3877,7 +3877,7 @@
ld b, $0
add hl, bc
ld a, [de]
- cp $50
+ cp "@"
jr z, .asm_17f1ea
and a
ret
@@ -3933,7 +3933,7 @@
ld b, $0
add hl, bc
ld a, [de]
- cp $50
+ cp "@"
jr z, .asm_17f23a
and a
ret
@@ -3996,7 +3996,7 @@
ld b, $0
add hl, bc
ld a, [de]
- cp $50
+ cp "@"
jr z, .asm_17f295
and a
ret
@@ -4079,13 +4079,13 @@
ld a, $1
ld [rSVBK], a
ld hl, wPlayerName
- ld de, $c608
+ ld de, wc608
ld bc, $6
call CopyBytes
ld a, $4
ld [rSVBK], a
pop hl
- ld de, $c608
+ ld de, wc608
call PlaceString
ld a, c
ld [wcd52], a
@@ -4125,10 +4125,10 @@
.asm_17f35d
ld c, a
call CloseSRAM
- ld de, $c608
+ ld de, wc608
farcall Function48c63
pop hl
- ld de, $c608
+ ld de, wc608
call PlaceString
ld a, c
ld [wcd52], a
@@ -4186,7 +4186,7 @@
Function17f3c9:
push bc
ld hl, wcd36
- ld de, $c708
+ ld de, wc708
ld bc, 12
call CopyBytes
pop de
@@ -4193,7 +4193,7 @@
ld c, $0
farcall Function11c075
push hl
- ld hl, $c708
+ ld hl, wc708
ld de, wcd36
ld bc, $c
call CopyBytes
@@ -4304,7 +4304,7 @@
ld b, 0
add hl, bc
ld a, [de]
- cp $50
+ cp "@"
jr z, .asm_17f46b
and a
ret
@@ -4337,7 +4337,7 @@
ld l, a
ld a, [wcd56]
ld h, a
- ld de, $c608
+ ld de, wc608
ld a, [wcd57]
ld c, a
ld b, $0
@@ -4355,7 +4355,7 @@
call GetSRAMBank
.asm_17f4b7
- ld de, $c608
+ ld de, wc608
pop hl
push hl
ld a, [wcd57]
--- a/wram.asm
+++ b/wram.asm
@@ -359,7 +359,13 @@
UNION ; c608
; unidentified uses
-wc608:: ds 480
+wc608:: ds 53
+wc63d:: ds 5
+wc642:: ds 5
+wc647:: ds 33
+wc668:: ds 32
+wc688:: ds 2
+wc68a:: ds 350
NEXTU ; c608
; surrounding tiles
@@ -868,7 +874,18 @@
NEXTU ; c6d0
; mobile data
-wc6d0:: ds 126
+wc6d0:: ds 56
+wc708:: db
+wc709:: db
+wc70a:: db
+wc70b:: db
+wc70c:: db
+wc70d:: db
+wc70e:: db
+wc70f:: db
+wc710:: db
+wc711:: db
+wc712:: ds 60
wc74e:: ds 107
wc7b9:: ds 1
wc7ba:: ds 1