Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-03 - decus/20-0078/comp/m2.mac
There are 2 other files named m2.mac in the archive. Click here to see a list.
;AUTHOR:	STEFAN ARNBORG
;VERSION:	3A [40,41]
;PURPOSE:	MAIN PASS 2 SCAN LOOP 
;		CORE ALLOCATION
;		AND PASS 2 UUO HANDLING
;CONTENTS:	M2EN,M2UU,M2LN,M2CO
	SEARCH	SIMMAC,SIMMC2,SIMMCR,SIMRPA
	CTITLE	M2
	INTERN	M2EN,M2UU,M2CO
	EXTERN	CGRD,O2IC2T,DM,O2LN2
	EXTERNAL	CGPU
	EXTERNAL	CAUD
	EXTERNAL	CGAD,CGCA,CGCC,CGCO,CGVA
	EXTERN	CGEN,ORLU,ORSM
	EXTERN	CAEN,OREN,ODEN,O2IS,O2IV,O2AB
	EXTERN	CGIM,CGIM1,CGLO,CGLO1,CGMO,CGMO1,O2AD,O2GI,O2GWD
	EXTERN	CADS,CGG2,CGG3,CGG4,CGR2,CGR3,CGR4,O2CF,O2GA,O2GF,O2GR,O2GW,O2DF
	EXTERN	YRELCD,YOPST,YORPAR,YERRCT,YM2EWS,YWARCT,YMAXID,YGAP
	EXTERN	YLINE,YDCSTO,YOLINE,YSTATM,YOPSTP,YOPSTB
	IFN	QDEBUG,<
	EXTERN	YM2DAD,YM2DB
	>
,Y3OPEN
	ASSERT<DSW	SM2DB1,YM2DB,1
IFN	QDEBUG,<	EXTERN	YMESS,YM2DBC,YP2IN,YO2DBZ>
	EXTERN	O2DB1,O2DB5
	>
	DEFINE	CLCO=<
	SKPINC
	NOP
	>
	OPDEF	ACFIELD	[POINT	4,0,13]
	OPDEF 	OUTSTR	[TTCALL	3,]
	SALL
	CGINIT
	MACINIT
	TWOSEG
	RELOC	400000
; JOB DATA AREA LOCATIONS (OPERATING SYSTEM INTERFACE)
.JB40=40
.JB41=41
.JBDDT=74
		DSW	SPAREN,YORPAR,36
;PURPOSE:	MAIN LOOP IN PASS 2. READS A NEW SYMBOL FROM IC1 AND
;		ENTERS THE CORRESPONDING PASS 2 COMPONENT
;ENTRY:		M2EN
;NORMAL EXITS:	OREN,ODEN,CAEN,M2LN
;ERROR EXIT:	ILLEGAL SYMBOL (ABORT)
;ERRORS GENERATED:NONE
;USED ROUTINES:	O2IS
	SUBTTL	M2EN
M2EN:	STACK	[Z .]
	EXEC	O2IS
	ASSERT<
		TLNE	XCUR,-1
		RFAIL	LEFT HW OF SYMBOL NON-ZERO
	>
	TRNE	XCUR,400K	; CHECK FOR %LINE SYMBOL (MOST FREQUENT)
	BRANCH	M2LN
	CAIG	XCUR,SYMBL2
	BRANCH	OREN
	CAIG	XCUR,SYMBL3
	BRANCH	CAEN
	ASSERT<
		CAIG	XCUR,SYMBL4
		BRANCH	ODEN
		CAIGE	XCUR,QLOWID
		RFAIL	ILLEGAL SYMBOL IN M2
		CAMLE	XCUR,YMAXID
		RFAIL	ILLEGAL IDENTIFIER IN M2
	>
	BRANCH	ODEN
	SUBTTL	M2UU
