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

@ -925,7 +925,7 @@ Audio1_ApplyWavePatternAndFrequency:
ld e, [hl] ld e, [hl]
inc hl inc hl
ld d, [hl] ld d, [hl]
ld hl, $ff30 ; wave pattern RAM ld hl, rWave_0
ld b, $f ld b, $f
ld a, $0 ; stop hardware channel 3 ld a, $0 ; stop hardware channel 3
ld [rNR30], a ld [rNR30], a

View file

@ -936,7 +936,7 @@ Audio2_ApplyWavePatternAndFrequency:
ld e, [hl] ld e, [hl]
inc hl inc hl
ld d, [hl] ld d, [hl]
ld hl, $ff30 ; wave pattern RAM ld hl, rWave_0
ld b, $f ld b, $f
ld a, $0 ; stop hardware channel 3 ld a, $0 ; stop hardware channel 3
ld [rNR30], a ld [rNR30], a

View file

@ -925,7 +925,7 @@ Audio3_ApplyWavePatternAndFrequency:
ld e, [hl] ld e, [hl]
inc hl inc hl
ld d, [hl] ld d, [hl]
ld hl, $ff30 ; wave pattern RAM ld hl, rWave_0
ld b, $f ld b, $f
ld a, $0 ; stop hardware channel 3 ld a, $0 ; stop hardware channel 3
ld [rNR30], a ld [rNR30], a

View file

@ -1,5 +1,5 @@
PlayPokedexRatingSfx:: PlayPokedexRatingSfx::
ld a, [$ffdc] ld a, [hDexRatingNumMonsOwned]
ld c, $0 ld c, $0
ld hl, OwnedMonValues ld hl, OwnedMonValues
.getSfxPointer .getSfxPointer

View file

@ -13,7 +13,7 @@
; these are the definitions for the channel 3 instruments ; these are the definitions for the channel 3 instruments
; each instrument definition is made up of 32 points (nibbles) that form ; each instrument definition is made up of 32 points (nibbles) that form
; the graph of the wave ; the graph of the wave
; the current instrument is copied to $FF30 ; the current instrument is copied to rWave_0--rWave_f
.wave0 .wave0
db $02,$46,$8A,$CE,$FF,$FE,$ED,$DC,$CB,$A9,$87,$65,$44,$33,$22,$11 db $02,$46,$8A,$CE,$FF,$FE,$ED,$DC,$CB,$A9,$87,$65,$44,$33,$22,$11

View file

@ -64,6 +64,22 @@ rNR44 EQU $ff23 ; Channel 4 Counter/consecutive; Initial (R/W)
rNR50 EQU $ff24 ; Channel control / ON-OFF / Volume (R/W) rNR50 EQU $ff24 ; Channel control / ON-OFF / Volume (R/W)
rNR51 EQU $ff25 ; Selection of Sound output terminal (R/W) rNR51 EQU $ff25 ; Selection of Sound output terminal (R/W)
rNR52 EQU $ff26 ; Sound on/off rNR52 EQU $ff26 ; Sound on/off
rWave_0 EQU $ff30
rWave_1 EQU $ff31
rWave_2 EQU $ff32
rWave_3 EQU $ff33
rWave_4 EQU $ff34
rWave_5 EQU $ff35
rWave_6 EQU $ff36
rWave_7 EQU $ff37
rWave_8 EQU $ff38
rWave_9 EQU $ff39
rWave_a EQU $ff3a
rWave_b EQU $ff3b
rWave_c EQU $ff3c
rWave_d EQU $ff3d
rWave_e EQU $ff3e
rWave_f EQU $ff3f
rLCDC EQU $ff40 ; LCD Control (R/W) rLCDC EQU $ff40 ; LCD Control (R/W)
rLCDC_ENABLE EQU 7 rLCDC_ENABLE EQU 7
rLCDC_ENABLE_MASK EQU 1 << rLCDC_ENABLE rLCDC_ENABLE_MASK EQU 1 << rLCDC_ENABLE

View file

@ -224,7 +224,7 @@ OaksLabHiddenObjects:
db $FF db $FF
ViridianPokecenterHiddenObjects: ViridianPokecenterHiddenObjects:
db $04,$00,$08 db $04,$00,$08
db Bank(PrintBenchGuyText) db BANK(PrintBenchGuyText)
dw PrintBenchGuyText dw PrintBenchGuyText
db $03,$0d,$04 db $03,$0d,$04
db BANK(OpenPokemonCenterPC) db BANK(OpenPokemonCenterPC)
@ -234,7 +234,7 @@ ViridianMartHiddenObjects:
db $FF db $FF
ViridianSchoolHiddenObjects: ViridianSchoolHiddenObjects:
db $04,$03,(ViridianSchoolNotebook_id - TextPredefs) / 2 + 1 db $04,$03,(ViridianSchoolNotebook_id - TextPredefs) / 2 + 1
db Bank(PrintNotebookText) db BANK(PrintNotebookText)
dw PrintNotebookText dw PrintNotebookText
db $00,$03,(ViridianSchoolBlackboard_id - TextPredefs) / 2 + 1 db $00,$03,(ViridianSchoolBlackboard_id - TextPredefs) / 2 + 1
db BANK(PrintBlackboardLinkCableText) db BANK(PrintBlackboardLinkCableText)
@ -262,7 +262,7 @@ PewterMartHiddenObjects:
db $FF db $FF
PewterPokecenterHiddenObjects: PewterPokecenterHiddenObjects:
db $04,$00,$08 db $04,$00,$08
db Bank(PrintBenchGuyText) db BANK(PrintBenchGuyText)
dw PrintBenchGuyText dw PrintBenchGuyText
db $03,$0d,$04 db $03,$0d,$04
db BANK(OpenPokemonCenterPC) db BANK(OpenPokemonCenterPC)
@ -270,7 +270,7 @@ PewterPokecenterHiddenObjects:
db $FF db $FF
CeruleanPokecenterHiddenObjects: CeruleanPokecenterHiddenObjects:
db $04,$00,$08 db $04,$00,$08
db Bank(PrintBenchGuyText) db BANK(PrintBenchGuyText)
dw PrintBenchGuyText dw PrintBenchGuyText
db $03,$0d,$04 db $03,$0d,$04
db BANK(OpenPokemonCenterPC) db BANK(OpenPokemonCenterPC)
@ -286,7 +286,7 @@ CeruleanMartHiddenObjects:
db $FF db $FF
LavenderPokecenterHiddenObjects: LavenderPokecenterHiddenObjects:
db $04,$00,$08 db $04,$00,$08
db Bank(PrintBenchGuyText) db BANK(PrintBenchGuyText)
dw PrintBenchGuyText dw PrintBenchGuyText
db $03,$0d,$04 db $03,$0d,$04
db BANK(OpenPokemonCenterPC) db BANK(OpenPokemonCenterPC)
@ -297,7 +297,7 @@ VermilionPokecenterHiddenObjects:
db BANK(OpenPokemonCenterPC) db BANK(OpenPokemonCenterPC)
dw OpenPokemonCenterPC dw OpenPokemonCenterPC
db $04,$00,$04 db $04,$00,$04
db Bank(PrintBenchGuyText) db BANK(PrintBenchGuyText)
dw PrintBenchGuyText dw PrintBenchGuyText
db $FF db $FF
VermilionGymHiddenObjects: VermilionGymHiddenObjects:
@ -345,7 +345,7 @@ CeladonMansion2HiddenObjects:
db $FF db $FF
CeladonPokecenterHiddenObjects: CeladonPokecenterHiddenObjects:
db $04,$00,$08 db $04,$00,$08
db Bank(PrintBenchGuyText) db BANK(PrintBenchGuyText)
dw PrintBenchGuyText dw PrintBenchGuyText
db $03,$0d,$04 db $03,$0d,$04
db BANK(OpenPokemonCenterPC) db BANK(OpenPokemonCenterPC)
@ -460,7 +460,7 @@ CeladonHotelHiddenObjects:
db BANK(OpenPokemonCenterPC) db BANK(OpenPokemonCenterPC)
dw OpenPokemonCenterPC dw OpenPokemonCenterPC
db $04,$00,$08 db $04,$00,$08
db Bank(PrintBenchGuyText) db BANK(PrintBenchGuyText)
dw PrintBenchGuyText dw PrintBenchGuyText
db $FF db $FF
FuchsiaPokecenterHiddenObjects: FuchsiaPokecenterHiddenObjects:
@ -468,7 +468,7 @@ FuchsiaPokecenterHiddenObjects:
db BANK(OpenPokemonCenterPC) db BANK(OpenPokemonCenterPC)
dw OpenPokemonCenterPC dw OpenPokemonCenterPC
db $04,$00,$04 db $04,$00,$04
db Bank(PrintBenchGuyText) db BANK(PrintBenchGuyText)
dw PrintBenchGuyText dw PrintBenchGuyText
db $FF db $FF
FuchsiaGymHiddenObjects: FuchsiaGymHiddenObjects:
@ -481,27 +481,27 @@ CinnabarGymHiddenObjects:
db $0d,$11,$04 db $0d,$11,$04
dbw BANK(GymStatues),GymStatues dbw BANK(GymStatues),GymStatues
db $07,$0f,$01 db $07,$0f,$01
db Bank(PrintCinnabarQuiz) db BANK(PrintCinnabarQuiz)
dw PrintCinnabarQuiz dw PrintCinnabarQuiz
db $01,$0a,$12 db $01,$0a,$12
db Bank(PrintCinnabarQuiz) db BANK(PrintCinnabarQuiz)
dw PrintCinnabarQuiz dw PrintCinnabarQuiz
db $07,$09,$13 db $07,$09,$13
db Bank(PrintCinnabarQuiz) db BANK(PrintCinnabarQuiz)
dw PrintCinnabarQuiz dw PrintCinnabarQuiz
db $0d,$09,$14 db $0d,$09,$14
db Bank(PrintCinnabarQuiz) db BANK(PrintCinnabarQuiz)
dw PrintCinnabarQuiz dw PrintCinnabarQuiz
db $0d,$01,$05 db $0d,$01,$05
db Bank(PrintCinnabarQuiz) db BANK(PrintCinnabarQuiz)
dw PrintCinnabarQuiz dw PrintCinnabarQuiz
db $07,$01,$16 db $07,$01,$16
db Bank(PrintCinnabarQuiz) db BANK(PrintCinnabarQuiz)
dw PrintCinnabarQuiz dw PrintCinnabarQuiz
db $FF db $FF
CinnabarPokecenterHiddenObjects: CinnabarPokecenterHiddenObjects:
db $04,$00,$04 db $04,$00,$04
db Bank(PrintBenchGuyText) db BANK(PrintBenchGuyText)
dw PrintBenchGuyText dw PrintBenchGuyText
db $03,$0d,$04 db $03,$0d,$04
db BANK(OpenPokemonCenterPC) db BANK(OpenPokemonCenterPC)
@ -513,7 +513,7 @@ SaffronGymHiddenObjects:
db $FF db $FF
MtMoonPokecenterHiddenObjects: MtMoonPokecenterHiddenObjects:
db $04,$00,$08 db $04,$00,$08
db Bank(PrintBenchGuyText) db BANK(PrintBenchGuyText)
dw PrintBenchGuyText dw PrintBenchGuyText
db $03,$0d,$04 db $03,$0d,$04
db BANK(OpenPokemonCenterPC) db BANK(OpenPokemonCenterPC)
@ -521,7 +521,7 @@ MtMoonPokecenterHiddenObjects:
db $FF db $FF
RockTunnelPokecenterHiddenObjects: RockTunnelPokecenterHiddenObjects:
db $04,$00,$08 db $04,$00,$08
db Bank(PrintBenchGuyText) db BANK(PrintBenchGuyText)
dw PrintBenchGuyText dw PrintBenchGuyText
db $03,$0d,$04 db $03,$0d,$04
db BANK(OpenPokemonCenterPC) db BANK(OpenPokemonCenterPC)
@ -589,7 +589,7 @@ RocketHideout4HiddenObjects:
db $FF db $FF
SaffronPokecenterHiddenObjects: SaffronPokecenterHiddenObjects:
db $04,$00,$04 db $04,$00,$04
db Bank(PrintBenchGuyText) db BANK(PrintBenchGuyText)
dw PrintBenchGuyText dw PrintBenchGuyText
db $03,$0d,$04 db $03,$0d,$04
db BANK(OpenPokemonCenterPC) db BANK(OpenPokemonCenterPC)
@ -704,7 +704,7 @@ ViridianCityHiddenObjects:
db $FF db $FF
SafariZoneRestHouse2HiddenObjects: SafariZoneRestHouse2HiddenObjects:
db $04,$00,$08 db $04,$00,$08
db Bank(PrintBenchGuyText) db BANK(PrintBenchGuyText)
dw PrintBenchGuyText dw PrintBenchGuyText
db $03,$0d,$04 db $03,$0d,$04
db BANK(OpenPokemonCenterPC) db BANK(OpenPokemonCenterPC)
@ -712,7 +712,7 @@ SafariZoneRestHouse2HiddenObjects:
db $FF db $FF
SafariZoneRestHouse3HiddenObjects: SafariZoneRestHouse3HiddenObjects:
db $04,$00,$08 db $04,$00,$08
db Bank(PrintBenchGuyText) db BANK(PrintBenchGuyText)
dw PrintBenchGuyText dw PrintBenchGuyText
db $03,$0d,$04 db $03,$0d,$04
db BANK(OpenPokemonCenterPC) db BANK(OpenPokemonCenterPC)
@ -720,7 +720,7 @@ SafariZoneRestHouse3HiddenObjects:
db $FF db $FF
SafariZoneRestHouse4HiddenObjects: SafariZoneRestHouse4HiddenObjects:
db $04,$00,$08 db $04,$00,$08
db Bank(PrintBenchGuyText) db BANK(PrintBenchGuyText)
dw PrintBenchGuyText dw PrintBenchGuyText
db $03,$0d,$04 db $03,$0d,$04
db BANK(OpenPokemonCenterPC) db BANK(OpenPokemonCenterPC)
@ -750,7 +750,7 @@ CeladonMansion5HiddenObjects:
db BANK(PrintBlackboardLinkCableText) db BANK(PrintBlackboardLinkCableText)
dw PrintBlackboardLinkCableText dw PrintBlackboardLinkCableText
db $04,$03,(TMNotebook_id - TextPredefs) / 2 + 1 db $04,$03,(TMNotebook_id - TextPredefs) / 2 + 1
db Bank(PrintNotebookText) db BANK(PrintNotebookText)
dw PrintNotebookText dw PrintNotebookText
db $FF db $FF
FightingDojoHiddenObjects: FightingDojoHiddenObjects:

