.TITLE VTMRUL - WRITE A RULER FOR VTM .IDENT /01.2/ .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: VTMRUL.MAC ; Author: Robin Miller ; Date: ; ; Description: ; ; This module is used to write a ruler on the VT100 for VTM. The ; ruler makes it easier to format messages on the VT100. There will be ; a ruler along the top line (by default) and the left margin (for now). ; ; ; Modification History: ; ;- .ENABL AMA .NLIST BEX ; Local equates: CR = 13. ; ASCII FOR CARRIAGE RETURN ; Macro to move a constant or a character to buffer pointer. .MACRO MOVCHR CHAR .NCHR $$$,^/CHAR/ .IF EQ $$$-1 MOVB #''CHAR,@BUFPTR .IFF MOVB #CHAR,@BUFPTR .ENDC INC BUFPTR .ENDM ; Ruler for the top. RULERM: .ASCII %1 5 10 15 20 25 30 35 40 45 5% .ASCII %0 55 60 65 70 75 80 85 90 95 1% .ASCII %00 105 110 115 120 125 130% RULMAX = .-RULERM .EVEN ; Local storage: RULERL: .WORD 1 ; LINE NUMBER FOR RULER ;+ ; ; RULER - Action routines to write ruler on the VT100. ; ;- RULLIN::MOVB .PNUMB,R0 ; COPY THE LINE NUMBER CMP R0,#24. ; LINE # WITHIN RANGE ? BGT FAIL ; IF GT, NO (TOO BIG) MOV R0,RULERL ; YES, SAVE IT BR RULER ; AND WRITE THE RULER FAIL: ADD #2,(SP) ; RETURN FAILURE RETURN RULER:: MOV BUFPTR,-(SP) ; SAVE CURRENT BUFFER POINTER MOV #MSGBUF,BUFPTR ; SETUP THE OUTPUT BUFFER BIT #B.CLR,STATUS ; NEED TO CLEAR THE SCREEN ? BEQ 10$ ; IF EQ, NO CALL CLRSCR ; YES, DO IT ; Set the starting line number. 10$: MOV RULERL,R1 ; COPY THE LINE NUMBER CALL 100$ ; GENERATE ESCAPE SEQUNCE CALL REVERSE ; TURN ON REVERSE VIDEO ; Now copy the actual ruler. MOV #RULERM,R0 ; ADDRESS OF RULER MOV #80.,R1 ; PRESUME NARROW SCREEN BIT #B.WIDE,STATUS ; IS IT REALLY NARROW ? BEQ 20$ ; IF EQ, YES MOV #RULMAX,R1 ; NOPE, USE THE MAXIMUM 20$: MOVB (R0)+,@BUFPTR ; COPY THE RULER INC BUFPTR ; BUMP THE BUFFER POINTER SOB R1,20$ ; LOOP UNTIL DONE CALL ATTOFF ; TURN OFF ATTRIBUTES ; Now for the ruler along the left margin. MOV #1,R1 ; START AT THE HOME POSITION CALL 100$ ; SET THE POSITION 30$: CALL REVERSE ; TURN ON REVERSE VIDEO CALL MAKNUM ; MAKE THE ASCII LINE # CALL ATTOFF ; TURN ATTRIBUTES OFF CMP R1,#24. ; ARE WE AT MAX LINE # ? BEQ 40$ ; IF EQ, YES (FINISHED) INC R1 ; BUMP THE LINE NUMBER CALL CDOWN ; NO, MOVE THE CURSER DOWN MOVCHR ; AND MOVE TO LEFT MARGIN BR 30$ ; AND LOOP UNTIL DONE ; Now write the ruler to the terminal. 40$: CALL SETBUF ; SET BUFFER AND BYTE COUNT CALL WRTTTY ; WRITE IT TO THE TERMINAL MOV (SP)+,BUFPTR ; RESTORE ORIGINAL POINTER RETURN ; Set the starting position for the ruler. ; Inputs: R1 = the line number. 100$: CALL MAKLIN ; MAKE THE LINE NUMBER MOV #1,R1 ; ALWAYS START IN COLUMN 1 CALL MAKNUM ; MAKE THE COLUMN NUMBER MOVCHR ; FINISH ESCAPE SEQUENCE RETURN .END