Add README.md
[pdp8.git] / sw / os8 / v3d / sources / system / dectapes / dectape4 / KL8E.PA
CommitLineData
7af5ad59
PH
1/17 SUPER TTY HANDLER FOR OS/8
2/
3/
4/
5/
6/
7/
8/
9/
10/
11/COPYRIGHT (C) 1974,1975,1977 BY DIGITAL EQUIPMENT CORPORATION
12/
13/
14/
15/
16/
17/
18/
19/
20/
21/
22/THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE
23/AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
24/CORPORATION. DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY
25/FOR ANY ERRORS THAT MAY APPEAR IN THIS DOCUMENT.
26/
27/THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FURNISHED TO THE PURCHASER
28/UNDER A LICENSE FOR USE ON A SINGLE COMPUTER SYSTEM AND CAN BE COPIED
29/(WITH INCLUSION OF DIGITAL'S COPYRIGHT NOTICE) ONLY FOR USE IN SUCH
30/SYSTEM, EXCEPT AS MAY OTHERWISE BE PROVIDED IN WRITING BY DIGITAL.
31/
32/DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY FOR THE USE
33/OR RELIABILITY OF ITS SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY
34/DIGITAL.
35/
36/
37/
38/
39/
40/
41/
42/
43/
44/
45
46/S.W.,S.R.,H.J.,R.L.,S.R.
47
48 *0
49
50 -1
51 DEVICE KL8E;DEVICE TTY;0;TTY&177+4000;ZBLOCK 2
52
53/TWO-PAGE TELETYPE HANDLER FOR OS/8 V3.
54/ON INPUT, RECOGNIZES ^Z, ^C, ^U, RUBOUT
55/^Z MEANS END OF INPUT, INSERT ^Z IN BUFFER,
56/ PAD WITH ZEROES, AND ECHO "^Z"
57/^C MEANS ABORT JOB, RETURN TO OS/8 VIA LOC 7600 TO SAVE CORE AND PRINT "^C"
58/^U MEANS DELETE THE LAST LINE, ALLOW OPERATOR TO RETYPE
59/ (LINE STARTS AT BEGIN OF BUFFER AND IS TERMINATED BY A CR)
60/ A CR GETS ENTERED INTO BUFFER, CAUSES A LF TO ALSO ECHO
61/ AND GET ENTERED INTO BUFFER, BUFFER IS THEN PADDED WITH NULLS.
62/ CONVERTS LC TO UC
63
64/ON OUTPUT RECOGNIZES ^C, ^O, ^S, ^Q FROM KEYBOARD
65/^C CAUSES JOB TO ABORT, RETURN TO OS/8 VIA LOCATION 7600
66/ TO SAVE CORE AND PRINT "^C"
67/^O CAUSES ECHOING BY THE HANDLER TO CEASE
68/ TYPING ANY OTHER CHARACTER RESUMES ECHOING.
69/^S CAUSES THE HANDLER TO STOP SENDING TO TERMINAL
70/^Q RESUMES HANDLER SENDING
71/ ^S AND ^Q ARE IGNORED IN OTHER CASES
72
73/WHENEVER PRINTING CHARACTERS (EITHER ON OUTPUT OR WHEN ECHOING),
74/ IGNORES NULLS
75/ FLAGS LC WITH AN APOSTROPHE
76/ HANDLES TABS CORRECTLY (SEVERAL WAYS)
77/ PRINTS ESCAPE AS $
78/ DELAYS 16 MS AFTER LINEFEEDS
79/ PRINTS CONTROL CHARACTERS AS "^K"
80
81/DOES AUTOMATIC CR/LF AT END OF LINE WIDTH.
82
83/MAINTENANCE RELEASE CHANGES:
84
85/1. ADDED KCC FOR NON-CONSOLE TELETYPES
86
87/V3D CHANGES: (VERSION E)
88
89/1. ADDED DELAY OPTION FOR VT78
90/2. ADDED SCOPE RUBOUTS
91/3. CHANGED VT78 DEFAULTS
92/4. REARRANGED CODE FOR SET TTY ESC AND ARROW
93\f INDVC=03
94 OUTDVC=04
95
96 KSF=10^INDVC+6001
97 KCC=10^INDVC+6002
98 KRS=10^INDVC+6004
99 KRB=KCC KRS
100 TSF=10^OUTDVC+6001
101 TCF=10^OUTDVC+6002
102 TPC=10^OUTDVC+6004
103 TLS=TCF TPC
104
105 TTYVERSION="E&77
106\f/BUILD YOUR OWN TELETYPE HANDLER:
107
108/THIS SOURCE HAS MUMBLE LOCATIONS LEFT.
109
110/THE FOLLOWING CONDITIONALS ALLOW YOU TO INCLUDE OPTIONAL FEATURES.
111/YOU MAY INCLUDE AS MANY OR AS FEW AS YOU DESIRE PROVIDED THERE
112/IS ROOM LEFT.
113
114/CONDITIONAL LOCATIONS LOCATIONS INCLUDED
115/VARIABLE PAGE 1 PAGE 2 FEATURES
116
117/ DELAY 0 7 DELAY AFTER GIVEN CHAR
118/ CTRL 0 3 PRINT CONTROL CHARS AS ^K
119/ RUB 0 0 PRINT CHAR RUBBED OUT ON RUBOUTS
120/ SIMTAB 0 10 SIMULATE TABS AS SPACES
121/ SLOTAB 0 6 PUT OUT 2 RUBOUTS AFTER A TAB
122/ ESC 0 10 PRINT ESCAPE AS $
123/ FLAGLC 0 12 FLAG LOWER CASE CHARS ON OUTPUT
124/ CNVLC 0 7 CONVERT LOWER CASE ON INPUT TO UPPER CASE
125/ ALTMOD 0 11 CONVERT ALTMODES (175,176) TO ESCAPE (33)
126/ PAUS 0 20 PAUSE BETWEEN PAGES
127/ FREE LOCS: 2 33
128
129 VT78=1 /SET TO 0 TO ALLOW OTHER PARAMETERS
130 /SET TO 1 TO FORCE OTHER PARAMETERS TO VT78 COMPATIBLE
131
132 DELAY=0 /SET NON-ZERO TO ALLOW DELAY AFTER ANY CHAR (12=CR)
133 /TYPICALLY AFTER LF FOR HIGH SPEED VT05
134 /SET VALUE OF DELAY = 7-BIT CHAR TO DELAY AFTER
135
136 CTRL=1 /SET TO 1 TO ECHO CONTROL CHARS AS ^K
137 /SET TO 0 TO ACCEPT CONTROL CHARACTERS AND PUT
138 /IN BUFFER, BUT NOT ECHO THEM (EXCEPT THE USUAL)
139 RUB=1 /SET TO 0 TO ECHO EACH RUBOUT BY TYPING A BACK SLASH
140 /SET TO 1 TO ECHO CHARS RUBBED OUT UPON RUB-OUT
141 /SET TO 4000 TO PERFORM SCOPE TYPE RUBOUTS
142 SIMTAB=1 /SET TO 1 TO SIMULATE TABS AS THE CORRECT NUMBER OF SPACES
143 /SET TO 0 TO TYPE TABS AS TABS
144 SLOTAB=0 /SET TO 1 TO TYPE 2 RUBOUTS AFTER A TAB
145 /ONLY IS APPLICABLE IF SIMTAB=0
146 ALTMOD=0 /SET TO 1 TO CONVERT 175,176 TO 33
147 /(UPPER CASE TERMINALS ONLY)
148 ESC=1 /SET TO 1 TO ECHO ESCAPE AS $
149 /SET TO 0 TO ECHO ESCAPE AS A CONTROL CHAR (^[)
150 FLAGLC=1 /SET TO 1 TO FLAG LOWER CASE CHARS ON OUTPUT
151 /THIS IS FOR PEOPLE NOT PRIVELIDGED ENOUGH TO
152 /OWN A LOWER CASE TERMINAL
153 /SET TO 0 TO PRINT LOWER CASE CHARS AS IS
154 CNVLC=0 /SET TO 1 TO CONVERT LOWER CASE CHARS ON INPUT TO UPPER CASE
155 /SET TO 0 TO ACCEPT INPUTTED LOWER CASE CHARS AS IS
156 /THIS IS FOR PEOPLE WHO ARE HANDICAPPED BY A LOWER CASE
157 /TERMINAL AND ONLY WANT UPPER CASE
158 PAUS=200 /NON-0 PAUSES BETWEEN SCOPE PAGES
159 HEIGHT=30 /NUMBER OF LINES PER SCREEN
160
161/SOME OF THE ABOVE OPTIONS SHOULD ACTUALLY BE IMPLEMENTED
162/IN SUCH A MANNER THAT THE USER CAN CHANGE THEM VIA AN ALTER
163/RATHER THAN HAVE TO REASSEMBLE.
164
165 IFNZRO VT78 <
166 DELAY=0
167 CTRL=1
168 RUB=4000
169 SIMTAB=0
170 SLOTAB=0
171 ALTMOD=0
172 ESC=1
173 FLAGLC=0
174 CNVLC=0
175 IFNZRO INDVC-3 <CTRL=0>
176 >
177\f/CROSS PAGE LINKAGE:
178
179/THIS CODE MUST BE ABLE TO LOAD INTO ANY TWO PAGES OF CORE
180/THE ENTRY POINT IS AT THE NEXT LOCATION TO THE END OF THE FIRST PAGE
181/AT THE END OF THE FIRST PAGE WE JMS TO PLINK,
182/THIS LEAVES THE ADDRESS OF THE FIRST LOCATION OF THE NEXT PAGE
183/IN LOCATION 'PLINK' . THIS JUST HAPPENS TO BE THE ADDRESS
184/OF BOTH TTYPCH AND TTYGCH.
185
186/TTYPCH AND TTYGCH SHARE THE SAME ENTRY POINT.
187/IF IT IS CALLED WITH A 0 AC, IT IS A CALL TO TTYGCH,
188/IF IT IS CALLED WITH A NON-ZERO AC, IT IS A CALL TO TTYPCH.
189
190/RETURN 1 MEANS GOT RUBOUT
191/TTYGCH TAKES RETURN 2 IF IT GOT A ^Z.
192/OTHERWISE IT TAKES RETURN 3 WITH CHARACTER GOTTEN IN AC.
193
194/TTYPCH TAKES RETURN 1 IF IT WANTS THE HANDLER TO GO AWAY,
195/I.E IF IT SAW A ^Z.
196/AC IS NORMALLY NON-ZERO UPON RETURN
197/AC IS POSITIVE MEANS DO A CRLF
198
199/WHEN ECHOING WE WANT TO CALL TTYPRT
200/BUT OTHERWISE WE WANT TO CALL TTYPCH (WHICH DOES ADDITIONAL
201/STUFF LIKE CHECK ^O, ^Q, ETC.
202/WE TELL BY WHETHER OR NOT TTYGCH HAD BEEN PREVIOUSLY CALLED.
203\f *200
204
205PLINK, 0 /GETS ADDRESS OF TTYPCH AND TTYGCH (START OF NEXT PAGE)
206 STL CLA RAR /4000
207 TAD I TTY /RETRIEVE FUNCTION WORD, BUT PUT R/W BIT IN LINK
208 AND L3700 /EXTRACT NUMBER OF DOUBLE-WORDS TO TRANSFER
209 CMA /GET COUNT+1
210 DCA BUFSIZ /STORE AWAY
211 RDF /FIND OUT THE USER'S DATA FIELD
212 TAD CIFCDF /FORM OUR EXIT CIF CDF
213 DCA TTYXIT /STORE AWAY FOR EXIT ROUTINE
214 TAD TTY70 /GET FUNCTION WORD
215L776, AND I TTY /ISOLATE FIELD OF BUFFER
216 TAD TTYCDF /FORM CDF TO FIELD OF BUFFER
217 DCA TTCDBF /STORE WHERE IT WILL BE USEFUL
218 /AT SAME TIME, INITIALIZE TTYEOF
219 ISZ TTY /POINT TO BUFFER ADDRESS
220 TAD I TTY /AND GET IT
221 DCA BUFSTRT /AND SAVE IT
222 ISZ TTY /POINT TO BLOCK #
223TTY376, ISZ TTY /POINT TO ERROR RETURN
224SHIFT, /OUTPUT SHIFT REGISTER
225TTYEOF, /0 IF SAW CR OR ^Z AND WISH TO PAD BUFFER WITH 0'S
226TTCDBF, HLT /CDF BUFFER FIELD
227 JMP TTYKLG
228TTYLP, SNL CLA /LINK=1 MEANS OUTPUT
229 JMP TTYGET /INPUT IS FROM TTY:
230\f/LINK MUST BE SET FIRST TIME THROUGH HERE.
231/IT ACTS AS A GUARD BIT IN THE SHIFT REGISTER
232ROTL, RTL
233 RTL
234 SPA /DO WE HAVE 8 BITS SHIFTED IN?
235 JMP TELP
236 DCA SHIFT /SAVE SHIFT REGISTER
237 TAD I BUFSTRT
238 SZA
239 JMS PUNCH /PRINT A CHARACTER
240 TAD I BUFSTRT
241 ISZ BUFSTRT /BUMP INPUT POINTER
242TT7400, 7400 /PROTECT ISZ
243 AND TT7400
244 CLL RAL
245 TAD SHIFT /SHIFT HIGH ORDER 4 BITS INTO
246 JMP ROTL /SHIFT REGISTER
247TELP, JMS PUNCH /PRINT 3RD CHARACTER OF DOUBLE-WORD
248 STL /***KLUDGE
249TTYKLG, ISZ BUFSIZ /DONE?
250 JMP TTYLP /NOT YET
251TTYX, TAD TTYEOF /IF INPUT AND WE WERE PADDING WITH 0'S
252 SZA CLA /TAKE SOFT ERROR EXIT
253TTYRTN, ISZ TTY /POINT TO NORMAL RETURN
254 /CAN'T GET ERROR OR END-OF-FILE ON OUTPUT
255TTYXIT, HLT /RETURN TO USER'S FIELD
256 JMP I TTY /RETURN TO USER
257TTYCA, 0
258TTYWC, 0
259BUFSIZ, 0
260BUFSTRT,0
261TTY70, 70
262
263PUNCH, 0 /NEVER CALL TTYPCH WITH ZERO AC
264 JMS I PLINK /CALL TTYPCH
265 JMP TTYRTN /GO AWAY, WE SAW A ^Z
266L7700, SMA CLA /DID WE REACH END OF TTY LINE?
267 JMS CRLF /YES, PERFORM CR/LF
268 JMP I PUNCH /RETURN
269
270TMP,
271CRLF, 0
272 TAD L215
273 JMS I PLINK /CALL TTYPCH TO PRINT CR
274L215, 215 /CAN'T RETURN HERE
275 CLA /****
276 TAD L212
277 JMS I PLINK /CALL TTYPCH TO PRINT LF
278L212, 212 /CAN'T RETURN HERE
279 CLA /****
280 JMP I CRLF /RETURN
281\fCTRLU, JMS CRLF /PERFORM A CR/LF
282TTYGET, TAD BUFSTRT
283 DCA TTYCA /POINT TO START OF BUFFER
284 TAD BUFSIZ
285 CLL RAL /CONVERT DOUBLE-WORDS TO WORDS
286DCAWC, DCA TTYWC /SET SIZE OF BUFFER
287TSTEND, TAD TTYEOF
288 SNA CLA
289 JMP ZERO
290 JMS I PLINK /CALL TTYGCH TO GET A CHARACTER
291 JMP RUBOUT /RETURN 1 MEANS SAW RUBOUT
292ZERO, DCA I TTYCA /RETURN 2 MEANS GOT CHARACTER
293 /STORE AWAY TEMPORARILY
294 /USING USER'S BUFFER AS A TEMP LOCATION
295 TAD I TTYCA /GET BACK CHARACTER
296 IFNZRO .-320 <_ERROR>
297 SZA
298 JMS PUNCH /ECHO IT
299 TAD I TTYCA /GET IT AGAIN
300 TAD M32 /-^Z
301 SNA
302 JMP CTRLZ
303 TAD L5 /^Z-^U
304 SNA /IS IT ^U?
305 JMP CTRLU /YES
306 TAD L7
307GRUDGE, DCA TMP
308 ISZ TTYCA /NO
309L7, 7
310 ISZ TTYWC /IS BUFFER FULL?
311TT10, SKP
312 JMP TTYX
313 ISZ TMP /WAS LAST CHAR A CR?
314 JMP TSTEND /NO
315 DCA TTYEOF /YES, SET "PAD WITH 0'S" FLAG
316 ISZ TTY /POINT TO NORMAL RETURN
317 /CR IS NOT AN ERROR OR END-OF-FILE
318 TAD L212 /IF LAST CHAR INPUT WAS CR, NOW PRETEND LF WAS INPUT
319 JMP ZERO /REJOIN PROCESSING
320
321CTRLZ, DCA TTYEOF
322 JMS CRLF
323 JMP GRUDGE
324
325M32, -32
326L5, 5
327L3700, 3700
328CIFCDF, CIF CDF 0
329TTYCDF, CDF 0
330
331/TTYEOF IS ZERO MEANS PAD BUFFER WITH ZEROES
332\f/DON'T DO YET:
333/RUBOUT, AND TTYWC /177 IN AC
334/ SNA CLA
335/ JMP CTRLU
336
337RUBOUT, KCC /TTYGCH DOESN'T CLEAR RO FROM BUFFER
338 TAD TTYCA
339 CIA
340 TAD BUFSTRT
341 SNA CLA /ARE WE AT BEGIN OF BUFFER?
342 JMP CTRLU /YES
343 STA
344 TAD TTYCA
345 DCA TTYCA
346 IFZERO RUB <
347LSLASH, "\
348 TAD LSLASH /PRINT A BACK SLASH FOR EACH RUBBED OUT CHAR
349 >
350 IFNZRO RUB&4000+RUB <TAD I TTYCA> /PRINT CHAR JUST DELETED
351 IFNZRO RUB&4000 <TAD TT10> /BACKSPACE-SPACE-BACKSPACE
352 JMS PUNCH
353 STA
354 TAD TTYWC
355 JMP DCAWC /BUMP BACK WC AND GET ANOTHER CHAR
356
357 ZBLOCK 376-.
358TTY, TTYVERSION /ENTRY POINT TO HANDLER
359 JMS PLINK /SET UP CROSS PAGE LINKAGE
360 IFNZRO TTY-376 <ENTERR,QQQQ>
361 PAGE
362\f/INTERLUDE:
363
364/USA STANDARD CODE FOR INFORMATION INTERCHANGE:
365
366/ 000 001 010 011 100 101 110 111
367/
368/ 0000 NUL DLE SP 0 @ P ' 'P
369/
370/ 0001 SOH DC1 ! 1 A Q 'A 'Q
371/
372/ 0010 STX DC2 " 2 B R 'B 'R
373/
374/ 0011 ETX DC3 # 3 C S 'C 'S
375/
376/ 0100 EOT DC4 $ 4 D T 'D 'T
377/
378/ 0101 ENQ NAK % 5 E U 'E 'U
379/
380/ 0110 ACK SYN & 6 F V 'F 'V
381/
382/ 0111 BEL ETB ' 7 G W 'G 'W
383/
384/ 1000 BS CAN ( 8 H X 'H 'X
385/
386/ 1001 HT EM ) 9 I Y 'I 'Y
387/
388/ 1010 LF SUB * : J Z 'J 'Z
389/
390/ 1011 VT ESC + ; K [ 'K '[
391/
392/ 1100 FF FS , < L \ 'L '\
393/
394/ 1101 CR GS - = M ] 'M ']
395/
396/ 1110 SO RS . > N ^ 'N '^
397/
398/ 1111 SI US / ? O _ 'O '_
399/
400\f/TTYGCH: GETS A CHAR FROM KBD
401/ IF GOT ^Z, IT SETS TTYEOF FLAG
402/ LEAVES IT IN AC IN 7-BIT
403
404/TTYPRT: PRINTS CHAR IN AC ON TTY
405/ IGNORES NULLS
406/ PRINTS ^X ON CONTROL CHARS (EXCEPT CR, LF, FF, VT, TAB)
407/ PRINTS 'X ON LOWER CASE
408
409/HANDLES TABS CORRECTLY
410/ AND AUTOMATICALLY PRINTS CR/LF AT EOL
411/ PRINTS ESCAPE AS $
412
413/TTYTLS: USED TO ACTUALLY PRINT CHAR
414/ IT HANDLES TABS AUTOMATICALLY
415/ AND CR/LF'S AT END OF LINE
416
417/TTYPCH: IT USES TTYPRT TO PRINT CHAR BUT ALSO RESPONDS TO
418/ ^C, ^O, ^S, ^Q.
419/ IF ^Z IS BEING PRINTED, IT THEN STOPS FURTHER PRINTING
420\f/MUST BE AT TOP OF PAGE
421TTYPCH, /ENTRY POINT TO TTY PUNCH ROUTINE
422 /OR TTY PRINT ROUTINE
423TTYGCH, 0 /ENTRY POINT TO TTY GET CHAR ROUTINE
424 SNA
425 JMS TGCH /ZERO AC-MEANT CALL TO TTYGCH
426PCH, AND (177 /FORCE TO 7-BIT
427 DCA TCHAR
428 TAD TGCH
429M140, SZA CLA /ARE WE ECHOING?
430 JMP ECHO /YES, IGNORE ^S AND STUFF
431K5, 5 /MUST BE AT REL 10
432 TAD TCHAR
433 TAD (-32
434 IFZERO PAUS <
435 SNA CLA
436 JMP I TTYPCH
437 >
438 IFNZRO PAUS <
439 SNA
440 JMP I TTYPCH
441 TAD L15 /32-15
442 SNA CLA /LOOK FOR CR
443 ISZ LINCNT /AT END OF PAGE?
444 JMP NOPAUS /NOT AT CR, OR AT CR BUT NOT AT END OF PAGE
445L15, 15 /MUST BE HERE FOR SET
446 TAD PAUSN
447 DCA TTYTLS /SET COUNT FOR OUTER LOOP
448 ISZ LINCNT
449 JMP .-1
450 ISZ TTYTLS
451 JMP .-3
452 TAD LINSYZ
453 DCA LINCNT
454 >
455NOPAUS, JMS TTYTST
456 TAD (203-217 /NO
457 SNA /^O?
458 DCA TCHAR /YES, SET TO NULL SO IT WILL BE IGNORED
459 TAD (217-223 /NO
460 SZA CLA /^S?
461 JMP ECHO /NO, IGNORE CHAR
462TTCTLQ, JMS TTYTST
463 TAD (203-221 /NO, NOTHING ELSE MATTERS UNTIL ^Q
464 SZA CLA /^Q?
465 JMP TTCTLQ /NO, SUSPEND OUTPUTTING
466TTY32, KCC /YES, REMOVE ^Q FROM BUFFER
467/HAD NO ROOM FOR:
468/ TAD LINSYZ
469/ DCA LINCNT
470ECHO, DCA TGCH
471 ISZ TTYPCH
472 IFNZRO ESC <
473 TAD TCHAR
474 TAD (-33
475 SZA CLA
476 JMP .+3
477 TAD L44
478 DCA TCHAR
479L44, 44
480 >
481 TAD TCHAR
482 SNA
483 JMP TTYCTO /IGNORE NULLS
484 IFNZRO RUB&4000 <
485 TAD (-10
486 SNA
487 JMP RUBO
488 TAD (10-16
489 >
490 IFZERO RUB&4000 <
491 TAD (-16
492 >
493TTY100, CLL
494TTY10, TAD K5
495TTY240, SZA /TAB?
496 JMP NOTAB
497 IFNZRO SIMTAB <
498TTYTAB, TAD TTY240
499 JMS TTYTLS
500TTY7, 7 /HERE FOR NO SPECIAL REASON
501 TAD TABCTR
502 AND TTY7
503 SZA CLA
504 JMP TTYTAB
505 JMP TTYCTO
506 >
507 IFNZRO SLOTAB <
508 TAD TCHAR
509 JMS TTYTLS
510 TAD (177
511 JMS TTYTLS
512 TAD (177
513 JMP PRIN+1
514 >
515 IFZERO SIMTAB+SLOTAB <JMP PRIN>
516
517/BUG: IF HARDWARE TABS, DON'T COUNT COLUMNS CORRECTLY
518
519 IFNZRO RUB&4000 <
520RUBO, TAD TTY10 /OUTPUT BACKSPACE-RUBOUT-BACKSPACE
521 JMS TTYTLS
522 TAD TTY240
523 JMS TTYTLS
524 TAD (-4
525 TAD TABCTR
526 JMP PREPRN
527 >
528\fNOTAB, SZL CLA
529 JMP SPCHR /DON'T UPARROW CHARS LF,CR,TAB,VT,FF
530 IFNZRO FLAGLC <
531 TAD TCHAR
532 AND TTY140
533 TAD M140
534 SZA CLA /IS IT LC?
535 JMP NOLC /NO
536TTYQUO, "'
537 TAD TTYQUO /YES
538 JMS TTYTLS /PRINT QUOTE
539 TAD M40
540 JMP PRIN /PRINT UPPER CASE OF CHAR
541 >
542NOLC, TAD TCHAR /NO, GET BACK CHAR
543 AND TTY140 /HIGH ORDER BITS IRRELEVANT
544 IFNZRO CTRL <
545M40, SMA SZA CLA /CAN'T BE NEGATIVE
546 JMP PRIN /NOT A CONTROL CHARACTER
547 TAD TTYUPA /ECHO 201-237 AS ^X (EXCEPT 211-215)
548 JMS TTYTLS
549 TAD TTY100 /ADD X100 TO ^K TO GET K
550 >
551 IFZERO CTRL <
552 SNA CLA /IS CHAR A CONTROL CHAR?
553 JMP TTYCTO /YES, DON'T ECHO CONTROL CHARACTERS EXCEPT FOR 211-215
554 >
555PRIN, TAD TCHAR
556 JMS TTYTLS
557TTYCTO, TAD TABCTR /RETURN TABCNT IN AC
558 JMP I TTYPCH
559
560 IFZERO CTRL <
561M40, -40
562 >
563
564TTY140,
565SPCHR, STA CLL
566 TAD LINSIZ
567PREPRN, DCA TABCTR /THESE CHARS RESET COLUMN COUNTER
568 JMP PRIN
569\fTGCH, 0 /NON-ZERO MEANS TTYGCH WAS CALLED
570 KSF
571 JMP .-1 /WAIT FOR CHAR TO BE TYPED
572 JMS TTYTST
573/WILD: (DON'T PUT IN) SZA CLA /FALL THRU AND RETURN R.O.
574/ ISZ TTYGCH
575 TAD (203-377
576 SNA CLA /TAKE RETURN 1 ON RUB OUT
577 JMP I TTYGCH /"CLUMSY" - R.L. (9/18/73)
578 ISZ TTYGCH
579 KRB /GET CHARACTER
580TTYAND, AND (177 /MUST RETURN CHAR IN 7-BIT
581 IFNZRO CNVLC <
582 DCA TCHAR
583 TAD TCHAR
584 AND TTY140
585 TAD M140
586 SNA CLA /IS IT LC?
587 TAD M40 /YES
588 TAD TCHAR /NO
589 >
590 IFNZRO ALTMOD <
591 TAD (-175 /IS IT 175 OR 176?
592 SMA
593 JMP CONV /YES, CONVERT ALTMODE TO ESCAPE
594 TAD (175 /NO, RESTORE CHAR
595 >
596 JMP I TTYGCH /TAKE RETURN 3
597
598/SHOULDN'T TABCTR BE INITIALIZED TO C(LINSIZ) UPON ENTRY?
599
600TABCTR, -110
601
602TTYTLS, 0
603 TLS
604 IFNZRO DELAY <
605 TAD (-DELAY
606 SZA CLA
607 STA
608 >
609TTYTSF, TSF
610 JMP .-1
611 IFNZRO DELAY <
612 IAC
613 SZA /19.66 MS IS G.T. 1/60 SEC
614 JMP TTYTSF
615 >
616 ISZ TABCTR
617TTYUPA, "^
618TT7600, 7600
619 JMP I TTYTLS
620LINSIZ, -110
621
622 IFNZRO PAUS <
623LINSYZ, -HEIGHT
624LINCNT, -HEIGHT
625PAUSN, -PAUS
626 >
627
628 IFNZRO ALTMOD <
629 IFNZRO KCC-6032 <
630CONV, CLA
631 TAD (33
632 JMP I TTYGCH
633 >
634 IFZERO KCC-6032 <
635CONV, CLA IAC
636 TAD TTY32 /DEVICE DEPENDENT
637 JMP TTYAND
638 >
639 >
640\fTCHAR, 0
641
642/TTYTST: READS KEYBOARD STATICALLY AND RESPONDS TO ^C
643/ OTHERWISE RETURNS CHAR (8-BIT) MINUS 203 IN AC.
644/ IF FLAG IS NOT UP, IT RETURNS A 1.
645
646TTYTST, 0
647 TAD TT7600 /OR CHAR IN
648 KRS
649 TAD (-7603 /-7603=175
650 KSF
651 CLA IAC /STUFF IN BUFFER IS UNRELIABLE IF FLAG ISN'T UP
652 SZA
653 JMP I TTYTST
654 IFNZRO INDVC-3 <KCC>
655 CIF CDF 0 /BRANCH TO OS/8 MONITOR AT 07600
656 JMP I TT7600 /IT WILL PRINT "^C" FOR CHAR IN BUFFER
657 PAGE
658\f/ DYNAMICALLY MODIFYING THE KL8E HANDLER
659
660/ *** I M P O R T A N T ***
661
662/ THIS HANDLER CAN BE DYNAMICALLY CHANGED VIA SET COMMANDS.
663/ CONSEQUENTLY, IT IS EXTREMELY IMPORTANT THAT PEOPLE
664/ WHO MODIFY THIS SOURCE DO NOT AFFECT THE ALGORITHMS
665/ NECESSARY TO PERFORM SUCH MODIFICATIONS.
666
667/ THIS ALGORITHM IS EXPLAINED BELOW.
668
669/ SET TTY WIDTH=N
670
671/ SEARCH LOCATIONS 200-377 FOR A 7600. CALL ITS ADDRESS X.
672/ LET Y BE THE INSTRUCTION AT LOCATION X+1.
673/ FORM THE (RELATIVE) ADDRESS T=Y&177+200-1.
674/ THEN LOCATIONS T AND X+2 CONTAIN MINUS THE TTY WIDTH.
675/ THE WIDTH MUST BE A MULTIPLE OF 10 AND MUST NOT BE 200.
676/ (BECAUSE -200 IS THE MAGIC 7600)
677
678/ SET TTY CODE XX
679
680/ SEARCH ENTIRE HANDLER FOR INSTRUCTIONS OF THE FORM 6XXY
681/ WHERE XX IS NOT 20 OR 21,
682/ AND FURTHERMORE DON'T INCLUDE A 6031 IF 2 LOCATIONS
683/ FOLLOWING IS A 7650
684/ AND DON'T INCLUDE A 6034 IF 4 LOCATIONS FOLLOWING IS A 7650.
685
686
687/ SET TTY [NO] ECHO
688
689/ THE WORD INVOLVED IS AT (RELATIVE) LOCATION 120.
690/ SET TO 7440 TO ECHO.
691/ SET TO 7610 TO SUPPRESS ECHOING.
692
693
694/ SET TTY LC
695
696/ SEARCH LOCATIONS 200-377 FOR A 377. CALL ITS ADDRESS X.
697/ LOOK AT LOCATION X+5.
698/ IF THIS LOCATION IS NOT A 7650, THEN LC TO UC CONVERSION
699/ WAS NOT ENABLED AT ASSEMBLY TIME.
700/ IF THE FEATURE IS ENABLED, CHANGE LOCATION X+5 TO A 7610
701/ TO PREVENT THE CONVERSION. TO ALLOW CONVERSION, SET
702/ LOCATION X+5 BACK TO 7650.
703
704/ SET TTY PAGE
705
706/ SEARCH LOCATIONS 215-300 FOR A 7450. CALL ITS ADDRESS X.
707/ SET X+3 TO 7640 TO ENABLE ^S, ^Q.
708/ SET X+3 TO 7200 TO DISABLE ^S, ^Q.
709\f/ SET TTY TAB
710
711/ SEARCH LOCATIONS 200-300 FOR A 7.
712/ IF NOT FOUND, SIMULATED TABS WAS NOT ENABLED AT ASSEMBLY TIME.
713/ IF FOUND, CALL ITS ADDRESS X.
714/ TO PATCH OUT SIMULATED TABS:
715/ MOVE C(X-12) TO LOCATION X-2
716/ CHANGE LOCATION X+3 TO A 7610
717/ TO RESTORE SIMULATED TABS:
718/ SET LOCATION X-2 TO X-4&77+1200
719/ CHANGE LOCATION X+3 TO A 7640
720
721/ SET TTY FILL
722
723/ THE LITERAL 177 MUST REMAIN AT THE END OF PAGE 2
724/ SEARCH LOCATIONS 200-300 FOR A 1377.
725/ IF NOT FOUND, THEN FILL CHARACTERS WERE NOT ENABLED AT ASSEMBLY
726/ TIME. IF FOUND, CALL ITS ADDRESS X.
727/ TO PATCH OUT FILL CHARACTERS, MOVE C(X+3) TO LOCATION X-1.
728/ TO RESTORE FILL CHARACTERS, MOVE C(X+1) TO LOCATION X-1.
729
730/ SET TTY FLAGLC
731
732/ SEARCH LOCATIONS 200-377 FOR A 247.
733/ IF NOT FOUND, LOWER CASE FLAGGING WAS NOT ENABLED AT ASSEMBLY TIME.
734/ IF FOUND, CALL ITS ADDRESS X.
735/ TO DISABLE FLAGGING, SET LOCATION X-2 TO A 7200.
736/ TO RE-ENABLE FLAGGING, SET LOCATION X-2 TO A 7640.
737
738/ SET TTY PAUSE [N]
739
740/ SEARCH LOCATIONS 200-300 FOR A 15.
741/ IF NOT FOUND, PAUSING WAS NOT ENABLED AT ASSEMBLY TIME.
742/ IF FOUND, CALL ITS ADDRESS X.
743/ TO DISABLE PAUSING AFTER A FULL SCREEN,
744/ SET LOCATION X-3 TO A 7610.
745/ TO RE-ENABLE PAUSING, SET LOCATION X-3 TO A 7650.
746/ TO SET PAUSE DURATION, SEARCH LOCATIONS 300-377 FOR A 7600,
747/ CALLING ITS ADDRESS X. THEN (MINUS THE) PAUSE DURATION IS AT
748/ LOCATION X+5.
749
750/ SET TTY HEIGHT
751
752/ THIS IS ONLY APPLICABLE IF SET TTY PAUSE HAS BEEN ASSEMBLED IN
753/ (A 15 CAN BE FOUND ON SECOND PAGE).
754/ NEGATIVE OF HEIGHT MUST BE SET IN BOTH LOCATIONS X+3 AND X+4
755/ WHERE X IS THE ADDRESS OF A 7600 AS IN ABOVE.
756\f/ SET TTY ESCAPE
757
758/ SEARCH LOCATIONS 200-377 FOR A 44.
759/ IF NOT FOUND, THEN $ WAS NOT ASSEMBLED INTO TTY HANDLER.
760/ IF FOUND, CALL ITS ADDRESS X.
761/ TO DISABLE PRINTING ESCAPE AS $, SET LOCATION X-4 TO A 'CLA'.
762/ TO CAUSE ESCAPE TO PRINT AS AN ESCAPE, SET LOCATION X-4 TO SZA CLA.
763
764/ SET TTY ARROW
765
766/ SEARCH LOCATIONS 200-377 FOR 7740.
767
768/ IF NOT FOUND, USING OLD HANDLER.
769/ CALL ITS ADDRESS X.
770/ IF LOCATION X+1 IS MORE THAN 7000,
771/ THEN UPARROW MODE WAS NOT ASSEMBLED INTO KL8E.
772/ OTHERWISE, TO ALLOW ARROWS, SET LOCATION X+3 TO THE
773/ CONTENTS OF LOCATION X+6.
774/ TO CAUSE CONTROL CHARACTERS TO ECHO AS IS, SET
775/ LOCATION X+3 TO 'SKP CLA'.
776/ NOTE THAT THIS IS A DIFFERENT OPTION THAN ASSEMBLING CTRL=0.
777\f IFDEF TEST <
778 *600
779
780/TEST ROUTINE FOR KL8E HANDLER
781
782GO, JMS I (TTY /CALL HANDLER
783 0600 /READ SIX PAGES
784 1000 /BUFFER AT 01000
785 0001 /BLOCK 1
786 HLT /ERROR RETURN
787 JMS I (TTY /CALL HANDLER AGAIN
788 4600 /OUTPUT SIX PAGES
789 1000
790 0001
791 HLT
792 CLA
793 JMP GO
794 >
795 $
796\f