Commit | Line | Data |
---|---|---|
81e70d48 PH |
1 | / RK05 RESTORE Program |
2 | / This program will receive a RK05 image and write it to the disk. The | |
3 | / entire disk it written, with each sector having a reread check. | |
4 | / | |
5 | / This program should be started before the program (PC) sending the data | |
6 | / | |
7 | / See dump for the format of the serial data. | |
8 | / To run start at 0200. | |
9 | / SR 9-11 should be drive | |
10 | / Should halt at HLT at label GDHLT (140) with AC = 0 if it worked. | |
11 | / Hit cont to display in AC number of recoverable errors | |
12 | / At normal exit hitting cont again will restart the program | |
13 | / | |
14 | / The current location being written to will be displayed in the AC | |
15 | / while running. It is (cylinder * 16 + sector) / 2 | |
16 | ||
17 | DSKP=6741 | |
18 | DCLR=6742 | |
19 | DLAG=6743 | |
20 | DLCA=6744 | |
21 | DRST=6745 | |
22 | DLDC=6746 | |
23 | ||
24 | INAD=030 / Address of serial input, 30 for console | |
25 | KCF2=6000 INAD | |
26 | KSF2=6001 INAD | |
27 | KCC2=6002 INAD | |
28 | KRS2=6004 INAD | |
29 | KIE2=6005 INAD | |
30 | KRB2=6006 INAD | |
31 | ||
32 | OUTAD=040 / Address of serial output, 40 for console | |
33 | TFL2=6000 OUTAD | |
34 | TSF2=6001 OUTAD | |
35 | TCF2=6002 OUTAD | |
36 | TPC2=6004 OUTAD | |
37 | TSK2=6005 OUTAD | |
38 | TLS2=6006 OUTAD | |
39 | ||
40 | *20 | |
41 | ERRCNT, 7760 / Stop when err count = 0, init at startup | |
42 | DRIVE, 0 / Drive # * 2 | |
43 | K0200, 0200 | |
44 | K4000, 4000 | |
45 | FLD, 10 / Use field 1 for data buffer | |
46 | TRACK, 0 | |
47 | MAXTRK, 4537 | |
48 | EXBIT, 0 | |
49 | WRTDAT, 4000 | |
50 | REDDAT, 0000 | |
51 | WRTLOC, 0000 / Address to write data to disk | |
52 | BUFLOC, 0000 / Address to store next word received | |
53 | NUMSEC, 0 / Number of sectors received but not written | |
54 | RDBUF, 1000 / Buffer for reread check | |
55 | DSPTRK, 0 | |
56 | LOC, 0 | |
57 | LEN, 0 | |
58 | K6, 6 | |
59 | K17, 17 | |
60 | K377, 377 | |
61 | K7400, 7400 | |
62 | KN1, 7777 | |
63 | CHKSUM, 0 | |
64 | TEMP, 0 | |
65 | LAST, 0 | |
66 | DONEFG, 0 / 1 when end of data flag received | |
67 | STATE, 0 / Where in serial data we are 0 = Need ff sector head, | |
68 | / -1 = byte1, ... -3 = byte 3 | |
69 | BUFCNT, 0 / Count of words received in sector | |
70 | ISRAC, 0 | |
71 | ISRFLG, 0 | |
72 | RISR, ISR | |
73 | DECIMAL | |
74 | NBLKSZ, -256 | |
75 | OCTAL | |
76 | WRITEF, WRITE | |
77 | RECALF, RECAL | |
78 | STARTF, START | |
79 | ||
80 | *1000 | |
81 | 1234 | |
82 | 4321 | |
83 | ||
84 | *1 | |
85 | JMP I RISR / Interrupt handler | |
86 | ||
87 | *140 | |
88 | GDHLT, HLT / Stop with sum of all words (including -checksum) | |
89 | / Should be 0 | |
90 | / CLA | |
91 | / TAD K17 | |
92 | / TAD ERRCNT | |
93 | / HLT / # of errors | |
94 | JMP I STARTF | |
95 | ||
96 | *200 | |
97 | START, CDF 0 / Init all our variables | |
98 | CAF | |
99 | CLA CLL OSR / Init variables changed during run | |
100 | RAL | |
101 | AND K6 / Clear out high bits such as 0200 start address | |
102 | DCA DRIVE | |
103 | DCA TRACK | |
104 | DCA EXBIT | |
105 | DCA CHKSUM | |
106 | DCA STATE | |
107 | DCA WRTLOC | |
108 | DCA BUFLOC | |
109 | DCA NUMSEC | |
110 | DCA DONEFG | |
111 | TAD K17 | |
112 | CIA | |
113 | DCA ERRCNT | |
114 | ION / Turn on serial interrupt handler | |
115 | CLA CLL IAC / Set bit 11 to enable interrupts | |
116 | KIE2 | |
117 | KRB2 | |
118 | / RPE / PTR Testing, use paper tape with emulator | |
119 | / RFC | |
120 | RECAL, CLA CLL IAC / Recal drive, clear errors and set to cyl 0 | |
121 | DCLR / From manual | |
122 | TAD DRIVE | |
123 | DLDC | |
124 | CLA CLL CML RTL | |
125 | DCLR | |
126 | DSKP | |
127 | JMP .-1 | |
128 | TAD K0200 | |
129 | TAD DRIVE | |
130 | DLDC | |
131 | DSKP | |
132 | JMP .-1 | |
133 | DRST | |
134 | CIA | |
135 | TAD K4000 | |
136 | SZA CLA | |
137 | JMP BADSTA | |
138 | JMP I WRITEF | |
139 | BADSTA, HLT | |
140 | ||
141 | PAGE | |
142 | WRITE, CLA CLL | |
143 | TAD EXBIT | |
144 | RAR | |
145 | TAD TRACK | |
146 | RAR | |
147 | DCA DSPTRK / Save track for display | |
148 | CDAT, CLA | |
149 | TAD DSPTRK / Display write location | |
150 | AND DSPTRK / Kill time to make brighter | |
151 | AND DSPTRK | |
152 | AND DSPTRK | |
153 | IOF / Turn off interrupts so we can safely update | |
154 | CLA / # of sectors in buffer | |
155 | TAD NUMSEC | |
156 | SNA | |
157 | JMP NODAT | |
158 | TAD KN1 | |
159 | DCA NUMSEC | |
160 | IAC / 1 flags sector to write | |
161 | NODAT, ION | |
162 | SZA | |
163 | JMP DOWRT / Got data write it | |
164 | TAD DONEFG / No more data flag? | |
165 | SNA | |
166 | JMP CDAT / No, try again | |
167 | JMP DONE / yes | |
168 | DOWRT, CLA CLL IAC / We have one waiting, write it | |
169 | DCLR | |
170 | TAD WRTLOC | |
171 | DLCA | |
172 | TAD DRIVE | |
173 | TAD WRTDAT | |
174 | TAD FLD | |
175 | TAD EXBIT | |
176 | DLDC | |
177 | TAD TRACK | |
178 | DLAG | |
179 | CLL | |
180 | TAD DSPTRK | |
181 | DSKP | |
182 | JMP .-1 | |
183 | DRST | |
184 | CIA | |
185 | TAD K4000 | |
186 | SZA CLA | |
187 | JMP ERROR | |
188 | RDCHK, CLA CLL IAC / And now reread sector | |
189 | DCLR | |
190 | TAD RDBUF | |
191 | DLCA | |
192 | TAD DRIVE | |
193 | TAD REDDAT | |
194 | TAD EXBIT | |
195 | DLDC | |
196 | TAD TRACK | |
197 | DLAG | |
198 | CLA CLL | |
199 | TAD DSPTRK | |
200 | DSKP | |
201 | JMP .-1 | |
202 | DRST | |
203 | CIA | |
204 | TAD K4000 | |
205 | SZA CLA | |
206 | JMP ERROR | |
207 | TAD RDBUF | |
208 | DCA LOC | |
209 | TAD NBLKSZ | |
210 | DCA LEN | |
211 | CHKDAT, CDF 10 / And now compare | |
212 | TAD I WRTLOC | |
213 | CIA | |
214 | CDF 0 | |
215 | TAD I LOC | |
216 | SZA | |
217 | HLT / Big trouble, sector is bad without CRC error | |
218 | ISZ WRTLOC | |
219 | ISZ LOC | |
220 | ISZ LEN | |
221 | JMP CHKDAT | |
222 | CLA CLL | |
223 | INCTRK, ISZ TRACK / Increment track and exbit value for next sector | |
224 | JMP WRITE | |
225 | ISZ EXBIT | |
226 | JMP WRITE | |
227 | HLT | |
228 | DONE, CLA CLL CMA / Done, wait for one more word | |
229 | TAD BUFLOC | |
230 | AND K17 | |
231 | SZA | |
232 | JMP DONE | |
233 | TAD CHKSUM / Get final checksum, receive has added checksum | |
234 | SZA / word to running sum, Halt here if checksum | |
235 | HLT / is not zero. | |
236 | JMP GDHLT | |
237 | ||
238 | ERROR, ISZ ERRCNT / To many errors? | |
239 | JMP I RECALF / No, recal drive and try again | |
240 | DRST / Yes, leave error in AC and halt | |
241 | HLT | |
242 | ||
243 | PAGE | |
244 | ISR, | |
245 | DCA ISRAC / Save AC | |
246 | GTF | |
247 | DCA ISRFLG / And flags | |
248 | CDF 10 / Buffer in field 1 | |
249 | / RSF / PTR | |
250 | KSF2 / Have character waiting | |
251 | HLT / Stop, not our interrupt | |
252 | / JMP IRET / No, not our interrupt | |
253 | CLA | |
254 | / RRB RFC / PTR | |
255 | KRB2 / Get character | |
256 | DCA TEMP | |
257 | TAD STATE / Find out where in sequence we are | |
258 | SNA | |
259 | JMP SBLK / Start of block | |
260 | IAC | |
261 | SNA | |
262 | JMP BYTE1 | |
263 | IAC | |
264 | SNA | |
265 | JMP BYTE2 | |
266 | CLA / Byte 3 | |
267 | TAD TEMP | |
268 | CLL | |
269 | RTL | |
270 | RTL | |
271 | TAD LAST | |
272 | DCA I BUFLOC | |
273 | TAD CHKSUM | |
274 | TAD I BUFLOC | |
275 | DCA CHKSUM | |
276 | TAD BUFLOC | |
277 | IAC | |
278 | DCA BUFLOC | |
279 | STA / -1 for byte 1 | |
280 | DCA STATE | |
281 | ISZ BUFCNT | |
282 | JMP IRET | |
283 | DCA STATE / End of sector, set to 0 to check header byte | |
284 | ISZ NUMSEC / Inc number of sectors buffered | |
285 | TAD K17 | |
286 | CIA | |
287 | TAD NUMSEC | |
288 | SNA | |
289 | HLT / To many buffered, halt. Must of had to many | |
290 | / retries in a row | |
291 | IRET, CLA | |
292 | TAD ISRFLG | |
293 | RTF | |
294 | CLA | |
295 | TAD ISRAC | |
296 | JMP I 0 | |
297 | BYTE2, CLA | |
298 | TAD TEMP | |
299 | RTL | |
300 | RTL | |
301 | RTL | |
302 | RTL | |
303 | AND K7400 | |
304 | TAD LAST | |
305 | DCA I BUFLOC | |
306 | TAD CHKSUM | |
307 | TAD I BUFLOC | |
308 | DCA CHKSUM | |
309 | ISZ BUFLOC | |
310 | ISZ BUFCNT | |
311 | TAD TEMP | |
312 | RTR | |
313 | RTR | |
314 | AND K17 | |
315 | DCA LAST | |
316 | CMA | |
317 | TAD STATE | |
318 | DCA STATE | |
319 | JMP IRET | |
320 | BYTE1, CLA | |
321 | TAD TEMP | |
322 | DCA LAST | |
323 | CMA | |
324 | TAD STATE | |
325 | DCA STATE | |
326 | JMP IRET | |
327 | SBLK, TAD K377 | |
328 | CIA | |
329 | TAD TEMP / Is is a ff? | |
330 | SNA | |
331 | JMP FLAGOK / Yes | |
332 | IAC / Is it a fe? | |
333 | SZA | |
334 | HLT / No, halt | |
335 | IAC | |
336 | DCA DONEFG | |
337 | FLAGOK, STA / -1 for byte 1 | |
338 | DCA STATE | |
339 | TAD NBLKSZ / And setup to look for 256 words | |
340 | DCA BUFCNT | |
341 | JMP IRET | |
342 | $ |