Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-05 - 43,50337/22/macsim.mac
There are 2 other files named macsim.mac in the archive. Click here to see a list.
	UNIVERSAL	MACSIM
	.DIRECTIVE	.NOBIN
	SUBTTL		HEADING

COMMENT/

AUTHORS:	CLAES WIHLBORG, Lars Enderin
		UPDATED AT ACADIA UNIVERSITY FOR KA10

PURPOSE:	TO FACILITATE COMMUNICATIONS BETWEEN MACRO-10 PROCEDURES AND
		THE SIMULA SYSTEM
/

	IF1,<END>

	PRINTX	UPDATE:	5, 14-Nov-1975/LE
;***AUBEG
;DEFINE QKI10 AND QKA10 ASSEMBLY SWITCHES.
	QKI10==0	;0 MEANS KA10 CPU
	QKA10==1
;***AUEND
	SUBTTL	USEFUL ASSEMBLY CONSTANTS AND OPDEFS


;CONSTANTS
;=========


NONE=676K


;TYPE CODES

QINTEGER=1
QREAL=2
QLREAL=3
QLONGREAL=3
QCHARACTER=4
QBOOLEAN=5
QTEXT=6
QREF=7
QLABEL=8
QNOTYPE=9


;KIND CODES

QSIMPLE=1
QARRAY=2
QPROCEDURE=3


;ACCUMULATORS

X0=0
X1=1
XSAC=X1
X2=2
XTAC=X2
XWAC1=3
XWAC2=4
XWAC3=5
XWAC4=6
XWAC5=7
XWAC6=10
XWAC7=11
XWAC10=12
XWAC11=13
XWAC12=14
XCB=15
XLOW=16
XPDP=17


;ENTRIES IN HIGH SEGMENT TRANSFER VECTOR

.CSES==400015
.CSEP==400016
.PHFA==400027
.PHFM==400030
.PHFS==400032
.PHFT==400031
.PHFV==400026
.IOIG==400155
.IOOG==400157
.OCIN8==400200
;OPERATOR DEFINITIONS
;====================

OPDEF	GOTO	[JRST]
OPDEF	L	[MOVE]		;LOAD
OPDEF	LI	[HRREI]		;LOAD IMMEDIATE
OPDEF	ST	[MOVEM]		;STORE
OPDEF	EXEC	[PUSHJ XPDP,]	;PROCEDURE CALL
OPDEF	STACK	[PUSH  XPDP,]
OPDEF	UNSTK	[POP   XPDP,]

;***AUBEG
;FOR KA10, DEFINE LD AND STD AS MACROS.
;ALSO DEFINE KI10 INSTRUCTIONS AS UUOS (IN KARTS).
IFN QKI10,<
OPDEF	LD	[DMOVE]		;LOAD DOUBLEWORD
OPDEF	STD	[DMOVEM]	;STORE DOUBLEWORD
>
IFN QKA10,<
	DEFINE	LD(A,B)=<
		L	A,B
		L	A+1,1+B
	>
	DEFINE	STD(A,B)=<
		ST	A,B
		ST	A+1,1+B
	>
	OPDEF	DFAD	[024B8]
	OPDEF	DFSB	[025B8]
	OPDEF	DFMP	[026B8]
	OPDEF	DFDV	[027B8]
	OPDEF	DMOVE	[030B8]
	OPDEF	DMOVN	[031B8]
	OPDEF	FIX	[032B8]
;NOTE 033 NOT ASSIGNED.
	OPDEF	DMOVEM	[034B8]
	OPDEF	DMOVNM	[035B8]
	OPDEF	FIXR	[036B8]
	OPDEF	FLTR	[037B8]
> ;END OF KA10 CONDITIONAL
;***AUEND
	SUBTTL	SPECIFICATIONS