View file

@ -2,7 +2,7 @@
; objects for each map ($00-$F8) ; objects for each map ($00-$F8)
; Table of 2-Byte pointers, one pointer per map, ; Table of 2-Byte pointers, one pointer per map,
; goes up to Map_F7, ends with $FFFF. ; goes up to Map_F7, ends with -1.
; points to table listing all missable object in the area ; points to table listing all missable object in the area
MapHSPointers: MapHSPointers:
dw MapHS00 dw MapHS00
@ -253,7 +253,7 @@ MapHSPointers:
dw MapHSXX dw MapHSXX
dw MapHSXX dw MapHSXX
dw MapHSXX dw MapHSXX
dw $FFFF dw -1 ; end
; Structure: ; Structure:
; 3 bytes per object ; 3 bytes per object

View file

@ -247,7 +247,7 @@ WildDataPointers:
dw NoMons dw NoMons
dw NoMons dw NoMons
dw NoMons dw NoMons
dw $FFFF dw -1 ; end
; wild pokemon data is divided into two parts. ; wild pokemon data is divided into two parts.
; first part: pokemon found in grass ; first part: pokemon found in grass

View file

@ -163,7 +163,7 @@ DrawFrameBlock:
PlayAnimation: PlayAnimation:
xor a xor a
ld [$FF8B], a ; it looks like nothing reads this ld [hROMBankTemp], a ; it looks like nothing reads this
ld [wSubAnimTransform], a ld [wSubAnimTransform], a
ld a, [wAnimationID] ; get animation number ld a, [wAnimationID] ; get animation number
dec a dec a

View file

@ -6870,9 +6870,9 @@ _LoadTrainerPic:
ld d, a ; de contains pointer to trainer pic ld d, a ; de contains pointer to trainer pic
ld a, [wLinkState] ld a, [wLinkState]
and a and a
ld a, Bank(TrainerPics) ; this is where all the trainer pics are (not counting Red's) ld a, BANK(TrainerPics) ; this is where all the trainer pics are (not counting Red's)
jr z, .loadSprite jr z, .loadSprite
ld a, Bank(RedPicFront) ld a, BANK(RedPicFront)
.loadSprite .loadSprite
call UncompressSpriteFromDE call UncompressSpriteFromDE
ld de, vFrontPic ld de, vFrontPic

View file

@ -17,7 +17,7 @@ ScaleFirstThreeSpriteColumnsByTwo:
.columnInnerLoop .columnInnerLoop
push bc push bc
ld a, [de] ld a, [de]
ld bc, -(7*8)+1 ; $ffc9, scale lower nybble and seek to previous output column ld bc, -(7*8)+1 ; -$37, scale lower nybble and seek to previous output column
call ScalePixelsByTwo call ScalePixelsByTwo
ld a, [de] ld a, [de]
dec de dec de
@ -32,7 +32,7 @@ ScaleFirstThreeSpriteColumnsByTwo:
dec de dec de
dec de dec de
ld a, b ld a, b
ld bc, -7*8 ; $ffc8, skip one output column (which has already been written along with the current one) ld bc, -7*8 ; -$38, skip one output column (which has already been written along with the current one)
add hl, bc add hl, bc
ld b, a ld b, a
dec b dec b

View file

@ -35,7 +35,7 @@ GiveFossilToCinnabarLab::
ld e, a ld e, a
add hl, de add hl, de
ld a, [hl] ld a, [hl]
ld [$ffdb], a ld [hItemToRemoveID], a
cp DOME_FOSSIL cp DOME_FOSSIL
jr z, .choseDomeFossil jr z, .choseDomeFossil
cp HELIX_FOSSIL cp HELIX_FOSSIL

View file

@ -73,7 +73,7 @@ UnusedPlayerNameLengthFunc:
; Unused function that does a calculation involving the length of the player's ; Unused function that does a calculation involving the length of the player's
; name. ; name.
ld hl, wPlayerName ld hl, wPlayerName
ld bc, $ff00 lb bc, $ff, $00
.loop .loop
ld a, [hli] ld a, [hli]
cp "@" cp "@"

View file

@ -24,7 +24,7 @@ PrintBookshelfText::
pop af pop af
call PrintPredefTextID call PrintPredefTextID
xor a xor a
ld [$ffdb], a ld [hFFDB], a
ret ret
.nextBookshelfEntry1 .nextBookshelfEntry1
inc hl inc hl
@ -33,7 +33,7 @@ PrintBookshelfText::
jr .loop jr .loop
.noMatch .noMatch
ld a, $ff ld a, $ff
ld [$ffdb], a ld [hFFDB], a
jpba PrintCardKeyText jpba PrintCardKeyText
INCLUDE "data/tilesets/bookshelf_tile_ids.asm" INCLUDE "data/tilesets/bookshelf_tile_ids.asm"

View file

@ -16,7 +16,7 @@ CinnabarGymQuiz::
pop af pop af
and $f0 and $f0
swap a swap a
ld [$ffdc], a ld [hGymGateAnswer], a
ld hl, CinnabarGymQuizIntroText ld hl, CinnabarGymQuizIntroText
call PrintText call PrintText
ld a, [hGymGateIndex] ld a, [hGymGateIndex]
@ -77,7 +77,7 @@ CinnabarGymGateFlagAction:
CinnabarGymQuiz_1ea92: CinnabarGymQuiz_1ea92:
call YesNoChoice call YesNoChoice
ld a, [$ffdc] ld a, [hGymGateAnswer]
ld c, a ld c, a
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
cp c cp c
@ -85,10 +85,10 @@ CinnabarGymQuiz_1ea92:
ld hl, wCurrentMapScriptFlags ld hl, wCurrentMapScriptFlags
set 5, [hl] set 5, [hl]
ld a, [hGymGateIndex] ld a, [hGymGateIndex]
ld [$ffe0], a ld [hBackupGymGateIndex], a
ld hl, CinnabarGymQuizCorrectText ld hl, CinnabarGymQuizCorrectText
call PrintText call PrintText
ld a, [$ffe0] ld a, [hBackupGymGateIndex]
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0 AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
ld c, a ld c, a
ld b, FLAG_SET ld b, FLAG_SET
@ -122,7 +122,7 @@ CinnabarGymQuizCorrectText:
TX_BLINK TX_BLINK
TX_ASM TX_ASM
ld a, [$ffe0] ld a, [hBackupGymGateIndex]
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0 AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
ld c, a ld c, a
ld b, FLAG_TEST ld b, FLAG_TEST
@ -162,7 +162,7 @@ UpdateCinnabarGymGateTileBlocks_::
ld [wGymGateTileBlock], a ld [wGymGateTileBlock], a
push bc push bc
ld a, [hGymGateIndex] ld a, [hGymGateIndex]
ld [$ffe0], a ld [hBackupGymGateIndex], a
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0 AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
ld c, a ld c, a
ld b, FLAG_TEST ld b, FLAG_TEST

