-
Notifications
You must be signed in to change notification settings - Fork 95
/
Copy pathcode.asm
69 lines (59 loc) · 1.24 KB
/
code.asm
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
MACRO lb ; r, hi, lo
ld \1, (\2) << 8 + ((\3) & $ff)
ENDM
MACRO ldtx
IF _NARG == 2
ld \1, \2_
ELSE
ld \1, \2_ \3
ENDC
ENDM
MACRO bank1call
rst $18
dw \1
ENDM
MACRO farcall
rst $28
IF _NARG == 1
db BANK(\1)
dw \1
ELSE
db \1
dw \2
ENDC
ENDM
; runs SetEventValue with the next byte as the event, c as the new value
MACRO set_event_value
call SetStackEventValue
db \1
ENDM
; runs ZeroOutEventValue with the next byte as the event
; functionally identical to set_event_zero but intended for single-bit events
MACRO set_event_false
call SetStackEventFalse
db \1
ENDM
; runs ZeroOutEventValue with the next byte as the event
; functionally identical to set_event_false but intended for multi-bit events
MACRO set_event_zero
call SetStackEventZero
db \1
ENDM
; runs MaxOutEventValue with the next byte as the event
MACRO max_event_value
call MaxStackEventValue
db \1
ENDM
; runs GetEventValue with the next byte as the event. returns value in a
MACRO get_event_value
call GetStackEventValue
db \1
ENDM
; the rst $38 handler is a single ret instruction
; probably used for testing purposes during development
DEF debug_nop EQUS "rst $38"
; Returns to the pointer in bc instead of where the stack was.
MACRO retbc
push bc
ret
ENDM