Google
 

Trailing-Edge - PDP-10 Archives - BB-F493Z-DD_1986 - 10,7/cmmd.mac
There are 3 other files named cmmd.mac in the archive. Click here to see a list.
	TITLE	CMMD - CONVERT COMMOD.REL TO COMMOD.UNV
	SUBTTL	DEFINITIONS
	SEARCH	JOBDAT,UUOSYM

;STEVEN M. WOLFE
;COMPUTER CENTER
;UNIVERSITY OF ARIZONA
;TUCSON, ARIZONA, 85721

;AC'S
	T1=1				;TEMPS
	T2=T1+1
	T3=T2+1
	T4=T3+1
	P1=5				;PRESERVED
	P2=P1+1
	P=17				;PDL

;ASSEMBLY PARAMETERS
	PDLSIZ==20			;SIZE OF PDL
	VER==25				;FORMAT VERSION OF UNV FILES

;CH'S
	II==0				;INPUT REL FILE
	OO==1				;OUTPUT UNV FILE

;VERSION
	VWHO=0				;U OF AZ
	VMAJOR=1
	VMINOR=0
	VEDIT=1
	LOC	.JBVER
	BYTE	(3)VWHO(9)VMAJOR(6)VMINOR(18)VEDIT
	SUBTTL	DATA AREAS
	RELOC	0

PDL:	BLOCK	PDLSIZ			;PUSH DOWN LIST
IDEV:	.IOBIN				;OPEN BLOCK FOR INPUT
	SIXBIT	/DSK/
	IBUF
IBUF:	BLOCK	3			;INPUT RING HEADER
IFIL:	.RBEXT				;LOOKUP BLOCK
	0
	SIXBIT	/COMMOD/
	SIXBIT	/REL/
ODEV:	.IOBIN				;OPEN BLOCK FOR OUTPUT
	SIXBIT	/DSK/
	(OBUF)
OBUF:	BLOCK	3			;OUTPUT RING HEADER
OFIL:	.RBEXT				;ENTER BLOCK
	0
	SIXBIT	/COMMOD/
	SIXBIT	/UNV/
BLK:	BLOCK	^D18+2			;A BLOCK FROM REL FILE
CNT:	BLOCK	1			;COUNT OF SYMBOLS IN UNV FILE
SAVFF:	BLOCK	1			;SAVE INITIAL .JBFF
	SUBTTL	INITIALIZATION

CMMD:	JFCL				;NO CCL
	RESET				;STOP I/O
	MOVE	P,[IOWD PDLSIZ,PDL]	;SETUP PDL
	OPEN	II,IDEV			;LOOKUP REL FILE
	 HALT
	LOOKUP	II,IFIL
	 HALT
	INBUF	II,
	OPEN	OO,ODEV			;ENTER UNV FILE
	 HALT
	ENTER	OO,OFIL
	 HALT
	OUTBUF	OO,
	SETZM	CNT			;ZERO COUNT
	MOVE	T1,.JBFF		;SAVE FIRST FREE
	MOVEM	T1,SAVFF
	SUBTTL	INPUT REL FILE

LOOP:	PUSHJ	P,CI			;INPUT HEADER
	 JRST	XIT			;EOF
	MOVEM	T1,BLK			;STORE IT
	TLZ	T1,-1			;GET SIZE
	CAILE	T1,^D18			;ERROR IF TOO BIG
	HALT
	ADDI	T1,1			;INCLUDING RELOCATION WORD
	MOVN	P1,T1			;MAKE INTO AOBJN PNTR
	MOVSS	P1
	HRRI	P1,1
LOP:	PUSHJ	P,CI			;INPUT A WORD
	 HALT
	MOVEM	T1,BLK(P1)		;STORE IT
	AOBJN	P1,LOP			;GET ALL THE WORDS IN THE BLOCK
	HLRZ	T1,BLK			;GET BLOCK TYPE
	CAIE	T1,2			;IGNORE ALL BUT SYMBOL BLOCKS
	JRST	LOOP
	HRRZ	T1,BLK			;GET SIZE
	TRNE	T1,1			;ERROR IF ODD
	HALT
	MOVN	P2,T1			;BUILD AOBJN PNTR
	MOVSS	P2
	HRRI	P2,2
	MOVE	P1,[POINT 2,BLK+1]	;SETUP BP TO RELOCATION WORD
LP:	ILDB	T1,P1			;GET RELOCATION FOR SYMBOL NAME
	SKIPE	T1			;ERROR IF RELOCATED
	HALT
	ILDB	T1,P1			;GET RELOCATION FOR SYMBOL VALUE
	JUMPN	T1,NXT			;IGNORE SYMBOL IF RELOCATED
	LDB	T1,[POINT 4,BLK(P2),3]	;GET SYMBOL TYPE
	CAIE	T1,1			;MUST BE GLOBAL OR GLOBAL SPD
	CAIN	T1,11
	JRST	LP1
	CAIE	T1,2			;OR LOCAL OR LOCAL SPD
	CAIN	T1,12
	JRST	LP1
	JRST	NXT
LP1:	AOS	CNT			;COUNT THE SYMBOL
	MOVE	T1,BLK(P2)		;GET SYMBOL NAME
	PUSHJ	P,SAV			;SAVE IT
	MOVE	T1,BLK+1(P2)		;GET SYMBOL VALUE
	PUSHJ	P,SAV			;SAVE IT