View file

@ -15,7 +15,7 @@ PickUpItem:
.isMissable .isMissable
ld a, [hl] ld a, [hl]
ld [$ffdb], a ld [hMissableObjectIndex], a
ld hl, wMapSpriteExtraData ld hl, wMapSpriteExtraData
ld a, [hSpriteIndexOrTextID] ld a, [hSpriteIndexOrTextID]
@ -30,7 +30,7 @@ PickUpItem:
call GiveItem call GiveItem
jr nc, .BagFull jr nc, .BagFull
ld a, [$ffdb] ld a, [hMissableObjectIndex]
ld [wMissableObjectIndex], a ld [wMissableObjectIndex], a
predef HideObject predef HideObject
ld a, 1 ld a, 1

View file

@ -2,7 +2,7 @@ RemoveGuardDrink::
ld hl, GuardDrinksList ld hl, GuardDrinksList
.drinkLoop .drinkLoop
ld a, [hli] ld a, [hli]
ld [$ffdb], a ld [hItemToRemoveID], a
and a and a
ret z ret z
push hl push hl

View file

@ -1,12 +1,12 @@
WriteDMACodeToHRAM:: WriteDMACodeToHRAM::
; Since no other memory is available during OAM DMA, ; Since no other memory is available during OAM DMA,
; DMARoutine is copied to HRAM and executed there. ; DMARoutine is copied to HRAM and executed there.
ld c, $ff80 % $100 ld c, hDMARoutine % $100
ld b, DMARoutineEnd - DMARoutine ld b, DMARoutineEnd - DMARoutine
ld hl, DMARoutine ld hl, DMARoutine
.copy .copy
ld a, [hli] ld a, [hli]
ld [$ff00+c], a ldh [c], a
inc c inc c
dec b dec b
jr nz, .copy jr nz, .copy

View file

@ -19,7 +19,7 @@ PredefShakeScreenVertically:
ld [wDisableVBlankWYUpdate], a ld [wDisableVBlankWYUpdate], a
xor a xor a
.loop .loop
ld [$ff96], a ld [hMutateWY], a
call .MutateWY call .MutateWY
call .MutateWY call .MutateWY
dec b dec b
@ -30,9 +30,9 @@ PredefShakeScreenVertically:
ret ret
.MutateWY .MutateWY
ld a, [$ff96] ld a, [hMutateWY]
xor b xor b
ld [$ff96], a ld [hMutateWY], a
ld [rWY], a ld [rWY], a
ld c, 3 ld c, 3
jp DelayFrames jp DelayFrames
@ -43,7 +43,7 @@ PredefShakeScreenHorizontally:
call GetPredefRegisters call GetPredefRegisters
xor a xor a
.loop .loop
ld [$ff97], a ld [hMutateWX], a
call .MutateWX call .MutateWX
ld c, 1 ld c, 1
call DelayFrames call DelayFrames
@ -58,9 +58,9 @@ PredefShakeScreenHorizontally:
ret ret
.MutateWX .MutateWX
ld a, [$ff97] ld a, [hMutateWX]
xor b xor b
ld [$ff97], a ld [hMutateWX], a
bit 7, a bit 7, a
jr z, .skipZeroing jr z, .skipZeroing
xor a ; zero a if it's negative xor a ; zero a if it's negative

View file

@ -1341,7 +1341,7 @@ ItemUseMedicine:
push hl push hl
push de push de
ld d, a ld d, a
callab CalcExperience ; calculate experience for next level and store it at $ff96 callab CalcExperience ; calculate experience for next level and store it at hExperience
pop de pop de
pop hl pop hl
ld bc, wPartyMon1Exp - wPartyMon1Level ld bc, wPartyMon1Exp - wPartyMon1Level

View file

@ -663,7 +663,7 @@ TradeCenter_PrintPartyListNames:
push de push de
push hl push hl
ld a, c ld a, c
ld [$ff95], a ld [hPastLeadingZeros], a
call GetMonName call GetMonName
pop hl pop hl
call PlaceString call PlaceString
@ -903,7 +903,7 @@ CableClub_Run:
ld [wTilesetGfxPtr + 1], a ld [wTilesetGfxPtr + 1], a
ld a, l ld a, l
ld [wTilesetGfxPtr], a ld [wTilesetGfxPtr], a
ld a, Bank(Club_GFX) ld a, BANK(Club_GFX)
ld [wTilesetBank], a ld [wTilesetBank], a
ld hl, Club_Coll ld hl, Club_Coll
ld a, h ld a, h

View file

@ -566,11 +566,11 @@ ShowPokedexDataInternal:
pop hl pop hl
inc hl ; hl = address of pokedex description text inc hl ; hl = address of pokedex description text
coord bc, 1, 11 coord bc, 1, 11
ld a, 2 ld a, %10
ld [$fff4], a ld [hClearLetterPrintingDelayFlags], a
call TextCommandProcessor ; print pokedex description text call TextCommandProcessor ; print pokedex description text
xor a xor a
ld [$fff4], a ld [hClearLetterPrintingDelayFlags], a
.waitForButtonPress .waitForButtonPress
call JoypadLowSensitivity call JoypadLowSensitivity
ld a, [hJoy5] ld a, [hJoy5]

View file

@ -601,9 +601,9 @@ GetMonCountsForBoxesInBank:
ret ret
SAVCheckRandomID: SAVCheckRandomID:
;checks if Sav file is the same by checking player's name 1st letter ($a598) ; checks if Sav file is the same by checking player's name 1st letter
; and the two random numbers generated at game beginning ; and the two random numbers generated at game beginning
;(which are stored at wPlayerID)s ; (which are stored at wPlayerID)s
ld a, $0a ld a, $0a
ld [MBC1SRamEnable], a ld [MBC1SRamEnable], a
ld a, $01 ld a, $01
@ -702,7 +702,7 @@ ClearSAV:
PadSRAM_FF: PadSRAM_FF:
ld [MBC1SRamBank], a ld [MBC1SRamBank], a
ld hl, $a000 ld hl, $a000 ; start of SRAM
ld bc, $2000 ld bc, $2000 ; size of SRAM
ld a, $ff ld a, $ff
jp FillMemory jp FillMemory

View file

@ -77,18 +77,18 @@ HandleItemListSwapping::
cp b cp b
jr z, .swapSameItemType jr z, .swapSameItemType
.swapDifferentItems .swapDifferentItems
ld [$ff95], a ; [$ff95] = second item ID ld [hSwapItemID], a ; save second item ID
ld a, [hld] ld a, [hld]
ld [$ff96], a ; [$ff96] = second item quantity ld [hSwapItemQuantity], a ; save second item quantity
ld a, [de] ld a, [de]
ld [hli], a ; put first item ID in second item slot ld [hli], a ; put first item ID in second item slot
inc de inc de
ld a, [de] ld a, [de]
ld [hl], a ; put first item quantity in second item slot ld [hl], a ; put first item quantity in second item slot
ld a, [$ff96] ld a, [hSwapItemQuantity]
ld [de], a ; put second item quantity in first item slot ld [de], a ; put second item quantity in first item slot
dec de dec de
ld a, [$ff95] ld a, [hSwapItemID]
ld [de], a ; put second item ID in first item slot ld [de], a ; put second item ID in first item slot
xor a xor a
ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped

View file

@ -57,7 +57,7 @@ OakSpeech:
bit 1, a ; possibly a debug mode bit bit 1, a ; possibly a debug mode bit
jp nz, .skipChoosingNames jp nz, .skipChoosingNames
ld de, ProfOakPic ld de, ProfOakPic
lb bc, Bank(ProfOakPic), $00 lb bc, BANK(ProfOakPic), $00
call IntroDisplayPicCenteredOrUpperRight call IntroDisplayPicCenteredOrUpperRight
call FadeInIntroPic call FadeInIntroPic
ld hl, OakSpeechText1 ld hl, OakSpeechText1
@ -76,7 +76,7 @@ OakSpeech:
call GBFadeOutToWhite call GBFadeOutToWhite
call ClearScreen call ClearScreen
ld de, RedPicFront ld de, RedPicFront
lb bc, Bank(RedPicFront), $00 lb bc, BANK(RedPicFront), $00
call IntroDisplayPicCenteredOrUpperRight call IntroDisplayPicCenteredOrUpperRight
call MovePicLeft call MovePicLeft
ld hl, IntroducePlayerText ld hl, IntroducePlayerText
@ -85,7 +85,7 @@ OakSpeech:
call GBFadeOutToWhite call GBFadeOutToWhite
call ClearScreen call ClearScreen
ld de, Rival1Pic ld de, Rival1Pic
lb bc, Bank(Rival1Pic), $00 lb bc, BANK(Rival1Pic), $00
call IntroDisplayPicCenteredOrUpperRight call IntroDisplayPicCenteredOrUpperRight
call FadeInIntroPic call FadeInIntroPic
ld hl, IntroduceRivalText ld hl, IntroduceRivalText
@ -95,7 +95,7 @@ OakSpeech:
call GBFadeOutToWhite call GBFadeOutToWhite
call ClearScreen call ClearScreen
ld de, RedPicFront ld de, RedPicFront
lb bc, Bank(RedPicFront), $00 lb bc, BANK(RedPicFront), $00
call IntroDisplayPicCenteredOrUpperRight call IntroDisplayPicCenteredOrUpperRight
call GBFadeInFromWhite call GBFadeInFromWhite
ld a, [wd72d] ld a, [wd72d]

View file

