2022-06-06 14:25:42 -07:00
|
|
|
DEF hlcoord EQUS "coord hl,"
|
|
|
|
DEF bccoord EQUS "coord bc,"
|
|
|
|
DEF decoord EQUS "coord de,"
|
2017-12-13 21:36:24 -08:00
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO coord
|
2017-12-13 21:36:24 -08:00
|
|
|
; register, x, y[, origin]
|
|
|
|
if _NARG < 4
|
2022-06-06 14:25:42 -07:00
|
|
|
ld \1, (\3) * SCREEN_WIDTH + (\2) + wTilemap
|
2017-12-13 21:36:24 -08:00
|
|
|
else
|
2022-06-06 14:25:42 -07:00
|
|
|
ld \1, (\3) * SCREEN_WIDTH + (\2) + \4
|
2017-12-29 13:05:33 -08:00
|
|
|
endc
|
|
|
|
ENDM
|
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF hlbgcoord EQUS "bgcoord hl,"
|
|
|
|
DEF bcbgcoord EQUS "bgcoord bc,"
|
|
|
|
DEF debgcoord EQUS "bgcoord de,"
|
2017-12-29 13:05:33 -08:00
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO bgcoord
|
2017-12-29 13:05:33 -08:00
|
|
|
; register, x, y[, origin]
|
|
|
|
if _NARG < 4
|
2022-06-06 14:25:42 -07:00
|
|
|
ld \1, (\3) * BG_MAP_WIDTH + (\2) + vBGMap0
|
2017-12-29 13:05:33 -08:00
|
|
|
else
|
2022-06-06 14:25:42 -07:00
|
|
|
ld \1, (\3) * BG_MAP_WIDTH + (\2) + \4
|
2017-12-13 21:36:24 -08:00
|
|
|
endc
|
2017-12-28 13:31:16 -08:00
|
|
|
ENDM
|
2017-12-13 21:36:24 -08:00
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO dwcoord
|
2017-12-29 13:05:33 -08:00
|
|
|
; x, y
|
2022-06-06 14:25:42 -07:00
|
|
|
rept _NARG / 2
|
|
|
|
dw (\2) * SCREEN_WIDTH + (\1) + wTilemap
|
|
|
|
shift 2
|
|
|
|
endr
|
2017-12-28 13:31:16 -08:00
|
|
|
ENDM
|
2017-12-13 21:36:24 -08:00
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO ldcoord_a
|
2017-12-29 13:05:33 -08:00
|
|
|
; x, y[, origin]
|
2017-12-13 21:36:24 -08:00
|
|
|
if _NARG < 3
|
2022-06-06 14:25:42 -07:00
|
|
|
ld [(\2) * SCREEN_WIDTH + (\1) + wTilemap], a
|
2017-12-13 21:36:24 -08:00
|
|
|
else
|
2022-06-06 14:25:42 -07:00
|
|
|
ld [(\2) * SCREEN_WIDTH + (\1) + \3], a
|
2017-12-13 21:36:24 -08:00
|
|
|
endc
|
2017-12-28 13:31:16 -08:00
|
|
|
ENDM
|
2017-12-13 21:36:24 -08:00
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO lda_coord
|
2017-12-29 13:05:33 -08:00
|
|
|
; x, y[, origin]
|
2017-12-13 21:36:24 -08:00
|
|
|
if _NARG < 3
|
2022-06-06 14:25:42 -07:00
|
|
|
ld a, [(\2) * SCREEN_WIDTH + (\1) + wTilemap]
|
2017-12-28 18:22:35 -08:00
|
|
|
else
|
2022-06-06 14:25:42 -07:00
|
|
|
ld a, [(\2) * SCREEN_WIDTH + (\1) + \3]
|
2017-12-28 18:22:35 -08:00
|
|
|
endc
|
2017-12-13 21:36:24 -08:00
|
|
|
ENDM
|
2020-04-04 12:19:43 -07:00
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO menu_coords
|
2020-04-04 12:19:43 -07:00
|
|
|
; x1, y1, x2, y2
|
|
|
|
db \2, \1 ; start coords
|
|
|
|
db \4, \3 ; end coords
|
|
|
|
ENDM
|