2017-12-29 21:05:33 +00:00
|
|
|
screenrows EQUS "* SCREEN_WIDTH"
|
|
|
|
bgrows EQUS "* BG_MAP_WIDTH"
|
|
|
|
|
|
|
|
hlcoord EQUS "coord hl,"
|
2017-12-28 12:23:44 +00:00
|
|
|
bccoord EQUS "coord bc,"
|
|
|
|
decoord EQUS "coord de,"
|
2017-12-14 05:36:24 +00:00
|
|
|
|
|
|
|
coord: MACRO
|
|
|
|
; register, x, y[, origin]
|
|
|
|
if _NARG < 4
|
2017-12-29 21:05:33 +00:00
|
|
|
ld \1, (\3) screenrows + (\2) + TileMap
|
2017-12-14 05:36:24 +00:00
|
|
|
else
|
2017-12-29 21:05:33 +00:00
|
|
|
ld \1, (\3) screenrows + (\2) + \4
|
|
|
|
endc
|
|
|
|
ENDM
|
|
|
|
|
|
|
|
hlbgcoord EQUS "bgcoord hl,"
|
|
|
|
bcbgcoord EQUS "bgcoord bc,"
|
|
|
|
debgcoord EQUS "bgcoord de,"
|
|
|
|
|
|
|
|
bgcoord: MACRO
|
|
|
|
; register, x, y[, origin]
|
|
|
|
if _NARG < 4
|
|
|
|
ld \1, (\3) bgrows + (\2) + vBGMap0
|
|
|
|
else
|
|
|
|
ld \1, (\3) bgrows + (\2) + \4
|
2017-12-14 05:36:24 +00:00
|
|
|
endc
|
2017-12-28 21:31:16 +00:00
|
|
|
ENDM
|
2017-12-14 05:36:24 +00:00
|
|
|
|
|
|
|
dwcoord: MACRO
|
2017-12-29 21:05:33 +00:00
|
|
|
; x, y
|
2017-12-14 05:36:24 +00:00
|
|
|
rept _NARG / 2
|
2017-12-29 21:05:33 +00:00
|
|
|
dw (\2) screenrows + (\1) + TileMap
|
2017-12-14 05:36:24 +00:00
|
|
|
shift
|
|
|
|
shift
|
|
|
|
endr
|
2017-12-28 21:31:16 +00:00
|
|
|
ENDM
|
2017-12-14 05:36:24 +00:00
|
|
|
|
|
|
|
ldcoord_a: MACRO
|
2017-12-29 21:05:33 +00:00
|
|
|
; x, y[, origin]
|
2017-12-14 05:36:24 +00:00
|
|
|
if _NARG < 3
|
2017-12-29 21:05:33 +00:00
|
|
|
ld [(\2) screenrows + (\1) + TileMap], a
|
2017-12-14 05:36:24 +00:00
|
|
|
else
|
2017-12-29 21:05:33 +00:00
|
|
|
ld [(\2) screenrows + (\1) + \3], a
|
2017-12-14 05:36:24 +00:00
|
|
|
endc
|
2017-12-28 21:31:16 +00:00
|
|
|
ENDM
|
2017-12-14 05:36:24 +00:00
|
|
|
|
|
|
|
lda_coord: MACRO
|
2017-12-29 21:05:33 +00:00
|
|
|
; x, y[, origin]
|
2017-12-14 05:36:24 +00:00
|
|
|
if _NARG < 3
|
2017-12-29 21:05:33 +00:00
|
|
|
ld a, [(\2) screenrows + (\1) + TileMap]
|
2017-12-29 02:22:35 +00:00
|
|
|
else
|
2017-12-29 21:05:33 +00:00
|
|
|
ld a, [(\2) screenrows + (\1) + \3]
|
2017-12-29 02:22:35 +00:00
|
|
|
endc
|
2017-12-14 05:36:24 +00:00
|
|
|
ENDM
|
2017-12-29 21:14:02 +00:00
|
|
|
|
|
|
|
ld_dims: MACRO
|
|
|
|
; register, width, height
|
|
|
|
lb \1, \3, \2
|
|
|
|
ENDM
|