-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathlccwrt1.src
287 lines (190 loc) · 5.22 KB
/
lccwrt1.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
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
.page
.subttl 'lccwrt1.src'
; write out data buffer
jwright cmp #$10 ; test if write
beq 1$
jmp jvrfy
1$ jsr chkblk ; get block checksum
sta chksum
lda dskcnt ; test for write protect
and #$10
bne 2$ ; not protected
lda #8 ; write protect error
jmp jerrr
2$ jsr bingcr ; convert buffer to write image
jsr jsrch ; find header
ldy #gap1-2 ; wait out header gap
3$ bit pota1
bmi 3$
bit byt_clr
dey ; test if done yet
bne 3$
lda #$ff ; make output $ff
sta ddra2
lda pcr2 ; set write mode
and #$ff-$e0 ; 0=wr
ora #$c0
sta pcr2
lda #$ff ; write 4 gcr sync
ldy #numsyn
sta data2
4$ bit pota1
bmi 4$
bit byt_clr
dey
bne 4$
; write out overflow buffer
ldy #256-topwrt
5$ lda ovrbuf,y ; get a char
6$ bit pota1
bmi 6$
sta data2 ; stuff it
iny
bne 5$ ; do next char
; write rest of buffer
7$ lda (bufpnt),y ; now do buffer
8$ bit pota1 ; wait until ready
bmi 8$
sta data2 ; stuff it again
iny ; test if done
bne 7$ ; do the whole thing
9$ bit pota1 ; wait for last char to write out
bmi 9$
lda pcr2 ; goto read mode
ora #$e0
sta pcr2
lda #0 ; make data2 input $00
sta ddra2
jsr jwtobin ; convert write image to binary
ldy jobn ; make job a verify
;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
jmp ptch62 ; *** rom ds 01/21/86 ***, chk for verify
; lda jobs,y
eor #$30
sta jobs,y
jmp jseak ; scan job que
;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
; * jwtobin
; convert write image back to
; binary data
jwtobin lda #0
sta savpnt
sta bufpnt ; lsb for overflow area
sta nxtpnt
lda bufpnt+1
sta nxtbf ; save for next buffer.
lda #>ovrbuf ; overflow first
sta bufpnt+1 ; msb for overflow area
sta savpnt+1
lda #256-topwrt
sta gcrpnt ; offset
sta bytcnt ; ditto
jsr jget4gb ; get first four- id and 3 data
lda btab ; save bid
sta bid
ldy bytcnt
lda btab+1
sta (savpnt),y
iny
lda btab+2
sta (savpnt),y
iny
lda btab+3
sta (savpnt),y
iny
sty bytcnt
; do overflow first and store back into overflow buffer
1$ jsr jget4gb ; do rest of overflow buffer
ldy bytcnt
lda btab
sta (savpnt),y
iny
lda btab+1
sta (savpnt),y
iny
beq 2$
lda btab+2
sta (savpnt),y
iny
lda btab+3
sta (savpnt),y
iny
sty bytcnt
bne 1$ ; jmp till end of overflow buffer
2$ lda btab+2
sta (bufpnt),y
iny
lda btab+3
sta (bufpnt),y
iny
sty bytcnt
3$ jsr jget4gb
ldy bytcnt
lda btab
sta (bufpnt),y
iny
lda btab+1
sta (bufpnt),y
iny
lda btab+2
sta (bufpnt),y
iny
lda btab+3
sta (bufpnt),y
iny
sty bytcnt
cpy #187
bcc 3$
lda #69 ; move buffer up
sta savpnt
lda bufpnt+1
sta savpnt+1
ldy #256-topwrt-1
4$ lda (bufpnt),y
sta (savpnt),y
dey
bne 4$
lda (bufpnt),y
sta (savpnt),y
; load in overflow
ldx #256-topwrt
5$ lda ovrbuf,x
sta (bufpnt),y
iny
inx
bne 5$
stx gcrflg ; clear buffer gcr flag
rts
; * verify data block
; convert to gcr verify image
; test against data block
; convert back to binary
jvrfy cmp #$20 ; test if verify
beq 1$
bne 7$ ; bra
1$ jsr chkblk ; get block checksum
sta chksum
jsr bingcr ; convert to verify image
jsr jdstrt
ldy #256-topwrt
2$ lda ovrbuf,y ; get char
3$ bit pota1
bmi 3$
eor data2 ; test if same
bne 4$ ; verify error
iny
bne 2$ ; next byte
5$ lda (bufpnt),y ; now do buffer
6$ bit pota1
bmi 6$
eor data2 ; test if same
bne 4$ ; error
iny
cpy #$fd ; dont test off bytes
bne 5$
beq 8$ ; bra
7$ jsr jsrch ; sector seek
8$ lda #1
.byte skip2
4$ lda #7 ; verify error
jmp jerrr