Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-03 - decus/20-0078/comp/i3.mac
There are 2 other files named i3.mac in the archive. Click here to see a list.
;<MENDERIN>I3.MAC.10, 15-Jan-77 11:56:06, Edit by ENDERIN
	SUBTTL I3



COMMENT	;

AUTHORS:		KIM WALDEN
			ELISABETH $LUND

VERSION:		4 [6,11,12,104,144,162,225,260]

PURPOSE:		INITIALIZE BUFFERS AND BUFFER HEADERS FOR INPUT/OUTPUT
			OPEN FILES
			INITIALIZE PUSHDOWN STACKS AND VARIBLES
			CALL MODULES IN PASS 3

CONTENTS:		SUBROUTINES:
			I3L	OPEN LS1
			I3I	OPEN IC2
			I3S	OPEN SOURCE CODE FILE
			I3X	OPEN XRF
			I3E	OPEN ATR
			I3LS3	OPEN	LS3
			I3P1	SWAP PASS 1 INTO CORE IF ^C START


ENTRY:			I3	NORMAL ENTRY FROM PASS 1-2
			I3 -1	IF ^C REENTER


NORMAL EXIT:		BRANCH	T3

ERROR EXIT:		EXIT TO MONITOR IF NOT ENOUGH CORE PASS 3
			BRANCH	T3T3	IF ERROR IN OPEN,LOOKUP OR ENTER

CALLED ROUTINES:	E3,M3,T3E

;


	SEARCH SIMMAC
	SALL
	IFN QDEC20,<SEARCH MONSYM>;[225]

	CTITLE	I3    Pass 3 initialization

	SEARCH	SIMMC3	;[104]
	IFE QDEC20,<;[225]
	LOC	<.JBVER==137>
	EXP	VERCOM
	>
	TWOSEG 
	RELOC	400000
	MACINIT
	P3INIT	;[104]


;EXTERNAL SUBROUTINES

EXTERN	DM		;ROUTINE FOR ERROR HANDLING
EXTERN	E3		;CREATE SOURCE LIST
EXTERN	M3		;CREATE REL FILE
EXTERN	O3RA		;[12] Read one buffer from ATR file
EXTERN	T3E		;OUTPUT ERROR STATISTICS
EXTERN	T3L		;DELETE LS1
EXTERN	T3R		;DELETE REL.TMP
EXTERN	T3T3		;TERMINATION ROUTINE PASS 3
EXTERN	T3
EXTERN	T3T		;TERMINATION ROUTINE
EXTERN	T3REE		;REENTER ROUTINE
EXTERN	O3RZ		;READ SYMBOL TABLE INTO CORE

EXTERN	YBHIC2,YBHLS1,YBHLS3,YBHSRC,YBHXRF,YBHEXT	;BUFFER HEADERS
EXTERN	YELIC2,YELLS1,YELLS3,YELSRC,YELXRF,YELEXT	;LOOKUP/ENTER BLOCKS
EXTERN	Y17BUF,YBRSRC,YBRBUF	;I/O BUFFER
EXTERN	YEXTS		;DEV OF LST FILE
EXTERN	Y3DEV		;DEV OF SOURCE
EXTERN	YESEM		;NUMBER OF SEMICOLONS ON LINE BEFORE ERROR
EXTERN	YDMEND		;LENGTH OF ZDM
EXTERN	Y3OPEN		;STATUS OF FILES
EXTERN	YSIMNAME	;[12] SIMULA name for global module (RADIX50)
EXTERN	YSWITCH		;WORD CONTAINING SWITCHES
EXTERN	YJOB		;JOB NUMBER
EXTERN	Y3LOWE		;END OF LOW SEG PASS 3
EXTERN	YSTK		;PUSHDOWN STACK
EXTERN	.JBAPR
EXTERN	.JBREN
EXTERN	.JBSA
EXTERN	.JB41		;[144]
EXTERN	YBEGST		;PUSHDOWN STACK BEGIN
EXTERN	YBEGSP		;POINTER YBEGST
EXTERN	Y1LOWE
EXTERN	Q3STSZ		;[6] Stack size for pass 3 (XPDP stack)
EXTERN	YATRFN		;[144] Name of ATR file (SIXBIT). Only if old
EXTERN	YATRPPN		;[144] file exists. YATRPPN=ppn of that file.
EXTERN	YATRDEV		;[144] Device of the old ATR file.
EXTERN	YATROFS		;[144] Offset of ATR module within ATR file
			;[144] (word offset,,block number)
