blob: 1721d7513398774a187bd9e5f20b4113cd74f5ca (
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
|
INCROM: MACRO
INCBIN "baserom.gbc", \1, \2 - \1
ENDM
const_def: MACRO
IF _NARG > 0
const_value = \1
ELSE
const_value = 0
ENDC
ENDM
const: MACRO
\1 EQU const_value
const_value = const_value + 1
ENDM
dn: MACRO
db \1 << 4 | \2
ENDM
dbw: MACRO
db \1
dw \2
ENDM
dwb: MACRO
dw \1
db \2
ENDM
dx: MACRO
x = 8 * ((\1) - 1)
rept \1
db ((\2) >> x) & $ff
x = x + -8
endr
ENDM
dt: MACRO ; three-byte (big-endian)
dx 3, \1
ENDM
dd: MACRO ; four-byte (big-endian)
dx 4, \1
ENDM
bigdw: MACRO ; big-endian word
dx 2, \1
ENDM
lb: MACRO ; r, hi, lo
ld \1, (\2) << 8 + ((\3) & $ff)
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
rgb: MACRO
dw (\3 << 10 | \2 << 5 | \1)
ENDM
textpointer: 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
const \1_
GLOBAL \1_
ENDM
text_hl: MACRO
ld hl, \1_
ENDM
text_de: MACRO
ld de, \1_
ENDM
sgb: MACRO
db \1 * 8 + \2 ; sgb_command * 8 + length
ENDM
|