summaryrefslogtreecommitdiff
path: root/macros/flag.asm
blob: c2b307f00347732bb0ded6d9f11973053fcc0d85 (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
engine_flag_def: macro
	const \1
\1_ADDR EQUS "\2"
\1_BIT  EQU \3
endm

engine_flag: macro
	dwb \1_ADDR, (1 << \1_BIT)
endm

CheckFlag: macro
	ld a, [\1_ADDR]
	bit \1_BIT, a
endm

CheckFlagHL: macro
	ld hl, \1_ADDR
	bit \1_BIT, [hl]
endm

SetFlag: macro
	ld hl, \1_ADDR
	set \1_BIT, [hl]
endm

ClearFlag: macro
	ld hl, \1_ADDR
	res \1_BIT, [hl]
endm

CheckFlagForceReuseA: macro
	bit \1_BIT, a
endm

CheckFlagForceReuseHL: macro
	bit \1_BIT, [hl]
endm

SetFlagForceReuseHL: macro
	set \1_BIT, [hl]
endm

ClearFlagForceReuseHL: macro
	res \1_BIT, [hl]
endm