ref: 5d97f15f80ff7b780bcfbd657af858f9bc2d6356
parent: 63798d56d05cf87ada77bd26727ea7725630b0b2
author: Andrew Cook <[email protected]>
date: Wed Apr 1 08:26:59 EDT 2020
Assorted labels in mobile related code (#702) Rename assorted labels in mobile-related code
--- a/data/mobile/ascii-alpha.txt
+++ /dev/null
@@ -1,1 +1,0 @@
-ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
\ No newline at end of file
--- a/data/mobile/ascii-sym.txt
+++ /dev/null
@@ -1,1 +1,0 @@
-0123456789 !"#$%&'()*+ ,-./:;<=>?@ [\]^_`{|}~
\ No newline at end of file
--- a/data/mobile/x-game-code-prefix.txt
+++ /dev/null
@@ -1,1 +1,0 @@
-X-Game-code:
--- a/data/mobile/x-game-code.txt
+++ /dev/null
@@ -1,1 +1,0 @@
-CGB-BXTJ-00
\ No newline at end of file
--- a/data/mobile/x-game-result-prefix.txt
+++ /dev/null
@@ -1,1 +1,0 @@
-X-Game-result:
--- a/data/mobile/x-game-result.txt
+++ /dev/null
@@ -1,1 +1,0 @@
-pokemon_crystal
\ No newline at end of file
--- a/lib/mobile/main.asm
+++ b/lib/mobile/main.asm
@@ -8440,9 +8440,9 @@
.asm_113734
ld hl, $cc0c
- ld a, LOW(Unknown_113b8e)
+ ld a, LOW(MD5_K_Table)
ld [hli], a
- ld a, HIGH(Unknown_113b8e)
+ ld a, HIGH(MD5_K_Table)
ld [hl], a
ld hl, $cc0e
ld a, LOW(Unknown_113a70)
@@ -8529,7 +8529,7 @@
ld [$cc0d], a
ld a, l
ld [$cc0c], a
- cp $8e ; XXX LOW(Unknown_113b8e + $100) ???
+ cp $8e ; XXX LOW(MD5_K_Table + $100) ???
jp nz, .asm_113751
ld de, $cc18
ld hl, $cbe7
@@ -8983,23 +8983,23 @@
db $01, $23, $45, $67, $89, $ab, $cd, $ef
db $fe, $dc, $ba, $98, $76, $54, $32, $10
-Unknown_113b8e:
- db $78, $a4, $6a, $d7, $56, $b7, $c7, $e8, $db, $70, $20, $24, $ee, $ce, $bd, $c1
- db $af, $0f, $7c, $f5, $2a, $c6, $87, $47, $13, $46, $30, $a8, $01, $95, $46, $fd
- db $d8, $98, $80, $69, $af, $f7, $44, $8b, $b1, $5b, $ff, $ff, $be, $d7, $5c, $89
- db $22, $11, $90, $6b, $93, $71, $98, $fd, $8e, $43, $79, $a6, $21, $08, $b4, $49
- db $62, $25, $1e, $f6, $40, $b3, $40, $c0, $51, $5a, $5e, $26, $aa, $c7, $b6, $e9
- db $5d, $10, $2f, $d6, $53, $14, $44, $02, $81, $e6, $a1, $d8, $c8, $fb, $d3, $e7
- db $e6, $cd, $e1, $21, $d6, $07, $37, $c3, $87, $0d, $d5, $f4, $ed, $14, $5a, $45
- db $05, $e9, $e3, $a9, $f8, $a3, $ef, $fc, $d9, $02, $6f, $67, $8a, $4c, $2a, $8d
- db $42, $39, $fa, $ff, $81, $f6, $71, $87, $22, $61, $9d, $6d, $0c, $38, $e5, $fd
- db $44, $ea, $be, $a4, $a9, $cf, $de, $4b, $60, $4b, $bb, $f6, $70, $bc, $bf, $be
- db $c6, $7e, $9b, $28, $fa, $27, $a1, $ea, $85, $30, $ef, $d4, $05, $1d, $88, $04
- db $39, $d0, $d4, $d9, $e5, $99, $db, $e6, $f8, $7c, $a2, $1f, $65, $56, $ac, $c4
- db $44, $22, $29, $f4, $97, $ff, $2a, $43, $a7, $23, $94, $ab, $39, $a0, $93, $fc
- db $c3, $59, $5b, $65, $92, $cc, $0c, $8f, $7d, $f4, $ef, $ff, $d1, $5d, $84, $85
- db $4f, $7e, $a8, $6f, $e0, $e6, $2c, $fe, $14, $43, $01, $a3, $a1, $11, $08, $4e
- db $82, $7e, $53, $f7, $35, $f2, $3a, $bd, $bb, $d2, $d7, $2a, $91, $d3, $86, $eb
+MD5_K_Table:
+ dl $d76aa478, $e8c7b756, $242070db, $c1bdceee
+ dl $f57c0faf, $4787c62a, $a8304613, $fd469501
+ dl $698098d8, $8b44f7af, $ffff5bb1, $895cd7be
+ dl $6b901122, $fd987193, $a679438e, $49b40821
+ dl $f61e2562, $c040b340, $265e5a51, $e9b6c7aa
+ dl $d62f105d, $02441453, $d8a1e681, $e7d3fbc8
+ dl $21e1cde6, $c33707d6, $f4d50d87, $455a14ed
+ dl $a9e3e905, $fcefa3f8, $676f02d9, $8d2a4c8a
+ dl $fffa3942, $8771f681, $6d9d6122, $fde5380c
+ dl $a4beea44, $4bdecfa9, $f6bb4b60, $bebfbc70
+ dl $289b7ec6, $eaa127fa, $d4ef3085, $04881d05
+ dl $d9d4d039, $e6db99e5, $1fa27cf8, $c4ac5665
+ dl $f4292244, $432aff97, $ab9423a7, $fc93a039
+ dl $655b59c3, $8f0ccc92, $ffeff47d, $85845dd1
+ dl $6fa87e4f, $fe2ce6e0, $a3014314, $4e0811a1
+ dl $f7537e82, $bd3af235, $2ad7d2bb, $eb86d391
Function113c8e:
ld a, c
--- a/mobile/mobile_12_2.asm
+++ b/mobile/mobile_12_2.asm
@@ -267,8 +267,8 @@
call GetNick
ld h, d
ld l, e
- ld de, wd006
- ld bc, 6
+ ld de, wMobileParticipant1Nickname
+ ld bc, NAME_LENGTH_JAPANESE
call CopyBytes
ld a, [wd003]
ld hl, wPartyMonNicknames
@@ -275,8 +275,8 @@
call GetNick
ld h, d
ld l, e
- ld de, wd00c
- ld bc, 6
+ ld de, wMobileParticipant2Nickname
+ ld bc, NAME_LENGTH_JAPANESE
call CopyBytes
ld a, [wd004]
ld hl, wPartyMonNicknames
@@ -283,8 +283,8 @@
call GetNick
ld h, d
ld l, e
- ld de, wd012
- ld bc, 6
+ ld de, wMobileParticipant3Nickname
+ ld bc, NAME_LENGTH_JAPANESE
call CopyBytes
ld hl, MobileUseTheseThreeMonText
call PrintText
--- a/mobile/mobile_22.asm
+++ b/mobile/mobile_22.asm
@@ -142,12 +142,12 @@
pop bc
ret
-Function89209:
+Mobile_EnableSpriteUpdates:
ld a, 1
ld [wSpriteUpdatesEnabled], a
ret
-Function8920f:
+Mobile_DisableSpriteUpdates:
ld a, 0
ld [wSpriteUpdatesEnabled], a
ret
@@ -237,13 +237,13 @@
ld [wMenuCursorBuffer], a
call PushWindow
call Mobile22_SetBGMapMode0
- call Function89209
+ call Mobile_EnableSpriteUpdates
call VerticalMenu
push af
ld c, $a
call DelayFrames
call CloseWindow
- call Function8920f
+ call Mobile_DisableSpriteUpdates
pop af
jr c, .done
ld a, [wMenuCursorY]
@@ -2514,9 +2514,9 @@
Function8a03d:
ld hl, MobileCardFolderIntro2Text
- call Function89209
+ call Mobile_EnableSpriteUpdates
call PrintText
- call Function8920f
+ call Mobile_DisableSpriteUpdates
jp Function89e36
Function8a04c:
@@ -2690,9 +2690,9 @@
and a
ret
.asm_8a16b
- call Function89209
+ call Mobile_EnableSpriteUpdates
call CloseWindow
- call Function8920f
+ call Mobile_DisableSpriteUpdates
scf
ret
@@ -3726,9 +3726,9 @@
pop bc
jr .asm_8a9a1
.asm_8a9bb
- call Function89209
+ call Mobile_EnableSpriteUpdates
call CloseWindow
- call Function8920f
+ call Mobile_DisableSpriteUpdates
ret
Jumptable_8a9c5:
--- a/mobile/mobile_22_2.asm
+++ b/mobile/mobile_22_2.asm
@@ -796,9 +796,9 @@
call Function8b703
call Function8b75d
call UpdateSprites
- call Function89209
+ call Mobile_EnableSpriteUpdates
call ScrollingMenu
- call Function8920f
+ call Mobile_DisableSpriteUpdates
ld a, [wMenuJoypad]
cp $2
jr z, .asm_8b823
--- a/mobile/mobile_45.asm
+++ b/mobile/mobile_45.asm
@@ -124,8 +124,6 @@
String_114232:
db "=?ISO-2022-JP?B?", 0
-popc
-
Function114243::
ld a, SRAM_ENABLE
ld [MBC3SRamEnable], a
@@ -444,7 +442,7 @@
jp Function11425c
Function1143f3:
- call Function114412
+ call .asm_114412
and a
jr nz, .asm_11440d
ld a, $4
@@ -470,7 +468,7 @@
ld b, $84
ret
-Function114412:
+.asm_114412:
ld a, c
ld [$dc00], a
ldh [hSRAMBank], a
@@ -514,9 +512,9 @@
jr z, .asm_1144c2
inc e
call z, Function1144c8
- cp $61 ; "a"
+ cp "a"
jr c, .asm_114462
- cp $7b ; "z" + 1
+ cp "z" + 1
jr nc, .asm_114462
sub $20
@@ -540,10 +538,10 @@
jr .asm_11446e
.asm_114476
- ld a, $20 ; " "
+ ld a, " "
cp b
jr z, .asm_114481
- ld a, $a ; NL
+ ld a, "\n"
cp b
jr z, .asm_114481
dec de
@@ -559,18 +557,18 @@
inc bc
inc e
call z, Function1144c8
- cp $d ; CR
+ cp $d ; "\r"
jr nz, .asm_114486
ld a, [de]
inc bc
inc e
call z, Function1144c8
- cp $a ; NL
+ cp "\n"
jr nz, .asm_114486
ld a, [de]
- cp $20 ; " "
+ cp " "
jr z, .asm_114486
- cp $9 ; TAB
+ cp "\t"
jr z, .asm_114486
ld d, h
ld e, l
@@ -4926,7 +4924,7 @@
.asm_115c77
ld a, [de]
inc de
- call Function115cfd
+ call .decodeBase64Character
ld [hli], a
dec b
jr nz, .asm_115c77
@@ -5026,27 +5024,27 @@
jp nz, .asm_115c64
ret
-Function115cfd:
- cp $2b
+.decodeBase64Character
+ cp "+"
jr c, .asm_115d27
jr z, .asm_115d2f
- cp $2f
+ cp "/"
jr c, .asm_115d27
jr z, .asm_115d32
- cp $30
+ cp "0"
jr c, .asm_115d27
- cp $3a
+ cp "9" + 1
jr c, .asm_115d35
- cp $3d
+ cp "="
jr c, .asm_115d27
jr z, .asm_115d38
- cp $41
+ cp "A"
jr c, .asm_115d27
- cp $5b
+ cp "Z" + 1
jr c, .asm_115d4d
- cp $61
+ cp "a"
jr c, .asm_115d27
- cp $7b
+ cp "z" + 1
jr c, .asm_115d50
.asm_115d27
@@ -5156,3 +5154,5 @@
ld d, $a0
ld e, $0
ret
+
+popc
--- a/mobile/mobile_45_stadium.asm
+++ b/mobile/mobile_45_stadium.asm
@@ -486,11 +486,19 @@
inc [hl]
ret
+pushc
+setcharmap ascii
+
Unknown_117a0f:
-INCBIN "data/mobile/ascii-alpha.txt"
+ db "ABCDEFGHIJKLMNOPQRSTUVWXYZ "
+ db "abcdefghijklmnopqrstuvwxyz "
Unknown_117a47:
-INCBIN "data/mobile/ascii-sym.txt"
+ db "0123456789 "
+ db "!\"#$%&'()*+ "
+ db ",-./:;<=>?@ "
+ db "[\\]^_`\{|}~ "
+popc
; everything from here to the end of the bank is related to the
; Mobile Stadium option from the continue/newgame menu.
--- a/mobile/mobile_46.asm
+++ b/mobile/mobile_46.asm
@@ -956,7 +956,7 @@
.asm_118803
ld a, $d3
-Function118805:
+SetMobileErrorCode:
ld [wMobileErrorCodeBuffer], a
xor a
ld [wMobileErrorCodeBuffer + 1], a
@@ -1388,7 +1388,7 @@
cp $a6
jr c, .asm_118af5
ld a, $da
- jp Function118805
+ jp SetMobileErrorCode
.asm_118b06
call Function118b24
@@ -1478,7 +1478,7 @@
cp $e0
ret c
ld a, $d3
- call Function118805
+ call SetMobileErrorCode
and a
ret
@@ -1542,7 +1542,7 @@
.asm_118d7b
ld a, $d3
- jp Function118805
+ jp SetMobileErrorCode
Function118d80:
call Function118e06
@@ -2117,7 +2117,7 @@
.asm_1191a6
ld a, $d3
- call Function118805
+ call SetMobileErrorCode
scf
ret
@@ -2137,7 +2137,7 @@
cp $a6
jr c, .asm_1191b4
ld a, $da
- call Function118805
+ call SetMobileErrorCode
ld a, BANK("Battle Tower RAM")
ldh [rSVBK], a
pop bc
@@ -2272,7 +2272,7 @@
and a
jr z, .asm_119266
ld a, $d3
- call Function118805
+ call SetMobileErrorCode
scf
ret
@@ -2537,7 +2537,7 @@
and $1
jr z, .asm_11945d
ld a, $d3
- jp Function118805
+ jp SetMobileErrorCode
.asm_11945d
xor a
ld [wcd50], a
@@ -2717,7 +2717,7 @@
ret
.asm_119571
ld a, $d8
- jp Function118805
+ jp SetMobileErrorCode
.asm_119576
ld a, $10
jr .asm_11957c
@@ -2805,7 +2805,7 @@
ret
.asm_1195f3
ld a, $d8
- jp Function118805
+ jp SetMobileErrorCode
Function1195f8:
ld a, $11
@@ -2991,7 +2991,7 @@
cp $a
jr nz, .asm_119722
ld a, $b
- jp Function118805
+ jp SetMobileErrorCode
.asm_119722
call Random
@@ -3055,7 +3055,7 @@
.asm_119770
ld a, $d3
- jp Function118805
+ jp SetMobileErrorCode
.asm_119775
ld a, b
@@ -3524,11 +3524,17 @@
ld [wBattleTowerRoomMenuJumptableIndex], a
ret
+pushc
+setcharmap ascii
+
XGameCode:
-INCBIN "data/mobile/x-game-code.txt"
+ db "CGB-BXTJ-00", $0
+
XGameResult:
-INCBIN "data/mobile/x-game-result.txt"
+ db "pokemon_crystal", $0
+popc
+
Function119b0d:
ld a, $8
ld [wBattleTowerRoomMenu2JumptableIndex], a
@@ -3613,22 +3619,22 @@
inc de
cp $d
jr z, .asm_119bfa
- call Function119c3e
+ call .decodeBase64Character
ret c
ld [hli], a
ld a, [de]
inc de
- call Function119c3e
+ call .decodeBase64Character
ret c
ld [hli], a
ld a, [de]
inc de
- call Function119c3e
+ call .decodeBase64Character
ret c
ld [hli], a
ld a, [de]
inc de
- call Function119c3e
+ call .decodeBase64Character
ret c
ld [hl], a
push de
@@ -3712,29 +3718,34 @@
call CopyBytes
jp BattleTowerRoomMenu_IncrementJumptable
-Function119c3e:
- cp $2b
+pushc
+setcharmap ascii
+
+.decodeBase64Character
+ cp "+"
jr c, .asm_119c68
jr z, .asm_119c80
- cp $2f
+ cp "/"
jr c, .asm_119c68
jr z, .asm_119c84
- cp $30
+ cp "0"
jr c, .asm_119c68
- cp $3a
+ cp "9" + 1
jr c, .asm_119c88
- cp $3d
+ cp "="
jr c, .asm_119c68
jr z, .asm_119c8c
- cp $41
+ cp "A"
jr c, .asm_119c68
- cp $5b
+ cp "Z" + 1
jr c, .asm_119c8f
- cp $61
+ cp "a"
jr c, .asm_119c68
- cp $7b
+ cp "z" + 1
jr c, .asm_119c93
+popc
+
.asm_119c68
ld a, $19
ld [wBattleTowerRoomMenuJumptableIndex], a
@@ -3989,12 +4000,17 @@
inc [hl]
ret
+pushc
+setcharmap ascii
+
XGameCodePrefix:
-INCBIN "data/mobile/x-game-code-prefix.txt"
+ db "X-Game-code:\n"
XGameResultPrefix:
-INCBIN "data/mobile/x-game-result-prefix.txt"
+ db "X-Game-result:\n"
+popc
+
Function119e4f:
push bc
ld hl, w3_d100
@@ -4469,7 +4485,7 @@
cp $50
jr nz, .asm_11a1e4
ld a, $d3
- call Function118805
+ call SetMobileErrorCode
scf
ret
@@ -4913,16 +4929,16 @@
Function11a536:
ld hl, hJoyPressed
ld a, [hl]
- and $1
+ and A_BUTTON
jr nz, .asm_11a5a7
ld a, [hl]
- and $2
+ and B_BUTTON
jr nz, .asm_11a5a2
ld a, [hl]
- and $40
+ and D_UP
jr nz, .asm_11a564
ld a, [hl]
- and $80
+ and D_DOWN
jr nz, .asm_11a583
.asm_11a54d
ld a, [wBattleTowerRoomMenu2JumptableIndex]
@@ -5401,7 +5417,7 @@
bit 7, h
ret nz
ld a, $d6
- call Function118805
+ call SetMobileErrorCode
and a
ret
@@ -5631,7 +5647,7 @@
ld a, BANK(LoadMenuMonIcon)
ld e, MONICON_MOBILE2
rst FarCall
- ld hl, $c6d0
+ ld hl, wPokedexOrder
ld bc, $0115
xor a
call ByteFill
@@ -5641,8 +5657,8 @@
ld [wcf65], a
ld [wcf66], a
ld [wcd30], a
- ld a, $2
- ld [wc7d4], a
+ ld a, DEXMODE_ABC
+ ld [wCurDexMode], a
farcall Pokedex_OrderMonsByMode
ret
@@ -5696,16 +5712,16 @@
and a
ret z
ld a, [hl]
- and $40
+ and D_UP
jr nz, .asm_11ade6
ld a, [hl]
- and $80
+ and D_DOWN
jr nz, .asm_11aded
ld a, [hl]
- and $1
+ and A_BUTTON
jr nz, .asm_11ae06
ld a, [hl]
- and $2
+ and B_BUTTON
ret z
call PlayClickSFX
xor a
@@ -6119,7 +6135,7 @@
ld a, [wc7d0]
ld e, a
ld d, $0
- ld hl, wc6d0
+ ld hl, wPokedexOrder
add hl, de
ld e, l
ld d, h
@@ -6183,10 +6199,10 @@
Function11b0ff:
ld hl, hJoyPressed
ld a, [hl]
- and $2
+ and B_BUTTON
jr nz, .asm_11b141
ld a, [hl]
- and $1
+ and A_BUTTON
jr nz, .asm_11b131
call Function11b175
jr nc, .asm_11b125
@@ -6265,19 +6281,19 @@
ld e, a
ld hl, hJoyLast
ld a, [hl]
- and $40
+ and D_UP
jr nz, .asm_11b19a
ld a, [hl]
- and $80
+ and D_DOWN
jr nz, .asm_11b1ae
ld a, d
cp e
jr nc, .asm_11b1ed
ld a, [hl]
- and $20
+ and D_LEFT
jr nz, .asm_11b1c6
ld a, [hl]
- and $10
+ and D_RIGHT
jr nz, .asm_11b1d8
jr .asm_11b1ed
--- a/mobile/mobile_5f.asm
+++ b/mobile/mobile_5f.asm
@@ -507,9 +507,9 @@
ret
Function17d2ce:
- ld a, $5
+ ld a, BANK(s5_aa72)
call GetSRAMBank
- ld a, [$aa72]
+ ld a, [s5_aa72]
call CloseSRAM
and a
jr nz, .asm_17d2e2
--- a/mobile/news/news.asm
+++ b/mobile/news/news.asm
@@ -3,10 +3,10 @@
db $cc, $6b, $1e ; unused
Unreferenced_Function1f4003:
- ld a, $6
+ ld a, BANK(s6_a000)
call GetSRAMBank
ld hl, .news_data
- ld de, $a000
+ ld de, s6_a000
ld bc, $1000
call CopyBytes
call CloseSRAM
@@ -16,10 +16,10 @@
INCBIN "mobile/news/news_1.bin"
Unreferenced_Function1f4dbe:
- ld a, $6
+ ld a, BANK(s6_a000)
call GetSRAMBank
ld hl, .news_data
- ld de, $a000
+ ld de, s6_a000
ld bc, $1000
call CopyBytes
call CloseSRAM
@@ -29,10 +29,10 @@
INCBIN "mobile/news/news_2.bin"
Function1f5d9f:
- ld a, $6
+ ld a, BANK(s6_a000)
call GetSRAMBank
ld hl, .news_data
- ld de, $a000
+ ld de, s6_a000
ld bc, $1000
call CopyBytes
call CloseSRAM