pokecrystal/macros/coords.asm

52 lines
887 B
NASM
Raw Normal View History

hlcoord EQUS "coord hl,"
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
ld \1, (\3) * SCREEN_WIDTH + (\2) + wTilemap
2017-12-14 05:36:24 +00:00
else
ld \1, (\3) * SCREEN_WIDTH + (\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) * BG_MAP_WIDTH + (\2) + vBGMap0
else
ld \1, (\3) * BG_MAP_WIDTH + (\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
; x, y
2018-05-06 16:16:57 +00:00
rept _NARG / 2
dw (\2) * SCREEN_WIDTH + (\1) + wTilemap
shift 2
2018-05-06 16:16:57 +00:00
endr
2017-12-28 21:31:16 +00:00
ENDM
2017-12-14 05:36:24 +00:00
ldcoord_a: MACRO
; x, y[, origin]
2017-12-14 05:36:24 +00:00
if _NARG < 3
ld [(\2) * SCREEN_WIDTH + (\1) + wTilemap], a
2017-12-14 05:36:24 +00:00
else
ld [(\2) * SCREEN_WIDTH + (\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
; x, y[, origin]
2017-12-14 05:36:24 +00:00
if _NARG < 3
ld a, [(\2) * SCREEN_WIDTH + (\1) + wTilemap]
else
ld a, [(\2) * SCREEN_WIDTH + (\1) + \3]
endc
2017-12-14 05:36:24 +00:00
ENDM