Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-06 - 43,50410/macten.mac
There are 48 other files named macten.mac in the archive. Click here to see a list.
	SUBTTL	DEC-10 UNIVERSAL PARAMETERS	%1(33)	12-AUG-75

	.XCREF
IFDEF %..C,<IFE %..C,<	.CREF
			TAPE	>>

IFNDEF %..C,<UNIVER	MACTEN	DECsystem-10 Common Parameter File
	.DIRECTIVE	.NOBIN>


;***Copyright (C) 1971,1972,1973,1974,1975 Digital Equipment Corp., Maynard, Mass.***



;THIS PARAMETER FILE CONTAINS MACRO DEFINITIONS, SYMBOL DEFINITIONS
;	AND OPDEFS WHICH ARE OPERATING SYSTEM INDEPENDENT.  THIS
;	FILE WAS ORIGINALLY PART OF C.MAC THE TOPS-10 CUSP UUO
;	PARAMETER FILE.

	MACWHO==2		;LAST PATCHER
	MACVER==1		;MAJOR VERSION
	MACMIN==0		;MINOR VERSION
	MACEDT==33		;EDIT LEVEL

	.CREF
	SALL

; EDITS >[24] ARE MARK CRISPIN'S AND MARTIN COLE'S IMPROVEMENTS
; TO MACTEN
	SUBTTL	TABLE OF CONTENTS

;                          SECTION                            PAGE
;    1. REVISION HISTORY......................................   3
;    2. INTERESTING SYMBOLS...................................   4
;    3. MACRO DEFINITIONS -- ND, XP, EXT, GLOB................   5
;    4. MACRO DEFINITIONS -- LISTING CONTROL..................   7
;    5. MACRO DEFINITIONS -- BYTE MANIPULATION................   8
;    6. MACRO DEFINITIONS -- INFO/REDEF.......................   9
;    7. MACRO DEFINITIONS -- STACK CONTROL....................  10
;    8. SIMPLE STRUCTURE AND LOAD/STORE.......................  11
;    9. FLAG DEFINITIONS......................................  12
;   10. MACRO DEFINITIONS -- GENERATE OP CODES ABCX...........  13
;   11. MACRO DEFINITIONS -- JUMPPT...........................  22
;   12. USEFUL OPDEFS.........................................  23
;   13. SYMBOLS FOR THE CONTROL CHARACTERS....................  24
;   14. HARDWARE BITS OF INTEREST TO USERS....................  25
	SUBTTL	REVISION HISTORY

;BASED UPON C.MAC %7(163) RELEASED MAY, 1974

;VERSIONS RESET WHEN CREATED

;1	CREATION
;2	CLEAN UP AND CORRECT BUGS INTRODUCED IN ORIGINAL SPLIT
;3	(10-14,209) REMOVE PDP-6 TEST IF SAME AS KA IN JUMPPT
;4	MASK DOWN VALUE IN INSVL.
;5	(10-14,209) ADD .SUA?? SYMBOLS
;6	ADD LSTOF., LSTON.
;7	ADD VRSN. AND VR.???
;10	ADD SHOW.
;11	ADD CONT.
;12	ADD DEFST., LOAD., STOR.
;13	ADD FLAG., LFLAG., SFLAG. AND CHANGE TX??
;14	ADD .LHALF, .RHALF, .FWORD
;15	ADD .ZERO5
;16	ADD FRAME.
;17	ADD TY??.
;20	ADD ZERO.
;21	ADD NDS.
;22	SIMPLIFY INSVL.
;23	ADD KL-10 IN JUMPPT
;24	WITHDRAW 13 UNTIL UNDERSTOOD
;25	(10-16,546) CORRECT MISSING .XCREF IN TX?? AND MOVX
;26	(10-??,???) CORRECT MISSING .XCREFS IN CAX?
;27		    CORRECT MISSING .XCREFS IN ARITHX
;30		    CORRECT MISSING .XCREFS IN F???X
;31		    ADD IC.??? CODES
;32		    IMPROVE LSTOF., LSTON., CHANGE FRIENDS
;33		    ADD TITLE.
	SUBTTL	INTERESTING SYMBOLS

;VERSION FORMAT COMPONENTS

VR.WHO==7B2	;WHO EDITED (0=DEC DEVELOPMENT, 1=OTHER DEC,
		;     2-4=CUSTOMER, 5-7=END USER)
VR.VER==777B11	;MAJOR DEC VERSION
VR.MIN==77B17	;MINOR DEC VERSION (1=A, ETC.)
VR.EDT==777777	;EDIT LEVEL

;MACRO TO FORMAT THIS MODULE'S VERSION
;	VRSN.	PREFIX
;
;ASSUMES SYMBOLS OF FORM PREFIX'CUS, ..VER, ETC.

DEFINE VRSN.(PFX),<BYTE (3)PFX'WHO (9)PFX'VER (6)PFX'MIN (18)PFX'EDT>


;MISC. CONSTANTS

.INFIN==377777,,777777	;PLUS INFINITY
.MINFI==1B0		;MINUS INFINITY
LH.ALF==777777B17	;LEFT HALF WORD
RH.ALF==777777		;RIGHT HALF WORD
FW.ORD==-1		;FULL WORD
.ZERO5==0		;MNEMONIC THAT NO @ OR INDEX POSSIBLE

