forked from Rangi42/polishedcrystal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoords.asm
57 lines (50 loc) · 991 Bytes
/
coords.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
hlcoord EQUS "coord hl,"
bccoord EQUS "coord bc,"
decoord EQUS "coord de,"
coord: MACRO
; register, x, y[, origin]
if _NARG < 4
ld \1, (\3) * SCREEN_WIDTH + (\2) + wTileMap
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
endc
ENDM
dwcoord: MACRO
; x, y
rept _NARG / 2
dw (\2) * SCREEN_WIDTH + (\1) + wTileMap
shift 2
endr
ENDM
ldcoord_a: MACRO
; x, y[, origin]
if _NARG < 3
ld [(\2) * SCREEN_WIDTH + (\1) + wTileMap], a
else
ld [(\2) * SCREEN_WIDTH + (\1) + \3], a
endc
ENDM
lda_coord: MACRO
; x, y[, origin]
if _NARG < 3
ld a, [(\2) * SCREEN_WIDTH + (\1) + wTileMap]
else
ld a, [(\2) * SCREEN_WIDTH + (\1) + \3]
endc
ENDM
menu_coords: MACRO
; x1, y1, x2, y2
db \2, \1 ; start coords
db \4, \3 ; end coords
ENDM