;**************************************************************************;
; ;
; ESPRIT III COLOR TERMINAL UNIT ROUTINE ;
; ;
;**************************************************************************;
;
; NOTICE
;
; (c) 1984 Alpha Micro Systems Inc. / Alpha Base Systems Inc.
; All Rights reserved
;
;Edit history:
;
; FLIP Code added 1984
BSH =^H4000 ; e ; backslash flag (from teltyp.mac)
FIP =BSH ; e ; bsh = function in progress flag
; Bitmap of defined functions (for new tdv format)
FN.1 =^B1111111111111111 ; 0-15 ; Tel950 can do all 0-15 functions
FN.2 =^B1111111111111001 ;16-31 ; some of fncts not yet defined
FN.3 =^B1111111111111111 ;32-47
FN.4 =^B1111111111111111 ;48-63
FN.5 =^B0111111111111111 ;64-79
FN.6 =^B0000000000000000 ;80-95
FN.7 =^B0000000000000000 ;96-111
FN.8 =^B0000000000000000 ;112-127
FN.9 =^B0000000000011100 ;128-143
FN.10 =^B0000000000000000 ;144-159
FN.11 =^B0000000000000000 ;160-175
FN.12 =^B0000000000000000 ;176-191
$CTLA =^H01 ; control a
$BS =^H08 ; backspace
$TAB =^H09 ; tab
$LF =^H0A ; line- feed
$VT =^H0B ; vertical tab
$FF =^H0C ; right- arrow, formfeed
$CR =^H0D ; carriage return
$CTLU =^H15 ; control u
$CTLZ =^H1A ; control z
$ESC =^H1B ; escape char
$SPACE =^H20
$COMMA =^H2C ; comma
$SEMC =^H3B ; semicolon
$LB =^H3C ; <
$RUB =^H7F ; rubout
BIT7 =^H80 ; set bit 7
$CTLA7 =1+BIT7 ; ^A- don't strip first
$CR7 =$CR+BIT7 ; carriage return
$ESC7 =$ESC+BIT7 ; escape with bit7 set
CTLMSK =^H1F ; for masking to control chars
DEFINE LDIN CHAR
BYTE 233,CHAR,0
ENDM
DEFINE TYPEP CHAR
BYTE 233,'.,CHAR,0
ENDM
DEFINE TYPEG CHAR
BYTE 233,'G,CHAR,0
ENDM
DEFINE CTL TRG,CHAR
BYTE TRG,CHAR-'@
ENDM
;********************
;* TELVID *
;********************
;Terminal driver communications area
TELVID: WORD TD$NEW ; terminal attributes
BR JMPINP ; input routine
BR JOUT ; output
BR ECHO ; echo routine
BR JMPCRT ; crt control
RTN ; no init routine yet
WORD 20. ; NON FLIP impure screen area
BYTE 24. ; number of rows
BYTE 80. ; number of columns
LWORD TFEATS ; terminal has:
; insert/delete line
; dim video attribute
; erase to end of screen
; erase to end of line
; supervue bitmaps
WORD FN.2
WORD FN.1
WORD FN.4
WORD FN.3
WORD FN.6
WORD FN.5
WORD FN.8
WORD FN.7
WORD FN.10
WORD FN.9
BLKW 6. ; FOR SUPERVUE
WORD [SUP],[ER],[VUE]
RAD50 /ABSVX SVX/
;********************
;* 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
;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
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 ; cr
BEQ KRTC
CMPB D1,#33 ; altmode
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 the 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
;
RADIX 8
;********************
;* 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
ANDW #177,D1 ; [for mark]
CMPB D1,#^H1E ; HOME SWAP
BNE CKLESC
MOVB #^H0A,D1 ; must be AFTER #dat check
BR INX
ENDC
CKLESC:
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
;
;++++++ NEW STUFF FOR AUTO TURN-ON WITH TRMOFF.LIT +++++++++
;
PUSH D1 ;save everything (paranoid we are)
PUSH D7
PUSH A6
PUSH D3
CLR D1 ;clear the reg
MOVW T.STS(A5),D6 ;get the terminal status word
PUSH D6 ;and save the original
ANDW #20000,D6 ;get this bit
CMPW D6,#20000 ;see if this bit is on (tv OFF)
BLO CONT ;NO, tv is ON, so normal processing
POP D6 ;tv OFF, so get the status word
MOVW #20000,D7 ;and the bit indicating it's OFF
COMW D7 ;complement
ANDW D7,D6 ;and turn this bit off (tv will be ON)
MOVW D6,@A5 ;move this into the status word
LEA A6,C37 ;get the "turn on" byte string address
MOV A6,D1 ;move this address to D1 for TRMBFQ
MOV #2,D3 ;the number of bytes for turn on
TRMBFQ ;turn tv ON
CONT: POP D6 ;restore junk
POP D3
POP A6
POP D7
POP D1
;
;++++++ END OF "NEW HOT STUFF" - ZOUNDS! ++++++++++++++++
;
INX: 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
; - get here for multi-byte sequence ---
INMLT: MOVB (A0)+,D1 ; get the first character
ANDB #177,D1
DECB D0 ; no translation if single character
BEQ INMX
CMPB D1,#1 ; function sequences start with SOH
JNE INMNOT ; - escape sequence -
;Function codes translation
INMF: MOVB (A0)+,D1 ; get the second character
ANDW #177,D1 ; remove parity
30$:
MOV T.IBF(A5),A6
ADD T.ICC(A5),A6
MOVB #07,@A6 ; force ^G ahead of this char
33$: INC T.ICC(A5)
INC T.BCC(A5)
INMX: LCC #0 ; reset the flags
INMX2: RTN
;Escape code translation
INMNOT: MOVB (A0)+,D1 ; get the second character
ANDB #177,D1 ; remove parity
BIT #T$XLT,@A5 ; TRANSLATE??
BEQ 8$ ; NO USE internal
ORB #200,D1 ; set the 8 bit
; CALL 40$
; MOVB D1,@A6
; CLR D1
LCC #0
RTN
8$:
LEA A6,XLAT2 ; index the translation table
10$: MOVB (A6)+,D7 ; get character
JEQ INMX2 ; end of table - take char(s) as is
CMPB D1,D7 ; this one it?
BEQ 20$ ; yes -
INC A6 ; no - keep looken
BR 10$
20$: MOVB @A6,D1 ; translate the sequence
BIT #^H80,D1 ; special send??
JEQ INMX
30$: CALL 40$ ; accept sequence 'as is'
MOVB #07,@A6
35$:
JMP INMX ; move the chr
; subroutine
40$: MOV T.IBF(A5),A6 ; subroutine inserts char
ADD T.ICC(A5),A6
INC T.ICC(A5)
INC T.BCC(A5)
RTN
XLAT1: BYTE 'J,2 ; func N is new job requeste
BYTE 'j,2
BYTE 'I,1 ; func I is toggle request
BYTE 'i,1 ;
BYTE 'E,3 ; func P is FLIP subsystem request
BYTE 'e,3 ;
BYTE 0,0 ; end of table
EVEN
XLAT2:
CTL '1,'T
CTL '2,'R
CTL '3,'S
CTL '4,'E
CTL '5,'U
CTL '6,'O
CTL '",'X
CTL '8,'V
CTL '9,'\
BYTE 'Q,^H06 ; ins chr
BYTE 'R,^H1A ; delete line
BYTE 'W,^H04 ; del chr
BYTE 'E,^H02 ; ins line
BYTE 'q,^H11 ; ^Q set insert mode
BYTE '7,^H1E ; hme(send key)
BYTE 'Y,^H0E ; ^Y Erase eol
BYTE 'y,^H16 ; ^V Erase word
BYTE 'T,^H19 ; ^N Skip Eol
BYTE 'I,^H01 ; bs (backtab) ^A
BYTE 'L,^H80+'| ; shft print = dial
BYTE 'P,^H80+'\ ; print = toggle ans/hu
BYTE '*,^H16 ; ^V Erase Word
BYTE 't,^H1F ; full line erase ^_
BYTE 'j,^H0B ; shifted up arrow fix
BYTE 0,0 ; end of table
EVEN
;
OUTPUT:
SAVE A0,A3,A6,A4,D7
; TST T.IMP(A5)
; BEQ NOFLP ; NO IMPURE
MOV T.IMP(A5),A3
ADD #4,A3 ; bump up
;********************
;* 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 233,275,0,0
ADD #^H1F1F,D1 ; add position offsets
ROR D1,#8. ; send row
TTY
ROL D1,#8. ; send col
TTY
RTN
CRTS:
; CMPW D1,#-^H0100
; JCS COLORS ; its color time
AND #377,D1 ; strip the high byte
CMPB D1,#254. ; LOAD FUNCTION KEYS??
BNE 0$
TTYL C254 ; Execute the FUNCTION KEYS
RTN
0$:
CMPB D1,#240. ; PRT ON
BEQ 1$
CMPB D1,#241. ; PRT OFF
BNE 4$
TTYL C241
RTN
1$: TTYL C240 ; PRT ON
10$: rtn
4$:
ASL D1 ; times 2 (word offset).
PUSH A2 ; save A2
LEA A2,CRCA ; index the table
CMP D1,#CRCB-CRCA ; check for valid code
BHI CRTX ; and bypass if bad
DOCRT: ADD D1,A2 ; add command code
MOVW @A2,D1 ; pick up data field offset
ADD D1,A2 ; make absolute data address
TTYL @A2
CMPB 1(A2),#'Y ; eos clear ??
BNE CRTX
SLEEP #75. ; wait a little
CRTX: POP A2
RTN
;Word offset and data tables follow for all commands
;
CRCA:
WORD C0-., C1-., C2-., C3-., C4-., C5-., C6-., C7-., C8-., C9-.
WORD C10-., C11-., C12-., C13-., C14-., C15-., C16-., C17-., C18-., C19-.
WORD C20-., C21-., C22-., C23-., C24-., C25-., C26-., C27-., C28-., C29-.
WORD C30-., C31-., C32-., C33-., C34-., C35-., C36-., C37-., C38-., C39-.
WORD C40-., C41-., C42-., C43-., C44-., C45-., C46-., C47-., C48-., C49-.
WORD C50-., C51-., C52-., C53-., C54-., C55-., C56-., C57-., C58-., C59-.
WORD C60-., C61-., C62-., C63-., C64-., C65-., C66-., C67-., C68-., C69-.
WORD C70-., C71-., C72-., C73-., C74-., C75-., C76-., C77-., C78-., C79-.
WORD C80-., C81-., C82-., C83-., C84-., C85-., C86-., C87-., C88-., C89-.
WORD C90-., C91-., C92-., C93-., C94-., C95-., C96-., C97-., C98-., C99-.
WORD C100-.,C101-.,C102-.,C103-.,C104-.,C105-.,C106-.,C107-.,C108-.,C109-.
WORD C110-.,C111-.,C112-.,C113-.,C114-.,C115-.,C116-.,C117-.,C118-.,C119-.
WORD C120-.,C121-.,C122-.,C123-.,C124-.,C125-.,C126-.,C127-.,C128-.,C129-.
WORD C130-.,C131-.,C132-.,C133-.,C134-.,C135-.,C136-.,C137-.,C138-.,C139-.
WORD C140-.,C141-.,C142-.,C143-.,C144-.,C145-.,C146-.,C147-.,C148-.,C149-.
WORD C150-.,C151-.,C152-.,C153-.,C154-.,C155-.,C156-.,C157-.,C158-.,C159-.
WORD C160-.,C161-.,C162-.,C163-.,C164-.,C165-.,C166-.,C167-.,0
CRCB:
;
; Special character table for FLIP
;
COLCRT:
WORD C158-.,C158-.,C160-.,C164-.,C162-.,C154-.,C167-.,C156-.
COLREV:
WORD C32-.,C32-.,C139-.,C143-.,C34-.,C145-.,C141-.,C30-.
PAGE
C0: BYTE 233,'*,0 ; clear screen
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 233,43,0 ; lock keyboard
C8: BYTE 233,42,0 ; unlock keyboard
C9: BYTE 233,'T,0 ; erase to end of line
C10: BYTE 233,'Y,0 ; erase to end of screen
C11: BYTE 233,'),0 ; enter backgroud display mode (reduced intensity).
C12: BYTE 233,'(,0 ; enter foreground display mode (normal intensity)
C13: BYTE 233,'&,0 ; enable protected fields
C14: BYTE 233,'',0 ; disable protected fields
C15: BYTE 233,'R,0 ; delete line
C16: BYTE 233,'E,0 ; insert line
C17: BYTE 233,'W,0 ; delete character
C18: BYTE 233,'Q,0 ; insert character
C19: BYTE 233,'?,0 ; read cursor address
C20: BYTE 233,'1,0 ; read character at current cursor position
C21: BYTE 233,'G,':,0 ; start RED field
C22: BYTE 233,'G,'0,0 ; end RED field
C23: BYTE 233,'$,0 ; start line drawing mode (enable alternate character set)
C24: BYTE 233,'%,0 ; end line drawing mode (disable alternate character set)
C25: ; set horizontal position
C26: BYTE 233,'d,0 ; set SCREEN DARK
C27: BYTE 233,'b,0 ; set SCREEN BRIGHT
C28: BYTE 233,'.,'2,0 ; cursor on
C29: BYTE 233,'.,'0,0 ; cursor off
C30: BYTE 233,'G,'5,0 ; reverse CYAN
C31: BYTE 233,'G,'0,0 ; reverse CYAN off [102
C32: BYTE 233,'G,'7,0 ; reverse WHITE
C33: BYTE 233,'G,'0,0 ; reverse WHITE off
C34: BYTE 233,'G,'>,0 ; reverse RED
C35: BYTE 233,'G,'0,0 ; reverse RED off
C36: BYTE 233,'o,0 ; turn off screen display [102]
C37: BYTE 233,'n,0 ; turn on screen display [102]
C38: BYTE 'B,0 ; top left corner
C39: BYTE 'C,0 ; top right corner
C40: BYTE 'A,0 ; bottom left corner
C41: BYTE 'D,0 ; bottom right corner
C42: BYTE 'N,0 ; top intersect
C43: BYTE 'L,0 ; right intersect
C44: BYTE 'M,0 ; left intersect
C45: BYTE 'O,0 ; bottom intersect
C46: BYTE 'K,0 ; horizontal line
C47: BYTE 'J,0 ; vertical line
C48: BYTE 'I,0 ; intersection
C49:
C50: ; slant block
C51: ; cross-hatch block
BYTE 233,'%,233,'U,^H7F,233,'u,233,'$,0 ; solid block
C52: BYTE 'K,0 ; double line horizontal
C53: BYTE 'J,0 ; double line vertical
C54: BYTE 233,'f,0 ; send message to function key line
C55: ; send message to shifted function key line
C56: ; set normal display format
C57: ; set horizontal split (follow with row code)
C58: ; set vertical split (39 char columns)
C59: ; set vertical split (40 char columns)
C60: ; set vertical split column to next char
C61: ; activate split segment 0
C62: ; activate split segment 1
C63: BYTE 0 ; send message to host message field
C64: ; up-arrow
C65: ; down-arrow
C66: BYTE 32.,0 ; raised dot
C67: BYTE 'M,0 ; end of
line marker
C68: BYTE 32.,0 ; horizontal tab symbol
C69: BYTE 'L,0 ; paragraph
C70: ; dagger
C71: ; section
C72: ; cent sign
C73: ; one-quarter
C74: ; one-half
C75: ; degree
C76: ; trademark
C77: ; copyright
C78: BYTE ' ,0 ; registered
C79: byte 33,'P,0 ; Print screen
C80: ; set 132 mode n/a
C81: byte 0 ; set normal mode
C82: BYTE 233,96.,0 ; PRINTER PORT ON-TRANSPARENT
C83: BYTE 233,97.,0 ; PRINTER PORT OFF (1=FLIP on)
C84: ; begin writing to alternate page
C85: ; end writing to alternate page
C86: ; toggle page
C87: ; copy to alternate page
C88: ; insert column
C89: ; delete column
C90: ; block fill with attribute
C91: ; block fill with character
C92: ; draw a box
C93: ; scroll box up one line
C94: BYTE 0 ; scroll box down one line
C95: ; select jump scroll
C96: BYTE 33,'9,0 ; select fast smooth scroll
C97: ; select med-fast smooth scroll
C98: ; select med-slow smooth scroll
C99: BYTE 33,'8,0 ; select slow smooth scroll
C100: BYTE 33,'G,':,0 ; start underscore/blink (red)
C101: BYTE 33,'G,'0,0 ; end underscore/blink
C102: BYTE 33,'G,'4,0 ; start underscore/reverse (green)
C103: BYTE 33,'G,'0,0 ; end underscore/reverse
C104: BYTE 33,'G,'>,0 ; start underscore/reverse/blink (redrev)
C105: BYTE 33,'G,'0,0 ; end underscore/reverse/blink
SPCTBL: BYTE '= ; Move cursor escape character
BYTE 'B ; top left corner (TCRT 38)
BYTE 'C ; top right corner (TCRT 39)
BYTE 'A ; bottom left corner (TCRT 40)
BYTE 'D ; bottom right corner (TCRT 41)
BYTE 'N ; top intersect (TCRT 42)
BYTE 'L ; right intersect (TCRT 43)
BYTE 'M ; left intersect (TCRT 44)
BYTE 'O ; bottom intersect (TCRT 45)
BYTE 'K ; horizontal line (TCRT 46)
BYTE 'J ; vertical line (TCRT 47)
BYTE 'I ; intersection (TCRT 48)
BYTE 13. ; Turn off Line 25.
END
COLORS:
PUSH A2
CMPW D1,#^H0FE00 ; foreground color
BCC FORCOL
CMPW D1,#^H0FC00
BCC BAKCOL
BR CRTX ; no background
FORCOL:
LEA A2,COLCRT
BR EXCOL ; execute
BAKCOL:
LEA A2,COLREV
EXCOL: AND #377,D1
ASL D1
BR DOCRT ; execute