Use labels instead of constants for HRAM

Use explicit ldh instruction to access HRAM locations, don't rely on optimizing ld
This commit is contained in:
Rangi
2018-08-25 14:28:22 -04:00
parent 376c64468b
commit eb1e3636bb
243 changed files with 4706 additions and 4661 deletions

View File

@@ -6,16 +6,16 @@ MapSetup_Sound_Off::
push bc
push af
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, BANK(_MapSetup_Sound_Off)
ld [hROMBank], a
ldh [hROMBank], a
ld [MBC3RomBank], a
call _MapSetup_Sound_Off
pop af
ld [hROMBank], a
ldh [hROMBank], a
ld [MBC3RomBank], a
pop af
@@ -30,16 +30,16 @@ UpdateSound::
push bc
push af
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, BANK(_UpdateSound)
ld [hROMBank], a
ldh [hROMBank], a
ld [MBC3RomBank], a
call _UpdateSound
pop af
ld [hROMBank], a
ldh [hROMBank], a
ld [MBC3RomBank], a
pop af
@@ -50,14 +50,14 @@ UpdateSound::
_LoadMusicByte::
; wCurMusicByte = [a:de]
ld [hROMBank], a
ldh [hROMBank], a
ld [MBC3RomBank], a
ld a, [de]
ld [wCurMusicByte], a
ld a, BANK(LoadMusicByte)
ld [hROMBank], a
ldh [hROMBank], a
ld [MBC3RomBank], a
ret
@@ -69,10 +69,10 @@ PlayMusic::
push bc
push af
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, BANK(_PlayMusic) ; and BANK(_MapSetup_Sound_Off)
ld [hROMBank], a
ldh [hROMBank], a
ld [MBC3RomBank], a
ld a, e
@@ -87,7 +87,7 @@ PlayMusic::
.end
pop af
ld [hROMBank], a
ldh [hROMBank], a
ld [MBC3RomBank], a
pop af
pop bc
@@ -103,10 +103,10 @@ PlayMusic2::
push bc
push af
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, BANK(_PlayMusic)
ld [hROMBank], a
ldh [hROMBank], a
ld [MBC3RomBank], a
push de
@@ -117,7 +117,7 @@ PlayMusic2::
call _PlayMusic
pop af
ld [hROMBank], a
ldh [hROMBank], a
ld [MBC3RomBank], a
pop af
@@ -134,12 +134,12 @@ PlayCry::
push bc
push af
ld a, [hROMBank]
ldh a, [hROMBank]
push af
; Cries are stuck in one bank.
ld a, BANK(PokemonCries)
ld [hROMBank], a
ldh [hROMBank], a
ld [MBC3RomBank], a
ld hl, PokemonCries
@@ -162,13 +162,13 @@ endr
ld [wCryLength + 1], a
ld a, BANK(_PlayCry)
ld [hROMBank], a
ldh [hROMBank], a
ld [MBC3RomBank], a
call _PlayCry
pop af
ld [hROMBank], a
ldh [hROMBank], a
ld [MBC3RomBank], a
pop af
@@ -196,10 +196,10 @@ PlaySFX::
jr c, .done
.play
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, BANK(_PlaySFX)
ld [hROMBank], a
ldh [hROMBank], a
ld [MBC3RomBank], a
ld a, e
@@ -207,7 +207,7 @@ PlaySFX::
call _PlaySFX
pop af
ld [hROMBank], a
ldh [hROMBank], a
ld [MBC3RomBank], a
.done
@@ -525,11 +525,11 @@ TerminateExpBarSound::
xor a
ld [wChannel5Flags1], a
ld [wSoundInput], a
ld [rNR10], a
ld [rNR11], a
ld [rNR12], a
ld [rNR13], a
ld [rNR14], a
ldh [rNR10], a
ldh [rNR11], a
ldh [rNR12], a
ldh [rNR13], a
ldh [rNR14], a
ret
ChannelsOff::

View File

@@ -1,6 +1,6 @@
UserPartyAttr::
push af
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr nz, .ot
pop af
@@ -11,7 +11,7 @@ UserPartyAttr::
OpponentPartyAttr::
push af
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .ot
pop af
@@ -52,22 +52,22 @@ ResetDamage::
SetPlayerTurn::
xor a
ld [hBattleTurn], a
ldh [hBattleTurn], a
ret
SetEnemyTurn::
ld a, 1
ld [hBattleTurn], a
ldh [hBattleTurn], a
ret
UpdateOpponentInParty::
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, UpdateEnemyMonInParty
jr UpdateBattleMonInParty
UpdateUserInParty::
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, UpdateBattleMonInParty
jr UpdateEnemyMonInParty
@@ -120,14 +120,14 @@ INCLUDE "home/battle_vars.asm"
FarCopyRadioText::
inc hl
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld [hROMBank], a
ldh [hROMBank], a
ld [MBC3RomBank], a
ld a, e
ld l, a
@@ -137,7 +137,7 @@ FarCopyRadioText::
ld bc, 2 * SCREEN_WIDTH
call CopyBytes
pop af
ld [hROMBank], a
ldh [hROMBank], a
ld [MBC3RomBank], a
ret
@@ -169,7 +169,7 @@ BattleTextBox::
StdBattleTextBox::
; Open a textbox and print battle text at 20:hl.
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, BANK(BattleText)

View File

@@ -23,7 +23,7 @@ GetBattleVarAddr::
; Enemy turn uses the second byte instead.
; This lets battle variable calls be side-neutral.
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .getvar
inc hl

View File

