Google
 

Trailing-Edge - PDP-10 Archives - BB-H311C-RM - swskit-utilities/typvf7.mac
There are 5 other files named typvf7.mac in the archive. Click here to see a list.
;<SWSKIT>TYPVF7.MAC.2, 26-Nov-81 02:09:51, EDIT BY ZIMA
;More simple cleanups.
;<ZIMA.SWSKIT>TYPVF7.MAC.3, 17-Feb-80 15:11:47, EDIT BY ZIMA
;Trivial cleanups
	TITLE	TYPVF7 - TYPE A VFU FILE

	SEARCH	MACSYM,MONSYM
	.REQUIRE SYS:MACREL
	.DIRECT	FLBLST
	SALL

;ACCUMULATORS:

	T1=1		;TEMP ACS
	T2=2
	T3=3
	T4=4
	P1=10		;PRESERVED ACS
	P2=11
	P3=12
	P=17		;STACK POINTER


ENTVEC:	JRST	TYPVF7		;START
	JRST	TYPVF7		;REENTER
	EXP	0		;VERSION NUMBER

TYPVF7:	RESET
	MOVE	P,[IOWD PDLLEN,PDL]	;SET UP PDL
	SETZM	GETFLG			;CLEAR BYTE FLAG
	TMSG	<VFU FILE: >	;PROMPT
	MOVX	T1,GJ%OLD+GJ%IFG+GJ%FNS+GJ%SHT
	MOVE	T2,[.PRIIN,,.PRIOU]
	GTJFN			;GET JFN FOR FIRST VFU FILE
	 JRST [	JSERR
		JRST TYPVF7]	;IF ERROR, RESTART
	MOVEM	T1,INJFN	;SAVE INPUT JFN
	TMSG	<OUTPUT TO FILE: >
	MOVX	T1,GJ%FOU+GJ%FNS+GJ%SHT
	MOVE	T2,[.PRIIN,,.PRIOU]
	GTJFN			;GET OUTPUT JFN
	 JRST [	JSERR
		JRST TYPVF7]
	MOVEM	T1,OUTJFN	;SAVE OUTPUT JFN
	MOVX	T2,FLD(7,OF%BSZ)+OF%WR
	OPENF			;OPEN OUTPUT FILE
	 JRST [	JSERR
		JRST TYPVF7]

	;...
;BEGIN PROCESSING A VFU FILE

MLOOP:	HRRZ	T1,INJFN	;OPEN INPUT FILE
	MOVX	T2,FLD(^D8,OF%BSZ)+OF%RD	;READ 8-BIT BYTES
	OPENF
	 JRST [	JSERR
		 JRST TYPVF7]
	MOVE	T1,OUTJFN	;NOW LEAVE OUTJFN IN T1
	FMSG	<
VFU FILE: >
	HRRZ	T2,INJFN
	JFNS			;WRITE FILE NAME
	FMSG	<

>				;FORMAT THE HEADER

	;...
;TYPE LINES PER INCH

	CALL	GETBYT		;GET THE FIRST BYTE
	MOVE	T1,OUTJFN	;RESTORE OUT-JFN
CK6:	CAIE	T2,354		;IS IT 6 LPI
	 JRST	CK8		;NO
	MOVEI	T2,"6"		;YES, TYPE 6
	BOUT
	JRST	ENDLPI

CK8:	CAIE	T2,355		;IS IT 8 LPI
	 JRST	CK0
	MOVEI	T2,"8"		;YES, TYPE 8
	BOUT
	JRST	ENDLPI

CK0:	CAIE	T2,356		;IS IT SWITCH DEFINED
	 JRST	NOTLPI		;NO
	FMSG	<SWITCH DEFINES>
	JRST	ENDLPI

NOTLPI:	FMSG	<%UNKNOWN FORMAT!!
>
	JRST	DONE		;GIVE UP WITH THIS FILE

ENDLPI:	FMSG	< LINES PER INCH

LINE	CHANNELS
 NO	1  2  3  4  5  6  7  8  9 10 11 12

>				;COMPLETE HEADER

	;...
;TYPE A CHANNEL TAPE

	MOVEI	P1,1		;P1: LINE NO.
