Google
 

Trailing-Edge - PDP-10 Archives - BB-Y390T-BM - t20src/macten.mac
There are 48 other files named macten.mac in the archive. Click here to see a list.
SUBTTL	DEC-10 UNIVERSAL PARAMETERS

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





;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1971,1972,1973,1974,1975,1977,
;1978,1979,1980,1984,1986. ALL RIGHTS RESERVED.
;
;
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
;ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
;INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
;COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
;OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
;TRANSFERRED.
;
;THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
;AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
;CORPORATION.
;
;DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
;SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.





;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==0		;LAST PATCHER
	MACVER==5		;MAJOR VERSION
	MACMIN==0		;MINOR VERSION
	MACEDT==46		;EDIT LEVEL

	SALL
	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	TITLE. ETC.
;26	SPR 10-26427 PURGE DERIVED MACRO SYMBOLS TO ELIMINATE PROBLEMS
;	DURING ASSEMBLY OF A PROGRAM THAT MAY ACCIDENTALLY USE THE SAME
;	SYMBOL - CAUSES MULTIPLE DEFINED LABEL MESSAGES .
;	AREA AFFECTED:  LAST PAGE

;27	RDH	30-MAR-79
;	REDEFINE ND ETC. TO SHOW VALUES, APPEAR IN CREF LISTING
;	ADD NOT-KNOWN-TO-DDT HARDWARE MNEMONICS, .NODDT OBNOXIOUS SYMBOLS

;30	RDH	28-JUN-79	10-27572, 10-27753
;	MACROS GENERATED BAD CODE: MOVX AC,LH.ALF; ADDX AC,LH.ALF;
;	FADRX AC,1.99999999.

;31	RDH	8-COT-79
;	MORE BRACKETS IN XP MACRO TO AVOID "Q" ERRORS.
;32	MFB	26-FEB-80
;	MOVX MACRO GENERATED BAD CODE WHEN GIVEN A POLISH EXPRESSION.
;33	BAH	20-NOV-80
;	MOVX MACRO INSERTED WITH EDIT 32 IS NOT GENERATED UNDER THE .CREF
;	DIRECTIVE.
;34	BAH	30-JAN-81	10-30489
;	EDIT 32 CAUSED GALAXY V2 COMPONENTS NOT TO ASSEMBLE WHEN THE
;	INSTRUCTION MOVX AC,INSVL.(VALUE,MASK)!ARG IS USED.
;35	BAH	22-JUN-82	10-32710
;	IF FLAG IN THE MOVX MACRO IS NOT ABSOLUTE, THEN THE SYMBOL TEST%%
;	IS NOT PURGED.  MOVE THE PURGE TO AFTER THE END OF IF ABSOLUTE.
;36	JMF	11-OCT-82
;	ADD MACROS TO DEFINE BREAK SET MASKS
;37	WSM	15-APR-83
;	FIX GLOB MACRO
;40	BAH	15-Apr-83	10-33730
;	Define values for APR traps.
;
;41	BAH	20-Jun-83
;	Define XJRST.
;
;42	BAH	24-Aug-83
;	Define copyright macros.
;
;43	BAH	19-Sep-83
;	Zero the copyright text since LINK preserves the ACs of the
;	from the last request when /SAVEing an EXE.
;
;44	DPM	23-Sep-83
;	Suppress cruft generated by .BCOPY and .ECOPY in .LST files.
;
;45	BAH	30-JAN-84
;	Define XMOVEI and XHLLI instructions since they aren't in MACRO.
;
;	*** Begin Version 5 ***
;
;46	BAH	4-Sep-85
;	Copyrights need to include "year. ALL RIGHTS RESERVED.", so the macro
;	cannot use a period as a delimiter.  Use a \ instead.
;
DEFINE .BCOPY,<
	XLIST
	.ORG 0
	LIST
>
DEFINE COPYRIGHT,<ASCIZ \
COPYRIGHT > 
DEFINE .ECOPY,<
	XLIST
	.....X=.
	.ORG
	.ORG 0
	REPEAT .....X,<EXP 0>
	PURGE .....X
	.ORG
	LIST