@@ -1,7 +1,7 @@
; Functions to copy data from ROM.
Get2bpp_2::
ld a, [rLCDC]
ldh a, [rLCDC]
bit rLCDC_ENABLE, a
jp z, Copy2bpp
@@ -10,7 +10,7 @@ Get2bpp_2::
ret
Get1bpp_2::
ld a, [rLCDC]
ldh a, [rLCDC]
bit rLCDC_ENABLE, a
jp z, Copy1bpp
@@ -19,10 +19,10 @@ Get1bpp_2::
ret
FarCopyBytesDouble_DoubleBankSwitch::
ld [hBuffer], a
ld a, [hROMBank]
ldh [hBuffer], a
ldh a, [hROMBank]
push af
ld a, [hBuffer]
ldh a, [hBuffer]
rst Bankswitch
call FarCopyBytesDouble
@@ -33,11 +33,11 @@ FarCopyBytesDouble_DoubleBankSwitch::
OldDMATransfer::
dec c
ld a, [hBGMapMode]
ldh a, [hBGMapMode]
push af
xor a
ld [hBGMapMode], a
ld a, [hROMBank]
ldh [hBGMapMode], a
ldh a, [hROMBank]
push af
ld a, b
rst Bankswitch
@@ -45,16 +45,16 @@ OldDMATransfer::
.loop
; load the source and target MSB and LSB
ld a, d
ld [rHDMA1], a ; source MSB
ldh [rHDMA1], a ; source MSB
ld a, e
and $f0
ld [rHDMA2], a ; source LSB
ldh [rHDMA2], a ; source LSB
ld a, h
and $1f
ld [rHDMA3], a ; target MSB
ldh [rHDMA3], a ; target MSB
ld a, l
and $f0
ld [rHDMA4], a ; target LSB
ldh [rHDMA4], a ; target LSB
; stop when c < 8
ld a, c
cp $8
@@ -64,7 +64,7 @@ OldDMATransfer::
ld c, a
; DMA transfer state
ld a, $f
ld [hDMATransfer], a
ldh [hDMATransfer], a
call DelayFrame
; add $100 to hl and de
ld a, l
@@ -84,13 +84,13 @@ OldDMATransfer::
.done
ld a, c
and $7f ; pretty silly, considering at most bits 0-2 would be set
ld [hDMATransfer], a
ldh [hDMATransfer], a
call DelayFrame
pop af
rst Bankswitch
pop af
ld [hBGMapMode], a
ldh [hBGMapMode], a
ret
ReplaceKrisSprite::
@@ -135,10 +135,10 @@ DecompressRequest2bpp::
FarCopyBytes::
; copy bc bytes from a:hl to de
ld [hBuffer], a
ld a, [hROMBank]
ldh [hBuffer], a
ldh a, [hROMBank]
push af
ld a, [hBuffer]
ldh a, [hBuffer]
rst Bankswitch
call CopyBytes
@@ -151,10 +151,10 @@ FarCopyBytesDouble::
; Copy bc bytes from a:hl to bc*2 bytes at de,
; doubling each byte in the process.
ld [hBuffer], a
ld a, [hROMBank]
ldh [hBuffer], a
ldh a, [hROMBank]
push af
ld a, [hBuffer]
ldh a, [hBuffer]
rst Bankswitch
; switcheroo, de <> hl
@@ -186,29 +186,29 @@ FarCopyBytesDouble::
Request2bpp::
; Load 2bpp at b:de to occupy c tiles of hl.
ld a, [hBGMapMode]
ldh a, [hBGMapMode]
push af
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, b
rst Bankswitch
ld a, [hTilesPerCycle]
ldh a, [hTilesPerCycle]
push af
ld a, $8
ld [hTilesPerCycle], a
ldh [hTilesPerCycle], a
ld a, [wLinkMode]
cp LINK_MOBILE
jr nz, .NotMobile
ld a, [hMobile]
ldh a, [hMobile]
and a
jr nz, .NotMobile
ld a, $6
ld [hTilesPerCycle], a
ldh [hTilesPerCycle], a
.NotMobile:
ld a, e
@@ -233,17 +233,17 @@ Request2bpp::
jr nz, .wait
pop af
ld [hTilesPerCycle], a
ldh [hTilesPerCycle], a
pop af
rst Bankswitch
pop af
ld [hBGMapMode], a
ldh [hBGMapMode], a
ret
.iterate
ld a, [hTilesPerCycle]
ldh a, [hTilesPerCycle]
ld [wRequested2bpp], a
.wait2
@@ -260,29 +260,29 @@ Request2bpp::
Request1bpp::
; Load 1bpp at b:de to occupy c tiles of hl.
ld a, [hBGMapMode]
ldh a, [hBGMapMode]
push af
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, b
rst Bankswitch
ld a, [hTilesPerCycle]
ldh a, [hTilesPerCycle]
push af
ld a, $8
ld [hTilesPerCycle], a
ldh [hTilesPerCycle], a
ld a, [wLinkMode]
cp LINK_MOBILE
jr nz, .NotMobile
ld a, [hMobile]
ldh a, [hMobile]
and a
jr nz, .NotMobile
ld a, $6
ld [hTilesPerCycle], a
ldh [hTilesPerCycle], a
.NotMobile:
ld a, e
@@ -307,17 +307,17 @@ Request1bpp::
jr nz, .wait
pop af
ld [hTilesPerCycle], a
ldh [hTilesPerCycle], a
pop af
rst Bankswitch
pop af
ld [hBGMapMode], a
ldh [hBGMapMode], a
ret
.iterate
ld a, [hTilesPerCycle]
ldh a, [hTilesPerCycle]
ld [wRequested1bpp], a
.wait2
@@ -333,7 +333,7 @@ Request1bpp::
jr .loop
Get2bpp::
ld a, [rLCDC]
ldh a, [rLCDC]
bit rLCDC_ENABLE, a
jp nz, Request2bpp
@@ -362,7 +362,7 @@ Copy2bpp::
jp FarCopyBytes
Get1bpp::
ld a, [rLCDC]
ldh a, [rLCDC]
bit rLCDC_ENABLE, a
jp nz, Request1bpp

View File

@@ -54,31 +54,31 @@ ByteFill::
GetFarByte::
; retrieve a single byte from a:hl, and return it in a.
; bankswitch to new bank
ld [hBuffer], a
ld a, [hROMBank]
ldh [hBuffer], a
ldh a, [hROMBank]
push af
ld a, [hBuffer]
ldh a, [hBuffer]
rst Bankswitch
; get byte from new bank
ld a, [hl]
ld [hBuffer], a
ldh [hBuffer], a
; bankswitch to previous bank
pop af
rst Bankswitch
; return retrieved value in a
ld a, [hBuffer]
ldh a, [hBuffer]
ret
GetFarHalfword::
; retrieve a halfword from a:hl, and return it in hl.
; bankswitch to new bank
ld [hBuffer], a
ld a, [hROMBank]
ldh [hBuffer], a
ldh a, [hROMBank]
push af
ld a, [hBuffer]
ldh a, [hBuffer]
rst Bankswitch
; get halfword from new bank, put it in hl
@@ -92,40 +92,40 @@ GetFarHalfword::
ret
FarCopyWRAM::
ld [hBuffer], a
ld a, [rSVBK]
ldh [hBuffer], a
ldh a, [rSVBK]
push af
ld a, [hBuffer]
ld [rSVBK], a
ldh a, [hBuffer]
ldh [rSVBK], a
call CopyBytes
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
GetFarWRAMByte::
ld [hBuffer], a
ld a, [rSVBK]
ldh [hBuffer], a
ldh a, [rSVBK]
push af
ld a, [hBuffer]
ld [rSVBK], a
ldh a, [hBuffer]
ldh [rSVBK], a
ld a, [hl]
ld [hBuffer], a
ldh [hBuffer], a
pop af
ld [rSVBK], a
ld a, [hBuffer]
ldh [rSVBK], a
ldh a, [hBuffer]
ret
GetFarWRAMWord::
ld [hBuffer], a
ld a, [rSVBK]
ldh [hBuffer], a
ldh a, [rSVBK]
push af
ld a, [hBuffer]
ld [rSVBK], a
ldh a, [hBuffer]
ldh [rSVBK], a
ld a, [hli]
ld h, [hl]
ld l, a
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret

View File

@@ -1,35 +1,35 @@
LoadTileMapToTempTileMap::
; Load wTileMap into wTempTileMap
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wTempTileMap)
ld [rSVBK], a
ldh [rSVBK], a
hlcoord 0, 0
decoord 0, 0, wTempTileMap
ld bc, wTileMapEnd - wTileMap
call CopyBytes
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
Call_LoadTempTileMapToTileMap::
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call LoadTempTileMapToTileMap
ld a, 1
ld [hBGMapMode], a
ldh [hBGMapMode], a
ret
LoadTempTileMapToTileMap::
; Load wTempTileMap into wTileMap
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wTempTileMap)
ld [rSVBK], a
ldh [rSVBK], a
hlcoord 0, 0, wTempTileMap
decoord 0, 0
ld bc, wTileMapEnd - wTileMap
call CopyBytes
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret

View File

@@ -55,7 +55,7 @@ LoadCry::
call GetCryIndex
ret c
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, BANK(PokemonCries)
rst Bankswitch

View File

@@ -2,7 +2,7 @@ FarDecompress::
; Decompress graphics data from a:hl to de.
ld [wLZBank], a
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, [wLZBank]
rst Bankswitch

View File

@@ -19,9 +19,9 @@ NormalSpeed::
SwitchSpeed::
set 0, [hl]
xor a
ld [rIF], a
ld [rIE], a
ldh [rIF], a
ldh [rIE], a
ld a, $30
ld [rJOYP], a
ldh [rJOYP], a
stop ; rgbasm adds a nop after this instruction by default
ret

View File

@@ -13,15 +13,15 @@ Unreferenced_Function48c::
.okay
ld a, [hli]
ld [rBGP], a
ldh [rBGP], a
ld a, [hli]
ld [rOBP0], a
ldh [rOBP0], a
ld a, [hli]
ld [rOBP1], a
ldh [rOBP1], a
ret
RotateFourPalettesRight::
ld a, [hCGB]
ldh a, [hCGB]
and a
jr z, .dmg
ld hl, IncGradGBPalTable_00
@@ -34,7 +34,7 @@ RotateFourPalettesRight::
jr RotatePalettesRight
RotateThreePalettesRight::
ld a, [hCGB]
ldh a, [hCGB]
and a
jr z, .dmg
ld hl, IncGradGBPalTable_05
@@ -63,7 +63,7 @@ RotatePalettesRight::
ret
RotateFourPalettesLeft::
ld a, [hCGB]
ldh a, [hCGB]
and a
jr z, .dmg
ld hl, IncGradGBPalTable_04 - 1
@@ -76,7 +76,7 @@ RotateFourPalettesLeft::
jr RotatePalettesLeft
RotateThreePalettesLeft::
ld a, [hCGB]
ldh a, [hCGB]
and a
jr z, .dmg
ld hl, IncGradGBPalTable_07 - 1

View File

@@ -2,10 +2,10 @@ FarCall_de::
; Call a:de.
; Preserves other registers.
ld [hBuffer], a
ld a, [hROMBank]
ldh [hBuffer], a
ldh a, [hROMBank]
push af
ld a, [hBuffer]
ldh a, [hBuffer]
rst Bankswitch
call .de
jr ReturnFarCall
@@ -18,10 +18,10 @@ FarCall_hl::
; Call a:hl.
; Preserves other registers.
ld [hBuffer], a
ld a, [hROMBank]
ldh [hBuffer], a
ldh a, [hROMBank]
push af
ld a, [hBuffer]
ldh a, [hBuffer]
rst Bankswitch
call FarJump_hl

View File

@@ -11,15 +11,15 @@ ResetGameTime::
GameTimer::
nop
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wGameTime)
ld [rSVBK], a
ldh [rSVBK], a
call UpdateGameTimer
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
UpdateGameTimer::

View File

@@ -29,14 +29,14 @@ AskSerial::
; handshake
ld a, $88
ld [rSB], a
ldh [rSB], a
; switch to internal clock
ld a, %00000001
ld [rSC], a
ldh [rSC], a
; start transfer
ld a, %10000001
ld [rSC], a
ldh [rSC], a
ret

View File