@ -14,14 +14,14 @@ IsPlayerOnDungeonWarp::
set 4, [hl] set 4, [hl]
ret ret
; if a hidden object was found, stores $00 in [$ffee], else stores $ff ; if a hidden object was found, stores $00 in [hFoundHiddenObject], else stores $ff
CheckForHiddenObject:: CheckForHiddenObject::
ld hl, $ffeb ld hl, hFoundHiddenObjectOrBookshelf
xor a xor a
ld [hli], a ld [hli], a ; [hFoundHiddenObjectOrBookshelf]
ld [hli], a ld [hli], a ; [hSavedMapTextPtr]
ld [hli], a ld [hli], a ; [hSavedMapTextPtr + 1]
ld [hl], a ld [hl], a ; [hFoundHiddenObject]
ld de, $0 ld de, $0
ld hl, HiddenObjectMaps ld hl, HiddenObjectMaps
.hiddenMapLoop .hiddenMapLoop
@ -81,7 +81,7 @@ CheckForHiddenObject::
ret ret
.noMatch .noMatch
ld a, $ff ld a, $ff
ld [$ffee], a ld [hFoundHiddenObject], a
ret ret
; checks if the coordinates in front of the player's sprite match Y in b and X in c ; checks if the coordinates in front of the player's sprite match Y in b and X in c

View file

@ -120,7 +120,7 @@ IsObjectHidden:
.notHidden .notHidden
xor a xor a
.hidden .hidden
ld [$ffe5], a ld [hIsHiddenMissableObject], a
ret ret
; adds missable object (items, leg. pokemon, etc.) to the map ; adds missable object (items, leg. pokemon, etc.) to the map

View file

@ -475,7 +475,7 @@ InitializeSpriteScreenPosition:
; tests if sprite is off screen or otherwise unable to do anything ; tests if sprite is off screen or otherwise unable to do anything
CheckSpriteAvailability: CheckSpriteAvailability:
predef IsObjectHidden predef IsObjectHidden
ld a, [$ffe5] ld a, [hIsHiddenMissableObject]
and a and a
jp nz, .spriteInvisible jp nz, .spriteInvisible
ld h, wSpriteStateData2 / $100 ld h, wSpriteStateData2 / $100
@ -564,7 +564,7 @@ UpdateSpriteImage:
ld a, [hl] ; c1x9: facing direction ld a, [hl] ; c1x9: facing direction
add b add b
ld b, a ld b, a
ld a, [$ff93] ; current sprite offset ld a, [hTilePlayerStandingOn]
add b add b
ld b, a ld b, a
ld a, [hCurrentSpriteOffset] ld a, [hCurrentSpriteOffset]

View file

@ -297,7 +297,7 @@ _GetTileAndCoordsInFrontOfPlayer:
GetTileTwoStepsInFrontOfPlayer: GetTileTwoStepsInFrontOfPlayer:
xor a xor a
ld [$ffdb], a ld [hPlayerFacing], a
ld hl, wYCoord ld hl, wYCoord
ld a, [hli] ld a, [hli]
ld d, a ld d, a
@ -306,7 +306,7 @@ GetTileTwoStepsInFrontOfPlayer:
and a ; cp SPRITE_FACING_DOWN and a ; cp SPRITE_FACING_DOWN
jr nz, .notFacingDown jr nz, .notFacingDown
; facing down ; facing down
ld hl, $ffdb ld hl, hPlayerFacing
set 0, [hl] set 0, [hl]
aCoord 8, 13 aCoord 8, 13
inc d inc d
@ -315,7 +315,7 @@ GetTileTwoStepsInFrontOfPlayer:
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
jr nz, .notFacingUp jr nz, .notFacingUp
; facing up ; facing up
ld hl, $ffdb ld hl, hPlayerFacing
set 1, [hl] set 1, [hl]
aCoord 8, 5 aCoord 8, 5
dec d dec d
@ -324,7 +324,7 @@ GetTileTwoStepsInFrontOfPlayer:
cp SPRITE_FACING_LEFT cp SPRITE_FACING_LEFT
jr nz, .notFacingLeft jr nz, .notFacingLeft
; facing left ; facing left
ld hl, $ffdb ld hl, hPlayerFacing
set 2, [hl] set 2, [hl]
aCoord 4, 9 aCoord 4, 9
dec e dec e
@ -333,7 +333,7 @@ GetTileTwoStepsInFrontOfPlayer:
cp SPRITE_FACING_RIGHT cp SPRITE_FACING_RIGHT
jr nz, .storeTile jr nz, .storeTile
; facing right ; facing right
ld hl, $ffdb ld hl, hPlayerFacing
set 3, [hl] set 3, [hl]
aCoord 12, 9 aCoord 12, 9
inc e inc e
@ -378,33 +378,33 @@ CheckForBoulderCollisionWithSprites:
ld hl, wSpriteStateData2 + $14 ld hl, wSpriteStateData2 + $14
add hl, de add hl, de
ld a, [hli] ; map Y position ld a, [hli] ; map Y position
ld [$ffdc], a ld [hPlayerYCoord], a
ld a, [hl] ; map X position ld a, [hl] ; map X position
ld [$ffdd], a ld [hPlayerXCoord], a
ld a, [wNumSprites] ld a, [wNumSprites]
ld c, a ld c, a
ld de, $f ld de, $f
ld hl, wSpriteStateData2 + $14 ld hl, wSpriteStateData2 + $14
ld a, [$ffdb] ld a, [hPlayerFacing]
and $3 ; facing up or down? and $3 ; facing up or down?
jr z, .pushingHorizontallyLoop jr z, .pushingHorizontallyLoop
.pushingVerticallyLoop .pushingVerticallyLoop
inc hl inc hl
ld a, [$ffdd] ld a, [hPlayerXCoord]
cp [hl] cp [hl]
jr nz, .nextSprite1 ; if X coordinates don't match jr nz, .nextSprite1 ; if X coordinates don't match
dec hl dec hl
ld a, [hli] ld a, [hli]
ld b, a ld b, a
ld a, [$ffdb] ld a, [hPlayerFacing]
rrca rrca
jr c, .pushingDown jr c, .pushingDown
; pushing up ; pushing up
ld a, [$ffdc] ld a, [hPlayerYCoord]
dec a dec a
jr .compareYCoords jr .compareYCoords
.pushingDown .pushingDown
ld a, [$ffdc] ld a, [hPlayerYCoord]
inc a inc a
.compareYCoords .compareYCoords
cp b cp b
@ -417,19 +417,19 @@ CheckForBoulderCollisionWithSprites:
.pushingHorizontallyLoop .pushingHorizontallyLoop
ld a, [hli] ld a, [hli]
ld b, a ld b, a
ld a, [$ffdc] ld a, [hPlayerYCoord]
cp b cp b
jr nz, .nextSprite2 jr nz, .nextSprite2
ld b, [hl] ld b, [hl]
ld a, [$ffdb] ld a, [hPlayerFacing]
bit 2, a bit 2, a
jr nz, .pushingLeft jr nz, .pushingLeft
; pushing right ; pushing right
ld a, [$ffdd] ld a, [hPlayerXCoord]
inc a inc a
jr .compareXCoords jr .compareXCoords
.pushingLeft .pushingLeft
ld a, [$ffdd] ld a, [hPlayerXCoord]
dec a dec a
.compareXCoords .compareXCoords
cp b cp b

View file

@ -31,7 +31,7 @@ _UpdateSprites::
UpdateNonPlayerSprite: UpdateNonPlayerSprite:
dec a dec a
swap a swap a
ld [$ff93], a ; $10 * sprite# ld [hTilePlayerStandingOn], a ; $10 * sprite#
ld a, [wNPCMovementScriptSpriteOffset] ; some sprite offset? ld a, [wNPCMovementScriptSpriteOffset] ; some sprite offset?
ld b, a ld b, a
ld a, [hCurrentSpriteOffset] ld a, [hCurrentSpriteOffset]
@ -79,7 +79,7 @@ DetectCollisionBetweenSprites:
and $f0 and $f0
or c or c
ld [$ff90], a ; store Y coordinate adjusted for direction of movement ld [hFF90], a ; store Y coordinate adjusted for direction of movement
ld a, [hli] ; a = [$c1i5] (delta X) (-1, 0, or 1) ld a, [hli] ; a = [$c1i5] (delta X) (-1, 0, or 1)
call SetSpriteCollisionValues call SetSpriteCollisionValues
@ -92,7 +92,7 @@ DetectCollisionBetweenSprites:
and $f0 and $f0
or c or c
ld [$ff91], a ; store X coordinate adjusted for direction of movement ld [hFF91], a ; store X coordinate adjusted for direction of movement
ld a, l ld a, l
add 7 add 7
@ -102,15 +102,15 @@ DetectCollisionBetweenSprites:
ld [hld], a ; zero [$c1id] XXX what's [$c1id] for? ld [hld], a ; zero [$c1id] XXX what's [$c1id] for?
ld [hld], a ; zero [$c1ic] (directions in which collisions occurred) ld [hld], a ; zero [$c1ic] (directions in which collisions occurred)
ld a, [$ff91] ld a, [hFF91]
ld [hld], a ; [$c1ib] = adjusted X coordinate ld [hld], a ; [$c1ib] = adjusted X coordinate
ld a, [$ff90] ld a, [hFF90]
ld [hl], a ; [$c1ia] = adjusted Y coordinate ld [hl], a ; [$c1ia] = adjusted Y coordinate
xor a ; zero the loop counter xor a ; zero the loop counter
.loop .loop
ld [$ff8f], a ; store loop counter ld [hFF8F], a ; store loop counter
swap a swap a
ld e, a ld e, a
ld a, [hCurrentSpriteOffset] ld a, [hCurrentSpriteOffset]
@ -154,7 +154,7 @@ DetectCollisionBetweenSprites:
cpl cpl
inc a inc a
.noCarry1 .noCarry1
ld [$ff90], a ; store the distance between the two sprites' adjusted Y values ld [hFF90], a ; store the distance between the two sprites' adjusted Y values
; Use the carry flag set by the above subtraction to determine which sprite's ; Use the carry flag set by the above subtraction to determine which sprite's
; Y coordinate is larger. This information is used later to set [$c1ic], ; Y coordinate is larger. This information is used later to set [$c1ic],
@ -176,11 +176,11 @@ DetectCollisionBetweenSprites:
ld b, 9 ld b, 9
.next1 .next1
ld a, [$ff90] ; a = distance between adjusted Y coordinates ld a, [hFF90] ; a = distance between adjusted Y coordinates
sub b sub b
ld [$ff92], a ; store distance adjusted using sprite i's direction ld [hFF92], a ; store distance adjusted using sprite i's direction
ld a, b ld a, b
ld [$ff90], a ; store 7 or 9 depending on sprite i's delta Y ld [hFF90], a ; store 7 or 9 depending on sprite i's delta Y
jr c, .checkXDistance jr c, .checkXDistance
; If sprite j's delta Y is 0, then b = 7, else b = 9. ; If sprite j's delta Y is 0, then b = 7, else b = 9.
@ -193,7 +193,7 @@ DetectCollisionBetweenSprites:
ld b, 9 ld b, 9
.next2 .next2
ld a, [$ff92] ; a = distance adjusted using sprite i's direction ld a, [hFF92] ; a = distance adjusted using sprite i's direction
sub b ; adjust distance using sprite j's direction sub b ; adjust distance using sprite j's direction
jr z, .checkXDistance jr z, .checkXDistance
jr nc, .next ; go to next sprite if distance is still positive after both adjustments jr nc, .next ; go to next sprite if distance is still positive after both adjustments
@ -225,7 +225,7 @@ DetectCollisionBetweenSprites:
cpl cpl
inc a inc a
.noCarry2 .noCarry2
ld [$ff91], a ; store the distance between the two sprites' adjusted X values ld [hFF91], a ; store the distance between the two sprites' adjusted X values
; Use the carry flag set by the above subtraction to determine which sprite's ; Use the carry flag set by the above subtraction to determine which sprite's
; X coordinate is larger. This information is used later to set [$c1ic], ; X coordinate is larger. This information is used later to set [$c1ic],
@ -247,11 +247,11 @@ DetectCollisionBetweenSprites:
ld b, 9 ld b, 9
.next3 .next3
ld a, [$ff91] ; a = distance between adjusted X coordinates ld a, [hFF91] ; a = distance between adjusted X coordinates
sub b sub b
ld [$ff92], a ; store distance adjusted using sprite i's direction ld [hFF92], a ; store distance adjusted using sprite i's direction
ld a, b ld a, b
ld [$ff91], a ; store 7 or 9 depending on sprite i's delta X ld [hFF91], a ; store 7 or 9 depending on sprite i's delta X
jr c, .collision jr c, .collision
; If sprite j's delta X is 0, then b = 7, else b = 9. ; If sprite j's delta X is 0, then b = 7, else b = 9.
@ -264,15 +264,15 @@ DetectCollisionBetweenSprites:
ld b, 9 ld b, 9
.next4 .next4
ld a, [$ff92] ; a = distance adjusted using sprite i's direction ld a, [hFF92] ; a = distance adjusted using sprite i's direction
sub b ; adjust distance using sprite j's direction sub b ; adjust distance using sprite j's direction
jr z, .collision jr z, .collision
jr nc, .next ; go to next sprite if distance is still positive after both adjustments jr nc, .next ; go to next sprite if distance is still positive after both adjustments
.collision .collision
ld a, [$ff91] ; a = 7 or 9 depending on sprite i's delta X ld a, [hFF91] ; a = 7 or 9 depending on sprite i's delta X
ld b, a ld b, a
ld a, [$ff90] ; a = 7 or 9 depending on sprite i's delta Y ld a, [hFF90] ; a = 7 or 9 depending on sprite i's delta Y
inc l inc l
; If delta X isn't 0 and delta Y is 0, then b = %0011, else b = %1100. ; If delta X isn't 0 and delta Y is 0, then b = %0011, else b = %1100.
@ -294,7 +294,7 @@ DetectCollisionBetweenSprites:
; set bit in [$c1ie] or [$c1if] to indicate which sprite the collision occurred with ; set bit in [$c1ie] or [$c1if] to indicate which sprite the collision occurred with
inc l inc l
inc l inc l
ld a, [$ff8f] ; a = loop counter ld a, [hFF8F] ; a = loop counter
ld de, SpriteCollisionBitTable ld de, SpriteCollisionBitTable
add a add a
add e add e
@ -311,7 +311,7 @@ DetectCollisionBetweenSprites:
ld [hl], a ld [hl], a
.next .next
ld a, [$ff8f] ; a = loop counter ld a, [hFF8F] ; a = loop counter
inc a inc a
cp $10 cp $10
jp nz, .loop jp nz, .loop