>

.BCOPY
COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1971,1986.
ALL RIGHTS RESERVED.
\
.ECOPY
;+.CENTER
;TITLE. MACRO
;.SKIP 2
;THE TITLE. MACRO IS DESIGNED TO HANDLE THE PROBLEMS OF
;MAINTAINING VERSION NUMBERS IN PROGRAMS. THE MACRO GENERATES
;A SERIES OF MACROS TO PERFORM VARIOUS FUNCTIONS FOR THE
;MACRO-10 PROGRAMMER. THE GENERAL FORM IS:
;.PARAGRAPH 0
;TITLE. (ABV,PRGNAM,COMMENT)
;.TAB STOPS 8
;.LEFT MARG 8
;.PARAGRAPH -8
;WHERE:	ABV=3-CHAR PROGRAM ABBREVIATION, IE. "DRT" FOR DIRECT.
;.BREAK
;PRGNAM=PROGRAM NAME, DIRECT.
;.BREAK
;COMMENT=SHORT STATEMENT STATING PROGRAM'S FUNCTION
;
;.LEFT MARG 0
;.PARA 0
;THE TITLE. MACRO ASSUMES THAT FOUR SYMBOLS ARE DEFINED,
;XXXVER, XXXMIN, XXXWHO AND XXXEDT, WHERE XXX=THE 3-CHARACTER
;PROGRAM ABBREVIATION SUPPLIED TO THE MACRO.
;TWO SYMBOLS ARE DEFINED XXXASC AND XXXSIX WHICH ARE SYMBOLICALLY
;AND RESPECTIVELY DEFINED AS THE ASCII AND SIXBIT VALUES OF THE
;PROGRAM ABBREVIATION SUPPLIED.
;-
SUBTTL	TITLE MACRO
;&.SUBTTL TITLE MACRO


; TITLE. (DRT,DIRECT,PROGRAM TO LIST DIRECTORIES)
DEFINE TITLE.(ABV,PRGNAM,COMENT),<
	.XCREF
	Z==0
	IFNDEF ABV'VER,<Z==-1>
	IFNDEF ABV'MIN,<Z==-1>
	IFNDEF ABV'EDT,<Z==-1>
	IFNDEF ABV'WHO,<Z==-1>
	IFL Z,<PRINTX ?SYMBOLS ABV'WHO,ABV'VER,ABV'MIN AND ABV'EDT NOT DEFINED
	PRINTX ?VERSION SYMBOLS MUST BE DEFINED BEFORE CALLING TITLE. MACRO
END>
	.CREF
	IF2,<LALL>
	ABV'SIX==SIXBIT /ABV/	; PRGNAM ABBREVIATION IN SIXBIT
	ABV'ASC==ASCIZ /ABV/	; PRGNAM ABBREVIATION IN ASCII
	SALL
	.XCREF
%FIRST=ABV'MIN/^D26
IFE %FIRST,<%SECON==ABV'MIN
	%FIRST==0>
IFG %FIRST,<%SECON=ABV'MIN-<^D26*%FIRST>>
IFE ABV'MIN-^D26,<%SECON==ABV'MIN
	%FIRST=0>
IFE ABV'MIN-^D52,<%SECON==^D26
	%FIRST=1>
; DEFINE ALL THE MACROS
BUILD$ (PRGNAM,\ABV'VER,\ABV'MIN,\%FIRST,<,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,
T,U,V,W,X,Y,Z>,\%SECON,<,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,
V,W,X,Y,Z>,\ABV'EDT,\ABV'WHO,COMENT,ABV)

	IF2,<PURGE %SECON,%FIRST,Z>
.CREF>
SUBTTL	BUILD$ MACRO

;+THE TITLE. MACRO GENERATES THE FOLLOWING MACROS TO
;BE OPTIONALLY CALLED BY THE USER.
;.LEFT MARG 8
;-.TAB STOPS 8

