Replace raw hex values with HRAM constants

To do: turn constants into labels and use ldh
This commit is contained in:
Rangi 2020-07-03 22:11:35 -04:00
parent 35deb77113
commit 6ef36800b0
65 changed files with 311 additions and 248 deletions

View file

@ -53,13 +53,13 @@ rLCDC_DEFAULT EQU %11100011
call ClearVram
ld hl, $ff80
ld bc, $ffff - $ff80
ld hl, $ff80 ; start of HRAM
ld bc, $ffff - $ff80 ; size of HRAM
call FillMemory
call ClearSprites
ld a, Bank(WriteDMACodeToHRAM)
ld a, BANK(WriteDMACodeToHRAM)
ld [hLoadedROMBank], a
ld [MBC1RomBank], a
call WriteDMACodeToHRAM

View file

@ -88,7 +88,7 @@ OverworldLoopLessDelay::
call IsPlayerCharacterBeingControlledByGame
jr nz, .checkForOpponent
call CheckForHiddenObjectOrBookshelfOrCardKeyDoor
ld a, [$ffeb]
ld a, [hFoundHiddenObjectOrBookshelf]
and a
jp z, OverworldLoop ; jump if a hidden object or bookshelf was found, but not if a card key door was found
call IsSpriteOrSignInFrontOfPlayer
@ -762,7 +762,7 @@ HandleBlackOut::
call StopMusic
ld hl, wd72e
res 5, [hl]
ld a, Bank(ResetStatusAndHalveMoneyOnBlackout) ; also Bank(SpecialWarpIn) and Bank(SpecialEnterMap)
ld a, BANK(ResetStatusAndHalveMoneyOnBlackout) ; also BANK(SpecialWarpIn) and BANK(SpecialEnterMap)
ld [hLoadedROMBank], a
ld [MBC1RomBank], a
call ResetStatusAndHalveMoneyOnBlackout
@ -793,7 +793,7 @@ HandleFlyWarpOrDungeonWarp::
set 2, [hl] ; fly warp or dungeon warp
res 5, [hl] ; forced to ride bike
call LeaveMapAnim
ld a, Bank(SpecialWarpIn)
ld a, BANK(SpecialWarpIn)
ld [hLoadedROMBank], a
ld [MBC1RomBank], a
call SpecialWarpIn
@ -2388,14 +2388,14 @@ SwitchToMapRomBank::
push bc
ld c, a
ld b, $00
ld a, Bank(MapHeaderBanks)
ld a, BANK(MapHeaderBanks)
call BankswitchHome ; switch to ROM bank 3
ld hl, MapHeaderBanks
add hl, bc
ld a, [hl]
ld [$ffe8], a ; save map ROM bank
ld [hMapROMBank], a ; save map ROM bank
call BankswitchBack
ld a, [$ffe8]
ld a, [hMapROMBank]
ld [hLoadedROMBank], a
ld [MBC1RomBank], a ; switch to map ROM bank
pop bc

View file

@ -365,7 +365,7 @@ TextCommandProcessor::
push af
set 1, a
ld e, a
ld a, [$fff4]
ld a, [hClearLetterPrintingDelayFlags]
xor e
ld [wLetterPrintingDelayFlags], a
ld a, c

View file

@ -26,7 +26,7 @@ VBlank::
call VBlankCopy
call VBlankCopyDouble
call UpdateMovingBgTiles
call $ff80 ; hOAMDMA
call hDMARoutine
ld a, BANK(PrepareOAMData)
ld [hLoadedROMBank], a
ld [MBC1RomBank], a