IFN QDEC20,<;[225]
EXTERN	YATRJFN		;JFN
EXTERN	YATRSZ		;ATR file size (pages)
EXTERN	YEXTSZ		;EXTERNAL FILE SIZE
EXTERN	YEXTAD,YEXTMP,YEXTJFN
EXTERN	O1OJFI	;OPEN JFN for input
EXTERN	O1EXMP	;Maps external file pages
>
EXTERN	YPASSNO	;[225]

;ENTRIES IN I3

INTERN	I3
INTERN	I3E		;OPEN FILE.ATR
INTERN	I3L		;OPEN LS1
INTERN	I3I		;OPEN IC2
INTERN	I3S		;OPEN SOURCE FILE
INTERN	I3X		;OPEN XRF
INTERN	I3LS3		;OPEN LS3
	SUBTTL	LOCAL MACROS

DEFINE	IOER(FILE)<
	L	X1,[ASCIZ/FILE/]>

DEFINE	IFCORE(FILE)<
	IF	;;File not in core
		SKIPN	YEL'FILE
		GOTO	FALSE
	THEN	IOER	FILE
		LOOKUP	QCH'FILE,YEL'FILE
		GOTO	I3LOER
		EXEC	I3GBUF
		ST	X0,YBH'FILE
		SETOM	YBH'FILE+2
		SETOFF	YPO'FILE
	FI
>
	SUBTTL	MAIN ROUTINE


	edit(260)
;DELETE .TMP FILES, NO OUTPUT OF ERRORS
;REACHED FROM ALL PASSES AFTER ^C REENTER
						edit(11)
	PORTAL	[L	XPDP,[IOWD QSTSIZ,YSTK] ;[11]
		SETZM	YDMEND	;SUPPRESS ERRORS
		BRANCH	T3REE]
	PROC
I3:	PORTAL	.+1	;[11] Enter concealed mode
	IFG QTRACE,<EXTERN	YTRPAS
			IFON	YTRSW
			GOTO	L1>
	
;GET MORE CORE IF NOT ENOUGH
				edit(144)
	LI	X0,Y3LOWE	;[144] Top addr required
	CORE	X0,		;[144]
	GOTO	[OUTSTR	[ASCIZ	/?NO CORE FOR LOW SEG PASS 3/]
		EXIT]	;[144]
L1():!
			edit(225)
	LI	3	;[225]
	ST	YPASSNO	;[225]
;START ADDR OF ERROR ROUTINES
	L	[XEC	DM]
	ST	.JB41

;INIT PUSH DOWN STACK
	LI	X1,10
	L	X0,[GOTO I3UF]
	LOOP
		ST	X0,YSTK(X1)
	AS
		SOJGE	X1,TRUE
	SA

;INIT TRAP HANDLING
;TAKE CARE OF PUSHDOWN OVERFLOW
	LI	X0,200000
	APRENB	X0,
	L	X0,[GOTO	I3OF]
	ST	X0,.JBAPR
				edit(6)
	MOVNI	XPDP,Q3STSZ-12	;[6]
	MOVSS	XPDP		;[6]
	HRRI	XPDP,YSTK+12-1	;[6]

;SET START AND REENTER ADDRESSES

	LI	I3-1
	HRRM	.JBREN
	LI	I3P1
	HRRM	.JBSA

	IFN	QDEBUG,<EXEC	YP3IN##>

;INIT BEGIN PUSH DOWN STACK

	L	X0,[XWD	-QBEG,YBEGST]
	ST	X0,YBEGSP
	SETOM	YBEGST
;YESEM WILL BE USED BY DM IF ANY ERRORS ARE DETECTED
;IT SHOULD ALWAYS BE = 0 IN PASS 3
	SETZB	X3MASK,YESEM		;Reset switches
	SETONA	NOREL
	EXEC	O3RZ			;READ SYMBOL TABLE INTO CORE
	OUTSTR	I3CRLF			;CR-LF to encourage the programmer

	IF	;TERMINATION ERROR IN PASS 1 OR 2
		IFOFF	YSWTRM
		GOTO	FALSE
	THEN	;CHECK IF LIST IS TO BE CREATED
		IFOFF	YSWP1
		BRANCH	T3T		;WRAP UP IF NO LIST WANTED
	FI
	L	YBRSRC
	ST	YBRBUF			;INITIALIZE DYNAMIC BUFFER POINTER
