-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy patherrorhandler
63 lines (63 loc) · 1.59 KB
/
errorhandler
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
.PAG 'ERROR HANDLER'
;***************************************
;* STOP -- CHECK STOP KEY FLAG AND *
;* RETURN Z FLAG SET IF FLAG TRUE. *
;* ALSO CLOSES ACTIVE CHANNELS AND *
;* FLUSHES KEYBOARD QUEUE. *
;* ALSO RETURNS KEY DOWNS FROM LAST *
;* KEYBOARD ROW IN .A. *
;***************************************
NSTOP LDA STKEY ;VALUE OF LAST ROW
CMP #$7F ;CHECK STOP KEY POSITION
BNE STOP2 ;NOT DOWN
PHP
JSR CLRCH ;CLEAR CHANNELS
STA NDX ;FLUSH QUEUE
PLP
STOP2 RTS
.SKI 5
;************************************
;* *
;* ERROR HANDLER *
;* *
;* PRINTS KERNAL ERROR MESSAGE IF *
;* BIT 6 OF MSGFLG SET. RETURNS *
;* WITH ERROR # IN .A AND CARRY. *
;* *
;************************************
;
ERROR1 LDA #1 ;TOO MANY FILES
.BYT $2C
ERROR2 LDA #2 ;FILE OPEN
.BYT $2C
ERROR3 LDA #3 ;FILE NOT OPEN
.BYT $2C
ERROR4 LDA #4 ;FILE NOT FOUND
.BYT $2C
ERROR5 LDA #5 ;DEVICE NOT PRESENT
.BYT $2C
ERROR6 LDA #6 ;NOT INPUT FILE
.BYT $2C
ERROR7 LDA #7 ;NOT OUTPUT FILE
.BYT $2C
ERROR8 LDA #8 ;MISSING FILE NAME
.BYT $2C
ERROR9 LDA #9 ;BAD DEVICE #
;
PHA ;ERROR NUMBER ON STACK
JSR CLRCH ;RESTORE I/O CHANNELS
;
LDY #MS1-MS1
BIT MSGFLG ;ARE WE PRINTING ERROR?
BVC EREXIT ;NO...
;
JSR MSG ;PRINT "CBM I/O ERROR #"
PLA
PHA
ORA #$30 ;MAKE ERROR # ASCII
JSR BSOUT ;PRINT IT
;
EREXIT PLA
SEC
RTS
.END