-
Notifications
You must be signed in to change notification settings - Fork 84
/
ieee...sf
266 lines (266 loc) · 3.66 KB
/
ieee...sf
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
.PAG 'IEEE...SF'
;ATN IRQ PROCESS
; IRQ ON ATN, LISTEN TO PET
; CLEAR STACK
.SKI 3
ATNIRQ
LDA IEEED ;CLR ATNIRQ
LDA #1
STA ATNPND
RTS
ATNSRV
SEI
LDA #0
STA ATNPND
LDX #TOPWRT
TXS
LDA #DAV+EOI+NDAC
ORA PB ;FREE CONTROL LINES
AND #$FF-TRSEL-NRFD
STA PB
LDA #0
STA DDRA1
LDA #RDD ;SET RECEIVE DIR
STA DDRB1
LDA #$FF
STA IEEED ;FREE DATA LINES
ATN10
LDA PB
AND #$FF-NDAC
ORA #NRFD+ATNA
STA PB
ATN20 BIT PB
BVC ATN30 ;DAV LO
BMI ATN20 ;ATN LO ATNI HI
BPL ATN50 ;ATN HI
ATN30 LDA #$FF-NRFD ;NRFD LO
AND PB
STA PB
AND #EOI
STA EOIFLG ;SAVE EOI
LDA IEEED
EOR #$FF
STA ICMD ;SAVE COMMAND
LDA #NDAC ;NDAC HI
ORA PB
STA PB
DCDE LDY #0
LDA ICMD
AND #%01100000
CMP #$40 ;TALK?
BEQ DCDE60
CMP #$20 ;LISTEN?
BEQ DCDE20
CMP #$60 ;SECONDARY?
BEQ DCDE70
BNE DCDE80 ;OTHER
DCDE20 LDA ICMD
CMP LSNADR
BEQ DCDE40 ;MY LISTEN ADDRESS
CMP #UNLSN
BNE DCDE30
STY LSNACT
DCDE30 STY ADRSED ;NOT PRIMARY ADDRSED
JMP DCDE80
DCDE40 STA LSNACT
STY TLKACT
DCDE50 LDA #32
STA SA ;DEFAULT SA
STA ORGSA
STA ADRSED ;PRIMARY ADDRESSED
BNE DCDE80
DCDE60 STY TLKACT
LDA ICMD
CMP TLKADR
BNE DCDE30
STA TLKACT
STY LSNACT
BEQ DCDE50
DCDE70 LDA ADRSED
BEQ DCDE80 ;NOT ADDRESSED
LDA ICMD
STA ORGSA
PHA
AND #$F
STA SA
PLA
AND #$F0 ;CLOSE?
CMP #$E0
BNE DCDE80
CLI
JSR CLOSE
SEI
DCDE80
ATN40 BIT PB
BVC ATN40
JMP ATN10
ATN50 LDA LSNACT
BEQ ATN60
LDA #$FF-NRFD-ATNA
AND PB
STA PB
JSR LISTEN
JMP IDLE
ATN60 LDA #$FF-ATNA-NDAC
AND PB
ORA #NDAC
STA PB
LDA TLKACT
BEQ ATN70
JSR TALK
ATN70 JMP IDLE
.SKI 5
LISTEN
SEI
LDA #NRFD ;RFD: HI
ORA PB
STA PB
LSN10 BIT PB ;DAV: LO
BMI NOLATN ;ATN IS NOW HIGH
BVS LSN10
JSR FNDWCH ; WAS LDX SA
BCS LSN15
.SKIP
LDA CHNRDY,X
ROR A ;OK, OPEN FOR LISTEN
BCS LSN30
LSN15 LDA ORGSA ; WAS TXA
AND #$F0 ;SA=OPEN?
CMP #$F0
BEQ LSN30
LSN20 LDA SA
CMP #1
BEQ LSN25
LSN21 BIT PB
BMI NOLATN ;ATN IS NOW HIGH
BVC LSN21
LDA #$FF-NDAC
AND PB
STA PB
RTS
.SKIP
NOLATN
JMP ATNSRV
LSN25
SEI
LDA #$FF-NRFD ; ACCEPT ALL DATA
AND PB
STA PB ;RFD LOW
LDA #NDAC
ORA PB ; DAC HI
STA PB
.SKIP
LSN26 BIT PB ; DAV HI
BMI NOLATN ;ATN IS NOW HIGH
BVC LSN26
LDA PB
AND #$FF-NDAC ; DAC LOW
STA PB
LDA #NRFD ; RFD HI
ORA PB
STA PB
LSN28 BIT PB ; WAIT DAV LOW
BMI NOLATN ;ATN IS NOW HIGH
BVC LSN28
JMP LSN25 ; DO UNTIL ATN PULLED
LSN30 LDA #$FF-NRFD
AND PB
STA PB
AND #EOI
STA EOIFLG
LDA IEEED
EOR #$FF
STA DATA
SEI
LDA #NDAC
ORA PB
STA PB
LSN40 BIT PB
BMI NOLATN ;ATN IS NOW HIGH
BVC LSN40
LDA #$FF-NDAC
AND PB
STA PB
CLI
JSR PUT
LSTRTN
JMP LISTEN
.SKI 3
TLK25
LDA #DAV+EOI
ORA PB
STA PB
JMP IDLE
TALK
SEI
JSR FNDRCH
BCS NOTLK ; TEST IF CHANNEL READY
TALK1 LDX LINDX
LDA CHNRDY,X
BMI TLK05
NOTLK RTS
TLK05
LDA #TDD
STA DDRB1
LDA #$FF
STA DDRA1
LDA PB
ORA #TRSEL
STA PB
;
LDA #NRFD
TLK10 BIT PB ;RFD: HI
BMI NOTATN ;ATN IS NOW HIGH
BEQ TLK10
LDA CHNDAT,X
EOR #$FF
STA IEEED
LDA CHNRDY,X
ORA #$FF-EOI-DAV ;DAV: LO
AND PB
STA PB
TLK20
LDA PB
BMI NOTATN ;ATN IS NOW HIGH
AND #NRFD+NDAC
CMP #NRFD+NDAC
BEQ TLK25
AND #NRFD
BNE TLK20
TLK30
CLI
JSR GET
SEI
LDA #NDAC
TLK35 BIT PB
BMI NOTATN ;ATN IS NOW HIGH
BEQ TLK35
TLKRTN LDA #$FF
STA IEEED
LDA #DAV+EOI
ORA PB
STA PB
LDA #NDAC
TLK40 BIT PB
BMI NOTATN ;ATN IS NOW HIGH
BNE TLK40
BEQ TALK1
;
NOTATN
JMP ATNSRV
;
ITERR ;IEEE TALKER ERROR RECOVERY
LDA PB
ORA #DAV
STA PB
RTS
;
;
ILERR ;IEEE LISTENER ERROR RECOVERY
LDA #NRFD
ORA PB
AND #$FF-ATNA
STA PB
RTS
;
.END