@@ -2,12 +2,12 @@ Reset::
di
call MapSetup_Sound_Off
xor a
ld [hMapAnims], a
ldh [hMapAnims], a
call ClearPalettes
xor a
ld [rIF], a
ldh [rIF], a
ld a, 1 ; VBlank int
ld [rIE], a
ldh [rIE], a
ei
ld hl, wcfbe
@@ -28,40 +28,40 @@ _Start::
ld a, $1
.load
ld [hCGB], a
ldh [hCGB], a
ld a, $1
ld [hSystemBooted], a
ldh [hSystemBooted], a
Init::
di
xor a
ld [rIF], a
ld [rIE], a
ld [rRP], a
ld [rSCX], a
ld [rSCY], a
ld [rSB], a
ld [rSC], a
ld [rWX], a
ld [rWY], a
ld [rBGP], a
ld [rOBP0], a
ld [rOBP1], a
ld [rTMA], a
ld [rTAC], a
ldh [rIF], a
ldh [rIE], a
ldh [rRP], a
ldh [rSCX], a
ldh [rSCY], a
ldh [rSB], a
ldh [rSC], a
ldh [rWX], a
ldh [rWY], a
ldh [rBGP], a
ldh [rOBP0], a
ldh [rOBP1], a
ldh [rTMA], a
ldh [rTAC], a
ld [WRAM1_Begin], a
ld a, %100 ; Start timer at 4096Hz
ld [rTAC], a
ldh [rTAC], a
.wait
ld a, [rLY]
ldh a, [rLY]
cp LY_VBLANK + 1
jr nz, .wait
xor a
ld [rLCDC], a
ldh [rLCDC], a
; Clear WRAM bank 0
ld hl, WRAM0_Begin
@@ -77,22 +77,22 @@ Init::
ld sp, wStack
; Clear HRAM
ld a, [hCGB]
ldh a, [hCGB]
push af
ld a, [hSystemBooted]
ldh a, [hSystemBooted]
push af
xor a
ld hl, HRAM_Begin
ld bc, HRAM_End - HRAM_Begin
call ByteFill
pop af
ld [hSystemBooted], a
ldh [hSystemBooted], a
pop af
ld [hCGB], a
ldh [hCGB], a
call ClearWRAM
ld a, 1
ld [rSVBK], a
ldh [rSVBK], a
call ClearVRAM
call ClearSprites
call ClearsScratch
@@ -103,21 +103,21 @@ Init::
call WriteOAMDMACodeToHRAM
xor a
ld [hMapAnims], a
ld [hSCX], a
ld [hSCY], a
ld [rJOYP], a
ldh [hMapAnims], a
ldh [hSCX], a
ldh [hSCY], a
ldh [rJOYP], a
ld a, $8 ; HBlank int enable
ld [rSTAT], a
ldh [rSTAT], a
ld a, $90
ld [hWY], a
ld [rWY], a
ldh [hWY], a
ldh [rWY], a
ld a, 7
ld [hWX], a
ld [rWX], a
ldh [hWX], a
ldh [rWX], a
ld a, LCDC_DEFAULT ; %11100011
; LCD on
@@ -128,17 +128,17 @@ Init::
; OBJ 8x8
; OBJ on
; BG on
ld [rLCDC], a
ldh [rLCDC], a
ld a, CONNECTION_NOT_ESTABLISHED
ld [hSerialConnectionStatus], a
ldh [hSerialConnectionStatus], a
farcall InitCGBPals
ld a, HIGH(vBGMap1)
ld [hBGMapAddress + 1], a
ldh [hBGMapAddress + 1], a
xor a ; LOW(vBGMap1)
ld [hBGMapAddress], a
ldh [hBGMapAddress], a
farcall StartClock
@@ -146,16 +146,16 @@ Init::
ld [MBC3LatchClock], a
ld [MBC3SRamEnable], a
ld a, [hCGB]
ldh a, [hCGB]
and a
jr z, .no_double_speed
call NormalSpeed
.no_double_speed
xor a
ld [rIF], a
ldh [rIF], a
ld a, %1111 ; VBlank, LCDStat, Timer, Serial interrupts
ld [rIE], a
ldh [rIE], a
ei
call DelayFrame
@@ -171,11 +171,11 @@ ClearVRAM::
; Wipe VRAM banks 0 and 1
ld a, 1
ld [rVBK], a
ldh [rVBK], a
call .clear
xor a ; 0
ld [rVBK], a
ldh [rVBK], a
.clear
ld hl, VRAM_Begin
ld bc, VRAM_End - VRAM_Begin
@@ -190,7 +190,7 @@ ClearWRAM::
ld a, 1
.bank_loop
push af
ld [rSVBK], a
ldh [rSVBK], a
xor a
ld hl, WRAM1_Begin
ld bc, WRAM1_End - WRAM1_Begin

View File

@@ -16,7 +16,7 @@ TossItem::
push hl
push de
push bc
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, BANK(_TossItem)
rst Bankswitch
@@ -33,7 +33,7 @@ TossItem::
ReceiveItem::
push bc
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, BANK(_ReceiveItem)
rst Bankswitch
@@ -54,7 +54,7 @@ CheckItem::
push hl
push de
push bc
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, BANK(_CheckItem)
rst Bankswitch

View File

