summaryrefslogtreecommitdiff
path: root/src/macros/code.asm
blob: 3441ec3df25b04d5db9133a21f26b30a1b809726 (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
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_out_flag: MACRO
	call ZeroStackFlagValue
	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