Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-03 - decus/20-0078/comp/simmac.mac
There are 3 other files named simmac.mac in the archive. Click here to see a list.
;<ENDERIN>SIMMAC.MAC.14, 12-Jan-77 17:30:18, Edit by ENDERIN
;	UNIVERSAL SIMMAC MACRO LIBRARY


Comment ;

Authors:	Stefan Arnborg
		Olof Bjoerner
		Claes Wihlborg

Purpose:	This file contains definitions common
		to the SIMULA system.

Version:	4A [03 10 06,04 07 00,12 20 11,13 00 12,14 22 12,14 22 15,
		    40,104,136,140,170,217,221,225,247,253,255,260,262,274,275,277,300,306,310]

Contents:	1. Assembly constants ......... 2
		2. Macro library .............. 3
		   Stack macros ............... 3
		   Queue macros ............... 4
		   Conditional macros ......... 5
		   BEGIN, ENDD macros ......... 6
		   Miscellaneous macros ....... 6-1
		   Switch (flag) macros ....... 7
		   Subroutine linkage ......... 8
		   Record, field macros ....... 9
		    LF, SF, WLF, WSF, ZF, SETF  9
		    DF (Define Field) ......... 10
		    DR (Define Record) ........ 10
		    Record discrimination ..... 11
		   REServed WorDs macro ....... 12
		   SYStem IDentifiers (SYSID) . 13
		   SYMBOL macro ............... 14
		   SWAPPA(SS) macro ........... 17
		   Type codes, declaration fields 18
		   DF1 and PASS2 fields ....... 19
		3. Global switch definitions .. 20
		4. Register assignments ....... 25
		5. Operator definitions ....... 26
		6. Macros for defining versions 28
;

IF2,<	PRINTX Update: 310	18-July-1978 12:40/LE
IFDEF .DIRECTIVE,<.DIRECTIVE .NOBIN>;[221]
>

	SALL
	SUBTTL	Assembly constants

;	**********************
;	* Assembly constants *
;	**********************

IFNDEF QSYS,<QSYS==1>		;QSYS   == 1 Means version on SYS area
IFNDEF QDEC20,<QDEC20==1>	;[225] QDEC20 == 1 means TOPS-20 version
IFNDEF QDEBUG,<QDEBUG==0>	;QDEBUG == 1 means DEBUG, not production mode
IFNDEF QERIMP,<QERIMP==1>	;QERIMP == 1 means errors implemented
IFNDEF QSADEA,<QSADEA==1>	;SPECIAL DEALLOCATION ON BLOCK EXIT ETC
IFNDEF QSASTE,<QSASTE==1>	;QSASTE == 1 MEANS ALLOCATION IN STEPS
IFNDEF QTIMER,<QTIMER==0>	;QTIMER == 1 MEANS EXPAND TIMER MACRO
IFNDEF QTRACE,<QTRACE==0>	;QTRACE == 1 MEANS INCLUDE TRACE FACILITIES
IFE QSYS,<QSYSDEV==SIXBIT/DSK/>
IFN QSYS,<QSYSDEV==SIXBIT/SYS/>
DEFINE TOPS20<IFN QDEC20>;[247]
DEFINE TOPS10<IFE QDEC20>;[247]

			;[247]
	IFNDEF QKI10,<
	 IFNDEF .CPU.,<QKI10==<QKA10==<QKL10==0>>+1>
	 IFDEF .CPU.,<
		QKA10==<QKI10==<QKL10==0>>
		IFL <.CPU.-2>,<PRINTX *** Illegal CPU! ***>
		IFE <.CPU.-2>,<QKA10==1>
		IFG <.CPU.-2>,<QKI10==1>
		IFG <.CPU.-3>,<QKL10==1>
		>
	>

DEFINE	KL10<IFN QKL10>;[247]
DEFINE	KI10<IFN QKI10>;[247]
DEFINE	KA10<IFN QKA10>;[247]

;	PROCESSOR CODE WORD IN NAME BLOCK IN REL FILE
;	IN THIS INSTALLATION SIMULA = OCTAL 15 DETERMINED
;	IN LINK-10 LNKPAR PROCESSORS MACRO
IFNDEF	QSIMREL,<IFN QKI10,<QSIMREL==020015,,0>
		IFN QKA10,<QSIMREL==010015,,0>
		>

;[130012] External classes and procedures:
;  Standard library name, system library device (may be changed to SIM later?)
	QEXLIB==SIXBIT/LIBSIM/
	QEXDEV==SIXBIT/SYS/

;	SET INSTALLATION DEPENDENT PPN TO 0 IN SYS VERSION
;	OR IF NOT DEFINED IN TEST VERSION (I.E. OWN AS DEFAULT)
IFNDEF QERPPN,<	QERPPN==0>	;;SIMERR.ERR
IFNDEF QHEPPN,<	QHEPPN==0>	;;HELP FILES SIMCOM AND SIMRTS
IFNDEF QP1PPN,<	QP1PPN==0>	;;SIMULA (PASS1)
IFNDEF QP2PPN,<	QP2PPN==0>	;;SIMP2  (PASS2)
IFNDEF QP3PPN,<	QP3PPN==0>	;;SIMP3  (PASS3)
IFNDEF QRTPPN,<	QRTPPN==0>	;;SIMRTS (RUN TIME SYSTEM)
IFNDEF QDEPPN,<	QDEPPN==0>	;;SIMDDT (DEBUG SYSTEM)


;	STANDARD CHANNEL NAMES
;	THE CHANNEL NUMBER MUST NOT BE CHANGED WITHOUT CHANGING
;	THE MACRO CALL DCHSW IN SIMMAC AND CONSTANT TABLE T3FINA IN MODULE T3(PASS 3)

	QCHTTY==0
	QCHSRC==1
	QCHEXT==2
	QCHLS1==3
	QCHIC1==4
	QCHDF1==5
	QCHZSE==6
	QCHREL==7
	QCHATR==10
	QCHXRF==11
	QCHIC2==12
	QCHLST==13
	QCHDEB==14
	QCHERR==15
	QCHIC3==QCHREL
	QCHLS3==QCHLST
	QCHTRC==16
	QCHCOM==17


;  NON-PRINTABLE CHARACTERS:

	QNUL==000	;NULL
	QEOT==004	;END-OF-FILE SYMBOL
	QHT==011	;HORIZONTAL TAB
	QLF==012	;LINE FEED
	QVT==013	;VERTICAL TAB
	QFF==014	;FORM FEED
	QCR==015	;CARRIAGE RETURN
	QALTMODE==033	;ALTMODE
	QDEL==177	;DELETE

;  BUFFER SIZES:

	QBUFS==203	;DISK BUFFER SIZE
	QSTSIZ==1200	;NO OF WORDS IN PUSH DOWN STACK
	QSTLL==7	;LENGTH OF YDPD-LEVEL
	QZSELE==6000	;INITIAL SIZE OF ZSE
	QDC1LE==1000	;INITIAL SIZE OF DC1

;IF QE3D OR QE3M IS CHANGED DO
;	-RECOMPILE LOWSEG
;	-RECOMPILE O3.MAC DEBUG VERSION
;	-CHANGE VALUE OF QE3D AND QE3M AND LENGTH OF CORRESPONDING LIST IN SUTERR.CBL

	QE3D==700	;LENGTH OF YE3D
	QE3M==700	;LENGTH OF YE3M
	QBEG==120	;LENGTH OF PUSHDOWN STACK BEGIN NUMBER
	QLDM==^D150	;LENGTH OF ZDM


	QMAXDIS=^D32	;MAX DISPLAY SIZE	;[12 20 11]


;	ACCUMULATORS FOR RTS 
;	THESE ARE ALLOCATED BY THE COMPILER

	XWAC1==3
	XWAC2==XWAC1+1
	XWAC3==XWAC2+1
	XWAC4==XWAC3+1
	XWAC5==XWAC4+1
	XWAC6==XWAC5+1
	XWAC7==XWAC6+1
	XWACL==14
IFL	<XWAC7-XWACL>,<XWAC10==XWAC7+1>
IFL	<XWAC10-XWACL>,<XWAC11==XWAC10+1>

;	QNAC IS NUMBER OF ACCUMULATORS  AND ALSO SIZE OF PSEUDOREGISTER STACK

	QNAC==<XWACL-XWAC1+1>

	QHASHM==13045647327


IFN QDEC20,<;[225]
DEFINE DIRST%<XEC DIRST.##>
DEFINE PPNST%<XEC PPNST.##>
DEFINE STPPN%<XEC STPPN.##>
>
	SUBTTL	STACK MACROS
	
;			*****************
;			* MACRO LIBRARY *
;			*****************


