Google
 

Trailing-Edge - PDP-10 Archives - QT020_T20_4.1_6.1_SWSKIT_851021 - swskit-hacks/vfuconvert.mac
There is 1 other file named vfuconvert.mac in the archive. Click here to see a list.
;<LONGO.MACRO>VFUCONVERT.MAC.18 20-Nov-84 16:32:40, Edit by LONGO
;Edit 4 - Clean up putbyt routine
;<LONGO.MACRO>VFUCONVERT.MAC.17 20-Nov-84 12:51:17, Edit by LONGO
;Edit 3 - On error, close and expunge the output file.  Also change
;  flag indicating first or second output byte to be a bit in AC 0 (f).
;<LONGO.MACRO>VFUCONVERT.MAC.16 16-Nov-84 07:32:11, Edit by LONGO
;Edit 2 - Change wording on question for "switch defines LPI"
;<LONGO.MACRO>VFUCONVERT.MAC.12  9-Nov-84 15:07:17, Edit by LONGO
;Edit 1 - Since LP27s don't allow LPI to be specified in the VFU, add
; code to allow user to convert 6 or 8 LPI to "switch defines LPI".

	title VFUConvert - Converts TOPS-10 VFUs to TOPS-20 Format
	subttl R. Longo  11/4/84

	search monsym,macsym
	.require sys:macrel
	sall

; Accumulator definitions
 
	stdac.			;use standard ACs

; Version number definitions

; 1(4)-1	20-Nov-84	Cleanup code in putbyt routine. - RAL

; 1(3)-1	20-Nov-84	On error, set CZ%ABT bit when closing output
;				 file so it will get expunged.  Also change
;				 flag for first/second output byte to be a bit
;				 the the flag register rather. - RAL

; 1(2)-1	16-Nov-84	Change wording in question that asks if user
;				 wants to force LPI to be "switch defines LPI"
;				 in output file. - RAL

; 1(1)-1	9-Nov-84	Added conditional code to allow Lines-per-Inch
;				 to be forced to be "switch defines" in output
;				 file. - RAL

; 1(0)-1	4-Nov-84	Program written - RAL
 
	vmajor==1		;major version of program
	vminor==0		;minor version number
	vedit==4		;edit number
	vwho==1			;group who last edited program
				; (0=DECdevelopment, 1=SWS, 2-7=Cust)

	pgver. vmajor,vminor,vedit,vwho ;create version number
 
   ifndef strip,<
	strip==1		;[1]1=assemble strip LPI code
   >;[1]end ifndef strip
   ifn strip,<bufsiz==^d80>	;[1]number of bytes to allow for user input
	pdlen==^d50		;push-down stack length
	fr%put==1b34		;[3]0=outputting first byte, 1=second byte
	fr%err==1b35		;[3]0=normal termination, 1=an error occurred

    if2,<printx [Remember to save as VFUCONVERT]>
	subttl MAIN PROGRAM

start:  RESET%
	move p,[iowd pdlen, pdl] ;set up stack
	txz f,fr%err!fr%put	;[3]clear flags
	tmsg <This program makes a TOPS-20 VFU from a TOPS-10 VFU.>

; Open the input file
opninp:	tmsg <
Input (TOPS-10) file: >
	movx t1,GJ%SHT!GJ%OLD!GJ%MSG!GJ%CFM!GJ%FNS
	move t2,[xwd .PRIIN,.PRIOU] ;input and output to the terminal
	GTJFN%
	 erjmp [ jserr
		jrst opninp]
	hrrzm t1,jfnin		;save the JFN
	movx t2,fld(7,OF%BSZ)!OF%RD
	OPENF%
	 ermsg <OPENF input>

; Open the output file
	tmsg <Output (TOPS-20) file: >
	movx t1,GJ%SHT!GJ%NEW!GJ%FOU!GJ%MSG!GJ%CFM!GJ%FNS
	move t2,[xwd .PRIIN,.PRIOU] ;input and output to the terminal
	GTJFN%
	 ermsg <GTJFN output>
	hrrzm t1,jfnout		;save the JFN
	movx t2,fld(^d16,OF%BSZ)!OF%RD!OF%WR
	OPENF%
	 ermsg <OPENF output>

   ifn strip,<			;[1]
; Ask if output VFU should have LPI set or not
	setzm nolpi		;[1]default is no strip