View file

@ -25,7 +25,7 @@ LoadTilesetHeader:
ld a, [hl] ld a, [hl]
ld [hTilesetType], a ld [hTilesetType], a
xor a xor a
ld [$ffd8], a ld [hMovingBGTilesCounter1], a
pop hl pop hl
ld a, [wCurMapTileset] ld a, [wCurMapTileset]
push hl push hl

View file

@ -5,16 +5,16 @@ _GetSpritePosition1::
ld [hSpriteIndex], a ld [hSpriteIndex], a
call GetSpriteDataPointer call GetSpriteDataPointer
ld a, [hli] ; c1x4 (screen Y pos) ld a, [hli] ; c1x4 (screen Y pos)
ld [$ffeb], a ld [hSpriteScreenYCoord], a
inc hl inc hl
ld a, [hl] ; c1x6 (screen X pos) ld a, [hl] ; c1x6 (screen X pos)
ld [$ffec], a ld [hSpriteScreenXCoord], a
ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6)
add hl, de add hl, de
ld a, [hli] ; c2x4 (map Y pos) ld a, [hli] ; c2x4 (map Y pos)
ld [$ffed], a ld [hSpriteMapYCoord], a
ld a, [hl] ; c2x5 (map X pos) ld a, [hl] ; c2x5 (map X pos)
ld [$ffee], a ld [hSpriteMapXCoord], a
ret ret
_GetSpritePosition2:: _GetSpritePosition2::
@ -42,16 +42,16 @@ _SetSpritePosition1::
ld a, [wSpriteIndex] ld a, [wSpriteIndex]
ld [hSpriteIndex], a ld [hSpriteIndex], a
call GetSpriteDataPointer call GetSpriteDataPointer
ld a, [$ffeb] ; c1x4 (screen Y pos) ld a, [hSpriteScreenYCoord] ; c1x4 (screen Y pos)
ld [hli], a ld [hli], a
inc hl inc hl
ld a, [$ffec] ; c1x6 (screen X pos) ld a, [hSpriteScreenXCoord] ; c1x6 (screen X pos)
ld [hl], a ld [hl], a
ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6)
add hl, de add hl, de
ld a, [$ffed] ; c2x4 (map Y pos) ld a, [hSpriteMapYCoord] ; c2x4 (map Y pos)
ld [hli], a ld [hli], a
ld a, [$ffee] ; c2x5 (map X pos) ld a, [hSpriteMapXCoord] ; c2x5 (map X pos)
ld [hl], a ld [hl], a
ret ret

View file

@ -63,7 +63,7 @@ RedrawMapView:
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
ld de, -2 * 32 ld de, -2 * BG_MAP_WIDTH
add hl, de add hl, de
ld a, h ld a, h
and $3 and $3
@ -73,23 +73,23 @@ RedrawMapView:
ld a, h ld a, h
ld [wBuffer + 1], a ; this copy of the address is not used ld [wBuffer + 1], a ; this copy of the address is not used
ld a, 2 ld a, 2
ld [$ffbe], a ld [hRedrawMapViewRowOffset], a
ld c, 9 ; number of rows of 2x2 tiles (this covers the whole screen) ld c, SCREEN_HEIGHT / 2 ; number of rows of 2x2 tiles (this covers the whole screen)
.redrawRowLoop .redrawRowLoop
push bc push bc
push hl push hl
push hl push hl
ld hl, wTileMap - 2 * SCREEN_WIDTH ld hl, wTileMap - 2 * SCREEN_WIDTH
ld de, SCREEN_WIDTH ld de, SCREEN_WIDTH
ld a, [$ffbe] ld a, [hRedrawMapViewRowOffset]
.calcWRAMAddrLoop .calcWRAMAddrLoop
add hl, de add hl, de
dec a dec a
jr nz, .calcWRAMAddrLoop jr nz, .calcWRAMAddrLoop
call CopyToRedrawRowOrColumnSrcTiles call CopyToRedrawRowOrColumnSrcTiles
pop hl pop hl
ld de, $20 ld de, BG_MAP_WIDTH
ld a, [$ffbe] ld a, [hRedrawMapViewRowOffset]
ld c, a ld c, a
.calcVRAMAddrLoop .calcVRAMAddrLoop
add hl, de add hl, de
@ -104,7 +104,7 @@ RedrawMapView:
ld a, REDRAW_ROW ld a, REDRAW_ROW
ld [hRedrawRowOrColumnMode], a ld [hRedrawRowOrColumnMode], a
call DelayFrame call DelayFrame
ld hl, $ffbe ld hl, hRedrawMapViewRowOffset
inc [hl] inc [hl]
inc [hl] inc [hl]
pop hl pop hl

View file