@@ -8,9 +8,9 @@ JoypadInt::
ClearJoypad::
xor a
; Pressed this frame (delta)
ld [hJoyPressed], a
ldh [hJoyPressed], a
; Currently pressed
ld [hJoyDown], a
ldh [hJoyDown], a
ret
Joypad::
@@ -38,10 +38,10 @@ Joypad::
; We can only get four inputs at a time.
; We take d-pad first for no particular reason.
ld a, R_DPAD
ld [rJOYP], a
ldh [rJOYP], a
; Read twice to give the request time to take.
ld a, [rJOYP]
ld a, [rJOYP]
ldh a, [rJOYP]
ldh a, [rJOYP]
; The Joypad register output is in the lo nybble (inversed).
; We make the hi nybble of our new container d-pad input.
@@ -55,10 +55,10 @@ Joypad::
; Buttons make 8 total inputs (A, B, Select, Start).
; We can fit this into one byte.
ld a, R_BUTTONS
ld [rJOYP], a
ldh [rJOYP], a
; Wait for input to stabilize.
rept 6
ld a, [rJOYP]
ldh a, [rJOYP]
endr
; Buttons take the lo nybble.
cpl
@@ -68,30 +68,30 @@ endr
; Reset the joypad register since we're done with it.
ld a, $30
ld [rJOYP], a
ldh [rJOYP], a
; To get the delta we xor the last frame's input with the new one.
ld a, [hJoypadDown] ; last frame
ldh a, [hJoypadDown] ; last frame
ld e, a
xor b
ld d, a
; Released this frame:
and e
ld [hJoypadReleased], a
ldh [hJoypadReleased], a
; Pressed this frame:
ld a, d
and b
ld [hJoypadPressed], a
ldh [hJoypadPressed], a
; Add any new presses to the list of collective presses:
ld c, a
ld a, [hJoypadSum]
ldh a, [hJoypadSum]
or c
ld [hJoypadSum], a
ldh [hJoypadSum], a
; Currently pressed:
ld a, b
ld [hJoypadDown], a
ldh [hJoypadDown], a
; Now that we have the input, we can do stuff with it.
@@ -130,28 +130,28 @@ GetJoypad::
jr z, .auto
; To get deltas, take this and last frame's input.
ld a, [hJoypadDown] ; real input
ldh a, [hJoypadDown] ; real input
ld b, a
ld a, [hJoyDown] ; last frame mirror
ldh a, [hJoyDown] ; last frame mirror
ld e, a
; Released this frame:
xor b
ld d, a
and e
ld [hJoyReleased], a
ldh [hJoyReleased], a
; Pressed this frame:
ld a, d
and b
ld [hJoyPressed], a
ldh [hJoyPressed], a
; It looks like the collective presses got commented out here.
ld c, a
; Currently pressed:
ld a, b
ld [hJoyDown], a ; frame input
ldh [hJoyDown], a ; frame input
.quit
pop bc
@@ -167,7 +167,7 @@ GetJoypad::
; A value of $ff will immediately end the stream.
; Read from the input stream.
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, [wAutoInputBank]
rst Bankswitch
@@ -224,8 +224,8 @@ GetJoypad::
pop af
rst Bankswitch
ld a, b
ld [hJoyPressed], a ; pressed
ld [hJoyDown], a ; input
ldh [hJoyPressed], a ; pressed
ldh [hJoyDown], a ; input
jr .quit
StartAutoInput::
@@ -241,9 +241,9 @@ StartAutoInput::
ld [wAutoInputLength], a
; Reset input mirrors.
xor a
ld [hJoyPressed], a ; pressed this frame
ld [hJoyReleased], a ; released this frame
ld [hJoyDown], a ; currently pressed
ldh [hJoyPressed], a ; pressed this frame
ldh [hJoyReleased], a ; released this frame
ldh [hJoyDown], a ; currently pressed
ld a, AUTO_INPUT
ld [wInputType], a
@@ -269,11 +269,11 @@ JoyTitleScreenInput::
call JoyTextDelay
pop bc
ld a, [hJoyDown]
ldh a, [hJoyDown]
cp D_UP | SELECT | B_BUTTON
jr z, .keycombo
ld a, [hJoyLast]
ldh a, [hJoyLast]
and START | A_BUTTON
jr nz, .keycombo
@@ -291,33 +291,33 @@ JoyWaitAorB::
.loop
call DelayFrame
call GetJoypad
ld a, [hJoyPressed]
ldh a, [hJoyPressed]
and A_BUTTON | B_BUTTON
ret nz
call RTC
jr .loop
WaitButton::
ld a, [hOAMUpdate]
ldh a, [hOAMUpdate]
push af
ld a, 1
ld [hOAMUpdate], a
ldh [hOAMUpdate], a
call WaitBGMap
call JoyWaitAorB
pop af
ld [hOAMUpdate], a
ldh [hOAMUpdate], a
ret
JoyTextDelay::
call GetJoypad
ld a, [hInMenu]
ldh a, [hInMenu]
and a
ld a, [hJoyPressed]
ldh a, [hJoyPressed]
jr z, .ok
ld a, [hJoyDown]
ldh a, [hJoyDown]
.ok
ld [hJoyLast], a
ld a, [hJoyPressed]
ldh [hJoyLast], a
ldh a, [hJoyPressed]
and a
jr z, .checkframedelay
ld a, 15
@@ -329,7 +329,7 @@ JoyTextDelay::
and a
jr z, .restartframedelay
xor a
ld [hJoyLast], a
ldh [hJoyLast], a
ret
.restartframedelay
@@ -338,14 +338,14 @@ JoyTextDelay::
ret
WaitPressAorB_BlinkCursor::
ld a, [hMapObjectIndexBuffer]
ldh a, [hMapObjectIndexBuffer]
push af
ld a, [hObjectStructIndexBuffer]
ldh a, [hObjectStructIndexBuffer]
push af
xor a
ld [hMapObjectIndexBuffer], a
ldh [hMapObjectIndexBuffer], a
ld a, 6
ld [hObjectStructIndexBuffer], a
ldh [hObjectStructIndexBuffer], a
.loop
push hl
@@ -354,20 +354,20 @@ WaitPressAorB_BlinkCursor::
pop hl
call JoyTextDelay
ld a, [hJoyLast]
ldh a, [hJoyLast]
and A_BUTTON | B_BUTTON
jr z, .loop
pop af
ld [hObjectStructIndexBuffer], a
ldh [hObjectStructIndexBuffer], a
pop af
ld [hMapObjectIndexBuffer], a
ldh [hMapObjectIndexBuffer], a
ret
SimpleWaitPressAorB::
.loop
call JoyTextDelay
ld a, [hJoyLast]
ldh a, [hJoyLast]
and A_BUTTON | B_BUTTON
jr z, .loop
ret
@@ -388,10 +388,10 @@ ButtonSound::
jp DelayFrames
.wait_input
ld a, [hOAMUpdate]
ldh a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
ldh [hOAMUpdate], a
ld a, [wInputType]
or a
jr z, .input_wait_loop
@@ -400,22 +400,22 @@ ButtonSound::
.input_wait_loop
call .blink_cursor
call JoyTextDelay
ld a, [hJoyPressed]
ldh a, [hJoyPressed]
and A_BUTTON | B_BUTTON
jr nz, .received_input
call RTC
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
call DelayFrame
jr .input_wait_loop
.received_input
pop af
ld [hOAMUpdate], a
ldh [hOAMUpdate], a
ret
.blink_cursor
ld a, [hVBlankCounter]
ldh a, [hVBlankCounter]
and %00010000 ; bit 4, a
jr z, .cursor_off
ld a, "â–Ľ"
@@ -436,37 +436,37 @@ BlinkCursor::
cp b
pop bc
jr nz, .place_arrow
ld a, [hMapObjectIndexBuffer]
ldh a, [hMapObjectIndexBuffer]
dec a
ld [hMapObjectIndexBuffer], a
ldh [hMapObjectIndexBuffer], a
ret nz
ld a, [hObjectStructIndexBuffer]
ldh a, [hObjectStructIndexBuffer]
dec a
ld [hObjectStructIndexBuffer], a
ldh [hObjectStructIndexBuffer], a
ret nz
ld a, "─"
ld [hl], a
ld a, -1
ld [hMapObjectIndexBuffer], a
ldh [hMapObjectIndexBuffer], a
ld a, 6
ld [hObjectStructIndexBuffer], a
ldh [hObjectStructIndexBuffer], a
ret
.place_arrow
ld a, [hMapObjectIndexBuffer]
ldh a, [hMapObjectIndexBuffer]
and a
ret z
dec a
ld [hMapObjectIndexBuffer], a
ldh [hMapObjectIndexBuffer], a
ret nz
dec a
ld [hMapObjectIndexBuffer], a
ld a, [hObjectStructIndexBuffer]
ldh [hMapObjectIndexBuffer], a
ldh a, [hObjectStructIndexBuffer]
dec a
ld [hObjectStructIndexBuffer], a
ldh [hObjectStructIndexBuffer], a
ret nz
ld a, 6
ld [hObjectStructIndexBuffer], a
ldh [hObjectStructIndexBuffer], a
ld a, "â–Ľ"
ld [hl], a
ret

