Google
 

Trailing-Edge - PDP-10 Archives - bb-d868e-bm_tops20_v41_2020_dist_1of2 - 4-1-sources/makvfu.mac
There are 30 other files named makvfu.mac in the archive. Click here to see a list.
;<5.UTILITIES>MAKVFU.MAC.2, 28-Oct-81 15:23:25, EDIT BY GRANT
;Change major version to 5
; UPD ID= 309, FARK:<4-WORKING-SOURCES.UTILITIES>MAKVFU.MAC.2,   3-Dec-80 13:05:24 by ZIMA
;Edit 4 - add MAKVF7 functionality to MAKVFU
;<4.UTILITIES>MAKVFU.MAC.3,  3-Jan-80 15:26:02, EDIT BY R.ACE
;UPDATE COPYRIGHT DATE
;<4.UTILITIES>MAKVFU.MAC.2, 10-Mar-79 14:12:49, EDIT BY KONEN
;UPDATE COPYRIGHT FOR RELEASE 4
;<4.UTILITIES>MAKVFU.MAC.2, 23-Jan-79 10:42:48, Edit by KONEN
;UPDATE VERSION NUMBER FOR RELEASE 4
TITLE MAKVFU - PROGRAM TO GENERATE BINARY VFU FILES



;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1976,1977,1978,1979,1980 BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

	SEARCH MONSYM,MACSYM
	.REQUIRE SYS:MACREL
	sall
	IFDEF .PSECT,<
	.DIRECT FLBLST>
	IFNDEF .PSECT,<
	.DIRECT .XTABM>

;DEFINITIONS

A==1
B==2
C==3
D==4
PNT==5
W==6
W1==7
W2==10
W3==11
P==17

; VERSION INFORMATION

VMAJOR==5		;MAJOR VERSION
VMINOR==0		;MINOR VERSION
VWHO==0			;WHO LAST EDITED (0=DEC DEVELOPMENT)
VEDIT==^D4		;EDIT NUMBER

VMAKVF== <VWHO>B2+<VMAJOR>B11+<VMINOR>B17+VEDIT

;TXTPTR- MACRO TO SET UP BYTE POINTER TO A STRING

	DEFINE TXTPTR (MSG) <POINT 7,[ASCIZ/MSG/]>
;**;[4] Add 3 lines at INILPP== -1L	JGZ	30-NOV-80
LPI6==354		;[4] LP07 CONTROL BYTE FOR 6 LINES/INCH
LPI8==355		;[4] LP07 CONTROL BYTE FOR 8 LINES/INCH
LPIX==356		;[4] CONTROL BYTE TO LEAVE LPI ALONE (REQUIRED FOR LP14)
INILPP==^D66		;INITIAL DEFAULT LINES/PAGE
NCHPW==5		;NUMBER OF ASCII CHARACTERS PER WORD
BUFSIZ==200		;SIZE OF INPUT TEXT BUFFER
ATMSIZ==200		;SIZE OF ATOM BUFFER
GJFSIZ==.GJRTY+2	;SIZE OF GTJFN BLOCK FOR COMND JSYS
MAXLIN==^D143		;MAXIMUM LINES IN VFU
MAXCHN==^D12		;MAX CHANNEL NUMBER
PDLN==50


PDL:	BLOCK PDLN		;PUSH DOWN LIST
CMDBLK:	BLOCK .CMGJB+5		;COMMAND STATE BLOCK FOR COMND JSYS
ATMBFR:	BLOCK ATMSIZ		;ATOM BUFFER
BUFFER:	BLOCK BUFSIZ		;INPUT TEXT BUFFER
GJFBLK:	BLOCK GJFSIZ		;GTJFN BLOCK FOR COMND JSYS
CHNBUF:	BLOCK ^D12*<MAXLIN/^D36+1> ;ALLOCATE VFU BIT MASK
CHNMSK:	BLOCK 1			;REMEMBER CHANNELS SPECIFIED
CHANEL:	BLOCK 1			;CURRENT CHANNEL
PAGSIZ:	PAGESZ:	BLOCK 1		;PAGE SIZE
LINPPG:	BLOCK 1			;LINES PER PAGE
VFUBUF:	BLOCK ^D256
MARKW:	BLOCK 1			;REMEMBER IF MARKING WANTED
FORMS:	BLOCK 1			;FORMS BREAK CHANNEL
;**;[4] Add 1 line at FORMS: +1L	JGZ	30-NOV-80
LPI:	BLOCK	1		;[4] CONTROL BYTE FOR 6/8/LEAVE ALONE LPI
ENDZRO==.-1

ENTVEC:	JRST START
	JRST START
	VMAKVF

PROMPT:	ASCIZ /MAKVFU>/

;**;[4] Add LINES-PER-INCH at HLPTXT: +12L	JGZ	30-NOV-80
HLPTXT: ASCIZ /
Commands are:

EXIT		Return to command language
CHANNEL 	Specifies line or lines on which a channel will stop.
		Arguments are: ALL,LINES,EVERY.
FORMS-BREAK	SPecifies the channel or channels which will stop on
		the lines in the forms break margin.
MARK		Directs MAKVFU to set any unspecified channel to stop
		at all lines. This is equivalent to "CHANNEL n ALL"
		for each unspecified channel.
INFORMATION	Produces a brief summary of the VFU so far defined.
LINES-PER-INCH	Specifies a lines per inch setting for the LP07 printer.
		Arguments are: 6-LPI, 8-LPI, LEFT-ALONE.