DEFINE BUILD$ (PRGNAM,MAJN,MINOR,O1,L1,O2,L2,EDIT,CUS,COMENT,ABV,%TMP,%A,%B),<
%TMP==-1
IRP L1,<%TMP==%TMP+1
IFE O1-%TMP, <%TMP==-1
IRP L2,<%TMP==%TMP+1
IFE O2-%TMP, <

;+.PARA -8
;XXXTTL	MACRO TO GENERATE A TITLE STATEMENT OF THE FORM:
;.BREAK
;-TITLE PRGNAM COMMENT VERSION
	DEFINE ABV'TTL,<IFG CUS,<
	TITLE	PRGNAM - COMENT  %'MAJN'L1'L2(EDIT)-CUS
>IFE CUS,<
	TITLE	PRGNAM - COMENT  %'MAJN'L1'L2(EDIT)
>>

;+.PARA -8
;XXX137	MACRO TO SETUP LOCATION 137 WITH THE SPECIFIED
;-VERSION NUMBER. NOTE: THE MACRO DOES ITS OWN "LOC" AND "RELOC".
	DEFINE ABV'137,<IFG CUS,<
	IF2,<LALL>
	LOC	137
	BYTE (3)ABV'WHO(9)ABV'VER(6)ABV'MIN(18)ABV'EDT	; PRGNAM %'MAJN'L1'L2(EDIT)-CUS
	RELOC
	SALL
>	IFE CUS,<
	IF2,<LALL>
	LOC	137
	BYTE (3)ABV'WHO(9)ABV'VER(6)ABV'MIN(18)ABV'EDT	; PRGNAM %'MAJN'L1'L2(EDIT)
	RELOC
	SALL
>>

; MACRO TO DEFINE VERSION # AT CURRENT LOCATION
;+.PARA -8
;XXXVRS	MACRO TO DEFINE THE VERSION NUMBER AT AN
;-ARBITRARY USER LOCATION.
	DEFINE ABV'VRS,<IFG CUS,<
	IF2,<LALL>
	BYTE (3)ABV'WHO(9)ABV'VER(6)ABV'MIN(18)ABV'EDT	; PRGNAM %'MAJN'L1'L2(EDIT)-CUS
	SALL
>	IFE CUS,<
	IF2,<LALL>
	BYTE (3)ABV'WHO(9)ABV'VER(6)ABV'MIN(18)ABV'EDT	; PRGNAM %'MAJN'L1'L2(EDIT)
	SALL
>>
; GENERATE A PASS2 PRINTX STATEMENT
;+.PARA -8
;-XXXPTX	GENERATES A PASS2 PRINTX STATEMENT.
	DEFINE ABV'PTX,<
	IF2,<
	IFG CUS,<PRINTX PRGNAM %'MAJN'L1'L2(EDIT)-CUS	COMENT
>	IFE CUS,<PRINTX PRGNAM %'MAJN'L1'L2(EDIT)	COMENT
>>>

;+.PARA -8
;XXXSTL	THE XXXSTL MACRO GENERATES A NEW PAGE
;VIA THE MACRO PAGE PSEUDO-OP AND OPTIONALLY
;DEFINES A NEW SUBTTL COMMAND. THE CALL IS "XXXSTL (COMMENT)".
;IF THE XXXSTL MACRO IS CALLED WITH A NULL ARGUMENT A COMMENT
; LINE IS GENERATED AT THE BOTTOM OF THE CURRENT PAGE
; AND AT THE TOP OF THE NEXT PAGE INDICATING THAT THE PAGE
;-HAS BEEN CONTINUED.
	DEFINE ABV'STL (TEXT),<IFNB <TEXT>,<
	SUBTTL	TEXT
	PAGE
>	IFB <TEXT>,<
	LALL
	PAGE		; CONTINUED TO NEXT PAGE
	SALL		; CONTINUED FROM PREVIOUS PAGE
