OpenVMS Source Code Demos

DEVICE_CONTROLS.INC

	%NOLIST
	%NOCROSS
	!+
	!==================================================
	! Device Control Codes
	!==================================================
	! Title    : Device Control Codes
	! Author   : Neil Steven Rieck
	! Created  : 1987.05.01
	! Objective: Create a uniform method for controlling terminal
	!	     hardware from within a BASIC program
	! Notes    :
	!
	! 1. Use "%include "[.inc]csmis$inc:Device_Controls.inc"" to reference these
	!    control codes from your program
	! 2. Since these codes are declared as STRING CONSTANTS, codes that you
	!    don't reference will -NOT- be included in the compiled program
	!    (At least for VAX BASIC version 3.0)
	!
	! History:
	!
	! Ver Who When    What
	! --- --- ------- ----
	! 1.0 NSR 87.0501 1. Original VT220 & LA50 code
	! 1.1 NSR 87.0519 1. Removed underscores from VT$Print_xx
	!                 2. Removed SGR from LA$SGRxxx
	!                 3. Added VT$Clear?? & VT$Print?? synonyms
	! 1.2 NSR 87.0612 1. Appended VT$ClearLine to VT$Error
	! 1.3 NSR 87.0629 1. Added VT line attributes
	! 1.4 NSR 87.1009 1. Appended <bell> to VT$Error
	!		  2. Added VT$Message ( VT$Error without <bel> )
	! 1.5 NSR 88.0105 1. Added VT$SaveCursor & VT$RestoreCursor
	!		     (the possibilities are now endless)
	!		  2. Added VT$Save & VT$Restore synonyms
	! 1.6 NSR 88.0107 1. added VT$KeyLock & VT$KeyUnLock
	!		  2. added VT$132 & VT$80
	! 1.7 NSR 88.0226 1. Changed all VT$Erase to VT$Clear
	!		  2. Changed VT$CPrint... to VT$Printer...
	!		  3. Changed VT$APrint... to VT$DualOut...
	!		  4. Removed VT$Prefix & LA$Prefix synonyms
	!		  5. Removed VT$PrintOn & VT$NoPrint synonyms
	!		  6. Removed VT$Save & VT$Restore synonyms
	!		  7. Removed VT$ClearScreen synonym
	! 1.8 NSR 89.0529 1. added 4 cursor control codes
	! 1.9 NSR 89.0712 1. added key pad mode commands
	! 2.0 NSR 91.1129 1. added vt$AutoWrap + vt$NoAutoWrap
	!     AGD 95.0427 1. Added vt$cursor_on vt$cursor_off
	!==================================================
	!-
	!+
	!==================================================
	!  Control Code Prefixes
	!==================================================
	!
	! Note: At some future date we may setup the VT220 terminals in
	! VT200 mode.  To do this, change the value of 'VT$Pfx' as follows...
	!
	!	from:	ESC+'['	{ escape followed by open square bracket }
	!	to:	CSI	{ an 8 bit escape with the sign bit set }
	!
	! The terminal driver must be set to 'EIGHTBIT' so we would probably
	! use 'SET TERM/INQUIRE' from within 'LOGIN.COM'.  Constant 'LA$Pfx'
	! would probably not change.
	!-
	declare string constant						&
		CSI	= '155'C  ,	! VT200 mode prefix		&
		VT$Pfx	= esc+'[' ,	! VT100 family prefix		&
		LA$Pfx	= esc+'['	! LA50 prefix
	!+
	!==================================================
	! VT220 Device Control Codes
	!==================================================
	! printer port control (page 28+29, 'VT220 Programmer Pocket Guide')
	!-
	declare string constant						&
		VT$PrinterOn	= VT$Pfx+'5i'  , ! controller on	&
		VT$PrinterOff	= VT$Pfx+'4i'  , ! controller off	&
		VT$DualOutOn	= VT$Pfx+'?5i' , ! auto on		&
		VT$DualOutOff	= VT$Pfx+'?4i' , ! auto off		&
		VT$ScreenPrint	= VT$Pfx+'i'     ! screen print
	!+
	! Terminal Modes (page 21, 'VT220 Programmer Pocket Guide')
	!-
	declare string constant						&
		VT$KeyLock	= VT$Pfx+'2h'  , ! keyboard lock	&
		VT$KeyUnLock	= VT$Pfx+'2l'  , ! keyboard un-lock	&
		VT$132		= VT$Pfx+'?3h' , ! 132 column		&
		VT$80		= VT$Pfx+'?3l' , !  80 column		&
		VT$AutoWrap	= VT$Pfx+'?7h' , ! auto wrap		&
		VT$NoAutoWrap	= VT$Pfx+'?7l'   ! no auto wrap
	!+
	! Select Graphic Rendition (page 24, 'VT220 Programmer Pocket Guide')
	!-
	declare string constant						&
		VT$Cursor_on    = VT$Pfx+'?25h', ! text cursor on	&
		VT$Cursor_off   = VT$Pfx+'?25l', ! text cursor off	&
		VT$Normal	= VT$Pfx+'0m'  , ! attributes off	&
		VT$Bright	= VT$Pfx+'1m'  , ! bright		&
		VT$Under	= VT$Pfx+'4m'  , ! underline		&
		VT$Flash	= VT$Pfx+'5m'  , ! flash		&
		VT$Reverse	= VT$Pfx+'7m'  , ! reverse video	&
		VT$NoBright	= VT$Pfx+'22m' , ! no bright		&
		VT$NoUnder	= VT$Pfx+'24m' , ! no Underline		&
		VT$NoFlash	= VT$Pfx+'25m' , ! no flash		&
		VT$NoReverse	= VT$Pfx+'27m'   ! no reverse
	!+
	! line erasing  (page 26, 'VT220 Programmer Pocket Guide')
	!-
	declare string constant						&
		VT$ClearEOL	= VT$Pfx+'0K' , ! to End		&
		VT$ClearBOL	= VT$Pfx+'1K' , ! to Beginning		&
		VT$ClearLine	= VT$Pfx+'2K'   ! whole
	!+
	! screen erasing (page 26, 'VT220 Programmer Pocket Guide')
	!-
	declare string constant						&
		VT$ClearEOS	= VT$Pfx+'0J' , ! to End		&
		VT$ClearBOS	= VT$Pfx+'1J' , ! to Beginning		&
		VT$Clear	= VT$Pfx+'2J'	! whole
	!+
	! line attributes (page 25, 'VT220 Programmer Pocket Guide')
	!-
	declare string constant					&
		VT$SingleWidth		=	esc+'#5' ,	&
		VT$DoubleWidth		=	esc+'#6' ,	&
		VT$DoubleHeightTop	=	esc+'#3' ,	&
		VT$DoubleHeightBottom	=	esc+'#4'
	!+
	! cursor positioning (page 23, 'VT220 Programmer Pocket Guide')
	!-
	declare string constant					&
		VT$SaveCursor		=	esc+'7' ,	&
		VT$RestoreCursor	=	esc+'8'
	!+
	! cursor motion (page 22, 'VT220 Programmer Pocket Guide')
	!-
	declare string constant					&
		VT$CursUp		=	VT$Pfx + '1A' ,	&
		VT$CursDown		=	VT$Pfx + '1B' ,	&
		VT$CursRight		=	VT$Pfx + '1C' ,	&
		VT$CursLeft		=	VT$Pfx + '1D'
	!+
	! keypad mode (page 21, 'VT220 Programmer Pocket Guide')
	!-
	declare string constant					&
		VT$KeyPadApp		=	esc + '=',	&
		VT$KeyPadNum		=	esc + '>'
	!+
	!==================================================
	!  LA50 Device Control Codes
	!==================================================
	! Printer Horizontal Pitch (LA$HP)
	! (page 31, 'LA50 Programmer Reference Manual')
	!-
	declare string constant						&
		LA$HP10	= LA$Pfx+'0w' , ! 10	char/inch		&
		LA$HP12	= LA$Pfx+'2w' , ! 12	char/inch		&
		LA$HP16	= LA$Pfx+'4w' , ! 16.5	char/inch		&
		LA$HP5	= LA$Pfx+'5w' , !  5	char/inch		&
		LA$HP6	= LA$Pfx+'6w' , !  6	char/inch		&
		LA$HP8	= LA$Pfx+'8w'   !  8.25	char/inch
	!+
	! Printer Vertical Pitch (LA$VP)
	! (page 33, 'LA50 Programmer Reference Manual')
	!-
	declare string constant						&
		LA$VP6	= LA$Pfx+'0z' , !  6 char/inch			&
		LA$VP12	= LA$Pfx+'2z' , !  8 char/inch			&
		LA$VP16	= LA$Pfx+'3z' , ! 12 char/inch			&
		LA$VP2	= LA$Pfx+'4z' , !  2 char/inch			&
		LA$VP3	= LA$Pfx+'5z' , !  3 char/inch			&
		LA$VP4	= LA$Pfx+'6z'   !  4 char/inch
	!+
	! Select Graphic Rendition
	! (page 39, 'LA50 Programmer Reference Manual')
	!-
	declare string constant						&
		LA$Normal	= LA$Pfx+'0m'  , ! normal		&
		LA$Bold		= LA$Pfx+'1m'  , ! bold on		&
		LA$Under	= LA$Pfx+'4m'  , ! underline		&
		LA$NoBold	= LA$Pfx+'22m' , ! no bold		&
		LA$NoUnder	= LA$Pfx+'24m'   ! no underline
	!+
	!==================================================
	! Common synonyms defined for general use
	!==================================================
	!-
	declare string constant						&
		VT$Home		= VT$Pfx+'1;1H'			     ,	&
		VT$Error	= VT$Pfx+'24;1H'+ bel + VT$ClearLine ,	&
		VT$Message	= VT$Pfx+'24;1H'+ VT$ClearLine	     ,	&
		VT$Command	= VT$Pfx+'23;1H'+ VT$ClearLine
	%LIST
	%CROSS

Back to Home
Neil Rieck
Waterloo, Ontario, Canada.