@ -199,7 +199,7 @@ LoadFrontSpriteByMonIndex::
pop hl pop hl
ld a, [hLoadedROMBank] ld a, [hLoadedROMBank]
push af push af
ld a, Bank(CopyUncompressedPicToHL) ld a, BANK(CopyUncompressedPicToHL)
ld [hLoadedROMBank], a ld [hLoadedROMBank], a
ld [MBC1RomBank], a ld [MBC1RomBank], a
xor a xor a
@ -832,7 +832,7 @@ UpdateSprites::
ret nz ret nz
ld a, [hLoadedROMBank] ld a, [hLoadedROMBank]
push af push af
ld a, Bank(_UpdateSprites) ld a, BANK(_UpdateSprites)
ld [hLoadedROMBank], a ld [hLoadedROMBank], a
ld [MBC1RomBank], a ld [MBC1RomBank], a
call _UpdateSprites call _UpdateSprites
@ -1104,7 +1104,7 @@ DisplayPokemartDialogue::
ld [wListMenuID], a ld [wListMenuID], a
ld a, [hLoadedROMBank] ld a, [hLoadedROMBank]
push af push af
ld a, Bank(DisplayPokemartDialogue_) ld a, BANK(DisplayPokemartDialogue_)
ld [hLoadedROMBank], a ld [hLoadedROMBank], a
ld [MBC1RomBank], a ld [MBC1RomBank], a
call DisplayPokemartDialogue_ call DisplayPokemartDialogue_
@ -1136,14 +1136,14 @@ LoadItemList::
DisplayPokemonCenterDialogue:: DisplayPokemonCenterDialogue::
; zeroing these doesn't appear to serve any purpose ; zeroing these doesn't appear to serve any purpose
xor a xor a
ld [$ff8b], a ld [hItemPrice], a
ld [$ff8c], a ld [hItemPrice + 1], a
ld [$ff8d], a ld [hItemPrice + 2], a
inc hl inc hl
ld a, [hLoadedROMBank] ld a, [hLoadedROMBank]
push af push af
ld a, Bank(DisplayPokemonCenterDialogue_) ld a, BANK(DisplayPokemonCenterDialogue_)
ld [hLoadedROMBank], a ld [hLoadedROMBank], a
ld [MBC1RomBank], a ld [MBC1RomBank], a
call DisplayPokemonCenterDialogue_ call DisplayPokemonCenterDialogue_
@ -2794,7 +2794,7 @@ GetTrainerInformation::
ld a, [wLinkState] ld a, [wLinkState]
and a and a
jr nz, .linkBattle jr nz, .linkBattle
ld a, Bank(TrainerPicAndMoneyPointers) ld a, BANK(TrainerPicAndMoneyPointers)
call BankswitchHome call BankswitchHome
ld a, [wTrainerClass] ld a, [wTrainerClass]
dec a dec a
@ -3185,12 +3185,12 @@ GetName::
ld hl, NamePointers ld hl, NamePointers
add hl, de add hl, de
ld a, [hli] ld a, [hli]
ld [$ff96], a ld [hSwapTemp + 1], a
ld a, [hl] ld a, [hl]
ld [$ff95], a ld [hSwapTemp], a
ld a, [$ff95] ld a, [hSwapTemp]
ld h, a ld h, a
ld a, [$ff96] ld a, [hSwapTemp + 1]
ld l, a ld l, a
ld a, [wd0b5] ld a, [wd0b5]
ld b, a ld b, a
@ -3258,7 +3258,7 @@ GetItemPrice::
ld [hItemPrice], a ld [hItemPrice], a
jr .done jr .done
.getTMPrice .getTMPrice
ld a, Bank(GetMachinePrice) ld a, BANK(GetMachinePrice)
ld [hLoadedROMBank], a ld [hLoadedROMBank], a
ld [MBC1RomBank], a ld [MBC1RomBank], a
call GetMachinePrice call GetMachinePrice
@ -3409,7 +3409,7 @@ Divide::
push bc push bc
ld a, [hLoadedROMBank] ld a, [hLoadedROMBank]
push af push af
ld a, Bank(_Divide) ld a, BANK(_Divide)
ld [hLoadedROMBank], a ld [hLoadedROMBank], a
ld [MBC1RomBank], a ld [MBC1RomBank], a
call _Divide call _Divide
@ -3552,11 +3552,11 @@ CalcStat::
call Multiply call Multiply
ld a, [hld] ld a, [hld]
ld d, a ld d, a
ld a, [$ff98] ld a, [hProduct + 3]
sub d sub d
ld a, [hli] ld a, [hli]
ld d, a ld d, a
ld a, [$ff97] ld a, [hProduct + 2]
sbc d ; test if (current stat exp bonus)^2 < stat exp sbc d ; test if (current stat exp bonus)^2 < stat exp
jr c, .statExpLoop jr c, .statExpLoop
.statExpDone .statExpDone
@ -4497,11 +4497,11 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor::
bit 0, a ; A button bit 0, a ; A button
jr z, .nothingFound jr z, .nothingFound
; A button is pressed ; A button is pressed
ld a, Bank(CheckForHiddenObject) ld a, BANK(CheckForHiddenObject)
ld [MBC1RomBank], a ld [MBC1RomBank], a
ld [hLoadedROMBank], a ld [hLoadedROMBank], a
call CheckForHiddenObject call CheckForHiddenObject
ld a, [$ffee] ld a, [hFoundHiddenObject]
and a and a
jr nz, .hiddenObjectNotFound jr nz, .hiddenObjectNotFound
ld a, [wHiddenObjectFunctionRomBank] ld a, [wHiddenObjectFunctionRomBank]
@ -4515,13 +4515,13 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor::
jr .done jr .done
.hiddenObjectNotFound .hiddenObjectNotFound
callba PrintBookshelfText callba PrintBookshelfText
ld a, [$ffdb] ld a, [hFFDB]
and a and a
jr z, .done jr z, .done
.nothingFound .nothingFound
ld a, $ff ld a, $ff
.done .done
ld [$ffeb], a ld [hFoundHiddenObjectOrBookshelf], a
pop af pop af
ld [MBC1RomBank], a ld [MBC1RomBank], a
ld [hLoadedROMBank], a ld [hLoadedROMBank], a
@ -4537,17 +4537,17 @@ PrintPredefTextID::
RestoreMapTextPointer:: RestoreMapTextPointer::
ld hl, wMapTextPtr ld hl, wMapTextPtr
ld a, [$ffec] ld a, [hSavedMapTextPtr]
ld [hli], a ld [hli], a
ld a, [$ffec + 1] ld a, [hSavedMapTextPtr + 1]
ld [hl], a ld [hl], a
ret ret
SetMapTextPointer:: SetMapTextPointer::
ld a, [wMapTextPtr] ld a, [wMapTextPtr]
ld [$ffec], a ld [hSavedMapTextPtr], a
ld a, [wMapTextPtr + 1] ld a, [wMapTextPtr + 1]
ld [$ffec + 1], a ld [hSavedMapTextPtr + 1], a
ld a, l ld a, l
ld [wMapTextPtr], a ld [wMapTextPtr], a
ld a, h ld a, h

View file

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

View file

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

View file

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

View file

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

View file

@ -1,3 +1,5 @@
hDMARoutine EQU $FF80
hSoftReset EQU $FF8A hSoftReset EQU $FF8A
; Initialized to 16. ; Initialized to 16.
; Decremented each input iteration if the player ; Decremented each input iteration if the player
@ -81,6 +83,11 @@ hOAMBufferOffset EQU $FF90
hSpriteScreenX EQU $FF91 hSpriteScreenX EQU $FF91
hSpriteScreenY EQU $FF92 hSpriteScreenY EQU $FF92
hFF8F EQU $FF8F
hFF90 EQU $FF90
hFF91 EQU $FF91
hFF92 EQU $FF92
hTilePlayerStandingOn EQU $FF93 hTilePlayerStandingOn EQU $FF93
hSpritePriority EQU $FF94 hSpritePriority EQU $FF94
@ -90,14 +97,20 @@ hSignCoordPointer EQU $FF95
hNPCMovementDirections2Index EQU $FF95 hNPCMovementDirections2Index EQU $FF95
hSwapItemID EQU $FF95
hSwapItemQuantity EQU $FF96
; CalcPositionOfPlayerRelativeToNPC ; CalcPositionOfPlayerRelativeToNPC
hNPCSpriteOffset EQU $FF95 hNPCSpriteOffset EQU $FF95
; temp value used when swapping bytes ; temp value used when swapping bytes or words
hSwapTemp EQU $FF95 hSwapTemp EQU $FF95
hExperience EQU $FF96 ; 3 bytes, big endian hExperience EQU $FF96 ; 3 bytes, big endian
hMutateWY EQU $FF96
hMutateWX EQU $FF97
; Multiplication and division variables are meant ; Multiplication and division variables are meant
; to overlap for back-to-back usage. Big endian. ; to overlap for back-to-back usage. Big endian.
@ -204,6 +217,8 @@ hAutoBGTransferPortion EQU $FFBB
; the destination address of the automatic background transfer ; the destination address of the automatic background transfer
hAutoBGTransferDest EQU $FFBC ; 2 bytes hAutoBGTransferDest EQU $FFBC ; 2 bytes
hRedrawMapViewRowOffset EQU $FFBE
; temporary storage for stack pointer during memory transfers that use pop ; temporary storage for stack pointer during memory transfers that use pop
; to increase speed ; to increase speed
hSPTemp EQU $FFBF ; 2 bytes hSPTemp EQU $FFBF ; 2 bytes
@ -273,6 +288,7 @@ hCurrentSpriteOffset EQU $FFDA ; multiple of $10
hItemCounter EQU $FFDB hItemCounter EQU $FFDB
hGymGateIndex EQU $FFDB hGymGateIndex EQU $FFDB
hGymGateAnswer EQU $FFDC
hGymTrashCanRandNumMask EQU $FFDB hGymTrashCanRandNumMask EQU $FFDB
@ -285,33 +301,64 @@ hDexRatingNumMonsOwned EQU $FFDC
; $FF = player cancelled ; $FF = player cancelled
hOaksAideResult EQU $FFDB hOaksAideResult EQU $FFDB
hSavedCoordIndex EQU $FFDB
hOaksAideRequirement EQU $FFDB ; required number of owned mons hOaksAideRequirement EQU $FFDB ; required number of owned mons
hOaksAideRewardItem EQU $FFDC hOaksAideRewardItem EQU $FFDC
hOaksAideNumMonsOwned EQU $FFDD hOaksAideNumMonsOwned EQU $FFDD
hPlayerFacing EQU $FFDB
hPlayerYCoord EQU $FFDC
hPlayerXCoord EQU $FFDD
hMissableObjectIndex EQU $FFDB
hItemToRemoveID EQU $FFDB hItemToRemoveID EQU $FFDB
hItemToRemoveIndex EQU $FFDC hItemToRemoveIndex EQU $FFDC
hVendingMachineItem EQU $FFDB hVendingMachineItem EQU $FFDB
hVendingMachinePrice EQU $FFDC ; 3-byte BCD number hVendingMachinePrice EQU $FFDC ; 3-byte BCD number
hFFDB EQU $FFDB
hFFDC EQU $FFDC
hBackupGymGateIndex EQU $FFE0
hUnlockedSilphCoDoors EQU $FFE0
; the first tile ID in a sequence of tile IDs that increase by 1 each step ; the first tile ID in a sequence of tile IDs that increase by 1 each step
hStartTileID EQU $FFE1 hStartTileID EQU $FFE1
hNewPartyLength EQU $FFE4 hNewPartyLength EQU $FFE4
hIsHiddenMissableObject EQU $FFE5
hDividend2 EQU $FFE5 hDividend2 EQU $FFE5
hDivisor2 EQU $FFE6 hDivisor2 EQU $FFE6
hQuotient2 EQU $FFE7 hQuotient2 EQU $FFE7
hMapROMBank EQU $FFE8
hSpriteVRAMSlotAndFacing EQU $FFE9 hSpriteVRAMSlotAndFacing EQU $FFE9
hCoordsInFrontOfPlayerMatch EQU $FFEA hCoordsInFrontOfPlayerMatch EQU $FFEA
hSpriteAnimFrameCounter EQU $FFEA hSpriteAnimFrameCounter EQU $FFEA
hSpriteScreenYCoord EQU $FFEB
hSpriteScreenXCoord EQU $FFEC
hSpriteMapYCoord EQU $FFED
hSpriteMapXCoord EQU $FFEE
hFoundHiddenObjectOrBookshelf EQU $FFEB
hFoundHiddenObject EQU $FFEE
hSavedMapTextPtr EQU $FFEC
hWhoseTurn EQU $FFF3 ; 0 on players turn, 1 on enemys turn hWhoseTurn EQU $FFF3 ; 0 on players turn, 1 on enemys turn
hClearLetterPrintingDelayFlags EQU $FFF4
; bit 0: draw HP fraction to the right of bar instead of below (for party menu) ; bit 0: draw HP fraction to the right of bar instead of below (for party menu)
; bit 1: menu is double spaced ; bit 1: menu is double spaced
hFlagsFFF6 EQU $FFF6 hFlagsFFF6 EQU $FFF6