LENGTH		Specifies the physical length of the page. This value
		is defaulted to 66 at start-up time but may be changed
		with this command.
PAGE-SIZE	Specifies the logical length of the page. This parameter
		defines the number of printable lines per page and
		the difference between it and the physical length
		is the forms break margin.
HELP		Produces this text.
/

;COMMAND TABLES

CMDTAB:	ELEV1-.-1,,ELEV1-.-1
	XWD [ASCIZ /CHANNEL/],.CHNL
	XWD [ASCIZ /EXIT/],.EXIT
	XWD [ASCIZ /FORMS-BREAK/],.FORM
	XWD [ASCIZ /HELP/],.HELP
	XWD [ASCIZ /INFORMATION/],.INFO
	XWD [ASCIZ /LENGTH/],.LENTH
;**;[4] Add one line at CMDTAB: +7L	JGZ	30-NOV-80
	XWD [ASCIZ /LINES-PER-INCH/],.LPI ;[4]
	XWD [ASCIZ /MARK/],.MARK
	XWD [ASCIZ /OUTPUT/],.OUTPT
	XWD [ASCIZ /PAGE-SIZE/],.PAGE
ELEV1:
LEV2:	ELEV2-.-1,,ELEV2-.-1
	XWD [ASCIZ /ALL/],.ALL
	XWD [ASCIZ /BOTTOM-OF-FORM/],.BOTOM
	XWD [ASCIZ /EVERY/],EVERY
	XWD [ASCIZ /LINE/],LINES
	XWD [ASCIZ /TOP-OF-FORM/],.TOP
ELEV2:
;**;[4] Add several lines at ELEV2: +1L	JGZ	30-NOV-80
LPITB:	ELPITB-.-1,,ELPITB-.-1	;[4] TABLE SIZE
	XWD [ASCIZ /6-LPI/],LPI6 ;[4]
	XWD [ASCIZ /8-LPI/],LPI8 ;[4]
	XWD [ASCIZ /LEFT-ALONE/],LPIX ;[4]
ELPITB:				;[4] END OF LPI TABLE

START:	RESET			;CLEAN UP
	SETZM CHNBUF		;SET UP TO CLEAR ALL DATA AREAS
	MOVE A,[CHNBUF,,CHNBUF+1]
	BLT A,ENDZRO		;ZAP ALL VULNERABLE DATA
	MOVEI A,INILPP		;ASSUME 66 LINES PER PAGE
	MOVEM A,LINPPG		;SET IT
;**;[4] Add two lines at START: +6L	JGZ	30-NOV-80
	MOVEI A,LPIX		;[4] DEFAULT LINES/INCH
	MOVEM A,LPI		;[4]  IS TO LEAVE SETTING ALONE
	;..
	;..

; COMMAND PARSER AND DISPATCH

	HRROI A,PROMPT		;GET POINTER TO PROMPT STRING
	MOVEM A,CMDBLK+.CMRTY	;PUT RE-TYPE PROMPT POINTER IN STATE BLOCK
	HRROI A,BUFFER		;GET POINTER TO INPUT TEXT BUFFER
	MOVEM A,CMDBLK+.CMPTR	;SAVE POINTER TO COMMAND STRING
	MOVEM A,CMDBLK+.CMBFP	;SAVE POINTER TO START-OF-BUFFER
	MOVE A,[.PRIIN,,.PRIOU] ;GET PRIMARY INPUT,, OUTPUT JFN'S
	MOVEM A,CMDBLK+.CMIOJ	;SAVE PRIMARY JFN'S
	MOVEI A,PARSE1		;GET RE-PARSE ADDRESS
	MOVEM A,CMDBLK+.CMFLG	;SAVE RE-PARSE ADDRESS
	SETZM CMDBLK+.CMINC	;INITIALIZE # OF CHARACTERS AFTER POINTER
	MOVEI A,BUFSIZ*NCHPW	;GET # OF CHARACTERS IN BUFFER AREA
	MOVEM A,CMDBLK+.CMCNT	;SAVE INITIAL # OF FREE CHARACTER POSITIONS
	HRROI A,ATMBFR		;GET POINTER TO ATOM BUFFER
	MOVEM A,CMDBLK+.CMABP	;SAVE POINTER TO LAST ATOM INPUT
	MOVEI A,ATMSIZ*NCHPW	;GET # OF CHARACTERS IN ATOM BUFFER
	MOVEM A,CMDBLK+.CMABC	;SAVE COUNT OF SPACE LEFT IN ATOM BUFFER
PARSE:
COMMAN:	MOVE P,[IOWD PDLN,PDL]	;SET UP STACK
	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMINI)] ;GET FUNCTION DESCRIPTOR BLOCK
	COMND			;INITIALIZE COMMAND SCANNER JSYS