;IF REL FILE IS GENERATED,CONVERT FORMAT TO SUIT LINK 10
;[144] Set standard protection on REL and LST files
	SETZM	YEXTS+2	;[144]
	SETZM	YEXTS+6	;[144]
	IF
		IFOFF	YSWP1
		GOTO	FALSE
	THEN	;DELETE REL.TMP
		EXEC	T3R
	ELSE
		EXEC	M3
	FI
	L	YBRSRC
	ST	YBRBUF
	EXEC	I3GBUF
	ST	X0,YBHSRC
	IF	;List file wanted or errors in source
		IFON	YSWLST
		GOTO	TRUE
		SKIPN	YDMEND
		GOTO	FALSE
	THEN	;Create a list file
		EXEC	E3
	ELSE	;DELETE LS1.TMP IF EXISTING
		EXEC	T3L
		;OUTPUT STATISTICAL INFORMATION
		EXEC	T3E
	FI
	BRANCH	T3			;TERMINATE PASS3
	EPROC
	SUBTTL	I3E, find ATR file [12], changed v3A(144)

	edit(225)
	edit(144)
	edit(12)
IFE QDEC20,<;[225]

;If an old ATR module with the same name exists, Pass 1 will have placed
;retrieval information in YATRDEV, YATRFN, YATRPPN, YATROFS.
;Find start of ATR module according to this information, or skip return.
;Position to first word of module

I3E::	PROC
	L	X1,YATRDEV
	JUMPE	X1,L8	;There was no old module according to search list
	LI	X0,1B30+14	;Synchronous binary input
	LI	X2,YBHEXT
	OPEN	QCHEXT,X0
	GOTO	L7

	;Look it up again

	L	X0,YATRFN
	MOVSI	X1,'ATR'
	STD	X0,YELEXT
	SETZM	YELEXT+2
	L	YATRPPN
	ST	YELEXT+3
	LOOKUP	QCHEXT,YELEXT
	 GOTO	L8	;on failure
				edit(162)
	ST	YELEXT+3	;[162] Restore ppn
	EXEC	I3GBUF		;Get buffers
	ST	YBHEXT
	SETZM	YBHEXT+2	;Reset byte count
	IF	;Library file (non-zero block no)
		SKIPN	X1,YATROFS
		GOTO	FALSE
	THEN	;Position to correct block, set flag
		USETI	QCHEXT,(X1)
		SETONA	INLIB
	FI
	EXEC	O3RA
	AOS	YBHEXT+2
	HLRZ	YATROFS		;word offset
	IF	;non-zero
		JUMPE	FALSE
	THEN	;Adjust byte pointer, count
		ADDM	YBHEXT+1
		MOVN
		ADDM	YBHEXT+2
	FI
	GOTO	L9

L7():!	L	X1,[ASCIZ/EXT/]
	JSP	I3OPER

L8():!	AOS	(XPDP)
L9():!	RETURN
	EPROC
>;[225]
	SUBTTL	I3E, find ATR file, DEC-20 version

	edit(225)
IFN QDEC20,<;[225]

;If an old ATR module with the same name exists, Pass 1 will have placed
;retrieval information in YATRJFN, YATRSZ,
; YATRDEV, YATRFN, YATRPPN, YATROFS.
;Find start of ATR module according to this information, or skip return.
;Position to first word of module

I3E::	PROC
	HRRZ	X1,YATRJFN
	JUMPE	X1,L8	;There was no old module according to search list
	ST	X1,YEXTJFN
	L	X2,[^D36+OF%HER+OF%RD+OF%NWT+OF%PLN]
	OPENF
	GOTO	L7	;On failure

	L	X3,YATROFS
	IF	;Non-zero offset
		JUMPE	X3,FALSE
	THEN	;Convert to word offset in file
		HLRZ	X0,YATROFS
		SUBI	X3,1
		LSH	X3,7
		HRRZS	X3
		ADD	X3,X0
		SETONA	INLIB	;Library flag
	FI
	L	YATRSZ
	ST	YEXTSZ
	LI	1
	ST	YEXTAD
	EXEC	O1EXMP	;Map into core
	GOTO	L9