View File

@@ -1,7 +1,7 @@
; LCD handling
Unreferenced_Function547::
ld a, [hLCDCPointer]
ldh a, [hLCDCPointer]
cp rSCX - $ff00
ret nz
ld c, a
@@ -11,18 +11,18 @@ Unreferenced_Function547::
LCD::
push af
ld a, [hLCDCPointer]
ldh a, [hLCDCPointer]
and a
jr z, .done
; At this point it's assumed we're in WRAM bank 5!
push bc
ld a, [rLY]
ldh a, [rLY]
ld c, a
ld b, HIGH(wLYOverrides)
ld a, [bc]
ld b, a
ld a, [hLCDCPointer]
ldh a, [hLCDCPointer]
ld c, a
ld a, b
ld [$ff00+c], a
@@ -36,37 +36,37 @@ DisableLCD::
; Turn the LCD off
; Don't need to do anything if the LCD is already off
ld a, [rLCDC]
ldh a, [rLCDC]
bit rLCDC_ENABLE, a
ret z
xor a
ld [rIF], a
ld a, [rIE]
ldh [rIF], a
ldh a, [rIE]
ld b, a
; Disable VBlank
res 0, a ; vblank
ld [rIE], a
ldh [rIE], a
.wait
; Wait until VBlank would normally happen
ld a, [rLY]
ldh a, [rLY]
cp LY_VBLANK + 1
jr nz, .wait
ld a, [rLCDC]
ldh a, [rLCDC]
and $ff ^ (1 << rLCDC_ENABLE)
ld [rLCDC], a
ldh [rLCDC], a
xor a
ld [rIF], a
ldh [rIF], a
ld a, b
ld [rIE], a
ldh [rIE], a
ret
EnableLCD::
ld a, [rLCDC]
ldh a, [rLCDC]
set rLCDC_ENABLE, a
ld [rLCDC], a
ldh [rLCDC], a
ret

View File