;			STACK HANDLING
;			==============
;
;
; Stack creation: GETSTACK a,h
;		  a=stackname, one letter
;		  h=halfword if given, otherwise full word
; This macro defines one stack, the operations on the stack
; and the assembly-time variables necessary
;
; Insertion in stack:   aPUSH W  or  aPUSH LH,RH
;
; deletion from stack:	aPOP  W  or  aPOP  LH,RH
; Arguments are optional
;
; Valuable assembly-time variables:
;	aSSIZE	(Number of elements in stack
;	aTOP	(Top element in stack
;	aTOPL	(Top left halfword in stack
;	aTOPR	(Top right halfword in stack
;
;
;
IF2,<

DEFINE GETSTACK (A,H)<
	.XCREF
	X=-1
	IRPC A,<
	X=X+1>
	IFN X,<$$E(<Stack name a not one letter>)>
	IFE X,<
IF1,<	IFDEF A'SSIZE,<$$E(<Double decl. of stack a>)>>
	A'SSIZE=0	
	IFB <H>,<A'TOP=0>	
	IFNB <H>,<A'TOPL=0	
	A'TOPR=0>	
	IFB <H>,<
DEFINE  A'PUSH (D)<
	IFE  A'SSIZE -7777,<$$E(<Overflow in stack a>)>
	A'SSIZE=A'SSIZE+1
	$$C(A,\A'SSIZE,$)=A'TOP
	A'TOP=D
>>
	IFNB <H>,<
DEFINE  A'PUSH (D,E)<
	IFE  A'SSIZE-7777,<$$E(<Overflow in stack a>)>
	A'SSIZE=A'SSIZE+1
	$$C(A,\A'SSIZE,$)=A'TOPL*1000000+A'TOPR
	A'TOPL=D
	A'TOPR=E
>>
	IFB <H>,<
DEFINE  A'POP(D)<
	IFE  A'SSIZE,<$$E(<Underflow in stack a>)>
	IFG A'SSIZE,<
	IFNB <D>,<D=A'TOP>
	A'TOP=$$C(A,\A'SSIZE,$)
	$$$P(A,\A'SSIZE,$)
	A'SSIZE=A'SSIZE-1
>>>
	IFNB <H>,<
DEFINE  A'POP (D,E)<
	IFE  A'SSIZE,<$$E(<Underflow in stack a>)>
	IFG A'SSIZE,<
	IFNB <D>,<D=A'TOPL>
	IFNB <E>,<E=A'TOPR>
	A'TOPL=$$C(A,\A'SSIZE,$)/1000000
	A'TOPR=$$C(A,\A'SSIZE,$)&777777
	$$$P(A,\A'SSIZE,$)
	A'SSIZE=A'SSIZE-1
>>>
>
.CREF
>
	SUBTTL	QUEUE MACROS
;
;			QUEUE HANDLING
;			==============
;
;
; Queue creation: GETQUE a,h
;  		  a=queuename, one letter
;		  h=halfword if given, otherwise full word
; This macro defines one queue, the operations on the queue
; and the assembly time variables necessary
;
; Insertion in queue:  aINQ  W  or aINQ  LH,RH
;
; Deletion from queue: aOUTQ W  or aOUTQ LH,RH
; Arguments are optional
;
; Valuable assembly time variables:
;	aQSIZE  (Number of elements in queue
;	aHEAD	(First element in queue
;	aHEADL	(First left halfword in queue
;	aHEADR	(First right halfword in queue
;
;
;
DEFINE  GETQUE (A,H)<
	.XCREF
	X=-1
	IRPC A,<
	X=X+1>
	IFN X,<$$E(<Queue name a not one letter>)>
IF1,<	IFDEF A'QSIZE,<$$E(<Double decl. of queue a>)>>
	$$Q'A'H=0
	$$Q'A'T=0
	A'QSIZE=0
	IFB <H>,<
DEFINE  A'OUTQ(W)<
	IFE A'QSIZE,<$$E(<Underflow in queue a>)>
	IFNB <W>,<W=A'HEAD>
	A'QSIZE=A'QSIZE-1
	$$$P(A,\$$Q'A'H,%)
	$$Q'A'H=<$$Q'A'H+1>&7777
	IFN A'QSIZE,<A'HEAD=$$C(A,\$$Q'A'H,%)>
>
DEFINE  A'INQ(W)<
	IFE A'QSIZE-7777,<$$E(<Overflow in queue a>)>
	$$C(A,\$$Q'A'T,%)=W
	IFE A'QSIZE,<A'HEAD=W>
	A'QSIZE=A'QSIZE+1
	$$Q'A'T=<$$Q'A'T+1>&7777
>
>
	IFNB <H>,<
DEFINE  A'OUTQ(L,R)<
	IFE A'QSIZE,<$$E(<Underflow in queue a>)>
	IFNB <L>,<L=A'HEADL>
	IFNB <R>,<R=A'HEADR>
	A'QSIZE=A'QSIZE-1
	$$$P(A,\$$Q'A'H,%)
	$$Q'A'H=<$$Q'A'H+1>&7777
	IFN A'QSIZE,<A'HEADL=$$C(A,\$$Q'A'H,%)/1000000
		A'HEADR=$$C(A,\$$Q'A'H,%)&777777>
>
DEFINE  A'INQ(L,R)<
	IFE A'QSIZE-7777,<$$E(<Overflow in queue a>)>
	$$C(A,\$$Q'A'T,%)=L*1000000+R
	IFE A'QSIZE,<A'HEADL=L
	A'HEADR=R>
	A'QSIZE=A'QSIZE+1
	$$Q'A'T=<$$Q'A'T+1>&7777
>
>
.CREF
>
	SUBTTL	COND MACROS
;
;			CONDITIONAL STATEMENTS
;			======================
;
;
DEFINE IF<
	.XCREF
	$$C($$,\<$$BSP>)==$$BST
	$$C($$,\<$$BSP+1>)==$$LT
	$$C($$,\<$$BSP+2>)==$$LF
	$$C($$,\<$$BSP+3>)==$$LE
	$$BSP==$$BSP+4
	$$BST==1
	$$LT==$$L
	$$LF==$$L+1
	$$L==$$L+2
	$$$IF
	.CREF
>
DEFINE THEN<
	.XCREF
	IFN $$BST-1,<$$E(<Illegal then>)>
	$$$THEN
	$$C(L,\$$LT):$$BST==5
	.CREF
>
DEFINE ELSE<
	.XCREF
	IFN $$BST-5,<$$E(<Illegal else>)>
	$$LE==$$L
	$$L==$$L+1
	GOTO $$C(L,\$$LE)-$$RELO($$BAS)
	$$C(L,\$$LF): $$BST==6
	.CREF
>
DEFINE FI<
	.XCREF
	IFN<$$BST-5>*<$$BST-6>,<$$E(<Illegal fi>)>
	IFE $$BST-5,<
	$$C(L,\$$LF):>
	IFE $$BST-6,<
	$$C(L,\$$LE): $$$P2(L,\$$LE)>
	$$$P2(L,\$$LT)
	$$$P2(L,\$$LF)
	$$BSP==$$BSP-4
	$$BST==$$C($$,\<$$BSP>)
	$$LT==$$C($$,\<$$BSP+1>)
	$$LF==$$C($$,\<$$BSP+2>)
	$$LE==$$C($$,\<$$BSP+3>)
	.CREF
>
;
;
DEFINE WHILE<
	.XCREF
	$$C($$,\<$$BSP>)==$$BST
	$$C($$,\<$$BSP+1>)==$$LT
	$$C($$,\<$$BSP+2>)==$$LF
	$$C($$,\<$$BSP+3>)==$$LE
	$$BSP==$$BSP+4
	$$BST==2
	$$LT==$$L
	$$LF==$$L+1
	$$LE==$$L+2
	$$L==$$L+3
	$$C(L,\$$LE): $$$WHILE
	.CREF
>
DEFINE DO<
	.XCREF
	IFN $$BST-2,<$$E(<Illegal do>)>
	$$$DO
	$$C(L,\$$LT): $$BST==7
	.CREF
>
DEFINE OD<
	.XCREF
	IFN $$BST-7,<$$E(<Illegal od>)>
	GOTO $$C(L,\$$LE)-$$RELO($$BAS)
	$$C(L,\$$LF): $$BSP==$$BSP-4
	$$$P2(L,\$$LT)
	$$$P2(L,\$$LF)
	$$$P2(L,\$$LE)
	$$BST==$$C($$,\<$$BSP>)
	$$LT==$$C($$,\<$$BSP+1>)
	$$LF==$$C($$,\<$$BSP+2>)
	$$LE==$$C($$,\<$$BSP+3>)
	.CREF
>
;
;
DEFINE LOOP<
	.XCREF
	$$C($$,\<$$BSP>)==$$BST
	$$C($$,\<$$BSP+1>)==$$LT
	$$C($$,\<$$BSP+2>)==$$LF
	$$BSP==$$BSP+3
	$$LT==$$L
	$$LF==$$L+1
	$$L==$$L+2
	$$C(L,\$$LT): $$BST==10
	.CREF
>
DEFINE AS<
	.XCREF
	IFN $$BST-10,<$$E(<Illegal as>)>
	$$BST==3
	$$$AS
	.CREF
>
DEFINE SA<
	.XCREF
	IFN $$BST-3,<$$E(<Illegal sa>)>
	$$$SA
	$$C(L,\$$LF): $$BSP==$$BSP-3
	$$$P2(L,\$$LT)
	$$$P2(L,\$$LF)
	$$BST==$$C($$,\<$$BSP>)
	$$LT==$$C($$,\<$$BSP+1>)
	$$LF==$$C($$,\<$$BSP+2>)
	.CREF
>
;
;
DEFINE GOIF<
	.XCREF
	$$C($$,\<$$BSP>)==$$BST
	$$C($$,\<$$BSP+1>)==$$LT
	$$C($$,\<$$BSP+2>)==$$LF
	$$BSP==$$BSP+3
	$$LT==$$L
	$$LF==$$L+1
	$$L==$$L+2
	$$BST==4
	$$$GOIF
	.CREF
>
DEFINE TO(A)<
	.XCREF
	IFN $$BST-4,<$$E(<Illegal to>)>
	$$$TO
	$$C(L,\$$LT): $$BSP==$$BSP-3
	GOTO A
	$$C(L,\$$LF):
	$$$P2(L,\$$LT)
	$$$P2(L,\$$LF)
	$$BST==$$C($$,\<$$BSP>)
	$$LT==$$C($$,\<$$BSP+1>)
	$$LF==$$C($$,\<$$BSP+2>)
	.CREF
>
;
;
DEFINE TRUE<$$C(L,\$$LT)-$$RELO($$BAS)>
DEFINE FALSE<$$C(L,\$$LF)-$$RELO($$BAS)>


;	EMPTY MACROS:

DEFINE $$$IF<>
DEFINE $$$THEN<>
DEFINE $$$WHILE<>
DEFINE $$$DO<>
DEFINE $$$AS<>
DEFINE $$$SA<>
DEFINE $$$GOIF<>
DEFINE $$$TO<>


;	INITIATING MACRO:

DEFINE MACINIT=<
	SEARCH	UUOSYM;;[247]
IFN QDEC20,<SEARCH MONSYM>;;[225]
	IF1,<ED$$MX==0>
	DEFINE EDIT(n)<;;[255]
	ED'n==n
	IF1,<
	IFG <n-ED$$MX>,<ED$$MX==n>
	>>
	IF2,<
	DEFINE $$ped(n)<PRINTX Edit: n>
	     IFN ED$$MX,<$$ped(\ED$$MX)>
	     PURGE $$ped,ED$$MX
	>
	.XCREF
	$$L==20
	.CREF
>
	SUBTTL	BLOCK MACROS

;	BEGIN - ENDD
;	============


DEFINE BEGIN<
.XCREF
$$C($$,\<$$BSP>)==$$BST
$$C($$,\<$$BSP+1>)==$$L1
$$C($$,\<$$BSP+2>)==$$L2
$$C($$,\<$$BSP+3>)==$$L3
$$C($$,\<$$BSP+4>)==$$L4
$$C($$,\<$$BSP+5>)==$$L5
$$C($$,\<$$BSP+6>)==$$L6
$$C($$,\<$$BSP+7>)==$$L7
$$C($$,\<$$BSP+10>)==$$L8
$$C($$,\<$$BSP+11>)==$$L9
$$C($$,\<$$BSP+12>)==$$L10
$$BST==11
$$BSP==$$BSP+13
$$L1==$$L+1
$$L2==$$L+2
$$L3==$$L+3
$$L4==$$L+4
$$L5==$$L+5
$$L6==$$L+6
$$L7==$$L+7
$$L8==$$L+10
$$L9==$$L+11
$$L10==$$L
$$L==$$L+12
.CREF
>
DEFINE ENDD<
.XCREF
IFN $$BST-11,<$$E(<Illegal endd>)>
$$BSP==$$BSP-13
$$$PD2(L,\$$L1)
$$$PD2(L,\$$L2)
$$$PD2(L,\$$L3)
$$$PD2(L,\$$L4)
$$$PD2(L,\$$L5)
$$$PD2(L,\$$L6)
$$$PD2(L,\$$L7)
$$$PD2(L,\$$L8)
$$$PD2(L,\$$L9)
$$$PD2(L,\$$L10)
$$BST==$$C($$,\$$BSP)
$$L1==$$C($$,\<$$BSP+1>)
$$L2==$$C($$,\<$$BSP+2>)
$$L3==$$C($$,\<$$BSP+3>)
$$L4==$$C($$,\<$$BSP+4>)
$$L5==$$C($$,\<$$BSP+5>)
$$L6==$$C($$,\<$$BSP+6>)
$$L7==$$C($$,\<$$BSP+7>)
$$L8==$$C($$,\<$$BSP+10>)
$$L9==$$C($$,\<$$BSP+11>)
$$L10==$$C($$,\<$$BSP+12>)
.CREF
>
;
;
;
;			MISCELLANEOUS
;			=============
;
;
DEFINE $$C(A,B,C)<A'B'C'>
;
;
DEFINE X(A)<IRP A,<
$$L'A==0
DEFINE L'A(B)<$$C(L,\$$L'A)>>>
X <1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19>
$$L==20
;
;
DEFINE $$E(A)<IF1,<PRINTX *** ERROR: A ***>>
;
;
DEFINE	$$$P(A,B,C)<
	PURGE A'B'C>

DEFINE	$$$P2(A,B)<
	IF2,<PURGE A'B>>

DEFINE	$$$PD2(A,B)<
	IFDEF A'B,<IF2,<PURGE A'B>>>
;
;
$$BST==0
$$BSP==0
$$LT==0
$$LF==0
$$LE==0
DEFINE $$RELO(A)<0>		;USED IN SIMDDT WHERE RELOCATABLE
				;ADDRESSES CAN  NOT BE USED
				;$$RELO==MODULE START
$$BAS==0			;$$BAS==BASE ACCUMULATOR
;
;
DEFINE RNAME(NEW,OLD)
<.K==0
IRP NEW <.K==.K+1>
RENAM1 <1,2,3,4,5,6,7,10,11,12,13,14,15,16,17>,<NEW>,<OLD>
>

DEFINE RENAM1(LOOP,NEW,OLD)
<IRP LOOP <IFE <LOOP-.K>,<STOPI>
	   .I==0
	   IRP OLD <.I==.I+1
		    IFE <.I-LOOP>,<STOPI
				   .C==OLD>
		   >
	   .I==0
	   IRP NEW <.I==.I+1
		    IFE <.I-LOOP>,<STOPI
				   NEW==.C>
		   >
	  >
PURGE OLD
>
DEFINE	ZEROCHECK(L)=<
	ASSERT<IRP	L <
		IFN	<L>,<CFAIL	ZEROCHECK FAILURE>
		>
	>
>
	SUBTTL	SWITCH MACROS

;		SWITCH HANDLING MACROS
;		======================

	

COMMENT ;

	DSW, SETON, SETOFF, IFON AND IFOFF
	DEFINE MACROS FOR SETTING, RESETTING AND TESTING A SWITCH.
	A SWITCH MAY BE EITHER A SINGLE BIT OR A WORD.
	A SWITCH IS SAID TO BE ON IF IT IS ALL ONES AND OFF
	IF IT IS ZERO.



	DEFINE SWITCH MACRO:

	ARGUMENTS:	W   WORD NAME
			F   BIT NAME
			N   BIT NUMBER (DECIMAL)
			XB  BASE REGISTER (OPTIONAL)

	IF THE SWITCH IS A SINGLE BIT THEN
	THE FOLLOWING IS DEFINED:
			VF  A BIT MASK
			CF  THE COMPLEMENT OF VF
;

DEFINE DSW (F,W,N,XB)=<

IFL <^D36-^D'N>,<$$E(<TOO BIG BIT NO>)>
IFE ^D36-^D'N,<
 IFB <XB>,<DEFINE F(ACC)=<
	IFE <%OP%-2>,<$$E(<ILL SWITCH NAME>)>
	IFN <%OP%-2>,<
	 IFE <%OP%-3>,<%OP3 777777>
	 IFE <%OP%-4>,<%OP3>
	 IFL <%OP%-2>,<%OP4 W(ACC)>
			%OP%==2>>>
 IFNB <XB>,<DEFINE F=<
	IFE <%OP%-2>,<$$E(<ILL SWITCH NAME>)>
	IFN <%OP%-2>,<
	 IFE <%OP%-3>,<%OP3 XB,777777>
	 IFE <%OP%-4>,<%OP3 XB,>
	 IFL <%OP%-2>,<%OP4 W(XB)>
		     %OP%==2>>>>
IFGE	^D35-^D'N,<
	V'F==1B'N
IFE	^D'N,<
	C'F==377777777777>
IFN	^D'N,<
	C'F==-1*V'F-1>
IFGE ^D17-^D'N,<
	C'F==C'F_-^D18
	V'F==V'F_-^D18>

DEFINE	$$TES1(X,Y,Z)<

IFGE	^D17-^D'N,<
IFB <Z>,<DEFINE F(ACC)<
IFE <%OP%-1>,<%OP1 Y>
IFE %OP%,<%OP1 X>
IFE <%OP%-2>,<$$E(<ILL SWITCH NAME>)>
IFGE <%OP%-3>,<IFB <ACC>,<%OP1 Y>
	IFNB <ACC>,<%OP1 ACC,Y>>
IFL<%OP%-2>,<%OP3 W(ACC)>
%OP%==2>>
IFNB <Z>,<DEFINE F=<
IFE <%OP%-1>,<%OP1 Y>
IFE %OP%,<%OP1 X>
IFE <%OP%-2>,<$$E(<ILL SWITCH NAME>)>
IFGE <%OP%-3>,<%OP1 Z,Y>
IFL <%OP%-2>,<%OP3 W(Z)>
%OP%==2>>>

IFL ^D17-^D'N,<
IFB <XB>,<DEFINE F(ACC)<
IFE %OP%-1,<%OP2 Y>
IFE %OP%,<%OP2 X>
IFE <%OP%-2>,<$$E(<ILL SWITCH NAME>)>
IFGE <%OP%-3>,<IFB <ACC>,<%OP2 Y>
	IFNB <ACC>,<%OP2 ACC,Y>>
IFL <%OP%-2>,<%OP3 W(ACC)>
%OP%==2>>
IFNB <XB>,<DEFINE F=<
IFE <%OP%-1>,<%OP2 Y>
IFE %OP%,<%OP2 X>
IFE <%OP%-2>,<$$E(<ILL SWITCH NAME>)>
IFGE <%OP%-3>,<%OP2 Z,Y>
IFL <%OP%-2>,<%OP3 W(Z)>
%OP%==2>>
>
>
	$$TES1(\C'F,\V'F,XB)
	PURGE V'F,C'F
>
>


;	OPCODE MACROS:

	DEFINE SETOFF<
	.XCREF
	OPDEF		%OP1	[HRLOI]
	OPDEF	      %OP2	[HRROI]
	OPDEF	      %OP3	[ANDM]
	OPDEF		%OP4	[SETZM]
		%OP%==0
	.CREF
>

	DEFINE SETON <
	.XCREF
	OPDEF	%OP1	[HRLZI]
	OPDEF	      %OP2	[MOVEI]
	OPDEF	      %OP3	[IORM]
	OPDEF		%OP4	[SETOM]
		%OP%==1
	.CREF
>

	DEFINE IFON  <
	.XCREF
	OPDEF	%OP1	[HRLZI]
	OPDEF	      %OP2	[MOVEI]
	OPDEF	      %OP3	[TDNE]
	OPDEF		%OP4	[SKIPE]
		%OP%==1
	.CREF
>

	DEFINE IFOFF <
	.XCREF
	OPDEF	%OP1	[HRLZI]
	OPDEF	      %OP2	[MOVEI]
	OPDEF	      %OP3	[TDNN]
	OPDEF		%OP4	[SKIPN]
	%OP%==1
	.CREF
>

DEFINE IFONA<
	.XCREF
	      %OP%==3
	OPDEF	      %OP1	[TLNE ]
	OPDEF	      %OP2	[TRNE ]
	OPDEF	      %OP3	[CAIE ]
	.CREF
>

DEFINE IFOFFA<
	.XCREF
	      %OP%==3
	OPDEF	      %OP1	[TLNN ]
	OPDEF	      %OP2	[TRNN ]
	OPDEF	      %OP3	[CAIN ]
	.CREF
>
DEFINE SETONA<
	.XCREF
	      %OP%==3
	OPDEF	      %OP1	[TLO]
	OPDEF	      %OP2	[TRO]
	OPDEF	      %OP3	[SETO]
	.CREF
>

DEFINE SETOFA<
	.XCREF
	      %OP%==4
	OPDEF	      %OP1	[TLZ]
	OPDEF	      %OP2	[TRZ]
	OPDEF	      %OP3	[SETZ]
	.CREF
>
	SUBTTL	SUBROUTINE LINKAGE MACROS


;		SUBROUTINE LINKAGE MACROS
;		=========================

	GETSTACK P
	GETSTACK R
	GETSTACK E
	GETSTACK S

DEFINE	$$KILL	(P1)=<PURGE %.%'P1>

DEFINE	$$HELP	(P1,P2)=<
.CREF
DEFINE P1=<%.%'P2(XPDP)>
.XCREF>


DEFINE	EXEC	(L,X)=<
 .XCREF
 IFNB <X>,<
	 $$LOOP==0
 IRP X,<
	 $$LOOP==$$LOOP-1
	.CREF
	 STACK	X
	.XCREF>
>
	.CREF
	 XEC	L ;;[221]
	.XCREF
 IFDEF $$LOOP,<
	 SUB	XPDP, [XWD -$$LOOP,-$$LOOP]
	 PURGE	$$LOOP>
.CREF
>

DEFINE	PROC	(X)=<
.XCREF
IFDEF $$NO,<$$E(<DOUBLE PROC>)>
IFDEF $$TEMP,<PURGE $$TEMP>
IFNDEF $$NO,<
BEGIN
.XCREF
	 $$NO==0
IRP X,<
	 $$NO==$$NO-1>
	 $$NR==-$$NO
IRP X,<
	 %.%==-$$NO
	 PPUSH	%.%
	 $$C(%.%,\%.%)==$$NO
	 $$HELP(X,\%.%)
	 $$NO==$$NO+1>>
.CREF
>

DEFINE	SAVE	(X)<
.XCREF
IFDEF $$NO,<
IFDEF $$SNOX,<
	 $$E(<DOUBLE SAVE ILLEGAL>)>
IFNDEF $$SNOX,<
	 $$SNOX==0
	$$TEMP==0
IRP X,<
	 $$SNOX==$$SNOX+1
	 SPUSH 	X
	.CREF
	 STACK	X
	.XCREF>
REPEAT $$NR,<
	 PPOP	$$TEMP
	 EPUSH	$$TEMP
	 $$C(%.%,\$$TEMP)==-$$TEMP-$$SNOX>>>
IFNDEF $$NO,<
	 $$SNOY==0
 IRP X,<
	 SPUSH X
	 $$SNOY==$$SNOY+1
	.CREF
	 STACK X
	.XCREF>>
.CREF
>

DEFINE	RETURN=<
	.XCREF
	RESTORE
	 POPJ XPDP,
	.CREF
>

DEFINE RESTORE=<
 IFDEF $$NO,<
  IFDEF $$SNOX,<
   REPEAT $$SNOX,<
	SPOP	$$TEMP
	RPUSH	$$TEMP
	UNSTK	$$TEMP
   >
   REPEAT $$SNOX,<
	RPOP	$$TEMP
	SPUSH	$$TEMP
   >
  >
 >
 IFNDEF $$NO,<
  IFDEF $$SNOY,<
   REPEAT $$SNOY,<
	SPOP	$$TEMP
	RPUSH	$$TEMP
	UNSTK	$$TEMP
   >
   REPEAT $$SNOY,<
	RPOP	$$TEMP
	SPUSH	$$TEMP
   >
  >
 >
>

DEFINE	EPROC=<
 .XCREF
 IFDEF $$SNOY,<PURGE $$SNOY>
 IFNDEF $$NO,<$$E(<ILLEGAL EPROC>)>
 IFDEF $$NO,<			;;IF PROC WAS DONE
	 $$T1==0
	 PURGE	$$NO		;;FLAG EPROC DONE
 REPEAT $$NR,<
IFDEF $$TEMP,<EPOP $$T1>
IFNDEF $$TEMP,<PPOP $$T1>
	 $$KILL	(\$$T1)>	;;KILL ALL CONSTANTS OF TYPE %.%
	 PURGE	$$NR
 IFDEF $$TEMP,<			;;IF SAVE WAS DONE
	 PURGE	$$SNOX
	 PURGE	$$TEMP>
	 PURGE $$T1
	 ENDD>>
	SUBTTL	RECORD AND FIELD HANDLING MACROS

;	RECORD - FIELD MACROS
;	=====================


; DEFINE FIELD ACCESS MACROS
;
; LOAD FIELD ZF OF THE RECORD POINTED TO BY XB
; TO XT WITH THE MACRO CALL:
;	LF(XT) ZF(XB)
DEFINE LF(XT,A,B)=<
OPDEF $L [HLRZ XT,]
OPDEF $R [HRRZ XT,]
OPDEF $F [MOVE XT,]
OPDEF $B [LDB XT,]
$$USE==1
IFNB <A>,<
IFNB <B>,<A,B>
IFB <B>,<A>
>
>
; SF IS THE REVERSE OF LF, I.E. STORES THE VALUE IN XS
; INTO THE FIELD ZF OF THE RECORD AT XB WITH:
;	SF(XS) ZF(XB)
DEFINE SF(XT,A,B)=<
OPDEF $L [HRLM XT,]
OPDEF $R [HRRM XT,]
OPDEF $F [MOVEM XT,]
OPDEF $B [DPB XT,]
$$USE==1
IFNB <A>,<
IFNB <B>,<A,B>
IFB <B>,<A>
>
>
; WLF LOADS AN ENTIRE WORD CONTAINING A FIELD
; XT,XB AND FIELD NAME OCCUR AS FOR LF AND SF
;
DEFINE WLF(XT)=<
$$USE==0
OPDEF $F [MOVE XT,]
>
; WSF STORES XT IN A WORD CONTAINING THE SPECIFIED FIELD BASED BY XB:
;	WSF (XT) ZF(XB)
DEFINE WSF(XT)=<
$$USE==0
OPDEF $F [MOVEM XT,]
>
DEFINE	ZF(A,B)	<
OPDEF	$L	[HRRZS]
OPDEF	$R	[HLLZS]
OPDEF	$F	[SETZM]
PURGE	$B,$B
$$USE==1
IFNB <A>,<
	IFNB <B>,<A,B>
	IFB  <B>,<A>
	>
>
DEFINE SETF(QVAL)=<
$$$VAL=QVAL
SF()
$$USE=3
>
DEFINE	OFFSET(A)<<$'A>&777777>
DEFINE SIZE(Q,Z)=<
Q=<<<$'Z>B59>&77>
>

; [247] LFE (from SIMRPA) loads a fullword or a halfword with sign extension.
; Otherwise identical to LF, but cannot be used when a byte pointer is required.

DEFINE LFE(xt,a,b)<
	OPDEF $L [HLRE xt,]
	OPDEF $R [HRRE xt,]
	OPDEF $F [MOVE xt,]
	PURGE $B,$B
	$$USE==1
	IFNB <a>,<
	 IFNB <b>,<a,b>
	 IFB  <b>,<a>
	>
>
; INTERNAL USE ONLY
; FIELD DEFINITION MACRO
DEFINE DF(F,W,S,P)=<
$$DEF==0
IFE <^D'S-^D36>,<DEFINE F(XB,O)=
<$%W==W
IFNB <O>,<$%W==W+<O>
>
IFE <$$USE-3>,<LI $$$VAL
$$USE==1>
$F $%W(XB)>
$$DEF==1>
IFE <^D'S-^D18>,<IFE <^D'P-^D17>,
<;; LEFT HW
DEFINE F(XB,O)=<
$%W==W
IFNB <O>,<$%W==W+<O>>
IFE <$$USE-3>,<LI $$$VAL
$$USE==1>
IFE $$USE,<$F $%W(XB)>
IFE <$$USE-1>,<$L $%W(XB)>
IFE <$$USE-2>,<PRINTX OPD-OPR NESTING ERROR>
$$USE==2>
$$DEF==1>
IFE <^D'P-^D35>,
<DEFINE F(XB,O)=<
$%W==W
IFNB <O>,<$%W==W+<O>>
IFE <$$USE-3>,<LI $$$VAL
$$USE==1>
IFE $$USE,<$F $%W(XB)>
IFE <$$USE-1>,<$R $%W(XB)>
IFE <$$USE-2>,<PRINTX OPD-OPR NESTING ERROR>
$$USE==2>
$$DEF==1>
>
IFE $$DEF,<
DEFINE F(XB,O)=<
$%W==W
IFNB <O>,<$%W==W+<O>>
IFE <$$USE-3>,<LI $$$VAL
$$USE==1>
IFE $$USE,<$F $%W(XB)>
IFE <$$USE-1>,<$B [$'F O(XB)]-$$RELO($$BAS)>
IFE <$$USE-2>,<PRINTX INVALID USE OF FIELD>
$$USE==2>
$$DEF==1>
OPDEF $'F [POINT S,W,P]
$'F==$'F
%'F==^D'P
IFE <^D'S-1>,<DSW (F,W,P)>
>
; RECORD DEFINITION
DEFINE DR(ZR,S,TF,TV)=<
ZR'%S==S
ZR'%V==TV
DEFINE ZR'%F=<TF>
>
; RECORD TEST MACROS
; SKIP IF XB POINTS TO ZR TYPE RECORD
DEFINE WHEN(XB,ZR,O)=<
IFEQF XB,ZR'%F,ZR'%V,O>
DEFINE WHENNOT(XB,ZR,O)=<
IFNEQF XB,ZR'%F,ZR'%V,O>
DEFINE IFEQF(XB,ZF,QV,O)=<
LF() ZF(XB,O)
CAIN QV
>
DEFINE IFNEQF(XB,ZF,QV,O)=<
LF() ZF(XB,O)
CAIE QV
>
DEFINE STEP(XB,ZR,XC)=<
 $%X==XB
 IFNB <XC>,<$%X==XC>
 LI $%X,ZR'%S(XB)
>
DEFINE SSTEP(XB,ZR)=<
	ADD	XB,[XWD	ZR'%S,ZR'%S]>
DEFINE STEPJ(XB,ZR,LAB)=<
IFE <ZR'%S-1>,< AOBJN XB,LAB>
IFN <ZR'%S-1>,<ADD XB,[XWD ZR'%S,ZR'%S]
 JUMPL XB,LAB>
>
DEFINE CFAIL(MSG)=
<PRINTX MSG>
IFN QDEBUG,<
DEFINE RFAIL(MSG)=
< RFAI [ASCIZ/MSG/]>
DEFINE ASSERT(B)=<
B
>
>
IFE QDEBUG,<DEFINE ASSERT(B)=<>
DEFINE RFAIL(M)=<RFAI 0
>
>
DEFINE SCALAR(B)=<
%%%%%1==0
IRP B,<
B==%%%%%1
%%%%%1==<%%%%%1+1>>>
	SUBTTL	RESERVED WORDS DECLARATION MACROS
DEFINE RESWORD<
	.XCREF
	RESW$	BEGIN,,Z1RWBM	;;RESERVED WORD,NAME OF SYMBOL(ADD %),SWITCHES
	RESW$	END ,,Z1RWBE+Z1RWBM
	RESW$	IF 
	RESW$	THEN 
	RESW$	INTEGER,INT 
	RESW$	REF 
	RESW$	DO 
	RESW$	PROCEDURE,PROC 
	RESW$	NEW
	RESW$	ACTIVATE,ACTIV
	RESW$	AFTER 
	RESW$	AND 
	RESW$	ARRAY 
	RESW$	AT 
	RESW$	BEFORE,BEFOR
	RESW$	BOOLEAN,BOOL
	RESW$	CHARACTER,CHAR
	RESW$	CLASS 
	RESW$	COMMENT,COMM,Z1RWBM
	RESW$	DELAY 
	RESW$	ELSE,,Z1RWBE 
	RESW$	EQ 
	RESW$	EQV 
	RESW$	EXTERNAL,EXT 
	RESW$	FALSE 
	RESW$	FOR 
	RESW$	GE,NLESS 
	RESW$	GO,,Z1RWBM 
	RESW$	GOTO,,Z1RWBE 
	RESW$	GT,GRT 
	RESW$	HIDDEN,HIDDE
	RESW$	IMP 
	RESW$	IN 
	RESW$	INNER 
	RESW$	INSPECT,INSPE 
	RESW$	IS 
	RESW$	LABEL 
	RESW$	LE,NGRT 
	RESW$	LONG 
	RESW$	LT,LESS 
	RESW$	NAME 
	RESW$	NE,NEQ 
	RESW$	NONE 
	RESW$	NOT 
	RESW$	NOTEXT,NOTEX 
	RESW$	OR 
	RESW$	OPTIONS,OPT,Z1RWBM
	RESW$	OTHERWISE,OTHER,Z1RWBE
	RESW$	PRIOR 
	RESW$	PROTECTED,PROTE
	RESW$	QUA 
	RESW$	REACTIVATE,REACT 
	RESW$	REAL
	RESW$	SHORT 
	RESW$	STEP 
	RESW$	SWITCH,SWIT 
	RESW$	TEXT 
	RESW$	THIS 
	RESW$	TO,,Z1RWBM 
	RESW$	TRUE 
	RESW$	UNTIL 
	RESW$	VALUE 
	RESW$	VIRTUAL,VIRT 
	RESW$	WHEN,,Z1RWBE 
	RESW$	WHILE 
	.CREF
>
; BIT SWITCHES USED IN CREATION OF Z1RW
Z1RWBE==1B18		;BIT 0 DELIMITS END COMMENT OR  PRODUCES WARNING
Z1RWBM==1B19		;BIT 1 MARKED,KEYWORD TO BE RECOGNIZED BY LSI

	QNRESW==0
DEFINE RESW$(A,B,C)<
	QNRESW==QNRESW+1>
	RESWORD
	SUBTTL	SYSTEM IDENTIFIERS MACRO

DEFINE	SYSID<
	RESW$	NUMBER:1,NO1
	RESW$	NUMBER:2,NO2
	RESW$	NUMBER:3,NO3
	RESW$	NUMBER:4,NO4
	RESW$	FILE.,FIL
	RESW$	INFILE,INF
	RESW$	OUTFILE,UTF
	RESW$	DIRECTFILE,DIF
	RESW$	PRINTFILE,PRF
	RESW$	SIMSET,SET
	RESW$	SIMULATION,SIM
	RESW$	LINKAGE,LKA
	RESW$	LINK,LIN
	RESW$	HEAD,HED
	RESW$	PROCESS,PRO
	RESW$	SYSIN,SIN
	RESW$	SYSOUT,SUT
	RESW$	TEXT.,TXT
>

DEFINE RESW$(A,B)<
	QID'B=QNSYSID
	QNSYSID==QNSYSID+1
>

	QNSYSID==2000
	SYSID
	QNSYSID==QNSYSID-2000
	SUBTTL	SYMBOL DECLARATION MACROS


;	SYMBOL DECLARATION
;	==================



REPEAT 0,<

THIS UNIVERSAL DEFINES SYMBOLS FROM LEXICAL SCANNER TO 
SYNTAX RECOGNITION AND THE SYMBOLS IN IC1, AS WELL AS SYMBOLS ONLY USED IN PASS 2 ZNS NODES.

THE SYMBOLS ARE DECLARED IN THE MACRO SYMBOL AS ARGUMENT TO THE
MACRO SYMBX.THE ARGUMENTS ARE:
	NAME		THE SYMBOL-NAME IS %'NAME
	BIT MASK	BIT 1 FROM LEXICAL SCANNER
			BIT 2 IN IC1
			BIT 3 IN ZNS NODES ONLY
	CLASS		SYMBT1 OPERATORS
			SYMBT2 CONTROL ACTIONS
			SYMBT3 OPERANDS
			SYMBT4 DECLARATIONS
			SYMBT5 AUXILARY FROM LS
	VALUE		NUMBER OF HALFWORDS

THE LIMITS OF THE DIFFERENT CLASSES ARE NAMED SYMBL9.
SYMBL3 IS 1 LESS THE LOWEST ELEMENT IN SYMBT3
AND 1 GREATER THE HIGHEST ELEMENT IN SYMBT2.


THE SYMBOLS CAN BE ACCESSED THRU THE MACRO SYMB.
THE ARGUMENTS TO SYMB ARE:
	BIT MASK	SAME AS IN SYMBOL
	ORDER		0= ALPHABETIC ORDER
			1= NUMERIC ORDER
	NAME		NAME OF MACRO TO BE CALLED. THE
ARGUMENTS TO THIS MACRO ARE:
	NAME		OF SYMBOL WITHOUT LEADING %
	VALUE		OF SYMBOL
	NUMBER		OF VALUES
	SPELLING 	OF SYMBOL
>

DEFINE SYMBOL<
	.XCREF
	SYMBX	ACTIV,3,SYMBT1,1,ACTIVATE
	SYMBX	ADEC,2,SYMBT1
	SYMBX	AFTER,1,SYMBT5,,AFTER
	SYMBX	AND,3,24,,AND
	SYMBX	ARRAY,1,SYMBT4,,ARRAY
	SYMBX	AT,1,SYMBT5,,AT
	SYMBX	BBLK,2,SYMBT2
	SYMBX	BECOM,3,SYMBT1,,<:=>
	SYMBX	BEFO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
	SYMBOL
	DEFINE SYMBZ(F)<
	IFDEF SYMB'F,<SYMB'F>>
	SYMBY==-1
	REPEAT SYMBL1,<
	SYMBY==SYMBY+1
	SYMBZ(\SYMBY)>
DEFINE SYMBZ(F)<
DEFINE SYMBX(M,N,O,P,Q)<
	IFE O-SYMBT'F,<
	IFN N&A,<C(M,\O,P,<Q>)>
	SYMBT'F==SYMBT'F+1>>
	SYMBOL>
	SYMBZ 1
	SYMBZ 2
	SYMBZ 3
	SYMBZ 4
	SYMBZ 5
	>
	>
DEFINE	SYMBXX(A,B,C,D)<
	%'A=B>
	SYMB	7,0,SYMBXX
IFE QDEC20,<;;[225] DEC20 prefers single segment programs
	SUBTTL	MACRO FOR EXCHANGE OF HIGH SEGMENT

;ARGUMENTS:
;		NAME = NAME OF HIGH SEGMENT FILE
;		WNAME= WORK NAME OF HIGH SEGMENT
;		INCR = TRANSFER SHOULD BE TO ENTRY+INCR
;		PPN  = PROJECT-PROGRAMMER NUMBER WHERE TO FIND NEW HIGH SEGMENT
;
;AT ENTRY X3 SHOULD BE LOADED WITH [ XWD 1,<TOP OF LOW SEGMENT> ]
;IF NO LOW SEGMENT CHANGES WITH [ XWD 1,0 ]

;[172] Take following passes from same DSK area as Pass 1 in SYS version
DEFINE SWAPPA(NAME,WNAME,INCR,PPN)<
DEFINE RL(LAB)<LAB-L2()+Y3SWAP>
EXTERN	Y3SWAP
BEGIN
	HLLZS	.JBREN##
	HLLZS	.JBSA##
	L	X2,[XWD L2(),Y3SWAP]
	BLT	X2,RL(L9())
	GOTO	RL(L2())
L2():!	CORE	X3,
	HALT
IFN QSYS,<
	IFNDEF YP1DEV,<EXTERN YP1DEV,YP1PPN>
	L	YP1DEV
	ST	RL(L4())
	L	YP1PPN
	ST	RL(L4())+4
>
	LI	X1,RL(L4())
	GETSEG	X1,
	SKIPA
	GOTO	RL(L3())
	LI	X1,RL(L5())
	GETSEG	X1,
	HALT
L3():!	BRANCH	400011+INCR ;;[260]

L4():!	SIXBIT'DSK'
	IFE QSYS,<SIXBIT/WNAME/>
	IFN QSYS,<SIXBIT/NAME/>
	Z
	Z
	Z
	Z
L5():!	EXP	QSYSDEV
	SIXBIT/NAME/
	Z
	Z
	EXP	PPN
	Z
L9():!
ENDD
>
>
	SUBTTL	TYPE CODES AND DECLARATION FILE FIELDS

; TYPE CODES
SCALAR <QUNDEF,QINTEGER,QREAL,QLREAL,QCHARACTER,QBOOLEAN,QTEXT,QREF,QLABEL,QNOTYPE,QRLREA>

; KIND CODES
SCALAR <QUNDEF,QSIMPLE,QARRAY,QPROCEDURE,QCLASS>

; MODE CODES
SCALAR <QDECLARED,QVALUE,QNAME,QREFER,QVIRTUAL,SPARE,QHDN,QNHDN>

; DECLARATION STACK RECORD TAG VALUES (SPARSE REPRESENTATION)
SCALAR <QZQU,QZHB,QZHE>
; BLOCK TYPE CODES IN ZHE AND ZHB RECORDS
SCALAR <QFOR,QRBLOCK,QUBLOCK,QPROCB,QPBLOCK,QCLASB,QINSPEC,QPROTO,QEBLOC,QCEXT,QPEXT,QMEXT,QFEXT,QSYSCL>
	QQUACH==QPROTO

;PARAMETER DESCRIPTOR TYPE CODES IN ZFL RECORD
SCALAR	<QDTVSI,QDTSIM,QDTFNM,QDTDYN,QDTCON,QDTICO,Q,QDTEXP>

; RELOCATION VALUES USED TO INDEX THE 
; RELOCATION COUNTER TABLE. THEIR VALUES MUST REFLECT THE ORDER OF THE RELOCATION COUNTER TABLE IN LOWSEG.
SCALAR	<QNOREL,QRELCN,QRELCD,QRELPT,QRELLT,QRELST,QRELID,QRELI2>

;[14 22 12] DEFINE ZQUSNR CODE.  DEFINITION MOVED FROM SYS1.MAC
DEFINE SC(B)=<
%%%%%1==0
IRP B,<
SYS'B==%%%%%1
%%%%%1==<%%%%%1+1>>>

SC<CL,MA,PR,TX,I1,I2,I3,I4,I5,I6,I7,I8,I9,K1,K2,K3,K4,K5,K6,K7,K8,K9,L1,L2,L3,L4,L5,L6,L7,L8,L9,M1>
	SUBTTL	DEFINITIONS OF DF1 AND PASS 2 FIELDS

DF ZDETYP,0,3,2
DF ZDELNK,2,18,35

DF ZQUGLO,0,1,3
DF ZQUEXT,0,1,4
DF ZQULEN,0,1,5
DF ZQUIS,0,1,5
DF ZQUIB,0,1,6
DF ZQUTPT,0,1,6		;[40]
DF ZQUSYS,0,1,7
DF ZQUHID,0,1,13	;[40] TOGETHER WITH BIT 12
DF ZQUNOT,0,1,14	;[40]
DF ZQUTYP,0,4,11
DF ZQUMOD,0,3,14
DF ZQUKND,0,3,17
DF ZQUTMK,0,10,17
DF ZQUSTM,0,11,17
DF ZQUZHE,0,18,35
DF ZQUTEM,0,18,35

DF ZQUFIX,1,18,17
DF ZQUIVA,1,1,0		;[40]
DF ZQUNSB,1,5,5
DF ZQULID,1,12,17
DF ZQUIND,1,18,35

DF ZQUUSE,2,1,0		;[140]
DF ZQUZQU,2,18,17
DF ZQUQID,2,18,17
DF ZQUZB,2,18,35

DF ZQUNAC,3,3,2
DF ZQUPR,3,1,3
DF ZQUGB,3,1,4
DF ZQUIO,3,1,5
DF ZQULO,3,1,6
DF ZQUQIK,3,1,7		;[040700] Quicker call of this MACRO-10 procedure
DF ZQUPTD,3,1,8		;[40]
DF ZQUDD,3,1,9		;[136]
DF ZQUSNR,3,8,17	;[040700] Leave some bits here for later possible use
DF ZQULNE,3,18,35

DF ZQUUNR,4,36,35


DF ZHETYP,0,3,5
DF ZHENOI,0,1,11
DF ZHESOL,0,6,17
DF ZHEDLV,0,18,35

DF ZHEEBL,1,5,4
DF ZHELEN,1,10,14
DF ZHEBNM,1,9,23
DF ZHEFIX,1,12,35

DF ZHEOID,0,12,17
DF ZHELID,0,18,35
DF ZHEUNR,1,36,35


DF ZHBXID,2,18,17
DF ZHBZQU,2,18,17
DF ZHBZE,2,18,35
DF ZHBZHB,2,18,35

DF ZHBDEV,3,11,12
DF ZHBNRP,3,8,7
DF ZHBVRT,3,8,15
DF ZHBSBL,3,5,20
DF ZHBSTD,3,5,25
DF ZHBSZD,3,5,30
DF ZHBUPF,3,1,31
 DF ZHBMFO,3,3,33	;;[040700] Non-zero for MACRO-10 or FORTRAN procedure
	;;[040700] Values of ZHBMFO field:
	QEXMAC=1	;; MACRO-10, standard procedure call
	QEXMQI=2	;; MACRO-10, quick calling sequence
	QEXFOR=4	;; FORTRAN-10
	QEXF40=5	;; Old FORTRAN (F40)
;[040700] DF ZHBFOR,3,1,31
DF ZHBBLV,3,1,32
;[040700] DF ZHBF40,3,1,32
DF ZHBLOC,3,1,33
;[040700] DF ZHBMAC,3,1,33
DF ZHBKDP,3,1,34
DF ZHBNCK,3,1,34
DF ZHBEXT,3,1,35

DF ZHBUNR,4,36,35
DF ZHBPPN,4,36,35



DF ZQQLNK,0,18,17
DF ZQQFIX,0,18,35
DF ZQQUNR,1,36,35



; DF1 AND PASS 2 RECORDS
DR ZQU,4,ZDETYP,1B<^d33+QZQU>
DR ZHE,2,ZDETYP,1B<^d33+QZHE>
DR ZHB,5,ZDETYP,1B<^d33+QZHB>
; DSW NCODE TO STOP CODE GENERATION
QO2LIS==200	; SIZE OF LITERAL TABLE
QLOWID==^D1024	; FIRST LEXICAL ID NUMBER ASSIGNED
QFTFX==140	; FIRST FIXUP NUMBER ASSIGNED BY PASS 1
	SUBTTL	SWITCH DECLARATIONS


;	COMPILER SWITCH SWITCHES
;	========================


	DSW	(YSWD,YSWITCH,34)
	DSW	(YSWI,YSWITCH,33)
	DSW	(YSWR,YSWITCH,32)
	DSW	(YSWY,YSWITCH,31)
	DSW	(YSWA,YSWITCH,30)
	DSW	(YSWQ,YSWITCH,28)
	DSW	(YSWW,YSWITCH,27)
	DSW	(YSWS,YSWITCH,26)	;[13] Set by any search list change
	DSW	(YSWCZ,YSWITCH,25)	;[220] CONTROL-Z SWITCH
	DSW	(YSWCM,YSWITCH,0)
	DSW	(YI1CCL,YSWITCH,1)
	DSW	(YDMF,YSWITCH,2)
	DSW	(YDMFE,YSWITCH,3)
	DSW	(YSWTRM,YSWITCH,4)
	DSW	(YSWP1,YSWITCH,5)
	DSW	(YSWLST,YSWITCH,6)
	DSW	(YSWCOM,YSWITCH,7)	;ON IF COMMAND FILE IN THIS COMPILATION
	DSW	(YSWLPT,YSWITCH,8)	;ON IF /LIST FROM COMPIL
	DSW	(YSWNFC,YSWITCH,9)	;OFF IF FIRST COMPILATION
	DSW	(YTRSW,YTRPAS,36)

;  MASKS FOR A,M,Q AND W
;  THESE MASKS ARE USED AS OPERANDS TO THE $OPT OPERATOR IN IC1

	QSWA==1B30
	QSWQ==1B28
	QSWW==1B27

;SWITCHES SHOWING DEFAULT VALUES OF COMMAND SWITCHES
;SWITCH ON DENOTES DEFAULT ON, OFF DENOTES DEFAULT OFF (- BEFORE SWITCH)

	DSW	(YSWDA,YSWDEF,0)
	DSW	(YSWDD,YSWDEF,1)
	DSW	(YSWDE,YSWDEF,2)
	DSW	(YSWDI,YSWDEF,3)
	DSW	(YSWDQ,YSWDEF,4)
	DSW	(YSWDR,YSWDEF,5)
	DSW	(YSWDW,YSWDEF,6)
	DSW	(YSWDS,YSWDEF,7)	;[13,,12]

;SWITCHES SHOWING WHICH COMPILE SWITCHES HAVE BEEN CHANGED DURING COMPILATION
;SWITCH ON DENOTES CHANGE FROM DEFAULT

	DSW	(YSWCA,YSWCHA,0)
	DSW	(YSWCD,YSWCHA,1)
	DSW	(YSWCE,YSWCHA,2)
	DSW	(YSWCI,YSWCHA,3)
	DSW	(YSWCQ,YSWCHA,4)
	DSW	(YSWCR,YSWCHA,5)
	DSW	(YSWCW,YSWCHA,6)
	DSW	(YSWCS,YSWCHA,7)	;[13,,12]


	QNSWCH==7+1	;[13,,12] Number of switches involved
;WARNING: THE POSITION AND ORDER OF THESE SWITCHES
;ARE CRITICAL FOR MODULE T3 IN PASS 3!!

;DEFAULT VALUES (1 DEFAULT=ON, 0 DEFAULT=OFF)

	QSWAD==1
	QSWDD==1
	QSWED==0
	QSWID==1
	QSWQD==1
	QSWRD==0
	QSWWD==1
	QSWSD==0	;[13,,12] 1 means some change (e g /-S)

	QSWDEF==<QSWAD>B0+<QSWDD>B1+<QSWED>B2+<QSWID>B3+<QSWQD>B4+<QSWRD>B5+<QSWWD>B6
	QSWDEF==<QSWDEF+<QSWSD>B7>_-^D18	;[13,,12]

	
; MACROS FOR CREATION OF FILE OPEN SWITCHES:

DEFINE DCHSW(NAME)=<
 DEFINE X(NAM,NUMBER)=<
	RADIX	8
	DSW	(NAM,Y3OPEN,NUMBER)
 >
 DEFINE Y(P1,P2)=<SYN P1,YOP'P2>
	QOPNO==^D35
 IRP NAME,<
	RADIX	10
	X	(YOP'NAME,\<35-QCH'NAME>)
	RADIX	10
	X	(YPO'NAME,\<17-QCH'NAME>)
	Y	(YOP'NAME,\QOPNO)
	QOPNO=QOPNO-1
 >
>;END OF DCHSW

;THE ORDER BETWEEN THE ARGUMENTS IS SIGNIFICANT
;EACH ARG CORRESPONDS TO  CHANNEL QCH'ARG AND ARG NR I CORRESPONDS TO CHANNEL I
DCHSW(<TTY,SRC,EXT,LS1,IC1,DF1,ZSE,REL,ATR,XRF,IC2,LST,DEB,ERR,TRC>)
;	DEFINITION OF LS1 RECORD 4 PROTOTYPE
;	------------------------------------

	DEFINE LS1INIT=<
	DF	(ZLEID,ZLEREC,7,6)	;IDENTIFIER FIELD = "I"
	DF	(ZLEIND,ZLEREC,8,16)	;BREAK CHARACTER COMBINATION INDICATOR
	DSW	(ZLESRC,ZLEREC,7)	;ON IF LINE NUMBER IN SOURCE LINE
	DSW	(ZLEOK,ZLEREC,8)	;ON IF SOURCE LINE NUMBER CAN BE USED IN LISTING
	DSW	(ZLEBIT,ZLEREC,17)	;RECORD INDICATOR = 1
		;SYMBOLIC NAMES ON ZLEIND VALUES  ;[14 22 15] Now defined in LC
	>


IFN QDEC20,<;[225] DEFINE FILE INFO AREA FOR DEC-20 HANDLING OF FILES
 DR ZLF,3	;LIMITS
 DF ZLFFCP,0,36,35 ;First core page no
 DF ZLFFFP,1,36,35	;First file page (corresponding)
 DF ZLFNPA,2,36,35	;Number of pages in core area
>


;;; MACROS FOR LOOKUP AND ENTER
;   Only to be used for files which are handled by PMAP on the 20

IFE QDEC20,<
DEFINE LOKUPF(F)<LOOKUP QCH'F,YEL'F>
DEFINE ENTERF(F)<ENTER  QCH'F,YEL'F>
>

IFN QDEC20,<
DEFINE LOKUPF(F)<
	LI	X1,YEL'F
	IF2,<IFNDEF O1JFNI,<EXTERN O1JFNI>>
	XEC	O1JFNI
>
DEFINE ENTERF(F)<
	LI	X1,YEL'F
	IF2,<IFNDEF O1JFNO,<EXTERN O1JFNO>>
	XEC	O1JFNO
>
>
	SUBTTL	TIMING MACRO

;THE MACRO TIMER WILL OUTPUT THE TIME SPENT SINCE THE
;LAST TIME IT WAS CALLED. IF NO MESSAGE IS GIVEN THERE
;IS NO OUTPUT, ELSE THE MESSAGE FOLLOWED BY THE TIME
;FOLLOWED BY "MILLISECONDS" IS OUTPUTTED.


DEFINE TIMER(MESSAGE)<
IFN QTIMER,<
	STACK	X0
	STACK	X1
	STACK	X2
	LI	X1,0
	RUNTIM	X1,
	SUB	X1,YTIMER##
	ADDM	X1,YTIMER
	IFNB<MESSAGE>,<
		OUTSTR	[ASCIZ/
MESSAGE  /]
		LSH	X1,25
		LI	X2,5
		LOOP
			LI	X0,0
			LSHC	X0,3
			ADDI	X0,60
			OUTCHR
		AS
			SOJG	X2,TRUE
		SA
		OUTSTR	[ASCIZ/  MILLISECONDS
/]
		>
	UNSTK	X2
	UNSTK	X1
	UNSTK	X0
>
>
	SUBTTL	MACRO FOR SETTING UP I/O BUFFERS

DEFINE	SETBUF(FIL,BUFFER,SIZE)<
	EXTERN	YBUFR'BUFFER,YBH'FIL
	L	[XWD QBUFS-2,YBUFR'BUFFER+1+QBUFS+1]
	ST	YBUFR'BUFFER+1
	HRRI	YBUFR'BUFFER+1
	ST	YBUFR'BUFFER+1+QBUFS+1
	HRLI	400K
	IFB<SIZE>,<ST YBH'FIL>
	IFNB<SIZE>,<MOVSI X1,(^D'SIZE'B11)
		STD	YBH'FIL>
>
	SUBTTL	RECORD DUMP MACRO

;	DEFINE RECORD DUMP
;	==================

DEFINE	DRD(R,F)
<	PROC
.'R::	SAVE	<X2,X3,X4,X5>
	OUTSTR	[ASCIZ/            =====
RECORD TYPE R AT ADDRESS /]
	LI	X3,22
	MOVE	X4,X1
	EXEC	L2
	OUTSTR	[ASCIZ/
            =====

/]
	IRP F	<	OUTSTR	[ASCIZ/F/]
			OUTCHR	["="]
			SIZE	(QSZ,F)
			IFE	<QSZ-1>,<LI	X4,"0"
					 IFON	F(X1)
					 LI	X4,"1"
					 OUTCHR	X4
					>
			IFN	<QSZ-1>,<LI	X3,QSZ
					 LF	(X4) F(X1)
					 EXEC	L2
					>
			OUTSTR	[ASCIZ/
/]
>
	OUTSTR	[ASCIZ/
/]
	RETURN
DEFINE	R	<EXEC .'R>
L2():	SETZ	X2,0
	DIVI	X2,3
	SKIPE	X3
	AOJ	X2,0
	MOVN	X3,X2
	IMULI	X3,3
	ROT	X4,(X3)
L3():	SETZ	X5,0
	ROTC	X4,3
	ADDI	X5,"0"
	OUTCHR	X5
	DECR	X2,L3
	POPJ	XPDP,0
	EPROC
>
	SUBTTL	REGISTER ASSIGNMENTS


;		************************
;		* REGISTER ASSIGNMENTS *
;		************************


	X0==0
	X1==1
	X2==2
	X3==3
	X4==4
	X5==5
	X6==6
	X7==7
	X10==10
	X11==11
	X12==12
	X13==13
	X14==14
	X15==15
	X16==16
	XPDP==17
	SUBTTL	OPERATOR DEFINITIONS


;	************************
;	* OPERATOR DEFINITIONS *
;	************************


	OPDEF	GOTO	[JRST]
	OPDEF	BRANCH	[JRST]
	OPDEF	INCR	[AOBJN]
	OPDEF	DECR	[SOJG]
	OPDEF	L	[MOVE]
	OPDEF	LI	[MOVEI]
	OPDEF	ST	[MOVEM]
	OPDEF	NOP	[JFCL]
	OPDEF	STACK	[PUSH XPDP,]
	OPDEF	UNSTK	[POP XPDP,]
OPDEF	XEC	[PUSHJ	XPDP,]	;[221]
OPDEF	RET	[POPJ	XPDP,]	;[221]

DEFINE %%CJMP(X)<
IRP X,<
	OPDEF	GOTO'X	[JUMP'X]
	OPDEF	BRAN'X	[JUMP'X]>>

	%%CJMP(<L,E,LE,GE,N,G>)

IFN QKI10,<
	OPDEF	LD	[DMOVE]
	OPDEF	STD	[DMOVEM]
	DEFINE KA10WARNING=<>
>

IFN QKA10,<
DEFINE KA10WARNING=<
	PRINTX	KI10 DEPENDENT CODE
	>
DEFINE LD (A,B)=<
	L	A,B
	L	A+1,1+B
>
DEFINE STD(A,B)=<
	ST	A,B
	ST	A+1,1+B
>>

QUUO==1
DEFINE X(E)=
<IFNB<E>,
<Q'E==%%%%%1
OPDEF	E	[<%%%%%1>B8]>
%%%%%1==%%%%%1+1
>

DEFINE UUOS(E)
<%%%%%1==QUUO
	IRP  E<X(E)>
>

	DEFINE	UUOSET=<
UUOS	<ERRT,,ERRI3,ERRI2,ERRI1,ERR,ERRLI,WARN,ERRR,ERR1,ERR2,FATA,SEV,SEV1,SEV2,RFAI>;ORDER SIGNIFICANT
>
	UUOSET


;ERROR TYPES:
;===========

QE==0
QT==1
QW==2

;ERROR START NUMBERS:
;===================

;START NUMBER OF ERRORMESSAGES IN THE COMPILER OF A CERTAIN TYPE AND PASS
;END NUMBER IS ONE NUMBER LESS THAN START OF NEXT INTERVAL

Q1.WAR==1		;LOWEST WARNING MESSAGE NUMBER PASS1
Q1.ERR==60		;LOWEST ERROR MESSAGE NUMBER PASS 1
Q1.TER==240		;LOWEST TERMINATION MESSAGE NUMBER PASS 1
Q2.WAR==300		;LOWEST WARNING MESSAGE NUMBER PASS 2
Q2.ERR==330		;LOWEST ERROR MESSAGE NUMBER PASS 2
Q2.TER==460		;LOWEST TERMINATION MESSAGE NUMBER PASS 2
Q3.WAR==500		;LOWEST WARNING MESSAGE PASS 3
Q3.ERR==530		;LOWEST ERROR MESSAGE PASS 3
Q3.TER==560		;LOWEST TERMINATION MESSAGE PASS 3
Q.OFL==567	;ERROR NUMBER FOR STACK OVERFLOW, COMMON TO ALL 3 PASSES
Q.UFL==566	;ERROR NUMBER FOR STACK UNDERFLOW, COMMON TO ALL 3 PASSES
Q.TER==570	;START NUMBER OF ERRORS COMMON  TO ALL 3 PASSES

;MACRO TO CLEAR ^O
;=================

DEFINE	CLEARO	<
	SKPINC
	NOP
>
	>;END OF IF1
	SUBTTL	Macros for defining versions

;		*********************************
;		* MACROS FOR DEFINING VERSIONS. *
;		*********************************


DEFINE	CTITLE	(module,a,b)	<;;[104]
	TITLE	module     DECsystem-10/20 SIMULA COMPILER %4A(310)  >
DEFINE	CUNIV	(module,a,b)	<;;[104]
	IFDEF .DIRECTIVE,<.DIRECTIVE .NOBIN>
	UNIVERSAL module     DECsystem-10/20 SIMULA COMPILER %4A(310)  >
		COMMENT /EXAMPLE			     %3AM(777)-5  
							     VMM  E   W
			CTITLE is used by modules of the compiler.
			V = Main version (should be same as RTS main version).
			MM= Minor version.
			E = Edit level.
			W = Who made the last update.
			/

	CUNIV(SIMMAC)


 
DEFINE	RTITLE	(module,a,b)	<;;[104]
	TITLE	module     DECsystem-10/20 SIMULA RTS %4A(310)  >
;;		RTITLE is used by modules of the Run Time System.
DEFINE	RUNIV	(module,a,b)	<;;[104]
	IFDEF .DIRECTIVE,<.DIRECTIVE .NOBIN>
	UNIVERSAL	module     DECsystem-10/20 SIMULA RTS %4A(310)  >

	VERCOM=< BYTE (3) 0 (9)     4 (6)   1 (18)  310  >
		COMMENT /EXAMPLE
	         BYTE (3) 5 (9)     3 (6)  47 (18)  777
	                 WHO   VERSION   MINOR      E
		VERCOM is used by compiler passes to set .JBVER.
		This is done in the modules I1,I2,I3.  Same legend as CTITLE.
		/

	VERRTS=VERCOM
		COMMENT /
		VERRTS is used by the RTS to set .JBVER.  This
		is done in the module SIMRTS.  Same legend
		as RTITLE.
		/
	END