L7():!	L	X1,[ASCIZ/EXT/]
	JSP	I3OPER

L8():!	AOS	(XPDP)
L9():!	RETURN
	EPROC
>;[225]
	SUBTTL	Open LS1, LST
I3L::	;OPEN FILE LS1
	IFCORE	LS1
	RETURN

I3LS3::	;OPEN FILE LST
	IOER	LST
	SKIPN	X3,YEXTS+10
	MOVSI	X3,'DSK'
	LI	X2,0
	MOVSI	X4,YBHLS3
	OPEN	QCHLS3,X2
	GOTO	I3OPER
				edit(162)
	LD	X0,YEXTS	;[162] Use real file name
	STD	X0,YELLS3
	LD	X0,YEXTS+2	;[162]
	STD	X0,YELLS3+2	;[162]
	ENTER	QCHLS3,YELLS3
	GOTO	I3ENER
	ST	X1,YELLS3	;[162] Reset path field
	EXEC	I3GBUF
	ST	X0,YBHLS3
	SETOM	YBHLS3+2
	SETON	YOPLS3
	RETURN
	SUBTTL	Open IC2, SRC, XRF
I3I::	;OPEN FILE IC2
	IFCORE	IC2
	RETURN

I3S::	;OPEN FILE SRC
	IOER	SRC
	L	YBHSRC	;SAVE FIRST WORD
	LI	X2,0
	SKIPN	X3,Y3DEV
	MOVSI	X3,'DSK'
	LI	X4,YBHSRC
	OPEN	QCHSRC,X2
	GOTO	I3OPER
	TLO	400000
	ST	YBHSRC	;RESTORE FIRST WORD
	LOOKUP	QCHSRC,YELSRC
	  GOTO	I3LOER
	SETOM	YBHSRC+2
	SETON	YOPSRC
	RETURN

I3X::	;OPEN FILE XRF
	IFCORE	XRF
	RETURN
	SUBTTL	Set up a buffer ring


I3GBUF:	PROC
	SAVE	<X2,X3>
	L	X0,YBRBUF
	HLRZ	X3,X0
	SKIPG	X3
	LI	X3,2	;Standard no of buffers = 2
	ADDI	X0,1
	HRLI	X0,201
	L	X2,X0
	WHILE
		SOJE	X3,FALSE
	DO
		L	X1,X2
		ADDI	X2,QBUFS+1
		ST	X2,(X1)
	OD
	ST	X0,(X2)
	HRLI	X0,400K
	LI	X2,QBUFS(X2)
	ST	X2,YBRBUF
	ASSERT	<CAIL	X2,Y17BUF
		RFAIL	Buffer overflow Pass 3
		>
	RETURN
	EPROC	;O1SETB
	SUBTTL	Error exits

I3OPER:
	;HERE IF ERROR IN OPEN
	ERRT	QT,Q.TER
	BRANCH	T3T3
I3LOER:
	;HERE IF ERROR IN LOOKUP
	ERRT	QT,Q.TER+1
	BRANCH	T3T3
I3ENER:
	;HERE IF ERROR IN ENTER
	ERRT	QT,Q.TER+2
	BRANCH	T3T3

	edit(12)
I3INER:	;[12] IN error
	ERRT	QT,Q.TER+3
	BRANCH	T3T3

I3UF:
	L	XPDP,[IOWD	QSTSIZ-12,YSTK+12]
	L	X1,[ASCIZ	/3/]
	ERRT	QT,Q.UFL
	BRANCH	T3T3
I3OF:
	L	XPDP,[IOWD	QSTSIZ-12,YSTK+12]
	L	X1,[ASCIZ	/3/]
	ERRT	QT,Q.OFL
	BRANCH	T3T3

I3CRLF:
	ASCIZ	/
/
	SUBTTL	Swap in PASS 1

I3P1:

	edit(225)
TOPS10,<;[225]
			EDIT(260)
	PORTAL	.+1	;[260]
	L	X3,[XWD 1,Y1LOWE]
	IFG QTRACE,<IFON YTRSW
		HRRI	X3,0>
	SWAPPA(SIMULA,S1,0,QP1PPN)
>
TOPS20,<BRANCH SIMULA##>;[225]
	SUBTTL	Literals
	LIT
	edit(225)
TOPS20,<END>;[225] ENTRY POINT IN PASS1 ONLY
	END	I3