-
Notifications
You must be signed in to change notification settings - Fork 82
/
erproc.src
469 lines (363 loc) · 7.23 KB
/
erproc.src
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
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
.page
.subttl erproc
; error processing
; 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
; command errors
; 30 general syntax
; 31 invalid command
; 32 long line
; 33 invalid filname
; 34 no file given
; 39 command file not found
; 50 record not present
; 51 overflow in record
; 52 file too large
; 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
; 70 no channels available
; 71 directory error
; 72 disk full
; 73 cbm dos v2.6 v170
; 74 drive not ready
; 1 files scratched response
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)
errtab ; " OK"
.byte 0,$a0,'O',$cb
;"read error"
.byte $20,$21,$22,$23,$24,$27
.byte $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"
.byte $25,$28,$8a,$89
;" write protect on"
.byte $26,$8a,' PROTECT O',$ce
;" disk id mismatch"
.byte $29,$88,' ID',$85
;"syntax error"
.byte $30,$31,$32,$33,$34
.byte $d3,'YNTAX',$89
;" write file open"
.byte $60,$8a,3,$84
;" file exists"
.byte $63,$83,' EXIST',$d3
;" file type mismatch"
.byte $64,$83,' TYPE',$85
;"no block"
.byte $65,$ce,'O BLOC',$cb
;"illegal track or sector"
.byte $66,$67,$c9,'LLEGAL TRACK'
.byte ' OR SECTO',$d2
;" file not open"
.byte $61,$83,6,$84
;" file not found"
.byte $39,$62,$83,6,$87
;" files scratched"
.byte 1,$83,'S SCRATCHE',$c4
;"no channel"
.byte $70,$ce,'O CHANNE',$cc
;"dir error"
.byte $71,$c4,'IR',$89
;" disk full"
.byte $72,$88,' FUL',$cc
;"cbm dos v2.6 1541"
.byte $73,$c3,'BM DOS V2.6 154',$b1
;"drive not ready"
.byte $74,$c4,'RIVE',6,' READ',$d9
; error token key words
; words used more than once
;"error"
.byte 9,$c5,'RRO',$d2
;"write"
.byte $a,$d7,'RIT',$c5
;"file"
.byte 3,$c6,'IL',$c5
;"open"
.byte 4,$cf,'PE',$ce
;"mismatch"
.byte 5,$cd,'ISMATC',$c8
;"not"
.byte 6,$ce,'O',$d4
;"found"
.byte 7,$c6,'OUN',$c4
;"disk"
.byte 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
pla
and #$0f ;convert controller...
beq err1 ;...errors to dos errors
cmp #$0f ;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 #$0f
sta sa
cmp #$0f
beq err10
sei
lda lsnact
bne lsnerr
lda tlkact
bne tlkerr
ldx sa
lda lintab,x
cmp #$ff
beq err10
and #$0f
sta lindx
jmp tlerr
;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
;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
;######### GCB 11/20/86 set dec. mode w/out disabling IRQ's bug. ########
jmp ptch27
; lda #0
; sed
;########################################################################
hex0 cpx #0
beq hex5
clc
adc #1
dex
jmp hex0
hex5 cld
;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 #$0f
ora #$30
sta (cb+2),y
iny
rts
;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
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 jsr eadv1 ;the number has been located
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
; .end