-
Notifications
You must be signed in to change notification settings - Fork 84
/
ser.talk
132 lines (132 loc) · 2.16 KB
/
ser.talk
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 'SER.TALK'
;
;
;
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