View file

@ -23,7 +23,7 @@ BikeShopText1:
call GiveItem call GiveItem
jr nc, .BagFull jr nc, .BagFull
ld a, BIKE_VOUCHER ld a, BIKE_VOUCHER
ld [$ffdb], a ld [hItemToRemoveID], a
callba RemoveItemByID callba RemoveItemByID
SetEvent EVENT_GOT_BICYCLE SetEvent EVENT_GOT_BICYCLE
ld hl, BikeShopText_1d824 ld hl, BikeShopText_1d824

View file

@ -66,13 +66,13 @@ BillsHouseScript3:
ld a, $2 ld a, $2
ld [wSpriteIndex], a ld [wSpriteIndex], a
ld a, $c ld a, $c
ld [$ffeb], a ld [hSpriteScreenYCoord], a
ld a, $40 ld a, $40
ld [$ffec], a ld [hSpriteScreenXCoord], a
ld a, $6 ld a, $6
ld [$ffed], a ld [hSpriteMapYCoord], a
ld a, $5 ld a, $5
ld [$ffee], a ld [hSpriteMapXCoord], a
call SetSpritePosition1 call SetSpritePosition1
ld a, HS_BILL_1 ld a, HS_BILL_1
ld [wMissableObjectIndex], a ld [wMissableObjectIndex], a

View file

@ -96,7 +96,7 @@ CinnabarGymScript2:
cp $ff cp $ff
jp z, CinnabarGymScript_75792 jp z, CinnabarGymScript_75792
ld a, [wTrainerHeaderFlagBit] ld a, [wTrainerHeaderFlagBit]
ld [$ffdb], a ld [hGymGateIndex], a
AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2 AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2
ld c, a ld c, a
ld b, FLAG_TEST ld b, FLAG_TEST
@ -111,7 +111,7 @@ CinnabarGymScript2:
call WaitForSoundToFinish call WaitForSoundToFinish
.asm_7581b .asm_7581b
ld a, [wTrainerHeaderFlagBit] ld a, [wTrainerHeaderFlagBit]
ld [$ffdb], a ld [hGymGateIndex], a
AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2 AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2
ld c, a ld c, a
ld b, FLAG_SET ld b, FLAG_SET

View file

@ -29,7 +29,7 @@ CopycatsHouse2FText1:
ld hl, ReceivedTM31Text ld hl, ReceivedTM31Text
call PrintText call PrintText
ld a, POKE_DOLL ld a, POKE_DOLL
ld [$ffdb], a ld [hItemToRemoveID], a
callba RemoveItemByID callba RemoveItemByID
SetEvent EVENT_GOT_TM31 SetEvent EVENT_GOT_TM31
jr .asm_62ecd jr .asm_62ecd

View file

@ -672,9 +672,9 @@ OaksLabScript_RemoveParcel:
OaksLabScript_1d02b: OaksLabScript_1d02b:
ld a, $7c ld a, $7c
ld [$ffeb], a ld [hSpriteScreenYCoord], a
ld a, $8 ld a, $8
ld [$ffee], a ld [hSpriteMapXCoord], a
ld a, [wYCoord] ld a, [wYCoord]
cp $3 cp $3
jr nz, .asm_1d045 jr nz, .asm_1d045
@ -703,9 +703,9 @@ OaksLabScript_1d02b:
.asm_1d066 .asm_1d066
ld a, $20 ld a, $20
.asm_1d068 .asm_1d068
ld [$ffec], a ld [hSpriteScreenXCoord], a
ld a, b ld a, b
ld [$ffed], a ld [hSpriteMapYCoord], a
ld a, $1 ld a, $1
ld [wSpriteIndex], a ld [wSpriteIndex], a
call SetSpritePosition1 call SetSpritePosition1

View file

@ -58,13 +58,13 @@ PewterCityScript1:
ld [hSpriteIndexOrTextID], a ld [hSpriteIndexOrTextID], a
call DisplayTextID call DisplayTextID
ld a, $3c ld a, $3c
ld [$ffeb], a ld [hSpriteScreenYCoord], a
ld a, $30 ld a, $30
ld [$ffec], a ld [hSpriteScreenXCoord], a
ld a, $c ld a, $c
ld [$ffed], a ld [hSpriteMapYCoord], a
ld a, $11 ld a, $11
ld [$ffee], a ld [hSpriteMapXCoord], a
ld a, $3 ld a, $3
ld [wSpriteIndex], a ld [wSpriteIndex], a
call SetSpritePosition1 call SetSpritePosition1
@ -126,13 +126,13 @@ PewterCityScript4:
ld [hSpriteIndexOrTextID], a ld [hSpriteIndexOrTextID], a
call DisplayTextID call DisplayTextID
ld a, $3c ld a, $3c
ld [$ffeb], a ld [hSpriteScreenYCoord], a
ld a, $40 ld a, $40
ld [$ffec], a ld [hSpriteScreenXCoord], a
ld a, $16 ld a, $16
ld [$ffed], a ld [hSpriteMapYCoord], a
ld a, $10 ld a, $10
ld [$ffee], a ld [hSpriteMapXCoord], a
ld a, $5 ld a, $5
ld [wSpriteIndex], a ld [wSpriteIndex], a
call SetSpritePosition1 call SetSpritePosition1

View file

@ -27,7 +27,7 @@ Route5GateScript0:
xor a xor a
ld [hJoyHeld], a ld [hJoyHeld], a
callba RemoveGuardDrink callba RemoveGuardDrink
ld a, [$ffdb] ld a, [hItemToRemoveID]
and a and a
jr nz, .asm_1df82 jr nz, .asm_1df82
ld a, $2 ld a, $2
@ -74,7 +74,7 @@ Route5GateText1:
bit 6, a bit 6, a
jr nz, .asm_88856 jr nz, .asm_88856
callba RemoveGuardDrink callba RemoveGuardDrink
ld a, [$ffdb] ld a, [hItemToRemoveID]
and a and a
jr nz, .asm_768a2 jr nz, .asm_768a2
ld hl, Route5GateText2 ld hl, Route5GateText2

View file

@ -21,7 +21,7 @@ Route6GateScript0:
xor a xor a
ld [hJoyHeld], a ld [hJoyHeld], a
callba RemoveGuardDrink callba RemoveGuardDrink
ld a, [$ffdb] ld a, [hItemToRemoveID]
and a and a
jr nz, .asm_1e080 jr nz, .asm_1e080
ld a, $2 ld a, $2

View file

@ -33,7 +33,7 @@ Route7GateScript0:
xor a xor a
ld [hJoyHeld], a ld [hJoyHeld], a
callba RemoveGuardDrink callba RemoveGuardDrink
ld a, [$ffdb] ld a, [hItemToRemoveID]
and a and a
jr nz, .asm_1e15a jr nz, .asm_1e15a
ld a, $2 ld a, $2

View file

@ -32,7 +32,7 @@ Route8GateScript0:
xor a xor a
ld [hJoyHeld], a ld [hJoyHeld], a
callba RemoveGuardDrink callba RemoveGuardDrink
ld a, [$ffdb] ld a, [hItemToRemoveID]
and a and a
jr nz, .asm_1e220 jr nz, .asm_1e220
ld a, $2 ld a, $2

View file

@ -31,7 +31,7 @@ SSAnne2Script0:
ld a, MUSIC_MEET_RIVAL ld a, MUSIC_MEET_RIVAL
call PlayMusic call PlayMusic
ld a, [wCoordIndex] ld a, [wCoordIndex]
ld [$ffdb], a ld [hSavedCoordIndex], a
ld a, HS_SS_ANNE_2F_RIVAL ld a, HS_SS_ANNE_2F_RIVAL
ld [wMissableObjectIndex], a ld [wMissableObjectIndex], a
predef ShowObject predef ShowObject
@ -43,7 +43,7 @@ SSAnne2Script0:
ld [hJoyHeld], a ld [hJoyHeld], a
ld a, $f0 ld a, $f0
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld a, [$ffdb] ld a, [hSavedCoordIndex]
cp $2 cp $2
jr nz, .asm_61400 jr nz, .asm_61400
ld de, MovementData_6140c ld de, MovementData_6140c

View file

@ -51,7 +51,7 @@ SSAnne7RubText:
ld a, SFX_STOP_ALL_MUSIC ld a, SFX_STOP_ALL_MUSIC
ld [wNewSoundID], a ld [wNewSoundID], a
call PlaySound call PlaySound
ld a, Bank(Music_PkmnHealed) ld a, BANK(Music_PkmnHealed)
ld [wAudioROMBank], a ld [wAudioROMBank], a
.asm_61908 .asm_61908
ld a, MUSIC_PKMN_HEALED ld a, MUSIC_PKMN_HEALED

View file

@ -28,7 +28,7 @@ SilphCo10GateCoords:
db $FF db $FF
SilphCo10Text_5a176: SilphCo10Text_5a176:
ld a, [$ffe0] ld a, [hUnlockedSilphCoDoors]
and a and a
ret z ret z
SetEvent EVENT_SILPH_CO_10_UNLOCKED_DOOR SetEvent EVENT_SILPH_CO_10_UNLOCKED_DOOR

View file

@ -35,14 +35,14 @@ SilphCo11Script_62137:
ld a, [hl] ld a, [hl]
ld c, a ld c, a
xor a xor a
ld [$ffe0], a ld [hUnlockedSilphCoDoors], a
pop hl pop hl
.asm_62143 .asm_62143
ld a, [hli] ld a, [hli]
cp $ff cp $ff
jr z, .asm_6215f jr z, .asm_6215f
push hl push hl
ld hl, $ffe0 ld hl, hUnlockedSilphCoDoors
inc [hl] inc [hl]
pop hl pop hl
cp b cp b
@ -60,11 +60,11 @@ SilphCo11Script_62137:
ret ret
.asm_6215f .asm_6215f
xor a xor a
ld [$ffe0], a ld [hUnlockedSilphCoDoors], a
ret ret
SilphCo11Script_62163: SilphCo11Script_62163:
ld a, [$ffe0] ld a, [hUnlockedSilphCoDoors]
and a and a
ret z ret z
SetEvent EVENT_SILPH_CO_11_UNLOCKED_DOOR SetEvent EVENT_SILPH_CO_11_UNLOCKED_DOOR

