	.PAGE
	.TITLE	SETUPV	A subroutine to "On control_V then display info"

;	This program was written by Matt Matthews for ManTech International
;	Corporation and DECUS. All rights are reserved. Reproduction by
;	DECUS is authorized providing that this information is included.

	.PAGE
	.SUBTITLE	DESCRIPTION
;
;	This subroutine takes two arguments:
;		Starting address  of the data to be displayed (by reference),
;		Length (in bytes) of the data to be displayed (by reference).
;
;	First, we create the output descriptor. Then, setup the ^V ast.
;	The ast routine writes the data to sys$output and sets up the ^V ast 
;	again.
;
	.PAGE
	.SUBTITLE	Data

OUTPUT_D:
OUTPUT_LEN:
	.BLKW		1
	.BYTE		^XE
	.BYTE		^X1
OUTPUT_ADDRESS:
	.BLKA		1

VMASK:
	.LONG		0
;			  NABCDEFGHIJKLMNOPQRSTUVWXYZ
;	.LONG		^B00000000000000000000001000000000
;			       ZYXWVUTSRQPONMLKJIHGFEDCBAN
	.LONG		^B00000000010000000000000000000000

OUTPUT_ARGLIST:
	.LONG		1
	.ADDRESS	OUTPUT_D

SYS_INPUT_D:
	.ASCID		/SYS$INPUT/

INPUT_CHAN:
	.BLKW		1

	.PAGE
	.SUBTITLE	Main Line
	.ENTRY		SETUPV,^M<>


	JSB		ASSIGN_CHAN
	JSB		CREATE_DESC
	JSB		SET_AST
	RET

	.PAGE
	.SUBTITLE	Build Descriptor

CREATE_DESC:

	MOVW		@8(AP), OUTPUT_LEN

	MOVL		4(AP),  OUTPUT_ADDRESS

	RSB

	.PAGE
	.SUBTITLE	Set up ^V ast

ASSIGN_CHAN:

	$ASSIGN_S	DEVNAM = SYS_INPUT_D,-
			CHAN   = INPUT_CHAN

	RSB

SET_AST:

	$QIOW_S		FUNC   = #IO$_SETMODE!IO$M_OUTBAND,-
			CHAN   = INPUT_CHAN,-
			P1     = TERM_DISPLAY,-
			P2     = #VMASK,-
			P3     = #^D3

	RSB

	.PAGE
	.SUBTITLE	AST ROUTINE
	.ENTRY		TERM_DISPLAY,^M<>

	CALLG		OUTPUT_ARGLIST,-
			G^LIB$PUT_OUTPUT

;	JSB		SET_AST

	RET

	.END
