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.
5 / This program should be started before the program (PC) sending the data
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
14 / The current location being written to will be displayed in the AC
15 / while running. It is (cylinder * 16 + sector) / 2
24 INAD=400 / Address of serial input, 30 for console
32 OUTAD=410 / Address of serial output, 40 for console
41 ERRCNT, 7760 / Stop when err count = 0, init at startup
42 DRIVE, 2 / Drive # * 2
45 FLD, 10 / Use field 1 for data buffer
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
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
85 JMP I RISR / Interrupt handler
88 GDHLT, / HLT / Stop with sum of all words (including -checksum)
93 / HLT / Normal good halt
94 / JMP START / And restart if requested
107 START, CDF 0 / Init all our variables
109 / CLA CLL OSR / Init variables changed during run
111 / AND K6 / Clear out high bits such as 0200 start address
125 ION / Turn on serial interrupt handler
126 CLA CLL IAC / Set bit 11 to enable interrupts
129 / RPE / PTR Testing, use paper tape with emulator
131 RECAL, CLA CLL IAC / Recal drive, clear errors and set to cyl 0
158 DCA DSPTRK / Save track for display
160 TAD DSPTRK / Display write location
161 AND DSPTRK / Kill time to make brighter
164 IOF / Turn off interrupts so we can safely update
165 CLA / # of sectors in buffer
171 IAC / 1 flags sector to write
174 JMP DOWRT / Got data write it
175 TAD DONEFG / No more data flag?
177 JMP CDAT / No, try again
179 DOWRT, CLA CLL IAC / We have one waiting, write it
199 RDCHK, CLA CLL IAC / And now reread sector
222 CHKDAT, CDF 10 / And now compare
228 HLT / Big trouble, sector is bad without CRC error
234 INCTRK, ISZ TRACK / Increment track and exbit value for next sector
239 DONE, CLA CLL CMA / Done, wait for one more word
244 TAD CHKSUM / Get final checksum, receive has added checksum
245 SZA / word to running sum, Halt here if checksum
249 ERROR, ISZ ERRCNT / To many errors?
250 JMP I RECALF / No, recal drive and try again
251 DRST / Yes, leave error in AC and halt
258 DCA ISRFLG / And flags
259 CDF 10 / Buffer in field 1
261 KSF2 / Have character waiting
262 HLT / Stop, not our interrupt
263 / JMP IRET / No, not our interrupt
268 TAD STATE / Find out where in sequence we are
270 JMP SBLK / Start of block
294 DCA STATE / End of sector, set to 0 to check header byte
295 ISZ NUMSEC / Inc number of sectors buffered
300 HLT / To many buffered, halt. Must of had to many
340 TAD TEMP / Is is a ff?
348 FLAGOK, STA / -1 for byte 1
350 TAD NBLKSZ / And setup to look for 256 words
354 / OLD ROUTINE, COLD RK05 REBOOT