DEFINE	SPECIFY(SPECS)<
	.XCREF
	%%%L1=1
	%%%L2=2
	%%%F1=4
	%%%F2=10
	%%%NA=20
	%%%MD=40
	%%%KD=100
	%%%TD=200
	%%%VC=400
	%%%VD=1000


	DEFINE	PROC(NAME,PARS)<
		PURGE	NAME,NAME
		NAME=%%%MD+%%%KD
		IRP PARS,<	PURGE	PARS,PARS
				PARS=0>
		DEFINE	%%%1<%%%2(NAME,\NAME,<PARS>)>
	>;; END PROC

	DEFINE	%(A,B,C)<
		DEFINE	A(P1,P2,P3,P4,P5,P6,P7,P8,P9,P0)<
			%%%3(B,C,<P1,P2,P3,P4,P5,P6,P7,P8,P9,P0>)>
	>;; END %

	%(VALUE,%%%MD+%%%VD,%%%VC+%%%MD)
	%(NAME,%%%MD+%%%NA,%%%MD)
	%(INTEGER,%%%TD+%%%L1,%%%TD)
	%(REAL,%%%TD+%%%L1,%%%TD)
	%(LONGREAL,%%%TD+%%%L2,%%%TD)
	%(CHARACTER,%%%TD+%%%L1,%%%TD)
	%(BOOLEAN,%%%TD+%%%L1,%%%TD)
	%(TEXT,%%%TD+%%%L2,%%%TD)
	%(REF,%%%TD+%%%L1+%%%VC,%%%TD+%%%VD)
	%(LABEL,%%%TD+%%%KD+%%%L2+%%%VC,%%%TD+%%%KD+%%%VD)
	%(SWITCH,%%%TD+%%%KD+%%%L2+%%%VC,%%%TD+%%%KD+%%%VD)
	%(ARRAY,%%%TD+%%%KD+%%%F1,%%%KD)
	%(PROCEDURE,%%%KD+%%%F2+%%%VC,%%%KD+%%%VD)

	PURGE	%

	DEFINE	%%%3(VAL,TEST,ARG)<
		IRP ARG,<
		IFNB<ARG>,<
			IFN ARG&<TEST>,<%%%ERR(ARG)>
			ARG=ARG!<VAL>>
		>
	>;; END %%%3

	DEFINE	%%%ERR(NAME)<
		PRINTX	ERROR IN SPECIFICATION OF NAME
	>

	;; NOW USE THE DECLARED MACROS

	SPECS

	;; DELETE THE MACROS

		PURGE	PROC,%%%3,VALUE,NAME,INTEGER,REAL,LONGREAL,CHARACTER
		PURGE	BOOLEAN,TEXT,REF,LABEL,SWITCH,ARRAY,PROCEDURE

	DEFINE	%%%2(NAME,NAMEV,PARS)<
		%%%5=2	;;OFFSET COUNTER
		IFNDEF	QUICK,<QUICK==0>;;[3]
		IFN	QUICK,<%%%5=XWAC1> ;;[3]
		DEFINE	%%%6(PAR,OFFSET)<
			%%%7=PAR
			PURGE PAR
			IFE %%%7&<%%%KD+%%%TD+%%%NA>,<%%%ERR(PAR)>
			IFN %%%7&%%%NA,<PAR=OFFSET
					%%%7=0
					%%%5=%%%5+2>
			IFN %%%7&<%%%F1+%%%F2>,<%%%7=%%%7_-2>
			IFN %%%7,<DEFINE PAR<OFFSET(XCB)>
				IFN QUICK,<DEFINE PAR<OFFSET>>;;[3]
				%%%5=%%%5+<%%%7&3>>
		>;; END OF %%%6
		PURGE	RETURN,RETURN
		IFE NAMEV&%%%TD,<;;PROPER PROCEDURE
			IFN	QUICK,<DEFINE RETURN <POPJ XPDP,>>
			IFE	QUICK,<DEFINE RETURN <GOTO .CSES>>
			PURGE	NAME>
		IFN NAMEV&%%%TD,<;;FUNCTION
			IFN	QUICK,<DEFINE RETURN <POPJ XPDP,>>
			IFE	QUICK,<DEFINE RETURN <GOTO .CSEP>>
			%%%6(NAME,\%%%5)>
			IFN QUICK,<%%%5=XWAC1> ;;1st param reg also result
		IRP PARS,<%%%6(PARS,\%%%5)>

	>;;END OF %%%2

	;;NOW DEFINE THE FORMAL PARAMETERS

	%%%1

	PURGE	%%%1,%%%2
	PURGE	%%%L1,%%%L2,%%%F1,%%%F2,%%%NA,%%%MD,%%%KD,%%%TD,%%%VC,%%%VD

	.CREF