; MACRO TO GENERATE A TITLE
;	TITLE.	PROGRAM NAME,PROGRAM VERSION,PROGRAM DESCRIPTION
; NOTE:	IF USED, PROGRAM MUST BE LOADED WITH LINK-10.

	DEFINE	TITLE.	(NAME,VER,WHAT)<
	TITLE	NAME %'VER -- WHAT
IF2,	PRINTX	ASSEMBLING NAME %'VER -- WHAT
	.TEXT	*/VERSION:'VER*
>
	SUBTTL	MACRO DEFINITIONS -- ND, XP, EXT, GLOB

;MACRO TO DEFINE A SYMBOL IF NOT ALREADY DEFINED
;	ND  SYMBOL,VALUE

DEFINE	ND(SYMBOL,VALUE),<
	IFNDEF	SYMBOL,<SYMBOL==VALUE>
>


;MACRO TO SHOW THE VALUE OF AN ABSOLUTE SYMBOL
;	SHOW.	SYMBOL
;WARNING-- DO NOT USE AS LAST LOCATION IN A SEGMENT

DEFINE	SHOW.(ARG$),<	LSTOF.	CREF
	EXP	<ARG$>
	.ORG	.-1
			LSTON.	CREF>


;MACRO TO DEFINE A SYMBOL IF NOT ALREADY DEFINED AND SHOW ITS VALUE
;WARNING-- DO NOT USE AS LAST LOCATION IN A SEGMENT

DEFINE	NDS.(SYMBOL,VALUE),<
	IFNDEF	SYMBOL,<SYMBOL==VALUE>
	SHOW.	(SYMBOL)
>
;MACRO TO DEFINE A SYMBOL AND FORCE IT INTERN
;	XP  SYMBOL,VALUE,PRINT
;		WHERE PRINT IS NON-BLANK TO PRINT OUT FROM DDT

DEFINE	XP(SYMBOL,VALUE,PRINT),<
	INTERN	SYMBOL
	IFB  <PRINT>,<SYMBOL==VALUE>
	IFNB <PRINT>,<SYMBOL=VALUE>
>


;MACRO TO EXTERN A SYMBOL IF NOT DEFINED IN THIS ROUTINE
;	EXT	SYMBOL

DEFINE	EXT(SYMBOL),<
	IRP	SYMBOL,<
	IF2,<	IFNDEF	SYMBOL,<EXTERN SYMBOL> >>>



;MACRO TO EXTERN OR INTERN A SYMBOL
;	GLOB	SYMBOL

DEFINE	GLOB(SYMBOL),<
	IRP	SYMBOL,<
	IF2,<	IFDEF	SYMBOL,<INTERN SYMBOL>
		IFNDEF	SYMBOL,<EXTERN SYMBOL>
		SUPPRE	SYMBOL>>>
	SUBTTL	MACRO DEFINITIONS -- LISTING CONTROL

;THIS MACRO IS USED TO FORCE A PAGE OVERFLOW WITH COMMENT
;TO HAVE LISTINGS MATCH THE PROPOSED CODING STANDARD.
;
;IT IS INVOKED WHENEVER A PAGE OVERFLOW WOULD HAVE HAPPENED.
;
;
;ACCORDING TO THE PROPOSED STANDARD, ALL SOURCE FOR A ROUTINE
;MUST OCCUR ON ONE PAGE. HOWEVER, IT IS IMPORTANT FOR THE
;USER TO FIND "SENTENCE" BREAKS TO FORM THE OVERFLOW (EJECT)
;POINTS. WHENEVER OVERFLOW OCCURS, A COMMENT
;TO THAT EFFECT SHOULD APPEAR IN THE LISTING. ALL THIS IS
;ACCOMPLISHED BY THE USER INCLUDING THE MACRO "CONT." IN HIS
;SOURCE AT THE POINT OF THE OVERFLOW. NO BLANKS SHOULD PRECEED
;OR FOLLOW THE MACRO.

	DEFINE	CONT.<LALL

			   PAGE	;(CONTINUED ON NEXT PAGE)
			   SALL	;(CONTINUED FROM PREVIOUS PAGE)
>


;MACROS TO TURN ON AND OFF LISTINGS WHEN NESTING
;	LSTOF.		TURNS OFF LISTING AND CREF
;	LSTOF.	LIST	TURNS OFF LISTING
;	LSTOF.	CREF	TURNS OFF CREF
;	LSTON.		RESTORES LISTING AND CREF IF TOP LEVEL
;	LSTON.	LIST	RESTORES LISTING IF TOP LEVEL
;	LSTON.	CREF	RESTORES CREF IF TOP LEVEL
;IF LSTIN. IS DEFINED AS .MINFI, THEN ALL LISTINGS ON
;IF CRFIN. IS DEFINED AS .MINFI, THEN ALL CREFS ON

DEFINE	LSTOF.(SPEC)	<
IFDIF <SPEC><LIST>,<
	IFNDEF CRFIN.,CRFIN.==0
	IFGE CRFIN.,.XCREF
	CRFIN.==CRFIN.+1>
IFDIF <SPEC><CREF><
	IFNDEF LSTIN.,LSTIN.==0
	IFGE LSTIN.,XLIST
	LSTIN.==LSTIN.+1>
>

DEFINE	LSTON.(SPEC)	<
IFDIF <SPEC><CREF>,<
	LSTIN.==LSTIN.-1
	IFLE LSTIN.,LIST>
