-
Notifications
You must be signed in to change notification settings - Fork 82
/
errorhandler
84 lines (84 loc) · 2.13 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
.PAG 'ERROR HANDLER'
;************************************
;* *
;* ERROR HANDLER *
;* RESTORES I/O CHANNELS TO DEFAULT*
;* 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 #
;
ERRORX 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
.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
AND #$01 ;CHECK STOP KEY POSITION
BNE STOP2 ;NOT DOWN
PHP
JSR CLRCH ;CLEAR CHANNELS
STA NDX ;FLUSH QUEUE
PLP
STOP2 RTS
.SKI 3
;---------------------------------------
; UDTIM - UPDATE THE STOP KEY LOCATION
; EXPECTS KEYBOARD OUTPUTS SET TO
; DEFAULT VALUE. BIT 0 OF STKEY =0
; FOR STOP KEY DOWN.
;---------------------------------------
UDTIM LDA TPI2+PC ;CHECK KEYBOARD
LSR A
BCS UDEXIT ;NO STOP KEY
LDA #$FE ;CHECK FOR SHIFT
STA TPI2+PB
LDA #$10
AND TPI2+PC
BNE UDTTT ;NO SHIFT KEY
SEC ;SHIFT KEY MARK
UDTTT LDA #$FF ;CLEAR
STA TPI2+PB
UDEXIT ROL A ;MOVE BIT 0 BACK
STA STKEY
RTS
.END