-
Notifications
You must be signed in to change notification settings - Fork 84
/
utl.src
185 lines (145 loc) · 2.63 KB
/
utl.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
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
.messg "utl"
.subttl "utl"
.page
;***************************
;** **
;** 1573 UTILITY **
;** **
;** * * * * * * * * * * * **
;** U0 n B = slow/fast **
;** serial **
;** U0 n S = int. dos **
;** U0 n R = retries **
;** U0 n T = signature **
;** U0 n V = verify **
;** U0 n # = device **
;** U0 n I = IEEE SET **
;** U0 n M = memory r/w **
;** **
;** n = ">" ascii **
;** **
;***************************
cmdsec lda cmdbuf+4
sta secinc
rts
cmdret lda cmdbuf+4
sta revcnt
rts
ieees lda cmdbuf+4
sta sieeeset
rts
sign jmp signature ; finish up there
chgutl sei
ldx cmdsiz ; chk cmd size
cpx #4
bcc utlbad ; br, error no parameters
lda cmdbuf+3
cmp #'I ; IEEE SET?
beq ieees
lda cmdbuf+3
cmp #'B ; bus slow fast change?
beq buss
cmp #'S ; sector interleave ?
beq cmdsec
cmp #'R ; retry
beq cmdret
cmp #'T ; test ROM
beq sign
cmp #'M ; m-r/w
beq memb
cmp #'V ; chk for verify
beq verif
tay
cpy #4
bcc utlbad
cpy #31
bcs utlbad
lda #$40 ; change device #
sta tlkadr ; clear old
lda #$20
sta lsnadr ; *
tya
clc
adc tlkadr
sta tlkadr ; new
tya
clc
adc lsnadr
sta lsnadr ; new
rts
utlbad lda #badcmd
jmp cmderr
buss lda fsflag
and #all-bit3
sta fsflag ; clear it
jsr bitit ; get bit
lsr a
lsr a
lsr a
lsr a ; shift to appropiate place
ora fsflag
sta fsflag
rts
verif lda iobyte
and #all-bit7
sta iobyte ; clear it
jsr bitit ; get bit
ora iobyte
sta iobyte
rts
memb
; +3 +4 +5 +6
; cmd r/w high-address pages
sei
lda fsflag
and #all-clkin ; set clk
sta fsflag
ldy #0
sty ip
lda cmdbuf+5
sta ip+1
lda cmdbuf+4 ; what is it?
cmp #'W ; write?
beq 2$
cmp #'R ; read?
bne 5$
jsr spout ; output
1$ lda (ip),y
jsr hskrd ; handshake it
iny
bne 1$
inc ip+1
dec cmdbuf+6 ; dec pages
bne 1$
beq 4$ ; bra
2$ lda pb
eor #clkout ; toggle state of clk
bit icr ; clear pending
sta pb
lda #8
3$ bit pb
bmi 6$ ; attn?
bit icr ; fast byte?
beq 3$
lda sdr ; get data
sta (ip),y
iny
bne 2$
inc ip+1
dec cmdbuf+6
bne 2$
4$ jmp endcmd
5$ jmp utlbad ; bad
6$ jsr tstatn
jmp 3$
bitit lda cmdbuf+4 ; which ?
cmp #'1
beq 1$
cmp #'0
beq 1$
jmp utlbad ; bad
1$ and #bit0 ; leave bit 0
clc
ror a ; rotate bit 0 to bit 7
ror a
rts