-
Notifications
You must be signed in to change notification settings - Fork 10
/
macros.s
93 lines (74 loc) · 2.13 KB
/
macros.s
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
processor 6502
mac varbase
NEXT_VAR set {1}
endm
mac var
{1} = NEXT_VAR
NEXT_VAR set NEXT_VAR + 1
endm
mac varrange
{1} = NEXT_VAR
NEXT_VAR set NEXT_VAR + {2}
endm
mac checkvarbase
if NEXT_VAR > {1}
err
endif
endm
; BIT instruction for skipping the next 1- or 2-byte instruction
mac skip1
dc.b $24
endm
mac skip2
dc.b $2c
endm
mac checkscriptend
if * > scriptCodeEnd
err
endif
endm
; Text jump. Game texts need to be located between $0000-$7fff to use
mac textjump
dc.b >{1} | $80
dc.b <{1}
endm
; Scripting macros
mac setscript
lda #<{1}
ldx #>{1}
jsr SetScript
endm
mac stopscript
jsr StopScript
endm
mac settrigger
lda #{3}
sta temp1
ldy #{1}
lda #<{2}
ldx #>{2}
jsr SetActorTrigger
endm
mac removetrigger
ldy #{1}
jsr RemoveActorTrigger
endm
mac speak
ldy #{1}
lda #<{2}
ldx #>{2}
jsr SpeakLine
endm
mac checkitem
lda #{1}
jsr FindItem
endm
mac additem
lda #{1}
lda #{2}
jsr AddItem
endm
mac removeitem
lda #{1}
jsr RemoveItem
endm