PARSE1:	MOVE A,[GJFBLK,,GJFBLK+1] ;SET UP TO CLEAR GTJFN BLOCK
	SETZM GJFBLK		;CLEAR FIRST WORD OF BLOCK
	BLT A,GJFBLK+GJFSIZ-1	;CLEAR GTJFN BLOCK

	MOVEI A,GJFBLK		;GET ADDRESS OF GTJFN BLOCK
	MOVEM A,CMDBLK+.CMGJB	;STORE POINTER TO GTJFN BLOCK
	MOVEI A,CMDBLK		;GET POINTER TO COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMKEY,,CMDTAB)] ;GET FUNCTION BLOCK
	COMND			;DO INITIAL PARSE
	TXNN A,CM%NOP		;VALID COMMAND ENTERED ?
	JRST PARSE5		;YES, GO DISPATCH TO PROCESSING ROUTINE
	CALL TSTCOL		;GO SEE IF CRLF NEEDED
	TMSG <? MAKVFU: No such MAKVFU command as ">
	MOVE A,CMDBLK+.CMABP	;GET POINTER TO ATOM BUFFER
	PSOUT			;OUTPUT STRING ENTERED BY USER
	TMSG <"
>				;OUTPUT END-OF-MESSAGE
	JRST PARSE		;GO TRY TO GET A COMMAND AGAIN

PARSE5:	HRRZ A,(B)		;GET DISPATCH ADDRESS
	CALL (A)		;PERFORM REQUESTED FUNCTION
	JRST PARSE		;GO PARSE NEXT COMMAND
;DO SPACING

.LENTH:	STKVAR <SPCING>
	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMNOI,,TXTPTR<OF PHYSICAL PAGE IS>)] ;GET FUNCTION
	COMND			;PARSE NOISE WORD
	MOVEI A,CMDBLK		;GET COMMAND STATE BLOCK ADDRESS
	MOVEI B,[FLDDB. (.CMNUM,,^D10,,66)] ;PARSE A DECIMAL NUMBER
	COMND			;GET SPACING
	TXNN A,CM%NOP		;NUMBER PARSED OK ?
	JRST LENTH2		;YES, GO SAVE THE NUMBER AND GET CONFIRMATION
	CALL TSTCOL		;NO, ISSUE CRLF IF NEEDED
	TMSG <MAKVFU: Invalid decimal number ">
	HRROI A,ATMBFR		;GET POINTER TO TEXT JUST ENTERED
	PSOUT			;OUTPUT TEXT JUST ENTERED
	TMSG <" for length
>				;OUTPUT REMAINDER OF MESSAGE
	RET			;RETURN WITH NO ACTION

; HERE ON GETTING A GOOD VALUE FOR THE LENGTH

LENTH2:	MOVEM B,SPCING		;SAVE SPACING
	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMCFM)] ;REQUEST COMMAND CONFIRMATION
	COMND			;GET END OF COMMAND
	TXNE A,CM%NOP		;GOT VALID CONFIRMATION ?
	CALLRET COMER1		;NO, ISSUE MESSAGE AND RETURN

; HERE WITH A GOOD COMMAND - VERIFY THAT A LEGAL SPACING WAS ENTERED

	MOVE A,SPCING		;RESTORE SPACING
	SKIPE A			;GOT A GOOD VALUE?
	CAILE A,MAXLIN		;AND WITHIN PRACTICAL LIMITS?
	JRST SPACER		;NO, GO ISSUE ERROR MESSAGE
	CAMGE A,PAGSIZ		;MUST BE AT LEAST SAME AS LOGICAL SIZE
	JRST SPACER		;NOT
	MOVEM A,LINPPG
	RET			;RETURN TO PARSER

; HERE ON A BAD VALUE FOR SPACING

SPACER:	CALL TSTCOL			;ISSUE CRLF IF NEEDED
	TMSG <? MAKVFU: LENGTH ARGUMENT OUT OF RANGE
>
	RET			;RETURN TO WHENCE WE CAME ...
;**;[4] Add several lines at SPACER: +5L	JGZ	30-NOV-80
;[4] LINES-PER-INCH COMMAND

.LPI:	STKVAR <LPIHLD>		;[4] TO HOLD SETTING FOR CONFIRMATION
	MOVEI A,CMDBLK		;[4] SETUP TO PARSE REST OF COMMAND
	MOVEI B,[FLDDB. (.CMNOI,,TXTPTR<FOR LP07 PRINTER>)] ;[4] GUIDEWORDS
	COMND			;[4] HANDLE GUIDEWORDS
	MOVEI A,CMDBLK		;[4] NOW PARSE SETTING
	MOVEI B,[FLDDB. (.CMKEY,,LPITB,,<LEFT-ALONE>)] ;[4] USE TABLE
	COMND			;[4] PARSE KEYWORD
	TXNN A,CM%NOP		;[4] DID IT PARSE?
	 JRST .LPIOK		;[4] YES, CONTINUE
	CALL TSTCOL		;[4] NO, ISSUE NEW LINE IF NEEDED
	TMSG <? MAKVFU: No such LPI setting> ;[4] GIVE ERROR MESSAGE
	RET			;[4] AND RETURN

.LPIOK:	HRRZ B,0(B)		;[4] GET VALUE ASSOCIATED WITH KEYWORD
	MOVEM B,LPIHLD		;[4] SAVE IT FOR CONFIRMATION
	MOVEI A,CMDBLK		;[4] SETUP CONFIRMATION PARSE
	MOVEI B,[FLDDB. (.CMCFM)] ;[4]
	COMND			;[4] CONFIRM THE COMMAND
	TXNE A,CM%NOP		;[4] DID IT PARSE?
	 CALLRET COMER1		;[4] NO, HANDLE ERROR
	MOVE A,LPIHLD		;[4] YES, GET LPI VALUE
	MOVEM A,LPI		;[4] AND SET IT OFFICIALLY
	RET			;[4] THEN RETURN


;MARK COMMAND

