Google
 

Trailing-Edge - PDP-10 Archives - klad_sources - klad.sources/cnvtdx.mac
There are no other files named cnvtdx.mac in the archive.
SUBTTL	DX20 FILE CONVERSION
S

CNVDX:	MOVE	FILNAM		;INITIALIZE FILE NAMES
	MOVEM	INNAME
	MOVEM	OUTNAM
	MOVE	[SIXBIT/BIN/]
	SKIPE	FILEXT
	MOVE	FILEXT
	MOVEM	INNAME+1
	MOVE	[SIXBIT/ADX/]
	MOVEM	OUTNAM+1
	MOVEI	13		;INPUT 36 BIT BYTES
	MOVEM	INBLK

	GO	ININIT		;INITIALIZE INPUT/OUTPUT

	GO	FILEID		;IDENTIFY FILE

CDX1:	SETZM	DXCWF#		;DXCWF =0,CRAM =-1,WRAM
	SETZM	DXCWF1#
	SETZM	DXADR#		;SETUP START ADDRESS
	SETZM	B11ADR		;SETUP 1ST ADDRESS
	SETZB	CNT,B11CNT	;INIT COUNTS

CDX2:	MOVE	DXSV
	ANDI	0,177777	;STRIP CRAM DATA TO 16 BITS
	SKIPE	DXCWF
	ANDI	0,377		;STRIP WRAM DATA TO 8 BITS

	MOVEM	B11DAT(CNT)	;STORE DATA WORD
	AOS	B11CNT		;INCREMENT WORD COUNT
	AOS	CNT		;INCREMENT STORAGE POINTER
	AOS	DXADR		;INCREMENT DX20 ADDRESS

	CAIGE	CNT,AWC11	;FILLED THIS BLOCK ?
	JRST	CDX5		;NOT YET
CDX3:	SKIPN	B11CNT		;ANY WORDS IN STORAGE ?
	JRST	CDX4		;NO

	GO	PUTDX		;START LINE WITH "C" OR "W" & SPACE

	GO	C11CNV		;ASCIIZE AND OUTPUT

CDX4:	SKIPE	DXCWF1		;WRAM NEXT ?
	SETOM	DXCWF		;YES, SET FLAG
	MOVE	DXADR		;INIT NEXT BLOCK ADDRESS
	MOVEM	B11ADR
	SETZB	CNT,B11CNT	;CLEAR COUNTS

CDX5:	GO	RINP		;GET NEXT DATA WORD
	JRST	DXEOF		;END OF FILE

	MOVEM	CHR,DXSV
	SKIPN	DXCWF		;SKIP IF DOING WRAM
	CAME	CHR,[-1]	;A FULL 36BIT -1 = END OF CRAM
	JRST	CDX2		;BACK TO PROCESS THIS DATA WORD

CDXEC:	SETOM	DXCWF1		;END OF CRAM, SET FOR WRAM
	SETZM	DXADR		;WRAM STARTS AT 0
	JRST	CDX3		;OUTPUT LAST CRAM BLOCK

DXEOF:	SKIPN	B11CNT		;ANY WORDS IN STORAGE ?
	JRST	DXEOF1		;NO

	GO	PUTDX		;YES, OUTPUT LAST BLOCK

	GO	C11CNV

DXEOF1:	SETZM	B11CNT		;TRANSFER BLOCK HAS 0 WORD COUNT
	SETZM	B11ADR		;AND 0 ADDRESS
	SETOM	DXCWF		;LINE STARTS WITH "W" & "SPACE"

	GO	PUTDX
	GO	C11CNV

	JRST	C11DON		;COMPLETED
IDDX20:	GO	RINP		;GET FIRST CRAM WORD
	JRST	ERR4		;EOF, ERROR

	MOVEM	CHR,DXSV#	;SAVE IT

	LDB	[POINT 10,DXSV,35]
	GO	FILOCS		;EDIT NUMBER

	MOVEI	CHR,"."
	GO	PUT1

	LDB	[POINT 6,DXSV,25]
	GO	FILOCS		;VERSION NUMBER

	JRST	FILEI1		;PUT IN DATE

PUTDX:	MOVEI	CHR,"C"		;CRAM STARTS WITH "C"
	SKIPE	DXCWF
	MOVEI	CHR,"W"		;WRAM STARTS WITH "W"
	GO	PUT1
	MOVEI	CHR," "
	GO	PUT1		; & "SPACE"
	RTN