IFDIF <SPEC><LIST>,<
	CRFIN.==CRFIN.-1
	IFLE CRFIN.,.CREF>
>
	SUBTTL	MACRO DEFINITIONS -- BYTE MANIPULATION

;MACRO TO COMPUTE THE WIDTH OF A MASK
;	"WID" RETURNS THE LENGTH OF THE LEFTMOST STRING OF
;	CONSECUTIVE ONES IN THE WORD.
DEFINE	WID(MASK),<<^L<-<<MASK>_<^L<MASK>>>-1>>>

;MACRO TO COMPUTE THE POSITION OF A MASK
DEFINE	POS(MASK),<<^L<MASK>+^L<-<<MASK>_<^L<MASK>>>-1>-1>>

;MACRO TO BUILD A POINTER TO A MASKED QUANTITY
;	POINTR	LOCATION,MASK
DEFINE	POINTR(LOC,MASK),<<POINT	WID(MASK),LOC,POS(MASK)>>

;MACRO TO BUILD A MASK "WID" BITS WIDE, WITH ITS RIGHTMOST BIT
;	IN THE BIT POSITION "POS".   (I.E. A MASK FOR THE BYTE
;	POINTED TO BY THE BYTE POINTER "POINT  WID,LOC,POS")
DEFINE	MASK.(WID,POS),<<<<1_<WID>>-1>B<POS>>>

;MACRO TO DEFINE A SYMBOL WITH ONLY ONE BIT ON, IN THE SAME POSITION AS
;	THE RIGHTMOST BIT IN "MASK" (OR 0, IF "MASK" = 0)
DEFINE RGHBT.(MASK),<<<MASK>&-<MASK>>>

;MACRO TO DEFINE A SYMBOL WITH ONLY ONE BIT ON, IN THE SAME POSITION AS
;	THE LEFTMOST BIT IN "MASK" (OR 0, IF "MASK" = 0)
DEFINE LFTBT.(MASK),<<1B<^L<MASK>>>>

;	"FILIN." RETURNS A WORD WITH A CONSECUTIVE STRING OF ONES FROM THE
;	BIT POSITION OF THE LEFTMOST ONE IN "MASK" THROUGH THE BIT POSITION
;	OF THE RIGHTMOST ONE IN "MASK" INCLUSIVE.
DEFINE FILIN.(MASK),<<<MASK>!<<LFTBT.(MASK)>-<RGHBT.(MASK)>>>>

;	"ALIGN." RETURNS THE NUMBER OF TRAILING ZEROS IN "MASK"
;	(I.E. A VALUE WHICH IS THE RIGHT COUNTERPART OF THE VALUE
;	RETURNED BY THE MACRO-10 OPERATOR "^L")
DEFINE ALIGN.(MASK),<<^D35-<^L<RGHBT.(MASK)>>+<^D37*<<^L<RGHBT.(MASK)>>/^D36>>>>

;	BTSWP.(AC,BIT-1,BIT-2) SWAPS BITS 1 AND 2 IN AC.
;		BIT-1 AND BIT-2 ARE DECIMALS 0-35
DEFINE	BTSWP.(AC,BIT1,BIT2),<
	REPEAT	3,<
	TXCE	AC,1B<BIT1>!1B<BIT2>
>>

;	"INSVL." POSITIONS VALUE IN MASK
DEFINE INSVL.(VALUE,MASK),<<<<VALUE>B<POS(<MASK>)>>&<MASK>>>
	SUBTTL	MACRO DEFINITIONS -- INFO/REDEF

;THE FOLLOWING MACROS FACILITATE THE ACCUMULATION OF TEXT BY PERMITTING
;THE USER TO APPEND A LINE OF TEXT TO THE BODY OF TEXT ALREADY
;ACCUMULATED.  THE MACROS ARE USED IN THE FOLLOWING WAY:
;1.  TO CLEAR THE MECHANISM:
;	CINFO.
;2.  TO APPEND THE LINE "SAMPLE LINE" (FOLLOWED BY CR-LF) TO THE
;END OF THE TEXT ACCUMULATED SO FAR:
;	INFO.	REDEF.,"SAMPLE LINE"
;3.  TO DEFINE A MACRO "NAME" SO THAT ITS EXPANSION WILL BE THE TEXT
;ACCUMULATED SO FAR, (NOTE-IT ADDS A NULL LINE TO THE END):
;	INFO.	DEFINE	"NAME"

	DEFINE	CINFO.	<
	DEFINE	INFO.(OPCODE,NEWARG)<
	OPCODE	NEWARG>>

	DEFINE	REDEF.(OLDARG)<
	DEFINE	INFO.(OPCODE,NEWARG)<
	OPCODE	<OLDARG
	NEWARG>>>
	SUBTTL	MACRO DEFINITIONS -- STACK CONTROL

;MACRO TO DEFINE A BUNCH OF WORDS ON THE STACK.
;EACH ARGUMENT TO THE FRAME. MACRO ALLOCATES 1 WORD ON THE
;  STACK AND DEFINES A MACRO WITH THE SAME NAME AS -N(P).
;
;WARNING: THIS MACRO DEFINES THINGS IN TERMS OF (P) AND THEREFOR
;	NOTHING ELSE MAY BE PUSHED ON THE STACK!!!

DEFINE	FRAME. (LIST,%A),<
	OLD%%%==10	;;SAVE CURRENT RADIX
	RADIX	8
	N%%%==0		;;ARGUMENT COUNT
