summaryrefslogtreecommitdiff
path: root/src/macros/code.asm
blob: 8921a04edc00d951080bb11199a9936eb7cade78 (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
lb: MACRO ; r, hi, lo
	ld \1, (\2) << 8 + ((\3) & $ff)
ENDM

ldtx: MACRO
if _NARG == 2
	ld \1, \2_
else
	ld \1, \2_ \3
endc
ENDM

bank1call: MACRO
	rst $18
	dw \1
ENDM

farcall: MACRO
	rst $28
if _NARG == 1
	db BANK(\1)
	dw \1
else
	db \1
	dw \2
endc
ENDM

; runs SetEventFlagValue with the next value as the flag, c as the new value
set_flag_value: MACRO
	call SetStackFlagValue
	db \1
ENDM

; runs ZeroOutEventFlag with the next value as the flag
zero_flag_value: MACRO
	call ZeroStackFlagValue
	db \1
ENDM

; a second version of the above with no real differences
zero_flag_value2: MACRO
	call ZeroStackFlagValue2
	db \1
ENDM

; runs MaxOutEventFlag with the next value as the flag
max_flag_value: MACRO
	call MaxStackFlagValue
	db \1
ENDM

; runs GetEventFlagValue with the next value as the flag. returns value in a
get_flag_value: MACRO
	call GetStackFlagValue
	db \1
ENDM

; the rst $38 handler is a single ret instruction
; probably used for testing purposes during development
debug_ret EQUS "rst $38"

; Returns to the pointer in bc instead of where the stack was.
retbc: MACRO
	push bc
	ret
ENDM