>>
;+.PARA -8
;XXXUNV	MACRO TO GENERATE A UNIVERSAL STATEMENT. THE MACRO IN
;EFFECT IS AN EXACT COPY OF THE XXXTTL MACRO EXCEPT THAT THE
;-WORD "UNIVERSAL" REPLACES THE WORD "TITLE".
	DEFINE ABV'UNV,<IFG CUS,<
	LALL
	UNIVERSAL PRGNAM - COMENT  %'MAJN'L1'L2(EDIT)-CUS
	SALL
>IFE CUS,<
	LALL
	UNIVERSAL PRGNAM - COMENT  %'MAJN'L1'L2(EDIT)
	SALL
>>
;+.PARA -8
;XXXERR	MACRO TO TYPE A FATAL ERROR MESSAGE ON THE
;USER'S TERMINAL. THE CALL IS OF THE FORM:
;.BREAK
;XXXERR (ZZZ,ERROR MESSAGE,<PDP-10 INSTRUCTION>)
;.BREAK
;ZZZ IS THE 3-CHARACTER ERROR CODE, ERROR MESSAGE IS THE ASCIZ
;STRING TO BE TYPED ON THE TERMINAL AND PDP-10 INSTRUCTION IS
;AN OPTIONAL ARGUMENT INDICATING WHAT THE USER WANTS TO DO
;ABOUT THE ERROR JUST TYPED. IF THE ARGUMENT IS NULL AN
;-EXIT IS EXECUTED.
	DEFINE ABV'ERR (COD,MSG,INSTR),<
...'COD:	JRST	[
	OUTSTR	[ASCIZ \
? ABV''COD MSG\]
	IFNB <INSTR>,<INSTR>
	IFB <INSTR>,<EXIT>
]>

;+.PARA -8
;XXXWRN	MACRO SIMILAR TO THE XXXERR MACRO EXCEPT THAT A
;WARNING MESSAGE IS ISSUED RATHER THAN A FATAL AND
;-THE DEFAULT PDP-10 INSTRUCTION TO BE EXECUTED IS "JRST .+1".
	DEFINE ABV'WRN (COD,MSG,INSTR),<
...'COD:	JRST	[
	OUTSTR	[ASCIZ \
% ABV''COD MSG\]
	IFNB <INSTR>,<INSTR>
	IFB <INSTR>,<JRST .+1>
]>

;; DEFINE NEW MACROS HERE
STOPI>>STOPI>>;;
	PURGE %TMP,%A,%B
>
SUBTTL	MODSHW MACRO

;+
;.SKIP 2
;.LEFT MARG 0
;.CENTER
;MODSHW MACRO
;.PARA 0
;THE MODSHW MACRO IS DESIGNED TO "SHOW" VERSION VALUES OF RELATED
;MODULES. THE FORM IS "MODSHW (ABV)" WHERE ABV IS THE 3-CHARACTER
;PROGRAM ABBREVIATION. THE SYMBOL "%%ABV" IS DEFINED WITH THAT VALUE.
;-

	DEFINE MODSHW (ABV),<
	LALL
	%%'ABV==BYTE (3)ABV'WHO(9)ABV'VER(6)ABV'MIN(18)ABV'EDT
	SALL
>
SUBTTL	IDENTITY

	TITLE.	(MAC,MACTEN,DECSYSTEM-10 COMMON PARAMETER FILE)

	IFNDEF	%..C,<MACUNV>
	MACPTX
SUBTTL	INTERESTING SYMBOLS

;VERSION FORMAT COMPONENTS