.MARK:	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMNOI,,TXTPTR<UNASSIGNED CHANNELS>)]
	COMND			;PARSE NOISE FIELD
	MOVEI A,CMDBLK		;GET ADDRESS OF COMMANDS STATE BLOCK
	MOVEI B,[FLDDB. (.CMCFM)] ;GET CONFIRMATION FUNCTION
	COMND			;PARSE END OF COMMAND
	TXNE A,CM%NOP		;END OF COMMAND PARSED OK ?
	CALLRET COMER1		;NO, GO ISSUE MESSAGE
	SETOM MARKW		;REMEMBER TO DO MARKING
	RET			;RETURN TO WHENCE WE CAME ...


; INFO COMMAND

.INFO:	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMNOI,,TXTPTR<ABOUT CURRENT VFU>)]
	COMND			;PARSE NOISE
	MOVEI A,CMDBLK		;GET COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMCFM)] ;CONFIRM FUNCTION
	COMND			;PARSE END OF COMMAND
	TXNE A,CM%NOP		;END OF COMMAND PARSED OK ?
	CALLRET COMER1		;NO, ISSUE MESSAGE

; HERE TO OUTPUT INFORMATION

;**;[4] Add several lines at INFO10: +0L	JGZ	30-NOV-80
INFO05:	MOVE A,LPI		;[4] GET LPI SETTING
	CAIN A,LPIX		;[4] STILL AT DEFAULT?
	 JRST INFO10		;[4] YES, DON'T MENTION IT THEN
	TMSG <
LINES-PER-INCH		>	;[4] LEADIN
	MOVE A,LPI		;[4] GET LPI AGAIN
	CAIE A,LPI6		;[4] IS IT 6?
	JRST INFO08		;[4] NO - ASSUME IT MUST BE 8 LPI
	TMSG <6-LPI>		;[4] INFORM
	JRST INFO10		;[4] AND CONTINUE
INFO08:	TMSG <8-LPI>		;[4] INFORM OF 8-LPI

INFO10:	TMSG <
LENGTH			>
	SKIPN B,LINPPG		;HAVE A LENGTH YET?
	MOVEI B,^D66		;NO. GET DEFAULT
	CALL NUMOUT		;AND DISPLAY A NUMBER
	SKIPN B,PAGSIZ		;HAVE A PAGE SIZE YET?
	JRST INFO20		;NO. GO ON
	TMSG <
PAGE SIZE		>
	CALL NUMOUT		;AND OUTPUT IT
INFO20:	SKIPN W2,CHNMSK		;HAVE ANY CHANNELS YET?
	JRST INFO30
	TMSG <
CHANNELS ASSIGNED	>
	CALL NUMS		;OUTPUT NUMBER LIST
INFO30:	SKIPN B,MARKW		;DOING MARKING?
	JRST INFO40		;NO
	TMSG <
MARKING UNASSIGNED CHANNELS>
INFO40:	SKIPN W2,FORMS		;DOING A FORMS CHANNEL?
	RET			;NO. ALL DONE
	TMSG <
FORMS CHANNELS		>
	CALLRET NUMS		;GO OUTPUT THEM

NUMS:	MOVSI W1,-^D12		;DO 12 CHANNELS
	ROT W2,-1		;SKIP 0
INFLOP:	ROT W2,-1		;GET NEXT CHANNEL
	JUMPGE W2,INFLO1	;NOT SET
	MOVEI B,1(W1)		;GET CHANNEL NUMBER
	CALL NUMOUT		;AND DISPLAY IT
	MOVEI A," "
	PBOUT			;MAKE IT LOOK NICE
INFLO1:	AOBJN W1,INFLOP		;DO ALL CHANNELS
	RET			;AND DONE
;FORM COMMAD TO DEFINE FORMS BREAK CHANNEL

.FORM:	STKVAR <FRMNUM>
	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMNOI,,TXTPTR<IS>)] ;GET FUNCTION
	COMND			;PARSE NOISE WORD
	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMNUM,,^D10)] ;GET DECIMAL NUMBER
	COMND			;PARSE NUMERIC ARGUMENT
	TXNE A,CM%NOP		;NUMBER PARSED OK ?
	JRST NOFRM		;NO, GO ISSUE ERROR MESSAGE
	MOVEM B,FRMNUM		;SAVE NUMBER ENTERED
	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMCFM)] ;GET CONFIRMATION FUNCTION
	COMND			;PARSE END OF COMMAND
	TXNE A,CM%NOP		;END OF COMMAND PARSED OK ?
	CALLRET COMER1		;NO, GO ISSUE ERROR MESSAGE

; HERE WITH A VALID NUMBER

	MOVE A,FRMNUM		;RESTORE NUMBER ENTERED BY USER
	SKIPE A			;IN RANGE?
	CAILE A,^D12		;STILL?
	JRST BADFRM		;INVALID VALUE GIVEN
	MOVEI B,1		;GET A BIT
	LSH B,0(A)		;POSITION IT
	IORM B,FORMS		;REMEMBER THIS CHANNEL
	RET			;RETURN TO WHENCE WE CAME ...

; HERE IF NUMBER NOT PARSED OK

NOFRM:	CALL TSTCOL		;ISSUE NEW LINE IF NEEDED
	TMSG <? MAKVFU: Invalid decimal number entered
>				;OUTPUT MESSAGE
	RET			;RETURN

