;*************************************************************************** ;* * ;* ZTERM for Windows TERMINAL DRIVER * ;* Copyright 1997 Rod Hewitt * ;* * ;*************************************************************************** ; ;IMPORTANT. This license agreement supersedes any other license agreement ;provided with the software. ; ;Read this License Agreement before installing this software. By installing ;this software, you indicate your acceptance of this License Agreement. ; ;COOL.STF LICENSE AGREEMENT ;COOL.STF ZTERM for Windows Terminal Driver 1.2 ; ;1. LICENSE RIGHTS AND RESTRICTIONS. ; ;COOL.STF grants to you the non-exclusive, non-assignable right to use this ;product in object code form (the "ZTERM Code") on a single computer system. ;You may only use the ZTERM code in conjuction with ZTERM for Windows or ;related COOL.STF products. All rights not expressly granted are reserved by ;COOL.STF. ; ;2. PRELIMINARY CODE. ; ;The ZTERM Code provided herein is beta code and not at the level of ;functionality, performance and compatibility of the final, generally available ;product offering. The code may be substantially modified prior to first ;commercial shipment. ; ;3. NO WARRANTIES. ; ;The ZTERM Code and accompanying written materials are provided "as is", ;without warranty of any kind. To the maximum extent permitted by law, ;COOL.STF disclaims all warranties, either express or implied, including but ;not limited to implied warranties of merchantability, fitness for a particular ;purpose and noninfringment. The entire risk arising out of the use or ;performance of the ZTERM Code and any accompanying written materials remains ;with you. ; ;4. NO LIABILITY FOR CONSEQUENTIAL DAMAGES. ; ;To the maximum extent permitted by applicable law: in no event shall COOL.STF ;or its suppliers be liable for any damages whatsoever (including, without ;limitation, damages for loss of business profits, business interruption, loss ;of business information, or other pecuniary loss) arising out of the use of or ;inability to use the ZTERM Code, even if COOL.STF has been advised of the ;possibility of such damages. Because some states/jurisdictions do not allow ;the exclusion or limitation of liability for consequential or incidental ;damages, the above limitation may not apply to you. ; ;5. MISCELLANEOUS. ; ;If you acquired this product in the United States, this Agreement is governed ;by the laws of the State of Maryland. If you acquired this product outside ;the United States, local law may apply. If either party employs attorneys to ;enforce any rights arising out of or relating to this Agreement, the ;prevailing party shall be entitled to recover reasonable attorneys fees, costs ;and expenses. ;[101] January 31, 1997 02:40 PM Edited by Rod Hewitt ; Added support for the AM62A emulation in ZTERM for Windows ;[100] January 26, 1997 12:47 AM Edited by Rod Hewitt ; Created with credits to the millions of others who have written ; terminal drivers, especially Dave Canfield at Alpha Micro who ; finally made TRMDEF work at the right speed!! SEARCH SYS SEARCH SYSSYM SEARCH TRM VMAJOR = 1 VMINOR = 2 VEDIT = 101. ;Assemble: M68 ZTERM/V:1 To get ZTERM.TDV, 7-bit ; M68 ZTERM/V:2 To get ZTERMX.TDV, 8-bit ; M68 ZTERM/V:3 To get ZT62A.TDV, 7-bit ; M68 ZTERM/V:4 To get ZT62AX.TDV, 8-bit NVALU SWITCH IF EQ, SWITCH-1 OBJNAM ZTERM.TDV COLOR = 1 EXTCHR = 0 ; 7-bit mode color ASMMSG /== Assembling 7-bit ZTERM for Windows AM62C driver ==/ ENDC IF EQ, SWITCH-2 OBJNAM ZTERMX.TDV COLOR = 1 EXTCHR = 1 ; 8-bit mode color ASMMSG /== Assembling 8-bit ZTERM for Windows AM62C driver ==/ ENDC IF EQ, SWITCH-3 OBJNAM ZT62A.TDV COLOR = 0 EXTCHR = 0 ; 7-bit mode mono ASMMSG /== Assembling 7-bit ZTERM for Windows AM62A driver ==/ ENDC IF EQ, SWITCH-4 OBJNAM ZT62AX.TDV COLOR = 0 EXTCHR = 1 ; 8-bit mode mono ASMMSG /== Assembling 8-bit ZTERM for Windows AM62A driver ==/ ENDC IF EQ, SWITCH ASMERP "Improper option selection" ASMMSG " " ASMMSG "To assemble ZTERM for Windows drivers, specify one" ASMERP "of the following options:" ASMMSG " " ASMMSG "M68 ZTERM/V:1 to get ZTERM.TDV (7-bit color)" ASMMSG "M68 ZTERM/V:2 to get ZTERMX.TDV (8-bit color)" ASMMSG "M68 ZTERM/V:3 to get ZT62A.TDV (7-bit mono)" ASMMSG "M68 ZTERM/V:4 to get ZT62AX.TDV (8-bit mono)" ASMMSG " " ENDC PAGE ;**************** ;* CAPABILITY * ;**************** ;Define capability flags TDVFLG=TD$LID ; line insert/delete TDVFLG=TDVFLG!TD$CID ; character insert/delete TDVFLG=TDVFLG!TD$RVA ; reverse video TDVFLG=TDVFLG!TD$DIM ; dim TDVFLG=TDVFLG!TD$BLN ; blink TDVFLG=TDVFLG!TD$UND ; underline TDVFLG=TDVFLG!TD$EOS ; erase to end of screen TDVFLG=TDVFLG!TD$EOL ; erase to end of line TDVFLG=TDVFLG!TD$MLT ; multi-key translation TDVFLG=TDVFLG!TD$SPL ; split screen TDVFLG=TDVFLG!TD$STS ; status line TDVFLG=TDVFLG!TD$AMS ; an AlphaTERMINAL TDVFLG=TDVFLG!TD$KID ; column insert/delete TDVFLG=TDVFLG!TD$PRT ; printer support TDVFLG=TDVFLG!TD$132 ; 132 columns TDVFLG=TDVFLG!TD$BOX ; box drawing commands TDVFLG=TDVFLG!TD$BLF ; block fill IF NE,COLOR, TDVFLG=TDVFLG!TD$CLR ; color capability IF NE,EXTCHR,TDVFLG=TDVFLG!TD$EXT ; 8-bit character support ;Define default color DEFCLR = 6. ; set default color to green ;******************** ;* ZTERM * ;******************** ;Terminal driver communications area ZTERM: WORD TD$NEW!TD$TCH ; terminal attributes BR JMPINP ; input routine RTN ; output routine BR ECHO ; echo routine BR JMPCRT ; crt control BR JMPINI ; INIT routine WORD 8. ; impure area of 8 bytes ROWCNT: BYTE 24. ; number of rows BYTE 80. ; number of columns LWORD TDVFLG ; terminal flags BR JMPTCH ; entry for TRMCHR JMPINP: JMP INP ; go handle input characters JMPCRT: JMP CRT ; go handle TCRT codes JMPINI: JMP INI ; go handle initialization JMPTCH: JMP TCH ; go handle TRMCHR call PAGE ;******************** ;* ECHO * ;******************** ;Special echo processing is performed here ;Rubouts will backspace and erase the previous character ;Control-U will erase the entire line by backspacing and erasing ECHO: CMPB D1,#25 ; control-U BEQ CTRLU CMPB D1,#177 ; rubout BNE ECHX ;Rubouts are handled by the old backspace-and-erase game ;Special handling must be performed if we are rubbing out a tab ;D6 contains the character being rubbed out RUBOUT: CMPB D6,#11 ; was it a tab? BEQ RBTB ; yes - CMPB D6,#40 ; no - was it a control char? BLO RBX ; yes - ;Rubout was of a printable character - queue up the backspace sequence KRTG: MOV #3,D3 ; set character count LEA A6,ERUB ; set buffer address MOV A6,D1 ; into D1 TRMBFQ ; queue the backspace sequence RBX: RTN ERUB: BYTE 10,40,10,0 ;Rubout was of a tab - we must calculate how big the tab was and backup over it RBTB: CLR D3 ; preclear D3 MOVW T.POB(A5),D3 ; set beginning position count MOV T.ICC(A5),D2 ; set input character count MOV T.IBF(A5),A6 ; set input buffer base KRTS: DEC D2 ; done with scan? BMI KRTQ ; yes - MOVB (A6)+,D1 ; scan forward calculating position CMPB D1,#11 ; tab - BEQ KRTT CMPB D1,#15 ; carriage return - BEQ KRTC CMPB D1,#33 ; escape - BEQ KRTI CMPB D1,#40 ; control-char - BLO KRTS CMPB D1,#172 BHI KRTS KRTI: INC D3 ; increment position for one character BR KRTS KRTT: ADD #10,D3 ; adjust position for tab AND #^C7,D3 BR KRTS KRTC: CLR D3 ; clear position for cr BR KRTS KRTQ: COM D3 ; calculate necessary backspaces AND #7,D3 INC D3 MOV #10,D1 ; set immediate backspace character TRMBFQ ; queue the backspaces ECHX: RTN ;Echo a control-U by erasing the entire line CTRLU: TST D6 ; no action if nothing to erase BEQ CTUX CLR D3 ; preclear D3 MOVW T.POO(A5),D3 ; calculate backspace number to erase line SUBW T.POB(A5),D3 BEQ ECHX CMP D3,T.ILS(A5) ; insure not greater than terminal width BLOS CLUA MOV T.ILS(A5),D3 CLUA: MOV #10,D1 ; queue up backspaces TRMBFQ ASL D1,#2 ; queue up spaces TRMBFQ MOV #10,D1 ; queue up backspaces TRMBFQ CTUX: RTN PAGE IF EQ, EXTCHR ;*************** ;* 7-BIT INP * ;*************** ;Input character processing subroutine ;Return a negative flag to indicate possible multi-byte key codes ;Detect a negative flag which indicates the multi-byte processing return INP: BMI INMLT ; skip if multi-byte processing CMPB D1,#1 ; function code? BEQ INPM ; yes - could be multi-byte sequence CMPB D1,#33 ; escape? BEQ INPM ; yes - could be multi-byte sequence LCC #0 ; no - normal processing RTN INPM: LCC #PS.N ; possible multi-byte - return N flag RTN ;Multi-byte processing is done here ;This occurs when TRMSER has accumulated all bytes of a multi-byte keystroke ;D0 contains the character count and A0 indexes the data string ;A5 indexes the terminal definition block and must be preserved ;The translated character must be returned in D1 for storage ;This routine may destroy only A0,A3,A6,D0,D6,D7 INMLT: MOVB (A0)+,D1 ; get the first character DECB D0 ; no translation if single character BEQ INMX CMPB D1,#1 ; function sequences start with SOH BEQ INMF ; function sequence - ;Escape sequences are translated directly by setting bit 7 on ;This will cause them to map to 240-377 MOVB (A0)+,D1 ; get the second character INMG: ORB #200,D1 ; set bit 7 on BIT #T$XLT,@A5 ; are we doing translation? BEQ INMNOT ; no - check for another translation INMX: LCC #0 ; reset the flags INMX2: RTN ;Function codes require additional translation so that they become 200-237 INMF: MOVB (A0)+,D1 ; get the second character SUBB #'@,D1 ; offset so that F1 becomes 0 BR INMG ; and go finish up ;Come here if program is not doing translation and we must do our own INMNOT: LEA A6,XLTTBL ; index the translation table 10$: MOVB (A6)+,D7 ; get character BEQ INMX2 ; end of table - ignore the character CMPB D1,D7 ; is it in the table? BEQ 20$ ; yes - INC A6 ; no - bypass translation BR 10$ ; loop for more - ;Come here to translate the character 20$: MOVB @A6,D1 ; translate the character BR INMX ENDC IF NE, EXTCHR ;*************** ;* 8-BIT INP * ;*************** ;Input character processing subroutine ;If we get a CSI (233 octal) we set a special flag so that we will return ;the next byte. INP: MOVW T.STS(A5),D6 ; get flags BTST #T%NFK,D6 ; are we suppressing all xlation? BNE 99$ ; yes - just pass char through MOV T.IMP(A5),A6 ; index impure space TSTW 4(A6) ; are we processing function key? BNE 30$ ; yes - CMPB D1,#233 ; CSI (function key leadin)? BNE 99$ ; no - SETB 4(A6) ; yes - set flag for next time BTST #T%XLT,D6 ; is program doing own translation? BEQ 20$ ; no - ignore CSI BTST #T%EXT,D6 ; is program in extended mode? BNE 99$ ; yes - send the CSI 20$: CLR D7 ; set flag to ignore this character RTN ; and return to TRMSER ;We had a CSI last time - this byte is the function code itself 30$: CLRW 4(A6) ; clear the leadin flag BIT #T$XLT,@A5 ; are we doing translation? BEQ 100$ ; no - check for another translation TSTB D1 ; funct key input? BMI 99$ ; no - use byte as is SUBB #'@,D1 ; yes - create offset ORB #200,D1 ; and set flag byte ;Return to TRMSER, using character in D1 99$: MOV #1,D7 ; normal processing of character RTN ;Come here if program is not doing translation and we must do our own 100$: LEA A6,XLTTBL ; index the translation table 110$: MOVB (A6)+,D7 ; get character BEQ 20$ ; end of table - ignore the character CMPB D1,D7 ; is it in the table? BEQ 120$ ; yes - INC A6 ; no - bypass translation BR 110$ ; loop for more - ;Come here to translate the character 120$: MOVB @A6,D1 ; translate the character BR 99$ ENDC ;Translation table XLTTBL: BYTE 314,3 ; CANCEL = Control-C BYTE 302,3 ; SHIFT + CANCEL = Control-C BYTE 274,15 ; EXECUTE = Return BYTE 276,15 ; SHIFT + EXECUTE = Return BYTE 313,'U-100 ; DEL LINE = Control-U BYTE 000,000 PAGE ;******************** ;* INI * ;******************** ;Handle initialization of the terminal INI: MOV T.IDV(A5),A6 ; index the interface driver CMP -(A6),#<[PSE]_16.>+[UDO]; is it the pseudo interface driver? JEQ INI2 ; yes - no initialization wanted CMP QFREE,#12. ; are there at least 12 queue blocks? JLO INI2 ; no - skip the initialization SAVE D1,D2 ; save registers MOV #FST1, D3 ; get size of first command LEA A6,FSTSTR ; index the first init string MOV A6,D1 TRMBFQ MOV SYSTEM,D1 ; BTST #SY%UP,D1 ; booting up ? BNE 100$ ; no - branch MOV TRMDFC,A6 ; ADDW #8.,A6 ; CMP A5,A6 ; are we the boot job ? BEQ 100$ ; yes-branch, don't mess up banner QGET A6 ; CLR (A6) ; MOV #2500.,4(A6) ; use a timer routine to finish PEA TMRCOD ; terminal initialization POP 8.(A6) ; MOV A5,12.(A6) ; set TDV pointer for interrupt handler TIMER (A6) ; REST D1,D2 ; RTN ; 100$: SLEEP #2500. ; wait for reset to complete INI1: MOV #INIS1,D3 ; get size of string to send LEA A6,INISTR ; index the string MOV A6,D1 TRMBFQ ; output the string MOV #74,D3 ; assume 74 spaces MOV SYSTEM,D7 ; get system flags AND #SY$UP,D7 ; are we up and running? BNE 4$ ; yep, no need to scare 'em MOV #INIS1B,D3 ; get size of string to send LEA A6,SYSBOT ; index string MOV A6,D1 TRMBFQ ; and send it MOV #40.,D3 ; output 40 spaces 4$: MOV #40,D1 TRMBFQ MOV #INIS2,D3 ; get size of string to send LEA A6,INIST2 ; index the string MOV A6,D1 TRMBFQ ; output the string BCALL INI3 ; output 78 spaces MOV #4,D3 ; get size of string to send LEA A6,INIST3 ; index the string MOV A6,D1 TRMBFQ ; output the string BCALL INI3 ; output 78 spaces MOV #1,D3 ; output one rubout MOV #177,D1 TRMBFQ REST D1,D2 ; restore registers INI2: MOV T.IMP(A5),A6 ; index impure area MOVW #80.,@A6 ; preset to 80 columns MOVW #24.,2(A6) ; and 24 rows CLRW 4(A6) ; initialize function key flag MOVB #DEFCLR,6(A6) ; default to default color MOVB #0,7(A6) ; on black RTN INI3: MOV #78.,D3 ; output 78 spaces MOV #40,D1 TRMBFQ RTN FSTSTR: IF NE, COLOR BYTE 33,'g,'!+DEFCLR,'! ; default color on black ENDC BYTE 33,'`,': ; reset to 80 column format BYTE 33,'x,'0 ; reset to normal screen format FST1=.-FSTSTR INISTR: BYTE 33,'A,'2,': ; set top line attributes BYTE 33,'F,40 ; send message to top line INIS1=.-INISTR SYSBOT: ASCII /System booting - please wait . . ./ INIS1B=.-SYSBOT INIST2: BYTE 177 BYTE 33,'A,'2,': ; set top line attributes BYTE 33,43 ; lock the keyboard BYTE 33,'z,'! ; clear unshifted status line INIS2=.-INIST2 INIST3: BYTE 177 BYTE 33,'Z,'! ; clear the shifted status line EVEN TMRCOD: SAVE D3,A5 ; PEA 10$ ; set "return" address SAVE D1,D2 ; MOV (A0),A5 ; get back port's TCB pointer JMP INI1 ; finish sending terminal initialization ; strings 10$: REST D3,A5 ; SUB #^H0C,A0 ; get queue block base address QRET A0 ; and give it back to system RTN ; PAGE ;******************** ;* TCH * ;******************** ;Handle TRMCHR call ;A1 points to argument block, A2 indexes this TDV, D2 contains flags ;Can only use A1,A2,A6,D1,D2,D6,D7 TCH: MOV TD.FLG(A2),TC.FLG(A1) ; transfer flags MOV JOBCUR,A6 ; index job MOV JOBTRM(A6),A6 ; index terminal control area MOV T.IMP(A6),A6 ; index impure area CLR D6 ; preclear register MOVB 2(A6),D6 ; get row count MOVW D6,TC.ROW(A1) ; transfer row count MOVB @A6,D6 ; get column count MOVW D6,TC.COL(A1) ; transfer column count IF NE, COLOR MOVB 6(A6),D6 ; get foreground color MOVW D6,TC.FGC(A1) MOVB 7(A6),D6 ; get background color MOVW D6,TC.BGC(A1) MOVW #64.,TC.CLR(A1) ; 64 colors ENDC IF EQ, COLOR CLRW TC.CLR(A1) ; no colors ENDC MOVW TC.COL(A1),D6 ; get total width of terminal MOVW D6,TC.SSL(A1) ; set length of shifted status line MOVW D6,TC.USL(A1) ; set length of unshifted status line SUBW #13.,D6 ; adjust for labels MOVW D6,TC.TSL(A1) ; set length of top status line MOVW #1820.,TC.SVA(A1) ; set number of saved characters MOV D2,D7 ; get TRMCHR argument flags AND #TC$BMP,D7 ; does user want bitmap? BEQ 20$ ; no - skip bitmap transfer code ;User has requested bitmap -- return it to him PUSH A1 ; save argument block index ADDW #TC.BMP,A1 ; index bitmap return area LEA A6,TCHBMP ; index our bitmap MOV #<256./16.>-1,D7 ; get amount to transfer 10$: MOVW (A6)+,(A1)+ ; transfer to user DBF D7,10$ ; loop until done POP A1 ; restore register 20$: RTN ; return to TRMCHR monitor routine ;Define feature bitmap TCHBMP: BYTE ^B11111111 ; 0 - 7 BYTE ^B11111111 ; 8 - 15 BYTE ^B11111111 ; 16 - 23 BYTE ^B11111001 ; 24 - 31 (no horiz or vert pos) BYTE ^B11111111 ; 32 - 39 BYTE ^B11111111 ; 40 - 47 BYTE ^B11111111 ; 48 - 55 BYTE ^B11100011 ; 56 - 63 (no vertical split) BYTE ^B11111111 ; 64 - 71 BYTE ^B11111111 ; 72 - 79 BYTE ^B00001111 ; 80 - 87 (no alternate page) BYTE ^B01111111 ; 88 - 95 BYTE ^B11110000 ; 96 - 103 BYTE ^B00000011 ; 104 - 111 (no non-space attributes) BYTE ^B00000000 ; 112 - 119 (no non-space attributes) BYTE ^B00001111 ; 120 - 127 (spare) IF NE, COLOR BYTE ^B11111111 ; 128 - 135 (AM-70 style color) BYTE ^B11111111 ; 136 - 143 BYTE ^B00111111 ; 144 - 151 ENDC IF EQ, COLOR BYTE ^B00001111 ; 128 - 135 (AM-70 style color) BYTE ^B00000000 ; 136 - 143 BYTE ^B00110000 ; 144 - 151 ENDC BYTE ^B11000111 ; 152 - 159 BYTE ^B00000010 ; 160 - 167 BYTE ^B01100000 ; 168 - 175 BYTE ^B00000000 ; 176 - 183 BYTE ^B00000000 ; 184 - 191 BYTE ^B00000000 ; 192 - 199 BYTE ^B00000000 ; 200 - 207 BYTE ^B00000000 ; 208 - 215 BYTE ^B00000000 ; 216 - 223 BYTE ^B00000000 ; 224 - 231 BYTE ^B00000000 ; 232 - 239 BYTE ^B00000000 ; 240 - 247 BYTE ^B00000000 ; 248 - 255 PAGE ;******************** ;* CRT * ;******************** ;Special CRT control processing ;D1 contains the control code for x,y positioning or special commands ;If D1 is positive we have screen positioning (row in hi byte, col in lo byte) ;If D1 is negative we have the special command in the low byte CRT: TSTW D1 ; is it cursor position? BMI CRTS ; no - TTYI ; send position command BYTE 33,'=,0 EVEN PUSH D2 ; save off the register MOVB D1,D2 ; save the value in D2 CMPB D2,#96. ; is it beyond column 96? BLOS 10$ ; no - send as is. SUBB #96.-32.,D2 ; yes - get offset past column 96 CLRB D1 ; and clear the low byte 10$: ADDW #^H1F1F,D1 ; convert to coded format RORW D1,#8. ; send row first TTY ROLW D1,#8. ; send column second TTY CMPB D1,#^H1F ; is there a third byte to send? BNE 20$ ; no - all done MOVB D2,D1 ; yes - send it then TTY 20$: POP D2 ; restore the register RTN ;Special commands - D1 contains the command code in the low byte CRTS: CMPW D1,#177400 ; is it -1 in the high byte IF NE, COLOR JLO CRTMSC ; no - must be some other fancy command ENDC IF EQ, COLOR JLO IGNCMD ; ignore fancy commands ENDC ;Special handling of 80/132 modes CMPB D1,#80. ; set to wide format? BEQ CRTWID ; yes - special handling CMPB D1,#81. ; set to normal format? BEQ CRTNOR ; yes - special handling ;Special handling of the printer port calls CMPB D1,#82. ; transparent printer port? BEQ PRTON ; yes - CMPB D1,#83. ; no - turn port off? BEQ PRTOFF ; yes - CMPB D1,#173. ; bidirectional print? BEQ BIPRT ; yes - CMPB D1,#174. ; no - turn port off? BEQ PRTOFF ; off same code as transparent ;Otherwise it's clear screen AND #377,D1 ; strip the high byte JNE CRTU ; and branch unless clear screen TTYI ; special case for clear screen BYTE 33,';,0 EVEN CRTZ: RTN ;Set terminal to wide format CRTWID: TTYI BYTE 33,'`,';,0 EVEN MOV #132.,D1 ; get new width WIDSET: MOV T.IMP(A5),A6 ; index impure area MOVW D1,@A6 ; store the new width RTN ;Set terminal to normal format CRTNOR: TTYI BYTE 33,'`,':,0 EVEN MOV #80.,D1 ; get the new width BR WIDSET ; go store it ;Code to handle the printer port on/off feature. PRTON: TTYI BYTE 24,0 ; printer port on command EVEN PRTDUN: ;; SLEEP #5000. ; pause while command completes RTN ;Turn printer port off PRTOFF: TTYI BYTE 30,0 ; printer port off command EVEN BR PRTDUN ; go store it ;Bidirectional/concurrent print available BIPRT: TTYI BYTE 22,0 ; bidirectional print command EVEN BR PRTDUN ; wait IF NE, COLOR ;Got a special negative TCRT command - check to see what type CRTMSC: CMPW D1,#-2._8. ; is it -2? BHIS SETFGC ; yes - must be foreground change CMPW D1,#-3._8. ; is it -3? BHIS SETBGC ; yes - must be background change BR IGNCMD ; no - ignore the command ;Select the background color SETBGC: MOV T.IMP(A5),A6 ; index impure storage ANDB #77,D1 ; get just the real parts MOVB D1,7(A6) ; store new background color BR CURCLR ; go select the color ;Select foreground color SETFGC: MOV T.IMP(A5),A6 ; index impure storage ANDB #77,D1 ; get just the color MOVB D1,6(A6) ; store new foreground color ;Set the color to current specification CURCLR: TTYI ; send the color selection command BYTE 33,'g,0,0 MOV T.IMP(A5),A6 CLR D1 ; preclear register MOVB 6(A6),D1 ; get the foreground color ADDB #'!,D1 ; adapt to terminal map TTY ; send the character MOV T.IMP(A5),A6 MOVB 7(A6),D1 ; get the background color ADDB #'!,D1 ; adapt to color map TTY ; send the character ENDC IGNCMD: RTN ; and return ;Command processing per director tables CRTU: PUSH A2 ASL D1 ; times 2 (word offset) CMP D1,#CRCB-CRCA ; check for valid code BHI CRTX ; and bypass if bad LEA A2,CRCA-2 ; index the table ADD D1,A2 ; add command code MOVW @A2,D1 ; pick up data field offset ADD D1,A2 ; make absolute data address TTYL @A2 ; print the data field CRTX: POP A2 ; restore A2 RTN DEFINE OFFTAB A1,A2,A3,A4,A5,A6,A7,A8,A9,A10 IF NB, A1, WORD A1-. IF NB, A2, WORD A2-. IF NB, A3, WORD A3-. IF NB, A4, WORD A4-. IF NB, A5, WORD A5-. IF NB, A6, WORD A6-. IF NB, A7, WORD A7-. IF NB, A8, WORD A8-. IF NB, A9, WORD A9-. IF NB, A10, WORD A10-. ENDM ;Byte offset and data tables follow for all commands ; CRCA: OFFTAB C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 OFFTAB C11,C12,C13,C14,C15,C16,C17,C18,C19,C20 OFFTAB C21,C22,C23,C24,C25,C26,C27,C28,C29,C30 OFFTAB C31,C32,C33,C34,C35,C36,C37,C38,C39,C40 OFFTAB C41,C42,C43,C44,C45,C46,C47,C48,C49,C50 OFFTAB C51,C52,C53,C54,C55,C56,C57,C58,C59,C60 OFFTAB C61,C62,C63,C64,C65,C66,C67,C68,C69,C70 OFFTAB C71,C72,C73,C74,C75,C76,C77,C78,C79,C80 OFFTAB C81,C82,C83,C84,C85,C86,C87,C88,C89,C90 OFFTAB C91,C92,C93,C94,C95,C96,C97,C98,C99,C100 OFFTAB C101,C102,C103,C104,C105,C106,C107,C108,C109,C110 OFFTAB C111,C112,C113,C114,C115,C116,C117,C118,C119,C120 OFFTAB C121,C122,C123,C124,C125,C126,C127,C128,C129,C130 OFFTAB C131,C132,C133,C134,C135,C136,C137,C138,C139,C140 OFFTAB C141,C142,C143,C144,C145,C146,C147,C148,C149,C150 OFFTAB C151,C152,C153,C154,C155,C156,C157,C158,C159,C160 OFFTAB C161,C162,C163,C164,C165,C166,C167,C168,C169,C170 OFFTAB C171,C172,C173,C174,C175,C176,C177 CRCB: PAGE ;CRT code tables ; C1: BYTE 30.,0 ; cursor home (move to column 1,1) C2: BYTE 200+13.,0 ; cursor return (move to column 1) C3: BYTE 11.,0 ; cursor up C4: BYTE 10.,0 ; cursor down C5: BYTE 8.,0 ; cursor left C6: BYTE 12.,0 ; cursor right C7: BYTE 33,43,0 ; lock keyboard C8: BYTE 33,42,0 ; unlock keyboard C9: BYTE 33,'T,0 ; erase to end of line C10: BYTE 33,'Y,0 ; erase to end of screen C11: BYTE 33,'),0 ; reduced intensity C12: BYTE 33,'(,0 ; normal intensity C13: BYTE 33,'&,33,'N,0 ; enable protected fields C14: BYTE 33,'',33,'O,0 ; disable protected fields C15: BYTE 33,'R,0 ; delete line C16: BYTE 33,'E,0 ; insert line C17: BYTE 33,'W,0 ; delete character C18: BYTE 33,'Q,0 ; insert character C19: BYTE 33,'?,0 ; read cursor address C20: BYTE 33,'M,0 ; read character at current cursor position C21: BYTE 33,'G,'2,0 ; start blink field C22: BYTE 33,'G,'0,0 ; end blink field C23: BYTE 33,'H,176,0 ; start line drawing mode (enable alternate character set) C24: BYTE 33,'H,175,0 ; end line drawing mode (disable alternate character set) C25: ; set horizontal position C26: BYTE 0 ; set vertical position C27: BYTE 33,'A,0 ; set terminal attributes C28: BYTE 33,'`,'1,0 ; cursor on C29: BYTE 33,'`,'0,0 ; cursor off C30: BYTE 33,'G,'8,0 ; start underscore C31: BYTE 33,'G,'0,0 ; end underscore C32: BYTE 33,'G,'4,0 ; start reverse video C33: BYTE 33,'G,'0,0 ; end reverse video C34: BYTE 33,'G,'6,0 ; start reverse blink C35: BYTE 33,'G,'0,0 ; end reverse blink C36: BYTE 33,'b,0 ; turn off screen display C37: BYTE 33,'a,0 ; turn on screen display C38: BYTE '2,0 ; top left corner C39: BYTE '3,0 ; top right corner C40: BYTE '1,0 ; bottom left corner C41: BYTE '5,0 ; bottom right corner C42: BYTE '0,0 ; top intersect C43: BYTE '9,0 ; right intersect C44: BYTE '4,0 ; left intersect C45: BYTE '=,0 ; bottom intersect C46: BYTE ':,0 ; horizontal line C47: BYTE '6,0 ; vertical line C48: BYTE '8,0 ; intersection C49: BYTE '7,0 ; solid block C50: BYTE ';,0 ; slant block C51: BYTE '?,0 ; cross-hatch block C52: BYTE '<,0 ; double line horizontal C53: BYTE '>,0 ; double line vertical C54: BYTE 33,'z,0 ; send message to function key line C55: BYTE 33,'Z,0 ; send message to shifted function key line C56: BYTE 33,'x,'0,0 ; set normal display format C57: BYTE 33,'x,'1,0 ; set horizontal split (follow with row code) C58: ; set vertical split (39 char columns) C59: ; set vertical split (40 char columns) C60: BYTE 0 ; set vertical split column to next char C61: BYTE 33,'],0 ; activate split segment 0 C62: BYTE 33,'},0 ; activate split segment 1 C63: BYTE 33,'F,0 ; send message to host message field C64: BYTE '!,0 ; up-arrow C65: BYTE '",0 ; down-arrow C66: BYTE '#,0 ; raised dot C67: BYTE '$,0 ; end of line marker C68: BYTE '%,0 ; horizontal tab symbol C69: BYTE '&,0 ; paragraph C70: BYTE '',0 ; dagger C71: BYTE '(,0 ; section C72: BYTE '),0 ; cent sign C73: BYTE '*,0 ; one-quarter C74: BYTE '+,0 ; one-half C75: BYTE ',,0 ; degree C76: BYTE '-,0 ; trademark C77: BYTE '.,0 ; copyright C78: BYTE '/,0 ; registered C79: BYTE 33,'P,0 ; print screen C80: ; reserved for set to wide mode C81: ; reserved for set to normal mode C82: ; reserved for enter transparent print mode C83: ; reserved for exit transparent print mode C84: ; begin writing to alternate page C85: ; end writing to alternate page C86: ; toggle page C87: BYTE 0 ; copy to alternate page C88: BYTE 33,'k,0 ; insert column C89: BYTE 33,'j,0 ; delete column C90: BYTE 33,'m,0 ; block fill with attribute C91: BYTE 33,'l,0 ; block fill with character C92: BYTE 33,'^,0 ; draw a box C93: BYTE 33,'_,'U,0 ; scroll box up one line C94: BYTE 33,'_,'D,0 ; scroll box down one line C95: ; select jump scroll C96: ; select fast smooth scroll C97: ; select med-fast smooth scroll C98: ; select med-slow smooth scroll C99: BYTE 0 ; select slow smooth scroll C100: BYTE 33,'G,':,0 ; start underscore/blink C101: BYTE 33,'G,'0,0 ; end underscore/blink C102: BYTE 33,'G,'<,0 ; start underscore/reverse C103: BYTE 33,'G,'0,0 ; end underscore/reverse C104: BYTE 33,'G,'>,0 ; start underscore/reverse/blink C105: BYTE 33,'G,'0,0 ; end underscore/reverse/blink C106: ; start underscore w/o space C107: ; end underscore w/o space C108: ; start reverse w/o space C109: ; end reverse w/o space C110: ; start reverse/blinking w/o space C111: ; end reverse/blinking w/o space C112: ; start underscore/blinking w/o space C113: ; end underscore/blinking w/o space C114: ; start underscore/reverse w/o space C115: ; end underscore/reverse w/o space C116: ; start underscore/reverse/blink w/o space C117: ; end underscore/reverse/blink w/o space C118: ; start blink w/o space C119: BYTE 0 ; end blink w/o space C120: BYTE 33,'`,'5,0 ; set cursor to blinking block C121: BYTE 33,'`,'2,0 ; set cursor to steady block C122: BYTE 33,'`,'3,0 ; set cursor to blinking underline C123: BYTE 33,'`,'4,0 ; set cursor to steady underline C124: ; SPARE C125: ; SPARE C126: ; SPARE C127: BYTE 0 ; SPARE C128: BYTE 33,'F,'!,0 ; select top status line w/o address C129: BYTE 177,0 ; end status line C130: BYTE 33,'z,40,0 ; select unshifted status line w/o addr C131: BYTE 33,'Z,40,0 ; select shifted status line w/o addr IF NE, COLOR C132: BYTE 33,'g,'!,'!,40,0 ; select black text C133: BYTE 33,'g,'",'!,40,0 ; select white text C134: BYTE 33,'g,'#,'!,40,0 ; select blue text C135: BYTE 33,'g,'$,'!,40,0 ; select magenta text C136: BYTE 33,'g,'%,'!,40,0 ; select red text C137: BYTE 33,'g,'&,'!,40,0 ; select yellow text C138: BYTE 33,'g,'','!,40,0 ; select green text C139: BYTE 33,'g,'(,'!,40,0 ; select cyan text C140: BYTE 33,'g,'!,'!,40,0 ; select black reverse text C141: BYTE 33,'g,'!,'",40,0 ; select white reverse text C142: BYTE 33,'g,'!,'#,40,0 ; select blue reverse text C143: BYTE 33,'g,'!,'$,40,0 ; select magenta reverse text C144: BYTE 33,'g,'!,'%,40,0 ; select red reverse text C145: BYTE 33,'g,'!,'&,40,0 ; select yellow reverse text C146: BYTE 33,'g,'!,'',40,0 ; select green reverse text C147: BYTE 33,'g,'!,'(,40,0 ; select cyan reverse text ENDC IF EQ, COLOR C132: ; select black text C133: ; select white text C134: ; select blue text C135: ; select magenta text C136: ; select red text C137: ; select yellow text C138: ; select green text C139: ; select cyan text C140: ; select black reverse text C141: ; select white reverse text C142: ; select blue reverse text C143: ; select magenta reverse text C144: ; select red reverse text C145: ; select yellow reverse text C146: ; select green reverse text C147: BYTE 0 ; select cyan reverse text ENDC C148: BYTE 33,'U,0 ; save section C149: BYTE 33,'V,0 ; restore section C150: ; select graphics mode unavailable C151: BYTE 0 ; exit graphics mode unavailable C152: BYTE 33,'v,0 ; box with rounded corners C153: BYTE 33,'u,0 ; "window" box C154: BYTE 33,'w,0 ; double line box C155: ; enable bitmap font C156: ; disable bitmap font C157: BYTE 0 ; no palette seclection needed C158: BYTE 33,'`,'M,'1,0 ; enable graphics cursor C159: BYTE 33,'`,'M,'0,0 ; disable graphics cursor C160: BYTE 0 ; set graphics cursor style C161: BYTE 33,'`,'M,'?,0 ; inquire graphics cursor position C162: ; set graphics cursor region C163: ; formfeed character C164: ; linefeed character C165: ; new line character C166: ; vertical tab character C167: ; plus-or-minus character C168: ; greater-than-or-equal character C169: ; less-than-or-equal chraracter C170: ; not-equal character C171: ; british pound character C172: BYTE 0 ; pi character C173: BYTE 'R-100,0 ; enable concurrent print C174: BYTE 'X-100,0 ; disable concurrent print C175: ; reserved for set terminal clock C176: ; reserved for set terminal calendar C177: BYTE 0 ; select color palette using HLS EVEN END