NXT:	ADJSP	P2,1			;BUMP AOBJN POINTER
	AOBJN	P2,LP			;LOOP FOR EACH SYMBOL
	JRST	LOOP			;INPUT NEXT BLOCK
	SUBTTL	WRITE UNV FILE

XIT:	MOVE	T1,[XWD 777,VER]	;HEADER
	PUSHJ	P,CO
	MOVE	T1,.JBVER		;OUR VERSION, NOT MACRO
	PUSHJ	P,CO
	SKIPN	T1,CNT			;COUNT OF SYMBOLS
	HALT
	PUSHJ	P,CO
	MOVE	P1,SAVFF		;ADDR OF 1ST SYMBOL
XITLP:	MOVE	T1,(P1)			;GET RAD50 SYMBOL
	PUSHJ	P,F2S			;CONVERT TO SIXBIT
	MOVE	T1,T3			;OUTPUT IT
	PUSHJ	P,CO
	MOVSI	T1,(1B0+1B9+1B15)	;GET ALL THE NORMAL BITS
	LDB	T2,[POINT 4,(P1),3]	;GET SYMBOL TYPE
	CAIE	T2,11			;DDT SUPRESSED?
	CAIN	T2,12
	TLO	T1,(1B2)		;YES, SET THE BIT
	MOVE	T2,1(P1)		;GET THE VALUE
	TLNE	T2,-1			;HALFWORD OR FULL WORD?
	JRST	XIT2			;FULL
	HRR	T1,T2			;HALF, COPY IT
	JRST	XIT3			;AND OUTPUT IT
;HERE ON FULL WORD
XIT2:	TLO	T1,(1B6)		;SET FULL WORD BIT
	PUSHJ	P,CO			;OUTPUT IT
	MOVE	T1,1(P1)		;GET VALUE
;HERE TO OUTPUT LAST WORD OF AN ENTRY
XIT3:	PUSHJ	P,CO			;OUTPUT THE WORD
	ADDI	P1,2			;BUMP PNTR
	CAMGE	P1,.JBFF		;LOOP FOR EACH SYMBOL
	JRST	XITLP
	CLOSE	OO,			;CLOSE THE UNV FILE
	STATZ	OO,IO.ERR
	 HALT
	EXIT
	SUBTTL	CONVERT RAD50 TO SIXBIT

;ROUTINE TO CONVERT RAD50 TO SIXBIT
;T1 PASSES THE RAD50 WORD
;T3 RETURNS THE SIXBIT WORD
F2S:	TLZ	T1,740000		;CLEAR OUT TRASH
	MOVEI	T4,6*6			;BIT COUNT
	PUSHJ	P,F2SS			;CONVERT TO SIXBIT
	LSH	T3,(T4)			;LEFT JUSTIFY
	POPJ	P,

F2SS:	IDIVI	T1,50			;DIVIDE BY RADIX
	HRLM	T2,(P)			;SAVE REMAINDER
	SKIPE	T1			;LOOP UNTIL ALL GONE
	PUSHJ	P,F2SS
	HLRZ	T1,(P)			;RESTORE REMAINDER
	CAIG	T1,12			;IS IT A DIGIT?
	ADDI	T1,"0"-1		;YES, CONVERT
	CAIG	T1,44			;IS IT A LETTER?
	ADDI	T1,"A"-13		;YES, CONVERT
	CAIG	T1,45			;IS IT "."?
	MOVEI	T1,"."			;YES, CONVERT
	CAIG	T1,47			;IS IT "$" OR "%"?
	SUBI	T1,46-"$"		;YES, CONVERT
	LSH	T3,6			;APPEND TO SIXBIT VERSION
	ADDI	T3,'A'-"A"(T1)
	SUBI	T4,6			;COUNT IT
	POPJ	P,
	SUBTTL	SAVE A WORD

;ROUTINE TO SAVE A WORD AT THE END OF CORE
;T1 PASSES THE WORD
SAV:	MOVEM	T1,@.JBFF		;SAVE THE WORD
	AOS	T1,.JBFF		;BUMP FIRST FREE
	CAMG	T1,.JBREL		;DO WE HAVE THAT MUCH CORE?
	POPJ	P,
	CORE	T1,			;NO, GET SOME MORE
	 HALT
	POPJ	P,
	SUBTTL	I/O ROUTINES

;ROUTINE TO INPUT A WORD
;T1 RETURNS THE WORD
;NOSKIP IF EOF
;SKIP IF OK
CI:	SOSGE	IBUF+.BFCTR
	JRST	CI2
	ILDB	T1,IBUF+.BFPTR
CPOPJ1:	AOS	(P)
CPOPJ:	POPJ	P,
CI2:	IN	II,
	 JRST	CI
	STATO	II,IO.ERR
	 POPJ	P,
	HALT

;ROUTINE TO OUTPUT A WORD
;T1 PASSES THE WORD
CO:	SOSGE	OBUF+.BFCTR
	JRST	CO2
	IDPB	T1,OBUF+.BFPTR
	POPJ	P,
CO2:	OUT	OO,
	 JRST	CO
	HALT

	END	CMMD