; HERE IF NUMBER ENTERED IS OUT OF RANGE

BADFRM:	CALL TSTCOL		;ISSUE NEW LINE IF NEEDED
	TMSG <MAKVFU: CHANNEL OUT OF RANGE
>
	RET			;RETURN TO WHENCE WE CAME ...
;DO PAGE SIZE

.PAGE:	STKVAR <PAGELN>
	MOVEI A,CMDBLK		;GET COMMAND STATE BLOCK ADDRESS
	MOVEI B,[FLDDB. (.CMNOI,,TXTPTR<IS>)] ;GET FUNCTION
	COMND			;PARSE NOISE WORD
	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMNUM,,^D10)] ;GET FDB ADDRESS FOR NUMBER INPUT
	COMND			;PARSE DECIMAL PAGE SIZE
	TXNN A,CM%NOP		;NUMBER PARSED OK ?
	JRST PAGE05		;YES, GO ON AND SAVE THE PAGE SIZE
	CALL TSTCOL		;NO, ISSUE CRLF IF NEEDED
	TMSG <? MAKVFU: Invalid decimal number entered for page size
>				;OUTPUT MESSAGE
	RET			;RETURN

; HERE WITH A VALID PAGE SIZE - SAVE IT AND PARSE END OF COMMAND

PAGE05:	MOVEM B,PAGELN		;SAVE SIZE ENTERED
	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMCFM) ] ;GET CONFIRMATION FUNCTION
	COMND			;PARSE END OF COMMAND
	TXNE A,CM%NOP		;END OF COMMAND PARSED OK ?
	CALLRET COMER1		;NO, GO ISSUE MESSAGE AND RETURN
	MOVE A,PAGELN		;RESTORE PAGE SIZE ENTERED
	CAMG A,LINPPG		;REASONABLE SIZE?
	SKIPN A			;A NON-ZERO PAGE SIZE?
	JRST BADSIZ		;NO. DON'T BELIEVE IT
	SKIPN PAGSIZ		;ALREADY HAVE ONE?
	JRST PAGE10		;NO, ALL SET
	PUSH P,A		;SAVE LINE NUMBER
	CALL TSTCOL		;YES, GO ISSUE CRLF IF NEEDED
	TMSG <% MAKVFU: PAGE SIZE ALREADY SPECIFIED. SUPERCEDED
>				;OUTPUT WARNING MESSAGE
	POP P,A			;RECOVER PAGE SIZE
PAGE10:	MOVEM A,PAGSIZ		;REMEMBER IT
	RET			;RETURN TO WHENCE WE CAME ...

; HERE ON A BAD PAGE SIZE SPECIFIED

BADSIZ:	CALL TSTCOL		;ISSUE NEW LINE IF NEEDED
	TMSG <? MAKVFU: Invalid ARGUMENT FOR PAGE SIZE. COMMAND IGNORED
>				;OUTPUT MESSAGE
	RET			;RETURN TO WHENCE WE CAME ...
;READ VFU CHANNEL ASSIGMENT AND SET UP VFU BIT PATTERN

.CHNL:	STKVAR <CHNARG>
	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMNOI,,TXTPTR<NUMBER>)] ;GET FUNCTION
	COMND			;PARSE NOISE WORDS
	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMNUM,,^D10)] ;GET DECIMAL NUMBER FUNCTION
	COMND			;PARSE CHANNEL NUMBER
	TXNN A,CM%NOP		;NUMBER PARSED OK ?
	JRST CHNL05		;YES, GO ON
	CALL TSTCOL		;NO, ISSUE NEW LINE IF NEEDED
	TMSG <? MAKVFU: Invalid decimal number entered for channel
>				;OUTPUT MESSAGE
	RET			;RETURN TOW WHENCE WE CAME ...

; HERE WITH A GOOD CHANNEL NUMBER

CHNL05:	SKIPLE B		;A VALID CHANNEL NUMBER?
	CAILE B,MAXCHN		;STILL?
	JRST [	CALL TSTCOL	;NO. TELL USER
		TMSG <? CHANNEL NUMBER OUT OF RANGE
>
		RET]		;AND IGNORE REST OF COMMAND
	MOVEM B,CHANEL		;REMEMBER CURRENT CHANNEL
	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMKEY,,LEV2)] ;GET KEYWORD TABLE FUNCTION
	COMND			;PARSE NEXT SUBCOMMAND
	TXNN A,CM%NOP		;PARSED NEXT PART OK ?
	JRST CHNL10		;YES, GO ON
	CALL TSTCOL		;NO, ISSUE NEW LINE IF NEEDED
	TMSG <? MAKVFU: Invalid argument to CHANNEL command, ignored.
>				;OUTPUT MESSAGE
	RET			;RETURN...

; HERE WITH A VALID ARGUMENT

CHNL10:	MOVEM B,CHNARG		;SAVE ARGUMENT ADDRESS

; SET UP CHANNEL MASK AND DISPATCH

	MOVEI B,1
	MOVE A,CHANEL
	LSH B,0(A)		;POSITION A BIT
	IORM B,CHNMSK		;REMEMBER THIS CHANNEL SEEN
	MOVE A,CHNARG		;GET CHANNEL ARG ADDRESS
	HRRZ A,(A)		;GET DISPATCH ADDRESS FOR ARGUMENT ENTERED
	CALLRET (A)		;GO PROCESS ARGUMENT AND RETURN
;UTILITY SUBROUTINES

