;*; Updated on 24-Aug-1995 at 2:45 AM by James A. Jarboe I V; edit time: 2:21:39 ;*; Created on 23-Aug-1995 at 1:52 PM by James A. Jarboe I V; edit time: 0:14:16 ;*************************** AMUS Program Label ****************************** ; Filename: QTYPE.LIT Date: 08/24/1995 ; Category: MUTIL Hash Code: 144-030-734-275 Version: 1.0(101) ; Initials: GR/AM Name: JAMES A. JARBOE IV ; Company: JAJIV Telephone #: 7174761906 ; Related Files: ; Min. Op. Sys.: 1.x Expertise Level: BEG ; Special: ; Description: Does low and high intensity text display for .CMD and .DO ; files without having to use XY=11, XY=12 and multiple :< > command file ; text statements. Respects all .DO file $?? values and can be used in ; place of standard :< command file text > characters. Accepts multiple ; lines just like the :< > does. The "_" character is the highlight toggle ; character within the text. ;*************************************************************************** ; * ;QTYPE - Outputs low & high intensity comments in command & do files. * ; * ;*************************************************************************** ;* Copyright (c) 1995 - James A. Jarboe IV * ;* Unpublished - All rights reserved. * ;*************************************************************************** ; ; Usage: ; QTYPE :< _High intensity_ Low intensity _text_ output. > ; ; Just as text output comments are used in .CMD and .DO files, QTYPE can ; be used to create text output comments that contain high and low intensity ; terminal output. QTYPE will always start outputing comments in low ; intensity (-1,11). The toggle character "_" will turn on high intensity ; (-1,12) on if output is currently in low intensity or will turn low ; intensity on (-1,11) if output is currently in high intensity. ; The commented text section must begin with ":<" just as .CMD and .DO ; files start out text output. The text output must also terminate with ; ">" just as .CMD and .DO files terminate the text output. ; QTYPE is also respects all the "$" special variables that .DO files ; are capable of using. ; The main purpose of QTYPE is to eliminate the need for (example) ; ; XY=11 ; :< This is low > ; XY=12 ; : ; XY=11 ; :< and so on> ; ; With QTYPE you can: ; ; QTYPE :< This is low _this is high_ ; and _so_ on ....._until you ; want_ to _end_ the _text_ output. ; it is now _$TM_ on _$TW_._ ; > ; ; Also in .DO files: ; ;************************************************** ; :S ; QTYPE :< It is _$TM_. ; You are _$NU_ on job _$NJ_. ; Your terminal is _$NT_ using driver _$ND_. ; The _OS_ is _$NS_ Version _$SV_. ; ; > ; terminator character. ;************************************************** ; ; Quote of the day: ; - If the comments and the code don't match, they are probably both wrong. ; ; Edit history. ; ; [100] 23-Aug-1995 by JAJIV ; - Designed and implemented because I was tired of XY=?? ; in .CMD and .DO files for text output. ; ; [101] 24-Aug-1995 by JAJIV ; - Ok got carried away and added: ; /H=char to change highlight char. ; - Added following features for display. ; % = REVERSE ; ~ = BLINK ; ^ = UNDERLINE ; - Added switches for each of the above ; /R=char ; /B=char ; /U=char ; /O to turn screen off before outputting test and on when finished. ; /C to clear screen before processing. SEARCH SYS SEARCH SYSSYM SEARCH TRM PAGE ;*************************************************************************** ; * ; V E R S I O N * ; * ;*************************************************************************** ; VMAJOR = 1 VMINOR = 0 VSUB = 0 VEDIT = 101. ; 24-Aug-1995 VWHO = 0 PAGE ;*************************************************************************** ; * ; M A C R O ' S * ; * ;*************************************************************************** ; ; Output internal text using toggle text. ; DEFINE HTYPE TEXT MOVB #$TOGGLE, QT.HIL(A5) CLR D3 CALL FLIP.IT LEA A2, 10$$ CALL HTYPE BR 20$$ 10$$: ASCIZ /TEXT/ EVEN 20$$: ENDM PAGE ;*************************************************************************** ; * ; C O N S T A N T V A L U E S * ; * ;*************************************************************************** ; ; Constant values. ; $LF = 10. ; The linefeed character. $COLON = 58. ; The : character. $START = 60. ; The < character. $TERM = 62. ; The > character. $TOGGLE = 95. ; The _ character. $REV = 37. ; The % character. $BLINK = 126. ; The ~ character. $UND = 94. ; The ^ character. PAGE ;*************************************************************************** ; * ; I M P U R E A R E A * ; * ;*************************************************************************** ; .OFINI .OFDEF QT.FLG, 4 ; Flags. QT$OFF = 1 ; Turn screen off then on. QT$CLR = 2 ; Clear screen first. .OFDEF QT.HIL, 1 ; Highlight toggle character value. .OFDEF QM.HIL, 1 ; Current highlight mode. .OFDEF QT.REV, 1 ; Reverse toggle character value. .OFDEF QM.REV, 1 ; Current reverse mode. .OFDEF QT.BLN, 1 ; Blink toggle character value. .OFDEF QM.BLN, 1 ; Current blink mode. .OFDEF QT.UND, 1 ; Underline toggle character value. .OFDEF QM.UND, 1 ; Current underline mode. .OFSIZ S..IMP ; Size of impure area. ;*************************************************************************** ; * ; Q T Y P E * ; * ;*************************************************************************** ; ; Throughout: ; ; A0 = Indexes JCB. ; D0 = Characters processed. ; D3 = Intensity status. ; D4 = Cmd/Do file Status ; QTYP: PHDR -1,0,PH$REE!PH$REU!PH$ILC ; input lower case. GETIMP S..IMP, A5 ; Get impure area. ; Preset default values. ; MOVB #$TOGGLE, QT.HIL(A5) ; Preset highlight char. MOVB #$REV, QT.REV(A5) ; Preset reverse. char. MOVB #$BLINK, QT.BLN(A5) ; Preset blink char. MOVB #$UND, QT.UND(A5) ; Preset underline char. BYP ; Bypass leading junk. LIN ; End of line? JEQ HELP.EM ; Yes.. CALL CHECK.SWITCHES ; Check for switches. BYP CMPB @A2, #$COLON ; Preceded by colon. JNE QTYPE.START.ERROR ; Tell em error. CMPB 1(A2), #$START ; Preceded by char. BNE 10$ ; No..let em by anyways. INC A2 ; Bump past ":". 10$: INC A2 ; Bump pointer. CLR D3 ; Preclear toggle flag. CLR D4 ; Preclear JOBCMS save status flags. 15$: JOBIDX A0 ; Index this job. TSTW JOBCMZ(A0) ; In a command file? BEQ 20$ ; No.. MOVW JOBCMS(A0), D4 ; Save jobcms status flag. BCLR #, JOBCMS(A0) ; And make sure silent is off. 20$: MOV QT.FLG(A5), D7 ; Get flags. AND #QT$OFF, D7 ; Screen off and on switch? BEQ 25$ ; No.. MOVW #<-1_8.+36.>, D1 ; Set screen off TCRT 25$: MOV QT.FLG(A5), D7 ; Get flags. AND #QT$CLR, D7 ; Clear screen first? BEQ 28$ ; No.. MOVW #<-1_8.+0>, D1 ; Set clear screen. TCRT ; Do it. 28$: CALL FLIP.IT ; Preset low intensity. ; This processes the QTYPE command line as a .CMD/.DO file has already ; consumed this much. ; 30$: TSTB @A2 ; End of buffer? just in case. JEQ QTYPE.FINISH ; Yes..exit. CALL DO.CHAR ; Do character. JNE QTYPE.FINISH ; Must be finished. CMPB D1, #$LF ; Was last char a LF? BNE 30$ ; No..try again. ; Here we process other lines of data after the command line prompt ; from a .CMD file or a .DO file until the > terminator character or the ; end of the cmd/do file. ; JOBIDX A0 ; Index the job. TSTW JOBCMZ(A0) ; In command file? JEQ QTYPE.FINISH ; No..never mind. MOV JOBBAS(A0), A2 ; Get job base address. ADD JOBSIZ(A0), A2 ; Get size of memory. MOV A2, A1 ; Save end of memory. CLR D6 ; Preclear. MOVW JOBCMZ(A0), D6 ; Get size of command file. SUB D6, A2 ; Offset to remaining cmd file info. CLR D0 ; Preclear counter. 40$: CMP A2, A1 ; At or past job memory? BHIS 90$ ; Yes..must have forgot > terminator. TSTB @A2 ; Any characters? BEQ 90$ ; No..quit. CALL DO.CHAR ; Do character. BEQ 40$ ; Try for another. 90$: CLR D6 ; Preclear MOVW JOBCMZ(A0), D6 ; Size of cmd/do file. Just in case. CMP D0, D6 ; Size of cmd/do => chars processed? BLOS 99$ ; Yes..all ok. MOV D6, D0 ; Nope..set max JOBCMZ size. 99$: SUBW D0, JOBCMZ(A0) ; Offset Cmd/do file size by the ; number of chars processed. ;;; BR QTYPE.FINISH ; And finish up. ;***************** ; QTYPE.FINISH: * ;***************** ; Finished ; Note - We do not automatically exit with high intensity set ; just in case other standard cmd/do file text output processing ; is to occur after QTYPE is used and the user wants it in low ; intensity or for whatever purpose. To ensure that high intensity ; is on after processing QTYPE text make sure that the correct. ; toggle situation is at hand. (Example:) ; ; high low high low high ; v v v v v ; QTYPE :<_Start High_, then low _and_ exit high_> ; Exits high. ; QTYPE :<_Start High_, then low _and_ exit low> ; Exits low. ; ^ ^ ^ ^ ; high low high low ; QTYPE.FINISH: MOV QT.FLG(A5), D7 ; Get flags. AND #QT$OFF, D7 ; Turn screen off & on? BEQ 10$ ; No.. MOVW #<-1_8.+37.>, D1 TCRT 10$: ANDW #C.SIL, D4 ; Was job in CMD/DO and silent set? BEQ 99$ ; No..never mind. JOBIDX A0 ; Yes..index job. BSET #C%SIL, JOBCMS(A0) ; And turn silent back on. 99$: EXIT ;********************* ; QTYPE.START.ERROR * ;********************* ; Start up error. ; QTYPE.START.ERROR: CRLF HTYPE MOVB #$START, D1 TTY HTYPE < in _QTYPE_ command._> CRLF JMP QTYPE.FINISH PAGE ;*********************+ ; DO.CHAR * ;*********************+ ; Processes a character at @A2 and outputs it or checks for toggle status. ; ; ; Incoming/dependencies: ; ; A2 => Indexes current input buffer location or ; or in memory command or do file text location. ; D0 =: Current characters processed count. ; D3 =: Current toggle status. ; ; Outgoing/Side effects: ; ; D0 =: Bump character count. ; D1 =: Current character from buffer or command/do file. ; A2 -> Indexes new buffer location. ; ; Z-bit SET if processing was all ok. (BEQ) ; Z-bit CLEAR if terminator character found. (BNE) ; ; D6, D7 are destroyed. ; DO.CHAR: MOV #-1, D6 ; Preset error condition. MOVB (A2)+, D1 ; Yes..get the character. INC D0 ; Bump char counter. CMPB D1, #$TERM ; Is this a terminator? BEQ 99$ ; Yes..then we are finished. CMPB D1, QT.HIL(A5) ; Is this a toggle character? BNE 10$ ; No.. CALL FLIP.IT ; Yes..flip insensity. BR 40$ ; Finish routine. 10$: CMPB D1, QT.REV(A5) ; Is this reverse? BNE 12$ CALL DO.REVERSE BR 40$ 12$: CMPB D1, QT.BLN(A5) BNE 15$ CALL DO.BLINK BR 40$ 15$: CMPB D1, QT.UND(A5) BNE 30$ CALL DO.UNDERLINE BR 40$ 30$: TTY ; Output character. 40$: MOV #0, D6 ; Set ok 99$: TST D6 ; Test condtion. RTN ; Return to caller. PAGE ;*********************+ ; FLIP.IT * ;*********************+ ; Flips terminal intensity from low to high or high to low. ; ; Incoming/dependencies: ; ; D3 =: Current intensity flag. ; 0 = currently high ; -1 = currently low. ; ; Outgoing/Side effects: ; ; D7 is destroyed. ; ; All other standard (A0-A5,D0-D5) registers are preserved. ; FLIP.IT: PUSH D1 ; Save character. MOVW #<-1_8.+12.>, D1 ; Preset high intensity. TSTB D3 ; In high intensity mode? BMI 10$ ; No..must be low. MOVB #11., D1 ; Yes..set low intensity. 10$: TCRT ; Toggle intensity. COMB D3 ; And toggle flag. POP D1 ; Restore character. RTN ; Return to caller. ;************* ; DO.TOGGLE * ;************* ; Processes toggle switching for all status. ; ; Incoming: ; D1 = byte = attribute on value. ; D2 = current status ; Outgoing: ; D2 = toggled value to store. ; DO.TOGGLE: ORW #<-1_8.>, D1 TSTB D2 ; Is it on? BEQ 10$ ; No.. ADDB #1, D1 ; Bump to off. 10$: TCRT ; Output it. COMB D2 ; Toggle value. RTN ;************** ; DO.REVERSE * ;************** ; Processes toggle value for Reverse status. ; DO.REVERSE: PUSH D1 ; Save d1 MOVB QM.REV(A5), D2 ; Set reverse toggle. MOVB #32., D1 ; Set on value. CALL DO.TOGGLE ; Do it. MOVB D2, QM.REV(A5) ; Reset new condition. POP D1 ; Restore d1 RTN ; Return to caller. ;************ ; DO.BLINK * ;************ ; Processes toggle value for Blink status. ; DO.BLINK: PUSH D1 ; Save d1 MOVB QM.BLN(A5), D2 ; Set Blink toggle. MOVB #21., D1 ; Set on value. CALL DO.TOGGLE ; Do it. MOVB D2, QM.BLN(A5) ; Reset new condition. POP D1 ; Restore d1 RTN ; Return to caller. ;**************** ; DO.UNDERLINE * ;**************** ; Processes toggle value for Underline status. ; DO.UNDERLINE: PUSH D1 ; Save d1 MOVB QM.UND(A5), D2 ; Set underline toggle. MOVB #30., D1 ; Set on value. CALL DO.TOGGLE ; Do it. MOVB D2, QM.UND(A5) ; Reset new condition. POP D1 ; Restore d1 RTN ; Return to caller. ;****************** ; CHECK.SWITCHES * ;****************** ; Process command line switches. ; CHECK.SWITCHES: 10$: BYP ; Bypass junk. LIN ; End of line? BEQ 99$ ; Yes..finito. CMPB @A2, #'/ ; Switch option? BNE 99$ ; Nope..finito. INC A2 ; Yes..bump pointer. BYP ; Bypass junk. MOVB @A2, D1 ; Get character. UCS D1 ; Upper case it. MOVB D1, @A2 ; Put it back. LEA A6, SWITCH ; Index switches. 30$: TSTB @A6 ; End of table? BMI 99$ ; Yes..must be a mistake. CMMB @A6, @A2 ; Do we match table? BEQ 50$ ; Yes..process it. ADDW #4, A6 ; No..bump to next entry. BR 30$ ; And try again. 50$: ADD #2, A6 ; Offset to correct address. ADDW @A6, A6 ; Add offset. CALL @A6 ; Call routine. BNE 99$ ; Opps...error. BR 10$ ; Ok..try for more. 99$: RTN ; Return to caller. ; Errors will be processed as text. ;********** ; SWITCH * ;********** ; Table of switches. ; SWITCH: BYTE 'H,0 ; Highlight switch. OFFSET H.SWITCH ; Highlight routine. BYTE 'R,0 ; Reverse switch. OFFSET R.SWITCH ; Reverse routine. BYTE 'B,0 ; Blink switch. OFFSET B.SWITCH ; Blink routine. BYTE 'U,0 ; Underline switch. OFFSET U.SWITCH ; Underline routine. BYTE 'O,0 ; Screen off/on switch. OFFSET O.SWITCH ; Screen off/on routine. BYTE 'C,0 ; Clear screen switch. OFFSET C.SWITCH ; Clear screen routine. BYTE -1 ; End of table. EVEN ; Even up assembly. ;************ ; H.SWITCH * ;************ ; Highlight switch routine. ; H.SWITCH: CALL BYPASS ; Bypass to entry. BNE 99$ ; Opps..mistake. MOVB (A2)+,QT.HIL(A5) ; Set alternate highlight character. LCC #PS.Z ; Set ok. 99$: RTN ; Return to caller. ;************ ; R.SWITCH * ;************ ; Reverse switch routine. ; R.SWITCH: CALL BYPASS ; Bypass to entry. BNE 99$ ; Opps..mistake. MOVB (A2)+, QT.REV(A5) ; Set alternate reverse character. LCC #PS.Z ; Set ok. 99$: RTN ; Return to caller. ;************ ; B.SWITCH * ;************ ; Blink switch routine. ; B.SWITCH: CALL BYPASS ; Bypass to character. BNE 99$ ; Opps..mistake. MOVB (A2)+, QT.BLN(A5) ; Set alternate blink character. LCC #PS.Z ; Set ok. 99$: RTN ; Return to caller. ;************ ; U.SWITCH * ;************ ; Underline switch routine. ; U.SWITCH: CALL BYPASS ; Bypass to character. BNE 99$ ; Opps..mistake. MOVB (A2)+, QT.UND(A5) ; Set alternate underline character. LCC #PS.Z ; Set ok. 99$: RTN ; Return to caller. ;************ ; O.SWITCH * ;************ ; Screen off/on switch routine. ; O.SWITCH: INC A2 ; Bump pointer. OR #QT$OFF, QT.FLG(A5) ; Set on/off flag. LCC #PS.Z ; Set ok. RTN ; Return to caller. ;************ ; C.SWITCH * ;************ ; Clear screen switch routine. ; C.SWITCH: INC A2 ; Bump pointer. OR #QT$CLR, QT.FLG(A5) ; Set clear screen flag. LCC #PS.Z ; Set ok. RTN ; Return to caller. ;************ ; BYPASS * ;************ ; Bypass = sign and/or get to alternate character. ; BYPASS: MOV #1, D6 ; Preset error. LIN ; End of line? BEQ 99$ ; Yes..error. INC A2 ; Bump pointer. BYP ; Bypass junk. LIN ; End of line? BEQ 99$ ; Yes..error. CMPB @A2, #'= ; At an = sign? BNE 10$ ; Nope..must have forgotten it. INC A2 ; Yes..bump pointer. 10$: BYP ; Bypass junk. LIN ; End of line? BEQ 99$ ; Yes..error. CLR D6 ; No..set ok. 99$: TST D6 ; Test condition. RTN ; Return to caller. ;********* ; HTYPE * ;********* ; Highlight text process for terminal output for help and error messages. ; Called from HTYPE macro. ; HTYPE: TSTB @A2 ; End of text? BEQ 99$ ; Yes..exit routine. CALL DO.CHAR ; Do character processing. BEQ HTYPE ; And try again. 99$: RTN ; Return to caller. ;*********** ; HELP.EM * ;*********** ; Provide help for the innocent. ; HELP.EM: CRLF HTYPE MOVB #'/, D1 TTY HTYPE <_switches_}_ :> MOVB #$START, D1 TTY TYPE < Output > MOVB #$TOGGLE, D1 TTY TYPE MOVB #$TOGGLE, D1 TTY TYPE <, low intensity > MOVB #$TOGGLE, D1 TTY TYPE MOVB #$TOGGLE, D1 TTY TYPE <.> MOVB #$TOGGLE, D1 TTY TYPE <> MOVB #$TERM, D1 TTY CRLF CRLF HTYPE < Use in place of the standard _:> MOVB #$START, D1 TTY HTYPE < text output command in> CRLF HTYPE < _.CMD_ or _.DO_ files. _Text_ can consist of _multiple_> HTYPE < lines just as> CRLF HTYPE < standard _.CMD_ or _.DO_ files process text with the _> MOVB #$TERM, D1 TTY HTYPE < character as> CRLF HTYPE < the text terminator.> CRLF CRLF HTYPE CRLF TYPE < > MOVB #'/, D1 TTY HTYPE <_H_=_char_ Change default HIGHLIGHT toggle charcter to _char_.> CRLF TYPE < > MOVB #'/, D1 TTY HTYPE <_B_=_char_ Change default BLINK toggle charcter to _char_.> CRLF TYPE < > MOVB #'/, D1 TTY HTYPE <_R_=_char_ Change default REVERSE toggle charcter to _char_.> CRLF TYPE < > MOVB #'/, D1 TTY HTYPE <_U_=_char_ Change default UNDERLINE toggle charcter to _char_.> CRLF TYPE < > MOVB #'/, D1 TTY HTYPE <_O_ Turn Screen _OFF_ before processing and _ON_ when finished.> CRLF TYPE < > MOVB #'/, D1 TTY HTYPE <_C_ Clear screen before processing.> CRLF HTYPE < _:> MOVB #$START, D1 TTY HTYPE < = the _lead-in_ characters for _text_ output.> CRLF HTYPE < _> MOVB #$TOGGLE, D1 TTY HTYPE < = the toggle character to turn crt intensity _on_ or _off_.> CRLF HTYPE < _> MOVB #$REV, D1 TTY HTYPE < = the toggle character to turn REVERSE _on_ or _off_.> CRLF HTYPE < _> MOVB #$UND, D1 TTY HTYPE < = the toggle character to turn UNDERLINE _on_ or _off_.> CRLF HTYPE < _> MOVB #$BLINK, D1 TTY HTYPE < = the toggle character to turn BLINK _on_ or _off_.> CRLF HTYPE < _> MOVB #$TERM, D1 TTY HTYPE < = the _terminator_ character for _text_ output._> CRLF CRLF EXIT END END .