software: Added more and more
[pdp8.git] / sw / os8 / v3d / sources / system / dectapes / dectape4 / RXCOPY.PA
CommitLineData
7af5ad59
PH
1/ RXCOPY FOR OS/8 V3D AND OS/78 V1A
2/
3/ THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY ON A
4/ SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH THE INCLUSION
5/ OF THE ABOVE SOPYRIGHT NOTICE. THIS SOFTWARE, OR ANY THEREOF,
6/ MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER
7/ PERSON EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO
8/ THESE LICENSE TERMS. TITLE TO AND OWNERSHIP OF THE SOFTWARE
9/ SHALL AT ALL TIMES REMAIN IN DEC.
10/
11/ THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT
12/ NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL
13/ EQUIPMENT CORPORATION.
14/
15/ DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS
16/ SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.
17/
18\f
19/
20/ VERSION V4A M.H. MAY 20, 1977
21/ S.R. MAY 20, 1977
22/
23/ START ADDRESS 16000; JSW 7403
24/
25/ THIS PROGRAM PERFORMS COPY, READ, AND COMPARE OPERATIONS ON
26/ RX FLOPPY DISKS ON A TRACK BY TRACK BASIS. THE COMMAND FORMAT
27/ IS: DEV:<DEV:/OPTION WHERE OPTIONS ARE P, N, M, R, OR V.
28/P PAUSE BEFORE AND AFTER ACCESSING DISK
29/M MATCH WITH NO IMPLIED COPY
30/N COPY WITH NO IMPLIED MATCH
31/R READ OUTPUT DEVICE WITH NO IMPLIED MATCH OR COPY
32/V PRINT VERSION NUMBER
33/C (NOT DOCUMENTED) COPY
34/ IF NO OPTIONS ARE EXPLICITYLY DECLARED, COPY AND MATCH ARE ASSUMED.
35/ IF THE R OPTION IS THE ONLY DISK ACCESSING OPTION SELECTED, THE
36/ FOLLOWING FORMATS WORK: DEV:/R DEV:</R <DEV:/R.
37/
38\f
39MAGIC=7623 /LOCATION IN RX SYSTEM HANDLER WITH A 7004 IF
40 /UNIT 0 OR A 7024 IF UNIT 1. THIS IS ONLY
41 /ACCESSED IF THE USER USES SYS: IN THE COMMAND
42 /STRING AND SYS: IS KNOWN TO BE AN RX!!
43OPT1=7643 /1ST COMMAND DECODER OPTION WORD
44OPT2=7644 /2ND COMMAND DECODER OPTION WORD
45BUFF=2000 /INPUT BUFFER FOR TTY MSGS
46DEVTYP=25 /DEVICE CODE FOR FLOPPY DISKS
47BSIZE=6400 /BUFFER SIZE IN OCTAL WORDS
48BSTART=20 /BUFFER START
49BHALF=BSIZE%2 /HALF OF BSIZE
50USR=200 /ENTRY POINT OF USR
51NOMAT=2000 /NO MATCH OPTION MASK
52COPY=1000 /COPY OPTION MASK
53MMATCH=3777 /CMA OF MATCH OPTION MASK
54MCOPY=6777 /CMA OF COPY OPTION MASK
55MATCH=4000 /MATCH OPTION MASK
56READ=0100 /READ OPTION MASK
57VERSION=0004 /VERSION OPTION MASK
58PAUS=0400 /PAUSE OPTION MASK
59\f
60/ RXCOPY READ-WRITE SUBROUTINE
61/
62 *6420
63/
64/ READ-WRITE SUBROUTINE TO HANDLE FLOPPY DISK IN 8-BIT MODE
65/ ROUTINE LIVES IN FIELD 0 TO BE CALLED FROM FIELD 10
66/
67/ CALLING SEQUENCE
68/
69/ CIF 0 /ASSUMED CDF 10, CALLED FROM FIELD 10
70/ TAD TRACK /TRACK # INTO AC
71/ JMS I (RW
72/ BITS /4000 IF FIELD 10 BUFFER, 2 IF READ, 20 IF UNIT 1
73/ OK RETURN /CDF AND CIF TO 10
74/ ERROR /SECTOR # IN AC
75/
76/ READS OR WRITES A TRACK AT A TIME. TWO BUFFERS LIVE IN 20-6417
77/ EACH OF FIELD 0 AND 10
78/
79/ USES AUTO-INCREMENT REGISTER 10 OF FIELD 0
80X10=10
81/
82/ AN ALTERNATE ENTRY OF CONTIN (JMP NOT JMS) CAUSES THE
83/ SUBROUTINE TO CONTINUE WORKING ON THE SAME TRACK ON WHICH THE
84/ ERROR OCCURRED.
85/
86/ THREE RETRIES ARE DONE ON A SECTOR BEFORE AN ERROR IS DECLARED.
87/
88SDN=6755
89LCD=6751
90STR=6753
91XDR=6752
92SER=6754
93FLINIT=6757
94/
95/
96/ USE PART OF PAGE AT 6400 TO SPREAD OUT WRITE LOOP
97/ FOR A LITTLE EXTRA SAFETY ON MAKING INTERLEAVE TIMING
98/
99WRIT1, TAD (-10 /8 TIMES THRU 16 BYTE > 128
100 DCA WRTCNT
101ST4, TAD I X10 /FETCH A BYTE
102 STR /SKIP IF READY TO TRANSFER
103 JMP .-1 /NO (SHOULDN'T HIT THIS ON VT78)
104 XDR /MOVE BYTE TO SILO
105 CLA /CLEAR THE MUMBLE AC
106 TAD I X10
107 STR
108 JMP .-1
109 XDR
110 CLA
111 TAD I X10
112 STR
113 JMP .-1
114 XDR
115 CLA
116 TAD I X10
117 STR
118 JMP .-1
119 XDR
120 CLA
121 TAD I X10
122 STR
123 JMP .-1
124 XDR
125 CLA
126 TAD I X10
127 STR
128 JMP .-1
129 XDR
130 CLA
131 TAD I X10
132 STR
133 JMP .-1
134 XDR
135 CLA
136 TAD I X10
137 STR
138 JMP .-1
139 XDR
140 CLA
141 TAD I X10
142 STR
143 JMP .-1
144 XDR
145 CLA
146 TAD I X10
147 STR
148 JMP .-1
149 XDR
150 CLA
151 TAD I X10
152 STR
153 JMP .-1
154 XDR
155 CLA
156 TAD I X10
157 STR
158 JMP .-1
159 XDR
160 CLA
161 TAD I X10
162 STR
163 JMP .-1
164 XDR
165 CLA
166 TAD I X10
167 STR
168 JMP .-1
169 XDR
170 CLA
171 TAD I X10
172 STR
173 JMP .-1
174 XDR
175 CLA
176 TAD I X10
177 STR
178 JMP .-1
179 XDR
180 CLA
181 ISZ WRTCNT /THRU WITH SILO?
182 JMP ST4 /NO
183 JMP WRIT2 /REST OF LOOP ON OTHER PAGE
184/
185WRTCNT, 0 /CONTROL COUNT FOR FILL SILO LOOP
186/
187 PAGE
188/
189\f/
190/ READ-WRITE ENTRY POINT
191/
192/
193RW, 0
194 DCA TRCKNO /ARRIVES WITH TRACK # IN AC
195 TAD I RW /DATA FIELD 10, FETCH CONTROL BITS
196 TAD L7100 /FLOPPY CONTROLLER IGNORES TOP 4 BITS; 100
197/ /BIT IS 8 BIT MODE; CONTROL FOR UNIT, R/W, IN PLACE
198 DCA FN /BUFFER BIT (COMPLEMENTED) ALSO STORED IN FN
199 TAD (17 /SET UP AUTO-INCR REG.
200 DCA X10
201 TAD (-32 /26 DECIMAL SECTORS PER TRACK
202 DCA SECTOR
203 ISZ RW /POINT TO OK EXIT
204 TAD FN /IF FIELD ZERO BUFFER, NEED TO CDF
205 SPA /SKIP ON FIELD 10 BUFFER, ALREADY SET!
206 CDF 0
207 RTR /READ/WRITE BIT TO LINK
208 SZL CLA /SKIP IF WRITE
209 JMP READLP /GO TO READ
210/
211/ WRITE LOOP
212/
213WRITLP, CLL CLA CMA RTL /LITERAL -3 FOR RETRY COUNT
214 DCA RETRY
215WRTRY, TAD FN /RETRY ERROR HERE THREE TIMES
216 JMS LDCMD
217 JMP WRIT1 /OTHER PAGE TO MOVE DATA TO SILO
218WRIT2, JMS DOIO /RETURN FROM OTHER PAGE TO ACCESS I/O
219 ISZ SECTOR
220 JMP WRITLP
221XT1, CDF CIF 10
222 JMP I RW
223/
224/ READ LOOP
225/
226READLP, CLL CLA CMA RTL /LITERAL -3 FOR RETRY COUNT
227 DCA RETRY
228RDTRY, JMS DOIO /COME HERE TO RETRY I/O
229 TAD FN
230 JMS LDCMD
231 TAD (-40 /32 PASSES THRU 4 BYTES MOVED
232 DCA FLEA
233ST5, STR
234 JMP .-1
235 XDR
236 DCA I X10
237 STR
238 JMP .-1
239 XDR
240 DCA I X10
241 STR
242 JMP .-1
243 XDR
244 DCA I X10
245 STR
246 JMP .-1
247 XDR
248 DCA I X10
249 ISZ FLEA
250 JMP ST5
251 ISZ SECTOR
252 JMP READLP
253 JMP XT1
254/
255/ DO READ OR WRITE I/O FUNCTION
256/
257DOIO, 0
258 TAD FN /SILO FUNCTION, CONVERTED TO READ-WRITE
259 TAD L7004 /BY LITERAL 4 (TOP FOUR BITS IRREL)
260 JMS LDCMD
261 JMS GETSEC /FETCH SECTOR TO AC
262 STR
263 JMP .-1
264 XDR
265 CLA
266 TAD TRCKNO
267 STR
268 JMP .-1
269 XDR
270 CLA
271 TAD L7530 /UNIT 1, 8-BIT NO-OP (TOP 4 BITS IGNORED)
272 JMS LDCMD
273 JMP I DOIO
274/
275/ LOAD COMMAND REGISTER
276/
277FLEA=.
278LDCMD, 0
279 SDN /SKIP ON DONE
280 JMP .-1
281 LCD /LOAD COMMAND
282 SER /SKIP ON ERROR
283 JMP I LDCMD
284 ISZ RETRY /TRIED THREE TIMES YET
285 JMP KEEPON /NO, KEEP ON TRYING
286 JMS GETSEC /RETURN SECTOR IN AC
287 ISZ RW /ON ERROR, RETURN ONE FURTHER DOWN
288 JMP XT1 /EXIT TO CALLER WITH SECTOR # IN AC
289/
290/ ENTRY TO CONTINUE AFTER ERROR
291/
292CONTIN, STA /BACK UP EXIT TO GOOD EXIT
293 TAD RW
294 DCA RW
295 TAD FN /SET DATA FIELD TO 0 IF NECESSARY
296 SPA CLA /ALREADY CDF TO 10, SKIP IF OK
297 CDF 0 /NO, SO SET TO 0
298 JMP I LDCMD /PRETEND OPERATION OK, SO RETURN THRU LDCMD!
299/
300KEEPON, FLINIT /DO A RECAL TO SHAKE IT UP
301 TAD FN /RETRYING READ OR WRITE
302 RTR /R/W BIT TO LINK
303 SZL CLA /SKIP ON WRITE
304 JMP RDTRY /RETRY A READ
305 TAD (-200 /BACK UP AUTO INCR TO REFILL SILO FOR WRITE
306 TAD X10 /SINCE THE FLINIT CLEARED SILO
307 DCA X10
308 JMP WRTRY /SO GO RETRY WRITE
309/
310/ CONVERT COUNT TO SECTOR
311/
312GETSEC, 0
313 TAD SECTOR /CONVERT -32 TO -1 TO INTERLEAVED SECTOR
314 TAD (15
315L7100, CLL /100 BIT SETS 8-BIT MODE, AS LITERAL
316L7530, SPA SZL /SZL JUST TO MAKE CORRECT LITERAL, NO-OP WAIT
317 TAD (15
318 CML RAL
319 IAC
320 JMP I GETSEC
321L7004, 7004
322/
323/
324/
325TRCKNO, 0 /TRACK NUMBER, INVARIANT THRU CALL
326SECTOR, 0 /COUNTS -32 UP TO 0; 26 DECIMAL SECTORS PER TRACK
327FN, 0 /FUNCTION BITS: ALWAYS 100 FOR 8BIT MODE
328/ /20 IF UNIT 1
329/ /2 IF READ OPERATION (2 IS SILO FETCH; 0 SILO FILL)
330/ /MINUS WORD IF BUFFER IN FIELD 0, PLUS IF FIELD 10
331/ /CONTROLLER IGNORES TOP 4 BITS OF WORD
332RETRY, 0 /RETRY COUNTER -3 TO 0
333\f FIELD 1
334 *6000
335/
336/ ***** BEGIN ONCE ONLY CODE *****
337/
338/
339/ ENTER HERE AND GET USER INPUTS
340/
341START, CLA!SKP /NORMAL ENTRY (MUST CALL DECODER)
342CHAIN, JMP NODEC /CHAIN ENTRY
343 JMS I (USR /CALL IT
344 5
345 5200 /DEFAULT INPUT EXT.(SPECIAL MODE)
346 0 /PRESERVE TENTATIVE FILES
347/
348/ LOAD CONSOLE TTY HANDLER
349/
350NODEC, JMS I (USR /LOAD THE KL8E HANDLER
351 1
352 DEVICE TTY
353TTYEP, 7201
354 JMP ERRUSR /PRINT USER ERROR
355 TAD TTYEP /MOVE ENTRY POINT FROM THIS PAGE
356 DCA TTYENT
357/
358/ LOAD OUTPUT DEVICE IF SPECIFIED
359/
360 JMS CTRLC /CHECK FOR CONTROL C TYPE-IN
361 TAD I (7600 /GET OUTPUT DEV
362 AND (17
363 DCA OUTDEV
364 TAD I (7605 /GET INPUT DEVICE
365 AND (17
366 DCA INDEV
367 TAD OUTDEV /IF NO OUTPUT DEVICE
368 SZA /IS NAMED MOVE INPUT
369 JMP LOC10 /TO OUTPUT DEVICE
370 TAD INDEV /MOVE IT!
371 DCA OUTDEV
372 DCA INDEV /ZERO INPUT DEVICE
373/
374/ VALIDATE OUTPUT DEVICES AND FILES
375/
376LOC10, JMS CTRLC /CHECK FOR CONTROL C
377 TAD (7601 /MAKE SURE THAT THERE ARE NO OUTPUT FILES
378 DCA TMP1 /OR OTHER OUTPUT DEVICES
379 TAD (-4
380 DCA TMP2
381LOC1, TAD I TMP1 /GET DECODER ENTRY
382 SZA!CLA /IS IT ZERO?
383 JMP ERR2 /NO -- ERROR
384 ISZ TMP1 /INCREMENT POINTER
385 ISZ TMP2 /YES -- DONE WITH OUTPUT ENTRIES?
386 JMP LOC1 /NO -- PROCEED
387 /YES --
388/
389 JMS CTRLC /CHECK FOR CONTROL C
390 TAD I (7605 /WAS THERE ANY INPUT SPECIFICATION?
391 SNA
392 JMP LOC3A /NO
393 TAD (7606 /YES -- MAKE SURE THAT THERE ARE NO INPUT FILES
394 DCA TMP1 /OR OTHER INPUT DEVICES
395 TAD (-5
396 DCA TMP2
397LOC2, TAD I TMP1 /GET DECODER ENTRY
398 SZA!CLA /IS IT ZERO?
399 JMP ERR2 /NO -- ERROR
400 ISZ TMP1 /INCREMENT POINTER
401 ISZ TMP2 /YES -- DONE WITH INPUT ENTRIES?
402 JMP LOC2 /NO -- PROCEED
403 /YES --
404/
405LOC3A, JMS I (USR /LOAD RXA0 AND RXA1 SO UNIT NUMBERS CAN
406 1 /BE FOUND.
407 DEVICE RXA0
408RX0EP, 200
409 NOP
410 JMS I (USR
411 1
412 DEVICE RXA1
413RX1EP, 200
414 NOP
415 JMP LOC3 /GO TO NEXT PAGE
416/
417OUTDEV, 0 /OUTPUT DEVICE NUMBER
418INDEV, 0 /INPUT DEVICE NUMBER
419TMP1, 0 /TEMP STORE
420TMP2, 0 /TEMP STORE
421/
422ERR2, TAD (MSG2 /ILLEGAL SPECIFICATION
423PERR, JMS TYPE /PRINT ERROR MESSAGE
424 JMP EXIT /LEAVE
425/
426ERRUSR, JMS I (USR /PRINT USER ERROR
427 7
428 2
429 JMP EXIT
430/
431/ SUBROUTINE UNIT -- FIND OUT WHAT THE UNIT NUMBER IS
432/ ON ENTRY AC HAS DEVICE NUMBER
433/ ON EXIT AC HAS 0 IFF UNIT 0 OR 0020 IFF UNIT 1
434/
435UNIT, 0
436 DCA TMP1 /SAVE DEVICE NUMBER
437 CLA!CMA
438 TAD TMP1 /IS DEVICE SYS:?(I.E. IS DEV NUM=1?)
439 SZA!CLA
440 JMP UNITNS /NO
441UNITSY, CDF 0 /YES -- FIND OUT WHICH UNIT IS SYS:
442 TAD I (MAGIC /GUT HOOK RX SYSTEM HANDLER********
443 CDF 10
444 AND (0020 /IF AC IS 0 ITS UNIT 0
445 JMP I UNIT
446UNITNS, TAD TMP1 /GET INFO ON DEVICE NUMBER
447 JMS I (USR
448 12
449UNITIN, 0
450 JMP ERR3 /SAY DEVICE IS NOT RX IF ERROR HERE
451 TAD UNITIN /IS DEV SYS: IN DISGUISE?
452 RAL
453 SZL!CLA
454 JMP UNITSY /YES -- GO DIG OUT THE UNIT NUM.
455 TAD UNITIN /NO -- DOES EP MATCH RXA0'S
456 CMA!IAC
457 TAD RX0EP
458 SNA!CLA
459 JMP I UNIT /YES
460 TAD UNITIN /NO -- CHECK RXA1
461 CMA!IAC
462 TAD RX1EP
463 SZA!CLA
464 JMP ERR3 /NO -- ERROR
465 TAD (20 /YES
466 JMP I UNIT
467\f
468/
469 PAGE
470/
471\f
472/
473/ CHECK THAT REQ'D DEVICES WERE SPECIFIED FOR OPTIONS SELECTED
474/
475LOC3, JMS OUTD /CHECK THAT OUTPUT DEVICE WAS GIVEN
476 TAD I (OPT2 /IF COPY OR MATCH, CHECK FOR INPUT DEV
477 AND (NOMAT!MATCH
478 SZA!CLA
479 JMS IND
480 TAD I (OPT2 /IF NOT READ OPTION, CHECK FOR INPUT DEV
481 AND (READ
482 SNA!CLA
483 JMS IND
484/
485/ PRINT VERSION IF SELECTED
486/
487VERS, JMS CTRLC /CHECK FOR CONTROL C
488 TAD I (OPT2 /SHOULD VERSION NUMBER BE PRINTED?
489 AND (VERSION
490 SNA!CLA
491 JMP TRANS /NO -- GO CHECK THAT DEVS ARE RXS
492 TAD (VERBUF /YES -- PRINT MESSAGE
493 JMS TYPE
494/
495/ PREPARE FOR DATA TRANSFER
496/
497TRANS, TAD I (OPT2 /SET C SWITCH IF COPY REQ'D
498 AND (MATCH!READ
499 SNA!CLA
500 JMP TRANSB
501 TAD I (OPT2
502 AND (NOMAT
503 SNA!CLA
504 JMP TRANSA /DON'T SET C SWITCH
505TRANSB, TAD I (OPT1 /SET IT
506 AND (MCOPY
507 TAD (COPY
508 DCA I (OPT1
509TRANSA, TAD I (OPT2 /SET M SWITCH IF MATCH REQ'D
510 AND (NOMAT!READ
511 SZA!CLA
512 JMP TRANS1
513 TAD I (OPT2
514 AND (MMATCH
515 TAD (MATCH
516 DCA I (OPT2
517TRANS1, TAD OUTDEV /NO -- CHECK THAT OUTPUT DEV IS RX
518 TAD (7757 /PREPARE TO GET DEV TYPE FROM TABLE
519 DCA TMP3
520 TAD I TMP3
521 AND (0770
522 RTR!CLL
523 RAR
524 TAD (-DEVTYP /WAS DEVICE AN RX?
525 SZA!CLA /DOES IT MATCH?
526 JMP ERR3 /NO -- OUTDEV IS NOT AN RX!!
527 TAD OUTDEV /SETUP UNIT NUMBERS
528 JMS UNIT /FOR OUPUT DEVICE
529 DCA WO1
530 TAD WO1
531 TAD (4002
532 DCA RO1
533/
534OUTOK, TAD I (OPT1 /IF MATCH OR COPY GET INFO ON INDEV
535 AND (COPY
536 SZA!CLA
537 JMP OUTOK1
538 TAD I (OPT2
539 AND (MATCH
540 SNA!CLA /WAS MATCH OR COPY SELECTED?
541 JMP DORDY /NO -- OK
542OUTOK1, TAD INDEV /MAKE SURE INPUT DEVICE IS AN RX
543 TAD (7757 /PREPARE TO ACCESS TABLE
544 DCA TMP3
545 TAD I TMP3
546 AND (0770
547 RTR!CLL
548 RAR
549 TAD (-DEVTYP
550 SZA!CLA /DOES IT MATCH?
551 JMP ERR3 /NO -- ERROR
552 TAD INDEV /SETUP UNIT NUMBERS
553 JMS UNIT /FOR INPUT DEVICE
554 TAD (2
555 DCA RI1
556DORDY, JMS QUEST /PAUSE IF SPECIFIED
557 MSG12
558 JMP DO /PROCESS DISKS
559\f
560/
561/ SUBROUTINE IND -- RETURN IF INPUT DEVICE NUMBER IS NON-ZERO
562/
563IND, 0
564 TAD INDEV /IF INPUT DEV WAS SPEC'D RETURN
565 SNA!CLA /IF NOT DECLARE ERROR
566 JMP ERR5
567 JMP I IND
568/
569/ SUBROUTINE OUTD -- RETURN IF OUTPUT DEVICE NUMBER IS NON-ZERO
570/
571OUTD, 0
572 CLA
573 TAD OUTDEV /IF OUTPUT DEV WAS SPEC'D RETURN
574 SNA!CLA /IF NOT DECLARE ERROR
575 JMP ERR6
576 JMP I OUTD
577/
578TMP3, 0 /TEMP STORE
579TMP4, 0 /TEMP STORE
580/
581ERR3, TAD (MSG3
582 JMP PERR
583ERR5, TAD (MSG5
584 JMP PERR
585ERR6, TAD (MSG6
586 JMP PERR
587\f
588/
589 PAGE
590/
591\f
592DO, JMS I (USR /UNLOCK USR FROM CORE
593 11
594 TAD (-115 /INIT COUNTER TO -77 DECIMAL
595 DCA CNT
596 DCA TRACK /INIT TRACK NUMBER TO 0
597 JMP DO1
598/
599/ ****** END OF ONCE ONLY CODE ******
600/
601 *6420
602/
603/ WAS COPY SELECTED?
604/
605DO1, TAD I (OPT1 /SHOULD WE COPY?
606 AND (COPY
607 SNA!CLA
608 JMP DO2 /NO
609 JMS RI /YES -- READ INPUT DEVICE INTO FIELD 0
610 JMS WO /WRITE OUTPUT DEVICE FROM FIELD 0
611/
612/ WAS READ SELECTED?
613/
614DO2, TAD I (OPT2 /SHOULD WE READ?
615 AND (READ
616 SNA!CLA
617 JMP DO3 /NO -- CHECK MATCH
618 IAC /YES -- READ OUTPUT DEVICE INTO FIELD 1
619 JMS RO
620/
621/ WAS MATCH SELECTED?
622/
623DO3, TAD I (OPT2 /SHOULD WE MATCH?
624 AND (MATCH
625 SNA!CLA
626 JMP DO5 /NO
627 TAD I (OPT1 /YES -- WAS THERE A COPY?
628 AND (COPY
629 SNA!CLA
630 JMS RI /NO -- READ INPUT DEVICE INTO FILED 0
631 TAD I (OPT2 /YES -- WAS THERE A READ?
632 AND (READ
633 SZA!CLA
634 JMP DO4 /YES
635 IAC /NO -- READ OUTDEV TO FIELD 1
636 JMS RO
637/
638/ COMPARE BUFFERS
639/
640DO4, TAD (BSTART
641 DCA PTR /INIT BUFFER POINTER
642 TAD (-BSIZE /SETUP WD IN BUFFER COUNTER
643 DCA WDCNT
644DO4A, TAD I PTR /GET A WD FROM FIELD 1
645 DCA TMP5 /SAVE
646 CDF 0 /GET A WD FROM FIELD 0
647 TAD I PTR
648 CDF 10
649 CMA!IAC /NEGATE
650 TAD TMP5 /DID WDS MATCH?
651 SZA!CLA /SKIP IF SO
652 JMS ERR7 /NO -- ERROR (BUT NOT FATAL)
653 ISZ PTR /YES -- INCREMENT POINTER
654 ISZ WDCNT /DONE WITH BUFFER?
655 JMP DO4A /NO -- PROCEED
656 /YES --
657/
658/ TEST FOR END OF DISK
659/
660DO5, ISZ TRACK /INCREMENT TRACK
661 ISZ CNT /DONE?
662 JMP DO1 /NO
663 JMP EXITOK /YES
664TMP5, 0 /TEMP STORE
665CNT, 0 /ISZ COUNTER OF TRACKS
666TRACK, 0 /TRACK NUMBER
667PTR, 0 /WORD IN BUFFER POINTER
668WDCNT, 0 /BUFFER WORD COUNTER
669/
670/ SUBROUTINE QUEST -- PRINT MSG AND ASK QUESTION
671/ ASK IT ONLY IF /P WAS SPECIFIED
672/ JMS+1 HAS MSG TO ASK
673/ RETURN ONLY WHEN ANSWER IS YES
674/
675QUEST, 0
676 TAD I (OPT2 /WAS /P SPECIFIED?
677 AND (PAUS
678 SNA!CLA
679 JMP Q2 /NO -- RETURN
680Q1, TAD I QUEST /YES -- GET MESG ADDR
681 JMS TYPE /PRINT IT
682 TAD (BUFF /SELECT INPUT BUFFER
683 JMS RDANS /READ ANSWER
684 TAD I (BUFF /WAS IT "Y"?
685 AND (77
686 TAD (-31
687 SZA!CLA
688 JMP Q1 /NO -- ASK AGAIN
689Q2, ISZ QUEST /YES -- RETURN AT JMS+2
690 JMP I QUEST
691/
692/ SUBROUTINE CTRLC -- CHECK FOR CONTROL C
693/
694CTRLC, 0
695 KRS
696 AND (177
697 TAD (-3
698 SNA!CLA
699 KSF
700 JMP I CTRLC
701 JMP EXIT
702/
703/ EXIT PROGRAM
704/
705EXITOK, JMS QUEST
706 MSG11
707EXIT, CIF!CDF 0
708 JMP I (7605
709\f
710/
711 PAGE
712/
713\f
714/
715/ SUBROUTINE RI -- READ FROM INPUT DEVICE
716/
717RI, 0 /READ FROM INPUT DEVICE
718 JMS CTRLC /CHECK FOR CONTROL C
719 TAD TRACK /GET TRACK NUMBER INTO AC
720 CIF 0 /PREPARE TO ENTRY DRIVER
721 JMS I (RW /CALL DRIVER
722RI1, 0 /FUNCTION WORD
723 JMP I RI /EXIT -- SUCCESSFUL
724 JMS ERR8 /ERROR
725 JMS CTRLC /CHECK FOR CONTROL C
726 CIF 0
727 JMP I (CONTIN /PROCEED
728/
729/ SUBROUTINE RO -- READ FROM OUTPUT DEVICE
730/
731RO, 0 /READ FROM OUTDEV
732 JMS CTRLC /CHECK FOR CONTROL C
733 TAD TRACK
734 CIF 0
735 JMS I (RW
736RO1, 0
737 JMP I RO
738 JMS ERR9
739 JMS CTRLC
740 CIF 0
741 JMP I (CONTIN
742\f
743/
744/ SUBROUTINE WO -- WRITE OUTPUT DEVICE
745/
746WO, 0 /WRITE TO OUTPUT DEVICE
747 JMS CTRLC
748 TAD TRACK
749 CIF 0
750 JMS I (RW
751WO1, 0
752 JMP I WO
753 JMS ERR10
754 JMS CTRLC
755 CIF 0
756 JMP I (CONTIN
757\f/
758/ MISC ERROR ROUTINES
759/
760ERR7, 0
761 TAD (-BSTART /SUBTRACK BUFFER START
762 TAD PTR /FROM WORD IN BUFFER POINTER
763 TAD (-BHALF /THEN SUBTRACT 1/2 OF BUFFER SIZE
764 SPA /SKIP IF PTR IN 2ND HALF
765 JMP ERR7A /PTR IN 1ST HALF
766 AND (7600 /DIVIDE BY 64 DECIMAL AND ADD 2
767 CLL!RTR
768 RTR
769 RTR
770 IAC
771 JMP ERR7W
772ERR7A, TAD (BHALF /MAKE POSITIVE
773 AND (7600 /DIVIDE BY 64 AND ADD 1
774 CLL!RTR
775 RTR
776 RTR
777ERR7W, IAC
778 DCA ERRTMP /SAVE SECTOR NUMBER
779 TAD TRACK /WAS THERE ANOTHER MISMATCH ON THIS SECTOR?
780 TAD ERR7TR
781 SZA!CLA
782 JMP ERR7P /NO
783 TAD ERRTMP /MAYBE
784 TAD ERR7SC
785 SNA!CLA
786 JMP I ERR7 /YES
787ERR7P, TAD (MSG7
788 JMS TYPE
789 TAD ERRTMP
790 JMS ADPRNT
791 TAD TRACK /SAVE TRACK AND SECTOR
792 CMA!IAC /AS 2'S COMP FOR FUTURE COMPARISION
793 DCA ERR7TR
794 TAD ERRTMP
795 CMA!IAC
796 DCA ERR7SC
797 JMP I ERR7
798ERR7TR, 400
799ERR7SC, 400
800ERR8, 0
801 DCA ERRTMP
802 TAD (MSG8
803 JMS TYPE
804 TAD ERRTMP
805 JMS ADPRNT
806 JMP I ERR8
807ERR9, 0
808 DCA ERRTMP
809 TAD (MSG9
810 JMS TYPE
811 TAD ERRTMP
812 JMS ADPRNT
813 JMP I ERR9
814ERR10, 0
815 DCA ERRTMP
816 TAD (MSG10
817 JMS TYPE
818 TAD ERRTMP
819 JMS ADPRNT
820 JMP I ERR10
821/
822ERRTMP, 0
823/
824\f
825/
826/ SUBROUTINE TYPE -- PRINT MESSAGE
827/ ON ENTRY AC HAS MESSAGE ADDRESS
828/
829TYPE, 0
830 DCA TYPAD /SAVE ADDR
831 CIF 0
832 JMS I TTYENT
833 4110
834TYPAD, 0
835 0
836 NOP
837 JMP I TYPE
838/
839/ SUBROUTINE RDANS -- READ ANSWER FROM TTY
840/ ON ENTRY AC HAS BUFFER ADDR
841/
842RDANS, 0
843 DCA RDAD /SAVE ADDR
844 CIF 0
845 JMS I TTYENT
846 0110
847RDAD, 0
848 0
849 NOP
850 JMP I RDANS
851/
852TTYENT, 0 /ENTRY POINT TO TTY HANDLER
853/
854\f
855/
856 PAGE
857/
858\f/
859/ SUBROUTINE APRNT -- PRINT TRACK AND SECTOR
860/ ENTER WITH SECTOR IN AC
861/
862ADPRNT, 0
863 JMS SETIN
864 MSG13B-1
865 TAD I TRACKN
866 JMS SETIN
867 MSG13A-1
868 TAD MSG
869 JMS I TYPEIT
870 JMP I ADPRNT
871TYPEIT, TYPE
872TRACKN, TRACK
873MSG, MSG13
874\f
875/
876/ SUBROUTINE SETIN -- ENTER NUMBER INTO A MESSAGE
877/
878/ ON ENTRY AC HAS NUMBER AND JMS+1 HAS POINTER TO MESSAGE
879/ HOLE MINUS 1. (2 DECIMAL DIGIT NUMBERS ARE ASSUMED)
880/
881SETIN, 0
882 DCA SETIN1 /SAVE NUMBER
883 DCA SETCNT /ZERO 10'S COUNTER
884 TAD I SETIN /GET MSG ADDR
885 DCA 10 /ENTER INTO AUTOINC POINTER
886 ISZ SETIN /BUMP RETURN ADDR
887SETINB, TAD SETIN1 /GET NUMBER
888 TAD M12 /SUBTRACT 10 DECIMAL
889 SMA /DONE DIVIDING?
890 JMP SETINA /NO
891 CLA /YES
892 TAD SETCNT /GET 10'S
893 TAD P260 /MAKE IT ASCII
894 DCA I 10 /STORE IN MESSAGE
895 TAD SETIN1 /GET REMAINDER
896 TAD P260 /MAKE IT ASCII
897 DCA I 10 /STORE IN MESSAGE
898 JMP I SETIN
899SETINA, DCA SETIN1 /SAVE RESULT
900 ISZ SETCNT /INCREMENT 10'S COUNT
901 JMP SETINB /CONTINUE
902/
903SETIN1, 0 /NUMBER STORAGE
904SETCNT, 0 /10'S COUNTER
905M12, -12 /MINUS 10 DECIMAL
906P7, 7 /LITERAL
907P260, 260 /LITERAL
908\f
909/
910/ ERROR MESSAGES
911/
912VERBUF, "R; "X; "C; "O; "P; "Y; 240; "V; "4; "A; 240; 215; 212; 232
913MSG2, "I; "L; "L; "E; "G; "A; "L; 240; "S; "P; "E; "C; "I; "F; "I
914 "C; "A; "T; "I; "O; "N; 215; 212; 232
915MSG3, "D; "E; "V; "I; "C; "E; 240; "I; "S; 240; "N; "O; "T; 240
916 "R; "X; 215; 212; 232
917MSG5, "N; "O; 240; "I; "N; "P; "U; "T; 240; "D; "E; "V; "I; "C;
918 "E; 215; 212; 232
919MSG6, "N; "O; 240; "O; "U; "T; "P; "U; "T; 240
920 "D; "E; "V; "I; "C; "E; 215; 212; 232
921MSG7, "C; "O; "M; "P; "A; "R; "E; 240
922 "E; "R; "R; "O; "R; 232
923MSG8, "I; "N; "P; "U; "T; 240; "D; "E; "V; "I; "C; "E; 240
924 "R; "E; "A; "D; 240; "E; "R; "R; "O; "R; 232
925MSG9, "O; "U; "T; "P; "U; "T; 240; "D; "E; "V; "I; "C; "E; 240
926 "R; "E; "A; "D; 240; "E; "R; "R; "O; "R; 232
927MSG10, "O; "U; "T; "P; "U; "T; 240; "D; "E; "V; "I; "C; "E; 240
928 "W; "R; "I; "T; "E; 240; "E; "R; "R; "O; "R; 232
929MSG11, "I; "S; 240; "M; "O; "N; "I; "T; "O; "R; 240
930 "R; "E; "M; "O; "U; "N; "T; "E; "D
931 "?; 232
932MSG12, "R; "E; "A; "D; "Y; "?; 232
933MSG13, 240; "T; "R; "A; "C; "K; 240
934MSG13A, 0
935 0
936 ",; "S; "E; "C; "T; "O; "R; 240
937MSG13B, 0
938 0
939 215; 212; 232
940$