NUMOUT:	MOVEI A,.PRIOU		;PRIMARY OUT
	MOVEI C,12		;IN DECIMAL
	NOUT			;OUTPUT A NUMBER
	 JFCL
	RET			;AND DONE

PBLANK:	ILDB A,PNT		;NEXT ATOM
	CAIE A," "		;A BLANK?
	CAIN A,"	"
	JRST PBLANK		;YES. SKIP IT
	CAIN A,.CHCRT		;A CR?
	JRST PBLANK		;YES
	CAIN A,.CHLFD		;END OF LINE?
	RET			;YES. BAD
	MOVNI A,1		;BACK UP PNT
	IBP A,PNT
	MOVE PNT,A		;DO IT
	AOS (P)
	RET			;GOOD

;SET A BIT IN THE CHNBUF

SETBIT:	PUSH P,A
	IDIVI A,^D36		;GET WORD AND BIT
	MOVE W,CHANEL		;GET CHANNEL
	SOS W			;ADJUST FOR CRUDE COUNTING
	IMULI W,<MAXLIN/^D36+1>	;WORDS PER CHANNEL
	ADDI A,0(W)		;WORD TO SET
	MOVSI C,(1B0)		;GET A BIT
	MOVNI B,0(B)
	ROT C,(B)		;POSITION BIT
	IORM C,CHNBUF(A)	;SET IT
	POP P,A			;RETURN THE ARG
	RET			;AND DONE
;SUBCOMMANDS OF CHANNEL

;FIRST, DO TOP

.TOP:	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMCFM) ] ;GET END OF COMMAND FUNCTION
	COMND			;PARSE END OF COMMAND
	TXNE A,CM%NOP		;END OF COMMAND PARSED OK ?
	CALLRET COMER1		;NO, GO ISSUE ERROR MESSAGE
	SKIPN PAGSIZ		;HAVE A PAGE SIZE YET?
	JRST [	CALL TSTCOL	;OUTPUT NEW LINE IF NEEDED
		TMSG <? MAKVFU: ILLEGAL TO SPECIFY "TOP" unless PAGE SIZE has been specified
>
		RET ]		;RETURN
	MOVEI A,0		;CHANNEL TO SET
	CALL SETBIT		;SET BIT FOR TOP
	ret			;return to whence we came ...

;DO BOTTOM

.BOTom:	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMCFM) ] ;GET END OF COMMAND FUNCTION
	COMND			;PARSE END OF COMMAND
	TXNE A,CM%NOP		;END OF COMMAND PARSED OK ?
	CALLRET COMER1		;NO, GO ISSUE ERROR MESSAGE
	SKIPN PAGSIZ		;HAVE A PAGE SIZE YET?
	JRST [	CALL TSTCOL	;OUTPUT CRLF IF NEEDED
		tmsg <? makvfu: ILLEGAL TO SPECIFY "BOTTOM" unless PAGE SIZE has been specified
>				;OUTPUT MESSAGE
		RET ]		;RETURN
	MOVE A,PAGSIZ		;FIRST MARK IS AT THE BOTTOM
	CALLRET SETBIT		;GO SET BIT AND RETURN

;DO ALL LINES

.ALL:	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMCFM) ] ;GET END OF COMMAND FUNCTION
	COMND			;PARSE END OF COMMAND
	TXNE A,CM%NOP		;END OF COMMAND PARSED OK ?
	CALLRET COMER1		;NO, GO ISSUE ERROR MESSAGE
	SKIPN PAGSIZ		;HAVE A PAGE SIZE YET
	JRST [	CALL TSTCOL	;OUTPUT NEW LINE IF NEEDED
		TMSG <? MAKVFU: ILLEGAL TO SPECIFY "ALL" unless PAGE SIZE has been specified
>				;OUTPUT MESSAGE
		RET ]		;RETURN
	MOVEI A,0		;INITIALIZE CHANNEL NUMBER
ALL1:	CALL SETBIT
	AOS A			;NEXT LINE
	CAMGE A,PAGSIZ		;AT THE END?
	JRST ALL1		;NO
	RET			;RETURN TO PARSER
;MORE SUBCOMMANDS.

;SET EVERY LINE

EVERY:	STKVAR <EVYSTP>
	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMNUM,,^D10)] ;GET NUMBER FUNCTION
	COMND			;PARSE DECIMAL NUMBER
	TXNN A,CM%NOP		;PARSED NUMBER OK ?
	JRST EVRY10		;YES, GO SAVE THE NUMBER
	CALL TSTCOL		;NO, ISSUE NEW LINE IF NEEDED
	TMSG <? MAKVFU: Invalid number entered for step size
>				;OUTPUT MESSAGE
	RET			;RETURN

; HERE WITH A GOOD STEP SIZE

EVRY10:	MOVEM B,EVYSTP		;SAVE STEP SIZE
	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMNOI,,TXTPTR<LINES>)] ;GET FUNCTION
	COMND			;PARSE NOISE WORDS
	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMCFM) ] ;GET END OF COMMAND FUNCTION
	COMND			;PARSE END OF COMMAND
	TXNE A,CM%NOP		;END OF COMMAND PARSED OK ?
	CALLRET COMER1		;NO, GO ISSUE ERROR MESSAGE
	SKIPG PAGSIZ		;HAVE A PAGE SIZE YET?
	JRST [	CALL TSTCOL	;ISSUE NEW LINE IF NEEDED
	TMSG <? MAKVFU: CAN'T SPECIFY "EVERY" unless PAGE SIZE has been specified
>				;OUTPUT MESSAGE
		RET ]		;RETURN
	SETZ A,			;START HERE
