2017-12-29 16:05:33 -05:00
|
|
|
hlcoord EQUS "coord hl,"
|
2017-12-28 13:23:44 +01:00
|
|
|
bccoord EQUS "coord bc,"
|
|
|
|
decoord EQUS "coord de,"
|
2017-12-14 00:36:24 -05:00
|
|
|
|
|
|
|
coord: MACRO
|
|
|
|
; register, x, y[, origin]
|
|
|
|
if _NARG < 4
|
2018-01-23 17:39:09 -05:00
|
|
|
ld \1, (\3) * SCREEN_WIDTH + (\2) + wTileMap
|
2017-12-14 00:36:24 -05:00
|
|
|
else
|
2017-12-29 18:59:50 -05:00
|
|
|
ld \1, (\3) * SCREEN_WIDTH + (\2) + \4
|
2017-12-29 16:05:33 -05:00
|
|
|
endc
|
|
|
|
ENDM
|
|
|
|
|
|
|
|
hlbgcoord EQUS "bgcoord hl,"
|
|
|
|
bcbgcoord EQUS "bgcoord bc,"
|
|
|
|
debgcoord EQUS "bgcoord de,"
|
|
|
|
|
|
|
|
bgcoord: MACRO
|
|
|
|
; register, x, y[, origin]
|
|
|
|
if _NARG < 4
|
2017-12-29 18:59:50 -05:00
|
|
|
ld \1, (\3) * BG_MAP_WIDTH + (\2) + vBGMap0
|
2017-12-29 16:05:33 -05:00
|
|
|
else
|
2017-12-29 18:59:50 -05:00
|
|
|
ld \1, (\3) * BG_MAP_WIDTH + (\2) + \4
|
2017-12-14 00:36:24 -05:00
|
|
|
endc
|
2017-12-28 22:31:16 +01:00
|
|
|
ENDM
|
2017-12-14 00:36:24 -05:00
|
|
|
|
|
|
|
dwcoord: MACRO
|
2017-12-29 16:05:33 -05:00
|
|
|
; x, y
|
2018-05-06 12:16:57 -04:00
|
|
|
rept _NARG / 2
|
2018-01-23 17:39:09 -05:00
|
|
|
dw (\2) * SCREEN_WIDTH + (\1) + wTileMap
|
2017-12-14 00:36:24 -05:00
|
|
|
shift
|
|
|
|
shift
|
2018-05-06 12:16:57 -04:00
|
|
|
endr
|
2017-12-28 22:31:16 +01:00
|
|
|
ENDM
|
2017-12-14 00:36:24 -05:00
|
|
|
|
|
|
|
ldcoord_a: MACRO
|
2017-12-29 16:05:33 -05:00
|
|
|
; x, y[, origin]
|
2017-12-14 00:36:24 -05:00
|
|
|
if _NARG < 3
|
2018-01-23 17:39:09 -05:00
|
|
|
ld [(\2) * SCREEN_WIDTH + (\1) + wTileMap], a
|
2017-12-14 00:36:24 -05:00
|
|
|
else
|
2017-12-29 18:59:50 -05:00
|
|
|
ld [(\2) * SCREEN_WIDTH + (\1) + \3], a
|
2017-12-14 00:36:24 -05:00
|
|
|
endc
|
2017-12-28 22:31:16 +01:00
|
|
|
ENDM
|
2017-12-14 00:36:24 -05:00
|
|
|
|
|
|
|
lda_coord: MACRO
|
2017-12-29 16:05:33 -05:00
|
|
|
; x, y[, origin]
|
2017-12-14 00:36:24 -05:00
|
|
|
if _NARG < 3
|
2018-01-23 17:39:09 -05:00
|
|
|
ld a, [(\2) * SCREEN_WIDTH + (\1) + wTileMap]
|
2017-12-28 21:22:35 -05:00
|
|
|
else
|
2017-12-29 18:59:50 -05:00
|
|
|
ld a, [(\2) * SCREEN_WIDTH + (\1) + \3]
|
2017-12-28 21:22:35 -05:00
|
|
|
endc
|
2017-12-14 00:36:24 -05:00
|
|
|
ENDM
|