>; END OF MACRO SPECIFY
	SUBTTL	PARAMETER HANDLING


DEFINE	%%%ADM(N,ACC)<
	IFL <N-2>*<13-N>,<PRINTX  ILLEGAL ACCUMULATOR USAGE>
	IFL N-3,<0>
	IFGE N-3,<
		%%%AD1==0
		IRP ACC,<IFNB<ACC>,<
			%%%AD1==%%%AD1+1B<ACC-3>
		>>
		XWD	N-2,[%%%AD1]
	>
>


DEFINE	GETF(PAR,NN,MAPR,ROUT)<
	N==XWAC1-1
	IFNB	<NN>,N==NN
	LI	N+1,(XCB)
	HRLI	N+1,PAR
	EXEC	ROUT
	.XCREF
	%%%ADM(N,<MAPR>)
	.CREF
	PURGE	N
>
DEFINE	GETADD(PAR,N,MAPR)<
	GETF(PAR,N,<MAPR>,.PHFA)
	>
DEFINE	GETTAD(PAR,N,MAPR)<
	GETF(PAR,N,<MAPR>,.PHFT)
	>
DEFINE	GETVAL(PAR,N,MAPR)<
	GETF(PAR,N,<MAPR>,.PHFV)
	>	
DEFINE	GETAAD(PAR,N,MAPR)<
	GETF(PAR,N,<MAPR>,.PHFM)
	>

DEFINE	ASSIGN(PAR,ACLHS,ACRHS)<
	HRRZ	0,PAR(XCB)
	EXEC	.PHFS
	XWD	ACRHS,ACLHS
>

DEFINE	GETTYPE(AC,PAR,X)<
	IFB <X>,<
	LDB	AC,[POINT 4,PAR(XCB),5]
	>
	IFNB <X>,<
	ADDI	X,(XCB)
	LDB	AC,[POINT 4,PAR(X),5]
	SUBI	X,(XCB)
	>
>

DEFINE	GETKIND(AC,PAR,X)<
	IFB <X>,<
	LDB	AC,[POINT 3,PAR(XCB),11]
	>
	IFNB <X>,<
	ADDI	X,(XCB)
	LDB	AC,[POINT 3,PAR(X),11]
	SUBI	X,(XCB)
	>
>

DEFINE	SETTYPE(TYP,PAR,AC,X)<
	%%ac==16
	%%x==XCB
	IFNB <AC>,<%%ac==AC>
	IFNB <X>,<%%x==X>
	LI	%%ac,TYP+20
	DPB	%%ac,[POINT 5,PAR(%%x),17]
	PURGE	%%x,%%ac
>
	SUBTTL	MACROS for QUICK procedures

;These macros become available by invoking the QUICKPROC macro

DEFINE	QUICKPROC<

	QUICK==1	;;Defines a different interpretation for SPECIFY

>;;End of QUICKPROC
	SUBTTL	I/O HANDLING


	IMAGE==4
	ENDFILE==7


OPDEF	INIMAGE	[EXEC	.IOIG]
OPDEF	OUTIMAGE[EXEC	.IOOG]

OPDEF	IFEOF	[SKIPE	ENDFILE]
OPDEF	IFNEOF	[SKIPN	ENDFILE]

OPDEF	GETCHANNEL[EXEC	.OCIN8]

DEFINE	FREECHANNEL(CHAN,AC<16>)<
	L	AC,CHAN
	ADD	AC,.JBOPS##
	SETZM	104(AC)
>
	END