You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

erproc.src 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. .page 'erproc'
  2. ; error processing
  3. ; controller errors
  4. ; 0 (1) no error
  5. ; 20 (2) can't find block header
  6. ; 21 (3) no synch character
  7. ; 22 (4) data block not present
  8. ; 23 (5) checksum error in data
  9. ; 24 (16) byte decoding error
  10. ; 25 (7) write-verify error
  11. ; 26 (8) write w/ write protect on
  12. ; 27 (9) checksum error in header
  13. ; 28 (10) data extends into next block
  14. ; 29 (11) disk i.d. mismatch
  15. ; command errors
  16. ; 30 general syntax
  17. ; 31 invalid command
  18. ; 32 long line
  19. ; 33 invalid filname
  20. ; 34 no file given
  21. ; 39 command file not found
  22. ; 50 record not present
  23. ; 51 overflow in record
  24. ; 52 file too large
  25. ; 60 file open for write
  26. ; 61 file not open
  27. ; 62 file not found
  28. ; 63 file exists
  29. ; 64 file type mismatch
  30. ; 65 no block
  31. ; 66 illegal track or sector
  32. ; 67 illegal system t or s
  33. ; 70 no channels available
  34. ; 71 directory error
  35. ; 72 disk full
  36. ; 73 cbm dos v2.6 v170
  37. ; 74 drive not ready
  38. ; 1 files scratched response
  39. badsyn =$30
  40. badcmd =$31
  41. longln =$32
  42. badfn =$33
  43. nofile =$34
  44. nocfil =$39
  45. norec =$50
  46. recovf =$51
  47. bigfil =$52
  48. filopn =$60
  49. filnop =$61
  50. flntfd =$62
  51. flexst =$63
  52. mistyp =$64
  53. noblk =$65
  54. badts =$66
  55. systs =$67
  56. nochnl =$70
  57. direrr =$71
  58. dskful =$72
  59. cbmv2 =$73
  60. nodriv =$74
  61. .page
  62. ; error message table
  63. ; leading errror numbers,
  64. ; text with 1st & last chars
  65. ; or'ed with $80,
  66. ; tokens for key words are
  67. ; less than $10 (and'ed w/ $80)
  68. errtab ; " OK"
  69. .byte 0,$a0,'O',$cb
  70. ;"read error"
  71. .byte $20,$21,$22,$23,$24,$27
  72. .byte $d2,'EAD',$89
  73. ;" file too large"
  74. .byte $52,$83,' TOO LARG',$c5
  75. ;" record not present"
  76. .byte $50,$8b,6,' PRESEN',$d4
  77. ;"overflow in record"
  78. .byte $51,$cf,'VERFLOW '
  79. .byte 'IN',$8b
  80. ;" write error"
  81. .byte $25,$28,$8a,$89
  82. ;" write protect on"
  83. .byte $26,$8a,' PROTECT O',$ce
  84. ;" disk id mismatch"
  85. .byte $29,$88,' ID',$85
  86. ;"syntax error"
  87. .byte $30,$31,$32,$33,$34
  88. .byte $d3,'YNTAX',$89
  89. ;" write file open"
  90. .byte $60,$8a,3,$84
  91. ;" file exists"
  92. .byte $63,$83,' EXIST',$d3
  93. ;" file type mismatch"
  94. .byte $64,$83,' TYPE',$85
  95. ;"no block"
  96. .byte $65,$ce,'O BLOC',$cb
  97. ;"illegal track or sector"
  98. .byte $66,$67,$c9,'LLEGAL TRACK'
  99. .byte ' OR SECTO',$d2
  100. ;" file not open"
  101. .byte $61,$83,6,$84
  102. ;" file not found"
  103. .byte $39,$62,$83,6,$87
  104. ;" files scratched"
  105. .byte 1,$83,'S SCRATCHE',$c4
  106. ;"no channel"
  107. .byte $70,$ce,'O CHANNE',$cc
  108. ;"dir error"
  109. .byte $71,$c4,'IR',$89
  110. ;" disk full"
  111. .byte $72,$88,' FUL',$cc
  112. ;"cbm dos v2.6 4030"
  113. .byte $73,$c3,'BM DOS V2.6 154',$b1
  114. ;"drive not ready"
  115. .byte $74,$c4,'RIVE',6,' READ',$d9
  116. ; error token key words
  117. ; words used more than once
  118. ;"error"
  119. .byte 9,$c5,'RRO',$d2
  120. ;"write"
  121. .byte $a,$d7,'RIT',$c5
  122. ;"file"
  123. .byte 3,$c6,'IL',$c5
  124. ;"open"
  125. .byte 4,$cf,'PE',$ce
  126. ;"mismatch"
  127. .byte 5,$cd,'ISMATC',$c8
  128. ;"not"
  129. .byte 6,$ce,'O',$d4
  130. ;"found"
  131. .byte 7,$c6,'OUN',$c4
  132. ;"disk"
  133. .byte 8,$c4,'IS',$cb
  134. ;"record"
  135. .byte $b,$d2,'ECOR',$c4
  136. etend =*
  137. .page
  138. ; controller error entry
  139. ; .a= error #
  140. ; .x= job #
  141. error pha
  142. stx jobnum
  143. txa
  144. asl a
  145. tax
  146. lda hdrs,x ; 4/12*****;recall track,sector
  147. sta track
  148. lda hdrs+1,x ; 4/12*********
  149. sta sector
  150. pla
  151. and #$f ; convert controller...
  152. beq err1 ; ...errors to dos errors
  153. cmp #$f ; check nodrive error
  154. bne err2
  155. ;
  156. lda #nodriv
  157. bne err3 ; bra
  158. err1
  159. lda #6 ; code=16-->14
  160. err2 ora #$20
  161. tax
  162. dex
  163. dex
  164. txa
  165. err3
  166. pha
  167. lda cmdnum
  168. cmp #val
  169. bne err4
  170. lda #$ff
  171. sta cmdnum
  172. pla
  173. jsr errmsg
  174. jsr initdr ; init for validate
  175. jmp cmder3
  176. err4
  177. pla
  178. cmder2
  179. jsr errmsg
  180. cmder3
  181. jsr clrcb ; clear cmdbuf
  182. lda #0
  183. sta wbam ; clear after error
  184. jsr erron ; set error led
  185. jsr freich ; free internal channel
  186. lda #0 ; clear pointers
  187. sta buftab+cbptr
  188. ldx #topwrt
  189. txs ; purge stack
  190. lda orgsa
  191. and #$f
  192. sta sa
  193. cmp #$f
  194. beq err10
  195. sei
  196. lda lsnact
  197. bne lsnerr
  198. lda tlkact
  199. bne tlkerr
  200. ;
  201. ldx sa
  202. lda lintab,x
  203. cmp #$ff
  204. beq err10
  205. and #$f
  206. sta lindx
  207. jmp tlerr
  208. ;
  209. ; talker error recovery
  210. ; if command channel, release dav
  211. ; if data channel, force not ready
  212. ; and release channel
  213. tlkerr
  214. jsr fndrch
  215. ;jsr iterr ;***rom -05 fix 8/18/83
  216. .byte $ea,$ea,$ea ; fill in 'jsr'
  217. bne tlerr ; finish
  218. ; listener error recovery
  219. ; if command channel, release rfd
  220. ; if data channel, force not ready
  221. ; and release channel
  222. lsnerr
  223. jsr fndwch
  224. ;jsr ilerr ;***rom -05 fix 8/18/83
  225. .byte $ea,$ea,$ea ; fil in 'jsr'
  226. tlerr
  227. jsr typfil
  228. cmp #reltyp
  229. bcs err10
  230. jsr frechn
  231. err10
  232. jmp idle
  233. .page
  234. ; convert hex to bcd
  235. hexdec tax
  236. ;######### GCB 11/20/86 set dec. mode w/out disabling IRQ's bug. ########
  237. jmp ptch27
  238. ; lda #0
  239. ; sed
  240. ;########################################################################
  241. hex0 cpx #0
  242. beq hex5
  243. clc
  244. adc #1
  245. dex
  246. jmp hex0
  247. hex5 cld
  248. ; convert bcd to ascii dec
  249. ; return bcd in .x
  250. ; store ascii in (temp),y
  251. bcddec tax
  252. lsr a
  253. lsr a
  254. lsr a
  255. lsr a
  256. jsr bcd2
  257. txa
  258. bcd2
  259. and #$f
  260. ora #$30
  261. sta (cb+2),y
  262. iny
  263. rts
  264. ; transfer error message to
  265. ; error buffer
  266. ;
  267. okerr
  268. jsr erroff
  269. lda #0
  270. errts0
  271. ldy #0
  272. sty track
  273. sty sector
  274. ;
  275. errmsg
  276. ldy #0
  277. ldx #<errbuf
  278. stx cb+2
  279. ldx #>errbuf
  280. stx cb+3
  281. jsr bcddec ; convert error #
  282. lda #',
  283. sta (cb+2),y
  284. iny
  285. lda errbuf
  286. sta chndat+errchn
  287. txa ; error # in .x
  288. jsr ermove ; move message
  289. ermsg2 lda #',
  290. sta (cb+2),y
  291. iny
  292. lda track
  293. jsr hexdec ; convert track #
  294. lda #',
  295. sta (cb+2),y
  296. iny
  297. lda sector ; convert sector #
  298. jsr hexdec
  299. dey
  300. tya
  301. clc
  302. adc #<errbuf
  303. sta lstchr+errchn ; set last char
  304. inc cb+2
  305. lda #rdytlk
  306. sta chnrdy+errchn
  307. rts
  308. ;
  309. ;**********************************;
  310. ;* ermove - move error message *;
  311. ;* from errtab to errbuf. *;
  312. ;* fully recursive for token *;
  313. ;* word prosessing. *;
  314. ;* input: .a= bcd error number *;
  315. ;**********************************;
  316. ;
  317. ermove
  318. tax ; save .a
  319. lda r0 ; save r0,r0+1
  320. pha
  321. lda r0+1
  322. pha
  323. lda #<errtab ; set pointer to table
  324. sta r0
  325. lda #>errtab
  326. sta r0+1
  327. txa ; restore .a
  328. ldx #0 ; .x=0 for indirect
  329. e10
  330. cmp (r0,x) ; ?error # = table entry?
  331. beq e50 ; yes, send message
  332. ;
  333. pha ; save error #
  334. jsr eadv2 ; check & advance ptr
  335. bcc e30 ; more #'s to check
  336. e20
  337. jsr eadv2 ; advance past this message
  338. bcc e20
  339. e30
  340. lda r0+1 ; check ptr
  341. cmp #>etend
  342. bcc e40 ; <, continue
  343. bne e45 ; >, quit
  344. ;
  345. lda #<etend
  346. cmp r0
  347. bcc e45 ; past end of table
  348. e40
  349. pla ; restor error #
  350. jmp e10 ; check next entry
  351. e45
  352. pla ; pop error #
  353. jmp e90 ; go quit
  354. ;
  355. e50 ; the number has been located
  356. jsr eadv1
  357. bcc e50 ; advance past other #'s
  358. e55
  359. jsr e60
  360. jsr eadv1
  361. bcc e55
  362. ;
  363. jsr e60 ; check for token or last word
  364. e90
  365. pla ; all finished
  366. sta r0+1 ; restore r0
  367. pla
  368. sta r0
  369. rts
  370. ;
  371. e60
  372. cmp #$20 ; (max token #)+1
  373. bcs e70 ; not a token
  374. tax
  375. lda #$20 ; implied leading space
  376. sta (cb+2),y
  377. iny
  378. txa ; restore token #
  379. jsr ermove ; add token word to message
  380. rts
  381. e70
  382. sta (cb+2),y ; put char in message
  383. iny
  384. rts
  385. ;
  386. ;error advance & check
  387. ;
  388. eadv1 ; pre-increment
  389. inc r0 ; advance ptr
  390. bne ea10
  391. inc r0+1
  392. ea10
  393. lda (r0,x) ; get current entry
  394. asl a ; .c=1 is end or beginning
  395. lda (r0,x)
  396. and #$7f ; mask off bit7
  397. rts
  398. ;
  399. eadv2 ; post-increment
  400. jsr ea10 ; check table entry
  401. inc r0
  402. bne ea20
  403. inc r0+1
  404. ea20
  405. rts
  406. ;
  407. ;.end