@@ -49,7 +49,7 @@ GetMapSceneID::
; Searches the scene script table for the map group and number loaded in bc, and returns the wram pointer in de.
; If the map is not in the scene script table, returns carry.
push bc
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, BANK(MapScenes)
rst Bankswitch
@@ -97,7 +97,7 @@ OverworldTextModeSwitch::
ret
LoadMapPart::
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, [wTilesetBlocksBank]
@@ -207,10 +207,10 @@ endr
ReturnToMapFromSubmenu::
ld a, MAPSETUP_SUBMENU
ld [hMapEntryMethod], a
ldh [hMapEntryMethod], a
farcall RunMapSetupScript
xor a
ld [hMapEntryMethod], a
ldh [hMapEntryMethod], a
ret
CheckWarpTile::
@@ -236,7 +236,7 @@ GetDestinationWarpNumber::
farcall CheckWarpCollision
ret nc
ld a, [hROMBank]
ldh a, [hROMBank]
push af
call SwitchToMapScriptsBank
@@ -306,7 +306,7 @@ GetDestinationWarpNumber::
ret
CopyWarpData::
ld a, [hROMBank]
ldh a, [hROMBank]
push af
call SwitchToMapScriptsBank
@@ -708,14 +708,14 @@ LoadBlockData::
ret
ChangeMap::
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld hl, wOverworldMapBlocks
ld a, [wMapWidth]
ld [hConnectedMapWidth], a
ldh [hConnectedMapWidth], a
add $6
ld [hConnectionStripLength], a
ldh [hConnectionStripLength], a
ld c, a
ld b, 0
add hl, bc
@@ -734,7 +734,7 @@ ChangeMap::
ld b, a
.row
push hl
ld a, [hConnectedMapWidth]
ldh a, [hConnectedMapWidth]
ld c, a
.col
ld a, [de]
@@ -743,7 +743,7 @@ ChangeMap::
dec c
jr nz, .col
pop hl
ld a, [hConnectionStripLength]
ldh a, [hConnectionStripLength]
add l
ld l, a
jr nc, .okay
@@ -775,9 +775,9 @@ FillMapConnections::
ld a, [wNorthConnectionStripLocation + 1]
ld d, a
ld a, [wNorthConnectionStripLength]
ld [hConnectionStripLength], a
ldh [hConnectionStripLength], a
ld a, [wNorthConnectedMapWidth]
ld [hConnectedMapWidth], a
ldh [hConnectedMapWidth], a
call FillNorthConnectionStrip
.South:
@@ -798,9 +798,9 @@ FillMapConnections::
ld a, [wSouthConnectionStripLocation + 1]
ld d, a
ld a, [wSouthConnectionStripLength]
ld [hConnectionStripLength], a
ldh [hConnectionStripLength], a
ld a, [wSouthConnectedMapWidth]
ld [hConnectedMapWidth], a
ldh [hConnectedMapWidth], a
call FillSouthConnectionStrip
.West:
@@ -823,7 +823,7 @@ FillMapConnections::
ld a, [wWestConnectionStripLength]
ld b, a
ld a, [wWestConnectedMapWidth]
ld [hConnectionStripLength], a
ldh [hConnectionStripLength], a
call FillWestConnectionStrip
.East:
@@ -846,7 +846,7 @@ FillMapConnections::
ld a, [wEastConnectionStripLength]
ld b, a
ld a, [wEastConnectedMapWidth]
ld [hConnectionStripLength], a
ldh [hConnectionStripLength], a
call FillEastConnectionStrip
.Done:
@@ -859,7 +859,7 @@ FillSouthConnectionStrip::
push de
push hl
ld a, [hConnectionStripLength]
ldh a, [hConnectionStripLength]
ld b, a
.x
ld a, [hli]
@@ -869,7 +869,7 @@ FillSouthConnectionStrip::
jr nz, .x
pop hl
ld a, [hConnectedMapWidth]
ldh a, [hConnectedMapWidth]
ld e, a
ld d, 0
add hl, de
@@ -891,7 +891,7 @@ FillEastConnectionStrip::
.loop
ld a, [wMapWidth]
add 6
ld [hConnectedMapWidth], a
ldh [hConnectedMapWidth], a
push de
@@ -907,13 +907,13 @@ FillEastConnectionStrip::
inc de
pop hl
ld a, [hConnectionStripLength]
ldh a, [hConnectionStripLength]
ld e, a
ld d, 0
add hl, de
pop de
ld a, [hConnectedMapWidth]
ldh a, [hConnectedMapWidth]
add e
ld e, a
jr nc, .okay
@@ -953,7 +953,7 @@ CallMapScript::
RunMapCallback::
; Will run the first callback found with execution index equal to a.
ld b, a
ld a, [hROMBank]
ldh a, [hROMBank]
push af
call SwitchToMapScriptsBank
call .FindCallback
@@ -1018,7 +1018,7 @@ ExecuteCallbackScript::
ret
MapTextbox::
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, b
@@ -1028,12 +1028,12 @@ MapTextbox::
call SpeechTextBox
call SafeUpdateSprites
ld a, 1
ld [hOAMUpdate], a
ldh [hOAMUpdate], a
call ApplyTilemap
pop hl
call PrintTextBoxText
xor a
ld [hOAMUpdate], a
ldh [hOAMUpdate], a
pop af
rst Bankswitch
@@ -1042,10 +1042,10 @@ MapTextbox::
Call_a_de::
; Call a:de.
ld [hBuffer], a
ld a, [hROMBank]
ldh [hBuffer], a
ldh a, [hROMBank]
push af
ld a, [hBuffer]
ldh a, [hBuffer]
rst Bankswitch
call .de
@@ -1060,7 +1060,7 @@ Call_a_de::
GetMovementData::
; Initialize the movement data for object c at b:hl
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, b
rst Bankswitch
@@ -1078,7 +1078,7 @@ GetScriptByte::
push hl
push bc
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, [wScriptBank]
rst Bankswitch
@@ -1125,7 +1125,7 @@ CoordinatesEventText::
db "@"
CheckObjectMask::
ld a, [hMapObjectIndexBuffer]
ldh a, [hMapObjectIndexBuffer]
ld e, a
ld d, $0
ld hl, wObjectMasks
@@ -1134,7 +1134,7 @@ CheckObjectMask::
ret
MaskObject::
ld a, [hMapObjectIndexBuffer]
ldh a, [hMapObjectIndexBuffer]
ld e, a
ld d, $0
ld hl, wObjectMasks
@@ -1143,7 +1143,7 @@ MaskObject::
ret
UnmaskObject::
ld a, [hMapObjectIndexBuffer]
ldh a, [hMapObjectIndexBuffer]
ld e, a
ld d, $0
ld hl, wObjectMasks
@@ -1163,7 +1163,7 @@ ScrollMapDown::
ld d, a
call UpdateBGMapRow
ld a, $1
ld [hBGMapUpdate], a
ldh [hBGMapUpdate], a
ret
ScrollMapUp::
@@ -1186,7 +1186,7 @@ ScrollMapUp::
ld d, a
call UpdateBGMapRow
ld a, $1
ld [hBGMapUpdate], a
ldh [hBGMapUpdate], a
ret
ScrollMapRight::
@@ -1201,7 +1201,7 @@ ScrollMapRight::
ld d, a
call UpdateBGMapColumn
ld a, $1
ld [hBGMapUpdate], a
ldh [hBGMapUpdate], a
ret
ScrollMapLeft::
@@ -1223,7 +1223,7 @@ ScrollMapLeft::
ld d, a
call UpdateBGMapColumn
ld a, $1
ld [hBGMapUpdate], a
ldh [hBGMapUpdate], a
ret
BackupBGMapRow::
@@ -1284,7 +1284,7 @@ UpdateBGMapRow::
dec c
jr nz, .loop
ld a, SCREEN_WIDTH
ld [hBGMapTileCount], a
ldh [hBGMapTileCount], a
ret
UpdateBGMapColumn::
@@ -1310,7 +1310,7 @@ UpdateBGMapColumn::
dec c
jr nz, .loop
ld a, SCREEN_HEIGHT
ld [hBGMapTileCount], a
ldh [hBGMapTileCount], a
ret
Unreferenced_Function2816::
@@ -1328,10 +1328,10 @@ LoadTilesetGFX::
ld a, [wTilesetBank]
ld e, a
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wDecompressScratch)
ld [rSVBK], a
ldh [rSVBK], a
ld a, e
ld de, wDecompressScratch
@@ -1342,10 +1342,10 @@ LoadTilesetGFX::
ld bc, $60 tiles
call CopyBytes
ld a, [rVBK]
ldh a, [rVBK]
push af
ld a, $1
ld [rVBK], a
ldh [rVBK], a
ld hl, wDecompressScratch + $60 tiles
ld de, vTiles2
@@ -1353,10 +1353,10 @@ LoadTilesetGFX::
call CopyBytes
pop af
ld [rVBK], a
ldh [rVBK], a
pop af
ld [rSVBK], a
ldh [rSVBK], a
; These tilesets support dynamic per-mapgroup roof tiles.
ld a, [wMapTileset]
@@ -1373,7 +1373,7 @@ LoadTilesetGFX::
.skip_roof
xor a
ld [hTileAnimFrame], a
ldh [hTileAnimFrame], a
ret
BufferScreen::
@@ -1412,7 +1412,7 @@ SaveScreen::
ld de, wScreenSave
ld a, [wMapWidth]
add 6
ld [hMapObjectIndexBuffer], a
ldh [hMapObjectIndexBuffer], a
ld a, [wPlayerStepDirection]
and a
jr z, .down
@@ -1426,7 +1426,7 @@ SaveScreen::
.up
ld de, wScreenSave + SCREEN_META_WIDTH
ld a, [hMapObjectIndexBuffer]
ldh a, [hMapObjectIndexBuffer]
ld c, a
ld b, 0
add hl, bc
@@ -1458,7 +1458,7 @@ LoadNeighboringBlockData::
ld l, a
ld a, [wMapWidth]
add 6
ld [hConnectionStripLength], a
ldh [hConnectionStripLength], a
ld de, wScreenSave
ld b, SCREEN_META_WIDTH
ld c, SCREEN_META_HEIGHT
@@ -1483,7 +1483,7 @@ SaveScreen_LoadNeighbor::
.okay
pop hl
ld a, [hConnectionStripLength]
ldh a, [hConnectionStripLength]
ld c, a
ld b, 0
add hl, bc
@@ -1772,7 +1772,7 @@ CheckFacingBGEvent::
ret z
ld c, a
ld a, [hROMBank]
ldh a, [hROMBank]
push af
call SwitchToMapScriptsBank
call CheckIfFacingTileCoordIsBGEvent
@@ -1826,7 +1826,7 @@ CheckCurrentMapCoordEvents::
ret z
; Copy the coord event count into c.
ld c, a
ld a, [hROMBank]
ldh a, [hROMBank]
push af
call SwitchToMapScriptsBank
call .CoordEventCheck
@@ -1893,7 +1893,7 @@ CheckCurrentMapCoordEvents::
FadeToMenu::
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call LoadStandardMenuHeader
farcall FadeOutPalettes
call ClearSprites
@@ -1943,7 +1943,7 @@ ReturnToMapWithSpeechTextbox::
call UpdateTimePals
call DelayFrame
ld a, $1
ld [hMapAnims], a
ldh [hMapAnims], a
pop af
ret
@@ -1953,7 +1953,7 @@ ReloadTilesetAndPalettes::
farcall RefreshSprites
call LoadStandardFont
call LoadFontsExtra
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, [wMapGroup]
ld b, a
@@ -2023,7 +2023,7 @@ GetMapField::
ld c, a
GetAnyMapField::
; bankswitch
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, BANK(MapGroupPointers)
rst Bankswitch
@@ -2067,7 +2067,7 @@ GetAnyMapAttributesBank::
CopyMapPartial::
; Copy map data bank, tileset, environment, and map data address
; from the current map's entry within its group.
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, BANK(MapGroupPointers)
rst Bankswitch

