ref: f01434f2c0d7895d3520c5d18913a382e6684c80
parent: 586a49c8adc48b83fe0879a5b3fe62e627bd1df2
author: Remy Oukaour <remy.oukaour@gmail.com>
date: Fri Dec 29 13:59:50 EST 2017
bgrows → * BG_MAP_WIDTH No dims macro
--- a/engine/events/magnet_train.asm
+++ b/engine/events/magnet_train.asm
@@ -262,19 +262,19 @@
; bushes
hlbgcoord 0, 0
- ld bc, 4 bgrows
+ ld bc, 4 * BG_MAP_WIDTH
ld a, $2
call ByteFill
; train
hlbgcoord 0, 4
- ld bc, 10 bgrows
+ ld bc, 10 * BG_MAP_WIDTH
xor a
call ByteFill
; more bushes
hlbgcoord 0, 14
- ld bc, 4 bgrows
+ ld bc, 4 * BG_MAP_WIDTH
ld a, $2
call ByteFill
--- a/engine/title.asm
+++ b/engine/title.asm
@@ -32,7 +32,7 @@
; Clear screen palettes
hlbgcoord 0, 0
- ld bc, 20 bgrows
+ ld bc, 20 * BG_MAP_WIDTH
xor a
call ByteFill
@@ -43,7 +43,7 @@
; line 0 (copyright)
hlbgcoord 0, 0, vBGMap1
- ld bc, 1 bgrows
+ ld bc, BG_MAP_WIDTH
ld a, 7 ; palette
call ByteFill
@@ -54,27 +54,27 @@
; lines 3-4
hlbgcoord 0, 3
- ld bc, 2 bgrows
+ ld bc, 2 * BG_MAP_WIDTH
ld a, 2
call ByteFill
; line 5
hlbgcoord 0, 5
- ld bc, 1 bgrows
+ ld bc, BG_MAP_WIDTH
ld a, 3
call ByteFill
; line 6
hlbgcoord 0, 6
- ld bc, 1 bgrows
+ ld bc, BG_MAP_WIDTH
ld a, 4
call ByteFill
; line 7
hlbgcoord 0, 7
- ld bc, 1 bgrows
+ ld bc, BG_MAP_WIDTH
ld a, 5
call ByteFill
; lines 8-9
hlbgcoord 0, 8
- ld bc, 2 bgrows
+ ld bc, 2 * BG_MAP_WIDTH
ld a, 6
call ByteFill
@@ -87,7 +87,7 @@
; Suicune gfx
hlbgcoord 0, 12
- ld bc, 6 bgrows ; the rest of the screen
+ ld bc, 6 * BG_MAP_WIDTH ; the rest of the screen
ld a, 0 | VRAM_BANK_1
call ByteFill
@@ -110,7 +110,7 @@
; Clear screen tiles
hlbgcoord 0, 0
- ld bc, 64 bgrows
+ ld bc, 64 * BG_MAP_WIDTH
ld a, " "
call ByteFill
--- a/macros/coords.asm
+++ b/macros/coords.asm
@@ -1,6 +1,3 @@
-screenrows EQUS "* SCREEN_WIDTH"
-bgrows EQUS "* BG_MAP_WIDTH"
-
hlcoord EQUS "coord hl,"
bccoord EQUS "coord bc,"
decoord EQUS "coord de,"
@@ -8,9 +5,9 @@
coord: MACRO
; register, x, y[, origin]
if _NARG < 4
- ld \1, (\3) screenrows + (\2) + TileMap
+ ld \1, (\3) * SCREEN_WIDTH + (\2) + TileMap
else
- ld \1, (\3) screenrows + (\2) + \4
+ ld \1, (\3) * SCREEN_WIDTH + (\2) + \4
endc
ENDM
@@ -21,25 +18,16 @@
bgcoord: MACRO
; register, x, y[, origin]
if _NARG < 4
- ld \1, (\3) bgrows + (\2) + vBGMap0
+ ld \1, (\3) * BG_MAP_WIDTH + (\2) + vBGMap0
else
- ld \1, (\3) bgrows + (\2) + \4
+ ld \1, (\3) * BG_MAP_WIDTH + (\2) + \4
endc
ENDM
-hldims EQUS "dims hl,"
-bcdims EQUS "dims bc,"
-dedims EQUS "dims de,"
-
-dims: MACRO
-; register, width, height
- lb \1, \3, \2
-ENDM
-
dwcoord: MACRO
; x, y
rept _NARG / 2
- dw (\2) screenrows + (\1) + TileMap
+ dw (\2) * SCREEN_WIDTH + (\1) + TileMap
shift
shift
endr
@@ -48,9 +36,9 @@
ldcoord_a: MACRO
; x, y[, origin]
if _NARG < 3
- ld [(\2) screenrows + (\1) + TileMap], a
+ ld [(\2) * SCREEN_WIDTH + (\1) + TileMap], a
else
- ld [(\2) screenrows + (\1) + \3], a
+ ld [(\2) * SCREEN_WIDTH + (\1) + \3], a
endc
ENDM
@@ -57,8 +45,8 @@
lda_coord: MACRO
; x, y[, origin]
if _NARG < 3
- ld a, [(\2) screenrows + (\1) + TileMap]
+ ld a, [(\2) * SCREEN_WIDTH + (\1) + TileMap]
else
- ld a, [(\2) screenrows + (\1) + \3]
+ ld a, [(\2) * SCREEN_WIDTH + (\1) + \3]
endc
ENDM