-
Notifications
You must be signed in to change notification settings - Fork 84
/
erproc
418 lines (418 loc) · 7.08 KB
/
erproc
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
.PAGE 'ERPROC'
; ERROR PROCESSING
.SKIP
; CONTROLLER ERRORS
; 0 (1) NO ERROR
; 20 (2) CAN'T FIND BLOCK HEADER
; 21 (3) NO SYNCH CHARACTER
; 22 (4) DATA BLOCK NOT PRESENT
; 23 (5) CHECKSUM ERROR IN DATA
; 24 (16) BYTE DECODING ERROR
; 25 (7) WRITE-VERIFY ERROR
; 26 (8) WRITE W/ WRITE PROTECT ON
; 27 (9) CHECKSUM ERROR IN HEADER
; 28 (10) DATA EXTENDS INTO NEXT BLOCK
; 29 (11) DISK I.D. MISMATCH
.SKIP
; COMMAND ERRORS
; 30 GENERAL SYNTAX
; 31 INVALID COMMAND
; 32 LONG LINE
; 33 INVALID FILNAME
; 34 NO FILE GIVEN
; 39 COMMAND FILE NOT FOUND
.SKIP
; 50 RECORD NOT PRESENT
; 51 OVERFLOW IN RECORD
; 52 FILE TOO LARGE
.SKIP
; 60 FILE OPEN FOR WRITE
; 61 FILE NOT OPEN
; 62 FILE NOT FOUND
; 63 FILE EXISTS
; 64 FILE TYPE MISMATCH
; 65 NO BLOCK
; 66 ILLEGAL TRACK OR SECTOR
; 67 ILLEGAL SYSTEM T OR S
.SKIP
; 70 NO CHANNELS AVAILABLE
; 71 DIRECTORY ERROR
; 72 DISK FULL
; 73 CBM DOS V2.6 1541
; 74 DRIVE NOT READY
.SKIP
; 1 FILES SCRATCHED RESPONSE
.SKIP2
BADSYN =$30
BADCMD =$31
LONGLN =$32
BADFN =$33
NOFILE =$34
NOCFIL =$39
NOREC =$50
RECOVF =$51
BIGFIL =$52
FILOPN =$60
FILNOP =$61
FLNTFD =$62
FLEXST =$63
MISTYP =$64
NOBLK =$65
BADTS =$66
SYSTS =$67
NOCHNL =$70
DIRERR =$71
DSKFUL =$72
CBMV2 =$73
NODRIV =$74
.PAGE
; ERROR MESSAGE TABLE
; LEADING ERRROR NUMBERS,
; TEXT WITH 1ST & LAST CHARS
; OR'ED WITH $80,
; TOKENS FOR KEY WORDS ARE
; LESS THAN $10 (AND'ED W/ $80)
.SKIP 2
ERRTAB ;" OK"
.BYT 0,$A0,'O',$CB
;"READ ERROR"
.BYT $20,$21,$22,$23,$24,$27
.BYT $D2,'EAD',$89
;" FILE TOO LARGE"
.BYTE $52,$83,' TOO LARG',$C5
;" RECORD NOT PRESENT"
.BYTE $50,$8B,6,' PRESEN',$D4
;"OVERFLOW IN RECORD"
.BYTE $51,$CF,'VERFLOW '
.BYTE 'IN',$8B
;" WRITE ERROR"
.BYT $25,$28,$8A,$89
;" WRITE PROTECT ON"
.BYT $26,$8A,' PROTECT O',$CE
;" DISK ID MISMATCH"
.BYT $29,$88,' ID',$85
;"SYNTAX ERROR"
.BYT $30,$31,$32,$33,$34
.BYT $D3,'YNTAX',$89
;" WRITE FILE OPEN"
.BYT $60,$8A,3,$84
;" FILE EXISTS"
.BYT $63,$83,' EXIST',$D3
;" FILE TYPE MISMATCH"
.BYT $64,$83,' TYPE',$85
;"NO BLOCK"
.BYT $65,$CE,'O BLOC',$CB
;"ILLEGAL TRACK OR SECTOR"
.BYTE $66,$67,$C9,'LLEGAL TRACK'
.BYTE ' OR SECTO',$D2
;" FILE NOT OPEN"
.BYT $61,$83,6,$84
;" FILE NOT FOUND"
.BYT $39,$62,$83,6,$87
;" FILES SCRATCHED"
.BYT 1,$83,'S SCRATCHE',$C4
;"NO CHANNEL"
.BYT $70,$CE,'O CHANNE',$CC
;"DIR ERROR"
.BYT $71,$C4,'IR',$89
;" DISK FULL"
.BYT $72,$88,' FUL',$CC
;"CBM DOS V2.6 4030"
.BYTE $73,$C3,'BM DOS V2.6 154',$B1
;"DRIVE NOT READY"
.BYTE $74,$C4,'RIVE',6,' READ',$D9
.SKIP
; ERROR TOKEN KEY WORDS
; WORDS USED MORE THAN ONCE
;"ERROR"
.BYT 9,$C5,'RRO',$D2
;"WRITE"
.BYT $A,$D7,'RIT',$C5
;"FILE"
.BYT 3,$C6,'IL',$C5
;"OPEN"
.BYT 4,$CF,'PE',$CE
;"MISMATCH"
.BYT 5,$CD,'ISMATC',$C8
;"NOT"
.BYT 6,$CE,'O',$D4
;"FOUND"
.BYT 7,$C6,'OUN',$C4
;"DISK"
.BYT 8,$C4,'IS',$CB
;"RECORD"
.BYTE $B,$D2,'ECOR',$C4
ETEND =*
.PAGE
; CONTROLLER ERROR ENTRY
; .A= ERROR #
; .X= JOB #
ERROR PHA
STX JOBNUM
TXA
ASL A
TAX
LDA HDRS,X ;4/12*****;RECALL TRACK,SECTOR
STA TRACK
LDA HDRS+1,X ;4/12*********
STA SECTOR
.SKIP
PLA
AND #$F ;CONVERT CONTROLLER...
BEQ ERR1 ;...ERRORS TO DOS ERRORS
CMP #$F ;CHECK NODRIVE ERROR
BNE ERR2
;
LDA #NODRIV
BNE ERR3 ;BRA
ERR1
LDA #6 ;CODE=16-->14
ERR2 ORA #$20
TAX
DEX
DEX
TXA
ERR3
PHA
LDA CMDNUM
CMP #VAL
BNE ERR4
LDA #$FF
STA CMDNUM
PLA
JSR ERRMSG
JSR INITDR ;INIT FOR VALIDATE
JMP CMDER3
ERR4
PLA
CMDER2
JSR ERRMSG
CMDER3
JSR CLRCB ;CLEAR CMDBUF
LDA #0
STA WBAM ;CLEAR AFTER ERROR
JSR ERRON ;SET ERROR LED
JSR FREICH ;FREE INTERNAL CHANNEL
LDA #0 ;CLEAR POINTERS
STA BUFTAB+CBPTR
LDX #TOPWRT
TXS ; PURGE STACK
LDA ORGSA
AND #$F
STA SA
CMP #$F
BEQ ERR10
SEI
LDA LSNACT
BNE LSNERR
LDA TLKACT
BNE TLKERR
;
LDX SA
LDA LINTAB,X
CMP #$FF
BEQ ERR10
AND #$F
STA LINDX
JMP TLERR
;
.SKIP
; TALKER ERROR RECOVERY
; IF COMMAND CHANNEL, RELEASE DAV
; IF DATA CHANNEL, FORCE NOT READY
; AND RELEASE CHANNEL
TLKERR
JSR FNDRCH
; JSR ITERR ; *** ROM - 05 FIX 8/18/83 ***
.BYTE $EA,$EA,$EA ; FILL IN 'JSR'
BNE TLERR ;FINISH
.SKIP
; LISTENER ERROR RECOVERY
; IF COMMAND CHANNEL, RELEASE RFD
; IF DATA CHANNEL, FORCE NOT READY
; AND RELEASE CHANNEL
LSNERR
JSR FNDWCH
; JSR ILERR ; *** ROM - 05 FIX 8/18/83 ***
.BYTE $EA,$EA,$EA ; FILL IN 'JSR'
TLERR
JSR TYPFIL
CMP #RELTYP
BCS ERR10
JSR FRECHN
ERR10
JMP IDLE
.PAGE
; CONVERT HEX TO BCD
HEXDEC TAX
LDA #0
SED
HEX0 CPX #0
BEQ HEX5
CLC
ADC #1
DEX
JMP HEX0
HEX5 CLD
.SKIP
; CONVERT BCD TO ASCII DEC
; RETURN BCD IN .X
; STORE ASCII IN (TEMP)Y
BCDDEC TAX
LSR A
LSR A
LSR A
LSR A
JSR BCD2
TXA
BCD2
AND #$F
ORA #$30
STA (CB+2)Y
INY
RTS
.SKI
; TRANSFER ERROR MESSAGE TO
; ERROR BUFFER
;
OKERR
JSR ERROFF
LDA #0
ERRTS0
LDY #0
STY TRACK
STY SECTOR
;
ERRMSG
LDY #0
LDX #<ERRBUF
STX CB+2
LDX #>ERRBUF
STX CB+3
JSR BCDDEC ;CONVERT ERROR #
LDA #',
STA (CB+2),Y
INY
LDA ERRBUF
STA CHNDAT+ERRCHN
TXA ;ERROR # IN .X
JSR ERMOVE ;MOVE MESSAGE
.SKIP
ERMSG2 LDA #',
STA (CB+2),Y
INY
LDA TRACK
JSR HEXDEC ;CONVERT TRACK #
LDA #',
STA (CB+2),Y
INY
LDA SECTOR ;CONVERT SECTOR #
JSR HEXDEC
DEY
TYA
CLC
ADC #<ERRBUF
STA LSTCHR+ERRCHN ;SET LAST CHAR
INC CB+2
LDA #RDYTLK
STA CHNRDY+ERRCHN
RTS
;
;**********************************;
;* ERMOVE - MOVE ERROR MESSAGE *;
;* FROM ERRTAB TO ERRBUF. *;
;* FULLY RECURSIVE FOR TOKEN *;
;* WORD PROSESSING. *;
;* INPUT: .A= BCD ERROR NUMBER *;
;**********************************;
;
ERMOVE
TAX ;SAVE .A
LDA R0 ;SAVE R0,R0+1
PHA
LDA R0+1
PHA
LDA #<ERRTAB ;SET POINTER TO TABLE
STA R0
LDA #>ERRTAB
STA R0+1
TXA ;RESTORE .A
LDX #0 ;.X=0 FOR INDIRECT
E10
CMP (R0,X) ;?ERROR # = TABLE ENTRY?
BEQ E50 ;YES, SEND MESSAGE
;
PHA ;SAVE ERROR #
JSR EADV2 ;CHECK & ADVANCE PTR
BCC E30 ;MORE #'S TO CHECK
E20
JSR EADV2 ;ADVANCE PAST THIS MESSAGE
BCC E20
E30
LDA R0+1 ;CHECK PTR
CMP #>ETEND
BCC E40 ;<, CONTINUE
BNE E45 ;>, QUIT
;
LDA #<ETEND
CMP R0
BCC E45 ;PAST END OF TABLE
E40
PLA ;RESTOR ERROR #
JMP E10 ;CHECK NEXT ENTRY
E45
PLA ;POP ERROR #
JMP E90 ;GO QUIT
;
E50 ;THE NUMBER HAS BEEN LOCATED
JSR EADV1
BCC E50 ;ADVANCE PAST OTHER #'S
E55
JSR E60
JSR EADV1
BCC E55
;
JSR E60 ;CHECK FOR TOKEN OR LAST WORD
E90
PLA ;ALL FINISHED
STA R0+1 ;RESTORE R0
PLA
STA R0
RTS
;
E60
CMP #$20 ;(MAX TOKEN #)+1
BCS E70 ;NOT A TOKEN
TAX
LDA #$20 ;IMPLIED LEADING SPACE
STA (CB+2),Y
INY
TXA ;RESTORE TOKEN #
JSR ERMOVE ;ADD TOKEN WORD TO MESSAGE
RTS
E70
STA (CB+2),Y ;PUT CHAR IN MESSAGE
INY
RTS
;
;ERROR ADVANCE & CHECK
;
EADV1 ;PRE-INCREMENT
INC R0 ;ADVANCE PTR
BNE EA10
INC R0+1
EA10
LDA (R0,X) ;GET CURRENT ENTRY
ASL A ;.C=1 IS END OR BEGINNING
LDA (R0,X)
AND #$7F ;MASK OFF BIT7
RTS
;
EADV2 ;POST-INCREMENT
JSR EA10 ;CHECK TABLE ENTRY
INC R0
BNE EA20
INC R0+1
EA20
RTS
;