-
Notifications
You must be signed in to change notification settings - Fork 84
/
sertalk.src
135 lines (92 loc) · 2.12 KB
/
sertalk.src
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
.page
.subttl sertalk
talk sei ;find if open channel
jsr fndrch
bcs notlk ;no one home
talk1 ldx lindx
lda chnrdy,x
bmi tlk05
notlk rts
; code added to correct verify error
tlk05 jsr tstatn ;test for atn
jsr debnc
; check for clock gone (must be 80us+ from jmp talk1)
and #datin
php
jsr clkhi ;set clock line hi
plp ;see if verify error...
beq tlk02 ;yes...data line low, eoi !!!!
talk2 jsr tstatn ;test atn gone
jsr debnc ;test data line now low
and #datin
bne talk2 ;did not respond
ldx lindx ;prepare to send eoi if needed
lda chnrdy,x
and #eoi
bne noeoi ;no eoi
tlk02 jsr tstatn
jsr debnc ;send an eoi
and #datin ;test if data line is low
bne tlk02 ;yes, wait till hi
tlk03 jsr tstatn
jsr debnc ;wait for data line to go low
and #datin
beq tlk03
noeoi jsr clklow ;set clock low
jsr tstatn
jsr debnc ;wait for data line hi
and #datin
bne noeoi
lda #8 ;set up bit counter
sta cont
isr01 jsr debnc ;let port settle
and #datin ;test that data line is now high before we send
bne frmerx
isr02 ldx lindx ;get byte to send
lda chndat,x
ror a
sta chndat,x
bcs isrhi ;send a 1
jsr datlow ;send a 0
bne isrclk ;and clock it
isrhi jsr dathi
isrclk jsr clkhi ;rising edge clock
lda drvtrk+1 ;check speed flag
bne isr03 ;no slow down
jsr slowd ;slow down
isr03 jsr clkdat ;pull clock low and release data
dec cont ;more bits?
bne isr01 ;yes
isr04 jsr tstatn
jsr debnc
and #datin
beq isr04
cli ;get next byte to send
jsr get
sei
jmp talk1 ;keep on talkin
frmerx jmp frmerr
dathi lda pb ;set data out hi
and #$ff-datout
sta pb
rts
datlow lda pb
ora #datout
sta pb
rts
clklow lda pb
ora #clkout
sta pb
rts
clkhi lda pb
and #$ff-clkout
sta pb
rts
debnc lda pb
cmp pb
bne debnc
rts
; .end
; additions after code sent to japan.
; rsr 3/30/81 add verify error correction
; rsr 3/31/81 change ordering to detect verify error