.TITLE AUXFMT - Format and Write Record .IDENT /1.0/ .ENABL LC ;+ ; ; Free software BY ; Project Software & Development, Inc. ; ; This software is furnished for free and may be used and copied as ; desired. This software or any other copies thereof may be provided or ; otherwise made available to any other person. No title to and ; ownership of the software is hereby transferred or allowed. ; ; The information in this software is subject to change without notice ; and should not be construed as a commitment by PROJECT SOFTWARE ; AND DEVELOPMENT, INC. ; ; PROJECT SOFTWARE assumes no responsibility for the use or reliability ; of this software on any equipment whatsoever. ; ; Project Software & Development, Inc. ; 14 Story St. ; Cambridge, Ma. 02138 ; 617-661-1444 ; ; ; Title: AUXFMT.MAC ; Author: Robin Miller ; Date: July 23, 1985 ; ; Description: ; ; These routines are used to format special characters and then write ; the buffer to the terminal. ; ; Modification History: ; ;- .ENABL AMA .NLIST BEX .MCALL QIOW$S ; Macro to move a single character to buffer in R0. .MACRO MOVCHR CHAR .NCHR $$$,^/CHAR/ .IF EQ $$$-1 MOVB #''CHAR,(R0)+ .IFF MOVB #CHAR,(R0)+ .ENDC .ENDM ; Equates for special graphics. G.DIA = 140 ; (') Diamond. G.CHK = 141 ; (a) Check board. G.HT = 142 ; (b) Horizontal tab. G.FF = 143 ; (c) Form feed. G.CR = 144 ; (d) Carriage return. G.LF = 145 ; (e) Line feed. G.DEG = 146 ; (f) Degree symbol. G.PLMI = 147 ; (g) Plus/minus. G.NL = 150 ; (h) New line. G.VT = 151 ; (i) Vertical tab. G.DOT = 176 ; (~) Centered dot. US = 31. ; Unit seperator. NUMSIZ = 8. ; Record number field size. ; Table of characters to be printed in graphics. GRATBL: .BYTE HT,FF,CR,LF,VT,0 ; Graphics character table. .SBTTL CHKGRA - Check for graphics character. ;+ ; ; CHKGRA - Check for graphics character. ; ; This routine determines whether the specified character is displayed ; in special graphics. This routine is needed by the input routine when ; deleting control characters from the screen. In special graphics, the ; character is displayed in a single character position. All other ; characters are displayed in two character positions as ^char. ; ; Inputs: ; R3 = Address of character to check. ; ; Outputs: ; C bit clear/set = graphics/no graphics. ; ; All registers are preserved. ; ;- CHKGRA::JSR R2,$SAVVR ; Save R0 - R2. MOV #GRATBL,R0 ; Set graphics table address. 10$: MOVB (R0)+,R1 ; Copy the next character. BEQ 90$ ; If EQ, end of the table. CMPB R1,(R3) ; Displayed in graphics ? BNE 10$ ; If NE, no. BR 100$ ; Use common return ... 90$: SEC ; Show not displayed in graphics. 100$: RETURN .SBTTL DOCHAR - Copy/format a character. ;+ ; ; DOCHAR - Copy/format a character. ; ; This routine is called to copy and format a single character converting ; control characters to printable ASCII as necessary. ; ; Inputs: ; R0 = The output buffer address. ; R3 = The character to format. ; ; Outputs: ; R0 = The updated output buffer address. ; ; All other registers are preserved. ; ;- DOCHAR::JSR R5,$SAVRG ; Save R3 - R5. CMPB R3,#SPACE ; Is this a control character ? BGE 10$ ; If GE, no (normal character). CALL DOGRA ; Do special graphics characters. BCC 100$ ; If CC, character displayed. MOVB #'^,(R0)+ ; Display control as ^char. ADD #64.,R3 ; Make control printable ASCII. 10$: MOVB R3,(R0)+ ; And copy to the output buffer. 100$: RETURN .SBTTL DOGRA - Display character in graphics. ;+ ; ; DOGRA - Display a character in graphics. ; ; This routine checks for and displays characters which can be displayed ; using a VT100 special graphics charater. ; ; Inputs: ; R0 = The output buffer address. ; R3 = The character to check. ; ; Outputs: ; C bit clear/set = graphics/no graphics. ; ; R0 = The updated output buffer address. ; All other registers are preserved. ; ;- DOGRA:: JSR R5,.SAVR1 ; Save R1 - R5. ; Special graphics for HT, LF, VT, FF, and CR. MOVB #G.HT,R1 ; Set graphic for horizontal tab. CMPB R3,#HT ; Is it a horizontal tab ? BEQ 10$ ; If EQ, yes. MOVB #G.LF,R1 ; Set graphic for line feed. CMPB R3,#LF ; Is it a line feed ? BEQ 10$ ; If EQ, yes. MOVB #G.VT,R1 ; Set graphic for vertical tab. CMPB R3,#VT ; Is it a vertical tab ? BEQ 10$ ; If EQ, yes. MOVB #G.FF,R1 ; Set graphic for form feed. CMPB R3,#FF ; Is it a form feed ? BEQ 10$ ; If EQ, yes. MOVB #G.CR,R1 ; Set graphic for carriage return. CMPB R3,#CR ; Is it a carriage return ? BNE 90$ ; If NE, no. 10$: CALL SGRAPH ; Turn on the special graphics. MOVB R1,(R0)+ ; Copy the graphics character. CALL USSET ; Return to ASCII character set. CLC ; Show displayed in graphics. BR 100$ ; And use common return ... 90$: SEC ; Show not a graphics character. 100$: RETURN .SBTTL MOVEF - Move characters with format. ;+ ; ; MOVEF - Move characters with format. ; ; This routine copies characters converting control characters to ; printable ASCII or special graphics as necessary. The number of ; characters to be displayed is also calculated and returned. ; ; Inputs: ; R0 = The output buffer address. ; R1 = The input string to copy (terminated by null). ; ; Outputs: ; R0 = The updated output buffer address. ; R1 = The number of characters displayed. ; ; All other registers are preserved. ; ;- MOVEF:: JSR R5,$SAVRG ; Save R3 - R5. MOV R1,-(SP) ; Save the starting address. 10$: MOVB (R1)+,R3 ; Copy the next character. BEQ 20$ ; If EQ, end of string. CALL DOCHAR ; Copy/format this character. BR 10$ ; Go get the next character. ; Calculate number of characters displayed. 20$: MOV (SP)+,R3 ; Copy the starting address. CLR R1 ; Initialize the display count. 30$: TSTB (R3) ; End of string being formatted ? BEQ 100$ ; If EQ, yes. INC R1 ; Adjust the display count. CMPB (R3),#SPACE ; Is this a control character ? BHIS 40$ ; If HIS, no. CALL CHKGRA ; Yes, displayed in graphics ? BCC 40$ ; If CC, yes. INC R1 ; Control dislayed as "^char". 40$: INC R3 ; Adjust the buffer address. BR 30$ ; And check the next character. 100$: RETURN .END