-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathseratn.src
More file actions
132 lines (94 loc) · 3.16 KB
/
seratn.src
File metadata and controls
132 lines (94 loc) · 3.16 KB
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
.page
.subttl '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 control 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 xidle
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 xidle
; 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
; rsr 12/8/80 fix inverted logic
; rsr 12/16/80 fix bad logic
; rsr 12/31/80 fix eoiflg and logic