VR.WHO==7B2	;WHO EDITTED (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
	SUBTTL	MACRO DEFINITIONS -- DEFINING SYMBOLS

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

DEFINE	ND(SYM,VAL)
<IF2,<IFDEF SYM,<SYM==SYM>> IFNDEF SYM,<SYM==<VAL>>>



;MACRO TO DEFINE A SYMBOL IF NOT ALREADY DEFINED AND SHOW ITS VALUE
;THIS MACRO IS SUPERCEDED BY THE ND MACRO (EDIT 27) AND IS OBSOLETE

DEFINE	NDS.(SYM,VAL)
<ND (SYM,<VAL>)
PRINTX %PLEASE USE ND MACRO, NDS. MACRO IS NOW OBSOLETE
>



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

DEFINE	SHOW.(ARG$),<	.XCREF
	EXP	<ARG$>
	.ORG	.-1
			.CREF>
;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(SYM,VAL,PRINT)
<IFB <PRINT>,<SYM==:<VAL>> IFNB <PRINT>,<SYM=:<VAL>>>



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

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



;MACRO TO EXTERN OR INTERN A SYMBOL
;	GLOB	SYMBOL

DEFINE	GLOB(SYMBOL),<
	IRP	SYMBOL,<
	IF2,<
		.IF SYMBOL,OPCODE,<.IFN SYMBOL,LOCAL,<EXTERN SYMBOL>>
		.IF SYMBOL,NEEDED,<EXTERN SYMBOL>
		.IF SYMBOL,OPDEF ,<.IFN SYMBOL,LOCAL,<EXTERN SYMBOL>>
		.IF SYMBOL,LOCAL ,<INTERN 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.	X	TURNS OFF LISTING
;	LSTON.		RESTORES LISTING AND CREF IF TOP LEVEL
;IF LSTIN. IS DEFINED AS .MINFI, THEN ALL LISTINGS ON

DEFINE	LSTOF.(CREF$),<
	IFNDEF	LSTIN.,	LSTIN.==0
IFE LSTIN.,<
	IFB <CREF$>,	.XCREF
			XLIST>
LSTIN.==LSTIN.+1
>

DEFINE	LSTON.,<
IFG LSTIN., LSTIN.==LSTIN.-1
IFLE LSTIN.,<	.CREF
		LIST>
>
	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.
	SUBTTL	MACRO DEFINITIONS -- GENERATE OP CODES ABCX

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

DEFINE	MOVX	(AC,FLAG),<
	.XCREF
	TEST%%=FLAG
.IFN <TEST%%>,ABSOLUTE,<
	.CREF
	MOVE	AC,[FLAG]
	.XCREF
>
.IF <TEST%%>,ABSOLUTE,<
	TEST%%=0
IFE	<<FLAG>_-^D18>,<
	TEST%%=1
	.CREF
	MOVEI	AC,<FLAG>
	.XCREF
>
IFE	TEST%%,<IFE	<<FLAG>_^D18>,<
	TEST%%=1
	.CREF
	MOVSI	AC,(FLAG)
	.XCREF
>>
IFE	TEST%%,<IFE	<<<FLAG>_-^D18>-^O777777>,<
	TEST%%=1
	.CREF
	HRROI	AC,<FLAG>
	.XCREF
>>
IFE	TEST%%,<IFE	<<<FLAG>_^D18>-^O777777B17>,<
	TEST%%=1
	.CREF
	HRLOI	AC,(<FLAG>-^O777777)
	.XCREF
>>
IFE	TEST%%,<
	.CREF
	MOVE	AC,[FLAG]
	.XCREF
>
>	;[35][32] END OF .IF <FLAG>,ABSOLUTE
	PURGE	TEST%%
	.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

DEFINE	CAX	(AC,VAL),<OP%%CA (AC,VAL,)>
DEFINE	CAXL	(AC,VAL),<OP%%CA (AC,VAL,L)>
DEFINE	CAXLE	(AC,VAL),<OP%%CA (AC,VAL,LE)>
DEFINE	CAXE	(AC,VAL),<OP%%CA (AC,VAL,E)>
DEFINE	CAXG	(AC,VAL),<OP%%CA (AC,VAL,G)>
DEFINE	CAXGE	(AC,VAL),<OP%%CA (AC,VAL,GE)>
DEFINE	CAXN	(AC,VAL),<OP%%CA (AC,VAL,N)>
DEFINE	CAXA	(AC,VAL),<OP%%CA (AC,VAL,A)>

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

DEFINE	ADDX	(AC,VAL),<OP%%IA	(AC,VAL,ADD,SUB)>
DEFINE	SUBX	(AC,VAL),<OP%%IA	(AC,VAL,SUB,ADD)>
DEFINE	MULX	(AC,VAL),<OP%%IN	(AC,VAL,MUL)>
DEFINE	IMULX	(AC,VAL),<OP%%IN	(AC,VAL,IMUL)>
DEFINE	DIVX	(AC,VAL),<OP%%IN	(AC,VAL,DIV)>
DEFINE	IDIVX	(AC,VAL),<OP%%IN	(AC,VAL,IDIV)>

DEFINE	OP%%IA	(AC,VALUE,CODE,ALT),<
	.XCREF
	TEST%%=0
IFE	<<<VALUE>_-^D18>-^O777777>,<
IFN	<<VALUE>&^O777777>,<
	TEST%%=1
	.CREF
	ALT'I	AC,-<VALUE>
	.XCREF
>>
IFE	TEST%%,<
	OP%%IN	AC,<VALUE>,CODE
>
	PURGE	TEST%%
	.CREF>

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

DEFINE	FADRX	(AC,VAL),<OP%%FP	(AC,VAL,FADR)>
DEFINE	FSBRX	(AC,VAL),<OP%%FP	(AC,VAL,FSBR)>
DEFINE	FMPRX	(AC,VAL),<OP%%FP	(AC,VAL,FMPR)>
DEFINE	FDVRX	(AC,VAL),<OP%%FP	(AC,VAL,FDVR)>

DEFINE	OP%%FP	(AC,VALUE,CODE),<
	.XCREF
IFE	<<VALUE>_^D18>,<
	.CREF
	CODE'I	AC,(VALUE)
	.XCREF
>
IFN	<<VALUE>_^D18>,<
	.CREF
	CODE	AC,[VALUE]
	.XCREF
>
	.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

	.XCREF
DEFINE	TX0%%	(M,S),<
	IRP	M,<
	IRP	S,<
DEFINE	TX'M'S	(AC,FLAG),<
	.XCREF
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
	.CREF
>>>>

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

	PURGE	TX0%%
	.CREF

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

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

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

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

;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>
	.XCREF
	<TDNE	AC,>!<37777777&FLAG>
	.CREF
>

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

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

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

DEFINE	TYC.	(AC,FLAG),<
	MOVX	AC,1B<FLAG_-^D30>
	.XCREF
	<XORM	AC,>!<37777777&FLAG>
	.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
;	NOTE THERE IS NO WAY TO DISTINGUISH BETWEEN KL-10 AND KS-10 CPU'S

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>

%1:>


;DEFINE UNITS OF STORAGE ALLOCATION

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

;USEFUL EXTENDED ADDRESSING DEFINITIONS

	OPDEF	XMOVEI [SETMI]		;EXTENDED MOVE IMMEDIATE
	OPDEF	XHLLI [HLLI]		;NOT YET IN MACRO


;OPDEF THE NOT-KNOWN-TO-DDT HARDWARE MNEMONICS

	OPDEF	PORTAL	[JRST 01,]	;CONCEALED ENTRY POINT JUMP
	OPDEF	JRSTF	[JRST 02,]	;JUMP RESTORING FLAGS
	OPDEF	HALT	[JRST 04,]	;JUMP, HALTING PROCESSOR
	OPDEF	XJRSTF	[JRST 05,]	;FLAG-PC-DOUBLEWORD JRSTF
	OPDEF	XJEN	[JRST 06,]	;FLAG-PC-DOUBLEWORD JEN
	OPDEF	XPCW	[JRST 07,]	;FLAG-PC-DOUBLEWORD XSFM+XJRSTF
	OPDEF	JEN	[JRST 12,]	;JRSTF ENABLING PI
	OPDEF	XSFM	[JRST 14,]	;SAVE FLAG-PC-DOUBLEWORD NO JUMP
	OPDEF	XJRST	[JRST 15,]	;SECTION,,ADDRESS JUMP

	OPDEF	JFOV	[JFCL 01,]	;JUMP ON FLOATING UNDER/OVERFLOW
	OPDEF	JCRY1	[JFCL 02,]	;JUMP ON CARRY-1
	OPDEF	JCRY0	[JFCL 04,]	;JUMP ON CARRY-0
	OPDEF	JCRY	[JFCL 06,]	;JUMP ON CARRY-0 OR CARRY-1
	OPDEF	JOV	[JFCL 10,]	;JUMP ON OVERFLOW



;THE P-CLASS (JUMP TO A POPJ ROUTINE) INSTRUCTIONS

;	OPDEF	PJRST	[JRST]		;PUSHJ/POPJ
	OPDEF	PJRST	[JUMPA 17,]	;PUSHJ/POPJ
					;THIS CUTE TRICK WILL ALLOW DDT
					;TO DISTINGUISH BETWEEN JRST AND
					;PJRST INSTRUCTIONS . . .
	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]

	.NODDT	PJRSTF, PJSP
	.NODDT	PJUMPL, PJMPLE, PJUMPE
	.NODDT	PJUMPN, PJUMPG, PJMPGE
	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	MACRO TO DEFINE BREAK CHARACTER MASK
