ref: 4a7d1513f3135a3c926233d47921b21bf8b1fab4
parent: b945988a0af9de9a37d95be8b117f395bc6e5592
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Tue Jul 7 11:09:54 EDT 2020
Use 'tile' and 'tiles' macros
--- a/data/icon_pointers.asm
+++ b/data/icon_pointers.asm
@@ -1,140 +1,37 @@
-MonPartySpritePointers:
- dw SlowbroSprite + $c0
- db $40 / $10 ; 40 bytes
- db BANK(SlowbroSprite)
- dw vSprites
+mon_icon_header: MACRO
+ dw \1 tile \2
+ db \3
+ db BANK(\1)
+ dw vSprites tile \4
+ENDM
- dw BallSprite
- db $80 / $10 ; $80 bytes
- db BANK(BallSprite)
- dw vSprites + $40
-
- dw ClefairySprite + $c0
- db $40 / $10 ; $40 bytes
- db BANK(ClefairySprite)
- dw vSprites + $c0
-
- dw BirdSprite + $c0
- db $40 / $10 ; $40 bytes
- db BANK(BirdSprite)
- dw vSprites + $100
-
- dw SeelSprite
- db $40 / $10 ; $40 bytes
- db BANK(SeelSprite)
- dw vSprites + $140
-
- dw BugIconFrame2
- db $10 / $10 ; $10 bytes
- db BANK(BugIconFrame2)
- dw vSprites + $180
-
- dw BugIconFrame2 + $10
- db $10 / $10 ; $10 bytes
- db BANK(BugIconFrame2)
- dw vSprites + $1a0
-
- dw PlantIconFrame2
- db $10 / $10 ; $10 bytes
- db BANK(PlantIconFrame2)
- dw vSprites + $1c0
-
- dw PlantIconFrame2 + $10
- db $10 / $10 ; $10 bytes
- db BANK(PlantIconFrame2)
- dw vSprites + $1e0
-
- dw SnakeIconFrame1
- db $10 / $10 ; $10 bytes
- db BANK(SnakeIconFrame1)
- dw vSprites + $200
-
- dw SnakeIconFrame1 + $10
- db $10 / $10 ; $10 bytes
- db BANK(SnakeIconFrame1)
- dw vSprites + $220
-
- dw QuadrupedIconFrame1
- db $10 / $10 ; $10 bytes
- db BANK(QuadrupedIconFrame1)
- dw vSprites + $240
-
- dw QuadrupedIconFrame1 + $10
- db $10 / $10 ; $10 bytes
- db BANK(QuadrupedIconFrame1)
- dw vSprites + $260
-
- dw TradeBubbleIconGFX
- db $40 / $10 ; $40 bytes
- db BANK(TradeBubbleIconGFX)
- dw vSprites + $380
-
- dw SlowbroSprite
- db $40 / $10 ; $40 bytes
- db BANK(SlowbroSprite)
- dw vSprites + $400
-
- dw BallSprite
- db $80 / $10 ; $80 bytes
- db BANK(BallSprite)
- dw vSprites + $440
-
- dw ClefairySprite
- db $40 / $10 ; $40 bytes
- db BANK(ClefairySprite)
- dw vSprites + $4c0
-
- dw BirdSprite
- db $40 / $10 ; $40 bytes
- db BANK(BirdSprite)
- dw vSprites + $500
-
- dw SeelSprite + $C0
- db $40 / $10 ; $40 bytes
- db BANK(SeelSprite)
- dw vSprites + $540
-
- dw BugIconFrame1
- db $10 / $10 ; $10 bytes
- db BANK(BugIconFrame1)
- dw vSprites + $580
-
- dw BugIconFrame1 + $10
- db $10 / $10 ; $10 bytes
- db BANK(BugIconFrame1)
- dw vSprites + $5a0
-
- dw PlantIconFrame1
- db $10 / $10 ; $10 bytes
- db BANK(PlantIconFrame1)
- dw vSprites + $5c0
-
- dw PlantIconFrame1 + $10
- db $10 / $10 ; $10 bytes
- db BANK(PlantIconFrame1)
- dw vSprites + $5E0
-
- dw SnakeIconFrame2
- db $10 / $10 ; $10 bytes
- db BANK(SnakeIconFrame2)
- dw vSprites + $600
-
- dw SnakeIconFrame2 + $10
- db $10 / $10 ; $10 bytes
- db BANK(SnakeIconFrame2)
- dw vSprites + $620
-
- dw QuadrupedIconFrame2
- db $10 / $10 ; $10 bytes
- db BANK(QuadrupedIconFrame2)
- dw vSprites + $640
-
- dw QuadrupedIconFrame2 + $10
- db $10 / $10 ; $10 bytes
- db BANK(QuadrupedIconFrame2)
- dw vSprites + $660
-
- dw TradeBubbleIconGFX + $40
- db $40 / $10 ; $40 bytes
- db BANK(TradeBubbleIconGFX)
- dw vSprites + $780
+MonPartySpritePointers:
+; gfx pointer, gfx tile offset, # tiles, vSprites tile offset
+ mon_icon_header SlowbroSprite, 12, 4, $00
+ mon_icon_header BallSprite, 0, 8, $04
+ mon_icon_header ClefairySprite, 12, 4, $0c
+ mon_icon_header BirdSprite, 12, 4, $10
+ mon_icon_header SeelSprite, 0, 4, $14
+ mon_icon_header BugIconFrame2, 0, 1, $18
+ mon_icon_header BugIconFrame2, 1, 1, $1a
+ mon_icon_header PlantIconFrame2, 0, 1, $1c
+ mon_icon_header PlantIconFrame2, 1, 1, $1e
+ mon_icon_header SnakeIconFrame1, 0, 1, $20
+ mon_icon_header SnakeIconFrame1, 1, 1, $22
+ mon_icon_header QuadrupedIconFrame1, 0, 1, $24
+ mon_icon_header QuadrupedIconFrame1, 1, 1, $26
+ mon_icon_header TradeBubbleIconGFX, 0, 4, $38
+ mon_icon_header SlowbroSprite, 0, 4, $40
+ mon_icon_header BallSprite, 0, 8, $44
+ mon_icon_header ClefairySprite, 0, 4, $4c
+ mon_icon_header BirdSprite, 0, 4, $50
+ mon_icon_header SeelSprite, 12, 4, $54
+ mon_icon_header BugIconFrame1, 0, 1, $58
+ mon_icon_header BugIconFrame1, 1, 1, $5a
+ mon_icon_header PlantIconFrame1, 0, 1, $5c
+ mon_icon_header PlantIconFrame1, 1, 1, $5e
+ mon_icon_header SnakeIconFrame2, 0, 1, $60
+ mon_icon_header SnakeIconFrame2, 1, 1, $62
+ mon_icon_header QuadrupedIconFrame2, 0, 1, $64
+ mon_icon_header QuadrupedIconFrame2, 1, 1, $66
+ mon_icon_header TradeBubbleIconGFX, 4, 4, $78
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -341,7 +341,7 @@
ld e, a
ld a, [hl]
ld d, a ; de = address of tileset
- ld hl, vSprites + $310
+ ld hl, vSprites tile $31
ld b, BANK(AnimationTileset1) ; ROM bank
ld a, [wTempTilesetNumTiles]
ld c, a ; number of tiles
@@ -373,6 +373,7 @@
IF DEF(_BLUE)
INCBIN "gfx/slots/blue_slots_2.2bpp"
ENDC
+SlotMachineTiles2End:
MoveAnimation:
push hl
--- a/engine/battle/battle_transitions.asm
+++ b/engine/battle/battle_transitions.asm
@@ -154,14 +154,12 @@
INCLUDE "data/maps/dungeon_maps.asm"
LoadBattleTransitionTile:
- ld hl, vChars1 + $7f0
+ ld hl, vChars1 tile $7f
ld de, BattleTransitionTile
- lb bc, BANK(BattleTransitionTile), (BattleTransitionTileEnd - BattleTransitionTile) / $10
+ lb bc, BANK(BattleTransitionTile), 1
jp CopyVideoData
-BattleTransitionTile:
- INCBIN "gfx/overworld/battle_transition.2bpp"
-BattleTransitionTileEnd:
+BattleTransitionTile: INCBIN "gfx/overworld/battle_transition.2bpp"
BattleTransition_BlackScreen:
ld a, $ff
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -6610,22 +6610,22 @@
jr c, .lcdEnabled
.lcdDisabled
ld hl, BattleHudTiles1
- ld de, vChars2 + $6d0
+ ld de, vChars2 tile $6d
ld bc, BattleHudTiles1End - BattleHudTiles1
ld a, BANK(BattleHudTiles1)
call FarCopyDataDouble
ld hl, BattleHudTiles2
- ld de, vChars2 + $730
+ ld de, vChars2 tile $73
ld bc, BattleHudTiles3End - BattleHudTiles2
ld a, BANK(BattleHudTiles2)
jp FarCopyDataDouble
.lcdEnabled
ld de, BattleHudTiles1
- ld hl, vChars2 + $6d0
+ ld hl, vChars2 tile $6d
lb bc, BANK(BattleHudTiles1), (BattleHudTiles1End - BattleHudTiles1) / $8
call CopyVideoDataDouble
ld de, BattleHudTiles2
- ld hl, vChars2 + $730
+ ld hl, vChars2 tile $73
lb bc, BANK(BattleHudTiles2), (BattleHudTiles3End - BattleHudTiles2) / $8
jp CopyVideoDataDouble
--- a/engine/battle/draw_hud_pokeball_gfx.asm
+++ b/engine/battle/draw_hud_pokeball_gfx.asm
@@ -12,7 +12,7 @@
LoadPartyPokeballGfx:
ld de, PokeballTileGraphics
- ld hl, vSprites + $310
+ ld hl, vSprites tile $31
lb bc, BANK(PokeballTileGraphics), (PokeballTileGraphicsEnd - PokeballTileGraphics) / $10
jp CopyVideoData
--- a/engine/events/diploma.asm
+++ b/engine/events/diploma.asm
@@ -10,7 +10,7 @@
set 6, [hl]
call DisableLCD
ld hl, CircleTile
- ld de, vChars2 + CIRCLE_TILE_ID * $10
+ ld de, vChars2 tile CIRCLE_TILE_ID
ld bc, $10
ld a, BANK(CircleTile)
call FarCopyData2
--- a/engine/events/hidden_objects/museum_fossils.asm
+++ b/engine/events/hidden_objects/museum_fossils.asm
@@ -38,7 +38,7 @@
ld a, [wcf91]
ld [wd0b5], a
call GetMonHeader
- ld de, vChars1 + $310
+ ld de, vChars1 tile $31
call LoadMonFrontSprite
ld a, $80
ldh [hStartTileID], a
--- a/engine/gfx/load_pokedex_tiles.asm
+++ b/engine/gfx/load_pokedex_tiles.asm
@@ -2,10 +2,10 @@
LoadPokedexTilePatterns:
call LoadHpBarAndStatusTilePatterns
ld de, PokedexTileGraphics
- ld hl, vChars2 + $600
+ ld hl, vChars2 tile $60
lb bc, BANK(PokedexTileGraphics), (PokedexTileGraphicsEnd - PokedexTileGraphics) / $10
call CopyVideoData
ld de, PokeballTileGraphics
- ld hl, vChars2 + $720
- lb bc, BANK(PokeballTileGraphics), $01
+ ld hl, vChars2 tile $72
+ lb bc, BANK(PokeballTileGraphics), 1
jp CopyVideoData ; load pokeball tile for marking caught mons
--- a/engine/gfx/mon_icons.asm
+++ b/engine/gfx/mon_icons.asm
@@ -201,11 +201,11 @@
ld a, [wcf91]
call GetPartyMonSpriteID
push af
- ld hl, vSprites
+ ld hl, vSprites tile $00
call .LoadTilePatterns
pop af
add $54
- ld hl, vSprites + $40
+ ld hl, vSprites tile $04
call .LoadTilePatterns
xor a
ld [wMonPartySpriteSpecies], a
--- a/engine/items/town_map.asm
+++ b/engine/items/town_map.asm
@@ -18,7 +18,7 @@
ld de, wTileMapBackup
ld bc, $10
call CopyData
- ld hl, vSprites + $40
+ ld hl, vSprites tile $04
ld de, TownMapCursor
lb bc, BANK(TownMapCursor), (TownMapCursorEnd - TownMapCursor) / $8
call CopyVideoDataDouble
@@ -140,11 +140,11 @@
call LoadPlayerSpriteGraphics
call LoadFontTilePatterns
ld de, BirdSprite
- ld hl, vSprites + $40
- lb bc, BANK(BirdSprite), $c
+ ld hl, vSprites tile $04
+ lb bc, BANK(BirdSprite), 12
call CopyVideoData
ld de, TownMapUpArrow
- ld hl, vChars1 + $6d0
+ ld hl, vChars1 tile $6d
lb bc, BANK(TownMapUpArrow), (TownMapUpArrowEnd - TownMapUpArrow) / $8
call CopyVideoDataDouble
call BuildFlyLocationsList
@@ -284,12 +284,12 @@
call TextBoxBorder
call DisableLCD
ld hl, WorldMapTileGraphics
- ld de, vChars2 + $600
+ ld de, vChars2 tile $60
ld bc, WorldMapTileGraphicsEnd - WorldMapTileGraphics
ld a, BANK(WorldMapTileGraphics)
call FarCopyData2
ld hl, MonNestIcon
- ld de, vSprites + $40
+ ld de, vSprites tile $04
ld bc, MonNestIconEnd - MonNestIcon
ld a, BANK(MonNestIcon)
call FarCopyDataDouble
--- a/engine/link/cable_club.asm
+++ b/engine/link/cable_club.asm
@@ -972,6 +972,6 @@
LoadTrainerInfoTextBoxTiles:
ld de, TrainerInfoTextBoxTileGraphics
- ld hl, vChars2 + $760
+ ld hl, vChars2 tile $76
lb bc, BANK(TrainerInfoTextBoxTileGraphics), (TrainerInfoTextBoxTileGraphicsEnd - TrainerInfoTextBoxTileGraphics) / $10
jp CopyVideoData
--- a/engine/menus/naming_screen.asm
+++ b/engine/menus/naming_screen.asm
@@ -325,7 +325,7 @@
LoadEDTile:
ld de, ED_Tile
- ld hl, vFont + $700
+ ld hl, vFont tile $70
ld bc, (ED_TileEnd - ED_Tile) / $8
; to fix the graphical bug on poor emulators
;lb bc, BANK(ED_Tile), (ED_TileEnd - ED_Tile) / $8
--- a/engine/menus/start_sub_menus.asm
+++ b/engine/menus/start_sub_menus.asm
@@ -485,39 +485,39 @@
call TrainerInfo_DrawVerticalLine
hlcoord 1, 2
call TrainerInfo_DrawVerticalLine
- ld hl, vChars2 + $70
- ld de, vChars2
- ld bc, $70 * 4
+ ld hl, vChars2 tile $07
+ ld de, vChars2 tile $00
+ ld bc, $1c tiles
call CopyData
ld hl, TrainerInfoTextBoxTileGraphics ; trainer info text box tile patterns
- ld de, vChars2 + $770
- ld bc, $80
+ ld de, vChars2 tile $77
+ ld bc, 8 tiles
push bc
call TrainerInfo_FarCopyData
ld hl, BlankLeaderNames
- ld de, vChars2 + $600
- ld bc, $170
+ ld de, vChars2 tile $60
+ ld bc, $17 tiles
call TrainerInfo_FarCopyData
pop bc
ld hl, BadgeNumbersTileGraphics ; badge number tile patterns
- ld de, vChars1 + $580
+ ld de, vChars1 tile $58
call TrainerInfo_FarCopyData
ld hl, GymLeaderFaceAndBadgeTileGraphics ; gym leader face and badge tile patterns
- ld de, vChars2 + $200
- ld bc, $400
- ld a, $03
+ ld de, vChars2 tile $20
+ ld bc, 8 * 8 tiles
+ ld a, BANK(GymLeaderFaceAndBadgeTileGraphics)
call FarCopyData2
ld hl, TextBoxGraphics
- ld de, $d0
+ ld de, 13 tiles
add hl, de ; hl = colon tile pattern
- ld de, vChars1 + $560
- ld bc, $10
- ld a, $04
+ ld de, vChars1 tile $56
+ ld bc, 1 tiles
+ ld a, BANK(TextBoxGraphics)
push bc
call FarCopyData2
pop bc
- ld hl, TrainerInfoTextBoxTileGraphics + $80 ; background tile pattern
- ld de, vChars1 + $570
+ ld hl, TrainerInfoTextBoxTileGraphics tile 8 ; background tile pattern
+ ld de, vChars1 tile $57
call TrainerInfo_FarCopyData
call EnableLCD
ld hl, wTrainerInfoTextBoxWidthPlus1
--- a/engine/movie/credits.asm
+++ b/engine/movie/credits.asm
@@ -5,14 +5,14 @@
call DelayFrames
call DisableLCD
ld hl, vFont
- ld bc, $800 / 2
+ ld bc, ($80 tiles) / 2
call ZeroMemory
- ld hl, vChars2 + $600
- ld bc, $200 / 2
+ ld hl, vChars2 tile $60
+ ld bc, ($20 tiles) / 2
call ZeroMemory
- ld hl, vChars2 + $7e0
- ld bc, $10
- ld a, $ff
+ ld hl, vChars2 tile $7e
+ ld bc, 1 tiles
+ ld a, $ff ; solid black
call FillMemory
hlcoord 0, 0
call FillFourRowsWithBlack
@@ -245,7 +245,7 @@
call FillMiddleOfScreenWithWhite
pop de
ld de, TheEndGfx
- ld hl, vChars2 + $600
+ ld hl, vChars2 tile $60
lb bc, BANK(TheEndGfx), (TheEndGfxEnd - TheEndGfx) / $10
call CopyVideoData
hlcoord 4, 8
--- a/engine/movie/gamefreak.asm
+++ b/engine/movie/gamefreak.asm
@@ -3,16 +3,16 @@
ldh [rOBP0], a
ld a, $a4
ldh [rOBP1], a
- ld de, AnimationTileset2 + $30 ; star tile (top left quadrant)
- ld hl, vChars1 + $200
- lb bc, BANK(AnimationTileset2), $01
+ ld de, AnimationTileset2 tile 3 ; star tile (top left quadrant)
+ ld hl, vChars1 tile $20
+ lb bc, BANK(AnimationTileset2), 1
call CopyVideoData
- ld de, AnimationTileset2 + $130 ; star tile (bottom left quadrant)
- ld hl, vChars1 + $210
- lb bc, BANK(AnimationTileset2), $01
+ ld de, AnimationTileset2 tile 19 ; star tile (bottom left quadrant)
+ ld hl, vChars1 tile $21
+ lb bc, BANK(AnimationTileset2), 1
call CopyVideoData
ld de, FallingStar
- ld hl, vChars1 + $220
+ ld hl, vChars1 tile $22
lb bc, BANK(FallingStar), (FallingStarEnd - FallingStar) / $10
call CopyVideoData
ld hl, GameFreakLogoOAMData
--- a/engine/movie/title.asm
+++ b/engine/movie/title.asm
@@ -36,27 +36,27 @@
call DisableLCD
call LoadFontTilePatterns
ld hl, NintendoCopyrightLogoGraphics
- ld de, vTitleLogo2 + $100
- ld bc, $50
+ ld de, vTitleLogo2 tile 16
+ ld bc, 5 tiles
ld a, BANK(NintendoCopyrightLogoGraphics)
call FarCopyData2
ld hl, GamefreakLogoGraphics
- ld de, vTitleLogo2 + $100 + $50
- ld bc, $90
+ ld de, vTitleLogo2 tile (16 + 5)
+ ld bc, 9 tiles
ld a, BANK(GamefreakLogoGraphics)
call FarCopyData2
ld hl, PokemonLogoGraphics
ld de, vTitleLogo
- ld bc, $600
+ ld bc, $60 tiles
ld a, BANK(PokemonLogoGraphics)
call FarCopyData2 ; first chunk
- ld hl, PokemonLogoGraphics+$600
+ ld hl, PokemonLogoGraphics tile $60
ld de, vTitleLogo2
- ld bc, $100
+ ld bc, $10 tiles
ld a, BANK(PokemonLogoGraphics)
call FarCopyData2 ; second chunk
ld hl, Version_GFX
- ld de, vChars2 + $600 - (Version_GFXEnd - Version_GFX - $50)
+ ld de, vChars2 tile $60 + (10 tiles - (Version_GFXEnd - Version_GFX) * 2) / 2
ld bc, Version_GFXEnd - Version_GFX
ld a, BANK(Version_GFX)
call FarCopyDataDouble
@@ -369,7 +369,7 @@
LoadCopyrightTiles:
ld de, NintendoCopyrightLogoGraphics
- ld hl, vChars2 + $600
+ ld hl, vChars2 tile $60
lb bc, BANK(NintendoCopyrightLogoGraphics), (GamefreakLogoGraphicsEnd - NintendoCopyrightLogoGraphics) / $10
call CopyVideoData
hlcoord 2, 7
--- a/engine/movie/trade.asm
+++ b/engine/movie/trade.asm
@@ -157,12 +157,12 @@
call Trade_ClearTileMap
call DisableLCD
ld hl, TradingAnimationGraphics
- ld de, vChars2 + $310
+ ld de, vChars2 tile $31
ld bc, TradingAnimationGraphicsEnd - TradingAnimationGraphics
ld a, BANK(TradingAnimationGraphics)
call FarCopyData2
ld hl, TradingAnimationGraphics2
- ld de, vSprites + $7c0
+ ld de, vSprites tile $7c
ld bc, TradingAnimationGraphics2End - TradingAnimationGraphics2
ld a, BANK(TradingAnimationGraphics2)
call FarCopyData2
--- a/engine/overworld/cut.asm
+++ b/engine/overworld/cut.asm
@@ -80,23 +80,23 @@
cp $52
jr z, .grass
; tree
- ld de, Overworld_GFX + $2d0 ; cuttable tree sprite top row
- ld hl, vChars1 + $7c0
- lb bc, BANK(Overworld_GFX), $02
+ ld de, Overworld_GFX tile $2d ; cuttable tree sprite top row
+ ld hl, vChars1 tile $7c
+ lb bc, BANK(Overworld_GFX), 2
call CopyVideoData
- ld de, Overworld_GFX + $3d0 ; cuttable tree sprite bottom row
- ld hl, vChars1 + $7e0
- lb bc, BANK(Overworld_GFX), $02
+ ld de, Overworld_GFX tile $3d ; cuttable tree sprite bottom row
+ ld hl, vChars1 tile $7e
+ lb bc, BANK(Overworld_GFX), 2
call CopyVideoData
jr WriteCutOrBoulderDustAnimationOAMBlock
.grass
- ld hl, vChars1 + $7c0
+ ld hl, vChars1 tile $7c
call LoadCutGrassAnimationTilePattern
- ld hl, vChars1 + $7d0
+ ld hl, vChars1 tile $7d
call LoadCutGrassAnimationTilePattern
- ld hl, vChars1 + $7e0
+ ld hl, vChars1 tile $7e
call LoadCutGrassAnimationTilePattern
- ld hl, vChars1 + $7f0
+ ld hl, vChars1 tile $7f
call LoadCutGrassAnimationTilePattern
call WriteCutOrBoulderDustAnimationOAMBlock
ld hl, wOAMBuffer + $93
@@ -112,8 +112,8 @@
ret
LoadCutGrassAnimationTilePattern:
- ld de, AnimationTileset2 + $60 ; tile depicting a leaf
- lb bc, BANK(AnimationTileset2), $01
+ ld de, AnimationTileset2 tile 6 ; tile depicting a leaf
+ lb bc, BANK(AnimationTileset2), 1
jp CopyVideoData
WriteCutOrBoulderDustAnimationOAMBlock:
--- a/engine/overworld/dust_smoke.asm
+++ b/engine/overworld/dust_smoke.asm
@@ -69,14 +69,14 @@
dw AdjustOAMBlockXPos
LoadSmokeTileFourTimes::
- ld hl, vChars1 + $7c0
- ld c, $4
+ ld hl, vChars1 tile $7c
+ ld c, 4
.loop
push bc
push hl
call LoadSmokeTile
pop hl
- ld bc, $10
+ ld bc, 1 tiles
add hl, bc
pop bc
dec c
--- a/engine/overworld/emotion_bubbles.asm
+++ b/engine/overworld/emotion_bubbles.asm
@@ -8,8 +8,8 @@
ld e, [hl]
inc hl
ld d, [hl]
- ld hl, vChars1 + $780
- lb bc, BANK(EmotionBubbles), $04
+ ld hl, vChars1 tile $78
+ lb bc, BANK(EmotionBubbles), 4
call CopyVideoData
ld a, [wUpdateSpritesEnabled]
push af
--- a/engine/overworld/healing_machine.asm
+++ b/engine/overworld/healing_machine.asm
@@ -1,7 +1,7 @@
AnimateHealingMachine:
ld de, PokeCenterFlashingMonitorAndHealBall
- ld hl, vChars0 + $7c0
- lb bc, BANK(PokeCenterFlashingMonitorAndHealBall), $03 ; loads one too many tiles
+ ld hl, vChars0 tile $7c
+ lb bc, BANK(PokeCenterFlashingMonitorAndHealBall), 3 ; should be 2
call CopyVideoData
ld hl, wUpdateSpritesEnabled
ld a, [hl]
--- a/engine/overworld/ledges.asm
+++ b/engine/overworld/ledges.asm
@@ -57,7 +57,7 @@
INCLUDE "data/tilesets/ledge_tiles.asm"
LoadHoppingShadowOAM:
- ld hl, vChars1 + $7f0
+ ld hl, vChars1 tile $7f
ld de, LedgeHoppingShadow
lb bc, BANK(LedgeHoppingShadow), (LedgeHoppingShadowEnd - LedgeHoppingShadow) / $8
call CopyVideoDataDouble
--- a/engine/overworld/map_sprites.asm
+++ b/engine/overworld/map_sprites.asm
@@ -130,13 +130,13 @@
push de
push bc
ld hl, vNPCSprites ; VRAM base address
- ld bc, $c0 ; number of bytes per VRAM slot
+ ld bc, 12 tiles ; number of bytes per VRAM slot
ldh a, [hVRAMSlot]
cp 11 ; is it a 4-tile sprite?
jr nc, .fourTileSpriteVRAMAddr
ld d, a
dec d
-; hl = vSprites + [hVRAMSlot] * $C0 (the number of bytes in 12 tiles)
+; hl = vSprites + [hVRAMSlot] * 12 tiles
.calculateVRAMAddrLoop
add hl, bc
dec d
@@ -143,12 +143,12 @@
jr nz, .calculateVRAMAddrLoop
jr .loadStillTilePattern
.fourTileSpriteVRAMAddr
- ld hl, vSprites + $7c0 ; address for second 4-tile sprite
+ ld hl, vSprites tile $7c ; address for second 4-tile sprite
ldh a, [hFourTileSpriteCount]
and a
jr nz, .loadStillTilePattern
; if it's the first 4-tile sprite
- ld hl, vSprites + $780 ; address for first 4-tile sprite
+ ld hl, vSprites tile $78 ; address for first 4-tile sprite
inc a
ldh [hFourTileSpriteCount], a
.loadStillTilePattern
--- a/engine/overworld/player_animations.asm
+++ b/engine/overworld/player_animations.asm
@@ -250,11 +250,11 @@
LoadBirdSpriteGraphics:
ld de, BirdSprite
ld hl, vNPCSprites
- lb bc, BANK(BirdSprite), $0c
+ lb bc, BANK(BirdSprite), 12
call CopyVideoData
- ld de, BirdSprite + $c0 ; moving animation sprite
+ ld de, BirdSprite tile 12 ; moving animation sprite
ld hl, vNPCSprites2
- lb bc, BANK(BirdSprite), $0c
+ lb bc, BANK(BirdSprite), 12
jp CopyVideoData
InitFacingDirectionList:
@@ -381,8 +381,8 @@
ld hl, wd736
set 6, [hl] ; reserve the last 4 OAM entries
ld de, RedSprite
- ld hl, vNPCSprites
- lb bc, BANK(RedSprite), $c
+ ld hl, vNPCSprites tile $00
+ lb bc, BANK(RedSprite), 12
call CopyVideoData
ld a, $4
ld hl, RedFishingTiles
@@ -479,22 +479,18 @@
db $50, $40, $FE, $00 ; player facing left
db $50, $58, $FE, $20 ; player facing right ($20 means "horizontally flip the tile")
-RedFishingTiles:
- dw RedFishingTilesFront
- db 2, BANK(RedFishingTilesFront)
- dw vNPCSprites + $20
+fishing_gfx: MACRO
+ dw \1
+ db \2
+ db BANK(\1)
+ dw vNPCSprites tile \3
+ENDM
- dw RedFishingTilesBack
- db 2, BANK(RedFishingTilesBack)
- dw vNPCSprites + $60
-
- dw RedFishingTilesSide
- db 2, BANK(RedFishingTilesSide)
- dw vNPCSprites + $a0
-
- dw RedFishingRodTiles
- db 3, BANK(RedFishingRodTiles)
- dw vNPCSprites2 + $7d0
+RedFishingTiles:
+ fishing_gfx RedFishingTilesFront, 2, $02
+ fishing_gfx RedFishingTilesBack, 2, $06
+ fishing_gfx RedFishingTilesSide, 2, $0a
+ fishing_gfx RedFishingRodTiles, 3, $fd
_HandleMidJump::
ld a, [wPlayerJumpingYScreenCoordsIndex]
--- a/engine/pokemon/bills_pc.asm
+++ b/engine/pokemon/bills_pc.asm
@@ -114,9 +114,9 @@
BillsPCMenu:
ld a, [wParentMenuItem]
ld [wCurrentMenuItem], a
- ld hl, vChars2 + $780
+ ld hl, vChars2 tile $78
ld de, PokeballTileGraphics
- lb bc, BANK(PokeballTileGraphics), $01
+ lb bc, BANK(PokeballTileGraphics), 1
call CopyVideoData
call LoadScreenTilesFromBuffer2DisableBGTransfer
hlcoord 0, 0
--- a/engine/pokemon/status_screen.asm
+++ b/engine/pokemon/status_screen.asm
@@ -86,21 +86,21 @@
call UpdateSprites
call LoadHpBarAndStatusTilePatterns
ld de, BattleHudTiles1 ; source
- ld hl, vChars2 + $6d0 ; dest
- lb bc, BANK(BattleHudTiles1), $03
+ ld hl, vChars2 tile $6d ; dest
+ lb bc, BANK(BattleHudTiles1), 3
call CopyVideoDataDouble ; ·│ :L and halfarrow line end
ld de, BattleHudTiles2
- ld hl, vChars2 + $780
- lb bc, BANK(BattleHudTiles2), $01
+ ld hl, vChars2 tile $78
+ lb bc, BANK(BattleHudTiles2), 1
call CopyVideoDataDouble ; │
ld de, BattleHudTiles3
- ld hl, vChars2 + $760
- lb bc, BANK(BattleHudTiles3), $02
- call CopyVideoDataDouble ; ─┘
+ ld hl, vChars2 tile $76
+ lb bc, BANK(BattleHudTiles3), 2
+ call CopyVideoDataDouble ; ─ ┘
ld de, PTile
- ld hl, vChars2 + $720
- lb bc, BANK(PTile), (PTileEnd - PTile) / $8
- call CopyVideoDataDouble ; P (for PP), inline
+ ld hl, vChars2 tile $72
+ lb bc, BANK(PTile), 1
+ call CopyVideoDataDouble ; bold P (for PP)
ldh a, [hTilesetType]
push af
xor a
@@ -244,9 +244,7 @@
ld [hl], $6f ; ← (halfarrow ending)
ret
-PTile:
- INCBIN "gfx/font/P.1bpp"
-PTileEnd:
+PTile: INCBIN "gfx/font/P.1bpp"
PrintStatsBox:
ld a, d
--- a/engine/slots/slot_machine.asm
+++ b/engine/slots/slot_machine.asm
@@ -850,17 +850,17 @@
call DisableLCD
ld hl, SlotMachineTiles2
ld de, vChars0
- ld bc, $1c0
+ ld bc, $1c tiles ; should be SlotMachineTiles2End - SlotMachineTiles2, or $18 tiles
ld a, BANK(SlotMachineTiles2)
call FarCopyData2
ld hl, SlotMachineTiles1
ld de, vChars2
- ld bc, $250
+ ld bc, SlotMachineTiles1End - SlotMachineTiles1
ld a, BANK(SlotMachineTiles1)
call FarCopyData2
ld hl, SlotMachineTiles2
- ld de, vChars2 + $250
- ld bc, $1c0
+ ld de, vChars2 tile $25
+ ld bc, $1c tiles ; should be SlotMachineTiles2End - SlotMachineTiles2, or $18 tiles
ld a, BANK(SlotMachineTiles2)
call FarCopyData2
ld hl, SlotMachineMap
@@ -890,3 +890,4 @@
IF DEF(_BLUE)
INCBIN "gfx/slots/blue_slots_1.2bpp"
ENDC
+SlotMachineTiles1End:
--- a/home.asm
+++ b/home.asm
@@ -820,13 +820,13 @@
jr nz, .on
.off
ld hl, TextBoxGraphics
- ld de, vChars2 + $600
+ ld de, vChars2 tile $60
ld bc, TextBoxGraphicsEnd - TextBoxGraphics
ld a, BANK(TextBoxGraphics)
jp FarCopyData2 ; if LCD is off, transfer all at once
.on
ld de, TextBoxGraphics
- ld hl, vChars2 + $600
+ ld hl, vChars2 tile $60
lb bc, BANK(TextBoxGraphics), (TextBoxGraphicsEnd - TextBoxGraphics) / $10
jp CopyVideoData ; if LCD is on, transfer during V-blank
@@ -836,13 +836,13 @@
jr nz, .on
.off
ld hl, HpBarAndStatusGraphics
- ld de, vChars2 + $620
+ ld de, vChars2 tile $62
ld bc, HpBarAndStatusGraphicsEnd - HpBarAndStatusGraphics
ld a, BANK(HpBarAndStatusGraphics)
jp FarCopyData2 ; if LCD is off, transfer all at once
.on
ld de, HpBarAndStatusGraphics
- ld hl, vChars2 + $620
+ ld hl, vChars2 tile $62
lb bc, BANK(HpBarAndStatusGraphics), (HpBarAndStatusGraphicsEnd - HpBarAndStatusGraphics) / $10
jp CopyVideoData ; if LCD is on, transfer during V-blank
--- a/home/vcopy.asm
+++ b/home/vcopy.asm
@@ -393,7 +393,7 @@
; water
- ld hl, vTileset + $14 * $10
+ ld hl, vTileset tile $14
ld c, $10
ld a, [wMovingBGTilesCounter2]
@@ -438,7 +438,7 @@
jr z, .copy
ld hl, FlowerTile3
.copy
- ld de, vTileset + $3 * $10
+ ld de, vTileset tile $03
ld c, $10
.loop
ld a, [hli]
--- a/scripts/RocketHideoutB2F.asm
+++ b/scripts/RocketHideoutB2F.asm
@@ -367,38 +367,32 @@
spinner: MACRO
; \1: source
; \2: offset (BANK() chokes on literals)
-; \3: length
-; \4: dest
- dw \1 + \2
- db \3, BANK(\1)
- dw \4
+; \3: dest
+ dw \1 tile \2
+ db 1
+ db BANK(\1)
+ dw vTileset tile \3
ENDM
FacilitySpinnerArrows:
-FACILITY_SPINNER EQU $20 * $10
-vFacilitySpinner EQUS "vTileset + FACILITY_SPINNER"
-
- spinner SpinnerArrowAnimTiles, $00, 1, vFacilitySpinner
- spinner SpinnerArrowAnimTiles, $10, 1, vFacilitySpinner + $10
- spinner SpinnerArrowAnimTiles, $20, 1, vFacilitySpinner + $100
- spinner SpinnerArrowAnimTiles, $30, 1, vFacilitySpinner + $110
- spinner Facility_GFX, FACILITY_SPINNER + $000, 1, vFacilitySpinner
- spinner Facility_GFX, FACILITY_SPINNER + $010, 1, vFacilitySpinner + $10
- spinner Facility_GFX, FACILITY_SPINNER + $100, 1, vFacilitySpinner + $100
- spinner Facility_GFX, FACILITY_SPINNER + $110, 1, vFacilitySpinner + $110
+ spinner SpinnerArrowAnimTiles, 0, $20
+ spinner SpinnerArrowAnimTiles, 1, $21
+ spinner SpinnerArrowAnimTiles, 2, $30
+ spinner SpinnerArrowAnimTiles, 3, $31
+ spinner Facility_GFX, $20, $20
+ spinner Facility_GFX, $21, $21
+ spinner Facility_GFX, $30, $30
+ spinner Facility_GFX, $31, $31
GymSpinnerArrows:
-GYM_SPINNER EQU $3c * $10
-vGymSpinner EQUS "vTileset + GYM_SPINNER"
-
- spinner SpinnerArrowAnimTiles, $10, 1, vGymSpinner
- spinner SpinnerArrowAnimTiles, $30, 1, vGymSpinner + $10
- spinner SpinnerArrowAnimTiles, $00, 1, vGymSpinner + $100
- spinner SpinnerArrowAnimTiles, $20, 1, vGymSpinner + $110
- spinner Gym_GFX, GYM_SPINNER + $000, 1, vGymSpinner
- spinner Gym_GFX, GYM_SPINNER + $010, 1, vGymSpinner + $10
- spinner Gym_GFX, GYM_SPINNER + $100, 1, vGymSpinner + $100
- spinner Gym_GFX, GYM_SPINNER + $110, 1, vGymSpinner + $110
+ spinner SpinnerArrowAnimTiles, 1, $3c
+ spinner SpinnerArrowAnimTiles, 3, $3d
+ spinner SpinnerArrowAnimTiles, 0, $4c
+ spinner SpinnerArrowAnimTiles, 2, $4d
+ spinner Gym_GFX, $3c, $3c
+ spinner Gym_GFX, $3d, $3d
+ spinner Gym_GFX, $4c, $4c
+ spinner Gym_GFX, $4d, $4d
SpinnerPlayerFacingDirections:
; This isn't the order of the facing directions. Rather, it's a list of