-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinkctrl.mac
235 lines (235 loc) · 2.7 KB
/
linkctrl.mac
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
MACRO
&lab _BlockMove
&lab ldx #$2B02
jsl $E10000
MEND
MACRO
&lab _HLock
&lab ldx #$2002
jsl $E10000
MEND
MACRO
&lab _HUnlock
&lab ldx #$2202
jsl $E10000
MEND
MACRO
&lab _DrawStringWidth
&lab ldx #$1512
jsl $E10000
MEND
MACRO
&lab _EraseRect
&lab ldx #$5504
jsl $E10000
MEND
MACRO
&lab _GetForeColor
&lab ldx #$A104
jsl $E10000
MEND
MACRO
&lab _MoveTo
&lab ldx #$3A04
jsl $E10000
MEND
MACRO
&lab _PenNormal
&lab ldx #$3604
jsl $E10000
MEND
MACRO
&lab _SetForeColor
&lab ldx #$A004
jsl $E10000
MEND
macro
&l ~FindHandle &p1
&l ph4 &p1
ldx #$1A02
jsl $E10000
mend
macro
&l ~GetHandleSize &p1
&l ph4 &p1
ldx #$1802
jsl $E10000
mend
macro
&l ~HLock &p1
&l ph4 &p1
ldx #$2002
jsl $E10000
mend
macro
&l ~SetBackColor &p1
&l ph2 &p1
ldx #$A204
jsl $E10000
mend
macro
&l ~SetFontFlags &p1
&l ph2 &p1
ldx #$9804
jsl $E10000
mend
macro
&l ~SetForeColor &p1
&l ph2 &p1
ldx #$A004
jsl $E10000
mend
macro
&l ~LoadResource &p1,&p2
&l ph2 &p1
ph4 &p2
ldx #$0E1E
jsl $E10000
mend
macro
&l ph2 &n1
&l anop
aif "&n1"="*",.f
lclc &c
&c amid &n1,1,1
aif "&c"="#",.d
aif s:longa=1,.a
rep #%00100000
.a
aif "&c"<>"{",.b
&c amid &n1,l:&n1,1
aif "&c"<>"}",.g
&n1 amid &n1,2,l:&n1-2
lda (&n1)
pha
ago .e
.b
aif "&c"="<",.c
lda &n1
pha
ago .e
.c
&n1 amid &n1,2,l:&n1-1
pei &n1
ago .e
.d
&n1 amid &n1,2,l:&n1-1
pea &n1
ago .f
.e
aif s:longa=1,.f
sep #%00100000
.f
mexit
.g
mnote "Missing closing '}'",16
mend
macro
&l ph4 &n1
&l anop
aif "&n1"="*",.f
lclc &c
&c amid &n1,1,1
aif "&c"="#",.d
aif s:longa=1,.a
rep #%00100000
.a
aif "&c"<>"{",.b
&c amid &n1,l:&n1,1
aif "&c"<>"}",.g
&n1 amid &n1,2,l:&n1-2
ldy #2
lda (&n1),y
pha
lda (&n1)
pha
ago .e
.b
aif "&c"<>"[",.c
ldy #2
lda &n1,y
pha
lda &n1
pha
ago .e
.c
aif "&c"<>"<",.c1
&n1 amid &n1,2,l:&n1-1
pei &n1+2
pei &n1
ago .e
.c1
lda &n1+2
pha
lda &n1
pha
ago .e
.d
&n1 amid &n1,2,l:&n1-1
pea +(&n1)|-16
pea &n1
ago .f
.e
aif s:longa=1,.f
sep #%00100000
.f
mexit
.g
mnote "Missing closing '}'",16
mend
macro
&lab ldax &address,&off
lclc &c
&lab anop
&c amid &address,1,1
aif "&c"="[",.deref
aif "&c"="#",.imm
lda &address
ldx &address+2
mexit
.deref
mexit
.imm
aif "&address"="0",.imm0
&address amid &address,2,l:&address-1
lda #&address
ldx #^&address
mexit
.imm0
lda #0
tax
mexit
.deref
&address amid &address,2,l:&address-2
aif c:&off=0,.deref0
aif "&off"="y",.derefy
&c amid &off,1,1
aif "&c"<>"#",.derefldy
ldy &off+2
ago .deref2
.derefldy
ldy &off
.derefy
iny
iny
.deref2
lda [&address],y
tax
dey
dey
lda [&address],y
mexit
.deref0
ldy #2
lda [&address],y
tax
lda [&address]
mend
macro
&lab stax &address
lclc &c
&lab anop
&c amid &address,1,1
sta &address
stx &address+2
mend