summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rwxr-xr-xengine/HoF_room_pc.asm3
-rw-r--r--engine/battle/battle_transitions.asm3
-rwxr-xr-xengine/battle/core.asm14
-rw-r--r--engine/battle/draw_hud_pokeball_gfx.asm3
-rw-r--r--engine/battle/trainer_ai.asm2
-rwxr-xr-xengine/cable_club.asm4
-rwxr-xr-xengine/evos_moves.asm2
-rwxr-xr-xengine/gamefreak.asm12
-rwxr-xr-xengine/intro.asm16
-rwxr-xr-xengine/items/items.asm8
-rwxr-xr-xengine/learn_move.asm2
-rwxr-xr-xengine/load_pokedex_tiles.asm2
-rwxr-xr-xengine/menu/naming_screen.asm5
-rwxr-xr-xengine/menu/party_menu.asm2
-rwxr-xr-xengine/menu/start_sub_menus.asm2
-rwxr-xr-xengine/menu/status_screen.asm3
-rwxr-xr-xengine/overworld/emotion_bubbles.asm2
-rwxr-xr-xengine/overworld/healing_machine.asm2
-rwxr-xr-xengine/overworld/ledges.asm3
-rwxr-xr-xengine/overworld/ssanne.asm3
-rwxr-xr-xengine/titlescreen.asm15
-rwxr-xr-xengine/town_map.asm11
-rwxr-xr-xengine/trade.asm8
23 files changed, 70 insertions, 57 deletions
diff --git a/engine/HoF_room_pc.asm b/engine/HoF_room_pc.asm
index 704fea16..e00fc57d 100755
--- a/engine/HoF_room_pc.asm
+++ b/engine/HoF_room_pc.asm
@@ -246,7 +246,7 @@ Credits: ; 7418e (1d:418e)
pop de
ld de, TheEndGfx
ld hl, vChars2 + $600
- lb bc, BANK(TheEndGfx), $0a
+ lb bc, BANK(TheEndGfx), (TheEndGfxEnd - TheEndGfx) / $10
call CopyVideoData
coord hl, 4, 8
ld de, TheEndTextString
@@ -267,3 +267,4 @@ INCLUDE "text/credits_text.asm"
TheEndGfx: ; 7473e (1d:473e) (7473f on blue)
INCBIN "gfx/theend.interleave.2bpp"
+TheEndGfxEnd:
diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm
index e9e247f9..8f57777c 100644
--- a/engine/battle/battle_transitions.asm
+++ b/engine/battle/battle_transitions.asm
@@ -184,11 +184,12 @@ DungeonMaps2: ; 70a44 (1c:4a44)
LoadBattleTransitionTile: ; 70a4d (1c:4a4d)
ld hl, vChars1 + $7f0
ld de, BattleTransitionTile
- lb bc, BANK(BattleTransitionTile), $01
+ lb bc, BANK(BattleTransitionTile), (BattleTransitionTileEnd - BattleTransitionTile) / $10
jp CopyVideoData
BattleTransitionTile: ; 70a59 (1c:4a59)
INCBIN "gfx/battle_transition.2bpp"
+BattleTransitionTileEnd:
BattleTransition_BlackScreen: ; 70a69 (1c:4a69)
ld a, $ff
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 65549f7b..ee93023f 100755
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -2394,7 +2394,7 @@ PartyMenuOrRockOrRun:
jp DisplayBattleMenu
.partyMonDeselected
coord hl, 11, 11
- ld bc, $81
+ ld bc, 6 * SCREEN_WIDTH + 9
ld a, " "
call FillMemory
xor a ; NORMAL_PARTY_MENU
@@ -5194,7 +5194,7 @@ ReloadMoveData: ; 3e329 (f:6329)
ld [wd11e],a
dec a
ld hl,Moves
- ld bc,$0006
+ ld bc,MoveEnd - Moves
call AddNTimes
ld a,BANK(Moves)
call FarCopyData ; copy the move's stats
@@ -6170,7 +6170,7 @@ GetCurrentMove: ; 3eabe (f:6abe)
ld [wd0b5], a
dec a
ld hl, Moves
- ld bc, $6
+ ld bc, MoveEnd - Moves
call AddNTimes
ld a, BANK(Moves)
call FarCopyData
@@ -6707,22 +6707,22 @@ LoadHudTilePatterns: ; 3ee5b (f:6e5b)
.lcdDisabled
ld hl, BattleHudTiles1
ld de, vChars2 + $6d0
- ld bc, $18
+ ld bc, BattleHudTiles1End - BattleHudTiles1
ld a, BANK(BattleHudTiles1)
call FarCopyDataDouble
ld hl, BattleHudTiles2
ld de, vChars2 + $730
- ld bc, $30
+ ld bc, BattleHudTiles3End - BattleHudTiles2
ld a, BANK(BattleHudTiles2)
jp FarCopyDataDouble
.lcdEnabled
ld de, BattleHudTiles1
ld hl, vChars2 + $6d0
- lb bc, BANK(BattleHudTiles1), $03
+ lb bc, BANK(BattleHudTiles1), (BattleHudTiles1End - BattleHudTiles1) / $8
call CopyVideoDataDouble
ld de, BattleHudTiles2
ld hl, vChars2 + $730
- lb bc, BANK(BattleHudTiles2), $06
+ lb bc, BANK(BattleHudTiles2), (BattleHudTiles3End - BattleHudTiles2) / $8
jp CopyVideoDataDouble
PrintEmptyString: ; 3ee94 (f:6e94)
diff --git a/engine/battle/draw_hud_pokeball_gfx.asm b/engine/battle/draw_hud_pokeball_gfx.asm
index 7198d984..c1387b7b 100644
--- a/engine/battle/draw_hud_pokeball_gfx.asm
+++ b/engine/battle/draw_hud_pokeball_gfx.asm
@@ -13,7 +13,7 @@ DrawEnemyPokeballs: ; 3a857 (e:6857)
LoadPartyPokeballGfx: ; 3a85d (e:685d)
ld de, PokeballTileGraphics
ld hl, vSprites + $310
- lb bc, BANK(PokeballTileGraphics), $04
+ lb bc, BANK(PokeballTileGraphics), (PokeballTileGraphicsEnd - PokeballTileGraphics) / $10
jp CopyVideoData
SetupOwnPartyPokeballs: ; 3a869 (e:6869)
@@ -189,3 +189,4 @@ SetupPlayerAndEnemyPokeballs: ; 3a948 (e:6948)
; four tiles: pokeball, black pokeball (status ailment), crossed out pokeball (faited) and pokeball slot (no mon)
PokeballTileGraphics:: ; 3a97e (e:697e)
INCBIN "gfx/pokeball.2bpp"
+PokeballTileGraphicsEnd:
diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm
index 9102b2d8..08205048 100644
--- a/engine/battle/trainer_ai.asm
+++ b/engine/battle/trainer_ai.asm
@@ -264,7 +264,7 @@ ReadMove: ; 39884 (e:5884)
push bc
dec a
ld hl,Moves
- ld bc,6
+ ld bc,MoveEnd - Moves
call AddNTimes
ld de,W_ENEMYMOVENUM
call CopyData
diff --git a/engine/cable_club.asm b/engine/cable_club.asm
index 07284d13..88e85e8b 100755
--- a/engine/cable_club.asm
+++ b/engine/cable_club.asm
@@ -598,7 +598,7 @@ ReturnToCableClubRoom: ; 577d (1:577d)
TradeCenter_DrawCancelBox:
coord hl, 11, 15
ld a, $7e
- ld bc, 2 * 20 + 9
+ ld bc, 2 * SCREEN_WIDTH + 9
call FillMemory
coord hl, 0, 15
ld b, 1
@@ -614,7 +614,7 @@ CancelTextString:
TradeCenter_PlaceSelectedEnemyMonMenuCursor:
ld a, [wSerialSyncAndExchangeNybbleReceiveData]
coord hl, 1, 9
- ld bc, 20
+ ld bc, SCREEN_WIDTH
call AddNTimes
ld [hl], $ec ; cursor
ret
diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm
index 16e893e5..4e55cdea 100755
--- a/engine/evos_moves.asm
+++ b/engine/evos_moves.asm
@@ -479,7 +479,7 @@ WriteMonMoves: ; 3afb8 (e:6fb8)
push hl
dec a
ld hl, Moves
- ld bc, 6
+ ld bc, MoveEnd - Moves
call AddNTimes
ld de, wBuffer
ld a, BANK(Moves)
diff --git a/engine/gamefreak.asm b/engine/gamefreak.asm
index 73e4f074..fa8faebc 100755
--- a/engine/gamefreak.asm
+++ b/engine/gamefreak.asm
@@ -13,15 +13,15 @@ LoadShootingStarGraphics: ; 70000 (1c:4000)
call CopyVideoData
ld de, FallingStar
ld hl, vChars1 + $220
- lb bc, BANK(FallingStar), $01
+ lb bc, BANK(FallingStar), (FallingStarEnd - FallingStar) / $10
call CopyVideoData
ld hl, GameFreakLogoOAMData
ld de, wOAMBuffer + $60
- ld bc, $40
+ ld bc, GameFreakLogoOAMDataEnd - GameFreakLogoOAMData
call CopyData
ld hl, GameFreakShootingStarOAMData
ld de, wOAMBuffer
- ld bc, $10
+ ld bc, GameFreakShootingStarOAMDataEnd - GameFreakShootingStarOAMData
jp CopyData
AnimateShootingStar: ; 70044 (1c:4044)
@@ -88,7 +88,7 @@ AnimateShootingStar: ; 70044 (1c:4044)
.initSmallStarsOAMLoop
push af
ld hl, SmallStarsOAM
- ld bc, 4
+ ld bc, SmallStarsOAMEnd - SmallStarsOAM
call CopyData
pop af
dec a
@@ -147,6 +147,7 @@ AnimateShootingStar: ; 70044 (1c:4044)
SmallStarsOAM: ; 700ee (1c:40ee)
db $00,$00,$A2,$90
+SmallStarsOAMEnd:
SmallStarsWaveCoordsPointerTable: ; 700f2 (1c:40f2)
dw SmallStarsWave1Coords
@@ -229,12 +230,15 @@ GameFreakLogoOAMData: ; 70140 (1c:4140)
db $60,$68,$83,$00
db $60,$70,$81,$00
db $60,$78,$86,$00
+GameFreakLogoOAMDataEnd:
GameFreakShootingStarOAMData: ; 70180 (1c:4180)
db $00,$A0,$A0,$10
db $00,$A8,$A0,$30
db $08,$A0,$A1,$10
db $08,$A8,$A1,$30
+GameFreakShootingStarOAMDataEnd:
FallingStar: ; 70190 (1c:4190)
INCBIN "gfx/falling_star.2bpp"
+FallingStarEnd:
diff --git a/engine/intro.asm b/engine/intro.asm
index 154c41fd..636b4af5 100755
--- a/engine/intro.asm
+++ b/engine/intro.asm
@@ -278,22 +278,22 @@ PlayMoveSoundB: ; 41849 (10:5849)
LoadIntroGraphics: ; 41852 (10:5852)
ld hl, FightIntroBackMon
ld de, vChars2
- ld bc, $600
+ ld bc, FightIntroBackMonEnd - FightIntroBackMon
ld a, BANK(FightIntroBackMon)
call FarCopyData2
ld hl, GameFreakIntro
ld de, vChars2 + $600
- ld bc, $140
+ ld bc, GameFreakIntroEnd - GameFreakIntro
ld a, BANK(GameFreakIntro)
call FarCopyData2
ld hl, GameFreakIntro
ld de, vChars1
- ld bc, $140
+ ld bc, GameFreakIntroEnd - GameFreakIntro
ld a, BANK(GameFreakIntro)
call FarCopyData2
ld hl, FightIntroFrontMon
ld de, vChars0
- ld bc, $6c0
+ ld bc, FightIntroFrontMonEnd - FightIntroFrontMon
ld a, BANK(FightIntroFrontMon)
jp FarCopyData2
@@ -430,9 +430,11 @@ GameFreakIntro: ; 41959 (10:5959)
INCBIN "gfx/gamefreak_intro.2bpp"
INCBIN "gfx/gamefreak_logo.2bpp"
ds $10 ; blank tile
+GameFreakIntroEnd:
FightIntroBackMon: ; 41a99 (10:5a99)
INCBIN "gfx/intro_fight.2bpp"
+FightIntroBackMonEnd:
FightIntroFrontMon: ; 42099 (10:6099)
@@ -440,11 +442,13 @@ IF DEF(_RED)
INCBIN "gfx/red/intro_nido_1.6x6.2bpp"
INCBIN "gfx/red/intro_nido_2.6x6.2bpp"
INCBIN "gfx/red/intro_nido_3.6x6.2bpp"
- ds $10 ; blank tile
ENDC
IF DEF(_BLUE)
INCBIN "gfx/blue/intro_purin_1.6x6.2bpp"
INCBIN "gfx/blue/intro_purin_2.6x6.2bpp"
INCBIN "gfx/blue/intro_purin_3.6x6.2bpp"
- ds $10 ; blank tile
ENDC
+
+FightIntroFrontMonEnd:
+
+ ds $10 ; blank tile
diff --git a/engine/items/items.asm b/engine/items/items.asm
index 364570da..bae86ddb 100755
--- a/engine/items/items.asm
+++ b/engine/items/items.asm
@@ -912,7 +912,7 @@ ItemUseMedicine: ; dabb (3:5abb)
ld [wHPBarNewHP+1],a
coord hl, 4, 1
ld a,[wWhichPokemon]
- ld bc,2 * 20
+ ld bc,2 * SCREEN_WIDTH
call AddNTimes ; calculate coordinates of HP bar of pokemon that used Softboiled
ld a,SFX_HEAL_HP
call PlaySoundWaitForCurrent
@@ -1937,7 +1937,7 @@ ItemUsePPRestore: ; e31e (3:631e)
cp b ; is the pokemon whose PP was restored active in battle?
jr nz,.skipUpdatingInBattleData
ld hl,wPartyMon1PP
- ld bc,44
+ ld bc,wPartyMon2 - wPartyMon1
call AddNTimes
ld de,wBattleMonPP
ld bc,4
@@ -2289,7 +2289,7 @@ GotOffBicycleText: ; e5fc (3:65fc)
; [wCurrentMenuItem] = index of move (when using a PP Up)
RestoreBonusPP: ; e606 (3:6606)
ld hl,wPartyMon1Moves
- ld bc,44
+ ld bc,wPartyMon2 - wPartyMon1
ld a,[wWhichPokemon]
call AddNTimes
push hl
@@ -2407,7 +2407,7 @@ GetMaxPP: ; e677 (3:6677)
dec a
push hl
ld hl,Moves
- ld bc,6
+ ld bc,MoveEnd - Moves
call AddNTimes
ld de,wcd6d
ld a,BANK(Moves)
diff --git a/engine/learn_move.asm b/engine/learn_move.asm
index 88dedd3d..02459b20 100755
--- a/engine/learn_move.asm
+++ b/engine/learn_move.asm
@@ -44,7 +44,7 @@ DontAbandonLearning: ; 6e5b (1:6e5b)
push de
dec a
ld hl, Moves
- ld bc, $6
+ ld bc, MoveEnd - Moves
call AddNTimes
ld de, wBuffer
ld a, BANK(Moves)
diff --git a/engine/load_pokedex_tiles.asm b/engine/load_pokedex_tiles.asm
index f4e45247..1189d2f0 100755
--- a/engine/load_pokedex_tiles.asm
+++ b/engine/load_pokedex_tiles.asm
@@ -3,7 +3,7 @@ LoadPokedexTilePatterns: ; 17840 (5:7840)
call LoadHpBarAndStatusTilePatterns
ld de,PokedexTileGraphics
ld hl,vChars2 + $600
- lb bc, BANK(PokedexTileGraphics), $12
+ lb bc, BANK(PokedexTileGraphics), (PokedexTileGraphicsEnd - PokedexTileGraphics) / $10
call CopyVideoData
ld de,PokeballTileGraphics
ld hl,vChars2 + $720
diff --git a/engine/menu/naming_screen.asm b/engine/menu/naming_screen.asm
index 967f11e8..e64a4bee 100755
--- a/engine/menu/naming_screen.asm
+++ b/engine/menu/naming_screen.asm
@@ -326,11 +326,14 @@ DisplayNamingScreen: ; 6596 (1:6596)
LoadEDTile: ; 675b (1:675b)
ld de, ED_Tile
ld hl, vFont + $700
- ld bc, $1
+ 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
jp CopyVideoDataDouble
ED_Tile: ; 6767 (1:6767)
INCBIN "gfx/ED_tile.1bpp"
+ED_TileEnd:
PrintAlphabet: ; 676f (1:676f)
xor a
diff --git a/engine/menu/party_menu.asm b/engine/menu/party_menu.asm
index 42ab553a..d83c4fbe 100755
--- a/engine/menu/party_menu.asm
+++ b/engine/menu/party_menu.asm
@@ -150,7 +150,7 @@ RedrawPartyMenu_: ; 12ce3 (4:6ce3)
ld l,a
ld de,wcd6d
ld a,BANK(EvosMovesPointerTable)
- ld bc,13
+ ld bc,Mon133_EvosEnd - Mon133_EvosMoves
call FarCopyData
ld hl,wcd6d
ld de,.notAbleToEvolveText
diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm
index f061fbf6..110da50d 100755
--- a/engine/menu/start_sub_menus.asm
+++ b/engine/menu/start_sub_menus.asm
@@ -611,7 +611,7 @@ DrawTrainerInfo: ; 1349a (4:749a)
jp PrintNumber
TrainerInfo_FarCopyData: ; 1357f (4:757f)
- ld a,$0b
+ ld a,BANK(TrainerInfoTextBoxTileGraphics)
jp FarCopyData2
TrainerInfo_NameMoneyTimeText: ; 13584 (4:7584)
diff --git a/engine/menu/status_screen.asm b/engine/menu/status_screen.asm
index d8a504bb..c959400a 100755
--- a/engine/menu/status_screen.asm
+++ b/engine/menu/status_screen.asm
@@ -99,7 +99,7 @@ StatusScreen: ; 12953 (4:6953)
call CopyVideoDataDouble ; ─┘
ld de, PTile
ld hl, vChars2 + $720
- lb bc, BANK(PTile), $01
+ lb bc, BANK(PTile), (PTileEnd - PTile) / $8
call CopyVideoDataDouble ; P (for PP), inline
ld a, [hTilesetType]
push af
@@ -242,6 +242,7 @@ DrawLineBox: ; 0x12ac7
PTile: ; 12adc (4:6adc) ; This is a single 1bpp "P" tile
INCBIN "gfx/p_tile.1bpp"
+PTileEnd:
PrintStatsBox: ; 12ae4 (4:6ae4)
ld a, d
diff --git a/engine/overworld/emotion_bubbles.asm b/engine/overworld/emotion_bubbles.asm
index ebd441aa..f8665dd6 100755
--- a/engine/overworld/emotion_bubbles.asm
+++ b/engine/overworld/emotion_bubbles.asm
@@ -9,7 +9,7 @@ EmotionBubble: ; 17c47 (5:7c47)
inc hl
ld d, [hl]
ld hl, vChars1 + $780
- lb bc, BANK(EmotionBubblesPointerTable), $04
+ lb bc, BANK(EmotionBubbles), $04
call CopyVideoData
ld a, [wUpdateSpritesEnabled]
push af
diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm
index d3513b0d..3ab41d5f 100755
--- a/engine/overworld/healing_machine.asm
+++ b/engine/overworld/healing_machine.asm
@@ -1,7 +1,7 @@
AnimateHealingMachine: ; 70433 (1c:4433)
ld de, PokeCenterFlashingMonitorAndHealBall
ld hl, vChars0 + $7c0
- lb bc, BANK(PokeCenterFlashingMonitorAndHealBall), $03
+ lb bc, BANK(PokeCenterFlashingMonitorAndHealBall), $03 ; loads one too many tiles
call CopyVideoData
ld hl, wUpdateSpritesEnabled
ld a, [hl]
diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm
index 5a3bfbe0..df4273fd 100755
--- a/engine/overworld/ledges.asm
+++ b/engine/overworld/ledges.asm
@@ -69,7 +69,7 @@ LedgeTiles: ; 1a6cf (6:66cf)
LoadHoppingShadowOAM: ; 1a6f0 (6:66f0)
ld hl, vChars1 + $7f0
ld de, LedgeHoppingShadow
- lb bc, BANK(LedgeHoppingShadow), $01
+ lb bc, BANK(LedgeHoppingShadow), (LedgeHoppingShadowEnd - LedgeHoppingShadow) / $8
call CopyVideoDataDouble
ld a, $9
lb bc, $54, $48 ; b, c = y, x coordinates of shadow
@@ -79,6 +79,7 @@ LoadHoppingShadowOAM: ; 1a6f0 (6:66f0)
LedgeHoppingShadow: ; 1a708 (6:6708)
INCBIN "gfx/ledge_hopping_shadow.1bpp"
+LedgeHoppingShadowEnd:
LedgeHoppingShadowOAM: ; 1a710 (6:6710)
db $FF,$10,$FF,$20
diff --git a/engine/overworld/ssanne.asm b/engine/overworld/ssanne.asm
index 1dccd026..e631bbfa 100755
--- a/engine/overworld/ssanne.asm
+++ b/engine/overworld/ssanne.asm
@@ -85,8 +85,9 @@ LoadSmokeTileFourTimes: ; 79fc0 (1e:5fc0)
LoadSmokeTile: ; 79fd4 (1e:5fd4)
ld de, SSAnneSmokePuffTile
- lb bc, BANK(SSAnneSmokePuffTile), $01
+ lb bc, BANK(SSAnneSmokePuffTile), (SSAnneSmokePuffTileEnd - SSAnneSmokePuffTile) / $10
jp CopyVideoData
SSAnneSmokePuffTile: ; 79fdd (1e:5fdd)
INCBIN "gfx/ss_anne_smoke_puff.2bpp"
+SSAnneSmokePuffTileEnd:
diff --git a/engine/titlescreen.asm b/engine/titlescreen.asm
index df47275b..fea179d6 100755
--- a/engine/titlescreen.asm
+++ b/engine/titlescreen.asm
@@ -56,15 +56,8 @@ DisplayTitleScreen: ; 42dd (1:42dd)
ld a, BANK(PokemonLogoGraphics)
call FarCopyData2 ; second chunk
ld hl, Version_GFX
-IF DEF(_RED)
- ld de,vChars2 + $600
- ld bc,$50
-ENDC
-IF DEF(_BLUE)
- ld de,vChars2 + $600 + $10
- ld bc,$50 - $10
-ENDC
-
+ ld de,vChars2 + $600 - (Version_GFXEnd - Version_GFX - $50)
+ ld bc, Version_GFXEnd - Version_GFX
ld a, BANK(Version_GFX)
call FarCopyDataDouble
call ClearBothBGMaps
@@ -317,7 +310,7 @@ ScrollTitleScreenGameVersion: ; 44cf (1:44cf)
DrawPlayerCharacter: ; 44dd (1:44dd)
ld hl, PlayerCharacterTitleGraphics
ld de, vSprites
- ld bc, $230
+ ld bc, PlayerCharacterTitleGraphicsEnd - PlayerCharacterTitleGraphics
ld a, BANK(PlayerCharacterTitleGraphics)
call FarCopyData2
call ClearSprites
@@ -377,7 +370,7 @@ LoadCopyrightAndTextBoxTiles: ; 4538 (1:4538)
LoadCopyrightTiles: ; 4541 (1:4541)
ld de, NintendoCopyrightLogoGraphics
ld hl, vChars2 + $600
- lb bc, BANK(NintendoCopyrightLogoGraphics), $1c
+ lb bc, BANK(NintendoCopyrightLogoGraphics), (GamefreakLogoGraphicsEnd - NintendoCopyrightLogoGraphics) / $10
call CopyVideoData
coord hl, 2, 7
ld de, CopyrightTextString
diff --git a/engine/town_map.asm b/engine/town_map.asm
index 037a59fa..414b6509 100755
--- a/engine/town_map.asm
+++ b/engine/town_map.asm
@@ -20,7 +20,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e)
call CopyData
ld hl, vSprites + $40
ld de, TownMapCursor
- lb bc, BANK(TownMapCursor), $04
+ lb bc, BANK(TownMapCursor), (TownMapCursorEnd - TownMapCursor) / $8
call CopyVideoDataDouble
xor a
ld [wWhichTownMapLocation], a
@@ -107,6 +107,7 @@ INCLUDE "data/town_map_order.asm"
TownMapCursor: ; 70f40 (1c:4f40)
INCBIN "gfx/town_map_cursor.1bpp"
+TownMapCursorEnd:
LoadTownMap_Nest: ; 70f60 (1c:4f60)
call LoadTownMap
@@ -144,7 +145,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90)
call CopyVideoData
ld de, TownMapUpArrow
ld hl, vChars1 + $6d0
- lb bc, BANK(TownMapUpArrow), $01
+ lb bc, BANK(TownMapUpArrow), (TownMapUpArrowEnd - TownMapUpArrow) / $8
call CopyVideoDataDouble
call BuildFlyLocationsList
ld hl, wUpdateSpritesEnabled
@@ -271,6 +272,7 @@ BuildFlyLocationsList: ; 71070 (1c:5070)
TownMapUpArrow: ; 71093 (1c:5093)
INCBIN "gfx/up_arrow.1bpp"
+TownMapUpArrowEnd:
LoadTownMap: ; 7109b (1c:509b)
call GBPalWhiteOutWithDelay3
@@ -283,12 +285,12 @@ LoadTownMap: ; 7109b (1c:509b)
call DisableLCD
ld hl, WorldMapTileGraphics
ld de, vChars2 + $600
- ld bc, $100
+ ld bc, WorldMapTileGraphicsEnd - WorldMapTileGraphics
ld a, BANK(WorldMapTileGraphics)
call FarCopyData2
ld hl, MonNestIcon
ld de, vSprites + $40
- ld bc, $8
+ ld bc, MonNestIconEnd - MonNestIcon
ld a, BANK(MonNestIcon)
call FarCopyDataDouble
coord hl, 0, 0
@@ -582,6 +584,7 @@ INCLUDE "text/map_names.asm"
MonNestIcon: ; 716be (1c:56be)
INCBIN "gfx/mon_nest_icon.1bpp"
+MonNestIconEnd:
TownMapSpriteBlinkingAnimation: ; 716c6 (1c:56c6)
ld a, [wAnimCounter]
diff --git a/engine/trade.asm b/engine/trade.asm
index 1a0e5f61..6e825fe5 100755
--- a/engine/trade.asm
+++ b/engine/trade.asm
@@ -149,7 +149,7 @@ Trade_Delay80: ; 41191 (10:5191)
Trade_ClearTileMap: ; 41196 (10:5196)
coord hl, 0, 0
- ld bc, 20 * 18
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, " "
jp FillMemory
@@ -158,12 +158,12 @@ LoadTradingGFXAndMonNames: ; 411a1 (10:51a1)
call DisableLCD
ld hl, TradingAnimationGraphics
ld de, vChars2 + $310
- ld bc, $310
+ ld bc, TradingAnimationGraphicsEnd - TradingAnimationGraphics
ld a, BANK(TradingAnimationGraphics)
call FarCopyData2
ld hl, TradingAnimationGraphics2
ld de, vSprites + $7c0
- ld bc, $40
+ ld bc, TradingAnimationGraphics2End - TradingAnimationGraphics2
ld a, BANK(TradingAnimationGraphics2)
call FarCopyData2
ld hl, vBGMap0
@@ -190,7 +190,7 @@ LoadTradingGFXAndMonNames: ; 411a1 (10:51a1)
call GetMonName
ld hl, wcd6d
ld de, wcf4b
- ld bc, $b
+ ld bc, 11
call CopyData
ld a, [wTradedEnemyMonSpecies]
ld [wd11e], a