LINENO:	CALL	GETBYT		;MAKE SURE WE HAVE MORE LINES
	CAIN	T2,357		;ARE WE DONE
	 JRST	DONE		;YES
	MOVE	P3,T2		;P3: 8-BIT BYTE
	MOVE	T2,P1		;GET LINE NO.
	MOVX	T3,NO%LFL+<FLD(3,NO%COL)>+^D10
	NOUT			;TYPE LINE NO.
	 JSERR
	FMSG	<   >		;TYPE SPACES TO FORMAT
	MOVEI	P2,1		;P2: CHANNEL NO.

CH1.6:	ROT	P3,-1		;ROTATE RIGHT 1 BIT
	JUMPGE	P3,SP1.6	;IF BIT OFF, TYPE SPACES
	MOVE	T2,P2		;IF ON, TYPE CHANNEL NO.
	MOVX	T3,NO%LFL+<FLD(3,NO%COL)>+^D10
	NOUT
	 JSERR
	JRST	EN1.6

SP1.6:	FMSG	<   >		;TYPE 3 SPACES

EN1.6:	AOS	P2		;INCREMENT THE CHANNEL NO.
	CAIGE	P2,7		;END OF FIRST BYTE?
	 JRST	CH1.6		;NO

	CALL	GETBYT		;GET SECOND BYTE IN LINE
	CAIN	T2,357		;CHECK FOR END (SHOULD FAIL)
	 JRST	DONE
	MOVE	P3,T2		;SAVE BYTE
CH7.12:	ROT	P3,-1		;ROTATE LEFT 1 BIT
	JUMPGE	P3,SP7.12	;JUMP IF NOT SET
	MOVE	T2,P2		;TYPE CHANNEL NO.
	MOVX	T3,NO%LFL+<FLD(3,NO%COL)>+^D10
	NOUT
	 JSERR
	JRST	EN7.12

SP7.12:	FMSG	<   >		;TYPE 3 SPACES

EN7.12:	AOS	P2		;INCREMENT CHANNEL NO.
	CAIGE	P2,^D13		;DONE WITH BYTE?
	 JRST	CH7.12		;NO
	FMSG	<
>				;COMPLETE THE LINE
	AOJA	P1,LINENO	;GO BACK FOR NEXT LINE NO.
;GETBYT - GET NEXT BYTE FROM VFU FILE

GETBYT:	SKIPE	GETFLG		;SKIP IF WE HAVE NO BYTE IN BUFFER
	 JRST	GOTBYT
	HRRZ	T1,INJFN
	BIN			;GET A BYTE
	MOVEM	T2,BYTE2	;BYTES SWAPPED, SO SAVE THIS ONE
	BIN			;GET NEXT BYTE
	SETOM	GETFLG		;AND SET FLAG
	MOVE	T1,OUTJFN	;RESTORE OUT-JFN
	RET			;RETURN

GOTBYT:	MOVE	T2,BYTE2	;GET SAVED BYTE
	SETZM	GETFLG		;CLEAR FLAG
	MOVE	T1,OUTJFN	;RESTORE OUT-JFN
	RET			;RETURN

DONE:	MOVX	T1,CO%NRJ	;KEEP THE JFN
	HRR	T1,INJFN
	CLOSF			;CLOSE THE VFU FILE
	 JSERR
	MOVE	T1,INJFN
	GNJFN			;GET NEXT VFU FILE JFN
	 JRST	ALLDON		;JUMP IF NO MORE
	MOVE	T1,OUTJFN
	MOVEI	T2,.CHFFD	;FORMFEED
	BOUT			;MORE, SO TYPE <FF>
	JRST	MLOOP		;AND LOOP

ALLDON:	MOVE	T1,OUTJFN
	CLOSF			;CLOSE OUTPUT FILE
	 JSERR
	HALTF			;STOP
	JRST	TYPVF7		;RESTART IF CONTINUED
;IMPURE STORAGE

PDL:	BLOCK	<PDLLEN==100>	;STACK
INJFN:	BLOCK	1		;INPUT JFN
OUTJFN:	BLOCK	1		;OUTPUT JFN
GETFLG:	BLOCK	1		; =0, NO BYTE IN BUFFER
				; =-1, BYTE IN BUFFER
BYTE2:	BLOCK	1		;BUFFER FOR SWAPPED BYTE

	END	<3,,ENTVEC>