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.

417 lines
6.9KB

  1. .PAGE 'ERPROC'
  2. ; ERROR PROCESSING
  3. .SKIP
  4. ; CONTROLLER ERRORS
  5. ; 0 (1) NO ERROR
  6. ; 20 (2) CAN'T FIND BLOCK HEADER
  7. ; 21 (3) NO SYNCH CHARACTER
  8. ; 22 (4) DATA BLOCK NOT PRESENT
  9. ; 23 (5) CHECKSUM ERROR IN DATA
  10. ; 24 (16) BYTE DECODING ERROR
  11. ; 25 (7) WRITE-VERIFY ERROR
  12. ; 26 (8) WRITE W/ WRITE PROTECT ON
  13. ; 27 (9) CHECKSUM ERROR IN HEADER
  14. ; 28 (10) DATA EXTENDS INTO NEXT BLOCK
  15. ; 29 (11) DISK I.D. MISMATCH
  16. .SKIP
  17. ; COMMAND ERRORS
  18. ; 30 GENERAL SYNTAX
  19. ; 31 INVALID COMMAND
  20. ; 32 LONG LINE
  21. ; 33 INVALID FILNAME
  22. ; 34 NO FILE GIVEN
  23. ; 39 COMMAND FILE NOT FOUND
  24. .SKIP
  25. ; 50 RECORD NOT PRESENT
  26. ; 51 OVERFLOW IN RECORD
  27. ; 52 FILE TOO LARGE
  28. .SKIP
  29. ; 60 FILE OPEN FOR WRITE
  30. ; 61 FILE NOT OPEN
  31. ; 62 FILE NOT FOUND
  32. ; 63 FILE EXISTS
  33. ; 64 FILE TYPE MISMATCH
  34. ; 65 NO BLOCK
  35. ; 66 ILLEGAL TRACK OR SECTOR
  36. ; 67 ILLEGAL SYSTEM T OR S
  37. .SKIP
  38. ; 70 NO CHANNELS AVAILABLE
  39. ; 71 DIRECTORY ERROR
  40. ; 72 DISK FULL
  41. ; 73 CBM DOS V2.6 1541
  42. ; 74 DRIVE NOT READY
  43. .SKIP
  44. ; 1 FILES SCRATCHED RESPONSE
  45. .SKIP2
  46. BADSYN =$30
  47. BADCMD =$31
  48. LONGLN =$32
  49. BADFN =$33
  50. NOFILE =$34
  51. NOCFIL =$39
  52. NOREC =$50
  53. RECOVF =$51
  54. BIGFIL =$52
  55. FILOPN =$60
  56. FILNOP =$61
  57. FLNTFD =$62
  58. FLEXST =$63
  59. MISTYP =$64
  60. NOBLK =$65
  61. BADTS =$66
  62. SYSTS =$67
  63. NOCHNL =$70
  64. DIRERR =$71
  65. DSKFUL =$72
  66. CBMV2 =$73
  67. NODRIV =$74
  68. .PAGE
  69. ; ERROR MESSAGE TABLE
  70. ; LEADING ERRROR NUMBERS,
  71. ; TEXT WITH 1ST & LAST CHARS
  72. ; OR'ED WITH $80,
  73. ; TOKENS FOR KEY WORDS ARE
  74. ; LESS THAN $10 (AND'ED W/ $80)
  75. .SKIP 2
  76. ERRTAB ;" OK"
  77. .BYT 0,$A0,'O',$CB
  78. ;"READ ERROR"
  79. .BYT $20,$21,$22,$23,$24,$27
  80. .BYT $D2,'EAD',$89
  81. ;" FILE TOO LARGE"
  82. .BYTE $52,$83,' TOO LARG',$C5
  83. ;" RECORD NOT PRESENT"
  84. .BYTE $50,$8B,6,' PRESEN',$D4
  85. ;"OVERFLOW IN RECORD"
  86. .BYTE $51,$CF,'VERFLOW '
  87. .BYTE 'IN',$8B
  88. ;" WRITE ERROR"
  89. .BYT $25,$28,$8A,$89
  90. ;" WRITE PROTECT ON"
  91. .BYT $26,$8A,' PROTECT O',$CE
  92. ;" DISK ID MISMATCH"
  93. .BYT $29,$88,' ID',$85
  94. ;"SYNTAX ERROR"
  95. .BYT $30,$31,$32,$33,$34
  96. .BYT $D3,'YNTAX',$89
  97. ;" WRITE FILE OPEN"
  98. .BYT $60,$8A,3,$84
  99. ;" FILE EXISTS"
  100. .BYT $63,$83,' EXIST',$D3
  101. ;" FILE TYPE MISMATCH"
  102. .BYT $64,$83,' TYPE',$85
  103. ;"NO BLOCK"
  104. .BYT $65,$CE,'O BLOC',$CB
  105. ;"ILLEGAL TRACK OR SECTOR"
  106. .BYTE $66,$67,$C9,'LLEGAL TRACK'
  107. .BYTE ' OR SECTO',$D2
  108. ;" FILE NOT OPEN"
  109. .BYT $61,$83,6,$84
  110. ;" FILE NOT FOUND"
  111. .BYT $39,$62,$83,6,$87
  112. ;" FILES SCRATCHED"
  113. .BYT 1,$83,'S SCRATCHE',$C4
  114. ;"NO CHANNEL"
  115. .BYT $70,$CE,'O CHANNE',$CC
  116. ;"DIR ERROR"
  117. .BYT $71,$C4,'IR',$89
  118. ;" DISK FULL"
  119. .BYT $72,$88,' FUL',$CC
  120. ;"CBM DOS V2.6 4030"
  121. .BYTE $73,$C3,'BM DOS V2.6 154',$B1
  122. ;"DRIVE NOT READY"
  123. .BYTE $74,$C4,'RIVE',6,' READ',$D9
  124. .SKIP
  125. ; ERROR TOKEN KEY WORDS
  126. ; WORDS USED MORE THAN ONCE
  127. ;"ERROR"
  128. .BYT 9,$C5,'RRO',$D2
  129. ;"WRITE"
  130. .BYT $A,$D7,'RIT',$C5
  131. ;"FILE"
  132. .BYT 3,$C6,'IL',$C5
  133. ;"OPEN"
  134. .BYT 4,$CF,'PE',$CE
  135. ;"MISMATCH"
  136. .BYT 5,$CD,'ISMATC',$C8
  137. ;"NOT"
  138. .BYT 6,$CE,'O',$D4
  139. ;"FOUND"
  140. .BYT 7,$C6,'OUN',$C4
  141. ;"DISK"
  142. .BYT 8,$C4,'IS',$CB
  143. ;"RECORD"
  144. .BYTE $B,$D2,'ECOR',$C4
  145. ETEND =*
  146. .PAGE
  147. ; CONTROLLER ERROR ENTRY
  148. ; .A= ERROR #
  149. ; .X= JOB #
  150. ERROR PHA
  151. STX JOBNUM
  152. TXA
  153. ASL A
  154. TAX
  155. LDA HDRS,X ;4/12*****;RECALL TRACK,SECTOR
  156. STA TRACK
  157. LDA HDRS+1,X ;4/12*********
  158. STA SECTOR
  159. .SKIP
  160. PLA
  161. AND #$F ;CONVERT CONTROLLER...
  162. BEQ ERR1 ;...ERRORS TO DOS ERRORS
  163. CMP #$F ;CHECK NODRIVE ERROR
  164. BNE ERR2
  165. ;
  166. LDA #NODRIV
  167. BNE ERR3 ;BRA
  168. ERR1
  169. LDA #6 ;CODE=16-->14
  170. ERR2 ORA #$20
  171. TAX
  172. DEX
  173. DEX
  174. TXA
  175. ERR3
  176. PHA
  177. LDA CMDNUM
  178. CMP #VAL
  179. BNE ERR4
  180. LDA #$FF
  181. STA CMDNUM
  182. PLA
  183. JSR ERRMSG
  184. JSR INITDR ;INIT FOR VALIDATE
  185. JMP CMDER3
  186. ERR4
  187. PLA
  188. CMDER2
  189. JSR ERRMSG
  190. CMDER3
  191. JSR CLRCB ;CLEAR CMDBUF
  192. LDA #0
  193. STA WBAM ;CLEAR AFTER ERROR
  194. JSR ERRON ;SET ERROR LED
  195. JSR FREICH ;FREE INTERNAL CHANNEL
  196. LDA #0 ;CLEAR POINTERS
  197. STA BUFTAB+CBPTR
  198. LDX #TOPWRT
  199. TXS ; PURGE STACK
  200. LDA ORGSA
  201. AND #$F
  202. STA SA
  203. CMP #$F
  204. BEQ ERR10
  205. SEI
  206. LDA LSNACT
  207. BNE LSNERR
  208. LDA TLKACT
  209. BNE TLKERR
  210. ;
  211. LDX SA
  212. LDA LINTAB,X
  213. CMP #$FF
  214. BEQ ERR10
  215. AND #$F
  216. STA LINDX
  217. JMP TLERR
  218. ;
  219. .SKIP
  220. ; TALKER ERROR RECOVERY
  221. ; IF COMMAND CHANNEL, RELEASE DAV
  222. ; IF DATA CHANNEL, FORCE NOT READY
  223. ; AND RELEASE CHANNEL
  224. TLKERR
  225. JSR FNDRCH
  226. JSR ITERR
  227. BNE TLERR ;FINISH
  228. .SKIP
  229. ; LISTENER ERROR RECOVERY
  230. ; IF COMMAND CHANNEL, RELEASE RFD
  231. ; IF DATA CHANNEL, FORCE NOT READY
  232. ; AND RELEASE CHANNEL
  233. LSNERR
  234. JSR FNDWCH
  235. JSR ILERR
  236. TLERR
  237. JSR TYPFIL
  238. CMP #RELTYP
  239. BCS ERR10
  240. JSR FRECHN
  241. ERR10
  242. JMP IDLE
  243. .PAGE
  244. ; CONVERT HEX TO BCD
  245. HEXDEC TAX
  246. LDA #0
  247. SED
  248. HEX0 CPX #0
  249. BEQ HEX5
  250. CLC
  251. ADC #1
  252. DEX
  253. JMP HEX0
  254. HEX5 CLD
  255. .SKIP
  256. ; CONVERT BCD TO ASCII DEC
  257. ; RETURN BCD IN .X
  258. ; STORE ASCII IN (TEMP)Y
  259. BCDDEC TAX
  260. LSR A
  261. LSR A
  262. LSR A
  263. LSR A
  264. JSR BCD2
  265. TXA
  266. BCD2
  267. AND #$F
  268. ORA #$30
  269. STA (CB+2)Y
  270. INY
  271. RTS
  272. .SKI
  273. ; TRANSFER ERROR MESSAGE TO
  274. ; ERROR BUFFER
  275. ;
  276. OKERR
  277. JSR ERROFF
  278. LDA #0
  279. ERRTS0
  280. LDY #0
  281. STY TRACK
  282. STY SECTOR
  283. ;
  284. ERRMSG
  285. LDY #0
  286. LDX #<ERRBUF
  287. STX CB+2
  288. LDX #>ERRBUF
  289. STX CB+3
  290. JSR BCDDEC ;CONVERT ERROR #
  291. LDA #',
  292. STA (CB+2),Y
  293. INY
  294. LDA ERRBUF
  295. STA CHNDAT+ERRCHN
  296. TXA ;ERROR # IN .X
  297. JSR ERMOVE ;MOVE MESSAGE
  298. .SKIP
  299. ERMSG2 LDA #',
  300. STA (CB+2),Y
  301. INY
  302. LDA TRACK
  303. JSR HEXDEC ;CONVERT TRACK #
  304. LDA #',
  305. STA (CB+2),Y
  306. INY
  307. LDA SECTOR ;CONVERT SECTOR #
  308. JSR HEXDEC
  309. DEY
  310. TYA
  311. CLC
  312. ADC #<ERRBUF
  313. STA LSTCHR+ERRCHN ;SET LAST CHAR
  314. INC CB+2
  315. LDA #RDYTLK
  316. STA CHNRDY+ERRCHN
  317. RTS
  318. ;
  319. ;**********************************;
  320. ;* ERMOVE - MOVE ERROR MESSAGE *;
  321. ;* FROM ERRTAB TO ERRBUF. *;
  322. ;* FULLY RECURSIVE FOR TOKEN *;
  323. ;* WORD PROSESSING. *;
  324. ;* INPUT: .A= BCD ERROR NUMBER *;
  325. ;**********************************;
  326. ;
  327. ERMOVE
  328. TAX ;SAVE .A
  329. LDA R0 ;SAVE R0,R0+1
  330. PHA
  331. LDA R0+1
  332. PHA
  333. LDA #<ERRTAB ;SET POINTER TO TABLE
  334. STA R0
  335. LDA #>ERRTAB
  336. STA R0+1
  337. TXA ;RESTORE .A
  338. LDX #0 ;.X=0 FOR INDIRECT
  339. E10
  340. CMP (R0,X) ;?ERROR # = TABLE ENTRY?
  341. BEQ E50 ;YES, SEND MESSAGE
  342. ;
  343. PHA ;SAVE ERROR #
  344. JSR EADV2 ;CHECK & ADVANCE PTR
  345. BCC E30 ;MORE #'S TO CHECK
  346. E20
  347. JSR EADV2 ;ADVANCE PAST THIS MESSAGE
  348. BCC E20
  349. E30
  350. LDA R0+1 ;CHECK PTR
  351. CMP #>ETEND
  352. BCC E40 ;<, CONTINUE
  353. BNE E45 ;>, QUIT
  354. ;
  355. LDA #<ETEND
  356. CMP R0
  357. BCC E45 ;PAST END OF TABLE
  358. E40
  359. PLA ;RESTOR ERROR #
  360. JMP E10 ;CHECK NEXT ENTRY
  361. E45
  362. PLA ;POP ERROR #
  363. JMP E90 ;GO QUIT
  364. ;
  365. E50 ;THE NUMBER HAS BEEN LOCATED
  366. JSR EADV1
  367. BCC E50 ;ADVANCE PAST OTHER #'S
  368. E55
  369. JSR E60
  370. JSR EADV1
  371. BCC E55
  372. ;
  373. JSR E60 ;CHECK FOR TOKEN OR LAST WORD
  374. E90
  375. PLA ;ALL FINISHED
  376. STA R0+1 ;RESTORE R0
  377. PLA
  378. STA R0
  379. RTS
  380. ;
  381. E60
  382. CMP #$20 ;(MAX TOKEN #)+1
  383. BCS E70 ;NOT A TOKEN
  384. TAX
  385. LDA #$20 ;IMPLIED LEADING SPACE
  386. STA (CB+2),Y
  387. INY
  388. TXA ;RESTORE TOKEN #
  389. JSR ERMOVE ;ADD TOKEN WORD TO MESSAGE
  390. RTS
  391. E70
  392. STA (CB+2),Y ;PUT CHAR IN MESSAGE
  393. INY
  394. RTS
  395. ;
  396. ;ERROR ADVANCE & CHECK
  397. ;
  398. EADV1 ;PRE-INCREMENT
  399. INC R0 ;ADVANCE PTR
  400. BNE EA10
  401. INC R0+1
  402. EA10
  403. LDA (R0,X) ;GET CURRENT ENTRY
  404. ASL A ;.C=1 IS END OR BEGINNING
  405. LDA (R0,X)
  406. AND #$7F ;MASK OFF BIT7
  407. RTS
  408. ;
  409. EADV2 ;POST-INCREMENT
  410. JSR EA10 ;CHECK TABLE ENTRY
  411. INC R0
  412. BNE EA20
  413. INC R0+1
  414. EA20
  415. RTS
  416. ;