-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathasmprint
449 lines (420 loc) · 4.71 KB
/
asmprint
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
.PAGE 'ASMPRINT'
; MAKE AN ENTRY IN LENGTH TABLE
; X CONTAINS COL. FOR ERROR
; Y CONTAINS LENGTH
; A CONTAINS ERROR CODE
LTINS LDA #0
TAY
LTINS2 STA LTAB+4
STY LTAB
LDX IPC
STX LTAB+2
LDX IPC+1
STX LTAB+3
; ADJUST RELATIVE BRANCH
CPY #$FF ;-1?
BNE L20 ;NO...
INY ;MAKE X=0
L20 CPY #4
BNE L30
CMP #201
BNE L30
LDA28 LDY #2
L30 CPY #3 ;CHECK FOR DBYTE
BNE L31 ;ONLY INCREMENT
CMP #202
BEQ LDA28
L31 TYA
CPY #$15
BCC LDA39
LDY #$14
LDA39 STY KLEN
CLC
ADC IPC ;IPC + KINC
STA IPC
BCC L31A
INC IPC+1
L31A LDA L23
BEQ LDA0B
LDA LTAB+4
BEQ LDA5E
CMP #204 ;.SKIP ?
BNE P202
LDA #$10
AND IFLAGS
BNE LDA0B
JMP LDFE9
P202 STA L1E
JMP LDBC7
LDA5E LDA #$10
AND IFLAGS
BEQ LDA6F
LDA LTAB+4
BEQ LDA6C
CMP #$C8
BCC LDA6F
LDA6C JMP LDC4E
LDA6F LDA LTAB+2
STA IPC
LDA LTAB+3
STA IPC+1
JSR LDBF8
LDY #0
STY ICSB
LDA JLABL
BNE LDA90
LDA JORG
BNE LDA90
LDA IPC
CMP L44
LDA IPC+1
SBC L45
BCC LDAD0
LDA90 LDX #MSG7-MSGS
JSR LDFE1
LDA IPC+1
LDX IPC
JSR WRAX
LDA JLABL
BEQ Q80
JSR LDFFA
LDX #0
Q73 LDA ICRD,X
INX
CMP #' '
BNE Q72 ;NOT BLANK
CPX IMAXCL
BEQ Q80 ;RAN OUT OF CARD
BNE Q73
Q72 JSR OUTALL ;OUTPUT LABEL
CPX IMAXCL
BEQ LDAC3 ;RAN OUT OF CARD
LDA ICRD,X
INX
CMP #$20
BNE Q72 ;STILL LABEL
Q80 JSR OUTPUT
LDAC3 LDA #$10
CLC
ADC IPC
STA L44
LDA IPC+1
ADC #$00
STA L45
LDAD0 LDA LTAB
LDAD2 PHA
LDA #0
STA L34
LDX #0
LDA ICRD
CMP #$3B
BNE LDAE2
JMP LDB90
LDAE2 LDY #0
PLA
TAX
BMI LDAF4
CMP #4
BMI LDAF4
LDX #2
SEC
SBC #2
JMP LDAF6
LDAF4 LDA #0
LDAF6 PHA
LDAF7 DEX
BMI LDB19
LDA #$08
AND IFLAGS
BNE LDB05
LDA (L09),Y
JMP LDB0C
LDB05 LDY ICSB
LDA L0170,Y
INC ICSB
LDB0C INC L34
INC L34
JSR NUMA
JSR LDBED
JMP LDAF7
LDB19 LDA L1F
BEQ LDB20
JMP LDBB2
LDB20 LDA #' '
LDY L34
LDB24 CPY #7
BPL LDB2E
JSR OUTALL
INY
BPL LDB24
LDB2E LDX #0
LDA LTAB+4
BNE LDB62
LDY #0
LDA JLABL
BEQ LDB55
STY JLABL
Q75 LDA ICRD,X ;DO NOT PRINT OP
INX
CMP #$20 ;UNTIL NONBLANK
BNE Q70
CPX IMAXCL
BCS LDBB2
BCC Q75
Q70 INY
CPX IMAXCL
BCS LDBB2
LDA ICRD,X
INX
CMP #$20
BNE Q70
LDB55 LDA ICRD,X
CMP #$20
BNE LDB62
INX
CPX IMAXCL
BCS LDBB2
BCC LDB55
LDB62 LSR J
LDB64 CPX IMAXCL
BCS LDBB2 ;OUT OF CARD
LDA ICRD,X ;GET OPCODE
; TAB COMMENT FIELD
CMP #';'
BEQ LDB8D
CMP #$27
BEQ LDB9D
CMP #' '
BNE LDB7B
SEC
ROR J
BMI LDB89
LDB7B BIT J
BPL LDB84
LSR J
JSR LDFFA
LDB84 LDA ICRD,X
LDB86 JSR OUTALL
LDB89 INX
JMP LDB64
LDB8D JSR OUTPUT
LDB90 CPX IMAXCL
BCS LDBB2
LDA ICRD,X
INX
JSR OUTALL
JMP LDB90
LDB9D BIT J
BPL LDBA4
JSR LDFFA
LDBA4 LDA ICRD,X
JSR OUTALL
JSR LD74B
BCS LDBB2
LSR J
BPL LDB86
LDBB2 JSR OUTPUT
INC L1F
PLA
BEQ LDBC4
BIT IFLAGS
BMI LDBC1
JMP LDAD2
LDBC1 JSR LDBEF
LDBC4 JMP LDC4E
LDBC7 JSR LDA5E
LDA L1E
CMP #$46
BEQ LDBEC
LDX #MSG1-MSGS
JSR LDFE1
LDA L1E
JSR NUMA
JSR OUTPUT
SED
CLC
LDA LERCT
ADC #1
STA LERCT
LDA LERCT+1
ADC #0
STA LERCT+1
CLD
LDBEC RTS
LDBED LDA #1
LDBEF CLC
ADC IPC
STA IPC
BCC LDBF8
INC IPC+1
LDBF8 LDA #0
LDBFA CLC
ADC IPC
STA L09
LDA IPC+1
ADC #0
STA L09+1
RTS
LDC06 SEC
BCS LDC0A
LDC09 CLC
LDC0A PHA
LDA OUTFLG
STA L88
LDA L87
STA OUTFLG
PLA
BCS LDC23
JSR OUTCK1
LDC1B PHA
LDA L88
STA OUTFLG
LDC21 PLA
RTS
LDC23 JSR OUTALL
JMP LDC1B
LDC29 CLC
ADC JOPBAS
DEC L84
OBJOUT PHA
LDA L23
BEQ LDC21
LDA IFLAGS
AND #$08
BNE LDC3F
PLA
LDY #0
STA (L09),Y
RTS
LDC3F LDY L84
PLA
STA L0170,Y
INY
CPY #20
BNE LDC4B
DEY
LDC4B STY L84
LDC4D RTS
LDC4E LDA IFLAGS
AND #$08
BEQ LDC4D
LDA L23
CMP #2
BNE LDC5D
JMP LDD0D
LDC5D CLC
LDA L85
ADC KLEN
TAY
LDA L85+1
ADC #0
CMP IPC+1
BNE LDC6F
CPY IPC
BEQ LDC82
LDC6F JSR LDCD2
SEC
LDA IPC
SBC KLEN
STA L85
LDA IPC+1
SBC #0
STA L85+1
JSR LDCB8
LDC82 LDA L89
CLC
ADC KLEN
CMP #$19
BCS LDC6F
LDX L89
LDY KLEN
BEQ LDCA9
LDY #0
LDC93 INC L85
BNE LDC99
INC L85+1
LDC99 LDA L0170,Y
STA L8C,X
JSR LDCC8
INC L89
INX
INY
CPY KLEN
BNE LDC93
LDCA9 LDA #0
STA L84
LDA #$EA
LDX #$13
LDCB1 STA L0170,X
DEX
BPL LDCB1
RTS
LDCB8 LDA #0
STA L89
STA L43
LDA L85
STA L8A+1
STA L42
LDA L85+1
STA L8A
LDCC8 CLC
ADC L42
STA L42
BCC LDCD1
INC L43
LDCD1 RTS
LDCD2 LDA L89
BEQ LDD0C
JSR LDCC8
LDA L89
CLC
ADC #3
STA IERR
LDA #$3B
JSR LDC06
LDY #0
LDCE7 LDA L89,Y
JSR LDC09
INY
CPY IERR
BNE LDCE7
LDA L43
JSR LDC09
LDA L42
JSR LDC09
INC L40
BNE LDD02
INC L41
LDD02 LDA #$0D
JSR LDC06
LDA #$0A
JSR LDC06
LDD0C RTS
LDD0D JSR LDCD2
INC L40
BNE LDD16
INC L41
LDD16 LDA #$3B
JSR LDC06
LDA #0
JSR LDC09
LDX #2
LDD22 LDA L41
JSR LDC09
LDA L40
JSR LDC09
DEX
BNE LDD22
JSR LDD02
LDA OUTFLG
PHA
LDA L87
STA OUTFLG
JSR DU11
LDA DRB
AND #$CF
STA DRB
PLA
STA OUTFLG
RTS
.END