EVERY1:	CALL SETBIT
	ADD A,EVYSTP		;NEXT
	CAMGE A,PAGSIZ		;AT THE END YET?
	JRST EVERY1		;NO
	RET			;RETURN
;DO LINES COMMAND

LINFDB:	FLDDB. (.CMNUM,,^D10,,,<[FLDDB. (.CMCMA,,,,,<[FLDDB. (.CMCFM)]>)]>)


LINES:	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMNOI,,TXTPTR<NUMBERS>)] ;GET FUNCTION
	COMND			;PARSE NOISE
LINE05:	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,LINFDB		;GET FUNCTION DESCRIPTOR ADDRESS
	COMND			;PARSE NEXT FIELD
	TXNN A,CM%NOP		;ANYTHING PARSE OK ?
	JRST LINE10		;YES, GO SEE WHAT WE GOT
	CALL TSTCOL		;NO, ISSUE NEW LINE IF NEEDED
	TMSG <? MAKVFU: Invalid argument
>				;OUTPUT MESSAGE
	RET			;RETURN


; HERE ON A VALID ARGUMENT - SEE WHAT WAS ENTERED

LINE10:	LDB A,[POINT 9,(C),8]	;GET FUNCTION CODE PARSED
	CAIN A,.CMCFM		;GOT END OF COMMAND ?
	RET			;RETURN, ALL DONE
	CAIN A,.CMCMA		;GOT A COMMA ?
	JRST LINE05		;YES, GO GET NEXT FIELD
	CAIN A,.CMNUM		;GET A NUMBER ?
	JRST LINNUM		;YES, GO HANDLE THE LINE NUMBER
	CALL TSTCOL		;ERROR, SEE IF CRLF NEEDED
	TMSG <? MAKVFU: Internal error, command ignored
>				;OUTPUT MESSAGE
	RET			;RETURN
; HERE TO HANDLE A NUMBER

LINNUM:	SOS B			;USE CORRECT ADDRESSING
	SKIPL B			;VALID?
	CAML B,PAGSIZ		;WITHIN RANGE?
	JRST [	CALL TSTCOL		;ISSUE MESSAGE IF NEEDED
		TMSG <? MAKVFU: LINE NUMBER OUT OF RANGE
>				;OUTPUT MESSAGE
		RET ]		;RETURN
	MOVE A,B		;COPY LINE NUMBER
	CALL SETBIT		;GO SET THE BIT
	JRST LINE05		;AND GET NEXT
SUBTTL	COMMAND ERROR SUBROUTINES

; INVALID END-OF-COMMAND

COMER1:	CALL TSTCOL		;TEST COLUMN POSITION
	TMSG <? MAKVFU: Garbage at end-of-command
>				;OUTPUT ERROR MESSAGE
	RET			;RETURN TO WHENCE WE CAME ...


; SUBROUTINE TO TEST COLUMN POSITION AND OUTPUT CRLF IF NEEDED

TSTCOL:	movei A,.priou		;get primary output designator
	rfpos			;read file position
	hrrz B,B		;keep just the column position
	JUMPE B,R		;IF AT COLUMN 1 DO NOT OUTPUT CRLF
	tmsg <
>				;no, output a crlf
	RET			;RETURN
; EXIT COMMAND

.EXIT:	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMNOI,,TXTPTR<TO MONITOR>)]
	COMND			;PARSE NOISE FIELD
	MOVEI B,[FLDDB. (.CMCFM)] ;GET CONFIRM FUNCTION BLOCK
	COMND			;WAIT FOR END-OF-COMMAND
	TXNE A,CM%NOP		;GARBAGE AT END-OF-COMMAND ?
	CALLRET COMER1		;YES, ISSUE ERROR MESSAGE
	HALTF			;TO THE EXEC
	JRST START		;IN CASE OF CONTINUE


; HELP COMMAND

.HELP:	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMCFM)] ;GET FUNCTION BLOCK FOR CONFIRM
	COMND			;WAIT FOR END-OF-COMMAND
	TXNE A,CM%NOP		;GARBAGE AT END-OF-COMMAND ?
	CALLRET COMER1		;YES, ISSUE ERROR MESSAGE
	HRROI A,HLPTXT
	PSOUT
	JRST PARSE		;GO DO NEXT COMMAND
;NOW BUILD VFU

.OUTPT:	STKVAR <VFUJFN>
	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMNOI,,<TXTPTR(TO VFU FILE)>)] ;GET NOISE FUNCITON
	COMND			;PARSE NOISE WORDS
	MOVEI A,CMDBLK		;GET ADDRESS OF COMMAND STATE BLOCK
	MOVEI B,[FLDDB. (.CMOFI)] ;GET OUTPUT FILE FUNCTION
	COMND			;PARSE OUTPUT FILE SPEC
	TXNN A,CM%NOP		;PARSED OK ?
	JRST OUTPT2		;YES, GO SAVE JFN
	CALL TSTCOL		;NO, ISSUE CRLF IF NEEDED
	TMSG <? MAKVFU: Invalid file specification
>				;OUTPUT MESSAGE
	RET			;RETURN

; HERE WITH A JFN FOR OUTPUT FILE

