.LIST TTM .TITLE CELL .IDENT /V01.00/ .ENABLE LC,LSB ; ; Program that allows for composing (designing) characters ; for the VT200 family of terminals ; .MCALL TTSYM$,QIOW$C ; TTSYM$ ; Define the Terminal Symbols ; ; CMD:: .BYTE 0 ; Command storage location BCKSPC: .BYTE <10> ; Backspace character GRDPTR::.BLKW ; Grid address pointer STATUS::.BLKW 2 ; I/O Status Block GRAPH:: .ASCII <33>/(0/ ; Escape Sequence to enter DEC ; special graphics mode NOGRHS::.ASCII <33>/(B/ ; Escape Sequence to leave DEC ; special graphics mode CURDWN::.ASCII <33>/[1B/ ; Cursor DOWN escape sequence ; CURSOR::.ASCII <33>/[/ ; Direct cursor addressing LINE:: .ASCII / ;/ ; escape sequence COLUMN::.ASCII / H/ ; ESCTRM::.BYTE TC.ESQ,1 ; Control block to set the terminal .BYTE TC.ACR,0 ; to recognize escape sequences NOESC:: .BYTE TC.ESQ,0 ; Control block to set the terminal .BYTE TC.ACR,1 ; NOT to recognize escape sequences ; TOPLIN: .ASCII /lqqqqqqqqk/ ; Top line of the Grid MIDLIN: .ASCII /x........x/ ; Middle lines of the Grid BOTLIN: .ASCII /mqqqqqqqqj/ ; Bottom line of the Grid .EVEN ; ; ; Address table of valid commands ; CMDTBL::.WORD UP ; UP cursor key .WORD DOWN ; DOWN cursor key .WORD RIGHT ; RIGHT cursor key .WORD LEFT ; LEFT cursor key .WORD DONE ; "E" key for subroutine exit ; ; ; CELL:: MOV 2(R5),GRDPTR ; Initialize the GRDPTR ; QIOW$C SF.SMC,5,1,,STATUS,, ; Enable the terminal to ; recognize escape sequences QIOW$C IO.WVB,5,1,,STATUS,, ; Set terminal into DEC graphics ; mode MOV #"09,LINE ; Set line no. to 9 MOVB #'2,COLUMN ; Set column no. to 29 MOVB #'9,COLUMN+1 ; QIOW$C IO.WVB,5,1,,STATUS,,; Move cursor to location 9,35 ; QIOW$C IO.WVB,5,1,,STATUS,, ; Print out top line of the ; Grid MOV #10.,R0 ; Use R0 as a loop counter MOV #"10,LINE ; Set line no. to 10; keep column ; number the same ; 10$: QIOW$C IO.WVB,5,1,,STATUS,,; Move cursor to the next line QIOW$C IO.WVB,5,1,,STATUS,,; Print out the middle lines INCB LINE+1 ; Advance to the next line SOB R0,10$ ; Loop until done ; MOV #"20,LINE ; Set line no. to 20 QIOW$C IO.WVB,5,1,,STATUS,, ; Move cursor to location 20,35 QIOW$C IO.WVB,5,1,,STATUS,,; Print out the bottom line ; MOV #"10,LINE ; Set line no. to 10 MOVB #'3,COLUMN ; Set column no. to 30 MOVB #'0,COLUMN+1 QIOW$C IO.WVB,5,1,,STATUS,, ; Move cursor to location 10,36 ; MOVB #'a,CMD ; Init. CMD with Set Pixel Character MOV #8.,R1 ; Use R1 as a loop counter MOV 2(R5),R2 ; Use R2 as GRID address pointer ; 12$: MOV #10.,R0 ; Use R0 as loop counter MOV (R2)+,R3 ; Obtain GRID binary char. rep. BEQ 19$ ; Move to next column if there ; aren't any pixels to set 15$: ROR R3 ; Need to set the Pixel ? BCC 18$ ; No, cont. at 18$ QIOW$C IO.WVB,5,1,,STATUS,, ; Yes, set the Pixel 18$: QIOW$C IO.WVB,5,1,,STATUS,, ; Move the cursor down one line SOB R0,15$ ; Loop until done ; 19$: INCB COLUMN+1 ; Adv. the column number QIOW$C IO.WVB,5,1,,STATUS,, ; Move cursor to the next ; column SOB R1,12$ ; Loop until done ; MOVB #'0,COLUMN+1 ; Restore column number to init. value QIOW$C IO.WVB,5,1,,STATUS,, ; Move cursor to init. ; location ; COMAND::QIOW$C IO.RNE,5,1,,STATUS,, ; Read in the command character ; CMPB CMD,#'A ; Valid command ? BLT PXLCHK ; No, check for clear or set pixel BICB #40,CMD ; Convert character to upper case CMPB CMD,#'E ; Valid command ? BGT COMAND ; No, get next character ; ; Decode the command ; EXECMD: MOV CMD,R0 ; Obtain the valid command character DEC R0 ; Dec. R0 for no. between 0 and 7 BIC #177770,R0 ; Clear the high order bits ASL R0 ; Multiply result by 2 for word offset JMP @CMDTBL(R0) ; Execute the command ; PXLCHK: CMPB CMD,#'0 ; Clear pixel command ? BEQ 20$ ; Yes, cont. at 20$ ; CMPB CMD,#'1 ; Set pixel command ? BNE COMAND ; No, get next command ; 20$: MOVB LINE+1,R1 ; Obtain the current line number BIC #177760,R1 ; Clear the high order bits MOV #1,R0 ; Create mask for bit toggling ASH R1,R0 ; Shift R0 to the left the proper ; number of places CMPB CMD,#'1 ; Set pixel command ? BEQ SETPXL ; Yes, cont. at SETPXL ; CLRPXL::BIC R0,@GRDPTR ; Clear the proper bit MOVB #'.,CMD ; Clear the Pixel by outputting a "." BR 30$ ; SETPXL::BIS R0,@GRDPTR ; Set the proper bit MOVB #'a,CMD ; Set the Pixel by outputting a "a" - in ; 30$: QIOW$C IO.WVB,5,1,,STATUS,, ; DEC graphics mode it appears ; as a solid block BR COMAND ; Get next command ; ; UP:: CMPB LINE+1,#'0 ; Check to see if the cursor could be ; moved up one line BEQ COMAND ; No, wait for next command DECB LINE+1 ; Yes, dec. line number BR MOVCUR ; Move the cursor up one line ; DOWN:: CMPB LINE+1,#'9 ; Check to see if the cursor could be ; moved down one line BEQ COMAND ; No, wait for next command INCB LINE+1 ; Yes, inc. line number BR MOVCUR ; Move the cursor down one line ; RIGHT:: CMPB COLUMN+1,#'7 ; Check to see if the cursor could be ; moved to the right one column BEQ COMAND ; No, wait for next command ADD #2,GRDPTR ; Increase the GRID address pointer INCB COLUMN+1 ; Yes, inc. column number BR MOVCUR ; Move the cursor to the right one ; column LEFT:: CMPB COLUMN+1,#'0 ; Check to see if the cursor could be ; moved to the left one column BEQ COMAND ; No, wait for next command SUB #2,GRDPTR ; Decrease the GRID address pointer DECB COLUMN+1 ; Yes, dec. column counter ; MOVCUR::QIOW$C IO.WVB,5,1,,STATUS,, ; Move cursor to new location ; BR COMAND ; Get the next command ; ; DONE:: QIOW$C IO.WVB,5,1,,STATUS,, ; Disable the DEC special ; graphics mode of operation ; QIOW$C SF.SMC,5,1,,STATUS,, ; Disable the terminal from ; recognizing escape sequences ; RETURN ; Done ; .END