summaryrefslogtreecommitdiff
path: root/home
diff options
context:
space:
mode:
Diffstat (limited to 'home')
-rw-r--r--home/audio.asm2
-rw-r--r--home/battle.asm6
-rw-r--r--home/copy.asm23
-rw-r--r--home/decompress.asm2
-rw-r--r--home/fade.asm2
-rw-r--r--home/game_time.asm2
-rw-r--r--home/handshake.asm20
-rw-r--r--home/init.asm25
-rw-r--r--home/joypad.asm8
-rw-r--r--home/lcd.asm6
-rw-r--r--home/map.asm16
-rw-r--r--home/map_objects.asm8
-rw-r--r--home/math.asm10
-rw-r--r--home/menu.asm26
-rw-r--r--home/mobile.asm5
-rw-r--r--home/movement.asm34
-rw-r--r--home/palettes.asm18
-rw-r--r--home/serial.asm107
-rw-r--r--home/sine.asm10
-rw-r--r--home/string.asm3
-rw-r--r--home/text.asm38
-rw-r--r--home/time.asm9
-rw-r--r--home/vblank.asm3
-rw-r--r--home/window.asm34
24 files changed, 186 insertions, 231 deletions
diff --git a/home/audio.asm b/home/audio.asm
index c6982fbbc..5e6eafe9a 100644
--- a/home/audio.asm
+++ b/home/audio.asm
@@ -196,7 +196,7 @@ endr
PlaySFX:: ; 3c23
; Play sound effect de.
-; Sound effects are ordered by priority (lowest to highest)
+; Sound effects are ordered by priority (highest to lowest)
push hl
push de
diff --git a/home/battle.asm b/home/battle.asm
index ea228851e..e8aa0747c 100644
--- a/home/battle.asm
+++ b/home/battle.asm
@@ -153,9 +153,8 @@ GetBattleVarAddr:: ; 39e7
ld hl, .battlevarpairs
ld c, a
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
@@ -175,9 +174,8 @@ endr
ld b, 0
ld hl, .vars
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
diff --git a/home/copy.asm b/home/copy.asm
index d4e3e2da7..8a307b3df 100644
--- a/home/copy.asm
+++ b/home/copy.asm
@@ -6,13 +6,7 @@ Get2bpp_2:: ; dc9
bit 7, a
jp z, Copy2bpp
- ld a, [hROMBank]
- push af
- ld a, BANK(_Get2bpp)
- rst Bankswitch
- call _Get2bpp
- pop af
- rst Bankswitch
+ homecall _Get2bpp
ret
; ddc
@@ -22,13 +16,7 @@ Get1bpp_2:: ; ddc
bit 7, a
jp z, Copy1bpp
- ld a, [hROMBank]
- push af
- ld a, BANK(_Get1bpp)
- rst Bankswitch
- call _Get1bpp
- pop af
- rst Bankswitch
+ homecall _Get1bpp
ret
; def
@@ -205,9 +193,8 @@ FarCopyBytesDouble:: ; e9b
.loop
ld a, [de]
inc de
-rept 2
ld [hli], a
-endr
+ ld [hli], a
.dec
dec c
jr nz, .loop
@@ -422,9 +409,9 @@ Copy1bpp:: ; fa4
push af
ld h, 0
ld l, c
-rept 3
add hl, hl
-endr
+ add hl, hl
+ add hl, hl
ld b, h
ld c, l
pop af
diff --git a/home/decompress.asm b/home/decompress.asm
index 373e9fe89..216b861f6 100644
--- a/home/decompress.asm
+++ b/home/decompress.asm
@@ -99,7 +99,7 @@ LZ_LONG_HI EQU %00000011
add a ; << 3
add a
- ; This is our new control code.
+ ; This is our new control code.
and LZ_CMD
push af
diff --git a/home/fade.asm b/home/fade.asm
index 579a4125a..c5eb2c2eb 100644
--- a/home/fade.asm
+++ b/home/fade.asm
@@ -2,6 +2,8 @@
Function48c:: ; 48c
+; XXX
+; TimeOfDayFade
ld a, [TimeOfDayPal]
ld b, a
ld hl, IncGradGBPalTable_11
diff --git a/home/game_time.asm b/home/game_time.asm
index 54cad89c9..09d558eef 100644
--- a/home/game_time.asm
+++ b/home/game_time.asm
@@ -33,7 +33,7 @@ UpdateGameTimer:: ; 20ad
; Don't update if game logic is paused.
- ld a, [wc2cd]
+ ld a, [wGameLogicPaused]
and a
ret nz
diff --git a/home/handshake.asm b/home/handshake.asm
index 2f067e7f6..14daf08a7 100644
--- a/home/handshake.asm
+++ b/home/handshake.asm
@@ -1,28 +1,22 @@
PrinterReceive:: ; 2057
- ld a, [hROMBank]
- push af
- ld a, BANK(_PrinterReceive)
- rst Bankswitch
-
- call _PrinterReceive
- pop af
- rst Bankswitch
+ homecall _PrinterReceive
ret
; 2063
AskSerial:: ; 2063
; send out a handshake while serial int is off
- ld a, [wc2d4]
+ ld a, [wPrinterConnectionOpen]
bit 0, a
ret z
- ld a, [wc2d5]
+; if we're still interpreting data, don't try to receive
+ ld a, [wPrinterOpcode]
and a
ret nz
; once every 6 frames
- ld hl, wca8a
+ ld hl, wHandshakeFrameDelay
inc [hl]
ld a, [hl]
cp 6
@@ -31,8 +25,8 @@ AskSerial:: ; 2063
xor a
ld [hl], a
- ld a, $c
- ld [wc2d5], a
+ ld a, 12
+ ld [wPrinterOpcode], a
; handshake
ld a, $88
diff --git a/home/init.asm b/home/init.asm
index 8c847ec76..b983ce826 100644
--- a/home/init.asm
+++ b/home/init.asm
@@ -100,7 +100,7 @@ Init:: ; 17d
ld [rSVBK], a
call ClearVRAM
call ClearSprites
- call Function270
+ call ClearsScratch
ld a, BANK(LoadPushOAM)
@@ -139,7 +139,7 @@ Init:: ; 17d
ld a, -1
ld [hLinkPlayerNumber], a
- callba Function9890
+ callba InitCGBPals
ld a, VBGMap1 / $100
ld [hBGMapAddress + 1], a
@@ -154,9 +154,9 @@ Init:: ; 17d
ld a, [hCGB]
and a
- jr z, .asm_22b
+ jr z, .no_double_speed
call NormalSpeed
-.asm_22b
+.no_double_speed
xor a
ld [rIF], a
@@ -166,7 +166,7 @@ Init:: ; 17d
call DelayFrame
- predef Function9853
+ predef InitSGBBorder ; SGB init
call MapSetup_Sound_Off
xor a
@@ -194,9 +194,10 @@ ClearVRAM:: ; 245
ClearWRAM:: ; 25a
; Wipe swappable WRAM banks (1-7)
+; Assumes CGB or AGB
ld a, 1
-.asm_25c
+.bank_loop
push af
ld [rSVBK], a
xor a
@@ -206,15 +207,17 @@ ClearWRAM:: ; 25a
pop af
inc a
cp 8
- jr nc, .asm_25c
+ jr nc, .bank_loop ; Should be jr c
ret
; 270
-Function270:: ; 270
- ld a, $0
+ClearsScratch:: ; 270
+; Wipe the first 32 bytes of sScratch
+
+ ld a, BANK(sScratch)
call GetSRAMBank
- ld hl, $a000
- ld bc, $0020
+ ld hl, sScratch
+ ld bc, $20
xor a
call ByteFill
call CloseSRAM
diff --git a/home/joypad.asm b/home/joypad.asm
index d66cdb662..0cb2f6206 100644
--- a/home/joypad.asm
+++ b/home/joypad.asm
@@ -33,7 +33,7 @@ Joypad:: ; 935
ret nz
; If we're saving, input is disabled.
- ld a, [wc2cd]
+ ld a, [wGameLogicPaused]
and a
ret nz
@@ -42,9 +42,8 @@ Joypad:: ; 935
ld a, R_DPAD
ld [rJOYP], a
; Read twice to give the request time to take.
-rept 2
ld a, [rJOYP]
-endr
+ ld a, [rJOYP]
; The Joypad register output is in the lo nybble (inversed).
; We make the hi nybble of our new container d-pad input.
@@ -209,9 +208,8 @@ GetJoypad:: ; 984
jr nz, .next
; The current input is overwritten.
-rept 2
dec hl
-endr
+ dec hl
ld b, NO_INPUT
jr .finishauto
diff --git a/home/lcd.asm b/home/lcd.asm
index fd62808d2..b73e9e5be 100644
--- a/home/lcd.asm
+++ b/home/lcd.asm
@@ -3,7 +3,7 @@
Function547:: ; 547
; Unreferenced
- ld a, [hFFC6]
+ ld a, [hLCDCPointer]
cp rSCX - $ff00
ret nz
ld c, a
@@ -15,7 +15,7 @@ Function547:: ; 547
LCD:: ; 552
push af
- ld a, [hFFC6]
+ ld a, [hLCDCPointer]
and a
jr z, .done
@@ -26,7 +26,7 @@ LCD:: ; 552
ld b, LYOverrides >> 8
ld a, [bc]
ld b, a
- ld a, [hFFC6]
+ ld a, [hLCDCPointer]
ld c, a
ld a, b
ld [$ff00+c], a
diff --git a/home/map.asm b/home/map.asm
index 96eae7d37..967d13af5 100644
--- a/home/map.asm
+++ b/home/map.asm
@@ -155,9 +155,9 @@ LoadMetatiles:: ; 2198
add a
ld l, a
ld h, 0
-rept 3
add hl, hl
-endr
+ add hl, hl
+ add hl, hl
ld a, [TilesetBlocksAddress]
add l
ld l, a
@@ -694,9 +694,9 @@ RestoreFacingAfterWarp:: ; 248a
ld a, [hli]
ld h, [hl]
ld l, a
-rept 3
inc hl ; get to the warp coords
-endr
+ inc hl ; get to the warp coords
+ inc hl ; get to the warp coords
ld a, [WarpNumber]
dec a
ld c, a
@@ -751,9 +751,9 @@ ChangeMap:: ; 24e4
ld [hConnectionStripLength], a
ld c, a
ld b, 0
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld c, 3
add hl, bc
ld a, [MapBlockDataBank]
@@ -1072,7 +1072,7 @@ MapTextbox:: ; 269a
push hl
call SpeechTextBox
- call Function2e31
+ call SafeUpdateSprites
ld a, 1
ld [hOAMUpdate], a
call ApplyTilemap
@@ -1382,7 +1382,7 @@ UpdateBGMapColumn:: ; 27f8
; unreferenced
ld hl, BGMapBuffer
- ld bc, SGBPredef - BGMapBuffer
+ ld bc, BGMapBufferEnd - BGMapBuffer
xor a
call ByteFill
ret
diff --git a/home/map_objects.asm b/home/map_objects.asm
index 3c70233eb..f64ebd8ab 100644
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -28,9 +28,8 @@ GetSpriteVTile:: ; 180e
.loop
cp [hl]
jr z, .found
-rept 2
inc hl
-endr
+ inc hl
dec c
jr nz, .loop
ld a, [UsedSprites + 1]
@@ -503,9 +502,8 @@ rept SPRITEMOVEDATA_FIELDS
endr
ld a, BANK(SpriteMovementData)
call GetFarByte
-rept 2
add a
-endr
+ add a
and $c
pop de
pop bc
@@ -638,7 +636,7 @@ GetObjectStruct:: ; 1ae5
ret
; 1af1
-GetObjectSprite:: ; 1af1
+DoesObjectHaveASprite:: ; 1af1
ld hl, OBJECT_SPRITE
add hl, bc
ld a, [hl]
diff --git a/home/math.asm b/home/math.asm
index c320fd15c..01aea6b72 100644
--- a/home/math.asm
+++ b/home/math.asm
@@ -59,15 +59,7 @@ Divide:: ; 3124
push hl
push de
push bc
- ld a, [hROMBank]
- push af
- ld a, BANK(_Divide)
- rst Bankswitch
-
- call _Divide
-
- pop af
- rst Bankswitch
+ homecall _Divide
pop bc
pop de
pop hl
diff --git a/home/menu.asm b/home/menu.asm
index b7755de08..563ee9f99 100644
--- a/home/menu.asm
+++ b/home/menu.asm
@@ -229,9 +229,9 @@ _OffsetMenuDataHeader:: ; 1e35
; 1e5d
DoNthMenu:: ; 1e5d
- call MenuFunc_1e7f
+ call DrawVariableLengthMenuBox
call MenuWriteText
- call Function1eff
+ call InitMenuCursorAndButtonPermissions
call GetStaticMenuJoypad
call GetMenuJoypad
call MenuClickSound
@@ -239,17 +239,17 @@ DoNthMenu:: ; 1e5d
; 1e70
SetUpMenu:: ; 1e70
- call MenuFunc_1e7f ; ???
+ call DrawVariableLengthMenuBox ; ???
call MenuWriteText
- call Function1eff ; set up selection pointer
+ call InitMenuCursorAndButtonPermissions ; set up selection pointer
ld hl, w2DMenuFlags1
set 7, [hl]
ret
-MenuFunc_1e7f::
+DrawVariableLengthMenuBox::
call CopyMenuData2
call GetMenuIndexSet
- call Function1ea6
+ call AutomaticGetMenuBottomCoord
call MenuBox
ret
@@ -257,8 +257,8 @@ MenuWriteText::
xor a
ld [hBGMapMode], a
call GetMenuIndexSet ; sort out the text
- call Function1eda ; actually write it
- call Function2e31
+ call RunMenuItemPrintingFunction ; actually write it
+ call SafeUpdateSprites
ld a, [hOAMUpdate]
push af
ld a, $1
@@ -269,7 +269,7 @@ MenuWriteText::
ret
; 0x1ea6
-Function1ea6:: ; 1ea6
+AutomaticGetMenuBottomCoord:: ; 1ea6
ld a, [wMenuBorderLeftCoord]
ld c, a
ld a, [wMenuBorderRightCoord]
@@ -310,7 +310,7 @@ GetMenuIndexSet:: ; 1ebd
ret
; 1eda
-Function1eda:: ; 1eda
+RunMenuItemPrintingFunction:: ; 1eda
call MenuBoxCoord2Tile
ld bc, 2 * SCREEN_WIDTH + 2
add hl, bc
@@ -325,7 +325,7 @@ Function1eda:: ; 1eda
ld d, h
ld e, l
ld hl, wMenuData2DisplayFunctionPointer
- call .__wMenuData2DisplayFunction__
+ call ._hl_
pop hl
ld de, 2 * SCREEN_WIDTH
add hl, de
@@ -333,14 +333,14 @@ Function1eda:: ; 1eda
jr .loop
; 1efb
-.__wMenuData2DisplayFunction__ ; 1efb
+._hl_ ; 1efb
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 1eff
-Function1eff:: ; 1eff
+InitMenuCursorAndButtonPermissions:: ; 1eff
call InitVerticalMenuCursor
ld hl, wMenuJoypadFilter
ld a, [wMenuData2Flags]
diff --git a/home/mobile.asm b/home/mobile.asm
index afe5d1b59..f50571ff4 100644
--- a/home/mobile.asm
+++ b/home/mobile.asm
@@ -6,7 +6,7 @@ Function3e32:: ; 3e32
ld [$c986], a
ld a, h
ld [$c987], a
- jr nz, .asm_3e4f
+ jr nz, .okay
ld [$c982], a
ld a, l
@@ -17,7 +17,7 @@ Function3e32:: ; 3e32
ld a, b
ld [hl], a
-.asm_3e4f
+.okay
ld hl, $c822
set 6, [hl]
ld a, [hROMBank]
@@ -30,6 +30,7 @@ Function3e32:: ; 3e32
; 3e60
Function3e60:: ; 3e60
+; Return from Function110030
ld [$c986], a
ld a, l
ld [$c987], a
diff --git a/home/movement.asm b/home/movement.asm
index 0e131e468..c4b5b578d 100644
--- a/home/movement.asm
+++ b/home/movement.asm
@@ -107,9 +107,8 @@ ComputePathToWalkToPlayer:: ; 1b5f
push hl
ld l, b
ld h, 0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld e, a
ld d, 0
add hl, de
@@ -122,18 +121,18 @@ endr
; 1ba5
.MovementData:
- slow_step_down
- slow_step_up
- slow_step_left
- slow_step_right
- step_down
- step_up
- step_left
- step_right
- big_step_down
- big_step_up
- big_step_left
- big_step_right
+ slow_step DOWN
+ slow_step UP
+ slow_step LEFT
+ slow_step RIGHT
+ step DOWN
+ step UP
+ step LEFT
+ step RIGHT
+ big_step DOWN
+ big_step UP
+ big_step LEFT
+ big_step RIGHT
; 1bb1
SetMenuAttributes:: ; 1bb1
@@ -148,13 +147,12 @@ SetMenuAttributes:: ; 1bb1
dec b
jr nz, .loop
ld a, $1
-rept 2
ld [hli], a
-endr
+ ld [hli], a
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
pop bc
pop hl
ret
diff --git a/home/palettes.asm b/home/palettes.asm
index 1d060dbb4..4eec68b5d 100644
--- a/home/palettes.asm
+++ b/home/palettes.asm
@@ -341,25 +341,11 @@ Special_ReloadSpritesNoPalettes:: ; d91
FarCallSwapTextboxPalettes:: ; db1
- ld a, [hROMBank]
- push af
- ld a, BANK(SwapTextboxPalettes)
- rst Bankswitch
- call SwapTextboxPalettes
- pop af
- rst Bankswitch
+ homecall SwapTextboxPalettes
ret
; dbd
FarCallScrollBGMapPalettes:: ; dbd
- ld a, [hROMBank]
- push af
- ld a, BANK(ScrollBGMapPalettes)
- rst Bankswitch
-
- call ScrollBGMapPalettes
-
- pop af
- rst Bankswitch
+ homecall ScrollBGMapPalettes
ret
; dc9
diff --git a/home/serial.asm b/home/serial.asm
index 97e0c2442..e60704f3d 100644
--- a/home/serial.asm
+++ b/home/serial.asm
@@ -10,7 +10,7 @@ Serial:: ; 6ef
and a
jr nz, .mobile
- ld a, [wc2d4]
+ ld a, [wPrinterConnectionOpen]
bit 0, a
jr nz, .printer
@@ -78,7 +78,7 @@ Serial:: ; 6ef
.player2
ld a, $1
ld [hFFCA], a
- ld a, -2
+ ld a, $fe
ld [hSerialSend], a
.end
@@ -126,92 +126,95 @@ Function75f:: ; 75f
; 78a
Function78a:: ; 78a
+.loop
xor a
ld [hFFCA], a
ld a, [hLinkPlayerNumber]
cp $2
- jr nz, .asm_79b
+ jr nz, .not_player_2
ld a, $1
ld [rSC], a
ld a, $81
ld [rSC], a
-
-.asm_79b
+.not_player_2
+.loop2
ld a, [hFFCA]
and a
- jr nz, .asm_7e5
+ jr nz, .reset_ffca
ld a, [hLinkPlayerNumber]
cp $1
- jr nz, .asm_7c0
- call Function82b
- jr z, .asm_7c0
- call .asm_825
+ jr nz, .not_player_1_or_wLinkTimeoutFrames_zero
+ call CheckwLinkTimeoutFramesNonzero
+ jr z, .not_player_1_or_wLinkTimeoutFrames_zero
+ call .delay_15_cycles
push hl
- ld hl, wcf5c
+ ld hl, wLinkTimeoutFrames + 1
inc [hl]
- jr nz, .asm_7b7
+ jr nz, .no_rollover_up
dec hl
inc [hl]
-.asm_7b7
+.no_rollover_up
pop hl
- call Function82b
- jr nz, .asm_79b
- jp Function833
+ call CheckwLinkTimeoutFramesNonzero
+ jr nz, .loop2
+ jp SerialDisconnected
-.asm_7c0
+.not_player_1_or_wLinkTimeoutFrames_zero
ld a, [rIE]
and $f
cp $8
- jr nz, .asm_79b
+ jr nz, .loop2
ld a, [wcf5d]
dec a
ld [wcf5d], a
- jr nz, .asm_79b
+ jr nz, .loop2
ld a, [wcf5d + 1]
dec a
ld [wcf5d + 1], a
- jr nz, .asm_79b
+ jr nz, .loop2
ld a, [hLinkPlayerNumber]
cp $1
- jr z, .asm_7e5
- ld a, $ff
-.asm_7e2
+ jr z, .reset_ffca
+
+ ld a, 255
+.delay_255_cycles
dec a
- jr nz, .asm_7e2
+ jr nz, .delay_255_cycles
-.asm_7e5
+.reset_ffca
xor a
ld [hFFCA], a
ld a, [rIE]
and $f
sub $8
- jr nz, .asm_7f8
+ jr nz, .rIE_not_equal_8
+
ld [wcf5d], a
ld a, $50
ld [wcf5d + 1], a
-.asm_7f8
+.rIE_not_equal_8
ld a, [hSerialReceive]
cp $fe
ret nz
- call Function82b
- jr z, .asm_813
+ call CheckwLinkTimeoutFramesNonzero
+ jr z, .wLinkTimeoutFrames_zero
push hl
- ld hl, wcf5c
+ ld hl, wLinkTimeoutFrames + 1
ld a, [hl]
dec a
ld [hld], a
inc a
- jr nz, .asm_80d
+ jr nz, .no_rollover
dec [hl]
-.asm_80d
+.no_rollover
pop hl
- call Function82b
- jr z, Function833
+ call CheckwLinkTimeoutFramesNonzero
+ jr z, SerialDisconnected
-.asm_813
+.wLinkTimeoutFrames_zero
ld a, [rIE]
and $f
cp $8
@@ -220,29 +223,29 @@ Function78a:: ; 78a
ld a, [hl]
ld [hSerialSend], a
call DelayFrame
- jp Function78a
+ jp .loop
-.asm_825
- ld a, $f
-.asm_827
+.delay_15_cycles
+ ld a, 15
+.delay_cycles
dec a
- jr nz, .asm_827
+ jr nz, .delay_cycles
ret
; 82b
-Function82b:: ; 82b
+CheckwLinkTimeoutFramesNonzero:: ; 82b
push hl
- ld hl, wcf5b
+ ld hl, wLinkTimeoutFrames
ld a, [hli]
or [hl]
pop hl
ret
; 833
-Function833:: ; 833
+SerialDisconnected:: ; 833
dec a
- ld [wcf5b], a
- ld [wcf5c], a
+ ld [wLinkTimeoutFrames], a
+ ld [wLinkTimeoutFrames + 1], a
ret
; 83b
@@ -275,7 +278,7 @@ Function83b:: ; 83b
Function862:: ; 862
call LoadTileMapToTempTileMap
callab PlaceWaitingText
- call Function87d
+ call WaitLinkTransfer
jp Call_LoadTempTileMapToTileMap
; 871
@@ -283,29 +286,30 @@ Function862:: ; 862
Function871:: ; 871
call LoadTileMapToTempTileMap
callab PlaceWaitingText
- jp Function87d
+ jp WaitLinkTransfer
; 87d
; One "giant" leap for machinekind
-Function87d:: ; 87d
+WaitLinkTransfer:: ; 87d
ld a, $ff
ld [wOtherPlayerLinkAction], a
.loop
call LinkTransfer
call DelayFrame
- call Function82b
+ call CheckwLinkTimeoutFramesNonzero
jr z, .check
push hl
- ld hl, wcf5c
+ ld hl, wLinkTimeoutFrames + 1
dec [hl]
jr nz, .skip
dec hl
dec [hl]
jr nz, .skip
+ ; We might be disconnected
pop hl
xor a
- jp Function833
+ jp SerialDisconnected
.skip
pop hl
@@ -395,6 +399,7 @@ LinkDataReceived:: ; 908
; 919
Function919:: ; 919
+; XXX
ld a, [wLinkMode]
and a
ret nz
diff --git a/home/sine.asm b/home/sine.asm
index e1552db24..810845860 100644
--- a/home/sine.asm
+++ b/home/sine.asm
@@ -8,14 +8,6 @@ Sine:: ; 1b11
ld e, a
- ld a, [hROMBank]
- push af
- ld a, BANK(_Sine)
- rst Bankswitch
-
- call _Sine
-
- pop af
- rst Bankswitch
+ homecall _Sine
ret
; 1b1e
diff --git a/home/string.asm b/home/string.asm
index 70a0f2dd5..492246832 100644
--- a/home/string.asm
+++ b/home/string.asm
@@ -8,8 +8,6 @@ InitName:: ; 2ef9
; Intended for names, so this function is limited to ten characters.
push hl
ld c, 10
-; 2efc
-
_InitString:: ; 2efc
; if the string pointed to by hl is empty (defined as "zero or more spaces
; followed by a null"), then initialize it to the string pointed to by de.
@@ -31,6 +29,7 @@ _InitString:: ; 2efc
inc c
call CopyBytes
ret
+
.notblank
pop bc
pop hl
diff --git a/home/text.asm b/home/text.asm
index 6b4ce4f78..a5ddf43c9 100644
--- a/home/text.asm
+++ b/home/text.asm
@@ -129,12 +129,10 @@ TextBoxPalette:: ; 1024
; Fill text box width c height b at hl with pal 7
ld de, AttrMap - TileMap
add hl, de
-rept 2
inc b
-endr
-rept 2
+ inc b
+ inc c
inc c
-endr
ld a, TEXTBOX_PAL
.col
push bc
@@ -184,7 +182,7 @@ BuenaPrintText:: ; 105a
PrintTextBoxText:: ; 1065
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 106c
@@ -527,7 +525,7 @@ Paragraph:: ; 12f2
call LoadBlinkingCursor
.linkbattle
- call Function13b6
+ call Text_WaitBGMap
call ButtonSound
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW
@@ -548,7 +546,7 @@ Char4B:: ; 131f
call LoadBlinkingCursor
.communication
- call Function13b6
+ call Text_WaitBGMap
push de
call ButtonSound
@@ -600,7 +598,7 @@ PromptText:: ; 135a
call LoadBlinkingCursor
.ok
- call Function13b6
+ call Text_WaitBGMap
call ButtonSound
ld a, [wLinkMode]
cp LINK_COLOSSEUM
@@ -640,12 +638,10 @@ TextScroll:: ; 138c
dec c
jr nz, .row
-rept 2
inc de
-endr
-rept 2
+ inc de
+ inc hl
inc hl
-endr
pop af
dec a
jr nz, .col
@@ -659,7 +655,7 @@ endr
ret
; 13b6
-Function13b6:: ; 13b6
+Text_WaitBGMap:: ; 13b6
push bc
ld a, [hOAMUpdate]
push af
@@ -712,7 +708,7 @@ PokeFluteTerminatorCharacter:: ; 13e0
; 13e5
-PlaceWholeStringInBoxAtOnce:: ; 13e5
+PlaceHLTextAtBC:: ; 13e5
ld a, [TextBoxFlags]
push af
set 1, a
@@ -738,9 +734,8 @@ DoTextUntilTerminator:: ; 13f6
ld c, a
ld b, 0
ld hl, TextCommands
-rept 2
add hl, bc
-endr
+ add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
@@ -1014,9 +1009,8 @@ Text_PlaySound:: ; 1500
jr z, .done
cp b
jr z, .play
-rept 2
inc hl
-endr
+ inc hl
jr .loop
.play
@@ -1035,6 +1029,8 @@ endr
; 1522
Function1522:: ; 1522
+; XXX
+; TX_CRY
push de
ld e, [hl]
inc hl
@@ -1113,9 +1109,8 @@ Text_TX_STRINGBUFFER:: ; 156a
ld e, a
ld d, 0
ld hl, StringBufferPointers
-rept 2
add hl, de
-endr
+ add hl, de
ld a, BANK(StringBufferPointers)
call GetFarHalfword
ld d, h
@@ -1136,9 +1131,8 @@ Text_TX_DAY:: ; 1582
ld c, a
ld b, 0
ld hl, .Days
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/home/time.asm b/home/time.asm
index 008b7a062..338168752 100644
--- a/home/time.asm
+++ b/home/time.asm
@@ -48,17 +48,20 @@ GetClock:: ; 5b7
ld [hl], RTC_S
ld a, [de]
- and $3f
+ maskbits 60
+ and x
ld [hRTCSeconds], a
ld [hl], RTC_M
ld a, [de]
- and $3f
+ maskbits 60
+ and x
ld [hRTCMinutes], a
ld [hl], RTC_H
ld a, [de]
- and $1f
+ maskbits 24
+ and x
ld [hRTCHours], a
ld [hl], RTC_DL
diff --git a/home/vblank.asm b/home/vblank.asm
index b93519298..cb8c5ba56 100644
--- a/home/vblank.asm
+++ b/home/vblank.asm
@@ -19,9 +19,8 @@ VBlank:: ; 283
ld e, a
ld d, 0
ld hl, .VBlanks
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/home/window.asm b/home/window.asm
index d000b7fdd..ff7d766e2 100644
--- a/home/window.asm
+++ b/home/window.asm
@@ -3,12 +3,12 @@ RefreshScreen:: ; 2dba
call ClearWindowData
ld a, [hROMBank]
push af
- ld a, BANK(Function6454) ; and BANK(Function64bf)
+ ld a, BANK(ReanchorBGMap_NoOAMUpdate) ; and BANK(LoadFonts_NoOAMUpdate)
rst Bankswitch
- call Function6454
- call Function2e20
- call Function64bf
+ call ReanchorBGMap_NoOAMUpdate
+ call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
+ call LoadFonts_NoOAMUpdate
pop af
rst Bankswitch
@@ -36,10 +36,10 @@ CloseText:: ; 2dcf
xor a
ld [hBGMapMode], a
call OverworldTextModeSwitch
- call Function2e20
+ call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
xor a
ld [hBGMapMode], a
- call Function2e31
+ call SafeUpdateSprites
ld a, $90
ld [hWY], a
call ReplaceKrisSprite
@@ -52,33 +52,33 @@ OpenText:: ; 2e08
call ClearWindowData
ld a, [hROMBank]
push af
- ld a, BANK(Function6454) ; and BANK(Function64bf)
+ ld a, BANK(ReanchorBGMap_NoOAMUpdate) ; and BANK(LoadFonts_NoOAMUpdate)
rst Bankswitch
- call Function6454 ; clear bgmap
+ call ReanchorBGMap_NoOAMUpdate ; clear bgmap
call SpeechTextBox
- call Function2e20 ; anchor bgmap
- call Function64bf ; load font
+ call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap ; anchor bgmap
+ call LoadFonts_NoOAMUpdate ; load font
pop af
rst Bankswitch
ret
; 2e20
-Function2e20:: ; 2e20
+_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap:: ; 2e20
ld a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
- callba Function104110
+ callba OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
pop af
ld [hOAMUpdate], a
ret
; 2e31
-Function2e31:: ; 2e31
+SafeUpdateSprites:: ; 2e31
ld a, [hOAMUpdate]
push af
ld a, [hBGMapMode]
@@ -87,7 +87,9 @@ Function2e31:: ; 2e31
ld [hBGMapMode], a
ld a, $1
ld [hOAMUpdate], a
+
call UpdateSprites
+
xor a
ld [hOAMUpdate], a
call DelayFrame
@@ -96,4 +98,8 @@ Function2e31:: ; 2e31
pop af
ld [hOAMUpdate], a
ret
-; 2e4e
+
+; XXX
+ scf
+ ret
+; 2e50