IRP LIST,<
	FR%%AM (LIST,\<N%%%+1>)	;;DEFINE SYMBOL MACRO
	N%%%==N%%%+1		;;COUNT ARGS
>
	ADD	P,[N%%%,,N%%%]	;;ALLOCATE SPACE
	PUSHJ	P,%A		;;DO THE SUBROUTINE
	  SKIPA
	AOS	-N%%%(P)	;;PASS ON SKIP RETURN
	SUB	P,[N%%%,,N%%%]	;;DEALLOCATE SPACE
	POPJ	P,		;;RETURN
%A:
	RADIX	OLD%%%
	PURGE	N%%%,OLD%%%
>

DEFINE	FR%%AM (A,B),<
	DEFINE	A,<-^O'B(P)>
>
	SUBTTL	SIMPLE STRUCTURE AND LOAD/STORE

;MACROS TO DEFINE AND LOAD/STORE A BYTE LOCATION

;MACRO DEFST. (BYTE NAME, WORD LOCATION, MASK)
; DEFINES THE LOCATION AND SIZE OF THE BYTE

DEFINE	DEFST.(NAM$,LOC$,MASK$),<
	..OLD==10
	..TYP==3
IFE <MASK$>+1,..TYP==0
IFE <MASK$>-^O777777,..TYP==1
IFE <MASK$>-^O777777B17,..TYP==2
..POS==POS(<MASK$>)
..WID==WID(<MASK$>)
	RADIX	10
	DF%%ST (\..TYP,NAM$,<LOC$>,\..POS,\..WID)
	PURGE	..OLD,..TYP,..POS,..WID>

;	THIS IS A HELPER MACRO FOR INTERNAL USE

DEFINE	DF%%ST (TYP$,NAM$,LOC$,POS$,WID$),<
	RADIX	..OLD
DEFINE	NAM$ (OPS,AC,E),<
	..C==0
	IRP OPS,<
		IFE TYP$-..C,<
			STOPI
			IFN 3-..C, OPS <AC>,LOC$''E
			IFE 3-..C, OPS <AC>,[POINT WID$,LOC$''E,POS$]
		>
	..C==..C+1>
	PURGE	..C>
>

;MACRO LOAD. (AC, BYTE NAME, OPTIONAL LOC)
; WILL LOAD AC WITH THE CONTENTS OF THE BYTE. IF AND ONLY
; NO LOCATION WAS GIVEN IN DEFST., GIVE IT IN LOAD.

;MACRO STOR. IS IDENTICAL EXCEPT THE AC IS STORED INTO THE BYTE.

;MACRO ZERO. IS IDENTICAL (FIRST ARG IGNORED) EXCEPT ZERO IS STORED