OUTPT2:	MOVEM B,VFUJFN		;SAVE JFN FOR VFU FILE
OUTPT3:	SKIPN A,FORMS		;HAVE A FORMS BREAK CHANNEL?
	JRST MAKVF1		;NO. GO ON
	JFFO A,.+1		;GET LOG OF CHANNEL NUMBER
	SUBI B,^D35		;NEGATIVE OF CHANNEL
	MOVN B,B		;GET CHANNEL NUMBER
	MOVEM B,CHANEL		;SET IT UP
	MOVEI A,1		;A BIT
	LSH A,0(B)		;POSITION IT
	ANDCAM A,FORMS		;TURN IT OFF
	MOVE A,PAGSIZ		;GET TO BOTTOM
MAKVF2:	CALL SETBIT		;SET THE BIT
	AOS A			;NEXT LINE
	CAMGE A,LINPPG		;ALL DONE?
	JRST MAKVF2		;NO. DO THE LINE THEN
	JRST OUTPT3		;YES. GO DO NEXT THEN
MAKVF1:	SETZ W1,		;LINE NUMBER
	MOVE PNT,[POINT ^D8,VFUBUF] ;WHERE TO BUILD IT
;**;[4] Change one line at MAKVF1: +2L	JGZ	30-NOV-80
	MOVE A,LPI		;[4] START VFU LOAD WITH CONTROL BYTE
	IDPB A,PNT		;STASH IT
CHNLOP:	MOVSI C,-^D12		;DO 12 CHANNELS
	SETZ W2,		;MASK WORD
	CALL BLDVFU		;GO BUILD WORD FOR THIS LINE
	LSHC W2,-6		;SPLIT THE FIELD
	LSH W3,-^D30		;POSITION FIRST BYTE
	IDPB W3,PNT
	IDPB W2,PNT		;PUT IN THE BYTES
	AOS W1			;NEXT LINE
	CAMGE W1,LINPPG		;OVER THE END?
	JRST CHNLOP		;NO. GO DO IT THEN
	MOVEI A,357		;LAST BYTE
	IDPB A,PNT

;NOW SWAP THE BYTES SO DATA CAN BE SENT IN WORD MODE TO THE -11

	HRRZ A,PNT		;GET LAST WORD USED
	SUBI A,VFUBUF-1		;CALCULATE WORDS USED
	LSH A,1			;-11 WORDS USED
	MOVE D,[POINT ^D8,VFUBUF]
	MOVE W3,D		;SET UP BYTE POINTERS
SWPLOP:	ILDB B,D		;GET  NEXT BYTE
	ILDB C,D		;AND THE NEXT
	IDPB C,W3
	IDPB B,W3		;SWAP THE BYTES
	SOJG A,SWPLOP		;DO ALL WORDS
	;..
	;..

; NOW OPEN THE OUTPUT FILE

	MOVE A,VFUJFN		;GET JFN FOR VFU FILE
	MOVE B,[200000,,100000]
	OPENF
	 JRST [	CALL TSTCOL	;ISSUE NEW LINE IF NEEDED
		TMSG <? MAKVFU: Cannot OPEN output file
>				;OUTPUT MESSAGE
		MOVE A,VFUJFN		;GET JFN FOR VFU FILE
		RLJFN		;RELEASE THE JFN
		 JFCL		;IGNORE ERRORS HERE
		RET ]		;RETURN
	MOVEI C,VFUBUF-1
	SUBI C,0(PNT)
	LSH C,1			;TWO BYTES PER
	TLNE PNT,200000		;ODD BYTE IN LAST WORD?
	AOS C			;YES.
	MOVE B,[POINT ^D16,VFUBUF]
	SOUT			;WRITE THE FILE
	CLOSF			;CLOSE IT
	 JRST [	CALL TSTCOL	;ISSUE NEW LINE IF NEEDED
		TMSG <% MAKVFU: Cannot close output file
>				;OUTPUT MESSAGE
		RET ]		;RETURN
	JRST START		;START ALL OVER AGAIN
;WORKER ROUTINE TO BUILD THE BYTE AND STORE IT

BLDVFU:	MOVEI D,<MAXLIN/^D36+1>	;SIZE OF A CHANNEL BUFFER
	MOVEI A,1		;SEE IF CHANNEL ASSIGNED
	LSH A,1(C)		;POSITION BIT
	TDNN A,CHNMSK		;IS IT?
	JRST SETIT1		;NO. GO SEE IF MARKING IS IN FORCE
	IMULI D,0(C)		;GET START WORD FOR THIS CHANNEL
	MOVEI A,0(W1)		;GET PROPER LINE
	IDIVI A,^D36		;LINES PER WORD
	ADDI D,0(A)		;THE WORD
	MOVNI B,0(B)		;ROT COUNT
	MOVSI A,(1B0)		;A BIT
	ROT A,(B)		;POSITION IT
	TDNE A,CHNBUF(D)	;SET?
	JRST SETIT		;YES. DO IT
BLD1:	AOBJN C,BLDVFU		;DO NEXT CHANNEL
	RET			;AND DONE

SETIT1:	SKIPN MARKW		;DOING MARKING?
	JRST BLD1		;NO. SKIP IT THEN
SETIT:	MOVEI A,1		;A BIT
	LSH A,0(C)		;POSITION ACCORDING TO CHANNEL
	IOR W2,A		;SET IT
	JRST BLD1		;AND PROCEED

	END <3,,ENTVEC>