.SYMTAB 7001. ; -*-MIDAS-*- TITLE CRTSTY - STY program for unsupported CRTs ; (c) Copyright 1979 by Ken Harrenstien and Earl Killian. comment ~ Operation: CRTSTY is a program which provides ITS display support for terminals which ITS does not support itself. A brief overview of ITS display support is called for here. When a program sends output to a terminal it is interpreted by the ITS Main Program (MP) Level TTY routines. In addition to straight text to be displayed a program may output special character sequences to perform useful operations on the displayed output. These character sequences are called "^P codes". The ITS MP Level interprets ^P codes (and certain ASCII format effectors such as CR, LF, etc.) and deposits in the terminal's output buffer "%TD codes" - an internal representation of the operations to be performed on the display. Finally at output interrupt level the ITS interrupt routines read %TD codes from the output buffer and send the terminal specific codes necessary to operate on the display. Normal ITS terminal output: ----------- ------------- ---------- ------------- ------------ | | | ITS | | ITS | | ITS | | | | Program |--->| Main Prog |--->| Output |--->| Interrupt |--->| Terminal | | | | | Level | | | Buffer | | | Level | | | | ----------- | ------------- | ---------- | ------------- | ------------ | | | | ^P codes %TD codes %TD codes Terminal codes Thus the only terminals directly supported by ITS are those small number which the ITS Interrupt Level knows about. However it is possible to indirectly support other terminals; this is what CRTSTY does. The CRTSTY program runs in a separate process and basically replaces the ITS Interrupt Level in the above diagram. It does this via the STY device which allows it to read from the output buffer of the TTY associated with the STY. Thus CRTSTY is able to read ITS %TD codes and translate them into terminal codes for the supported terminal. Finally CRTSTY outputs the terminal codes to the terminal, again going through the ITS MP Level, ITS output buffer, and ITS Interrupt Level. However it outputs in a special mode called "super image ouput mode" which prevents MP Level and Interrupt Level from doing anything but passing what CRTSTY sends verbatim. CRTSTY operation: ----------- ------------- ---------- ---------- ---------- | | | ITS | | ITS | | Pseudo | | | | Program |--->| Main Prog |--->| Output |--->| TTY |--->| CRTSTY |---> | | | | Level | | | Buffer | | | Device | | | | | ----------- | ------------- | ---------- | ---------- | ---------- | | | | | | ^P codes %TD codes %TD codes %TD codes Terminal codes ------------- ---------- ------------- ------------ | ITS | | ITS | | ITS | | | --->| Main Prog |--->| Output |--->| Interrupt |--->| Terminal | | Level | | | Buffer | | | Level | | | | ------------- | ---------- | ------------- | ------------ | | | Terminal codes Terminal codes Terminal codes Add some stuff about what CRTSTY does when it gets the %TD codes. Explain its "never do today what you can put off until tomorrow" attitude. ~ comment ~ CRTSTY Internal Structure Conceptually, CRTSTY is composed of two separate processes which sit astride two data streams, to form four interlocked modules. %TOFCI bits | SIMULATION | SUPPORT |---------------| | |---------------| PYO channel | "SMO" | | | "TYI" | TYIC channel input <<=======|sbout< >=======|styinc> >======|=======|td.xxx> >tr.tyo|============>> display PYI channel | | | | | TYOC channel |---------------| | |---------------| | | %TD codes Note well the possible confusion wherein "output" to the STY is input from the TTY to the program, and vice versa. In the very center one sees the "IDEAL" virtual terminal, using %TOFCI bits on input and %TD codes on output. By using this virtual terminal concept it is possible to simulate and support any pair of real terminals freely, since each will be "plug compatible" with every other. In general, only the output stream is of interest, since keyboard input is usually passed along to the program with no modification or special action. However, note that the SMO and TYI modules as implemented are actually co-routines; each believes it is driving the other. SMI on the other hand does drive TYO directly; in fact the channel between them is one of execution paths rather than actual data, wherein SMI decides what TD.XXX routines to invoke. The SIMULATE component's task is to fake the program into believing that its TTY is some particular terminal, primarily by scanning the output stream for display commands and translating them into %TD codes. This is useful when dealing with programs which were written with one particular terminal in mind, as is often the case on non-ITS systems. By default this component simulates an ITS "Soft" TTY. Since a Soft TTY is merely the ITS virtual terminal specification, identical or almost so to CRTSTY's virtual terminal, this contrives to be transparent! The SUPPORT component's task is to translate the virtual-terminal %TD-code display commands into specific output sequences for the particular terminal type actually being used. It is also sometimes responsible, in the TYI module, for implementing various keyboard input features that try to compensate for whatever mis-features the terminal has. A prime example of this is the underscore/DEL exchange for keyboards which have these chars on the same key, wrong side up (i.e. they expect you to hold down SHIFT every time you rubout something). ~ subttl History comment ~ Historical: Historically derived from TEKSTY, munged by DPR, RZ, MOON, CBF, EAK, and KLH. Current version nearly a complete KLH rewrite (with exception of command parsing). TEKSTY was a version of STY (written by PJ?) hacked up by JLK and RLB. Date FN2 Who What (Note KLH doesn't pay much attention to this nonsense) 3/20/78 394 EAK fix auto-nl bug again 3/28/78 400 EAK add TM.AX and TM.AY entries to HP's 3/31/78 402 EAK put check in MOVCUR for fast return if no movement 3/31/78 403 CBF remove my version of the NIH5200 4/05/78 407 EAK fix Concept 100 initialization to set tabs correctly 4/07/78 416 EAK Purified CRTSTY 4/08/78 417 EAK Fixed bug in SCRDCP 4/12/78 421 CBF Added DTI terminal 4/16/78 422 EAK Fixed bug in TEK4025 4/26/78 423 EAK Added home entry to TEK4025 4/28/78 435 EAK Fixed some OMRON bugs 5/06/78 436 EAK Increased OMRON InsLine and DelLine padding 5/11/78 437 EAK Switched to winning version of ASCNT macro 5/16/78 439 KLH Added DM3025 as per FURST's specifications 5/16/78 440 CBF Changed some timings and 1 bug in DM3025 definition 5/16/78 443 EAK Fixed some paddings in DM3025 5/22/78 448 EAK Restored C100 editing functions 5/22/78 449 EAK Fixed FOX absolute move bug and NOABS flag 5/22/78 450 CBF Made TR.AMC definitions for FOX, OWL, HP2645 and HP2640 5/22/78 452 EAK Changed C100 padding on basis of experimentation 5/28/78 454 RJL Added control _ and control ^ to c100 on function keys 5/31/78 459 RJL Added esc n function keys, padding on formfeed and fixed init bug in C100 6/02/78 480 EAK Changed insert/delete line/character entries to take argument instead of assuming 1 7/03/78 507 EAK Finally debugged the TEK4025 code. The terminal is a real crock, and the manual is impossible. 7/19/78 520 KLH Hacked TRMBEG macro and CORFLS routine so that several terminal definitions can share same page. 7/24/78 521 EAK Added some stuff to TEK4025 code. 8/01/78 527 EAK Fixed a bug in TEK4025 code. Also made definition macros barf if arguments are blank. 8/02/78 530 EAK Created two new zone tables and modified some terminal definitions to use them. 8/06/78 564 EAK Put in redundent movement optimizer. 8/11/78 572 KLH Finished EAK's mods and added smart CLEOL hackery! 8/12/78 RWK Made VT52 alternate keypad work right, made it %TOFCI and put in timeout for ESC (SEL). Fixed FEEP code. 8/14/78 608 EAK Changed the world to use arguments for relative movement functions. 8/17/78 615 EAK Redid ORDNRY to fix bugs, provide better control character output. 8/20/78 633 EAK Fixed some bugs in movement optimizer and ORDNRY. 8/20/78 634 EAK Added a TR.WRP entry for the HP terminals. 8/20/78 635 EAK Hacked the HP terminal definitions somewhat. 8/20/78 638 EAK Added the Tektronix 4027. It is almost identical to the 4025, but lacks  for move up. 8/20/78 639 EAK Fixed a bug in CLEOL-less terminal bug in ORDNRY. 8/20/78 641 EAK Hacked 4027 CLEOL to used DCH at 60cps or slower. 8/21/78 644 EAK Fixed bug in SIMEOL so that it will clear the last character position on a line. 8/21/78 646 EAK Moved screen image updating from ORDNRY to SCHO. 8/21/78 647 EAK Removed  hackery from 4025 since not all of them have it. 8/21/78 656 EAK Added TRMTOO and associated hackery. 8/22/78 657 EAK Fixed bug in FTLINT. 8/23/78 660 CBF Added H1500A cause Hazeltine changed RP's CR to an NL 8/23/78 661 CBF Added T1061 8/23/78 662 CBF Changed TK4027 to always use DWN instead of LF This may also have to be done to the 4025 8/23/78 663 RWK Fixed a %CLPND bug in ORDNRY. 8/23/78 664 EAK Added DBUFC for debugging. 8/27/78 667 EAK Changed FRCEOL to not output CLEOL unless its really needed. 9/01/78 668 EAK Fixed a bug I introduced into FRCEOL. 9/01/78 669 EAK Added more smarts to SMEOL on terminal with CLEOL. 9/03/78 670 EAK Added a CHO routine for the Concept 100. Also, turned off character insert/delete. 9/05/78 671 CBF Add the BEE3 for CMR 9/07/78 679 EAK Fixed some VT100 stuff after playing with one. 9/08/78 680 EAK Added some scroll region optimizations for the VT100. 9/08/78 681 EAK Added Infoton 4380 support. Also added sample terminal definition. 9/09/78 683 RWK Made -> key on VT52 into [BREAK] instead of [FORM] 9/09/78 684 RWK Added [ENTER] key hackery to VT52 stuff 9/09/78 686 RWK Made code for [ENTER] stuff available to any terminal and added code to flush it from core for those that don't use it. 9/09/78 691 RWK Added terminal-specific interactive ([ENTER]) capability. Intended for re-initing terminal parameters, etc. 9/09/78 691 RWK Added Alarm mode toggle as an [ENTER] command 9/09/78 692 RWK Started adding the DELPHI terminal type. (An intelligent protocol between DELPHI UNIX and ITS including a mini-FTP for people here TA'ing 6.031) 9/09/78 694 RWK Spec'd out the FTP portion of DELPHI type. 9/09/78 699 RWK Added log file hackery 9/09/78 703 RWK Fixed a bug in VT52 sail graphics. 9/09/78 705 RWK More DELPHI hacking. 9/12/78 706 EAK Added a VT100 absolute movement cost calculator. 9/12/78 708 EAK Fixed two bugs in log file stuff. 9/13/78 709 EAK Fixed two bugs in Teleray 1061 code before demo today. 9/13/78 717 EAK Debugged Teleray 1061 support. 9/13/78 718 EAK Fixed bug in VTCHO. 9/15/78 719 CBF Hacked Adds 980 a bit. 9/17/78 724 EAK Hacked log file stuff a little more. 9/20/78 727 CBF Fixed BADSPC up a little. 9/20/78 729 EAK Tidied up OMRON code. 9/20/78 731 EAK Removed GRAFIX hack per request. 9/20/78 736 EAK Changed around a lot of the command line parsing. Still needs an awful lot of work. 9/24/78 738 RWK Fixed a bug in the CRTSTY-escape code. 9/27/78 739 CBF Made TK4027 use the obscure hardware CLEOL. 10/12/78 751 EAK Added stuff to flush initialization code after startup. 10/20/78 766 EAK Created terminal type SOFT and reorganized lots of the TD routines. In the process HOMCLR went away; TDCLR and TDEOF now conspire to do it's job. 10/20/78 767 EAK Fixed up TK40XX insert line at top code a little. 10/20/78 770 EAK Added basic windowing stuff. 10/21/78 777 EAK Added insert/delete line/character simulation. 10/23/78 780 KLH Changed the terminal definition table to be BLT'd into the TB array at initialization. Redid STY input. 10/24/78 790 KLH Added NLS LP simulation. 10/24/78 792 EAK Redid screen dumping stuff a little. 10/24/78 793 EAK Added some TNX conditionals. 10/25/78 794 MMCM Added Soroc IQ 120. 10/25/78 797 EAK Added some more TNX stuff. Changed WARN to use ORDNRY. 10/27/78 804 CBF Added RPVT52, it's sick. 10/27/78 807 KLH Added H1510. 10/28/78 808 EAK Added %TDWIN stuff. Created TE.WIN entries for the VT100 and Concept 100. 10/30/78 809 EAK Hacked insert/delete line/character to work better in windows. Also added .TRFIN to be called before CRTSTY quits. 10/30/78 810 EAK Added ACT-IV. Changed log file's home to be CRASH. 11/01/78 811 EAK More fixes for insert/delete line/char in windows. Added .TPSCR, the scroll count for the terminal (corresponds to TTYROL in ITS). Also, changed screen image to live right after variables to save a page on occaisions. 11/01/78 812 EAK Reorganized TD subroutines. Added some more TNX conditionals. 11/03/78 814 EAK Redid TD.(DLF ILP DLP ICP DCP) yet again. %FNxxx no longer need to be specified in terminal definitions. SIMEOL now calls TD.DLF instead of ORDNRY. 11/06/78 819 EAK Replaced PAD subroutine with PAD UUO. Changed all the TR.TYI handlers to conform to KLH's new scheme. 11/07/78 821 EAK Added @ITS command line option. 11/08/78 822 EAK Changed NOWARN to NO WARN, NOLOGIN to NO LOGIN, and NOBELL to NO BELL. Also changed SCREOL, SCREOS, and SCRILP to work with windowing. 11/09/78 824 RWK Fixed bugs in ENTER code. 11/09/78 827 EAK Reorganized more of the initialization code to make it more modular and make it easier to conditionalize it for TNX. Also changed C100 padding to be closer to reality, making it pretty hairy. 11/10/78 828 EAK Changed NOABS to NO ABS, and NOTABS to NO TABS. Hacked TPCBS stuff. Moved lots of code around to make groupings more logical. PAD UUO now rounds up. 11/10/78 830 EAK Changed SCRICP to work with windowing. Commented out DBUFC (not worth the buffer space it takes). 11/14/78 834 EAK Added a wrap optimizer to the I4380. 11/16/78 837 EAK Removed %FLCNL and added CCHO in its place. CCHO hacks scrolling when typing in the last column of the last line. Added redisplay command to ACT stuff. 11/16/78 838 EAK Changed SCRDLP to work with windowing. 11/21/78 852 KLH Re-did some LP support/simulation stuff. 11/21/78 853 GSB Added TX.VBL entry for Concept 100 and also changed its TR.CHO to hack underscores to avoid lossage. 11/21/78 854 EAK Fixed a bug in C1CHO and hacked it a bit. 11/24/78 8?? KLH decides to give up and start writing garbage in here. 11/24/78 880 KLH Made TYI and SMI modules into co-routines, re-did most TR.TYI entries to take advantage of new capabilities. Added more doc, clarified structure. Fixed several bugs in term defs (ACs not saved). 11/26/78 883 EAK Changed TD.SCR to TD.SU. Added SCROLL command line option. 11/27/78 888 KLH Fixed bug in TD.ILP/DLP/ICP/DCP routines, added TD.SD (scroll down), redid terminal subttl's. 11/27/78 892 EAK Undid KLH's undo of my undo to KLH's undo of my .TPSCR stuff. Also fixed a bug in .TPSCR where cursor isn't updated updated correctly when .TPSCR^=1. 11/27/78 897 EAK Changed SCRDCP to hack windowing. Began TR.TYI changes to improve co-routine setup. 11/29/78 899 KLH Completed most TR.TYI changes, also changed STY interrupt vectoring similarly. Fixed SCREOL bug. Added ACT-V. 11/30/78 900 EAK Removed HP2640 definition, moved much of its stuff into the HP2645. Eventually I'd like to make HPINIT see what name was used to invoke the HP code and do some stuff conditional on that name being HP2640. 11/30/78 901 EAK Redid VT52 input co-routine and timeout stuff. Timeout stuff is now available to all terminals. 11/30/78 902 EAK Hacked REDISP stuff a little. 12/01/78 903 RWK Put [HELP] back in the ASKQUE routine. This is easier to type on a VT52 (and I expect other TTY's too) than [BACK-NEXT]H or [TOP]H 12/01/78 906 RWK Put in table of TOP characters. What existed was useless. 12/01/78 909 EAK HP2645 bug fix. 12/02/78 912 EAK Fixed up simulator output co-routine initialization. 12/03/78 914 EAK Added some 20X PTY code. 12/04/78 915 KLH Added  for LP mouse simulation. 12/05/78 917 EAK Random changes all over. 12/06/78 918 EAK CT64 bug fix. 12/06/78 919 EAK ADM2 bug fix. 12/06/78 920 EAK Fixed initialization bug introduced in 917. 12/06/78 921 EAK Changes to %PITTY interrupts. 12/07/78 922 CBF Minor fix to RPVT52, fixed JTRMSLS to list several terminals per line again, and put in VT100 padding. 12/07/78 926 KLH Added DATAPOINT, tried to document some hair. 12/08/78 928 KLH Added XLOG, improved CCHO, removed SCRLCOUNT=0 check. Scroll stuff really needs to be fixed. 12/08/78 929 EAK Put back detached check in RLTINT; it is needed because %PITTY doesn't go off reliably. 12/08/78 930 EAK Added SLEEP macro. Reversed PG$MSK convention. 12/08/78 931 EAK More TNX modifications. 12/14/78 943 KLH Added DATALOSER (still needs work), condensed TMCDEF etc macros, TB entries now have labels for DDT. Changed TR.INI default, dbgsw setting. 12/14/78 944 KLH Fixed a CLEOL bug. 12/14/78 947 KLH Changed Dm2500 i/c and i/l code to use cleverness. 12/17/78 950 RWK Put the ASKHLP routine (from ASKQUE) inside the IFN ITS 12/22/78 953 KLH Fixed DEFINI bug, changed LP's .TRINI back owing to problems with hacking TYIGET before interrupts enabled. 1/03/79 954 BYRON Minor adjustment to C100 padding. 1/29/79 960 CBF Changed OMRON to -%TOLID if > 300 baud. 2/25/79 962 CBF Added MIME52 for Emery. Essentially VT52 with line i/d 2/28/79 964 EAK Changed C1CHO3 to use repeat character horizontal. Also changed OSMAP a little. 3/01/79 966 GSB&EAK Hacked C1CHO some more. 3/02/79 967 EAK Added STYIP for hacky optimizations. 3/03/79 968 EAK Added TRANSLUCENT option for C100. Completely redid C1CHO. Also started WHOLINE option. 3/05/79 970 EAK Moved OSMAP code into OSINIT, TTYINI, STYINI. Changed HPINIT to use BUFC while sending terminal reset. 3/11/79 971 EAK Fixed up TKILP. 3/11/79 972 EAK Added WHO1/WHO2/WHO3 hacking to WHOLINE stuff. 3/11/79 973 EAK Added JTMU, NMPGS, and NSWPGS hackery to WHOLINE. 3/11/79 974 EAK Fixed screwed up %F flag definitions. 3/12/79 976 EAK Added I400. 3/13/79 977 CBF Added I100. (This is support your local Infoton week) 3/13/79 978 CBF Added ADS100 for Macrak and hacked MIME52 for Emery 3/14/79 979 EAK Fixed I400 bugs, changed C1CHO to hack last column better. 3/15/79 980 EAK More I400 work. 3/16/79 981 EAK Changed XITEX to use NUL for padding. 3/17/79 982 EAK Fixed formatting bug in WRTLOG. 3/18/79 983 EAK Fixed TDORS problem with WHOLINE. 3/24/79 984 EAK C100 window hacking. 3/25/79 985 EAK Added optimization to TDDLP. 3/26/79 986 EAK Hacked C100 insert/delete character subroutines. 3/26/79 989 EAK Random hacking. 3/30/79 990 EAK Added TR.NRM to make wrapping work. Also changed %FNxxx computation in SETUP3 and TD.WIN. It is now possible to have, for example, a TE.ICP entry which isn't used because of a %FNICP in TP.FLG (but that can be overriden by a CID in the command line). Also added %PIATY interrupt handler and DMOVE/DMOVEM macros. 3/31/79 991 CBF VT100 hacking. 3/31/79 992 EAK Rewrote ORDNRY, SCHO, CCHO to be faster. 3/31/79 993 EAK Added TE.EIM and TE.LIM. 4/01/79 994 EAK Fixed bug in %PIATY interrupt handler. 4/03/79 999 EAK Numerous changes to everything. Mostly completing the TNX SUPDUP code. 4/09/79 1000 EAK More changes for TNX SUPDUP code. Sort of hacky at the moment. 4/09/79 1001 EAK Wrote FINI, QUIT, and PROCED. Flushed C1FINI. 4/10/79 1002 EAK Fixed bug %TOLID/%TOCID bug in SETUP4. 4/12/79 1003 EAK Added more command character hackery. Hacked CC.FWD. 4/20/79 1004 CBF Added VDM1 for Jerry Pournelle 4/22/79 1005 CBF Added H19 4/22/79 1007 RWK Added TH6416 for NEAL (he wrote it, this is a merge) 4/24/79 1008 EAK Fixed H2000 bug. 4/24/79 1009 EAK Added some %TX code to SWSMO. Hacked ENTER/CMDCHR. 4/25/79 1010 EAK Fixed bug in H19DEC. 4/27/79 1011 EAK Added %FNEOL+%FNEOS to Xitex's TP.FLG. 4/28/79 1013 EAK Reduced padding for Teleray 1061. TNX hackery. 5/10/79 1015 EAK Changed VT100 definition a fair amount. 5/17/79 1017 EAK Added CLEOL padding to T1061. 5/18/79 1018 EAK Fixed NO BELL, added VT100 visbel. 5/28/79 1019 EAK Added ANNARB and ADI60. 5/29/79 1020 EAK Added tabs to ANNARB support. 5/30/79 1021 EAK Added TEL3 for ELL. 6/10/79 1022 EAK Added TLC for AUTHOR. 6/12/79 1023 EAK Added PGA,GYRO's DD5200 code. 6/18/79 1024 EAK Added SOL20 for LEWIS! and DEVON. 6/18/78 1025 EAK Changed C1EOL and C1EOS to use Clear All. 6/18/78 1026 EAK Added I200 for MACRAK. 6/19/79 1027 EAK Changed SOL20 for DEVON. 6/20/79 1028 EAK Added VT52 simulation. 6/21/79 1029 EAK Added TNX JERR1 uuo for reporting JSYS failure returns. 6/22/79 1030 EAK Added real TYITOG for TNX, added SIBEBUG stuff. 6/22/79 1032 EAK Added more TNX error handling code. 6/25/79 1034 EAK Debugged TNX PTY and INT code. TNX&STY&INT doesn't work because SIBE doesn't appear to work on PTY channels! TNX&INT doesn't work because .TICTI doesn't leave interrupt character in input buffer! 6/26/79 1036 EAK Stopped using IVORY in favor of SECTIONs. 7/05/79 1037 EAK Fixed bug in TNX NET STYINI, CHNTAB definition, changed IQ120 to use CCHO, and fixed missing TE.EOL in SOL20 definition. 7/09/79 1038 EAK Added C1TYI. 7/10/79 1039 EAK CID option tells C100 support to use fixes for insert/delete character. 7/11/79 1040 EAK Changed SIMULATE default for TNX&STY to VT52. 7/20/79 1043 EAK Merged in HARV's TUBE1.5. 7/21/79 1044 EAK Added automatic login on TNX PTYs and open TTY: instead of TTYnnn. 7/21/79 1045 EAK Added ICMASK so DM2500 and T1061 input handlers can hack meta bits. 7/22/79 1046 DCH Added MIME. 7/23/79 1047 EAK Added NO LOGIN option for TNX&STY. 7/27/79 1048 EAK Fixed H19 per MT's request. 7/28/79 1049 EAK Fixed SOL20 and TUBE1.5 per requests. 7/28/79 1050 EAK Moved VTABS to utility section, added TYODEC utility. 7/31/79 1052 EAK Merge several insert/delete lines in VT52 simulation. 8/01/79 1053 EAK Added PURIFY routine for TNX. 8/12/79 1055 EAK Added code to handle too many insert/delete lines/characters. 8/14/79 1056 EAK Added fair share to wholine, updated option listing, change ICP to be to SUPDUP socket, made TNX TYIPUF and SMOPUF better, and added %FSPD to H19 flags. 8/16/79 1057 CBF Added HP2621 from HP2645 definition 8/16/79 1058 EAK Added more comments, fixed %PIATY bug, hacked FRCV to handle non-existant receive fork. Added REINIT and NO FLUSH. 8/16/79 1059 EAK Divided INT conditional into TINT and SINT for TTY and STY. Got TTY input interrupts to work. 8/21/79 1065 EAK Add ITS network code. Still needs work. 8/22/79 1066 EAK Added TNX WHOLINE code. Fixed up VT52 simulator. 8/23/79 1067 EAK Added a few .XCREFs. 8/31/79 1069 EAK Added load average to TNX WHOLINE. 9/04/79 1075 KLH Fixed bug in LP, TDDLP. Cvtted LP to TNX. Added TYIPUC routine to centralize cmd-char check. 9/05/79 1081 KLH Put in kludge code to make SIBE work with TINT. Added IBUFIP. 9/09/79 1084 EAK Added IQ140 for JAC. 9/11/79 1085 EAK Fixed IBUFIP. 9/12/79 1086 EAK Lots of little changes all over. Fixed TM.NLs that used TYN instead of TYO. Re-ordered JCOPTs and :CRTSTY ? listing. Renamed CLEOS to STEOS and added NO CLEOL and NO CLEOS. Moved MOVC20 label to right place. Bummed an instruction from CC.TAB. Deleted H200 and H2LOSE CLEOL routines. 9/13/79 1087 CBF Added Perkin-Elmer Bantam 9/27/79 1088 EAK Added chaosnet code. 10/01/79 1089 CBF Made DM2500 cancel modes at initialization time 10/13/79 1090 CBF Added IBM 3101. 10/23/79 1091 EAK Fixed bugs in IBM 3101. 11/02/79 1092 EAK Conditionalized stuff in VTTYI on ITS\NET. 11/12/79 1093 EAK Added VT52 absolute positioning hack to VT52 simulation 12/03/79 1094 HIC Fixed some bugs in BANTAM support. Still needs work. 12/11/79 1095 EAK Added AAB for AQE (another Ann Arbor!). Also changed TR.NRM to be just for horizontal wrapping. 12/13/79 1096 EAK Added %TDRSU/%TDRSD code. Not tested yet. 12/20/79 1100 RWK Added TE.SU entry for H19, made TE.INI reset auto-CR and turn on the cursor! Flushed losing DELPHI spec which was never finished and useless now anyway. Added TX.WE, TX.WB, TX.WI, and TR.WHO, and gave H19 a TR.WHO to use the 25'the line. 12/21/79 1101 EAK Changed around new wholine stuff. Fixed several bugs in it (probably introduced a few). TP.WHO kludge eliminated in favor of TR.WI. 1/13/80 1109 EAK Added %TDRSU/%TDRSD code. 1/24/80 1110 EAK Fixed a 20X TT%PGM bug. 1/29/80 1111 EAK Turn on %TPRSC when %TOLID turned on. Fixed bug at XDLP4 that caused random lossage sometimes. 1/30/80 1112 EAK Added TR.FIN for H19 to prevent cursor from being left on status line. 1/30/80 1113 EAK Fixed bug in STYIP that prevented one character of the input stream from being read! 2/07/80 1114 EAK H19 wholine bug fix. 3/30/80 1122 CBF Installed RLL's first cut at VT132. 4/18/80 1125 EAK Added gross padding to VT132. 5/07/80 1127 EAK Increased C100 insert/delete line padding a bit. 5/23/80 1129 EAK Changed IQ140 insert/delete codes for JAC. 5/25/80 1130 EAK Fixed H19 25th line problems with 20X SUPDUP version. 6/08/80 1133 CBF Added TVI912 for DBK, put IQ120,140 in alpha order. 6/21/80 1138 CBF Added AJ510 for GNU, installed BKD's Cromem 3101 Had to up MAXTRMs from 80.! Set it to 120. 6/27/80 1142 EAK Added CSK's VT05 code and removed RLJFN from PURIFY. 7/12/80 1144 CBF Couldn't resist the amusement of adding DWARME's ACT-II commented out due to CRTSTY lossage 7/30/80 1150 CBF Added VIP7800 for MAXB 8/5/80 1152 CBF The problem with the ACT-II and the VIP7800 was due to Midas limits on constants. EAK made a new version on MC which fixes it. In celebration I added, KTM2 for MAXB, DG200 for JJK and INtertec-S for JWP. ACT-II & VIP7800 should work now also. 9/8/80 1162 RLL Added support for the AAA (Ann Arbor Ambassador) terminal. There is no padding, but that might change when it's tried out on the terminal. 9/9/80 1167 EAK Fixed up AAA support a bit. Added TYOANS & TYNANS UUOs. History: ; This is here for the TAGS package to find where to ; add new history entries ~ subttl Things-to-do comment ~ To Be Done (someday)?: Not all of these things are, of course, realistic, hence "?". !!!!! Make JCL option reader recognize partial matches. With so many cmds, this is more impt now. Flush SPEED, recognize 120, 1200, etc. directly. in SUPDUP, allow host name in JCL without "HOST" spec. Command reader should list commands in response to "?". New command if SUPDUP: EXEC, to run inferior exec. New command: BREAK, to send break. New JCL option: META. Enable META-bit processing. Escape becomes meta-^@. On SRI-KL, default SUPDUP options are DM2500, META, etc. Add support for %TOOVR terminals. Make tabstop setter more general, have "set-tab" terminal-table entry as well as "clear-tab" (or "clear-all-tabs") or something. MOVCUR Optimizer - variable-size tab calculations? Figure how to have efficient distinction between a) neither atomic nor simulate exist. b) atomic commands, no simulate c) no atomic, uses simulate. d) atomic cmds exist, but shorter simulate also exists. (assmption is that a longer-than-atomic simulate will never want to exist!) Separate universal term flags into LH of F, dependent flags into RH (or define mask range for them) Store line sum counts in front of SCREEN? For easier check-EOL-ing; not hard to do, but saving may be trivial. Must remember MODE that terminal is in; some terms have many different modes with different ways of exiting each. (upon entry to mode, store vector to getting out of mode?) CRTSTY test program? either routine in CRTSTY, or program using ^P codes? (or program feeding it software codes directly? 2 sty's in a row...) see KLH;CRTEST > Detach sty when tty disappears. May need more ITS support. Check %TANJS bit of STYGET call? Or somehow detect when the ^Z sent to STY isn't getting a hactrn; this could be a big loss if it hangs up crtsty forever. Debug script file. normal feedthru chars all on one line, all 2xx chars given as: | .. move h,v -> nh,nv (chars sent) (description) ~ subttl Definitions IF1 { its==1 10x==1 20x==1 .insrt system } ; IF1 ifndef sty, sty==0 ; STY device output ifndef net, net==0 ; NET device output (i.e. a TELNET or SUPDUP) ife sty\net, sty==its ? net==1-sty ifndef tint, tint==its ; TTY interrupt driven ifndef sint, sint==its ; STY interrupt driven ifndef sibebug, sibebug==10x F=:0 ; AC of flags A=:1 ; A-E are used for arguments and return values. B=:2 ; In general these ACs are preserved across subroutine calls. C=:3 D=:4 E=:5 Z=:6 ; Random MOVCUR AC CP=:7 ; Cursor motion hack stack V=:10 ; "Actual" current vertical position H=:11 ; "Actual" current horizontal position VH==:V ; VH refers to the pair V,H NV=:12 ; "New" virtual positions NH=:13 ; "New" virtual positions NVH==:NV ; NVH refers to the pair NV,NH T1=:14 ; temporaries, not saved by UUOs, subroutines, or macros T2=:15 ; ... ; 16 unused! P=:17 ; PDL pointer .XCREF F,A,B,C,D,E,V,H,NV,NH,T1,T2,P ; ACs for .I/.F A0==:T1 A1==:T2 IFN ITS,{ ; I/O channel assignments. tyon==:2 ; Console terminal output during startup pbout==.iot tyon,a ; hack for reducing conditionals tyic==:3 ; Input from supported terminal tyoc==:4 ; Output to supported terminal (Superimage) ifn net, icpch==:5 ; ICP channel, PYI/PYO must be ICPCH+2/ICPCH+3 pyi==:7 ; Input from sty (some program outputting to TTY) pyo==:10 ; Output to sty (some program reading typein from TTY) dsko==:12 ; channel for various disk outputs. } ; IFN ITS ; F flag values, LH (see TRMFLG for RH values) ; These flags used for setting bucky-bit input. %imeta==400000 ; For input, metize next char %itop== 200000 ; topify next char %ictrl==100000 ; controlify %imtc==%imeta+%itop+%ictrl %ipesc== 40000 ; Indicate ESC key seen (preceding current) %ipesq== 20000 ; Indicates ESC-? (for VT terms) %ipcts== 10000 ; for ^S/^Q hacking by RPVT52 %clpnd== 4000 ; 1 => CLEOL pending %icm==: 2000 ; insert character mode IFN TNX, IF1 EXPUNGE DTI ifndef maxver,maxver==70. ; max value for vertical screen size (SHEIGHT) ifndef maxhor,maxhor==140. ; max value for horizontal screen size (SWIDTH) IFE ITS\.ITS,{ ;NOW COME THE BITS OF THE CHARACTER ITSELF: %TXTOP==:4000 ;"TOP" KEY. %TXSFL==:2000 ;"SHIFT-LOCK" KEY. %TXSFT==:1000 ;"SHIFT" KEY. %TXMTA==:400 ;"META" KEY. %TXCTL==:200 ;"CONTROL" KEY. %TXASC==:177 ;THE ASCII PART OF THE CHARACTER. %TNPRT==:0 ;PRINTING TTY. %TNDP==:1 ;TTY USES DATAPOINT CURSOR CTL CODES. %TNODP==:2 ;TTY IS A LOSING DATAPOINT. %TNIML==:3 ;TTY USES IMLAC CURSOR CODES. %TNTEK==:4 ;TEKTRONIX 4000 SERIES %TNTV==:5 ;TTY IS A KNIGHT TV DISPLAY. %TNMEM==:6 ;TTY IS A MEMOWRECK. %TNSFW==:7 ;"SOFTWARE" TTY THAT WANTS I.T.S. CURSOR-MOTION CODES. %TNTRM==:10 ;TTY IS A TERMINET. %TNESC==:11 ;TTY WANTS ASCII STANDARD ESCAPE SEQUENCES. (E.G. VT52) %TNDTM==:12 ;DATAMEDIA %TNMAX==:13 ;TTYOPT WORD DESCRIBES CHARACTERISTICS OF THE PARTICULAR ;TERMINAL ATTACHED TO EACH LINE. ;LEFT HALF BITS ARE: %TO==:1,,525252 ;BIT TYPEOUT MASK %TOALT==:200000 ;4.8 => STANDARDIZE ALTMODES. %TOCLC==:100000 ;4.7 => CONVERT LOWER CASE TO UPPER. %TOERS==:40000 ;4.6 => THIS TTY CAN SELECTIVELY ERASE. %TOHDX==:20000 ;4.5 => THIS TTY IS HALF-DUPLEX. $TOHDX==:370100 %TOMVB==:10000 ;4.4 => THIS TTY CAN BACKSPACE. %TOSAI==:4000 ;4.3 => THIS TTY HAS SAIL CHAR SET ON OUTPUT. %TOSA1==:2000 ;4.2 INIT %TSSAI OF NEW JOBS. %TOOVR==:1000 ;4.1 => THIS TTY CAN OVERPRINT SUCCESSFULLY. %TOMVU==:400 ;3.9 => THIS TTY CAN MOVE CURSOR UP (I.E. IT'S A DISPLAY). %TOMOR==:200 ;3.8 => DO **MORE** PROCESSING ON THIS TTY ;(ACTUALLY JUST USED TO INIT %TSMOR FOR NEW JOBS). %TOROL==:100 ;3.7 SIMILARLY, INIT %TSROL FOR NEW JOBS. %TORAW==:40 ;3.6 => SUPPRESS CURSOR MOTION OPTIMIZATION. %TOLWR==:20 ;3.5 => THIS TTY HAS LOWER CASE KEYBOARD. %TOFCI==:10 ;3.4 => KEYBOARD CAN GENERATE FULL 12-BIT CHARACTER SET %TOIML==:4 ;3.3 => SPACE, BS DON'T EQUAL ^PF, ^PB; ALSO ^PC SENDS ^L. %TOLID==:2 ;3.2 => %TDILP, %TDDLP WORK (INSERT AND DELETE LINES) %TOCID==:1 ;3.1 => %TDICP, %TDDCP WORK (INSERT AND DELETE CHARACTERS) ;RIGHT HALF: %TP==:707252 ;BIT TYPEOUT MASK %TPPLF==:100000 $TPPLF==:170300 ;3-BIT FIELD SAYING HOW TO PAD LF. ;0 - DON'T. 1 - MEMOWRECK, 2741. 2 - TERMINET. %TPPCR==:10000 $TPPCR==:140300 ;3-BIT FIELD SAYING HOW TO PAD CR. ;7 - UNUSED. 6 - MEMOWRECK. 5 - 2741. 4 - EXECUPORT. ;0 - DON'T. 1 - NORMAL. 2 - DOUBLE. ;ON DATAPOINTS, = # CHARS PADDING NEEDED FOR ALL CURSOR MOTION. ;4 IS RIGHT FOR 2400 BAUD; 3, FOR 1200. ;ON TERMINETS, 0 => NO PADDING, ELSE a,2,3,4,5 ;ARE PADDING FOR SPEEDS 10,15,30,60,120 CPS. %TPPCW==:6 ;FOR MEMO WRECK. %TPPTB==:1000 $TPPTB==:110300 ;3 BIT FIELD SAYING HOW MUCH PADDING NEEDED AFTER TAB. ;0 => TABS NOT ALLOWED; ELSE 1 +<# PADDING CHARS NEEDED> ;BUT ON A DISPLAY, TABS ARE NEVER PADDED AND THIS FIELD IS ;1 TO USE TABS, 2 TO USE ABSOLUTE CURSOR POSITIONING, ;3 TO USE BOTH, 0 TO USE NEITHER. %TPPRN==:200 ;1.8 => INTERCHANGE () WITH [] ON INPUT %TPTEL==:100 ;1.7 => HANDLE CR-LF ON INPUT AS CR, FOR TELNET PROTOCOL %TPCBS==:40 ;1.6 => ENABLE SPECIAL HANDLING OF CONTROL BACK SLASH ON INPUT ;(THE "INTELLIGENT TERMINAL PROTOCOL"). %TP11T==:20 ;1.5 => PDP-11 TV TTY. REFLECTS %TY11T. ;NOT SETTABLE BY USER. %TPORS==:10 ;1.4 => OUTPUT RESET ON THIS TTY SHOULD REALLY DO SOMETHING. %TPRSC==:4 ;1.3 => THIS TTY SUPPORTS %TDRSU, %TDRSD } ; IFE ITS\.ITS subttl Macros ; Make use of some winning macros. ifn its, .insrt syseng;$call macro %%%asc==:1 ; use winning ASCNT ifn .its, .insrt ksc;macros > ife .its, .insrt macros call=: ; saves typing return=: ;pjrst==:jrst ; CALL FOO ? RETURN paoja==:aoja ; ADDI AC,1 ? CALL FOO ? RETURN .xcref call,return,pjrst define movx #ac,con ife con򽸱, movei ac,con ? .stop ife con&777777, movsi ac,(con) ? .stop move ac,[con] termin IFNDEF KA,KA==1-20X IFN KA,{ IF1 { define dmove ac,m ac ? m termin equals dmovem,dmove equals fltr,dmove } ; IF1 IF2 { define dmove #ac,m ifn m&20000000, .err DMOVE macro can't hack indirection move ac,m move ac+1,m+1 termin define dmovem #ac,m ifn m&20000000, .err DMOVEM macro can't hack indirection movem ac,m movem ac+1,m+1 termin define fltr #ac,m move ac,m fsc ac,233 termin } ; IF2 } ; IFN KA IFN ITS,{ ; Use this output macro until have UUO or routine. define stro ch,&string& move t1,[440700,,[ascii string]] movx t2,.length string $call siot,[#ch,t1,t2] .lose %lsfil termin define say &string& stro tyon,string termin define saycr *string* stro tyon,string termin } ; IFN ITS IFN TNX,{ define say &string& hrroi a,[asciz string] psout termin define saycr *string* hrroi a,[asciz string ] psout termin } ; IFN TNX ; SLEEP - Macro to sleep tenths of a second. Clobbers A. IFN ITS,{ define sleep t movx a,t*3. .sleep a, termin } ; IFN ITS IFN TNX,{ define sleep t movx a,t*100. disms termin } ; IFN TNX IFN TNX, .lose=:haltf IFN 0,{ .defmac ivar ; tell @ that IVAR defines its argument .defmac mvar ; tell @ that MVAR defines its argument .defmac tvar ; tell @ that TVAR defines its argument .defmac svar ; tell @ that SVAR defines its argument } define inform a,b,c,d,e,f,g printx a!b!c!d!e!f!g  termin define section name $sect loc name define $sect name==. termin termin ; Start off with SECTION MAINVAR. define $sect mainvar==. termin init==26000 ; leave 11K for variables and screen image initvar==34000 ; leave 2K for initialization section main==36000 ; leave 1K for initialization variable section fipg==:init/pg$siz fivpg==:initvar/pg$siz fmpg==:main/pg$siz IFN 0,{ define mvar v1,v2,v3,v4 irp v,,[v1,v2,v3,v4] irps s,c,[v] s=:mainvar ifse [c][] mainvar==mainvar+1 ? .istop irpnc <.length "s">+1,<.length "v">-<.length "s">-2,1,l,,[v] mainvar==mainvar+ termin .istop termin termin termin } .ELSE { equals mvar,.scalar ; .SCALAR is presumably faster, so use it in ; place of MVAR since it occurs most often } define ivar v1,v2,v3,v4 irp v,,[v1,v2,v3,v4] irps s,c,[v] s=:initvar ifse [c][] initvar==initvar+1 ? .istop irpnc <.length "s">+1,<.length "v">-<.length "s">-2,1,l,,[v] initvar==initvar+ termin .istop termin termin termin equals tvar,mvar equals svar,mvar subttl Part I - Initialization subttl Start up patch: pat: block 40 ; patch area debug: 0 ; set positive for any runtime debug switching SECTION INIT IFN ITS,{ ; Use PURIFYG to purify CRTSTY before dumping. purify: move a,[,,sipg] ; flush screen image pages $call corblk,[#0,#%jself,a] ; ... .lose %lssys move a,[-,,fipg] ; purify INIT pages $call corblk,[#%cbndr,#%jself,a] .lose %lssys move a,[-,,fmpg] ; purify MAIN pages $call corblk,[#%cbndr,#%jself,a] .lose %lssys .value [asciz ": Purified, now dump... :PDUMP DSK:SYSBIN;CRTSTY BIN"] } ; IFN ITS IFN TNX,{ purtab: -sipg,,ss%cpy\ss%rd\ss%exe\0 ; MAINVAR pages -,,ss%rd\ss%exe\fipg ; INIT pages -,,ss%cpy\ss%rd\ss%exe\fivpg ; INITVAR pages -,,ss%rd\ss%exe\fmpg ; MAIN pages -<512.->,,ss%rd\ ; symbol table pages 0 purify: move p,[-lpdl,,pdl-1] ; set PDL pointer so can use error UUO movei a,.fhslf ; SEVEC arg: A = process handle move b,[1,,crtsty] ; SEVEC arg: B = length,,address sevec ; set entry vector move a,[gj%sht+.fvers] ; GTJFN arg: A = bits,,default version IFE STY,{ ifn 20x, hrroi b,[asciz "CRTSTY.EXE"] ifn 10x, hrroi b,[asciz "CRTSTY.SAV"] } IFN STY,{ ifn 20x, hrroi b,[asciz "PCRTSTY.EXE"] ifn 10x, hrroi b,[asciz "PCRTSTY.SAV"] } ; GTJFN arg: B = filename gtjfn ; get JFN to CRTSTY save file jerr1 [asciz "Unable to assign JFN - "] hrli a,.fhslf ; SSAVE arg: A = fork handle,,JFN movei b,purtab ; SSAVE arg: B = table address movei c,0 ; SSAVE arg: C = flag bits ssave ; dump ourself haltf } ; IFN TNX lpdl==100 ; Length of PDL mvar pdl(lpdl) ; PDL ; CRTSTY starts here. crtsty: move p,[-lpdl,,pdl-1] ; initialize PDL pointer movei f,0 ; initialize flags call osinit ; operating system dependent initialization call commnd ; parse command line to get terminal type, ; TTY no., etc. jrst logout ; error in command line call ttyini ; open TTY, initialize some options call commnd ; parse command line again, this time ; for rest of options jrst logout ; error in command line call ttyoin ; TTY output initialization skipe jvtsw ; VT specified? jrst [ call vtsu ; see if can identify terminal type jrst logout jrst .+1 ] skipn trmadr ; Now identified a terminal? jrst [ say "No terminal type specified! " call badtrm jrst logout ] call setup3 ; random initialization call scrini ; initialize screen image call styini ; open STY IFN NET,{ call netini } call smoini ; initialize simulator output co-routine jrst setup7 subttl Operating system initialization IFN ITS,{ osinit: move a,[-lipdl,,ipdl-1] ; initialize interrupt PDL movem a,intpdp ; ... setzm iocvec ; no IOC error handler yet move a,[-24.,,[ .roption ? tlo %opint+%opopc ; turn on new style ints .roption ? movem option .rmask ? movei %piioc ; enable interrupts .rmsk2 ? movei 0 ; ... .rdf1 ? movei 0 ; and set defer words .rdf2 ? movei 0 ; ... .rcnsl ? movem cnsl ; get console TTY no. .runame ? movem uname .rjname ? movem jname .ruind ? movem uind .rxuname ? movem xuname .rxjname ? movem xjname ]] $call usrvar,[#%jself,a] .lose %lssys .i ttynum=cnsl ; default TTY supported to our console $call open,[#tyon,[sixbit/tty/]][][#.uao] .lose %lsfil ; Normal unit output to TTY hlrz a,uname ; get LH of uname cain a,-1 ; not logged in? jrst [ saycr "You must log in to use CRTSTY" jrst logout] move e,xjname ; JRTR6F arg: sixbit name call jrtr6f ; is XJNAME some terminal name? setz a, ; No, so zap... hrrzm a,trmadr ; yes, set terminal to use. move a,option ; get OPTION variable tlnn a,%opcmd ; command for us? jrst [ skipe trmadr ; No, barf unless terminal selected by xjname. jrst .+1 saycr "Usage is :CRTSTY . Do :CRTSTY ? for help." jrst logout] move a,[cmd,,cmd+1] ; clear command line buffer setzm cmd ; ... blt a,cmd+/5-2 ; ... movsi a,(ascii " ") ; put CR at end of command line buffer movem a,cmd+/5-1 ; ... .break 12,[5,,cmd] ; get command line from superior call wrtlog ; Write log file entry with cmd line. move b,[squoze 0,%TDMAX] ; Find highest software code .eval b, .lose %lssys caile b,%tdmax ; see if system has same ideas we do. jrst [ saycr "Warning: Some display codes may not work. Send mail to BUG-CRTSTY@MC about this!" jrst .+1] move a,[squoze 0,LUBLK] ; find length of a user-var block .eval a, .lose %lssys movem a,lublk imul a,uind ; find position from start of user-var storage movem a,myuind ; save in case later need movei a,syspg movem a,syspno move a,[squoze 0,TIME] movei b,0 call itsmap movem a,time move a,[squoze 0,APRC] move b,myuind call itsmap movem a,aprc move a,[squoze 0,SUPPRO] move b,myuind call itsmap movem a,suppro return } ; IFN ITS IFN TNX,{ osinit: reset ; initialize system's data for this fork ; (this does an automatic CIS so that's not ; needed below) movei a,.fhslf ; RPCAP arg: fork handle rpcap ; read our capabilities ; results: B = possible capabilities, ; C = enabled capabilities tlo c,(sc%ctc\sc%gtb) ; turn on control-C intercept and epcap ; GETAB capabilities gjinf ; get job specific information movem a,ldir ; directory no. logged in under movem d,cnsl ; GJINF val: terminal no. associated with ; this job (or -1 if detached) setom ttynum ; default to using TTY: instead of TTYnnn: move t1,[chntab,,chntab+1] ; zero channel table setzm chntab ; ... blt t1,chntab+35. ; ... movei a,.fhslf ; SIR arg: process handle move b,[levtab,,chntab] ; SIR arg: level table,,channel table sir ; set channel and level table addresses eir ; enable interrupt system setzm siiset ; no superimage input yet ; Get command line. IFN 20X,{ movei a,0 ; RSCAN arg: 0 to read last string rscan ; put command line in input buffer jerr1 [asciz "Error reading command line - "] movn c,a ; skip over 1st word of command line os1: aojge c,os9 ; nothing more to read? pbin ; get next character cain a,^J ; LF? jrst os9 ; yes, no real command line caie a,40 ; space? jrst os1 ; no, keep going movei a,.priin ; SIN arg: A = source designator move b,[440700,,cmd] ; SIN arg: B = B.P. ; SIN arg: C = -count sin ; read command line into command buffer movei a,^M ; replace LF at end of string with CR dpb a,b ; ... } ; IFN 20X IFN 10X,{ movei a,.priin ; BKJFN arg: A = JFN bkjfn ; backup one character in input stream jrst os0 ; can't, oh well pbin ; get last character typed cain a,37 ; CR? jrst os9 ; yes, no command line os0: move b,[10700,,cmd-1] ; byte pointer to command line buffer os1: pbin ; get next character cain a,37 ; CR? jrst os2 ; yes, we're done cain a,177 ; RUBOUT? jrst [ camn b,[10700,,cmd-1] ; yes, nothing to rubout? jrst [ movei a,^G ; nothing, PBOUT arg: character pbout ; feep at user jrst os1 ] ; keep reading ldb a,b ; get character rubbed out pbout ; echo it back add b,[70000,,0] ; decrement byte pointer jumpge b,os1 ; ... sub b,[430000,,1] ; ... jrst os1 ] ; keep reading idpb a,b ; put character into command line buffer jrst os1 ; keep reading os2: movei a,^M ; deposit an actual CR, instead of 37 idpb a,b ; ... } ; IFN 10X IFN STY,{ move a,[sixbit/ptypar/] ; SYSGT arg: SIXBIT table name sysgt ; get PTY information ; results: A = first word of table, ; B = table no. jumpe b,[ ; no PTYPAR table? saycr "System lacks PTYs" jrst logout ] hlrzm a,syspty ; no. of PTYs in system hrrzm a,firpty ; TTY no. of first PTY } ; IFN STY IFN NET,{ setzm lskt ; local relative socket no. } return os9: saycr "Usage is CRTSTY . Do CRTSTY ? for help." jrst logout } ; IFN TNX subttl Output entry to CRTSTY log file IFN ITS,{ wrtlog: movei a,logint ; where to go if we get an IOC error movem a,iocvec sretry: syscal open,[ %clbit,,100000\.uao ? %climm,,dsko [sixbit /DSK/] [sixbit /CRTSTY/] ? [sixbit /LOG/] ? [sixbit /CRASH/] %clerr,,a] ; get the error code jrst [ cain a,%enafl ; file locked? jrst [ movei a,5 ; sleep a bit .sleep a, jrst sretry ] ; and try again caie a,%ensfl ; file not found? $call lose,[#%lsfil,#sretry] ; unknown error, hassle syscal open,[ %clbit,,.uao ? %climm,,dsko ? [sixbit /DSK/] [sixbit /CRTSTY/] ? [sixbit /LOG/] [sixbit /CRASH/]] .lose %lsfil jrst .+1] $call fillen,[#dsko][a] ; find end of file .lose %lsfil $call access,[#dsko,a] ; and start there .lose %lsfil .rdatim a, ; get date and time move e,b ; hack the date first rot e,12. ; make MMDDYY movei b,"/ ; separate by /'s call timprt ; print the time .iot dsko,[40] ; separate by a space move e,a ; hack the time now movei b,": ; separate by :'s call timprt ; print it .iot dsko,[40] ; space again move a,uind ; get job no. caige a,100 .iot dsko,[40] caige a,10 .iot dsko,[40] call numout .iot dsko,[40] move e,[.fnam1] call sixout ; output FN1 if strange. .iot dsko,[40] move e,[.fnam2] call sixout .iot dsko,[40] move e,xuname call sixout ; print it .iot dsko,[40] $call stlget,[#tyon][a,e] ; get the host caia jumpn e,log1 move a,cnsl ; get terminal no. lshc a,-3 ; convert to sixbit lsh a,3 ; ... lshc a,3 ; ... movsi e,'T00(a) ; convert to device name log1: call sixout ; print it .iot dsko,[40] .iot dsko,[40] move a,[440700,,cmd] ; BP to the command buffer logcmd: ildb b,a ; get a char caie b,^M ; end of line? cain b,^C ; Another form of end of line jrst logcls ; yes, close up the line caie b,^_ ; still another form of end of the line cain b,0 ; yet another jrst logcls ; so close up the line .iot dsko,b ; no, output it jrst logcmd ; and do another logcls: .iot dsko,[^M] ; new line .iot dsko,[^J] logint: .close dsko, setzm iocvec ; remove IOC error handler return numout: push p,b idivi a,10 caile a,0 call numout addi b,"0 .iot dsko,b pop p,b return sixout: movei b,6 call prtdig ; print a character sojg b,.-1 return ; SIXDO - output sixbit in E cleverly to disk; always outputs ; at least one char (a blank if word 0). sixdo: movei d,0 lshc d,6 addi d,40 .iot dsko,d jumpn e,sixdo return timprt: call prt2dg ; print two digits .iot dsko,b ; and the delimiter call prt2dg ; print two more digits .iot dsko,b ; and the delimiter pjrst prt2dg ; and the final portion prt2dg: call prtdig prtdig: movei d,0 lshc d,6 addi d,40 .iot dsko,d return } ; IFN ITS subttl Command line processing lcmd==:120. ; length of command line buffer ivar cmd(/5) ; command line buffer ltoken==:20. ; option buffer length ivar token(/5) ; option buffer commnd: move a,[440700,,cmd] ; initialize pointer to the command buffer movem a,cmdp hllz f,f ; Clear terminal flags. cloop: skipa a,[1] ; Set yes/no state to YES. clpno: movns a ; come here to reverse state. call jclf ; pick up next token jrst popj1 ; EOF, return2 from COMMND for winnage move d,token ; get 1st word of token camn d,[asciz /NO/] ; requesting opposite state? jrst clpno ; Yes, negate state & get next field. movsi b,-njopts cl1: move c,jcoptb(b) ; Find match - get addr of name came d,(c) ; Match? jrst cl7 ; nope, try another hlrz c,c call (c) ; Execute matching rtn. return ; return1 from COMMND to indicate error jrst cloop ; Continue loop cl7: aobjn b,cl1 ; Drop thru if fail to match... move e,[440700,,token] ; didn't match a JCL opt, try as terminal. call jrtrmf ; Check out. jrst bad skipe b,trmadr ; won, but was something already spec'd? cain b,(c) caia ; No, or specifying same thing, OK. jrst [saycr "Terminal already specified!" return] hrrzm c,trmadr ; first spec of terminal. jrst cloop ; Continue if won... IFN ITS,{ bad: .iot tyon,[""] move a,tokp move b,tokl $call siot,[#tyon,a,b] .lose %lsfil } ; IFN ITS IFN TNX,{ bad: movei a,"" pbout move a,tokp psout } ; IFN TNX saycr |" is not a valid terminal name or option. | help: skiple trmadr ; if he specified a good terminal, jrst lstopt ; don't list them say "Usage is :CRTSTY Terminals are:" call jtrmls say " " lstopt: say "Options are: ; Terminal description: HEIGHT , WIDTH , SPEED , ISPEED , OSPEED , NO ABS, NO TABS, NO BELL, NO CLEOL, NO CLEOS, NO LID, NO CID, SCRLCOUNT ; ITS options (same meaning as with TCTYP): GLASS, SAIL, SCROLL ; CRTSTY options: [NO] INVERSE, VISBEL, WHOLINE, ALARM , [NO] SMEOL, STEOS, NO LOGIN, LOGIN , NO WARN, SOFTOK, SLAVE, NO SII, NO ATTACH, DEBUG, BUFFER , TTY , SIMULATE " IFN NET,{ say ", HOST " } say " " return badtrm: say "Terminal id may be one of:" pjrst jtrmls subttl JCL option routines & dispatch table comment | JCL options are defined very easily; for example, to define an option FOO, we just put in jcopt /FOO/,