DEFINE LOAD. (AC$,STR$,E$),< STR$ (<MOVE,HRRZ,HLRZ,LDB>,<AC$>,<E$>)>
DEFINE STOR. (AC$,STR$,E$),< STR$ (<MOVEM,HRRM,HRLM,DPB>,<AC$>,<E$>)>
DEFINE ZERO. (AC$,STR$,E$),< STR$ (<SETZM,HLLZS,HRRZS,<PRINTX ?CAN'T ZERO BYTE>>,<AC$>,<E$>)>
	SUBTTL	FLAG DEFINITIONS

;MACRO FLAG. DEFINES A LIST OF FLAGS AS BEING IN
;A PARTICULAR REGISTER IN SUCH A FASHION THAT
;THE BITS ARE ASSIGNED AT ASSEMBLY TIME AND THE REGISTER AND
;BITS ARE "REMEMBERED" FOR FUTURE USE IN THE TX?? MACROS.

;;THIS WILL BE DEFINED AT SOME FUTURE TIME AND VERSION.
;;(WHEN WE FIGURE OUT WHAT WE'RE TALKING ABOUT!)
	SUBTTL	MACRO DEFINITIONS -- GENERATE OP CODES ABCX

;MACRO TO GENERATE MOVEI, MOVSI, OR MOVE [] AS APPROPRIATE
;	ALSO HRLOI, HRROI

DEFINE	MOVX	(AC,FLAG),<
	LSTOF.	CREF
	TEST%%=0
IFE	<<FLAG>_-^D18>,<
	TEST%%=1
	LSTON.	CREF
	MOVEI	AC,<FLAG>
	LSTOF.	CREF
>
IFN	<FLAG>,<
IFE	<<FLAG>_^D18>,<
	TEST%%=1
	LSTON.	CREF
	MOVSI	AC,(FLAG)
	LSTOF.	CREF
>
IFE	<<<FLAG>_-^D18>-^O777777>,<
	TEST%%=1
	LSTON.	CREF
	HRROI	AC,<FLAG>
	LSTOF.	CREF
>
IFE	TEST%%,<
IFE	<<<FLAG>_^D18>-^O777777B17>,<
	TEST%%=1
	LSTON.	CREF
	HRLOI	AC,(<FLAG>-^O777777)
	LSTOF.	CREF
>
IFE	TEST%%,<
	LSTON.	CREF
	MOVE	AC,[FLAG]
	LSTOF.	CREF
>>>
	PURGE	TEST%%
	LSTON.	CREF>

;STORE (AC,FIRST,LAST,CONSTANT) PUTS CONSTANT IN FIRST THRU LAST.
	DEFINE	STORE(AC,FIRST,LAST,CONS),<
IFE <CONS>,<	SETZM	FIRST>	;;IF CONS=0, CLEAR FIRST
IFE <CONS>+1,<	SETOM	FIRST>	;;IF CONS=-1, SET FIRST TO -1
IFN <CONS>*<<CONS>+1>,<MOVX	AC,<CONS>	;;ELSE DO IT
		   MOVEM AC,FIRST>	;; THE HARD WAY
IFNB <LAST>,<			;;IF MORE THAN ONE LOCATION
	MOVE	AC,[FIRST,,FIRST+1]
	BLT	AC,LAST		;;DISTRIBUTE THE CONSTANT
>>
;GENERATE CAI OR CAM AS APPROPRIATE

	LSTOF.	CREF
DEFINE	CAX%%	(M),<
	IRP	M,<
DEFINE	CAX'M	(AC,VAL),<
	LSTOF.	CREF
	OP%%CA	(AC,VAL,M)
	LSTON.	CREF
>>>

	CAX%%	<,L,LE,E,G,GE,N,A>

	PURGE	CAX%%
	LSTON.	CREF

DEFINE	OP%%CA	(AC,VALUE,CODE),<
IFE	<<VALUE>_-^D18>,<
	LSTON.	CREF
	CAI'CODE	AC,<VALUE>
	LSTOF.	CREF
>
IFN	<<VALUE>_-^D18>,<
	LSTON.	CREF
	CAM'CODE	AC,[VALUE]
	LSTOF.	CREF
>>
;GENERATE IMMEDIATE OR MEMORY CONSTANTS

	LSTOF.	CREF
DEFINE	ATHX%%	(M,N),<
	IRP	M,<
	IRP	N,<
IFB <N>,<
	DEFINE	M'X	(AC,VAL)<
	LSTOF.	CREF
	OP%%IN	(AC,VAL,M)
	LSTON.	CREF
>>
IFNB <N>,<
	DEFINE	M'X	(AC,VAL)<
	LSTOF.	CREF
	OP%%IA	(AC,VAL,M,N)
	LSTON.	CREF
>>>>>

	ATHX%%	<ADD,SUB,MUL,IMUL,DIV,IDIV>,<SUB,ADD,,,,>

	PURGE	ATHX%%
	LSTON.	CREF

DEFINE	OP%%IA	(AC,VALUE,CODE,ALT),<
IFE	<<<VALUE>_-^D18>-^O777777>,<
	LSTON.	CREF
	ALT'I	AC,-<VALUE>
	LSTOF.	CREF
>
IFN	<<<VALUE>_-^D18>-^O777777>,<
	OP%%IN	AC,<VALUE>,CODE
>>

DEFINE	OP%%IN	(AC,VALUE,CODE),<
IFE	<<VALUE>_-^D18>,<
	LSTON.	CREF
	CODE'I	AC,<VALUE>
	LSTOF.	CREF
>
IFN	<<VALUE>_-^D18>,<
	LSTON.	CREF
	CODE	AC,[VALUE]
	LSTOF.	CREF
>>
;GENERATE IMMEDIATE OR MEMORY FOR FLOATING POINT

DEFINE	FADRX	(AC,VAL),<LSTOF.	CREF
			OP%%FA	(AC,VAL,FADR,FSBR)
			LSTON.	CREF
>
DEFINE	FSBRX	(AC,VAL),<LSTOF.	CREF
			OP%%FA	(AC,VAL,FSBR,FADR)
			LSTON.	CREF
>
DEFINE	FMPRX	(AC,VAL),<LSTOF.	CREF
			OP%%FP	(AC,VAL,FMPR)
			LSTON.	CREF
>
DEFINE	FDVRX	(AC,VAL),<LSTOF.	CREF
			OP%%FP	(AC,VAL,FDVR)
			LSTON.	CREF
>

DEFINE	OP%%FA	(AC,VALUE,CODE,ALT),<
IFE	<<<VALUE>_^D18>-^O777777B17>,<
	LSTON.	CREF
	ALT'I	AC,(-<VALUE>)
	LSTOF.	CREF
>
IFN	<<<VALUE>_^D18>-^O777777B17>,<
	OP%%FP	AC,<VALUE>,CODE
>>

DEFINE	OP%%FP	(AC,VALUE,CODE),<
IFE	<<VALUE>_^D18>,<
	LSTON.	CREF
	CODE'I	AC,(VALUE)
	LSTOF.	CREF
>
IFN	<<VALUE>_^D18>,<
	LSTON.	CREF
	CODE	AC,[VALUE]
	LSTOF.	CREF
>>
;MACRO TO GENERATE MACROS OF THE FORM TXYY.  THESE MACRO REPLACE
; A TLYY OR A TRYY DEPENDING UPON THEIR ARGUMENT. SEE EXAMPLES:
;
;		CALL				RESULT
;	TXNE	F,1B20			TRNE	F,1B20
;	TXON	F,1B0			TLON	F,(1B0)
;	TXZ	F,1B1!1B31		TDZ	F,[1B1!1B31]
;
;IF CALLED WITH ONLY ONE ARG, IT IS ASSUMED TO BE DEFINED BY A FLAG. MACRO

	LSTOF.	CREF
DEFINE	TX0%%	(M,S),<
	IRP	M,<
	IRP	S,<
DEFINE	TX'M'S	(AC,FLAG),<
	LSTOF.	CREF
IFB  <FLAG>,	OP%%TX	<^O37777777&AC>,1B<AC_-^D30>,TL'M'S,TR'M'S,TD'M'S
IFNB <FLAG>,	OP%%TX	AC,<FLAG>,TL'M'S,TR'M'S,TD'M'S
	LSTON.	CREF
>>>>

	TX0%%	<N,Z,O,C>,<E,N,A>

	PURGE	TX0%%
	LSTON.	CREF

DEFINE	TXN	(AC,FLAG),<
IFB <FLAG>, JFCL	0
IFNB <FLAG>, TRN	AC,<,,<FLAG>>
>
DEFINE	TXZ	(AC,FLAG),<
	LSTOF.	CREF
IFB <FLAG>, TXZ	(<^O37777777&AC>,1B<AC_-^D30>)
IFNB <FLAG>,<
IFN <<AC>&^O777777777760>, PRINTX ? AC IS NOT AN ACCUMULATOR
IFE	<<<FLAG>_-^D18>-^O777777>,<
	LSTON.	CREF
	ANDI	AC,<,,-1-<FLAG>>
	LSTOF.	CREF>
IFN	<<<FLAG>_-^D18>-^O777777>,<
	OP%%TX	AC,<FLAG>,TLZ,TRZ,TDZ
>>	LSTON.	CREF>

DEFINE	TXO	(AC,FLAG),<
	LSTOF.	CREF
IFB <FLAG>, TXO	(<^O37777777&AC>,1B<AC_-^D30>)
IFNB <FLAG>,<
IFN <<AC>&^O777777777760>, PRINTX ? AC IS NOT AN ACCUMULATOR
IFE	<<<FLAG>_-^D18>-^O777777>,<
	LSTON.	CREF
	ORCMI	AC,<,,-1-<FLAG>>
	LSTOF.	CREF>
IFN	<<<FLAG>_-^D18>-^O777777>,<
	OP%%TX	AC,<FLAG>,TLO,TRO,TDO
>>	LSTON.	CREF>
DEFINE	TXC	(AC,FLAG),<
	LSTOF.	CREF
IFB <FLAG>, TXC	(<^O37777777&AC>,1B<AC_-^D30>)
IFNB <FLAG>,<
IFN <<AC>&^O777777777760>, PRINTX ? AC IS NOT AN ACCUMULATOR
IFE	<<<FLAG>_-^D18>-^O777777>,<
	LSTON.	CREF
	EQVI	AC,<,,-1-<FLAG>>
	LSTOF.	CREF>
IFN	<<<FLAG>_-^D18>-^O777777>,<
	OP%%TX	AC,<FLAG>,TLC,TRC,TDC
>>	LSTON.	CREF>

DEFINE	OP%%TX	(AC,FLAG,L,R,D)<
IFN <<AC>&^O777777777760>, PRINTX ? AC IS NOT AN ACCUMULATOR

	TEMP%%=0
IFE	<<FLAG>_^D18>,<
IFN	<FLAG>,<
	TEMP%%=1
	LSTON.	CREF
	L	AC,(FLAG)
	LSTOF.	CREF
>>
IFE	<<FLAG>_-^D18>,<
	TEMP%%=1
	LSTON.	CREF
	R	AC,<FLAG>
	LSTOF.	CREF
>
IFE	TEMP%%,<
	LSTON.	CREF
	D	AC,[FLAG]
	LSTOF.	CREF
>
	PURGE	TEMP%%
>

;DEFINE MNEMONIC CODES FOR SOME OF ABOVE

DEFINE	IORX	(AC,FLAG),<TXO	AC,<FLAG>>
DEFINE	ANDX	(AC,FLAG),<TXZ	AC,-1-<FLAG>>
DEFINE	XORX	(AC,FLAG),<TXC	AC,<FLAG>>
;MACROS TO TEST AND SET/CLEAR/COMPLEMENT FLAGS WHICH ARE NOT
;IN ACCUMULATORS. BE VERY CAREFUL THAT THESE GENERATE TWO
;INSTRUCTIONS, SO CAN NOT BE SKIPPED OVER.
;THEY EACH HAVE TWO ARGUMENTS, THE FIRST IS A SCRATCH AC
; AND THE SECOND IS THE FLAG WHICH WAS DEFINED IN A FLAG. MACRO.

DEFINE	TYNE.	(AC,FLAG),<
	MOVX	AC,1B<FLAG_-^D30>
	LSTOF.	CREF
	<TDNE	AC,>!<37777777&FLAG>
	LSTON.	CREF
>

DEFINE	TYNN.	(AC,FLAG),<
	MOVX	AC,1B<FLAG_-^D30>
	LSTOF.	CREF
	<TDNN	AC,>!<37777777&FLAG>
	LSTON.	CREF
>

DEFINE	TYO.	(AC,FLAG),<
	MOVX	AC,1B<FLAG_-^D30>
	LSTOF.	CREF
	<IORM	AC,>!<37777777&FLAG>
	LSTON.	CREF
>

DEFINE	TYZ.	(AC,FLAG),<
	MOVX	AC,1B<FLAG_-^D30>
	LSTOF.	CREF
	<ANDCAM	AC,>!<37777777&FLAG>
	LSTON.	CREF
>

DEFINE	TYC.	(AC,FLAG),<
	MOVX	AC,1B<FLAG_-^D30>
	LSTOF.	CREF
	<XORM	AC,>!<37777777&FLAG>
	LSTON.	CREF
>
;NOTE - "TXNI.", "TXND.", "JUMPI." & "JUMPD." MAY ASSEMBLE AS ONE OR MORE
;	INSTRUCTIONS, DEPENDING ON THE ACTUAL VALUES OF THEIR ARGUMENTS.
;	IN ALL CASES WHERE THE MACRO EXPANSION IS MORE THAN ONE INSTRUCTION
;	IT WILL BE TRUE THAT IF CONTROL ARRIVES AT THE SECOND INSTRUCTION
;	OF THE MACRO EXPANSION, CONTROL WILL UNCONDITIONALLY BE PASSED TO
;	THE INSTRUCTION IMMEDIATELY FOLLOWING THE LAST INSTRUCTION OF THE
;	MACRO EXPANSION (WITHOUT HAVING ALTERED ANY PART OF THE MACHINE
;	STATE OTHER THAN THE PC). THUS A SKIP TYPE INSTRUCTION IMMEDIATELY
;	PRECEEDING A "TXNI.", "TXND.", "JUMPI.", OR "JUMPD." MACRO WILL HAVE
;	THE EFFECT OF SKIPPING OVER THE ENTIRE MACRO EXPANSION.
;
;
;TEST (BUT DON'T MODIFY) THE FIELD
;	(IN "AC") SPECIFIED BY "MASK" AND SKIP IF IT IS IDENTICAL TO "PATERN"
DEFINE	TXNI.(AC,MASK,PATERN),<
IFE <<MASK>_<1+^L<MASK>>>,<
IFE <<MASK>&<PATERN>>,<
	TXNE	AC,<MASK>
>
IFN <<MASK>&<PATERN>>,<
	TXNN	AC,<MASK>
>>
IFN <<MASK>_<1+^L<MASK>>>,<
	TXCA	AC,<<PATERN>&<MASK>>
	JRST	.+4
	TXCE	AC,<<PATERN>&<MASK>>
	JRST	.+2
	TXNE	AC,<<-<PATERN>-1>&<MASK>>
>>

;TEST (BUT DON'T MODIFY) THE FIELD
;	(IN "AC") SPECIFIED BY "MASK" AND SKIP IF IT IS DIFFERENT THAN "PATERN"
DEFINE	TXND.(AC,MASK,PATERN),<
IFE <<MASK>_<1+^L<MASK>>>,<
IFE <<MASK>&<PATERN>>,<
	TXNN	AC,<MASK>
>
IFN <<MASK>&<PATERN>>,<
	TXNE	AC,<MASK>
>>
IFN <<MASK>_<1+^L<MASK>>>,<
	TXCA	AC,<<PATERN>&<MASK>>
	JRST	.+4
	TXCE	AC,<<PATERN>&<MASK>>
	JRST	.+3
	TXNN	AC,<<-<PATERN>-1>&<MASK>>
>>
;JUMP TO "LOCATN" IF THE FIELD
;	(IN "AC") SPECIFIED BY "MASK" IS IDENTICAL TO "PATERN"
DEFINE	JUMPI.(AC,MASK,PATERN,LOCATN),<
IFE <<MASK>_1>,<
IFE <MASK>,<
	JUMPA	AC,LOCATN
>
IFN <MASK>,<
IFE <<PATERN>&<MASK>>,<
	JUMPGE	AC,LOCATN
>
IFN <<PATERN>&<MASK>>,<
	JUMPL	AC,LOCATN
>>>
IFN <<MASK>_1>,<
	TXCA	AC,<<PATERN>&<MASK>>
	JRST	.+5
	TXCE	AC,<<PATERN>&<MASK>>
	JRST	.+3
	TXNN	AC,<<-<PATERN>-1>&<MASK>>
	JRST	LOCATN
>>

;JUMP TO "LOCATN" IF THE FIELD
;	(IN "AC") SPECIFIED BY "MASK" IS DIFFERENT THAN "PATERN"
DEFINE	JUMPD.(AC,MASK,PATERN,LOCATN)
<IFE <<MASK>_1>,<
IFE <MASK>,<
	JUMP	AC,LOCATN
>
IFN <MASK>,<
IFE <<PATERN>&<MASK>>,<
	JUMPL	AC,LOCATN
>
IFN <<PATERN>&<MASK>>,<
	JUMPGE	AC,LOCATN
>>>
IFN <<MASK>_1>,<
	TXCA	AC,<<PATERN>&<MASK>>
	JRST	.+5
	TXCE	AC,<<PATERN>&<MASK>>
	JRST	LOCATN
	TXNE	AC,<<-<PATERN>-1>&<MASK>>
	JRST	LOCATN
>>
	SUBTTL	MACRO DEFINITIONS -- JUMPPT

;MACRO TO JUMP DEPENDING UPON PROCESSOR TYPE

;CALL:	JUMPPT	TEMPAC,PDP-6 ADDR,KA-10 ADDR,KI-10 ADDR,KL-10 ADDR
;	WHERE	TEMPAC IS AN AC TO USE AS A TEMP
;	BLANK PROCESSORS FALL THROUGH TO NEXT INSTRUCTION

DEFINE	JUMPPT	(AC,CP166,KA10,KI10,KL10,KX,KY,KZ,%1),<
IFDIF <CP166><KA10>,<
	JFCL	1,.+1		;;CLEAR PC-CHANGE FLAG
	JRST	.+1		;;SET PC-CHANGE
IFNB <CP166>,<	JFCL	1,CP166
  IFNB <KA10>,<IFIDN <KA10><KI10>,<IFIDN <KI10><KL10>,< JRST	KA10>>>>
IFB <CP166>,<	JFCL	1,%1
  IFIDN <KA10><KI10>,<IFIDN <KI10><KL10>,< JRST	KA10>>>
>;;END IFDIF <CP166><KA10>

IFDIF <KA10><KI10>,<
	HRLOI	AC,-2		;;SET FOR KA/KI TEST
IFNB <KA10>,<	AOBJP	AC,KA10
  IFNB <KI10>,<IFIDN <KI10><KL10>,<JRST	KI10>>>
IFB <KA10>,<IFDIF <KI10><KL10>,<AOBJP AC,%1>
	    IFIDN <KI10><KL10>,<AOBJN AC,KI10>>
>;;END IFDIF <KA10><KI10>

IFDIF <KI10><KL10>,<
	IF2,<IFE AC,<PRINTX ? AC MUST BE NON-ZERO IN JUMPPT>>
	MOVEI	AC,0		;;SET FOR KI/KL TEST
	BLT	AC,0		;;DO TEST
IFNB <KI10>,<	JUMPE	AC,KI10
  IFNB <KL10>,<	JRST	KL10>>
IFB <KI10>,<	JUMPN	AC,KL10>
>;;END IFDIF <KI10><KL10>

LSTOF.	CREF
%1:
LSTON.	CREF>


;DEFINE UNITS OF STORAGE ALLOCATION

.SUAP6==^D1024	;PDP-6
.SUAKA==^D1024	;KA-10
.SUAKI==^D512	;KI-10
.SUAKL==^D512	;KL-10
	SUBTTL	USEFUL OPDEFS

	OPDEF	PJRST	[JRST]		;PUSHJ/POPJ
	OPDEF	PJRSTF	[JRSTF]		;PUSHJ/POPJ
	OPDEF	PJSP	[JSP]		;MOVEI .+1/PUSHJ/POPJ
	OPDEF	PJUMPL	[JUMPL]
	OPDEF	PJMPLE	[JUMPLE]
	OPDEF	PJUMPE	[JUMPE]
	OPDEF	PJUMPN	[JUMPN]
	OPDEF	PJUMPG	[JUMPG]
	OPDEF	PJMPGE	[JUMPGE]

;OPDEF THE KI-10 CONCEALED PAGE GATE-KEEPER

	OPDEF	PORTAL	[JRST 1,]
	SUBTTL	SYMBOLS FOR THE CONTROL CHARACTERS

.CHNUL==000	;NULL
.CHCNA==001
.CHCNB==002
.CHCNC==003
.CHCND==004
.CHCNE==005
.CHCNF==006
.CHBEL==007	;BELL
.CHCNH==010
.CHTAB==011	;TAB
.CHLFD==012	;LINE-FEED
.CHVTB==013	;VERTICAL TAB
.CHFFD==014	;FORM FEED
.CHCRT==015	;CARRIAGE RETURN
.CHCNN==016
.CHCNO==017
.CHCNP==020
.CHCNQ==021
.CHCNR==022
.CHCNS==023
.CHCNT==024
.CHCNU==025
.CHCNV==026
.CHCNW==027
.CHCNX==030
.CHCNY==031
.CHCNZ==032
.CHESC==033	;ESCAPE
.CHCBS==034	;CONTROL BACK SLASH
.CHCRB==035	;CONTROL RIGHT BRACKET
.CHCCF==036	;CONTROL CIRCONFLEX
.CHCUN==037	;CONTROL UNDERLINE

.CHALT==175	;OLD ALTMODE
.CHAL2==176	;ALTERNATE OLD ALTMODE
.CHDEL==177	;DELETE
	SUBTTL	HARDWARE BITS OF INTEREST TO USERS

;PC FLAGS

PC.OVF==1B0	;OVERFLOW
PC.CY0==1B1	;CARRY 0
PC.CY1==1B2	;CARRY 1
PC.FOV==1B3	;FLOATING OVERFLOW
PC.BIS==1B4	;BYTE INCREMENT SUPPRESSION
PC.USR==1B5	;USER MODE
PC.UIO==1B6	;USER IOT MODE
PC.LIP==1B7	;LAST INSTRUCTION PUBLIC
PC.AFI==1B8	;ADDRESS FAILURE INHIBIT
PC.ATN==3B10	;APR TRAP NUMBER
PC.FUF==1B11	;FLOATING UNDERFLOW
PC.NDV==1B12	;NO DIVIDE

;INSTRUCTION FIELDS

IC.OPC==777B8		;OPERATION CODE
IC.ACF==17B12		;AC FIELD
IC.IOP==70034B14	;I/O OPERATION CODE
IC.IDV==774B11		;I/O DEVICE CHANNEL
IC.IND==1B13		;INDIRECT BIT
IC.IDX==17B17		;INDEX FIELD
IC.YHF==777777		;"Y" HALF
	SUBTTL

	.XCREF

%%MACT==<VRSN. (MAC)>
	PURGE	MACWHO,MACVER,MACMIN,MACEDT


	IF1,<	ASUPPRESS>
	IFNDEF %..C,<END>	;END UNIVERSAL OF MACTEN

	.CREF