View file

@ -45,14 +45,14 @@ SilphCo2Script_59d43:
ld a, [hl] ld a, [hl]
ld c, a ld c, a
xor a xor a
ld [$ffe0], a ld [hUnlockedSilphCoDoors], a
pop hl pop hl
.asm_59d4f .asm_59d4f
ld a, [hli] ld a, [hli]
cp $ff cp $ff
jr z, .asm_59d6b jr z, .asm_59d6b
push hl push hl
ld hl, $ffe0 ld hl, hUnlockedSilphCoDoors
inc [hl] inc [hl]
pop hl pop hl
cp b cp b
@ -70,12 +70,12 @@ SilphCo2Script_59d43:
ret ret
.asm_59d6b .asm_59d6b
xor a xor a
ld [$ffe0], a ld [hUnlockedSilphCoDoors], a
ret ret
SilphCo2Script_59d6f: SilphCo2Script_59d6f:
EventFlagAddress hl, EVENT_SILPH_CO_2_UNLOCKED_DOOR1 EventFlagAddress hl, EVENT_SILPH_CO_2_UNLOCKED_DOOR1
ld a, [$ffe0] ld a, [hUnlockedSilphCoDoors]
and a and a
ret z ret z
cp $1 cp $1

View file

@ -39,7 +39,7 @@ SilphCo3GateCoords:
SilphCo3Script_59fad: SilphCo3Script_59fad:
EventFlagAddress hl, EVENT_SILPH_CO_3_UNLOCKED_DOOR1 EventFlagAddress hl, EVENT_SILPH_CO_3_UNLOCKED_DOOR1
ld a, [$ffe0] ld a, [hUnlockedSilphCoDoors]
and a and a
ret z ret z
cp $1 cp $1

View file

@ -45,14 +45,14 @@ SilphCo4Script_19d5d:
ld a, [hl] ld a, [hl]
ld c, a ld c, a
xor a xor a
ld [$ffe0], a ld [hUnlockedSilphCoDoors], a
pop hl pop hl
.asm_19d69 .asm_19d69
ld a, [hli] ld a, [hli]
cp $ff cp $ff
jr z, .asm_19d85 jr z, .asm_19d85
push hl push hl
ld hl, $ffe0 ld hl, hUnlockedSilphCoDoors
inc [hl] inc [hl]
pop hl pop hl
cp b cp b
@ -70,12 +70,12 @@ SilphCo4Script_19d5d:
ret ret
.asm_19d85 .asm_19d85
xor a xor a
ld [$ffe0], a ld [hUnlockedSilphCoDoors], a
ret ret
SilphCo4Script_19d89: SilphCo4Script_19d89:
EventFlagAddress hl, EVENT_SILPH_CO_4_UNLOCKED_DOOR1 EventFlagAddress hl, EVENT_SILPH_CO_4_UNLOCKED_DOOR1
ld a, [$ffe0] ld a, [hUnlockedSilphCoDoors]
and a and a
ret z ret z
cp $1 cp $1

View file

@ -49,7 +49,7 @@ SilphCo5GateCoords:
SilphCo5Script_19f9e: SilphCo5Script_19f9e:
EventFlagAddress hl, EVENT_SILPH_CO_5_UNLOCKED_DOOR1 EventFlagAddress hl, EVENT_SILPH_CO_5_UNLOCKED_DOOR1
ld a, [$ffe0] ld a, [hUnlockedSilphCoDoors]
and a and a
ret z ret z
cp $1 cp $1

View file

@ -28,7 +28,7 @@ SilphCo6GateCoords:
db $FF db $FF
SilphCo6Script_1a1e6: SilphCo6Script_1a1e6:
ld a, [$ffe0] ld a, [hUnlockedSilphCoDoors]
and a and a
ret z ret z
SetEvent EVENT_SILPH_CO_6_UNLOCKED_DOOR SetEvent EVENT_SILPH_CO_6_UNLOCKED_DOOR

View file

@ -55,14 +55,14 @@ SilphCo7Text_51bc8:
ld a, [hl] ld a, [hl]
ld c, a ld c, a
xor a xor a
ld [$ffe0], a ld [hUnlockedSilphCoDoors], a
pop hl pop hl
.asm_51bd4 .asm_51bd4
ld a, [hli] ld a, [hli]
cp $ff cp $ff
jr z, .asm_51bf0 jr z, .asm_51bf0
push hl push hl
ld hl, $ffe0 ld hl, hUnlockedSilphCoDoors
inc [hl] inc [hl]
pop hl pop hl
cp b cp b
@ -80,12 +80,12 @@ SilphCo7Text_51bc8:
ret ret
.asm_51bf0 .asm_51bf0
xor a xor a
ld [$ffe0], a ld [hUnlockedSilphCoDoors], a
ret ret
SilphCo7Text_51bf4: SilphCo7Text_51bf4:
EventFlagAddress hl, EVENT_SILPH_CO_7_UNLOCKED_DOOR1 EventFlagAddress hl, EVENT_SILPH_CO_7_UNLOCKED_DOOR1
ld a, [$ffe0] ld a, [hUnlockedSilphCoDoors]
and a and a
ret z ret z
cp $1 cp $1

View file

@ -35,14 +35,14 @@ SilphCo8Script_56541:
ld a, [hl] ld a, [hl]
ld c, a ld c, a
xor a xor a
ld [$ffe0], a ld [hUnlockedSilphCoDoors], a
pop hl pop hl
.asm_5654d .asm_5654d
ld a, [hli] ld a, [hli]
cp $ff cp $ff
jr z, .asm_56569 jr z, .asm_56569
push hl push hl
ld hl, $ffe0 ld hl, hUnlockedSilphCoDoors
inc [hl] inc [hl]
pop hl pop hl
cp b cp b
@ -60,11 +60,11 @@ SilphCo8Script_56541:
ret ret
.asm_56569 .asm_56569
xor a xor a
ld [$ffe0], a ld [hUnlockedSilphCoDoors], a
ret ret
SilphCo8Script_5656d: SilphCo8Script_5656d:
ld a, [$ffe0] ld a, [hUnlockedSilphCoDoors]
and a and a
ret z ret z
SetEvent EVENT_SILPH_CO_8_UNLOCKED_DOOR SetEvent EVENT_SILPH_CO_8_UNLOCKED_DOOR

View file

@ -65,14 +65,14 @@ SilphCo9Script_5d837:
ld a, [hl] ld a, [hl]
ld c, a ld c, a
xor a xor a
ld [$ffe0], a ld [hUnlockedSilphCoDoors], a
pop hl pop hl
.asm_5d843 .asm_5d843
ld a, [hli] ld a, [hli]
cp $ff cp $ff
jr z, .asm_5d85f jr z, .asm_5d85f
push hl push hl
ld hl, $ffe0 ld hl, hUnlockedSilphCoDoors
inc [hl] inc [hl]
pop hl pop hl
cp b cp b
@ -90,12 +90,12 @@ SilphCo9Script_5d837:
ret ret
.asm_5d85f .asm_5d85f
xor a xor a
ld [$ffe0], a ld [hUnlockedSilphCoDoors], a
ret ret
SilphCo9Script_5d863: SilphCo9Script_5d863:
EventFlagAddress hl, EVENT_SILPH_CO_9_UNLOCKED_DOOR1 EventFlagAddress hl, EVENT_SILPH_CO_9_UNLOCKED_DOOR1
ld a, [$ffe0] ld a, [hUnlockedSilphCoDoors]
and a and a
ret z ret z
cp $1 cp $1

View file

@ -59,14 +59,14 @@ ViridianCityScript_1903d:
ret ret
ViridianCityScript1: ViridianCityScript1:
ld a, [wSpriteStateData1 + $34] ld a, [wSprite03StateData1YPixels]
ld [$ffeb], a ld [hSpriteScreenYCoord], a
ld a, [wSpriteStateData1 + $36] ld a, [wSprite03StateData1XPixels]
ld [$ffec], a ld [hSpriteScreenXCoord], a
ld a, [wSpriteStateData2 + $34] ld a, [wSprite03StateData2MapY]
ld [$ffed], a ld [hSpriteMapYCoord], a
ld a, [wSpriteStateData2 + $35] ld a, [wSprite03StateData2MapX]
ld [$ffee], a ld [hSpriteMapXCoord], a
xor a xor a
ld [wListScrollOffset], a ld [wListScrollOffset], a
@ -82,14 +82,14 @@ ViridianCityScript1:
ret ret
ViridianCityScript2: ViridianCityScript2:
ld a, [$ffeb] ld a, [hSpriteScreenYCoord]
ld [wSpriteStateData1 + $34], a ld [wSprite03StateData1YPixels], a
ld a, [$ffec] ld a, [hSpriteScreenXCoord]
ld [wSpriteStateData1 + $36], a ld [wSprite03StateData1XPixels], a
ld a, [$ffed] ld a, [hSpriteMapYCoord]
ld [wSpriteStateData2 + $34], a ld [wSprite03StateData2MapY], a
ld a, [$ffee] ld a, [hSpriteMapXCoord]
ld [wSpriteStateData2 + $35], a ld [wSprite03StateData2MapX], a
call UpdateSprites call UpdateSprites
call Delay3 call Delay3
xor a xor a

View file

@ -32,7 +32,7 @@ FuchsiaHouse2Text1:
ld hl, WardenTeethText1 ld hl, WardenTeethText1
call PrintText call PrintText
ld a, GOLD_TEETH ld a, GOLD_TEETH
ld [$ffdb], a ld [hItemToRemoveID], a
callba RemoveItemByID callba RemoveItemByID
SetEvent EVENT_GAVE_GOLD_TEETH SetEvent EVENT_GAVE_GOLD_TEETH
.asm_60cba .asm_60cba

View file

@ -1985,7 +1985,7 @@ wSpriteOutputBitOffset:: ; determines where in the output byte the two bits are
ds 1 ds 1
wSpriteLoadFlags:: wSpriteLoadFlags::
; bit 0 determines used buffer (0 -> $a188, 1 -> $a310) ; bit 0 determines used buffer (0 -> sSpriteBuffer1, 1 -> sSpriteBuffer2)
; bit 1 loading last sprite chunk? (there are at most 2 chunks per load operation) ; bit 1 loading last sprite chunk? (there are at most 2 chunks per load operation)
ds 1 ds 1
wSpriteUnpackMode:: wSpriteUnpackMode::