diff options
Diffstat (limited to 'home')
-rw-r--r-- | home/audio.asm | 108 | ||||
-rw-r--r-- | home/battle.asm | 142 | ||||
-rw-r--r-- | home/battle_vars.asm | 111 | ||||
-rw-r--r-- | home/copy.asm | 32 | ||||
-rw-r--r-- | home/cry.asm | 10 | ||||
-rw-r--r-- | home/delay.asm | 4 | ||||
-rw-r--r-- | home/fade.asm | 2 | ||||
-rw-r--r-- | home/flag.asm | 4 | ||||
-rw-r--r-- | home/game_time.asm | 36 | ||||
-rw-r--r-- | home/init.asm | 6 | ||||
-rw-r--r-- | home/joypad.asm | 44 | ||||
-rw-r--r-- | home/lcd.asm | 4 | ||||
-rw-r--r-- | home/map.asm | 326 | ||||
-rw-r--r-- | home/map_objects.asm | 28 | ||||
-rw-r--r-- | home/menu.asm | 12 | ||||
-rw-r--r-- | home/mobile.asm | 6 | ||||
-rw-r--r-- | home/movement.asm | 6 | ||||
-rw-r--r-- | home/names.asm | 28 | ||||
-rw-r--r-- | home/pokedex_flags.asm | 8 | ||||
-rw-r--r-- | home/predef.asm | 20 | ||||
-rw-r--r-- | home/random.asm | 4 | ||||
-rw-r--r-- | home/rtc.asm | 2 | ||||
-rw-r--r-- | home/text.asm | 56 | ||||
-rw-r--r-- | home/tilemap.asm | 8 | ||||
-rw-r--r-- | home/time.asm | 22 | ||||
-rw-r--r-- | home/trainers.asm | 26 | ||||
-rw-r--r-- | home/vblank.asm | 30 | ||||
-rw-r--r-- | home/video.asm | 56 | ||||
-rw-r--r-- | home/window.asm | 2 |
29 files changed, 578 insertions, 565 deletions
diff --git a/home/audio.asm b/home/audio.asm index 44786ee29..2d6f27cda 100644 --- a/home/audio.asm +++ b/home/audio.asm @@ -55,14 +55,14 @@ UpdateSound:: ; 3b6a _LoadMusicByte:: ; 3b86 -; CurMusicByte = [a:de] +; wCurMusicByte = [a:de] GLOBAL LoadMusicByte ld [hROMBank], a ld [MBC3RomBank], a ld a, [de] - ld [CurMusicByte], a + ld [wCurMusicByte], a ld a, BANK(LoadMusicByte) ld [hROMBank], a @@ -168,13 +168,13 @@ endr inc hl ld a, [hli] - ld [CryPitch], a + ld [wCryPitch], a ld a, [hli] - ld [CryPitch + 1], a + ld [wCryPitch + 1], a ld a, [hli] - ld [CryLength], a + ld [wCryLength], a ld a, [hl] - ld [CryLength + 1], a + ld [wCryLength + 1], a ld a, BANK(_PlayCry) ld [hROMBank], a @@ -208,7 +208,7 @@ PlaySFX:: ; 3c23 jr nc, .play ; Does it have priority? - ld a, [CurSFX] + ld a, [wCurSFX] cp e jr c, .done @@ -220,7 +220,7 @@ PlaySFX:: ; 3c23 ld [MBC3RomBank], a ld a, e - ld [CurSFX], a + ld [wCurSFX], a call _PlaySFX pop af @@ -249,16 +249,16 @@ WaitSFX:: ; 3c55 push hl .wait - ld hl, Channel5Flags + ld hl, wChannel5Flags bit 0, [hl] jr nz, .wait - ld hl, Channel6Flags + ld hl, wChannel6Flags bit 0, [hl] jr nz, .wait - ld hl, Channel7Flags + ld hl, wChannel7Flags bit 0, [hl] jr nz, .wait - ld hl, Channel8Flags + ld hl, wChannel8Flags bit 0, [hl] jr nz, .wait @@ -271,16 +271,16 @@ IsSFXPlaying:: ; 3c74 ; The inverse of CheckSFX. push hl - ld hl, Channel5Flags + ld hl, wChannel5Flags bit 0, [hl] jr nz, .playing - ld hl, Channel6Flags + ld hl, wChannel6Flags bit 0, [hl] jr nz, .playing - ld hl, Channel7Flags + ld hl, wChannel7Flags bit 0, [hl] jr nz, .playing - ld hl, Channel8Flags + ld hl, wChannel8Flags bit 0, [hl] jr nz, .playing @@ -296,31 +296,31 @@ IsSFXPlaying:: ; 3c74 MaxVolume:: ; 3c97 ld a, MAX_VOLUME - ld [Volume], a + ld [wVolume], a ret ; 3c9d LowVolume:: ; 3c9d ld a, $33 ; 40% - ld [Volume], a + ld [wVolume], a ret ; 3ca3 VolumeOff:: ; 3ca3 xor a - ld [Volume], a + ld [wVolume], a ret ; 3ca8 Unused_FadeOutMusic:: ; 3ca8 ld a, 4 - ld [MusicFade], a + ld [wMusicFade], a ret ; 3cae FadeInMusic:: ; 3cae ld a, 4 | (1 << MUSIC_FADE_IN_F) - ld [MusicFade], a + ld [wMusicFade], a ret ; 3cb4 @@ -346,11 +346,11 @@ FadeToMapMusic:: ; 3cbc jr z, .done ld a, 8 - ld [MusicFade], a + ld [wMusicFade], a ld a, e - ld [MusicFadeID], a + ld [wMusicFadeID], a ld a, d - ld [MusicFadeID + 1], a + ld [wMusicFadeID + 1], a ld a, e ld [wMapMusic], a @@ -399,7 +399,7 @@ EnterMapMusic:: ; 3d03 xor a ld [wDontPlayMapMusicOnReload], a ld de, MUSIC_BICYCLE - ld a, [PlayerState] + ld a, [wPlayerState] cp PLAYER_BIKE jr z, .play call GetMapMusic_MaybeSpecial @@ -455,7 +455,7 @@ RestartMapMusic:: ; 3d47 ; 3d62 SpecialMapMusic:: ; 3d62 - ld a, [PlayerState] + ld a, [wPlayerState] cp PLAYER_SURF jr z, .surf cp PLAYER_SURF_PIKA @@ -480,10 +480,10 @@ SpecialMapMusic:: ; 3d62 ret .contest - ld a, [MapGroup] + ld a, [wMapGroup] cp GROUP_ROUTE_35_NATIONAL_PARK_GATE jr nz, .no - ld a, [MapNumber] + ld a, [wMapNumber] cp MAP_ROUTE_35_NATIONAL_PARK_GATE jr z, .ranking cp MAP_ROUTE_36_NATIONAL_PARK_GATE @@ -506,15 +506,15 @@ Unreferenced_Function3d9f:: ; 3d9f ; Places a BCD number at the ; upper center of the screen. ld a, 4 * TILE_WIDTH - ld [Sprite39YCoord], a - ld [Sprite40YCoord], a + ld [wVirtualOAMSprite38YCoord], a + ld [wVirtualOAMSprite39YCoord], a ld a, 10 * TILE_WIDTH - ld [Sprite39XCoord], a + ld [wVirtualOAMSprite38XCoord], a ld a, 11 * TILE_WIDTH - ld [Sprite40XCoord], a + ld [wVirtualOAMSprite39XCoord], a xor a - ld [Sprite39Attributes], a - ld [Sprite40Attributes], a + ld [wVirtualOAMSprite38Attributes], a + ld [wVirtualOAMSprite39Attributes], a ld a, [wc296] cp 100 jr nc, .max @@ -524,32 +524,32 @@ Unreferenced_Function3d9f:: ; 3d9f swap a and $f add "0" - ld [Sprite39TileID], a + ld [wVirtualOAMSprite38TileID], a ld a, b and $f add "0" - ld [Sprite40TileID], a + ld [wVirtualOAMSprite39TileID], a ret .max ld a, "9" - ld [Sprite39TileID], a - ld [Sprite40TileID], a + ld [wVirtualOAMSprite38TileID], a + ld [wVirtualOAMSprite39TileID], a ret ; 3dde CheckSFX:: ; 3dde ; Return carry if any SFX channels are active. - ld a, [Channel5Flags] + ld a, [wChannel5Flags] bit 0, a jr nz, .playing - ld a, [Channel6Flags] + ld a, [wChannel6Flags] bit 0, a jr nz, .playing - ld a, [Channel7Flags] + ld a, [wChannel7Flags] bit 0, a jr nz, .playing - ld a, [Channel8Flags] + ld a, [wChannel8Flags] bit 0, a jr nz, .playing and a @@ -561,8 +561,8 @@ CheckSFX:: ; 3dde TerminateExpBarSound:: ; 3dfe xor a - ld [Channel5Flags], a - ld [SoundInput], a + ld [wChannel5Flags], a + ld [wSoundInput], a ld [rNR10], a ld [rNR11], a ld [rNR12], a @@ -575,21 +575,21 @@ TerminateExpBarSound:: ; 3dfe ChannelsOff:: ; 3e10 ; Quickly turn off music channels xor a - ld [Channel1Flags], a - ld [Channel2Flags], a - ld [Channel3Flags], a - ld [Channel4Flags], a - ld [SoundInput], a + ld [wChannel1Flags], a + ld [wChannel2Flags], a + ld [wChannel3Flags], a + ld [wChannel4Flags], a + ld [wSoundInput], a ret ; 3e21 SFXChannelsOff:: ; 3e21 ; Quickly turn off sound effect channels xor a - ld [Channel5Flags], a - ld [Channel6Flags], a - ld [Channel7Flags], a - ld [Channel8Flags], a - ld [SoundInput], a + ld [wChannel5Flags], a + ld [wChannel6Flags], a + ld [wChannel7Flags], a + ld [wChannel8Flags], a + ld [wSoundInput], a ret ; 3e32 diff --git a/home/battle.asm b/home/battle.asm index 30096fd4a..e59b1e3b4 100644 --- a/home/battle.asm +++ b/home/battle.asm @@ -25,13 +25,13 @@ OpponentPartyAttr:: ; 3951 BattlePartyAttr:: ; 395d -; Get attribute a from the active BattleMon's party struct. +; Get attribute a from the party struct of the active battle mon. push bc ld c, a ld b, 0 - ld hl, PartyMons + ld hl, wPartyMons add hl, bc - ld a, [CurBattleMon] + ld a, [wCurBattleMon] call GetPartyLocation pop bc ret @@ -39,13 +39,13 @@ BattlePartyAttr:: ; 395d OTPartyAttr:: ; 396d -; Get attribute a from the active EnemyMon's party struct. +; Get attribute a from the party struct of the active enemy mon. push bc ld c, a ld b, 0 - ld hl, OTPartyMon1Species + ld hl, wOTPartyMon1Species add hl, bc - ld a, [CurOTMon] + ld a, [wCurOTMon] call GetPartyLocation pop bc ret @@ -54,8 +54,8 @@ OTPartyAttr:: ; 396d ResetDamage:: ; 397d xor a - ld [CurDamage], a - ld [CurDamage + 1], a + ld [wCurDamage], a + ld [wCurDamage + 1], a ret ; 3985 @@ -89,16 +89,16 @@ UpdateUserInParty:: ; 3995 UpdateBattleMonInParty:: ; 399c ; Update level, status, current HP - ld a, [CurBattleMon] + ld a, [wCurBattleMon] UpdateBattleMon:: ; 399f - ld hl, PartyMon1Level + ld hl, wPartyMon1Level call GetPartyLocation ld d, h ld e, l - ld hl, BattleMonLevel - ld bc, BattleMonMaxHP - BattleMonLevel + ld hl, wBattleMonLevel + ld bc, wBattleMonMaxHP - wBattleMonLevel jp CopyBytes ; 39b0 @@ -110,14 +110,14 @@ UpdateEnemyMonInParty:: ; 39b0 dec a ret z - ld a, [CurOTMon] - ld hl, OTPartyMon1Level + ld a, [wCurOTMon] + ld hl, wOTPartyMon1Level call GetPartyLocation ld d, h ld e, l - ld hl, EnemyMonLevel - ld bc, EnemyMonMaxHP - EnemyMonLevel + ld hl, wEnemyMonLevel + ld bc, wEnemyMonMaxHP - wEnemyMonLevel jp CopyBytes ; 39c9 @@ -136,100 +136,7 @@ UpdateBattleHuds:: ; 39d4 ; 39e1 -GetBattleVar:: ; 39e1 -; Preserves hl. - push hl - call GetBattleVarAddr - pop hl - ret -; 39e7 - -GetBattleVarAddr:: ; 39e7 -; Get variable from pair a, depending on whose turn it is. -; There are 21 variable pairs. - - push bc - - ld hl, .battlevarpairs - ld c, a - ld b, 0 - add hl, bc - add hl, bc - - ld a, [hli] - ld h, [hl] - ld l, a - -; Enemy turn uses the second byte instead. -; This lets battle variable calls be side-neutral. - ld a, [hBattleTurn] - and a - jr z, .getvar - inc hl - -.getvar -; var id - ld a, [hl] - ld c, a - ld b, 0 - - ld hl, .vars - add hl, bc - add hl, bc - - ld a, [hli] - ld h, [hl] - ld l, a - - ld a, [hl] - - pop bc - ret - -.battlevarpairs - dw .substatus1, .substatus2, .substatus3, .substatus4, .substatus5 - dw .substatus1opp, .substatus2opp, .substatus3opp, .substatus4opp, .substatus5opp - dw .status, .statusopp, .animation, .effect, .power, .type - dw .curmove, .lastcounter, .lastcounteropp, .lastmove, .lastmoveopp - -; player enemy -.substatus1 db PLAYER_SUBSTATUS_1, ENEMY_SUBSTATUS_1 -.substatus1opp db ENEMY_SUBSTATUS_1, PLAYER_SUBSTATUS_1 -.substatus2 db PLAYER_SUBSTATUS_2, ENEMY_SUBSTATUS_2 -.substatus2opp db ENEMY_SUBSTATUS_2, PLAYER_SUBSTATUS_2 -.substatus3 db PLAYER_SUBSTATUS_3, ENEMY_SUBSTATUS_3 -.substatus3opp db ENEMY_SUBSTATUS_3, PLAYER_SUBSTATUS_3 -.substatus4 db PLAYER_SUBSTATUS_4, ENEMY_SUBSTATUS_4 -.substatus4opp db ENEMY_SUBSTATUS_4, PLAYER_SUBSTATUS_4 -.substatus5 db PLAYER_SUBSTATUS_5, ENEMY_SUBSTATUS_5 -.substatus5opp db ENEMY_SUBSTATUS_5, PLAYER_SUBSTATUS_5 -.status db PLAYER_STATUS, ENEMY_STATUS -.statusopp db ENEMY_STATUS, PLAYER_STATUS -.animation db PLAYER_MOVE_ANIMATION, ENEMY_MOVE_ANIMATION -.effect db PLAYER_MOVE_EFFECT, ENEMY_MOVE_EFFECT -.power db PLAYER_MOVE_POWER, ENEMY_MOVE_POWER -.type db PLAYER_MOVE_TYPE, ENEMY_MOVE_TYPE -.curmove db PLAYER_CUR_MOVE, ENEMY_CUR_MOVE -.lastcounter db PLAYER_COUNTER_MOVE, ENEMY_COUNTER_MOVE -.lastcounteropp db ENEMY_COUNTER_MOVE, PLAYER_COUNTER_MOVE -.lastmove db PLAYER_LAST_MOVE, ENEMY_LAST_MOVE -.lastmoveopp db ENEMY_LAST_MOVE, PLAYER_LAST_MOVE - -.vars - dw PlayerSubStatus1, EnemySubStatus1 - dw PlayerSubStatus2, EnemySubStatus2 - dw PlayerSubStatus3, EnemySubStatus3 - dw PlayerSubStatus4, EnemySubStatus4 - dw PlayerSubStatus5, EnemySubStatus5 - dw BattleMonStatus, EnemyMonStatus - dw wPlayerMoveStructAnimation, wEnemyMoveStructAnimation - dw wPlayerMoveStructEffect, wEnemyMoveStructEffect - dw wPlayerMoveStructPower, wEnemyMoveStructPower - dw wPlayerMoveStructType, wEnemyMoveStructType - dw CurPlayerMove, CurEnemyMove - dw LastPlayerCounterMove, LastEnemyCounterMove - dw LastPlayerMove, LastEnemyMove -; 3a90 +INCLUDE "home/battle_vars.asm" FarCopyRadioText:: ; 3a90 @@ -293,8 +200,6 @@ BattleTextBox:: ; 3ac3 StdBattleTextBox:: ; 3ad5 ; Open a textbox and print battle text at 20:hl. -GLOBAL BattleText - ld a, [hROMBank] push af @@ -310,16 +215,13 @@ GLOBAL BattleText GetBattleAnimPointer:: ; 3ae1 -GLOBAL BattleAnimations -GLOBAL BattleAnimCommands - ld a, BANK(BattleAnimations) rst Bankswitch ld a, [hli] - ld [BattleAnimAddress], a + ld [wBattleAnimAddress], a ld a, [hl] - ld [BattleAnimAddress + 1], a + ld [wBattleAnimAddress + 1], a ld a, BANK(BattleAnimCommands) rst Bankswitch @@ -332,7 +234,7 @@ GetBattleAnimByte:: ; 3af0 push hl push de - ld hl, BattleAnimAddress + ld hl, wBattleAnimAddress ld e, [hl] inc hl ld d, [hl] @@ -341,7 +243,7 @@ GetBattleAnimByte:: ; 3af0 rst Bankswitch ld a, [de] - ld [BattleAnimByte], a + ld [wBattleAnimByte], a inc de ld a, BANK(BattleAnimCommands) @@ -354,6 +256,6 @@ GetBattleAnimByte:: ; 3af0 pop de pop hl - ld a, [BattleAnimByte] + ld a, [wBattleAnimByte] ret ; 3b0c diff --git a/home/battle_vars.asm b/home/battle_vars.asm new file mode 100644 index 000000000..44fc21d6d --- /dev/null +++ b/home/battle_vars.asm @@ -0,0 +1,111 @@ +GetBattleVar:: ; 39e1
+; Preserves hl.
+ push hl
+ call GetBattleVarAddr
+ pop hl
+ ret
+; 39e7
+
+GetBattleVarAddr:: ; 39e7
+; Get variable from pair a, depending on whose turn it is.
+; There are 21 variable pairs.
+
+ push bc
+
+ ld hl, .BattleVarPairs
+ ld c, a
+ ld b, 0
+ add hl, bc
+ add hl, bc
+
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+
+; Enemy turn uses the second byte instead.
+; This lets battle variable calls be side-neutral.
+ ld a, [hBattleTurn]
+ and a
+ jr z, .get_var
+ inc hl
+
+.get_var
+; var id
+ ld a, [hl]
+ ld c, a
+ ld b, 0
+
+ ld hl, .BattleVarPointers
+ add hl, bc
+ add hl, bc
+
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+
+ ld a, [hl]
+
+ pop bc
+ ret
+
+.BattleVarPairs:
+ dw .Substatus1
+ dw .Substatus2
+ dw .Substatus3
+ dw .Substatus4
+ dw .Substatus5
+ dw .Substatus1Opp
+ dw .Substatus2Opp
+ dw .Substatus3Opp
+ dw .Substatus4Opp
+ dw .Substatus5Opp
+ dw .Status
+ dw .StatusOpp
+ dw .MoveAnim
+ dw .MoveEffect
+ dw .MovePower
+ dw .MoveType
+ dw .CurMove
+ dw .LastCounter
+ dw .LastCounterOpp
+ dw .LastMove
+ dw .LastMoveOpp
+
+; player enemy
+.Substatus1: db PLAYER_SUBSTATUS_1, ENEMY_SUBSTATUS_1
+.Substatus1Opp: db ENEMY_SUBSTATUS_1, PLAYER_SUBSTATUS_1
+.Substatus2: db PLAYER_SUBSTATUS_2, ENEMY_SUBSTATUS_2
+.Substatus2Opp: db ENEMY_SUBSTATUS_2, PLAYER_SUBSTATUS_2
+.Substatus3: db PLAYER_SUBSTATUS_3, ENEMY_SUBSTATUS_3
+.Substatus3Opp: db ENEMY_SUBSTATUS_3, PLAYER_SUBSTATUS_3
+.Substatus4: db PLAYER_SUBSTATUS_4, ENEMY_SUBSTATUS_4
+.Substatus4Opp: db ENEMY_SUBSTATUS_4, PLAYER_SUBSTATUS_4
+.Substatus5: db PLAYER_SUBSTATUS_5, ENEMY_SUBSTATUS_5
+.Substatus5Opp: db ENEMY_SUBSTATUS_5, PLAYER_SUBSTATUS_5
+.Status: db PLAYER_STATUS, ENEMY_STATUS
+.StatusOpp: db ENEMY_STATUS, PLAYER_STATUS
+.MoveAnim: db PLAYER_MOVE_ANIMATION, ENEMY_MOVE_ANIMATION
+.MoveEffect: db PLAYER_MOVE_EFFECT, ENEMY_MOVE_EFFECT
+.MovePower: db PLAYER_MOVE_POWER, ENEMY_MOVE_POWER
+.MoveType: db PLAYER_MOVE_TYPE, ENEMY_MOVE_TYPE
+.CurMove: db PLAYER_CUR_MOVE, ENEMY_CUR_MOVE
+.LastCounter: db PLAYER_COUNTER_MOVE, ENEMY_COUNTER_MOVE
+.LastCounterOpp: db ENEMY_COUNTER_MOVE, PLAYER_COUNTER_MOVE
+.LastMove: db PLAYER_LAST_MOVE, ENEMY_LAST_MOVE
+.LastMoveOpp: db ENEMY_LAST_MOVE, PLAYER_LAST_MOVE
+
+.BattleVarPointers:
+ dw wPlayerSubStatus1, wEnemySubStatus1
+ dw wPlayerSubStatus2, wEnemySubStatus2
+ dw wPlayerSubStatus3, wEnemySubStatus3
+ dw wPlayerSubStatus4, wEnemySubStatus4
+ dw wPlayerSubStatus5, wEnemySubStatus5
+ dw wBattleMonStatus, wEnemyMonStatus
+ dw wPlayerMoveStructAnimation, wEnemyMoveStructAnimation
+ dw wPlayerMoveStructEffect, wEnemyMoveStructEffect
+ dw wPlayerMoveStructPower, wEnemyMoveStructPower
+ dw wPlayerMoveStructType, wEnemyMoveStructType
+ dw wCurPlayerMove, wCurEnemyMove
+ dw wLastPlayerCounterMove, wLastEnemyCounterMove
+ dw wLastPlayerMove, wLastEnemyMove
+; 3a90
diff --git a/home/copy.asm b/home/copy.asm index 33268b6bf..9bd79ce37 100644 --- a/home/copy.asm +++ b/home/copy.asm @@ -235,23 +235,23 @@ Request2bpp:: ; eba .NotMobile: ld a, e - ld [Requested2bppSource], a + ld [wRequested2bppSource], a ld a, d - ld [Requested2bppSource + 1], a + ld [wRequested2bppSource + 1], a ld a, l - ld [Requested2bppDest], a + ld [wRequested2bppDest], a ld a, h - ld [Requested2bppDest + 1], a + ld [wRequested2bppDest + 1], a .loop ld a, c ld hl, hTilesPerCycle cp [hl] jr nc, .iterate - ld [Requested2bpp], a + ld [wRequested2bpp], a .wait call DelayFrame - ld a, [Requested2bpp] + ld a, [wRequested2bpp] and a jr nz, .wait @@ -267,11 +267,11 @@ Request2bpp:: ; eba .iterate ld a, [hTilesPerCycle] - ld [Requested2bpp], a + ld [wRequested2bpp], a .wait2 call DelayFrame - ld a, [Requested2bpp] + ld a, [wRequested2bpp] and a jr nz, .wait2 @@ -311,23 +311,23 @@ Request1bpp:: ; f1e .NotMobile: ld a, e - ld [Requested1bppSource], a + ld [wRequested1bppSource], a ld a, d - ld [Requested1bppSource + 1], a + ld [wRequested1bppSource + 1], a ld a, l - ld [Requested1bppDest], a + ld [wRequested1bppDest], a ld a, h - ld [Requested1bppDest + 1], a + ld [wRequested1bppDest + 1], a .loop ld a, c ld hl, hTilesPerCycle cp [hl] jr nc, .iterate - ld [Requested1bpp], a + ld [wRequested1bpp], a .wait call DelayFrame - ld a, [Requested1bpp] + ld a, [wRequested1bpp] and a jr nz, .wait @@ -343,11 +343,11 @@ Request1bpp:: ; f1e .iterate ld a, [hTilesPerCycle] - ld [Requested1bpp], a + ld [wRequested1bpp], a .wait2 call DelayFrame - ld a, [Requested1bpp] + ld a, [wRequested1bpp] and a jr nz, .wait2 diff --git a/home/cry.asm b/home/cry.asm index 204b02ba4..93983a6ae 100644 --- a/home/cry.asm +++ b/home/cry.asm @@ -29,7 +29,7 @@ PlayMonCry2:: ; 37d5 push af xor a ld [wStereoPanningMask], a - ld [CryTracks], a + ld [wCryTracks], a pop af call _PlayMonCry ret @@ -76,13 +76,13 @@ endr inc hl ld a, [hli] - ld [CryPitch], a + ld [wCryPitch], a ld a, [hli] - ld [CryPitch + 1], a + ld [wCryPitch + 1], a ld a, [hli] - ld [CryLength], a + ld [wCryLength], a ld a, [hl] - ld [CryLength + 1], a + ld [wCryLength + 1], a pop af rst Bankswitch diff --git a/home/delay.asm b/home/delay.asm index 450b4190c..300f65c88 100644 --- a/home/delay.asm +++ b/home/delay.asm @@ -1,12 +1,12 @@ DelayFrame:: ; 45a ; Wait for one frame ld a, 1 - ld [VBlankOccurred], a + ld [wVBlankOccurred], a ; Wait for the next VBlank, halting to conserve battery .halt halt ; rgbasm adds a nop after this instruction by default - ld a, [VBlankOccurred] + ld a, [wVBlankOccurred] and a jr nz, .halt ret diff --git a/home/fade.asm b/home/fade.asm index d81a49c6c..1a6f87c63 100644 --- a/home/fade.asm +++ b/home/fade.asm @@ -3,7 +3,7 @@ Unreferenced_Function48c:: ; 48c ; TimeOfDayFade - ld a, [TimeOfDayPal] + ld a, [wTimeOfDayPal] ld b, a ld hl, IncGradGBPalTable_11 ld a, l diff --git a/home/flag.asm b/home/flag.asm index 5f1d783af..0b1390c99 100644 --- a/home/flag.asm +++ b/home/flag.asm @@ -1,6 +1,6 @@ ResetMapBufferEventFlags:: ; 2e50 xor a - ld hl, EventFlags + ld hl, wEventFlags ld [hli], a ret ; 2e56 @@ -29,7 +29,7 @@ ResetFlashIfOutOfCave:: ; 2e5d EventFlagAction:: ; 0x2e6f - ld hl, EventFlags + ld hl, wEventFlags call FlagAction ret diff --git a/home/game_time.asm b/home/game_time.asm index 36dcaa282..feaa09608 100644 --- a/home/game_time.asm +++ b/home/game_time.asm @@ -1,11 +1,11 @@ ResetGameTime:: ; 208a xor a - ld [GameTimeCap], a - ld [GameTimeHours], a - ld [GameTimeHours + 1], a - ld [GameTimeMinutes], a - ld [GameTimeSeconds], a - ld [GameTimeFrames], a + ld [wGameTimeCap], a + ld [wGameTimeHours], a + ld [wGameTimeHours + 1], a + ld [wGameTimeMinutes], a + ld [wGameTimeSeconds], a + ld [wGameTimeFrames], a ret ; 209e @@ -16,7 +16,7 @@ GameTimer:: ; 209e ld a, [rSVBK] push af - ld a, BANK(GameTime) + ld a, BANK(wGameTime) ld [rSVBK], a call UpdateGameTimer @@ -43,13 +43,13 @@ UpdateGameTimer:: ; 20ad ret z ; Is the timer already capped? - ld hl, GameTimeCap + ld hl, wGameTimeCap bit 0, [hl] ret nz ; +1 frame - ld hl, GameTimeFrames + ld hl, wGameTimeFrames ld a, [hl] inc a @@ -65,7 +65,7 @@ UpdateGameTimer:: ; 20ad ld [hl], a ; +1 second - ld hl, GameTimeSeconds + ld hl, wGameTimeSeconds ld a, [hl] inc a @@ -81,7 +81,7 @@ UpdateGameTimer:: ; 20ad ld [hl], a ; +1 minute - ld hl, GameTimeMinutes + ld hl, wGameTimeMinutes ld a, [hl] inc a @@ -97,9 +97,9 @@ UpdateGameTimer:: ; 20ad ld [hl], a ; +1 hour - ld a, [GameTimeHours] + ld a, [wGameTimeHours] ld h, a - ld a, [GameTimeHours + 1] + ld a, [wGameTimeHours + 1] ld l, a inc hl @@ -113,19 +113,19 @@ UpdateGameTimer:: ; 20ad cp LOW(1000) jr c, .ok - ld hl, GameTimeCap + ld hl, wGameTimeCap set 0, [hl] ld a, 59 ; 999:59:59.00 - ld [GameTimeMinutes], a - ld [GameTimeSeconds], a + ld [wGameTimeMinutes], a + ld [wGameTimeSeconds], a ret .ok ld a, h - ld [GameTimeHours], a + ld [wGameTimeHours], a ld a, l - ld [GameTimeHours + 1], a + ld [wGameTimeHours + 1], a ret ; 210f diff --git a/home/init.asm b/home/init.asm index d8e476c3f..ec541ad16 100644 --- a/home/init.asm +++ b/home/init.asm @@ -79,7 +79,7 @@ Init:: ; 17d or c jr nz, .ByteFill - ld sp, Stack + ld sp, wStack ; Clear HRAM ld a, [hCGB] @@ -103,10 +103,10 @@ Init:: ; 17d call ClearsScratch - ld a, BANK(LoadPushOAM) + ld a, BANK(WriteOAMDMACodeToHRAM) rst Bankswitch - call LoadPushOAM + call WriteOAMDMACodeToHRAM xor a ld [hMapAnims], a diff --git a/home/joypad.asm b/home/joypad.asm index 94d9610de..f46ab5c98 100644 --- a/home/joypad.asm +++ b/home/joypad.asm @@ -129,7 +129,7 @@ GetJoypad:: ; 984 ; The player input can be automated using an input stream. ; See more below. - ld a, [InputType] + ld a, [wInputType] cp AUTO_INPUT jr z, .auto @@ -173,22 +173,22 @@ GetJoypad:: ; 984 ; Read from the input stream. ld a, [hROMBank] push af - ld a, [AutoInputBank] + ld a, [wAutoInputBank] rst Bankswitch - ld hl, AutoInputAddress + ld hl, wAutoInputAddress ld a, [hli] ld h, [hl] ld l, a ; We only update when the input duration has expired. - ld a, [AutoInputLength] + ld a, [wAutoInputLength] and a jr z, .updateauto ; Until then, don't change anything. dec a - ld [AutoInputLength], a + ld [wAutoInputLength], a pop af rst Bankswitch jr .quit @@ -203,7 +203,7 @@ GetJoypad:: ; 984 ; A duration of $ff will end the stream indefinitely. ld a, [hli] - ld [AutoInputLength], a + ld [wAutoInputLength], a cp -1 jr nz, .next @@ -216,9 +216,9 @@ GetJoypad:: ; 984 .next ; On to the next input... ld a, l - ld [AutoInputAddress], a + ld [wAutoInputAddress], a ld a, h - ld [AutoInputAddress+1], a + ld [wAutoInputAddress+1], a jr .finishauto .stopauto @@ -238,14 +238,14 @@ GetJoypad:: ; 984 StartAutoInput:: ; 9ee ; Start reading automated input stream at a:hl. - ld [AutoInputBank], a + ld [wAutoInputBank], a ld a, l - ld [AutoInputAddress], a + ld [wAutoInputAddress], a ld a, h - ld [AutoInputAddress+1], a + ld [wAutoInputAddress+1], a ; Start reading the stream immediately. xor a - ld [AutoInputLength], a + ld [wAutoInputLength], a ; Reset input mirrors. xor a ld [hJoyPressed], a ; pressed this frame @@ -253,7 +253,7 @@ StartAutoInput:: ; 9ee ld [hJoyDown], a ; currently pressed ld a, AUTO_INPUT - ld [InputType], a + ld [wInputType], a ret ; a0a @@ -261,12 +261,12 @@ StartAutoInput:: ; 9ee StopAutoInput:: ; a0a ; Clear variables related to automated input. xor a - ld [AutoInputBank], a - ld [AutoInputAddress], a - ld [AutoInputAddress+1], a - ld [AutoInputLength], a + ld [wAutoInputBank], a + ld [wAutoInputAddress], a + ld [wAutoInputAddress+1], a + ld [wAutoInputLength], a ; Back to normal input. - ld [InputType], a + ld [wInputType], a ret ; a1b @@ -336,11 +336,11 @@ JoyTextDelay:: ; a57 and a jr z, .checkframedelay ld a, 15 - ld [TextDelayFrames], a + ld [wTextDelayFrames], a ret .checkframedelay - ld a, [TextDelayFrames] + ld a, [wTextDelayFrames] and a jr z, .restartframedelay xor a @@ -349,7 +349,7 @@ JoyTextDelay:: ; a57 .restartframedelay ld a, 5 - ld [TextDelayFrames], a + ld [wTextDelayFrames], a ret ; a80 @@ -411,7 +411,7 @@ ButtonSound:: ; aaf push af ld a, $1 ld [hOAMUpdate], a - ld a, [InputType] + ld a, [wInputType] or a jr z, .input_wait_loop farcall _DudeAutoInput_A diff --git a/home/lcd.asm b/home/lcd.asm index e2fb4c5a9..3899f0816 100644 --- a/home/lcd.asm +++ b/home/lcd.asm @@ -6,7 +6,7 @@ Unreferenced_Function547:: ; 547 cp rSCX - $ff00 ret nz ld c, a - ld a, [LYOverrides] + ld a, [wLYOverrides] ld [$ff00+c], a ret ; 552 @@ -22,7 +22,7 @@ LCD:: ; 552 push bc ld a, [rLY] ld c, a - ld b, HIGH(LYOverrides) + ld b, HIGH(wLYOverrides) ld a, [bc] ld b, a ld a, [hLCDCPointer] diff --git a/home/map.asm b/home/map.asm index a66391896..252b68cbe 100644 --- a/home/map.asm +++ b/home/map.asm @@ -29,9 +29,9 @@ GetCurrentMapSceneID:: ; 212a ; Grabs the wram map scene script pointer for the current map and loads it into wCurrMapSceneScriptPointer. ; If there is no scene, both bytes of wCurrMapSceneScriptPointer are wiped clean. ; Copy the current map group and number into bc. This is needed for GetMapSceneID. - ld a, [MapGroup] + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a ; Blank out wCurrMapSceneScriptPointer; this is the default scenario. xor a @@ -105,7 +105,7 @@ LoadMapPart:: ; 217a ld a, [hROMBank] push af - ld a, [TilesetBlocksBank] + ld a, [wTilesetBlocksBank] rst Bankswitch call LoadMetatiles @@ -145,13 +145,13 @@ LoadMetatiles:: ; 2198 ld a, [de] and a jr nz, .ok - ld a, [MapBorderBlock] + ld a, [wMapBorderBlock] .ok ; Load the current wMisc address into de. ld e, l ld d, h - ; Set hl to the address of the current metatile data ([TilesetBlocksAddress] + (a) tiles). + ; Set hl to the address of the current metatile data ([wTilesetBlocksAddress] + (a) tiles). ; This is buggy; it wraps around past 128 blocks. ; To fix, uncomment the line below. add a ; Comment or delete this line to fix the above bug. @@ -161,10 +161,10 @@ LoadMetatiles:: ; 2198 add hl, hl add hl, hl add hl, hl - ld a, [TilesetBlocksAddress] + ld a, [wTilesetBlocksAddress] add l ld l, a - ld a, [TilesetBlocksAddress + 1] + ld a, [wTilesetBlocksAddress + 1] adc h ld h, a @@ -200,7 +200,7 @@ endr ld de, WMISC_WIDTH * 4 add hl, de pop de - ld a, [MapWidth] + ld a, [wMapWidth] add 6 add e ld e, a @@ -259,10 +259,10 @@ GetDestinationWarpNumber:: ; 2252 ; 2266 .GetDestinationWarpNumber: ; 2266 - ld a, [PlayerStandingMapY] + ld a, [wPlayerStandingMapY] sub $4 ld e, a - ld a, [PlayerStandingMapX] + ld a, [wPlayerStandingMapX] sub $4 ld d, a ld a, [wCurrMapWarpCount] @@ -345,7 +345,7 @@ CopyWarpData:: ; 22a7 ld a, [hli] cp $ff jr nz, .skip - ld hl, BackupWarpNumber + ld hl, wBackupWarpNumber ld a, [hli] .skip @@ -358,9 +358,9 @@ CopyWarpData:: ; 22a7 ld a, c ld [wPrevWarp], a - ld a, [MapGroup] + ld a, [wMapGroup] ld [wPrevMapGroup], a - ld a, [MapNumber] + ld a, [wMapNumber] ld [wPrevMapNumber], a scf ret @@ -422,7 +422,7 @@ CopyMapDefAndData:: ; 2326 ReadMapEvents:: ; 2336 push af - ld hl, MapEventsPointer + ld hl, wMapEventsPointer ld a, [hli] ld h, [hl] ld l, a @@ -441,7 +441,7 @@ ReadMapEvents:: ; 2336 ; 234f ReadMapScripts:: ; 234f - ld hl, MapScriptsPointer + ld hl, wMapScriptsPointer ld a, [hli] ld h, [hl] ld l, a @@ -464,35 +464,35 @@ CopyMapData:: ; 235c GetMapConnections:: ; 2368 ld a, $ff - ld [NorthConnectedMapGroup], a - ld [SouthConnectedMapGroup], a - ld [WestConnectedMapGroup], a - ld [EastConnectedMapGroup], a + ld [wNorthConnectedMapGroup], a + ld [wSouthConnectedMapGroup], a + ld [wWestConnectedMapGroup], a + ld [wEastConnectedMapGroup], a - ld a, [MapConnections] + ld a, [wMapConnections] ld b, a bit NORTH_F, b jr z, .no_north - ld de, NorthMapConnection + ld de, wNorthMapConnection call GetMapConnection .no_north bit SOUTH_F, b jr z, .no_south - ld de, SouthMapConnection + ld de, wSouthMapConnection call GetMapConnection .no_south bit WEST_F, b jr z, .no_west - ld de, WestMapConnection + ld de, wWestMapConnection call GetMapConnection .no_west bit EAST_F, b jr z, .no_east - ld de, EastMapConnection + ld de, wEastMapConnection call GetMapConnection .no_east @@ -501,7 +501,7 @@ GetMapConnections:: ; 2368 GetMapConnection:: ; 23a3 ; Load map connection struct at hl into de. - ld c, SouthMapConnection - NorthMapConnection + ld c, wSouthMapConnection - wNorthMapConnection .loop ld a, [hli] ld [de], a @@ -601,7 +601,7 @@ ReadObjectEvents:: ; 241f push hl call ClearObjectStructs pop de - ld hl, Map1Object + ld hl, wMap1Object ld a, [de] inc de ld [wCurrMapObjectEventCount], a @@ -671,13 +671,13 @@ CopyMapObjectEvents:: ; 2457 ; 2471 ClearObjectStructs:: ; 2471 - ld hl, Object1Struct + ld hl, wObject1Struct ld bc, OBJECT_STRUCT_LENGTH * (NUM_OBJECT_STRUCTS - 1) xor a call ByteFill ; Just to make sure (this is rather pointless) - ld hl, Object1Struct + ld hl, wObject1Struct ld de, OBJECT_STRUCT_LENGTH ld c, NUM_OBJECT_STRUCTS - 1 xor a @@ -693,23 +693,23 @@ RestoreFacingAfterWarp:: ; 248a call GetMapScriptsBank rst Bankswitch - ld hl, MapEventsPointer + ld hl, wMapEventsPointer ld a, [hli] ld h, [hl] ld l, a inc hl ; get to the warp coords inc hl ; get to the warp coords inc hl ; get to the warp coords - ld a, [WarpNumber] + ld a, [wWarpNumber] dec a ld c, a ld b, 0 ld a, 5 call AddNTimes ld a, [hli] - ld [YCoord], a + ld [wYCoord], a ld a, [hli] - ld [XCoord], a + ld [wXCoord], a ; destination warp number ld a, [hli] cp $ff @@ -723,17 +723,17 @@ RestoreFacingAfterWarp:: ; 248a .backup ld a, [wPrevWarp] - ld [BackupWarpNumber], a + ld [wBackupWarpNumber], a ld a, [wPrevMapGroup] - ld [BackupMapGroup], a + ld [wBackupMapGroup], a ld a, [wPrevMapNumber] - ld [BackupMapNumber], a + ld [wBackupMapNumber], a ret ; 24cd LoadBlockData:: ; 24cd - ld hl, OverworldMap - ld bc, OverworldMapEnd - OverworldMap + ld hl, wOverworldMap + ld bc, wOverworldMapEnd - wOverworldMap ld a, 0 call ByteFill call ChangeMap @@ -747,8 +747,8 @@ ChangeMap:: ; 24e4 ld a, [hROMBank] push af - ld hl, OverworldMap - ld a, [MapWidth] + ld hl, wOverworldMap + ld a, [wMapWidth] ld [hConnectedMapWidth], a add $6 ld [hConnectionStripLength], a @@ -759,14 +759,14 @@ ChangeMap:: ; 24e4 add hl, bc ld c, 3 add hl, bc - ld a, [MapBlocksBank] + ld a, [wMapBlocksBank] rst Bankswitch - ld a, [MapBlocksPointer] + ld a, [wMapBlocksPointer] ld e, a - ld a, [MapBlocksPointer + 1] + ld a, [wMapBlocksPointer + 1] ld d, a - ld a, [MapHeight] + ld a, [wMapHeight] ld b, a .row push hl @@ -796,94 +796,94 @@ ChangeMap:: ; 24e4 FillMapConnections:: ; 2524 ; North - ld a, [NorthConnectedMapGroup] + ld a, [wNorthConnectedMapGroup] cp $ff jr z, .South ld b, a - ld a, [NorthConnectedMapNumber] + ld a, [wNorthConnectedMapNumber] ld c, a call GetAnyMapBlocksBank - ld a, [NorthConnectionStripPointer] + ld a, [wNorthConnectionStripPointer] ld l, a - ld a, [NorthConnectionStripPointer + 1] + ld a, [wNorthConnectionStripPointer + 1] ld h, a - ld a, [NorthConnectionStripLocation] + ld a, [wNorthConnectionStripLocation] ld e, a - ld a, [NorthConnectionStripLocation + 1] + ld a, [wNorthConnectionStripLocation + 1] ld d, a - ld a, [NorthConnectionStripLength] + ld a, [wNorthConnectionStripLength] ld [hConnectionStripLength], a - ld a, [NorthConnectedMapWidth] + ld a, [wNorthConnectedMapWidth] ld [hConnectedMapWidth], a call FillNorthConnectionStrip .South: - ld a, [SouthConnectedMapGroup] + ld a, [wSouthConnectedMapGroup] cp $ff jr z, .West ld b, a - ld a, [SouthConnectedMapNumber] + ld a, [wSouthConnectedMapNumber] ld c, a call GetAnyMapBlocksBank - ld a, [SouthConnectionStripPointer] + ld a, [wSouthConnectionStripPointer] ld l, a - ld a, [SouthConnectionStripPointer + 1] + ld a, [wSouthConnectionStripPointer + 1] ld h, a - ld a, [SouthConnectionStripLocation] + ld a, [wSouthConnectionStripLocation] ld e, a - ld a, [SouthConnectionStripLocation + 1] + ld a, [wSouthConnectionStripLocation + 1] ld d, a - ld a, [SouthConnectionStripLength] + ld a, [wSouthConnectionStripLength] ld [hConnectionStripLength], a - ld a, [SouthConnectedMapWidth] + ld a, [wSouthConnectedMapWidth] ld [hConnectedMapWidth], a call FillSouthConnectionStrip .West: - ld a, [WestConnectedMapGroup] + ld a, [wWestConnectedMapGroup] cp $ff jr z, .East ld b, a - ld a, [WestConnectedMapNumber] + ld a, [wWestConnectedMapNumber] ld c, a call GetAnyMapBlocksBank - ld a, [WestConnectionStripPointer] + ld a, [wWestConnectionStripPointer] ld l, a - ld a, [WestConnectionStripPointer + 1] + ld a, [wWestConnectionStripPointer + 1] ld h, a - ld a, [WestConnectionStripLocation] + ld a, [wWestConnectionStripLocation] ld e, a - ld a, [WestConnectionStripLocation + 1] + ld a, [wWestConnectionStripLocation + 1] ld d, a - ld a, [WestConnectionStripLength] + ld a, [wWestConnectionStripLength] ld b, a - ld a, [WestConnectedMapWidth] + ld a, [wWestConnectedMapWidth] ld [hConnectionStripLength], a call FillWestConnectionStrip .East: - ld a, [EastConnectedMapGroup] + ld a, [wEastConnectedMapGroup] cp $ff jr z, .Done ld b, a - ld a, [EastConnectedMapNumber] + ld a, [wEastConnectedMapNumber] ld c, a call GetAnyMapBlocksBank - ld a, [EastConnectionStripPointer] + ld a, [wEastConnectionStripPointer] ld l, a - ld a, [EastConnectionStripPointer + 1] + ld a, [wEastConnectionStripPointer + 1] ld h, a - ld a, [EastConnectionStripLocation] + ld a, [wEastConnectionStripLocation] ld e, a - ld a, [EastConnectionStripLocation + 1] + ld a, [wEastConnectionStripLocation + 1] ld d, a - ld a, [EastConnectionStripLength] + ld a, [wEastConnectionStripLength] ld b, a - ld a, [EastConnectedMapWidth] + ld a, [wEastConnectedMapWidth] ld [hConnectionStripLength], a call FillEastConnectionStrip @@ -915,7 +915,7 @@ FillSouthConnectionStrip:: ; 25d3 add hl, de pop de - ld a, [MapWidth] + ld a, [wMapWidth] add 6 add e ld e, a @@ -931,7 +931,7 @@ FillWestConnectionStrip:: FillEastConnectionStrip:: ; 25f6 .loop - ld a, [MapWidth] + ld a, [wMapWidth] add 6 ld [hConnectedMapWidth], a @@ -967,21 +967,21 @@ FillEastConnectionStrip:: ; 25f6 ; 261b LoadMapStatus:: ; 261b - ld [MapStatus], a + ld [wMapStatus], a ret ; 261f CallScript:: ; 261f ; Call a script at a:hl. - ld [ScriptBank], a + ld [wScriptBank], a ld a, l - ld [ScriptPos], a + ld [wScriptPos], a ld a, h - ld [ScriptPos + 1], a + ld [wScriptPos + 1], a ld a, PLAYEREVENT_MAPSCRIPT - ld [ScriptRunning], a + ld [wScriptRunning], a scf ret @@ -989,7 +989,7 @@ CallScript:: ; 261f CallMapScript:: ; 2631 ; Call a script at hl in the current bank if there isn't already a script running - ld a, [ScriptRunning] + ld a, [wScriptRunning] and a ret nz call GetMapScriptsBank @@ -1051,18 +1051,18 @@ RunMapCallback:: ; 263b ExecuteCallbackScript:: ; 2674 ; Do map callback de and return to script bank b. farcall CallCallback - ld a, [ScriptMode] + ld a, [wScriptMode] push af - ld hl, ScriptFlags + ld hl, wScriptFlags ld a, [hl] push af set 1, [hl] farcall EnableScriptMode farcall ScriptEvents pop af - ld [ScriptFlags], a + ld [wScriptFlags], a pop af - ld [ScriptMode], a + ld [wScriptMode], a ret ; 269a @@ -1126,16 +1126,16 @@ GetMovementData:: ; 26c7 ; 26d4 GetScriptByte:: ; 0x26d4 -; Return byte at ScriptBank:ScriptPos in a. +; Return byte at wScriptBank:wScriptPos in a. push hl push bc ld a, [hROMBank] push af - ld a, [ScriptBank] + ld a, [wScriptBank] rst Bankswitch - ld hl, ScriptPos + ld hl, wScriptPos ld c, [hl] inc hl ld b, [hl] @@ -1215,7 +1215,7 @@ UnmaskObject:: ; 271e ScrollMapDown:: ; 272a hlcoord 0, 0 - ld de, BGMapBuffer + ld de, wBGMapBuffer call BackupBGMapRow ld c, 2 * SCREEN_WIDTH call FarCallScrollBGMapPalettes @@ -1231,7 +1231,7 @@ ScrollMapDown:: ; 272a ScrollMapUp:: ; 2748 hlcoord 0, SCREEN_HEIGHT - 2 - ld de, BGMapBuffer + ld de, wBGMapBuffer call BackupBGMapRow ld c, 2 * SCREEN_WIDTH call FarCallScrollBGMapPalettes @@ -1255,7 +1255,7 @@ ScrollMapUp:: ; 2748 ScrollMapRight:: ; 2771 hlcoord 0, 0 - ld de, BGMapBuffer + ld de, wBGMapBuffer call BackupBGMapColumn ld c, 2 * SCREEN_HEIGHT call FarCallScrollBGMapPalettes @@ -1271,7 +1271,7 @@ ScrollMapRight:: ; 2771 ScrollMapLeft:: ; 278f hlcoord SCREEN_WIDTH - 2, 0 - ld de, BGMapBuffer + ld de, wBGMapBuffer call BackupBGMapColumn ld c, 2 * SCREEN_HEIGHT call FarCallScrollBGMapPalettes @@ -1325,7 +1325,7 @@ BackupBGMapColumn:: ; 27c0 ; 27d3 UpdateBGMapRow:: ; 27d3 - ld hl, BGMapBufferPtrs + ld hl, wBGMapBufferPtrs push de call .iteration pop de @@ -1357,7 +1357,7 @@ UpdateBGMapRow:: ; 27d3 ; 27f8 UpdateBGMapColumn:: ; 27f8 - ld hl, BGMapBufferPtrs + ld hl, wBGMapBufferPtrs ld c, SCREEN_HEIGHT .loop ld a, e @@ -1384,19 +1384,19 @@ UpdateBGMapColumn:: ; 27f8 ; 2816 Unreferenced_Function2816:: - ld hl, BGMapBuffer - ld bc, BGMapBufferEnd - BGMapBuffer + ld hl, wBGMapBuffer + ld bc, wBGMapBufferEnd - wBGMapBuffer xor a call ByteFill ret ; 2821 LoadTilesetGFX:: ; 2821 - ld hl, TilesetAddress + ld hl, wTilesetAddress ld a, [hli] ld h, [hl] ld l, a - ld a, [TilesetBank] + ld a, [wTilesetBank] ld e, a ld a, [rSVBK] @@ -1430,7 +1430,7 @@ LoadTilesetGFX:: ; 2821 ld [rSVBK], a ; These tilesets support dynamic per-mapgroup roof tiles. - ld a, [wTileset] + ld a, [wMapTileset] cp TILESET_JOHTO jr z, .load_roof cp TILESET_JOHTO_MODERN @@ -1466,7 +1466,7 @@ BufferScreen:: ; 2879 dec b jr nz, .col pop hl - ld a, [MapWidth] + ld a, [wMapWidth] add $6 ld c, a ld b, $0 @@ -1483,7 +1483,7 @@ SaveScreen:: ; 289d ld h, [hl] ld l, a ld de, wScreenSave - ld a, [MapWidth] + ld a, [wMapWidth] add 6 ld [hMapObjectIndexBuffer], a ld a, [wPlayerStepDirection] @@ -1529,7 +1529,7 @@ LoadNeighboringBlockData:: ; 28e3 ld a, [hli] ld h, [hl] ld l, a - ld a, [MapWidth] + ld a, [wMapWidth] add 6 ld [hConnectionStripLength], a ld de, wScreenSave @@ -1568,20 +1568,20 @@ SaveScreen_LoadNeighbor:: ; 28f7 GetMovementPermissions:: ; 2914 xor a - ld [TilePermissions], a + ld [wTilePermissions], a call .LeftRight call .UpDown ; get coords of current tile - ld a, [PlayerStandingMapX] + ld a, [wPlayerStandingMapX] ld d, a - ld a, [PlayerStandingMapY] + ld a, [wPlayerStandingMapY] ld e, a call GetCoordTile - ld [PlayerStandingTile], a + ld [wPlayerStandingTile], a call .CheckHiNybble ret nz - ld a, [PlayerStandingTile] + ld a, [wPlayerStandingTile] and 7 ld hl, .MovementPermissionsData add l @@ -1590,7 +1590,7 @@ GetMovementPermissions:: ; 2914 adc h ld h, a ld a, [hl] - ld hl, TilePermissions + ld hl, wTilePermissions or [hl] ld [hl], a ret @@ -1608,41 +1608,41 @@ GetMovementPermissions:: ; 2914 ; 294d .UpDown: - ld a, [PlayerStandingMapX] + ld a, [wPlayerStandingMapX] ld d, a - ld a, [PlayerStandingMapY] + ld a, [wPlayerStandingMapY] ld e, a push de inc e call GetCoordTile - ld [TileDown], a + ld [wTileDown], a call .Down pop de dec e call GetCoordTile - ld [TileUp], a + ld [wTileUp], a call .Up ret ; 296c .LeftRight: - ld a, [PlayerStandingMapX] + ld a, [wPlayerStandingMapX] ld d, a - ld a, [PlayerStandingMapY] + ld a, [wPlayerStandingMapY] ld e, a push de dec d call GetCoordTile - ld [TileLeft], a + ld [wTileLeft], a call .Left pop de inc d call GetCoordTile - ld [TileRight], a + ld [wTileRight], a call .Right ret ; 298b @@ -1650,7 +1650,7 @@ GetMovementPermissions:: ; 2914 .Down: call .CheckHiNybble ret nz - ld a, [TileDown] + ld a, [wTileDown] and 7 cp $2 jr z, .ok_down @@ -1660,16 +1660,16 @@ GetMovementPermissions:: ; 2914 ret nz .ok_down - ld a, [TilePermissions] + ld a, [wTilePermissions] or FACE_DOWN - ld [TilePermissions], a + ld [wTilePermissions], a ret ; 29a8 .Up: call .CheckHiNybble ret nz - ld a, [TileUp] + ld a, [wTileUp] and 7 cp $3 jr z, .ok_up @@ -1679,16 +1679,16 @@ GetMovementPermissions:: ; 2914 ret nz .ok_up - ld a, [TilePermissions] + ld a, [wTilePermissions] or FACE_UP - ld [TilePermissions], a + ld [wTilePermissions], a ret ; 29c5 .Right: call .CheckHiNybble ret nz - ld a, [TileRight] + ld a, [wTileRight] and 7 cp $1 jr z, .ok_right @@ -1698,16 +1698,16 @@ GetMovementPermissions:: ; 2914 ret nz .ok_right - ld a, [TilePermissions] + ld a, [wTilePermissions] or FACE_RIGHT - ld [TilePermissions], a + ld [wTilePermissions], a ret ; 29e2 .Left: call .CheckHiNybble ret nz - ld a, [TileLeft] + ld a, [wTileLeft] and 7 cp $0 jr z, .ok_left @@ -1717,9 +1717,9 @@ GetMovementPermissions:: ; 2914 ret nz .ok_left - ld a, [TilePermissions] + ld a, [wTilePermissions] or FACE_LEFT - ld [TilePermissions], a + ld [wTilePermissions], a ret ; 29ff @@ -1735,7 +1735,7 @@ GetFacingTileCoord:: ; 2a07 ; Return map coordinates in (d, e) and tile id in a ; of the tile the player is facing. - ld a, [PlayerDirection] + ld a, [wPlayerDirection] and %1100 srl a srl a @@ -1755,10 +1755,10 @@ GetFacingTileCoord:: ; 2a07 ld h, [hl] ld l, a - ld a, [PlayerStandingMapX] + ld a, [wPlayerStandingMapX] add d ld d, a - ld a, [PlayerStandingMapY] + ld a, [wPlayerStandingMapY] add e ld e, a ld a, [hl] @@ -1767,13 +1767,13 @@ GetFacingTileCoord:: ; 2a07 .Directions: ; x, y db 0, 1 - dw TileDown + dw wTileDown db 0, -1 - dw TileUp + dw wTileUp db -1, 0 - dw TileLeft + dw wTileLeft db 1, 0 - dw TileRight + dw wTileRight ; 2a3c GetCoordTile:: ; 2a3c @@ -1786,9 +1786,9 @@ GetCoordTile:: ; 2a3c ld h, $0 add hl, hl add hl, hl - ld a, [TilesetCollisionAddress] + ld a, [wTilesetCollisionAddress] ld c, a - ld a, [TilesetCollisionAddress + 1] + ld a, [wTilesetCollisionAddress + 1] ld b, a add hl, bc rr d @@ -1802,7 +1802,7 @@ GetCoordTile:: ; 2a3c inc hl .nocarry2 - ld a, [TilesetCollisionBank] + ld a, [wTilesetCollisionBank] call GetFarByte ret @@ -1812,11 +1812,11 @@ GetCoordTile:: ; 2a3c ; 2a66 GetBlockLocation:: ; 2a66 - ld a, [MapWidth] + ld a, [wMapWidth] add 6 ld c, a ld b, 0 - ld hl, OverworldMap + 1 + ld hl, wOverworldMap + 1 add hl, bc ld a, e srl a @@ -1869,7 +1869,7 @@ CheckFacingBGEvent:: ; 2a8b ; 2aaa CheckIfFacingTileCoordIsBGEvent:: ; 2aaa -; Checks to see if you are facing a BG event. If so, copies it into EngineBuffer1 and sets carry. +; Checks to see if you are facing a BG event. If so, copies it into wEngineBuffer1 and sets carry. ld hl, wCurrMapBGEventsPointer ld a, [hli] ld h, [hl] @@ -1924,7 +1924,7 @@ CheckCurrentMapCoordEvents:: ; 2ad4 ret .CoordEventCheck: -; Checks to see if you are standing on a coord event. If yes, copies the event to EngineBuffer1 and sets carry. +; Checks to see if you are standing on a coord event. If yes, copies the event to wEngineBuffer1 and sets carry. ld hl, wCurrMapCoordEventsPointer ld a, [hli] ld h, [hl] @@ -1933,10 +1933,10 @@ CheckCurrentMapCoordEvents:: ; 2ad4 call CheckScenes ld b, a ; Load your current coordinates into de. This will be used to check if your position is in the coord event table for the current map. - ld a, [PlayerStandingMapX] + ld a, [wPlayerStandingMapX] sub 4 ld d, a - ld a, [PlayerStandingMapY] + ld a, [wPlayerStandingMapY] sub 4 ld e, a @@ -2025,7 +2025,7 @@ ReturnToMapWithSpeechTextbox:: ; 0x2b74 hlcoord 0, 12 lb bc, 4, 18 call TextBox - ld hl, VramState + ld hl, wVramState set 0, [hl] call UpdateSprites call WaitBGMap2 @@ -2048,9 +2048,9 @@ ReloadTilesetAndPalettes:: ; 2bae call LoadFontsExtra ld a, [hROMBank] push af - ld a, [MapGroup] + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a call SwitchToAnyMapDataBank farcall UpdateTimeOfDayPal @@ -2066,9 +2066,9 @@ ReloadTilesetAndPalettes:: ; 2bae ; 2be5 GetMapDefPointer:: ; 2be5 - ld a, [MapGroup] + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a GetAnyMapDefPointer:: ; 0x2bed ; Prior to calling this function, you must have switched banks so that @@ -2112,9 +2112,9 @@ GetMapDefField:: ; 0x2c04 ; bc = data from the current map's map_def ; (e.g., de = MAPDEF_TILESET would return a pointer to the tileset id) - ld a, [MapGroup] + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a GetAnyMapDefField:: ; 0x2c0c ; bankswitch @@ -2136,9 +2136,9 @@ GetAnyMapDefField:: ; 0x2c0c ; 0x2c1c SwitchToMapDataBank:: ; 2c1c - ld a, [MapGroup] + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a SwitchToAnyMapDataBank:: ; 2c24 call GetAnyMapDataBank @@ -2147,9 +2147,9 @@ SwitchToAnyMapDataBank:: ; 2c24 ; 2c29 GetMapDataBank:: ; 2c29 - ld a, [MapGroup] + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a GetAnyMapDataBank:: ; 2c31 push hl @@ -2181,13 +2181,13 @@ PartialCopyMapDef:: ; 2c3d ; 2c52 SwitchToMapScriptsBank:: ; 2c52 - ld a, [MapScriptsBank] + ld a, [wMapScriptsBank] rst Bankswitch ret ; 2c57 GetMapScriptsBank:: ; 2c57 - ld a, [MapScriptsBank] + ld a, [wMapScriptsBank] ret ; 2c5b @@ -2377,12 +2377,12 @@ LoadTileset:: ; 2d27 push bc ld hl, Tilesets - ld bc, TilesetEnd - Tileset - ld a, [wTileset] + ld bc, wTilesetEnd - wTileset + ld a, [wMapTileset] call AddNTimes - ld de, TilesetBank - ld bc, TilesetEnd - Tileset + ld de, wTilesetBank + ld bc, wTilesetEnd - wTileset ld a, BANK(Tilesets) call FarCopyBytes diff --git a/home/map_objects.asm b/home/map_objects.asm index 1db2bb3ba..97e4bae37 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -18,7 +18,7 @@ GetSpritePalette:: ; 17ff GetSpriteVTile:: ; 180e push hl push bc - ld hl, UsedSprites + 2 + ld hl, wUsedSprites + 2 ld c, SPRITE_GFX_LIST_CAPACITY - 1 ld b, a ld a, [hMapObjectIndexBuffer] @@ -32,12 +32,12 @@ GetSpriteVTile:: ; 180e inc hl dec c jr nz, .loop - ld a, [UsedSprites + 1] + ld a, [wUsedSprites + 1] scf jr .done .nope - ld a, [UsedSprites + 1] + ld a, [wUsedSprites + 1] jr .done .found @@ -75,14 +75,14 @@ DoesSpriteHaveFacings:: ; 1836 ; 184a GetPlayerStandingTile:: ; 184a - ld a, [PlayerStandingTile] + ld a, [wPlayerStandingTile] call GetTileCollision ld b, a ret ; 1852 CheckOnWater:: ; 1852 - ld a, [PlayerStandingTile] + ld a, [wPlayerStandingTile] call GetTileCollision sub WATERTILE ret z @@ -204,7 +204,7 @@ CheckWaterfallTile:: ; 18bd ; 18c3 CheckStandingOnEntrance:: ; 18c3 - ld a, [PlayerStandingTile] + ld a, [wPlayerStandingTile] cp COLL_DOOR ret z cp COLL_DOOR_79 @@ -217,7 +217,7 @@ CheckStandingOnEntrance:: ; 18c3 GetMapObject:: ; 18d2 ; Return the location of map object a in bc. - ld hl, MapObjects + ld hl, wMapObjects ld bc, OBJECT_LENGTH call AddNTimes ld b, h @@ -256,7 +256,7 @@ CheckObjectTime:: ; 18f5 cp -1 jr z, .timeofday_always ld hl, .TimeOfDayValues_191e - ld a, [TimeOfDay] + ld a, [wTimeOfDay] add l ld l, a jr nc, .ok @@ -434,7 +434,7 @@ LoadMovementDataPointer:: ; 19e9 add hl, bc ld [hl], STEP_TYPE_00 - ld hl, VramState + ld hl, wVramState set 7, [hl] and a ret @@ -446,7 +446,7 @@ FindFirstEmptyObjectStruct:: ; 1a13 ; Preserves BC and DE. push bc push de - ld hl, ObjectStructs + ld hl, wObjectStructs ld de, OBJECT_STRUCT_LENGTH ld c, NUM_OBJECT_STRUCTS .loop @@ -604,19 +604,19 @@ _GetMovementByte:: ; 1aae ; 1ac6 SetVramState_Bit0:: ; 1ac6 - ld hl, VramState + ld hl, wVramState set 0, [hl] ret ; 1acc ResetVramState_Bit0:: ; 1acc - ld hl, VramState + ld hl, wVramState res 0, [hl] ret ; 1ad2 UpdateSprites:: ; 1ad2 - ld a, [VramState] + ld a, [wVramState] bit 0, a ret z @@ -627,7 +627,7 @@ UpdateSprites:: ; 1ad2 GetObjectStruct:: ; 1ae5 ld bc, OBJECT_STRUCT_LENGTH - ld hl, ObjectStructs + ld hl, wObjectStructs call AddNTimes ld b, h ld c, l diff --git a/home/menu.asm b/home/menu.asm index f8ade3f58..ae3252e96 100644 --- a/home/menu.asm +++ b/home/menu.asm @@ -315,7 +315,7 @@ RunMenuItemPrintingFunction:: ; 1eda ld a, [de] cp -1 ret z - ld [MenuSelection], a + ld [wMenuSelection], a push de push hl ld d, h @@ -405,7 +405,7 @@ ContinueGettingMenuJoypad: ld h, $0 add hl, de ld a, [hl] - ld [MenuSelection], a + ld [wMenuSelection], a ld a, [wMenuCursorY] ld [wMenuCursorBuffer], a and a @@ -415,7 +415,7 @@ ContinueGettingMenuJoypad: ld a, B_BUTTON ld [wMenuJoypad], a ld a, -1 - ld [MenuSelection], a + ld [wMenuSelection], a scf ret ; 1f79 @@ -426,7 +426,7 @@ PlaceMenuStrings:: ; 1f79 ld a, [hli] ld h, [hl] ld l, a - ld a, [MenuSelection] + ld a, [wMenuSelection] call GetNthString ld d, h ld e, l @@ -437,7 +437,7 @@ PlaceMenuStrings:: ; 1f79 PlaceNthMenuStrings:: ; 1f8d push de - ld a, [MenuSelection] + ld a, [wMenuSelection] call GetMenuDataPointerTableEntry inc hl inc hl @@ -460,7 +460,7 @@ Unreferenced_Function1f9e:: ; 1f9e ; 1fa7 MenuJumptable:: ; 1fa7 - ld a, [MenuSelection] + ld a, [wMenuSelection] call GetMenuDataPointerTableEntry ld a, [hli] ld h, [hl] diff --git a/home/mobile.asm b/home/mobile.asm index 1248c3f7e..4be526bbc 100644 --- a/home/mobile.asm +++ b/home/mobile.asm @@ -146,7 +146,7 @@ Unreferenced_Function3ed7:: ; 3ed7 Function3eea:: ; 3eea push hl push bc - ld de, AttrMap - TileMap + ld de, wAttrMap - wTileMap add hl, de inc b inc b @@ -173,7 +173,7 @@ Unreferenced_Function3efd:: ; 3efd .fill_attr push hl push bc - ld de, AttrMap - TileMap + ld de, wAttrMap - wTileMap add hl, de inc b inc b @@ -187,7 +187,7 @@ Unreferenced_Function3efd:: ; 3efd ; 3f20 Function3f20:: ; 3f20 - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ld b, 6 ld c, 20 call Function3f35 diff --git a/home/movement.asm b/home/movement.asm index a7c9dbb5b..c2c45d12b 100644 --- a/home/movement.asm +++ b/home/movement.asm @@ -4,9 +4,9 @@ InitMovementBuffer:: ; 1b1e ld [wMovementBufferCount], a ld a, $0 ; useless ld [wUnusedMovementBufferBank], a - ld a, LOW(MovementBuffer) + ld a, LOW(wMovementBuffer) ld [wUnusedMovementBufferPointer], a - ld a, HIGH(MovementBuffer) + ld a, HIGH(wMovementBuffer) ld [wUnusedMovementBufferPointer + 1], a ret ; 1b35 @@ -27,7 +27,7 @@ AppendToMovementBuffer:: ; 1b3f ld e, [hl] inc [hl] ld d, 0 - ld hl, MovementBuffer + ld hl, wMovementBuffer add hl, de ld [hl], a pop de diff --git a/home/names.asm b/home/names.asm index 37ce4f37d..90a15c093 100644 --- a/home/names.asm +++ b/home/names.asm @@ -4,14 +4,14 @@ NamesPointers:: ; 33ab dba MoveNames ; MOVE_NAME dbw 0, NULL ; DUMMY_NAME dba ItemNames ; ITEM_NAME - dbw 0, PartyMonOT ; PARTY_OT_NAME - dbw 0, OTPartyMonOT ; ENEMY_OT_NAME + dbw 0, wPartyMonOT ; PARTY_OT_NAME + dbw 0, wOTPartyMonOT ; ENEMY_OT_NAME dba TrainerClassNames ; TRAINER_NAME dbw 4, MoveDescriptions ; MOVE_DESC_NAME_BROKEN (wrong bank) ; 33c3 GetName:: ; 33c3 -; Return name CurSpecies from name list wNamedObjectTypeBuffer in StringBuffer1. +; Return name wCurSpecies from name list wNamedObjectTypeBuffer in wStringBuffer1. ld a, [hROMBank] push af @@ -23,7 +23,7 @@ GetName:: ; 33c3 cp MON_NAME jr nz, .NotPokeName - ld a, [CurSpecies] + ld a, [wCurSpecies] ld [wd265], a call GetPokemonName ld hl, MON_NAME_LENGTH @@ -47,11 +47,11 @@ GetName:: ; 33c3 ld h, [hl] ld l, a - ld a, [CurSpecies] + ld a, [wCurSpecies] dec a call GetNthString - ld de, StringBuffer1 + ld de, wStringBuffer1 ld bc, ITEM_NAME_LENGTH call CopyBytes @@ -95,7 +95,7 @@ GetBasePokemonName:: ; 3420 push hl call GetPokemonName - ld hl, StringBuffer1 + ld hl, wStringBuffer1 .loop ld a, [hl] cp "@" @@ -138,11 +138,11 @@ GetPokemonName:: ; 343b add hl, de ; Terminator - ld de, StringBuffer1 + ld de, wStringBuffer1 push de ld bc, MON_NAME_LENGTH - 1 call CopyBytes - ld hl, StringBuffer1 + MON_NAME_LENGTH - 1 + ld hl, wStringBuffer1 + MON_NAME_LENGTH - 1 ld [hl], "@" pop de @@ -162,7 +162,7 @@ GetItemName:: ; 3468 cp TM01 jr nc, .TM - ld [CurSpecies], a + ld [wCurSpecies], a ld a, ITEM_NAME ld [wNamedObjectTypeBuffer], a call GetName @@ -170,7 +170,7 @@ GetItemName:: ; 3468 .TM: call GetTMHMName .Copied: - ld de, StringBuffer1 + ld de, wStringBuffer1 pop bc pop hl ret @@ -199,7 +199,7 @@ GetTMHMName:: ; 3487 ld bc, .TMTextEnd - .TMText .asm_34a1 - ld de, StringBuffer1 + ld de, wStringBuffer1 call CopyBytes ; TM/HM number @@ -268,10 +268,10 @@ GetMoveName:: ; 34f8 ld [wNamedObjectTypeBuffer], a ld a, [wNamedObjectIndexBuffer] ; move id - ld [CurSpecies], a + ld [wCurSpecies], a call GetName - ld de, StringBuffer1 + ld de, wStringBuffer1 pop hl ret diff --git a/home/pokedex_flags.asm b/home/pokedex_flags.asm index bedb91d18..e9ca2163e 100644 --- a/home/pokedex_flags.asm +++ b/home/pokedex_flags.asm @@ -1,7 +1,7 @@ SetSeenAndCaughtMon:: ; 3380 push af ld c, a - ld hl, PokedexCaught + ld hl, wPokedexCaught ld b, SET_FLAG call PokedexFlagAction pop af @@ -10,21 +10,21 @@ SetSeenAndCaughtMon:: ; 3380 SetSeenMon:: ; 338b ld c, a - ld hl, PokedexSeen + ld hl, wPokedexSeen ld b, SET_FLAG jr PokedexFlagAction ; 3393 CheckCaughtMon:: ; 3393 ld c, a - ld hl, PokedexCaught + ld hl, wPokedexCaught ld b, CHECK_FLAG jr PokedexFlagAction ; 339b CheckSeenMon:: ; 339b ld c, a - ld hl, PokedexSeen + ld hl, wPokedexSeen ld b, CHECK_FLAG ; fallthrough ; 33a1 diff --git a/home/predef.asm b/home/predef.asm index f99e85891..f03bdaa94 100644 --- a/home/predef.asm +++ b/home/predef.asm @@ -2,13 +2,13 @@ Predef:: ; 2d83 ; Call predefined function a. ; Preserves bc, de, hl and f. - ld [PredefID], a + ld [wPredefID], a ld a, [hROMBank] push af ld a, BANK(GetPredefPointer) rst Bankswitch - call GetPredefPointer ; stores hl in PredefTemp + call GetPredefPointer ; stores hl in wPredefTemp ; Switch to the new function's bank rst Bankswitch @@ -20,16 +20,16 @@ Predef:: ; 2d83 push hl ; Call the Predef function - ld a, [PredefAddress] + ld a, [wPredefAddress] ld h, a - ld a, [PredefAddress + 1] + ld a, [wPredefAddress + 1] ld l, a push hl ; Get hl back - ld a, [PredefTemp] + ld a, [wPredefTemp] ld h, a - ld a, [PredefTemp + 1] + ld a, [wPredefTemp + 1] ld l, a ret @@ -37,17 +37,17 @@ Predef:: ; 2d83 ; Clean up after the Predef call ld a, h - ld [PredefTemp], a + ld [wPredefTemp], a ld a, l - ld [PredefTemp+1], a + ld [wPredefTemp+1], a pop hl ld a, h rst Bankswitch - ld a, [PredefTemp] + ld a, [wPredefTemp] ld h, a - ld a, [PredefTemp + 1] + ld a, [wPredefTemp + 1] ld l, a ret ; 2dba diff --git a/home/random.asm b/home/random.asm index ae39f439c..ceefdce6f 100644 --- a/home/random.asm +++ b/home/random.asm @@ -42,10 +42,10 @@ BattleRandom:: ; 2f9f call _BattleRandom - ld [PredefTemp + 1], a + ld [wPredefTemp + 1], a pop af rst Bankswitch - ld a, [PredefTemp + 1] + ld a, [wPredefTemp + 1] ret ; 2fb1 diff --git a/home/rtc.asm b/home/rtc.asm index 5b83f1079..9b8bc4ac3 100644 --- a/home/rtc.asm +++ b/home/rtc.asm @@ -9,7 +9,7 @@ RTC:: ; 46f call UpdateTime ; obj update on? - ld a, [VramState] + ld a, [wVramState] bit 0, a ; obj update ret z diff --git a/home/text.asm b/home/text.asm index 2dbb85f6d..5e7e66d43 100644 --- a/home/text.asm +++ b/home/text.asm @@ -22,11 +22,11 @@ FillBoxWithByte:: ClearTileMap:: ; fc8 -; Fill TileMap with blank tiles. +; Fill wTileMap with blank tiles. hlcoord 0, 0 ld a, " " - ld bc, TileMapEnd - TileMap + ld bc, wTileMapEnd - wTileMap call ByteFill ; Update the BG Map. @@ -39,7 +39,7 @@ ClearTileMap:: ; fc8 ClearScreen:: ; fdb ld a, PAL_BG_TEXT - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call ByteFill jr ClearTileMap @@ -111,7 +111,7 @@ TextBoxBorder:: ; ff1 TextBoxPalette:: ; 1024 ; Fill text box width c height b at hl with pal 7 - ld de, AttrMap - TileMap + ld de, wAttrMap - wTileMap add hl, de inc b inc b @@ -313,11 +313,11 @@ print_name: MACRO jp PlaceCommandCharacter ENDM -PrintMomsName: print_name MomsName ; 1186 -PrintPlayerName: print_name PlayerName ; 118d -PrintRivalName: print_name RivalName ; 1194 -PrintRedsName: print_name RedsName ; 119b -PrintGreensName: print_name GreensName ; 11a2 +PrintMomsName: print_name wMomsName ; 1186 +PrintPlayerName: print_name wPlayerName ; 118d +PrintRivalName: print_name wRivalName ; 1194 +PrintRedsName: print_name wRedsName ; 119b +PrintGreensName: print_name wGreensName ; 11a2 TrainerChar: print_name TrainerCharText ; 11a9 TMChar: print_name TMCharText ; 11b0 @@ -346,7 +346,7 @@ PlaceMoveUsersName:: ; 1203 and a jr nz, .enemy - ld de, BattleMonNick + ld de, wBattleMonNick jr PlaceCommandCharacter .enemy @@ -354,7 +354,7 @@ PlaceMoveUsersName:: ; 1203 call PlaceString ld h, b ld l, c - ld de, EnemyMonNick + ld de, wEnemyMonNick jr PlaceCommandCharacter @@ -365,13 +365,13 @@ PlaceEnemysName:: ; 121b and a jr nz, .linkbattle - ld a, [TrainerClass] + ld a, [wTrainerClass] cp RIVAL1 jr z, .rival cp RIVAL2 jr z, .rival - ld de, OTClassName + ld de, wOTClassName call PlaceString ld h, b ld l, c @@ -380,21 +380,21 @@ PlaceEnemysName:: ; 121b push bc callfar Battle_GetTrainerName pop hl - ld de, StringBuffer1 + ld de, wStringBuffer1 jr PlaceCommandCharacter .rival - ld de, RivalName + ld de, wRivalName jr PlaceCommandCharacter .linkbattle - ld de, OTClassName + ld de, wOTClassName jr PlaceCommandCharacter PlaceGenderedPlayerName:: ; 1252 push de - ld de, PlayerName + ld de, wPlayerName call PlaceString ld h, b ld l, c @@ -452,7 +452,7 @@ LineBreakChar:: ; 12b0 TextFar:: ; 12b9 pop hl push de - ld bc, -TileMap + $10000 + ld bc, -wTileMap + $10000 add hl, bc ld de, -SCREEN_WIDTH ld c, 1 @@ -696,15 +696,15 @@ PokeFluteTerminatorCharacter:: ; 13e0 PlaceHLTextAtBC:: ; 13e5 - ld a, [TextBoxFlags] + ld a, [wTextBoxFlags] push af set NO_TEXT_DELAY_F, a - ld [TextBoxFlags], a + ld [wTextBoxFlags], a call DoTextUntilTerminator pop af - ld [TextBoxFlags], a + ld [wTextBoxFlags], a ret ; 13f6 @@ -1082,13 +1082,13 @@ Text_LINK_WAIT_BUTTON:: ; 1562 Text_TX_STRINGBUFFER:: ; 156a ; Print a string from one of the following: -; 0: StringBuffer3 -; 1: StringBuffer4 -; 2: StringBuffer5 -; 3: StringBuffer2 -; 4: StringBuffer1 -; 5: EnemyMonNick -; 6: BattleMonNick +; 0: wStringBuffer3 +; 1: wStringBuffer4 +; 2: wStringBuffer5 +; 3: wStringBuffer2 +; 4: wStringBuffer1 +; 5: wEnemyMonNick +; 6: wBattleMonNick ; [$14][id] ld a, [hli] diff --git a/home/tilemap.asm b/home/tilemap.asm index 9e15ed85b..4bbd16102 100644 --- a/home/tilemap.asm +++ b/home/tilemap.asm @@ -117,7 +117,7 @@ PlaceVerticalMenuItems:: ; 1c89 inc hl ld d, [hl] call GetMenuTextStartCoord - call Coord2Tile ; hl now contains the TileMap address where we will start printing text. + call Coord2Tile ; hl now contains the tilemap address where we will start printing text. inc de ld a, [de] ; Number of items inc de @@ -207,7 +207,7 @@ MenuBoxCoord2Tile:: ; 1cfd Coord2Tile:: ; 1d05 -; Return the address of TileMap(c, b) in hl. +; Return the address of wTileMap(c, b) in hl. xor a ld h, a ld l, b @@ -235,7 +235,7 @@ MenuBoxCoord2Attr:: ; 1d19 ld b, a Coord2Attr:: ; 1d21 -; Return the address of AttrMap(c, b) in hl. +; Return the address of wAttrMap(c, b) in hl. xor a ld h, a ld l, b @@ -251,7 +251,7 @@ Coord2Attr:: ; 1d21 xor a ld b, a add hl, bc - bccoord 0, 0, AttrMap + bccoord 0, 0, wAttrMap add hl, bc ret ; 1d35 diff --git a/home/time.asm b/home/time.asm index 9ed703686..5ede49173 100644 --- a/home/time.asm +++ b/home/time.asm @@ -140,12 +140,12 @@ FixDays:: ; 5e8 FixTime:: ; 61d ; add ingame time (set at newgame) to current time ; day hr min sec -; store time in CurDay, hHours, hMinutes, hSeconds +; store time in wCurDay, hHours, hMinutes, hSeconds ; second ld a, [hRTCSeconds] ; S ld c, a - ld a, [StartSecond] + ld a, [wStartSecond] add c sub 60 jr nc, .updatesec @@ -157,7 +157,7 @@ FixTime:: ; 61d ccf ; carry is set, so turn it off ld a, [hRTCMinutes] ; M ld c, a - ld a, [StartMinute] + ld a, [wStartMinute] adc c sub 60 jr nc, .updatemin @@ -169,7 +169,7 @@ FixTime:: ; 61d ccf ; carry is set, so turn it off ld a, [hRTCHours] ; H ld c, a - ld a, [StartHour] + ld a, [wStartHour] adc c sub 24 jr nc, .updatehr @@ -181,27 +181,27 @@ FixTime:: ; 61d ccf ; carry is set, so turn it off ld a, [hRTCDayLo] ; DL ld c, a - ld a, [StartDay] + ld a, [wStartDay] adc c - ld [CurDay], a + ld [wCurDay], a ret ; 658 SetTimeOfDay:: ; 658 xor a - ld [StringBuffer2], a + ld [wStringBuffer2], a ld a, $0 ; useless - ld [StringBuffer2 + 3], a + ld [wStringBuffer2 + 3], a jr InitTime SetDayOfWeek:: ; 663 call UpdateTime ld a, [hHours] - ld [StringBuffer2 + 1], a + ld [wStringBuffer2 + 1], a ld a, [hMinutes] - ld [StringBuffer2 + 2], a + ld [wStringBuffer2 + 2], a ld a, [hSeconds] - ld [StringBuffer2 + 3], a + ld [wStringBuffer2 + 3], a jr InitTime ; useless InitTime:: ; 677 diff --git a/home/trainers.asm b/home/trainers.asm index 4eabfbcbb..575af65a7 100644 --- a/home/trainers.asm +++ b/home/trainers.asm @@ -16,7 +16,7 @@ CheckTrainerBattle:: ; 360d ; Skip the player object. ld a, 1 - ld de, MapObjects + OBJECT_LENGTH + ld de, wMapObjects + OBJECT_LENGTH .loop @@ -97,32 +97,32 @@ CheckTrainerBattle:: ; 360d pop af ld [hLastTalked], a ld a, b - ld [EngineBuffer2], a + ld [wEngineBuffer2], a ld a, c - ld [EngineBuffer3], a + ld [wEngineBuffer3], a jr LoadTrainer_continue ; 3674 TalkToTrainer:: ; 3674 ld a, 1 - ld [EngineBuffer2], a + ld [wEngineBuffer2], a ld a, -1 - ld [EngineBuffer3], a + ld [wEngineBuffer3], a LoadTrainer_continue:: ; 367e call GetMapScriptsBank - ld [EngineBuffer1], a + ld [wEngineBuffer1], a ld a, [hLastTalked] call GetMapObject ld hl, MAPOBJECT_SCRIPT_POINTER add hl, bc - ld a, [EngineBuffer1] + ld a, [wEngineBuffer1] call GetFarHalfword ld de, wTempTrainer ld bc, wTempTrainerEnd - wTempTrainer - ld a, [EngineBuffer1] + ld a, [wEngineBuffer1] call FarCopyBytes xor a ld [wRunningTrainerBattleScript], a @@ -152,11 +152,11 @@ FacingPlayerDistance:: ; 36ad add hl, bc ld e, [hl] - ld a, [PlayerStandingMapX] + ld a, [wPlayerStandingMapX] cp d jr z, .CheckY - ld a, [PlayerStandingMapY] + ld a, [wPlayerStandingMapY] cp e jr z, .CheckX @@ -164,7 +164,7 @@ FacingPlayerDistance:: ; 36ad ret .CheckY: - ld a, [PlayerStandingMapY] + ld a, [wPlayerStandingMapY] sub e jr z, .NotFacing jr nc, .Above @@ -182,7 +182,7 @@ FacingPlayerDistance:: ; 36ad jr .CheckFacing .CheckX: - ld a, [PlayerStandingMapX] + ld a, [wPlayerStandingMapX] sub d jr z, .NotFacing jr nc, .Left @@ -236,7 +236,7 @@ CheckTrainerFlag:: ; 36f5 ; 3718 PrintWinLossText:: ; 3718 - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_CANLOSE jr .canlose ; ?????????? diff --git a/home/vblank.asm b/home/vblank.asm index 5afecdad0..3b33b1ec5 100644 --- a/home/vblank.asm +++ b/home/vblank.asm @@ -113,27 +113,27 @@ VBlank0:: ; 2b1 ld a, [hOAMUpdate] and a jr nz, .done_oam - call hPushOAM + call hTransferVirtualOAM .done_oam ; vblank-sensitive operations are done xor a - ld [VBlankOccurred], a + ld [wVBlankOccurred], a - ld a, [OverworldDelay] + ld a, [wOverworldDelay] and a jr z, .ok dec a - ld [OverworldDelay], a + ld [wOverworldDelay], a .ok - ld a, [TextDelayFrames] + ld a, [wTextDelayFrames] and a jr z, .ok2 dec a - ld [TextDelayFrames], a + ld [wTextDelayFrames], a .ok2 call Joypad @@ -165,7 +165,7 @@ VBlank2:: ; 325 rst Bankswitch xor a - ld [VBlankOccurred], a + ld [wVBlankOccurred], a ret ; 337 @@ -192,11 +192,11 @@ VBlank1:: ; 337 call UpdateBGMap call Serve2bppRequest_VBlank - call hPushOAM + call hTransferVirtualOAM .done xor a - ld [VBlankOccurred], a + ld [wVBlankOccurred], a ; get requested ints ld a, [rIF] @@ -282,11 +282,11 @@ VBlank3:: ; 396 call UpdateBGMap call Serve2bppRequest_VBlank - call hPushOAM + call hTransferVirtualOAM .done xor a - ld [VBlankOccurred], a + ld [wVBlankOccurred], a ld a, [rIF] push af @@ -338,12 +338,12 @@ VBlank4:: ; 3df call UpdateBGMap call Serve2bppRequest - call hPushOAM + call hTransferVirtualOAM call Joypad xor a - ld [VBlankOccurred], a + ld [wVBlankOccurred], a call AskSerial @@ -379,7 +379,7 @@ VBlank5:: ; 400 .done xor a - ld [VBlankOccurred], a + ld [wVBlankOccurred], a call Joypad @@ -429,7 +429,7 @@ VBlank6:: ; 436 .done xor a - ld [VBlankOccurred], a + ld [wVBlankOccurred], a ld a, BANK(_UpdateSound) rst Bankswitch diff --git a/home/video.asm b/home/video.asm index 2f06effa0..1066197ff 100644 --- a/home/video.asm +++ b/home/video.asm @@ -20,8 +20,8 @@ DMATransfer:: ; 15d8 UpdateBGMapBuffer:: ; 15e3 -; Copy [hBGMapTileCount] 16x8 tiles from BGMapBuffer -; to bg map addresses in BGMapBufferPtrs. +; Copy [hBGMapTileCount] 16x8 tiles from wBGMapBuffer +; to bg map addresses in wBGMapBufferPtrs. ; [hBGMapTileCount] must be even since this is done in pairs. @@ -35,13 +35,13 @@ UpdateBGMapBuffer:: ; 15e3 push af ld [hSPBuffer], sp - ld hl, BGMapBufferPtrs + ld hl, wBGMapBufferPtrs ld sp, hl ; We can now pop the addresses of affected spots on the BG Map - ld hl, BGMapPalBuffer - ld de, BGMapBuffer + ld hl, wBGMapPalBuffer + ld de, wBGMapBuffer .next @@ -122,7 +122,7 @@ WaitTop:: ; 163a UpdateBGMap:: ; 164c -; Update the BG Map, in thirds, from TileMap and AttrMap. +; Update the BG Map, in thirds, from wTileMap and wAttrMap. ld a, [hBGMapMode] and a @@ -168,7 +168,7 @@ UpdateBGMap:: ; 164c ld a, 1 ld [rVBK], a - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap call .update ld a, 0 @@ -250,7 +250,7 @@ THIRD_HEIGHT EQU SCREEN_HEIGHT / 3 ; Rows of tiles in a third ld a, SCREEN_HEIGHT / 3 -; Discrepancy between TileMap and BGMap +; Discrepancy between wTileMap and BGMap ld bc, BG_MAP_WIDTH - (SCREEN_WIDTH - 1) @@ -285,7 +285,7 @@ endr Serve1bppRequest:: ; 170a ; Only call during the first fifth of VBlank - ld a, [Requested1bpp] + ld a, [wRequested1bpp] and a ret z @@ -296,29 +296,29 @@ Serve1bppRequest:: ; 170a cp LY_VBLANK + 2 ret nc -; Copy [Requested1bpp] 1bpp tiles from [Requested1bppSource] to [Requested1bppDest] +; Copy [wRequested1bpp] 1bpp tiles from [wRequested1bppSource] to [wRequested1bppDest] ld [hSPBuffer], sp ; Source - ld hl, Requested1bppSource + ld hl, wRequested1bppSource ld a, [hli] ld h, [hl] ld l, a ld sp, hl ; Destination - ld hl, Requested1bppDest + ld hl, wRequested1bppDest ld a, [hli] ld h, [hl] ld l, a ; # tiles to copy - ld a, [Requested1bpp] + ld a, [wRequested1bpp] ld b, a xor a - ld [Requested1bpp], a + ld [wRequested1bpp], a .next @@ -348,11 +348,11 @@ endr ld a, l - ld [Requested1bppDest], a + ld [wRequested1bppDest], a ld a, h - ld [Requested1bppDest + 1], a + ld [wRequested1bppDest + 1], a - ld [Requested1bppSource], sp + ld [wRequested1bppSource], sp ld a, [hSPBuffer] ld l, a @@ -366,7 +366,7 @@ endr Serve2bppRequest:: ; 1769 ; Only call during the first fifth of VBlank - ld a, [Requested2bpp] + ld a, [wRequested2bpp] and a ret z @@ -381,34 +381,34 @@ Serve2bppRequest:: ; 1769 Serve2bppRequest_VBlank:: ; 1778 - ld a, [Requested2bpp] + ld a, [wRequested2bpp] and a ret z _Serve2bppRequest:: ; 177d -; Copy [Requested2bpp] 2bpp tiles from [Requested2bppSource] to [Requested2bppDest] +; Copy [wRequested2bpp] 2bpp tiles from [wRequested2bppSource] to [wRequested2bppDest] ld [hSPBuffer], sp ; Source - ld hl, Requested2bppSource + ld hl, wRequested2bppSource ld a, [hli] ld h, [hl] ld l, a ld sp, hl ; Destination - ld hl, Requested2bppDest + ld hl, wRequested2bppDest ld a, [hli] ld h, [hl] ld l, a ; # tiles to copy - ld a, [Requested2bpp] + ld a, [wRequested2bpp] ld b, a xor a - ld [Requested2bpp], a + ld [wRequested2bpp], a .next @@ -430,11 +430,11 @@ endr ld a, l - ld [Requested2bppDest], a + ld [wRequested2bppDest], a ld a, h - ld [Requested2bppDest + 1], a + ld [wRequested2bppDest + 1], a - ld [Requested2bppSource], sp + ld [wRequested2bppSource], sp ld a, [hSPBuffer] ld l, a @@ -466,7 +466,7 @@ AnimateTileset:: ; 17d3 ld a, [rSVBK] push af - ld a, BANK(TilesetAnim) + ld a, BANK(wTilesetAnim) ld [rSVBK], a ld a, [rVBK] diff --git a/home/window.asm b/home/window.asm index 67debe5d3..2d7c22569 100644 --- a/home/window.asm +++ b/home/window.asm @@ -26,7 +26,7 @@ CloseText:: ; 2dcf pop af ld [hOAMUpdate], a - ld hl, VramState + ld hl, wVramState res 6, [hl] ret ; 2de2 |