;MACRO TO ADD BREAK CHARACTER TO FOUR WORD BREAK MASK (W0., W1., W2., W3.)
DEFINE BRKCH. (%%V,V2)
<
%%FOO==%%V
	BRK0 (%%FOO,V2,0)
>
;MACRO TO REMOVE CHARACTER
DEFINE UNBRK. (%%V,V2)
<
%%FOO==%%V
	BRK0 (%%FOO,V2,1)
>
DEFINE BRK0 (%%11,V2,FLAVOR)
<	..V22==%%11
	..V1==%%11
	IFNB <V2>,<..V22==V2>
REPEAT ..V22-<%%11>+1,<	;;BRACKETS AROUND %%11 IN CASE ITS AN EXPRESSION
	%%W==..V1/^D32	;;DECIDE WHICH WORD CHARACTER GOES IN
	%%X==..V1-%%W*^D32	;;CALCULATE BIT POSITION WITHIN WORD
	IFE FLAVOR,BRKC1 \"<%%W+"0">	;;MODIFY CORRECT MASK WORD
	IFN FLAVOR,BRKC2 \"<%%W+"0">
	..V1==..V1+1
		   >
>
DEFINE BRKC1 (ARG1)
<	W'ARG1'.==W'ARG1'.!<1B<%%X>>
>
DEFINE BRKC2 (ARG1)
<	W'ARG1'.==W'ARG1'.&<-1-1B<%%X>>
>
;MACRO TO INITIALIZE 4-WORD 12-BIT CHARACTER BREAK MASK
DEFINE BRINI.(A0<0>,A1<0>,A2<0>,A3<0>)
<
W0.==A0
W1.==A1				;INITIALIZE BREAK MASK
W2.==A2
W3.==A3
>
;MACRO TO DEFINE A BREAK SET
DEFINE BRMSK. (INI0,INI1,INI2,INI3,ALLOW,DISALW)
<	BRINI. INI0,INI1,INI2,INI3	;;SET UP INITIAL MASK
	IRPC ALLOW,<	UNBRK. "ALLOW">	;;DON'T BREAK ON CHARS TO BE ALLOWED IN FIELD
	IRPC DISALW,<	BRKCH. "DISALW">	;;BREAK ON CHARACTERS NOT ALLOWED
	EXP W0.,W1.,W2.,W3.		;;STORE RESULTANT MASK IN MEMORY
>
	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.ARI==1	;[40] ARITHMETIC TRAP NUMBER
	PC.PDL==2	;[40] PUSHDOWN LIST OVERFLOW NUMBER
	PC.TT3==3	;[40] RESERVED FOR DEC
PC.FUF==1B11	;FLOATING UNDERFLOW
PC.NDV==1B12	;NO DIVIDE
	SUBTTL

	.XCREF

%%MACT==<VRSN. (MAC)>
	PURGE	MACWHO,MACVER,MACMIN,MACEDT
	PURGE	MACSIX,MAC137,MACSTL,MACASC,MACUNV  ;[26]
	PURGE	MACWRN,MACTTL,MACPTX,MACERR	;[26]


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

	.CREF