;PURPOSE:	UUO INSTRUCTION HANDLING
;		FOR ERRORS,WARNINGS AND VARIOUS DEBUG CHECKS
;ENTRY:		M2UU ENTERED FROM PUSHJ IN .JB41
;NORMAL EXITS:	RETURN BY POPJ FOR NON-FATAL ERROR UUO:S
;		BY EXIT FOR RFAI AND ABORT
;		RFAI EXITS TO DDT IF IT IS LOADED
;I/O PERFORMED:	MESSAGE WRITTEN ON TTY IN DEBUG VERSION
;		PRODUCE A DUMP IF RFAI EXECUTED AND DDT NOT LOADED
;USED ROUTINES:	DM
M2UU:	PROC
	IFN QDEBUG,<
		ST	YO2DBZ
		L	@(XPDP)
		EXCH	YO2DBZ
	>
	SAVE <X0,X1,X2,X3,X4,X5,XP2>
	; NOTE: ONLY XP2 AND X0 MAY BE CHANGED BEFORE A RECURSIVE CALL
	IFN QDEBUG,<STACK	YMESS
	L	YO2DBZ
	SETZM	YO2DBZ
	ST	YMESS
	>
	L	.JB40
	LDB	XP2,[POINT 9,0,8]
	GOTO	.+1-QUUO(XP2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STR	[ASCIZ/
;SEV /]
;	>
	HRRZ	X1,@
	LDB	[ACFIELD]
	ADDI	Q2.ERR
	HRLI	(ERRI1	QE,)
	XCT
	GOTO	EGZIT
.SEV1:;	IFN	QDEBUG,<OUTSTR	[ASCIZ/
;SEV1 /]
;	>
	HRRZ	X1,@
	LDB	[ACFIELD]
	ADDI	Q2.ERR+20
	HRLI	(ERR	QE,)
	XCT
	GOTO	EGZIT
.SEV2:;	IFN	QDEBUG,<OUTSTR	[ASCIZ/
;SEV2 /]
;	>
	HRRZ
	ADDI	Q2.ERR
	HRLI	(ERR	QE,)
	XCT
	GOTO	EGZIT
EGZIT:	SETON	SCERFL
	LI	QRELCD
	ST	YGAP
	L	[RTSERR	QDSCON,QSORCERR]	;[41]
	GENABS	; ERROR CALL FOR SOURCE ERRORS
EGZITW:	IFN	QDEBUG,<
		HLRZ	X1,YMESS
		HRRZ	YMESS
		CAIN	X1,(NOP)
		GOTO	[TLO	(OUTSTR)
			NOP;XCT
			GOTO	.+1]
	UNSTK	YMESS
	>
	RETURN
.FATA:	IFN	QDEBUG,<
		CLCO
;	OUTSTR	[ASCIZ/
;FATAL ERROR /]
		HLRZ	X1,YMESS
		HRRZ	YMESS
;		CAIN	X1,(NOP)
;		GOTO	[TLO	(OUTSTR)
;			XCT
;			GOTO	.+1]
		UNSTK	YMESS
		RESTORE
		EXEC	YP2IN
	>
	HRRZ	.JB40
	ADDI	Q2.TER
	HRLI	(ERR	QT,)
	XCT
	SETON	YSWP1	; THIS CAUSES A LIST TO BE PRODUCED IN PASS 3
PMDUMP:	SETO	;GET LCH OF JOB TTY/PTY
	IFN	QDEBUG,<
	GETLCH	; TO X0
	SKIPGE	; NEGATIVE IF PTY
	BRANCH	O2AB	; BATCH JOB: DONT ASK UNANSWERABLE QUESTIONS
	OUTSTR	[ASCIZ/
? TYPE D FOR DUMP, C FOR CONTINUE,E FOR EXIT
 /]
	ASSERT<	ST	YMESS>
		AOS	YM2DAD
	IF	CLRBFI	0
		SETZ
		INCHRW	0
		OUTCHR	0
		CAIE	"D"
		GOTO	FALSE
	THEN
		L	X2,[XWD	6,YM2DAD]
		DAEMON	X2,
		Z
		LI	[SIXBIT/SYS/
			SIXBIT/DUMP/
			EXP	0,0,0,0]
		CLOSE	QCHDEB,0
		RUN
		RFAIL	NO DUMP PROGRAM
	ELSE
	IF	CAIE	"C"
		GOTO	FALSE
	THEN
	IFN	QDEBUG,<	L	YMESS
	>
		POPJ	17,0
	FI
	FI
	>
	CLRBFI	0
	GOTO	O2AB
	EPROC
	SUBTTL	M2LN
		COMMENT;
PURPOSE:	READ LINE NUMBER FROM IC1

ENTRY:		M2LN

NORMAL EXIT:	RETURN

ERROR EXIT:	NONE

ERRORS GENERATED:	NONE

USED ROUTINES:	O2IV, CGEN, ERRLI, ORLU, ORSM
;
M2LN:	PROC
	IF	; OPERAND STACK NON-EMPTY
		HRRZ	YOPSTP
		CAIGE	YOPST
		GOTO	FALSE
	THEN
		STACK	XCUR
		LI	XP1,YOPST
		WHEN	XP1,ZLI
		EXEC	ORLU
		EXEC	ORSM
		IF
			IFOFF	SPAREN
			GOTO	FALSE
		THEN
		ERROR2	33,PARENTHESISED EXPRESSION IS NOT A VALID STATEMENT
		EXEC	CGPU
		ELSE
		LI	XCUR,YOPST
		L	XL1,YRELCD		; SAVE FOR LINE TABLE ENTRY
		IF
			WHEN	XCUR,ZNS
			GOTO	FALSE
		THEN
			IFOFF	SCERFL
			ERROR2	33,EXPRESSION IS NOT A VALID STATEMENT
			EXEC	CGPU
		ELSE
			LF	,ZNSGEN(XCUR)
			IF	CAIN	%PCALL
				GOTO	FALSE
				CAIN	%NEW
				GOTO	FALSE
			THEN	IFOFF	SCERFL
				ERROR2	33,ONLY NEW OR PROCCALL ON OUTERMOST LEVEL
			EXEC	CGPU
			ELSE
			EXEC	CGEN
			FI
		FI
		FI
		UNSTK	XCUR
	FI
	TRZ	XCUR,400K		;CLEAR %LINE SYMBOL BIT
	ST	XCUR,YOLINE
	EXEC	O2IV
	HRLI	-1
	TRZN	400K
	HRLI	0	; NOT IN DECLARATIONS
	ST	YSTATM
	EXEC	O2IV
	ST	YLINE
	IF
		L	YWARCT
		ADD	YERRCT
		CAMG	YM2EWS
		GOTO	FALSE
	THEN	; NEW ERROR OR WARNING HAS BEEN PRODUCED
		ST	YM2EWS
		ERRLI
	FI
	IF	IFOFF	YSWI
		GOTO	FALSE
	THEN
		EXEC	O2LN2
	FI
	IFN	<QDEBUG>,<
		L	YLINE
		OP	(NOP)
		L	X1,YM2DBC
;		CAME	X1,YRELCD
		; TO OUTPUT JFCL WITH LINE NUMBER FOR DEBUGGING
;		GENABS
		IF	IFOFF	SM2DB3
			GOTO	FALSE
			L	YM2DBC
			CAMN	YRELCD
			GOTO	FALSE
		THEN
			EXEC	O2DB1,<<[XWD	020000,0]>>
			LI	X2,(SIXBIT/LIN/)
			HRLI	X2,622200
			HRL	X3,YOLINE
			HRR	X3,YLINE
			HRL	X4,YSTATM
			EXEC	O2DB5,<X2,X3,X4>
		FI
		L	YRELCD
		ST	YM2DBC
	>
	RETURN
	EPROC
	SUBTTL	M2CO
COMMENT;
PURPOSE:	ALLOCATE ANOTHER PAGE AND INCREASE YDCSTO

NORMAL EXIT:	RETURN, RESTORE X0

ERROR EXIT:	FATAL ERROR IF CORE NOT AVAILABLE

;
M2CO:	PROC
	SAVE	<X0,X1,X2>
	L	YDCSTO
	ADDI	1000
	ST	YDCSTO
	CORE
	FATAL	2,CORE NOT AVAILABLE
	RETURN
	EPROC
	END