ask:	hrroi t1,prompt		;[1]
	PSOUT%			;[1]
	hrroi t1,inbuf		;[1]
	movx t2,RD%RAI!bufsiz*5 ;[1]bytes=words*5(char/word)
	hrroi t3,prompt		;[1]^R pointer
	RDTTY%			;[1]get answer from user
	 ermsg <RDTTY>		;[1]
	ldb t1,[point 7,inbuf,6] ;[1]get the first character of user's input
	cain t1,"Y"		;[1]is it a 'Y'?
	 jrst yes		;[1] yes
	caie t1,"N"		;[1]no.  Could it be an 'N'?
	 jrst [	tmsg <Answer either Yes or No please.
>				;[1]
		jrst ask]	;[1] no.  Wrong on both accounts.
	skipa			;[1]answer was no.
yes:	 setom nolpi		;[1]flag so we strip LPI later
   >;[1]end of ifn strip

; Convert the TOPS-10 Lines Per Inch byte to equivalent TOPS-20 LPI byte
	move t1,jfnin
	BIN%
	 ermsg <BIN on LPI>
	move t1,t2		;put byte read in t1
	setz t2,		;start at a known state
	cain t1,25		;Switch defines LPI?
	 movei t2,356		; yes
	cain t1,26		;6 LPI?
	 movei t2,354		; yes
	cain t1,27		;8 LPI?
	 movei t2,355		; yes
	skipn t2		;was a correct LPI byte seen?
	 jrst [	tmsg <?Lines per inch byte in input file is not correct>
		txo f,fr%err	;[3] no, mark that an error has occurred
		jrst endit]	; and quit
   ifn strip,<			;[1]
	skipe nolpi		;[1]strip LPI byte?
	 movei t2,356		;[1] yes, convert to "switch defines"
   >;[1]end of ifn strip
	call putbyt		;yes, go output the byte

; Convert the meat of the VFUs
cnvlop:	move t1,jfnin
	BIN%
	 ermsg <BIN in conversion loop>
	caie t2,126		;end byte?
	 jrst [	call putbyt	; no, output the byte as is
		jrst cnvlop]	;back for more
	movei t2,357		;change TOPS-10 end byte to TOPS-20 end byte
	call putbyt		;output TOPS-20 end byte
	txne f,fr%put		;[3]output an even number of bytes?
	 jrst [ tmsg <?Did not output an even number of bytes>
		txo f,fr%err	;[3]mark that an error has occurred
		jrst endit]	; and quit

; All done.  Close files and quit
endit:	move t1,jfnin
	CLOSF%
	 erjmp .+1		;ignore errors
	move t1,jfnout
	txne f,fr%err		;[3]did we see an error?
	 txo t1,CZ%ABT		;[3] yes, output file gets expunged
	CLOSF%
	 erjmp .+1		;ignore errors
	HALTF%
	jrst start		;for continue
	subttl SUBROUTINES

; Routine to output bytes to the TOPS-20 VFU file
;  This routine is called with a 7-bit byte in t2.  It saves the byte on
;  the first call until the second time it is called, at which time it
;  outputs a 16-bit byte consisting of the two 7-bit bytes swapped.

putbyt:	txcn f,fr%put		;[3]skip if this is the second byte
	 jrst [	movem t2,byte2	;[4] first byte, save it
		ret]		;[4] and just return
	hrrz t1,jfnout
	lsh t2,^d8		;move this byte over
	ior t2,byte2		;put in the first byte
	BOUT%			;output the 16-bit byte
	 ermsg <BOUT>
	ret			;return
	subttl MISC DATA STORAGE

; Misc data storage
pdl:	block pdlen		;push down pointer
   ifn strip,<			;[1]
inbuf:	block bufsiz		;[1]text for yes/no answer
prompt:	asciz/
Due to a hardware  restriction, VFUs for LP27  printers must be  built
with the  lines-per-inch set  to "left  alone" (switch  defines  LPI).
Should the lines-per-inch be forced to  be "left alone" in the  output
file? /				;[2]
nolpi:	block 1			;[1]0=don't convert LPI to "switch defines"
   >;[1]end ifn strip
byte2:	block 1			;second byte to output
jfnin:	block 1			;JFN of input file
jfnout:	block 1			;JFN of output file

	end start