View File

@@ -20,7 +20,7 @@ GetSpriteVTile::
ld hl, wUsedSprites + 2
ld c, SPRITE_GFX_LIST_CAPACITY - 1
ld b, a
ld a, [hMapObjectIndexBuffer]
ldh a, [hMapObjectIndexBuffer]
cp 0
jr z, .nope
ld a, b
@@ -54,7 +54,7 @@ DoesSpriteHaveFacings::
push hl
ld b, a
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, BANK(_DoesSpriteHaveFacings)
rst Bankswitch
@@ -96,7 +96,7 @@ GetTileCollision::
ld d, 0
add hl, de
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, BANK(TileCollisionTable)
rst Bankswitch
@@ -210,14 +210,14 @@ GetMapObject::
CheckObjectVisibility::
; Sets carry if the object is not visible on the screen.
ld [hMapObjectIndexBuffer], a
ldh [hMapObjectIndexBuffer], a
call GetMapObject
ld hl, MAPOBJECT_OBJECT_STRUCT_ID
add hl, bc
ld a, [hl]
cp -1
jr z, .not_visible
ld [hObjectStructIndexBuffer], a
ldh [hObjectStructIndexBuffer], a
call GetObjectStruct
and a
ret
@@ -301,21 +301,21 @@ CheckObjectTime::
ret
; unused
ld [hMapObjectIndexBuffer], a
ldh [hMapObjectIndexBuffer], a
call GetMapObject
call CopyObjectStruct
ret
_CopyObjectStruct::
ld [hMapObjectIndexBuffer], a
ldh [hMapObjectIndexBuffer], a
call UnmaskObject
ld a, [hMapObjectIndexBuffer]
ldh a, [hMapObjectIndexBuffer]
call GetMapObject
farcall CopyObjectStruct
ret
ApplyDeletionToMapObject::
ld [hMapObjectIndexBuffer], a
ldh [hMapObjectIndexBuffer], a
call GetMapObject
ld hl, MAPOBJECT_OBJECT_STRUCT_ID
add hl, bc
@@ -394,7 +394,7 @@ Unreferenced_Function19b8:
LoadMovementDataPointer::
; Load the movement data pointer for object a.
ld [wMovementObject], a
ld a, [hROMBank]
ldh a, [hROMBank]
ld [wMovementDataPointer], a
ld a, l
ld [wMovementDataPointer + 1], a
@@ -484,7 +484,7 @@ endr
CopySpriteMovementData::
ld l, a
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, BANK(SpriteMovementData)
rst Bankswitch
@@ -551,7 +551,7 @@ endr
_GetMovementByte::
; Switch to the movement data bank
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, [hli]
rst Bankswitch

View File

@@ -9,7 +9,7 @@ CopyMenuHeader::
ld de, wMenuHeader
ld bc, wMenuHeaderEnd - wMenuHeader
call CopyBytes
ld a, [hROMBank]
ldh a, [hROMBank]
ld [wMenuDataBank], a
ret
@@ -59,7 +59,7 @@ Call_ExitMenu::
VerticalMenu::
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call MenuBox
call UpdateSprites
call PlaceVerticalMenuItems
@@ -229,17 +229,17 @@ DrawVariableLengthMenuBox::
MenuWriteText::
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call GetMenuIndexSet ; sort out the text
call RunMenuItemPrintingFunction ; actually write it
call SafeUpdateSprites
ld a, [hOAMUpdate]
ldh a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
ldh [hOAMUpdate], a
call ApplyTilemap
pop af
ld [hOAMUpdate], a
ldh [hOAMUpdate], a
ret
AutomaticGetMenuBottomCoord::
@@ -455,10 +455,10 @@ ClearWindowData::
ld hl, w2DMenuCursorInitY
call .bytefill
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wWindowStack)
ld [rSVBK], a
ldh [rSVBK], a
xor a
ld hl, wWindowStackBottom
@@ -470,7 +470,7 @@ ClearWindowData::
ld [wWindowStackPointer + 1], a
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
.bytefill
@@ -505,10 +505,10 @@ MenuTextBoxWaitButton::
ret
Place2DMenuItemName::
ld [hBuffer], a
ld a, [hROMBank]
ldh [hBuffer], a
ldh a, [hROMBank]
push af
ld a, [hBuffer]
ldh a, [hBuffer]
rst Bankswitch
call PlaceString
@@ -518,21 +518,21 @@ Place2DMenuItemName::
ret
_2DMenu::
ld a, [hROMBank]
ldh a, [hROMBank]
ld [wMenuData_2DMenuItemStringsBank], a
farcall _2DMenu_
ld a, [wMenuCursorBuffer]
ret
InterpretBattleMenu::
ld a, [hROMBank]
ldh a, [hROMBank]
ld [wMenuData_2DMenuItemStringsBank], a
farcall _InterpretBattleMenu
ld a, [wMenuCursorBuffer]
ret
InterpretMobileMenu::
ld a, [hROMBank]
ldh a, [hROMBank]
ld [wMenuData_2DMenuItemStringsBank], a
farcall _InterpretMobileMenu
ld a, [wMenuCursorBuffer]

Some files were not shown because too many files have changed in this diff Show More