-
Notifications
You must be signed in to change notification settings - Fork 95
/
Copy pathdata.asm
99 lines (82 loc) · 1.55 KB
/
data.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
MACRO dn
db ((\1) << 4) | (\2)
ENDM
MACRO dbw
db \1
dw \2
ENDM
MACRO dwb
dw \1
db \2
ENDM
MACRO dx
DEF x = 8 * ((\1) - 1)
REPT \1
db ((\2) >> x) & $ff
DEF x -= 8
ENDR
ENDM
MACRO dt ; three-byte (big-endian)
dx 3, \1
ENDM
MACRO dd ; four-byte (big-endian)
dx 4, \1
ENDM
MACRO bigdw ; big-endian word
dx 2, \1
ENDM
MACRO sgb
db (\1) << 3 + (\2) ; sgb_command * 8 + length
ENDM
MACRO rgb
dw ((\3) << 10 | (\2) << 5 | (\1))
ENDM
; poketcg specific macros below
MACRO textpointer
dw (((\1) + ($4000 * (BANK(\1) - 1))) - (TextOffsets + ($4000 * (BANK(TextOffsets) - 1)))) & $ffff
db (((\1) + ($4000 * (BANK(\1) - 1))) - (TextOffsets + ($4000 * (BANK(TextOffsets) - 1)))) >> 16
const \1_
EXPORT \1_
ENDM
MACRO energy
DEF en = 0
IF _NARG > 1
REPT _NARG / 2
DEF x = 4 - 8 * ((\1) % 2)
DEF en += \2 << (((\1) * 4) + x)
SHIFT 2
ENDR
REPT NUM_TYPES / 2
db LOW(en)
DEF en >>= 8
ENDR
ELSE
db 0, 0, 0, 0
ENDC
ENDM
MACRO gfx
dw ($4000 * (BANK(\1) - BANK(CardGraphics)) + ((\1) - $4000)) / 8
ENDM
MACRO frame_table
db BANK(\1) - BANK(AnimData1) ; maybe use better reference for Bank20?
dw \1
ENDM
MACRO frame_data
db \1 ; frame index
db \2 ; anim count
db \3 ; x translation
db \4 ; y translation
ENDM
MACRO tx
dw \1_
ENDM
MACRO textitem
db \1, \2
tx \3
ENDM
; cursor x / cursor y / attribute / idx-up / idx-down / idx-right / idx-left
; idx-[direction] means the index to get when the input is in the direction.
; its attribute is used for drawing a flipped cursor.
MACRO cursor_transition
db \1, \2, \3, \4, \5, \6, \7
ENDM