summaryrefslogtreecommitdiff
path: root/macros.asm
blob: 2a6e11e0653c93f9c4497283bcd808e85b22d473 (plain)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
RGB: MACRO
	dw (\3 << 10 | \2 << 5 | \1)
ENDM

bank1call: MACRO
	rst $18
	dw \1
ENDM

farcall: MACRO
	rst $28
	db BANK(\1)
	dw \1
ENDM

; used when the specified bank does not match the bank of the specified function
; otherwise, farcall is preferred
farcallx: MACRO
	rst $28
	db \1
	dw \2
ENDM

emptybank: MACRO
	rept $4000
	db $ff
	endr
ENDM

text: MACRO
	dw ((\1 + ($4000 * (BANK(\1) - 1))) - (TextOffsets + ($4000 * (BANK(TextOffsets) - 1)))) & $ffff
	db ((\1 + ($4000 * (BANK(\1) - 1))) - (TextOffsets + ($4000 * (BANK(TextOffsets) - 1)))) >> 16
ENDM

; notes
C_ EQU $1
C# EQU $2
D_ EQU $3
D# EQU $4
E_ EQU $5
F_ EQU $6
F# EQU $7
G_ EQU $8
G# EQU $9
A_ EQU $A
A# EQU $B
B_ EQU $C

; instruments
bass   EQU $1
snare1 EQU $3 ; medium length
snare2 EQU $5 ; medium length
snare3 EQU $7 ; short
snare4 EQU $9 ; long
snare5 EQU $C ; long

note: MACRO
	db (\1 << 4) | (\2 - 1)
ENDM

rest: MACRO
	db \1 - 1
ENDM

speed: MACRO
	db $d0, \1
ENDM

octave: MACRO
	db ($d << 4) | \1
ENDM

inc_octave: MACRO
	db $d7
ENDM

dec_octave: MACRO
	db $d8
ENDM

tie: MACRO
	db $d9
ENDM

musicdc: MACRO
	db $dc, \1
ENDM

MainLoop: MACRO
	db $dd
ENDM

EndMainLoop: MACRO
	db $de
ENDM

Loop: MACRO
	db $df, \1
ENDM

EndLoop: MACRO
	db $e0
ENDM

; unused
;music_jp: MACRO
;	db $e1
;	dw \1
;ENDM

music_call: MACRO
	db $e2
	dw \1
ENDM

music_ret: MACRO
	db $e3
ENDM

musice4: MACRO
	db $e4, \1
ENDM

duty: MACRO
	db $e5, \1 << 6
ENDM

volume: MACRO
	db $e6, \1
ENDM

wave: MACRO
	db $e7, \1
ENDM

musice8: MACRO
	db $e8, \1
ENDM

musice9: MACRO
	db $e9, \1
ENDM

vibrato_type: MACRO
	db $ea, \1
ENDM

vibrato_delay: MACRO
	db $eb, \1
ENDM

; unused
;musicec: MACRO
;	db $ec, \1
;ENDM

; unused
;musiced: MACRO
;	db $ed, \1
;ENDM

music_end: MACRO
	db $ff
ENDM

sfx_0: MACRO
	db \1, \2
ENDM

sfx_1: MACRO
	db $10, \1
ENDM

sfx_2: MACRO
	db $20 | \1
ENDM

sfx_loop: MACRO
	db $30, \1
ENDM

sfx_endloop: MACRO
	db $40
ENDM

sfx_5: MACRO
	db $50, \1
ENDM

sfx_6: MACRO
	db $60, \1
ENDM

sfx_8: MACRO
	db $80, \1
ENDM

sfx_end: MACRO
	db $f0
ENDM