TITLE CONVERTER

O=0
A=1
B=2
C=3
D=4

DSKI==0
DSKO==1

MFD:	BLOCK	1024.
MFDPT:	-1024.,,MFD
FAKBUF:	BLOCK	6
BUF:	BLOCK	300.
BUFPT:	-300.,,BUF

START:	.CALL	[SETZ
		 SIXBIT	/OPEN/
		 [.BII,,DSKI]
		 [SIXBIT /DSK/]
		 [SIXBIT /M.F.D./]
		 SETZ	[SIXBIT /(FILE)/]]
	 .LOSE	1400
	MOVE	A,MFDPT
	.IOT	DSKI,A
	.CLOSE	DSKI,
	MOVE	A,MFDPT
	HRLS	MFD+1
	ADD	A,MFD+1		; AOBJN POINTER TO GOOD STUFF IN MFD
SCLOOP:	SKIPN	(A)
	 JRST	ENDLOP
	.CALL	[SETZ
		 SIXBIT	/OPEN/
		 [.BII,,DSKI]
		 [SIXBIT /DSK/]
		 [SIXBIT /%COMBT/]
		 [SIXBIT /TAILOR/]
		 SETZ	(A)]
	 JRST	ENDLOP
	.CALL	[SETZ
		 SIXBIT	/OPEN/
		 [.BIO,,DSKO]
		 [SIXBIT /DSK/]
		 [SIXBIT /_COMBT/]
		 [SIXBIT />/]
		 SETZ	(A)]
	 .LOSE	1400
CONLOP:	MOVE	B,[-2,,C]		; READ HEADER
	.IOT	DSKI,B
	JUMPL	B,DIDONE
	JUMPE	C,DIDONE
	MOVE	B,[-2,,C]		; PRINT IT OUT
	.IOT	DSKO,B
	TLZ	C,-1
	MOVN	B,C
	HRLS	B
	HRRI	B,BUF
	MOVEM	B,PTSAV'		; SAVE POINTER FOR PRINTING IT OUT
	.IOT	DSKI,B
	MOVE	B,PTSAV
	.IOT	DSKO,B			; PUT NAME OUT
	MOVNI	B,(D)			; ALREADY ADDED THE 6
	HRLS	B
	HRRI	B,BUF
	.IOT	DSKI,B
	MOVNI	B,(D)
	HRLS	B
	HRRI	B,BUF
	MOVEI	O,27.
	DPB	O,[220602,,7]
	.IOT	DSKO,B
	JRST	CONLOP
DIDONE:	.CALL	[SETZ
		 SIXBIT	/RENMWO/
		 MOVEI	DSKO
		 [SIXBIT /%COMBT/]
		 SETZ	[SIXBIT /TAILOR/]]
	 .LOSE	1000
	.CLOSE	DSKI,
	.CLOSE	DSKO,
ENDLOP:	ADD	A,[2,,2]
	JUMPL	A,SCLOOP
DONE:	.LOGOUT	1,
END	START