;********************
;* HEATH *
;********************
;Terminal driver communications area
Z29: WORD TD$NEW!TD$TCH ; terminal attributes
BR JMPINP ; input routine [102]
RTN ; output routine
BR ECHO ; echo routine
BR JMPCRT ; crt control
RTN ; INIT routine
WORD 4 ; impure area of one longword.
ROWCNT:
BYTE 24. ; number of rows
COLCNT:
BYTE 80. ; number of columns
LWORD TDVFLG ; terminal has:
; insert/delete line
; insert/delete character
; reverse video attribute
; dim video attribute
; blinking video attribute
; underlined video attribute
; erase to end of screen
; erase to end of line
; split screen
; status line
; line graphics
BR JMPTCH ; entry for TRMCHR routine
JMPINP: JMP INP ; go handle input [102]
JMPCRT: JMP CRT ; go handle TCRT codes
JMPTCH: JMP TCH ; go handle TRMCHR call
;********************
;* 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.? [103]
BLO RBX ; yes - [103][104]
;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 ; [103]
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
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 ROWCNT(A2),D6 ; get row count
MOVW D6,TC.ROW(A1) ; transfer row count
MOVB COLCNT(A2),D6 ; Get column count [103]
MOVW D6,TC.COL(A1) ; transfer column count. [103]
; MOVW @A6,TC.COL(A1) ; transfer column count [103]
CLRW TC.CLR(A1) ; no colors
MOVW #0,TC.TSL(A1) ; set length of top status line [101]
MOVW #0,TC.SSL(A1) ; set length of shifted status line [101]
MOVW #0,TC.USL(A1) ; set length of unshifted status line [101]
MOV D2,D7 ; get TRMCHR argument flags [101]
AND #TC$BMP,D7 ; does user want bitmap [101]
BEQ 20$ ; no - skip transfer code [101]
; user has requested bitmap -- return to him
PUSH A1 ; save argument block index [101]
ADDW #TC.BMP,A1 ; index bitmap return area [101]
LEA A6,TCHBMP ; index our bitmap [101]
MOV #<256./16.>-1,D7 ; get amount to transfer [101]
10$: MOVW (A6)+,(A1)+ ; transfer to user
DBF D7,10$ ; loop until done
POP A1 ; restore register
20$: RTN ; return to TRMCHR monitor routine
;********************
;* 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
;Cursor positioning - D1 contains X,Y coordinates
TTYI ; send position command
BYTE 233,'Y,0,0
ADD #17437,D1 ; add position offsets
ROR D1,#8. ; send row first
TTY
ROL D1,#8. ; send column second
TTY
RTN
;Special commands - D1 contains the command code in the low byte
CRTS: AND #377,D1 ; strip the high byte
BNE CRTU ; and branch unless clear screen
TTYI ; special case for clear screen
BYTE 233,'E,0
EVEN
CRTZ: TTYL CRTNUL ; output some nulls
RTN
;Command processing per director tables
CRTU: PUSH A2 ; save 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
CMPB @A2,#36 ; sleep if home command
BEQ CRTXZ
CMPB 1(A2),#100 ; sleep if erase command
BHI CRTXZ
CRTX: POP A2 ; restore A2
RTN
CRTXZ: POP A2 ; restore A2
BR CRTZ ; and go output nulls
;Null characters for long commands
;
CRTNUL: BYTE 200,200,0
EVEN
;Byte offset and data tables follow for all commands
;
CRCA: WORD C1-.,C2-.,C3-.,C4-.,C5-.,C6-.,C7-.,C8-.
WORD C9-.,C10-.,C11-.,C12-.,C13-.,C14-.
WORD C15-.,C16-.,C17-.,C18-.,C19-.,C20-.,C21-.,C22-.
WORD 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-.
WORD C109-.,C110-.,C111-.,C112-.,C113-.,C114-.,C115-.,C116-.,C117-.
WORD C118-.,C119-.,C120-.,C121-.,C122-.,C123-.,C124-.,C125-.,C126-.
WORD C127-.,C128-.,C129-.,C130-.,C131-.,C132-.,C133-.,C134-.,C135-.
WORD C136-.,C137-.,C138-.,C139-.,C140-.,C141-.,C142-.,C143-.,C144-.
WORD C145-.,C146-.,C147-.
CRCB:
PAGE
C1: BYTE 233,'H,0 ; cursor home (move to column 1,1)
C2: BYTE 200+13.,0 ; cursor return (move to column 1)
C3: BYTE 233,'A,0 ; cursor up
C4: BYTE 233,'B,0 ; cursor down
C5: BYTE 233,'D,0 ; cursor left
C6: BYTE 233,'C,0 ; cursor right
C7: BYTE 233,'},0 ; lock keyboard
C8: BYTE 233,'{,0 ; unlock keyboard
C9: BYTE 233,'K,0 ; erase to end of line
C10: BYTE 233,'J,0 ; erase to end of screen
C11: BYTE 233,'p,0 ; enter backgroud display mode (reduced intensity).
C12: BYTE 233,'q,0 ; enter foreground display mode (normal intensity)
C13: BYTE 233,'F,0 ; enable protected fields
C14: BYTE 233,'G,0 ; disable protected fields
C15: BYTE 233,'M,0 ; delete line
C16: BYTE 233,'L,0 ; insert line
C17: BYTE 233,'N,0 ; delete character
C18: ; insert character
C19: ; read cursor address
C20: ; read character at current cursor position
C21: BYTE 0 ; start blink field
C22: BYTE 0 ; end blink field
C23: BYTE 233,'F,0 ; start line drawing mode (enable alternate character set)
C24: BYTE 233,'G,0 ; end line drawing mode (disable alternate character set)
C25: BYTE 0 ; set horizontal position
C26: BYTE 0 ; set vertical position
C27: BYTE 0 ; set terminal attributes
C28: BYTE 233,'y,'5,0 ; cursor on
C29: BYTE 233,'x,'5,0 ; cursor off
C30: BYTE 0 ; start underscore [102]
C31: BYTE 0 ; end underscore [102
C32: BYTE 233,'p,0 ; start reverse video [102]
C33: BYTE 233,'q,0 ; end reverse video [102]
C34: ; start reverse blink [102]
C35: ; end reverse blink [102]
C36: ; turn off screen display [102]
C37: ; turn on screen display [102]
C38: BYTE 'f,0 ; top left corner
C39: BYTE 'c,0 ; top right corner
C40: BYTE 'e,0 ; bottom left corner
C41: BYTE 'd,0 ; bottom right corner
C42: BYTE 's,0 ; top intersect
C43: BYTE 't,0 ; right intersect
C44: BYTE 'v,0 ; left intersect
C45: BYTE 'u,0 ; bottom intersect
C46: BYTE 'a,0 ; horizontal line
C47: BYTE '`,0 ; vertical line
C48: BYTE 'b,0 ; intersection
C49: BYTE 'i,0 ; solid block
C50: BYTE 'r,0 ; slant block
C51: BYTE 'w,0 ; cross-hatch block
C52: BYTE 'j,0 ; double line horizontal
C53: BYTE 'j,0 ; double line vertical
C54: ; 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: BYTE 94.,0 ; up-arrow
C65: BYTE 0 ; down-arrow
C66: BYTE 94.,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: ; print screen
C80: ; reserved for set to wide mode
C81: BYTE 0 ; reserved for set to normal mode
C82: ; enter transparent print mode
C83: ; exit transparent print mode
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: ; 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 0 ; start underscore/blink
C101: BYTE 0 ; end underscore/blink
C102: BYTE 0 ; start underscore/reverse
C103: BYTE 0 ; end underscore/reverse
C104: BYTE 0 ; start underscore/reverse/blink
C105: BYTE 0 ; end underscore/reverse/blink
C106: ; start underscore w/o space
C107: ; end underscore w/o space
C108: BYTE 233,'p,0 ; start reverse w/o space
C109: BYTE 233,'q,0 ; 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/blinking w/o space
C117: ; end underscore/reverse/blinking w/o space
C118: ; start blink w/o space
C119: BYTE 0 ; end blink w/o space
C120: BYTE 233,'x,'4,0 ; set cursor to blinking block
C121: BYTE 233,'x,'4,0 ; set cursor to steady block
C122: BYTE 233,'y,'4,0 ; set cursor to blinking underline
C123: BYTE 233,'y,'4,0 ; set cursor to steady underline
C124: ; spare
C125: ; spare
C126: ; spare
C127: BYTE 0 ; spare
C128: ; select top status line
C129: ; end of all status line
C130: ; select unshifted status line
C131: ; select shifted status line
C132: ; select black text
C133: ; select white text
C134: ; select blue text
C135: ; select magneta 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 magneta reverse text
C144: ; select red reverse text
C145: ; select yellow reverse text
C146: ; select green reverse text
C147: BYTE 0 ; select cyan reverse text