-
Notifications
You must be signed in to change notification settings - Fork 84
/
ser.atn
133 lines (133 loc) · 2.33 KB
/
ser.atn
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
.PAGE 'SER.ATN'
;
;
;
ATNIRQ LDA PA1 ; CLEAR IRQ (CA1)
LDA #1
STA ATNPND
RTS
;
ATNSRV SEI
;
LDA #0 ; CLEAR PENDING FLAG
STA ATNPND
STA LSNACT ; CLEAR ADDRESS FLAGS
STA TLKACT
;
LDX #TOPWRT ; RESET STACK
TXS
;
LDA #$80 ; SET ATN MODE FLAG FOR ACPT ROUTINE
STA EOIFLG ;RESET EOI FLAG TO NON-EOI STATE
STA ATNMOD
;
JSR CLKHI
JSR DATLOW ; SET DATA LINE LOW AS RESPONSE
;
LDA PB ; SET ATN ACK TO GET HARDWARE CONTROLL OF DATA LINE
ORA #ATNA
STA PB
;
ATNS15 LDA PB ; TEST ATN STILL HERE
BPL ATNS20 ; GONE !
AND #CLKIN ; CLOCK STILL LOW
BNE ATNS15
;
;
ATN30 JSR ACPTR ; GET A COMMAND BYTE
;
CMP #UNLSN
BNE ATN35
;
LDA #0 ; GENERAL UNLISTEN COMMAND
STA LSNACT
BEQ ATN122 ; JMP
;
ATN35 CMP #UNTLK
BNE ATN40
;
LDA #0
STA TLKACT ; UNTALK NOW
BEQ ATN122 ; JMP
;
ATN40 CMP TLKADR ; OUR TALK ADDRESS?
BNE ATN45 ; NOPE
;
LDA #1 ; YES
STA TLKACT ; SET ACTIVE TALKER FLAG
LDA #0
STA LSNACT ; UNLISTEN
BEQ ATN95 ;JUMP
;
ATN45 CMP LSNADR ; OUT LISTEN ADDRESS?
BNE ATN50 ; NOPE
;
LDA #1 ; YES
STA LSNACT
LDA #0
STA TLKACT
BEQ ATN95 ;JUMP
;
ATN50 TAX ; TEST IF SA
AND #$60
CMP #$60 ; SA = $60 + N
BNE ATN120 ;DID NOT GET A VALID COMMAND
;
;
TXA ; A SA FOR ME
STA ORGSA
AND #$0F ; STRIP JUNK
STA SA
;
LDA ORGSA ; TEST IF CLOSE
AND #$F0
CMP #$E0
BNE ATN122 ; NO
;
CLI
JSR CLOSE ; CLOSE THE FILE
SEI
;
; WARNING:::CLOSE DOESN'T RETURN IN TIME FOR ATN122:::
;
ATN95 BIT PB ; TEST ATN STILL HERE
BMI ATN30
;
;
; ATN GONE , DO WHAT WE WHERE TOLD TO DO
;
;
ATNS20 LDA #0 ; CLEAR ATN MODE
STA ATNMOD
;
LDA PB ; ATN GONE , RELEASE ATN ACK
AND #$FF-ATNA
STA PB
;
LDA LSNACT ; LISTEN ?
BEQ ATN100
;
JSR LISTEN
JMP IDLE
;
ATN100 LDA TLKACT ; TALK?
BEQ ATN110
;
JSR DATHI ; RELEASE DATA LINE
JSR CLKLOW ; PULL CLOCK LOW
;
JSR TALK
ATN110 JMP ILERR ; RELEASE ALL LINES AND GO TO IDLE
;
; FIX SO (DEVICE NOT PRESENT) ERRORS REPORTED
;
ATN120 LDA #$10 ;KILL ALL BUT ATNAK
STA PB
ATN122 BIT PB
BPL ATNS20 ;EXIT OUT SAME WAY AFTER ATN DONE
BMI ATN122 ;JMP
;
.END
; RSR 12/8/80 FIX INVERTED LOGIC
; RSR 12/16/80 FIX BAD LOGIC
; RSR 12/31/80 FIX EOIFLG AND LOGIC