	FILE	MULTOS-8 MULTI-USER OS/8 SYSTEM
	TITLE	VERSION, REVISION, AND EDIT NUMBER
*
*	Copyright (C) 1978, 1979 by Computer Methods
*					7822 Oakledge Road
*					Salt Lake City, UT 84121
*					Phone 801-942-2300
*
*	Unauthorized reproduction in whole or in part
*	by any means whatsoever without written authorization
*	from Computer Methods is strictly prohibited by law.
*
*
VERSION	SET	'1		29 MAY 1977
REVISION SET	'A		29 MAY 1977
*EDIT	EQU	797		14 JUL 1978
*SPLIT THE SOURCE FILE INTO SEVERAL SMALLER FILES.
*OSA CONTAINS MACRO AND OTHER DEFINITIONS
*
EDIT1	EQU	135		19 Aug 79
*
*	EDIT HISTORY
*
*EDIT	DATE		REASON
*113	28 SEP 78	ADDED PERTEC DISK SUPPORT
*114	28 SEP 78	DITTO
*115	 2 OCT 78	ADDED CAPABILITY TO USE NON-CONTIGUOUS MEMORY
*116	 4 OCT 78	ADDED DATA PRINTER V132 SUPPORT
*118	 5 OCT 78	ADDED .SWAPJ MACRO
*119	23 OCT 78	MAINTENANCE -- CHANGE '.DISK6' TO '.DISK'
*120	23 OCT 78	ADDED DEFINITION FOR 'RTS8'
*122	25 OCT 78	MAINTENANCE
*123	 1 NOV 78	MAINTENANCE
*125	23 Nov 78	Maintenance
*126	24 Nov 78	Maintenance
*130	25 Nov 78	Maintenance
*133	 4 Jan 79	Added '.END' Macro
*135	19 Aug 79	Added support for 6 terminals.
*
*	DEFINITIONS BASED ON DEFINITIONS IN PARAMETER FILE
*
PDP8I	EQU	PDP8E-1
*
NO:DECTAPE EQU	DECTAPE-1
*
NO:TC08	EQU	TC08-1
*
NO:TD8E	EQU	TD8E-1
*
NO:MAGTAPE EQU	MAGTAPE-1
*
NO:KL8A	EQU	KL8A-1
*
NO:PTR	EQU	PTR-1
*
NO:PTP	EQU	PTP-1
*
NO:FLOPPY EQU	FLOPPY-1
*
NO:EAE	EQU	EAE-1
*
NO:RKO5	EQU	RKO5-1
*
NO:SPOOL EQU	SPOOL-1
*
*	SYSTEM DISK SUPPORT
*
	AIF	SYS:DISK.NE.RK8E,.DISK2
*
.DISK1	ANOP
	NOTE:	System Disk:	RK8-E
DSK	EQU	074		I/O ADDRESS FOR RK8-E
DLAG	EQU	3		DISK LOAD AND GO
DLCA	EQU	4		LOAD CURRENT ADDRESS
DRST	EQU	5		READ DISK STATUS
DLDC	EQU	6		LOAD DISK COMMAND
	AGO	.DISK
*
.DISK2	AIF	SYS:DISK.NE.RK8L,.DISK3
*
	NOTE:	System Disk:	RK8-L
	AGO	.DISK
*
.DISK3	AIF	SYS:DISK.NE.RL01,.DISK5
*
	NOTE:	System Disk:	RL01
	AGO	.DISK
*
.DISK5	AIF	SYS:DISK.NE.PERTEC,.DISK
*
	NOTE:	System Disk:	Pertec
*
*	PERTEC DISK SUPPORT
*
DLHS	EQU	06153		LOAD HEAD AND SECTOR ADDRESS
DLCY	EQU	06154		LOAD CYLINDER ADDRESS
DSAE	EQU	06164		SKIP ON ATTENTION OR ERROR FLAG
DLDC	EQU	06173		LOAD COMMAND REGISTER
DRST	EQU	06174		READ DISK STATUS
*
DSKWC	QUT	0,07750		3 CYCLE DATA BREAK WORD COUNT
DSKCA	QUT	0,07751		AND CURRENT ADDRESS
*
	AGO	.DISK
*
.SYS:DISK:1 ANOP
*
	ERROR:	SYSTEM DISK:	UNKNOWN
	MONR			ABORT THE ASSEMBLY
*
.DISK	ANOP
*
	AIF	NO:RKO5,.DISK
*
	NOTE:	Additional Disk Drives (3 max)
*
.DISK	ANOP
*
*	TERMINAL SUPPORT
*
	AIF	KL8A,.KL8A:DEF
*
*	TTY I/O ADDRESSES
*
KEY1	EQU	03		TTY # 1
TTY1	EQU	KEY1+1
*
	AIF	TERM2,.TERM2
*
	NOTE:	TTY # 2 TERM2 not specified
	MONR			ABORT ASSEMBLY AND RETURN TO OS/8
*
.TERM2	ANOP
*
KEY2	EQU	TERM2		TTY # 2
TTY2	EQU	TERM2+1
*
	AIF	TERMS.GT.2,.TERMS3
*
	NOTE:	Terminals:	2
	AGO	.TERMS
*
.TERMS3	ANOP
*
	AIF	TERM3,.TERM3
*
	NOTE:	TTY # 3 TERM3 not specified
	MONR			ABORT ASSEMBLY AND RETURN TO OS/8
*
.TERM3	ANOP
*
KEY3	EQU	TERM3		TTY # 3
TTY3	EQU	KEY3+1
*
	AIF	TERMS.GT.3,.TERMS4
*
	NOTE:	Terminals:	3
	AGO	.TERMS
*
.TERMS4	ANOP
*
	AIF	TERM4,.TERM4
*
	NOTE:	TTY # 4 TERM4 not specified.
	MONR			Abort assembly and return to OS/8.
*
.TERM4	ANOP
*
KEY4	EQU	TERM4		TTY # 4
TTY4	EQU	KEY4+1
*
	AIF	TERMS.GT.4,.TERMS5
*
	NOTE:	Terminals:	4
	AGO	.TERMS
*
.TERMS5	ANOP
*
	AIF	TERM5,.TERM5
*
	NOTE:	TTY # 5 TERM5 not specified.
	MONR			Abort assembly and return to OS/8.
*
.TERM5	ANOP
*
KEY5	EQU	TERM5		TTY # 5
TTY5	EQU	KEY5+1
*
	AIF	TERMS.GT.5,.TERMS6
*
	NOTE:	Terminals:	5
	AGO	.TERMS
*
.TERMS6	ANOP
*
	AIF	TERM6,.TERM6
*
	NOTE:	TTY # 6 TERM6 not specified.
	MONR			Abort assembly and return to OS/8.
*
.TERM6	ANOP
*
KEY6	EQU	TERM6		TTY # 6
TTY6	EQU	KEY6+1
*
.TERMS	AGO	.CLOCKS:DEF
*
.KL8A:DEF ANOP
*
	AIF	(KL8A.GE.040).AN.(KL8A.LE.057),.KL8A:OK
*
	NOTE:	KL8-A device code out of range
	MONR			ABORT ASSEMBLY AND RETURN TO OS/8
*
.KL8A:OK ANOP
*
.CLOCKS:DEF ANOP
*
*	REAL TIME CLOCK SUPPORT
*
	AIF	(DK8EA.OR.DK8EC.OR.DK8EP.OR.DKC8AA),.CLOCK:DEF
	NOTE:	Type of clock not specified
	MONR			ABORT ASSEMBLY AND RETURN TO OS/8
*
.CLOCK:DEF ANOP
	AIF	DK8EA.EQ.0,.NO:HERTZ
	AIF	HERTZ,.HERTZ
	NOTE:	No line frequency specified
	MONR			ABORT ASSEMBLY AND RETURN TO OS/8
*
.HERTZ ANOP
TICKS	EQU	HERTZ*2		DEFINE TICKS/SECOND
.NO:HERTZ ANOP
DK8	EQU	013		I/O ADDRESS FOR ANY CLOCK
	AIF	DK8EP.OR.DKC8AA,.PROG:8A:CLOCK
CLEI	EQU	1		ENABLE CLOCK INTERRUPTS
CLDI	EQU	2		DISABLE CLOCK INTERRUPTS
CLSK	EQU	3		SKIP ON CLOCK FLAG, CLEAR FLAG
	AIF	DK8EC,.CRYSTAL:CLOCK
	AIF	HERTZ.EQ.50,.FIFTY:HZ
MIDNHO	EQU	04743		CLOCK TICKS PER DAY
MIDNLO	EQU	02000
MMIDNHO	EQU	03034		MINUS CLOCK TICKS PER DAY
MMIDNLO	EQU	06000
	NOTE:	Clock:		DK8-EA 60 Hz
	AGO	.CLOCK
*
.FIFTY:HZ ANOP
MIDNHO	EQU	04075		CLOCK TICKS PER DAY
MIDNLO	EQU	03000
MMIDNHO	EQU	03702		MINUS CLOCK TICKS PER DAY
MMIDNLO	EQU	05000
	NOTE:	Clock:		DK8-EA 50 Hz
	AGO	.CLOCK
*
.CRYSTAL:CLOCK ANOP
TICKS	EQU	50		TICKS PER SECOND
MIDNHO	EQU	02036		CLOCK TICKS PER DAY
MIDNLO	EQU	05400
MMIDNHO	EQU	05741		MINUS CLOCK TICKS PER DAY
MMIDNLO	EQU	02400
	NOTE:	Clock:		DK8-EC 50 Hz
	AGO	.CLOCK
*
.PROG:8A:CLOCK ANOP
*
TICKS	EQU	100
*
MIDNHO	EQU	04075		CLOCK TICKS PER DAY
MIDNLO	EQU	03000
MMIDNHO	EQU	03702		MINUS CLOCK TICKS PER DAY
MMIDNLO	EQU	05000
*
	AIF	DKC8AA,.PDP8A:CLOCK
*
ENABLE	EQU	05510		ENABLE OVERFLOW, MODE 1, 100 KHZ, & INTERRUPT
*
	NOTE:	Clock:		DK8-EP 100 Hz
*
CLZE	EQU	0		CLEAR CLOCK ENABLE REGISTER PER AC
CLSK	EQU	1		SKIP ON CLOCK INTERRUPT
CLOE	EQU	2		SET CLOCK ENABLE REGISTER PER AC
CLAB	EQU	3		AC TO CLOCK BUFFER
CLEN	EQU	4		LOAD CLOCK ENABLE REGISTER
CLSA	EQU	5		CLOCK STATUS TO AC
CLBA	EQU	6		CLOCK BUFFER TO AC
CLCA	EQU	7		CLOCK COUNTER TO AC
*
	AGO	.CLOCK
*
.PDP8A:CLOCK ANOP
*
	NOTE:	Clock:		DKC8-AA
*
CLLE	EQU	5		LOAD INTERRUPT ENABLE FROM AC11
CLCL	EQU	6		CLEAR CLOCK FLAG
CLSK	EQU	7		SKIP ON CLOCK FLAG
*
.CLOCK	ANOP
*
TENTH	EQU	TICKS/10	NUMBER OF TICKS PER TENTH SECOND
*
*	DECTAPE SUPPORT
*
	AIF	NO:DECTAPE,.DECTAPE
*
	AIF	NO:TC08,.TC08
*
	NOTE:	TC08 DECtape:	8 transports
*
*	TC08 DECTAPE IOT DEFINITIONS
*
DTRA	EQU	06761		READ STATUS REGISTER A
DTCA	EQU	06762		CLEAR STATUS REGISTER A
DTXA	EQU	06764		LOAD STATUS REGISTER A
DTLA	EQU	DTCA.OR.DTXA	CLEAR AND LOAD STATUS REGISTER A
DTSF	EQU	06771		SKIP ON DECTAPE FLAG
DTRB	EQU	06772		READ STATUS REGISTER B
DTXB	EQU	06774		LOAD STATUS REGISTER B
*
.TC08	AIF	NO:TD8E,.DECTAPE
*
*	TD8E DECTAPE SUPPORT
*
	NOTE:	TD8E DECtape:	8 transports
*
*	TD8E DECTAPE IOT DEFINITIONS
*
SDSS	EQU	06771		SKIP ON SINGLE LINE FLAG
SDST	EQU	06772		SKIP ON TIME ERROR FLAG
SDSQ	EQU	06773		SKIP ON QUAD LINE FLAG
SDLC	EQU	06774		LOAD COMMAND REGISTER FROM AC, CLEAR AC
SDLD	EQU	06775		LOAD DATA REGISTER FROM AC, DO NOT CLEAR AC
SDRC	EQU	06776		LOAD AC FROM COMMAND REGISTER
SDRD	EQU	06777		LOAD AC FROM DATA REGISTER
*
.DECTAPE ANOP
*
*	MAGTAPE SUPPORT
*
	AIF	NO:MAGTAPE,.MAGTAPE
*
	NOTE:	TM8E MAGtape:	8 transports
*
*	TM8E MAGTAPE IOT DEFINITIONS
*
LWCR	EQU	06701		LOAD WORD COUNT REGISTER
CWCR	EQU	06702		CLEAR WORD COUNT REGISTER
LCAR	EQU	06703		LOAD CURRENT ADDRESS REGISTER
CCAR	EQU	06704		CLEAR CURRENT ADDRESS REGISTER
LCMR	EQU	06705		LOAD COMMAND REGISTER
LFGR	EQU	06706		LOAD FUNCTION/GO REGISTER
RWCR	EQU	06711		READ WORD COUNT REGISTER
CLT	EQU	06712		CLEAR TRANSPORT'S MASTER REGISTERS
RCAR	EQU	06713		READ CURRENT ADDRESS REGISTER
RMSR	EQU	06714		READ MAIN STATUS REGISTER
RCMR	EQU	06715		READ COMMAND REGISTER
RFSR	EQU	06716		READ FUNCTION AND 2ND STATUS REGISTER
SKEF	EQU	06721		SKIP IF ERROR FLAG IS SET
SKCB	EQU	06722		SKIP IF CONTROL NOT BUSY
SKJD	EQU	06723		SKIP IF JOB DONE FLAG IS SET
SKTR	EQU	06724		SKIP IF TAPE UNIT IS READY
CLF	EQU	06725		CLEAR CONTROLLER AND TRANSPORT MASTER
*
.MAGTAPE ANOP
*
*	FLOPPY DISK SUPPORT
*
	AIF	NO:FLOPPY,.FLOPPY
*
	NOTE:	RX8-E Dual Drive Floppy Disk
*
RX8	EQU	075		I/O ADDRESS
LCD	EQU	1		LOAD COMMAND REGISTER, CLEAR AC
XDR	EQU	2		TRANSFER DATA REGISTER
STR	EQU	3		SKIP ON TRANSFER REQ FLAG, CLEAR FLAG
SER	EQU	4		SKIP ON ERROR FLAG, CLEAR FLAG
SDN	EQU	5		SKIP ON DONE FLAG, CLEAR FLAG
INTR	EQU	6		ENABLE/DISABLE INTERRUPTS
INIT	EQU	7		INITIALIZE CONTROLLER AND INTERFACE
*
.FLOPPY	ANOP
*
	AIF	NO:PTR,.PTR
*
*	PAPER TAPE SUPPORT
*
	NOTE:	PR8-E Paper Tape Reader
*
PR8	EQU	01		READER I/O ADDRESS
RRB	EQU	2		READ READER BUFFER
RFC	EQU	4		FETCH NEXT CHARACTER
RRC	EQU	6		RRB RFC COMBINATION
*
.PTR	ANOP
*
	AIF	NO:PTP,.PTP
*
	NOTE:	PP8-E Paper Tape Punch
*
PP8	EQU	02		PUNCH I/O ADDRESS
*
.PTP	ANOP
*
*	EAE SUPPORT
*
	AIF	NO:EAE,.EAE
*
	NOTE:	KE8-E Extended Arithmetic Element
*
SCL	EQU	07403		SC LOAD FROM MEMORY
SWAB	EQU	07431		SWITCH FROM MODE 'A' TO MODE 'B'
SCA	EQU	07441		AC = SC.OR.AC
SWBA	EQU	07447		SWITCH FROM MODE 'B' TO MODE 'A'
DPSZ	EQU	07451		IF (AC,MQ)=0 AND MODE 'B', SKIP NEXT INST;
*				IF MODE A, 'SCA NMI'
*
.EAE	ANOP
*
	AIF	NO:SPOOL,.SPOOL
*
	NOTE:	Print Spooler
*
.SPOOL	ANOP
	TITLE	MACRO DEFINITIONS
*
*	PICK UP A JOB PARAMETER
*
	MACRO
	.PARAM	<PARAMETER>
	AIF	%*,.F1
!<>	DSI	UPARAM
	DC	<PARAMETER>
	MEXIT
.F1	ANOP
!<>	DSI	PARAM
	DC	<PARAMETER>
	MEND
*
*	FIND AN AVAILABLE MEMORY FIELD
*
	MACRO
	.FINDM
	MSKIP
	AIF	%*,.F1
!<>	JMS	UFINDM
	MEXIT
.F1	ANOP
!<>	JMS	QFINDM
	MEND
*
*	FIND A FIELD FROM INFO IN AC AND MASK IN MQ
*
	MACRO
	.FINDF
	MSKIP
	AIF	%*,.F1
!<>	JMS	UFINDF
	MEXIT
.F1	ANOP
!<>	JMS	QFINDF
	MEND
*
*	FIND A DISK SWAP BLOCK BASED ON INFO IN AC
*
	MACRO
	.FINDB
	MSKIP
!<>	JMS	QFINDB
	MEND
*
*	QUEUE A DISK REQUEST
*
	MACRO
	.EXDISK
	MSKIP
	AIF	%*,.F1
!<>	JMSI	UXDISK
	MEXIT
.F1	ANOP
!<>	JMSI	QXDISK
	MEND
*
*	SWAP A FIELD TO/FROM DISK SWAP BLOCKS
*
	MACRO
	.SWAPF
	MSKIP
	AIF	%*,.F1
!<>	JMS	USWAPF
	MEXIT
.F1	ANOP
!<>	JMS	QSWAPF
	MEND
*
*	SWAP OUT ALL JOBS OTHER THAN THE CURRENT JOB
*
	MACRO
	.SWAPJ
	ROOM	4
!<>	JMS	USWAPJ		; SKIP IF NO SWAP OCCURS
	MEND
*
*	CHECK FOR AVAILABLE MEMORY
*
	MACRO
	.AVMEM
	ROOM	4
!<>	JMS	QAVMEM
	MEND
*
*	PERFORM AN EXCLUSIVE 'OR'
*
	MACRO
	.XOR
	MSKIP
	AIF	%*,.F1
!<>	JMS	UXOR
	MEXIT
.FI	ANOP
!<>	JMS	QXOR
	MEND
*
*	SUSPEND A JOB
*
	MACRO
	.SUSPEND
	MSKIP
	AIF	%*.EQ.1,.Q
!<>	JMPI	USUSP
	MEXIT
.Q	ANOP
!<>	JMPI	QSUSP
	MEND
*
*	CLEAR AN I/O BUFFER
*
	MACRO
	.CLEAR
	MSKIP
	AIF	%*,.F1
!<>	JMS	UCLEAR
	MEXIT
.F1	ANOP
!<>	JMS	QCLEAR
	MEND
*
*	CHANGE EXECUTIVE DATA FIELD
*
	MACRO
	.CUIF
	MSKIP
!<>	JMS	UUCUIF
	MEND
*
	MACRO
	.CUDF
	MSKIP
!<>	JMS	UUCUDF
	MEND
*
	MACRO
	.F0
	MSKIP
!<>	JMS	CDF0
	MEND
*
	MACRO
	.CUR
	MSKIP
!<>	JMS	CDFCUR
	MEND
*
*	MACRO TO HANDLE 'MQL' ON ALL PDP-8/I AND LATER MACHINES
*
	UNLINK	MQL
	MACRO
	MQL
	MSKIP
	AIF	PDP8I.AN.NO:EAE,.MQL
	LINK	MQL
!<>	MQL
	UNLINK	MQL
	MEXIT
.MQL	ANOP
!<>	DCA	CPU:MQ		; STORE IN FAKE MQ
	MEND
*
*	MACRO TO HANDLE 'MQA' ON ALL PDP-8/I AND LATER MACHINES
*
	UNLINK	MQA
	MACRO
	MQA
	MSKIP
	AIF	PDP8I.AN.NO:EAE,.MQA
	LINK	MQA
!<>	MQA
	UNLINK	MQA
	MEXIT
.MQA	ANOP
!<>	TAD	CPU:MQ		; JUST ADD IN THE FAKE 'MQ'
	MEND
*
*	MACRO TO HANDLE 'MQOR'
*
	MACRO
	MQOR
	MSKIP
	AIF	PDP8I.AN.NO:EAE,.MQOR
	LINK	MQA
!<>	MQA
	UNLINK	MQA
	MEXIT
.MQOR	AIF	%*,.F1
!<>	JMS	UMQOR		; DO IT IN SOFTWARE
	MEXIT
.F1	ANOP
!<>	JMS	QMQOR		; DO IT IN SOFTWARE
	MEND
*
*	MACRO TO HANDLE 'CAM' FOR PDP-8/I NON-EAE SYSTEMS
*
	UNLINK	CAM
	MACRO
	CAM
	MSKIP
	AIF	PDP8I.AN.NO:EAE,.CAM
	LINK	CAM
!<>	CAM
	UNLINK	CAM
	MEXIT
.CAM	AIF	%*,.F1
!<>	JMS	UCAM		; DO IT IN SOFTWARE
	MEXIT
.F1	ANOP
!<>	JMS	QCAM		; DO IT IN SOFTWARE
	MEND
*
*	MACRO TO HANDLE 'SWP' FOR PDP-8/I NON-EAE SYSTEMS
*
	UNLINK	SWP
	MACRO
	SWP
	MSKIP
	AIF	PDP8I.AN.NO:EAE,.SWP
	LINK	SWP
!<>	SWP
	UNLINK	SWP
	MEXIT
.SWP	AIF	%*,.F1
!<>	JMS	USWP		; DO IT IN SOFTWARE
	MEXIT
.F1	ANOP
!<>	JMS	QSWP		; DO IT IN SOFTWARE
	MEND
*
*	MACROS TO HANDLE 'GTF' AND 'RTF'
*
	UNLINK	GTF
	MACRO			GET THE FLAGS
	GTF
	AIF	PDP8I,.GTFI
	LINK	GTF
!<>	GTF
	UNLINK	GTF
	MSKIP
	MEXIT
.GTFI	ANOP
!<>	CLA RAR			; GET THE LINK INTO BIT 0
	RIB			; GET THE INTERRUPT FLAGS
	MEND
*
	UNLINK	RTF
	MACRO			RESTORE THE FLAGS
	RTF
	AIF	PDP8I,.RTFI
	LINK	RTF
!<>	RTF
	UNLINK	RTF
	MSKIP
	MEXIT
.RTFI	ANOP
	LISTM
!<>	DCA	CPU:TEM		; STORE THE FLAGS TEMPORARILY
	CDF	%*
	TAD	CPU:TEM
	AND	=07		; EXTRACT 'DF'
	CLL RAL
	RTL
	TAD	=KCDF
	DCA	$2F
	TAD	CPU:TEM
	SPA			; IS THE LINK TO BE SET ?
	STL			; YES
	AND	=070		; EXTRACT 'IF'
	TAD	=KCIF
	DCA	$1F
	TAD	CPU:TEM
	AND	=UM		; EXTRACT USER MODE BIT
	SNA CLA			; IS IT SET ?
	JMP	$1F		; NO, DON'T ENABLE USER MODE OR INTERRUPT
	ROOM	6
	DI	SUF		; YES, ENABLE USER MODE AND
	ION			;	ENABLE INTERRUPT SYSTEM
$1H	HLT			; SET 'IF'
$2H	HLT			; SET 'DF'
	NOLISTM
	MEND
*
*	'MULT64' MACRO
*
	UNLINK	BSW
	MACRO			MULTIPLY BY 64
	MULT64
	AIF	PDP8I,.MULT64
	LINK	BSW
!<>	CLL BSW
	UNLINK	BSW
	MEXIT
.MULT64	ANOP
!<>	CLL RTL
	RTL
	RTL
	MEND
*
*	'RAR6' MACRO
*
	MACRO			ROTATE RIGHT 6 BITS
	RAR6
	MSKIP
	AIF	PDP8I,.RAR6
	LINK	BSW
!<>	CLL BSW
	UNLINK	BSW
	MEXIT
.RAR6	ANOP
	AIF	%*,.F1
!<>	JMS	URAR6
	MEXIT
.F1	ANOP
!<>	JMS	QRAR6
	MEND
*
*	MACRO TO HANDLE 'LDI'
*
	UNLINK	LDI
	MACRO
	LDI	<ARG>
	MSKIP
	AIF	(<ARG>.EQ.0100).AN.PDP8I,.LDI
	AIF	<ARG>.EQ.1,.OK
	AIF	<ARG>.EQ.2,.OK
	AIF	<ARG>.EQ.3,.OK
	AIF	<ARG>.EQ.4,.OK
	AIF	<ARG>.EQ.6,.OK
	AIF	<ARG>.EQ.0100,.OK
	AIF	<ARG>.EQ.04000,.OK
	AIF	<ARG>.EQ.02000,.OK
	AIF	<ARG>.EQ.06000,.OK
	AIF	<ARG>.EQ.03777,.OK
	AIF	<ARG>.EQ.05777,.OK
	AIF	<ARG>.EQ.07775,.OK
	AIF	<ARG>.EQ.07776,.OK
	AIF	<ARG>.EQ.07777,.OK
	AGO	.LDI
.OK	LINK	LDI
!<>	LDI	<ARG>
	UNLINK	LDI
	MEXIT
.LDI	ANOP
!<>	TAD	=<ARG>
	MEND
*
*	GENERATE TEXT FOR INITIALIZATION MESSAGES
*
	MACRO
	.OUTEXT	<STRING>
!<>	JMS	OUTEXT
:A	SET	0
.LOOP	ANOP
:B	MSCAN	:A,<STRING>	; PICK UP A TEXT CHARACTER
	AIF	:B.EQ.0215,.END
	DC	:B
:A	SET	:A+1
	AGO	.LOOP
*
.END	ANOP
	DC	CR
	DC	LF
	DC	0
	MEND
*	GENERATE TEXT FORPASS WORD SIGNON
*
	MACRO
	.OTXT	<STRING>
!<>	JMS	OTXT
:A	SET	0
.LOOP	ANOP
:B	MSCAN	:A,<STRING>	; PICK UP A TEXT CHARACTER
	AIF	:B.EQ.0215,.END
	DC	:B
:A	SET	:A+1
	AGO	.LOOP
*
.END	ANOP
	DC	CR
	DC	LF
	DC	0
	MEND
*
*	Indicate highest address used in a field.
*
	MACRO
	.END
	DSEC
:F	SET	%*+'0
:H	SET	*-1
!	NOTE:	HIGHEST ADDR [:F\:H
	MEND
*
*	MACRO TO GENERATE STATUS BITS
*
:STAT	SET	0
	MACRO
	.STAT	<ARG>
!<>	EQU	:STAT
	AIF	:STAT.GE.0100,.STAT:OVFLO
:STAT	SET	:STAT+<ARG>
	MEXIT
.STAT:OVFLO ANOP
	NOTE:	More than 64 status words generated
	MONR			ABORT ASSEMBLY AND RETURN TO OS/8
	MEND
*
*	MACRO TO GENERATE LOGICAL WAIT BITS
*
:LWAIT	SET	04000
	MACRO
	.LWAIT
!<>	EQU	:LWAIT
:LWAIT	SET	:LWAIT.RS.1
	MEND

*	MACRO TO GENERATE DEVICE WAIT BITS
*
:DWAIT	SET	01
	MACRO
	.DWAIT
!<>	EQU	:DWAIT
:DWAIT	SET	:DWAIT.LS.1
	MEND
*
*	MACRO TO GENERATE BUFFER STORAGE ALLOCATIONS IN FIELD 1
*
:BUFF	SET	0200
	MACRO
	.BUFF	<SIZE>
!<>	QUT	1,:BUFF
:BUFF	SET	:BUFF+<SIZE>
	MEND
*
*	MACROS TO GENERATE TWO IOT LIST TABLES
*
:IOT	SET	0
*
	MACRO			GENERATE IOT LIST
	.IOT	<IOT:><IOTADR>
	MSKIP
!<>	DC	-<IOT:>		; NEGATE THE IOT
IOT\:IOT EQU	<IOTADR>	; THIS CONSTANT WILL BE USED IN NEXT MACRO
:IOT	SET	:IOT+1
	MEND
*
	MACRO			GENERATE IOT LIST SERVICE ADDRESS TABLE
	.GEN
:IOT2	SET	0
!<>	DC	IOT\:IOT2
:IOT2	SET	:IOT2+1
.LOOP	DC	IOT\:IOT2
:IOT2	SET	:IOT2+1
	AIF	:IOT-:IOT2,.LOOP
	MEND
	TITLE	SOME OS/8 DEFINITIONS
*
OS8NDES	QUT	0,07600		NON-DESTRUCTIVE STANDALONE OS/8 ENTRY
OS8DEST	QUT	0,07605		DESTRUCTIVE STANDALONE OS/8 ENTRY
OSDATEH	QUT	0,07777		HIGH ORDER OS/8 SYSTEM DATE (BITS 3-4)
OSDATEL QUT	1,07666		LOW ORDER OS/8 SYSTEM DATE
*
USR	QUT	1,07700		USR ENTRY ADDRESS
USRRES	QUT	1,0200		USR ENTRY ADDRESS WHEN RESIDENT
LOOKUP	EQU	2		LOOK UP A PERMANENT FILE
ENTER	EQU	3		OPEN A TENTATIVE OUTPUT FILE
CLOSE	EQU	4		CLOSE A TENTATIVE FILE
USRIN	EQU	8		LOCK USR IN MEMORY
USROUT	EQU	9		RELEASE USR FROM MEMORY
INQUIRE	EQU	10		USR INQUIRE FOR DEVICE HANDLER
*
RTS8	EQU	01000		RTS/8 BACKGROUND EXECUTION BIT
	TITLE	HARDWARE ASSUMED COMMON TO ALL SYSTEMS
*
*	KP8-E POWER FAIL/AUTO-RESTART
*
KP8	EQU	010		I/O ADDRESS
SBE	EQU	1		SKIP IF BATTERY EMPTY (PDP-8/A)
SPL	EQU	2		SKIP ON POWER LOW
CACL	EQU	3		CLEAR AC LOW FLAG (PDP-8/A)
*
*	KM8-E TIME SHARE
*
CINT	EQU	06204		CLEAR USER INTERRUPT
SINT	EQU	06254		SKIP ON USER INTERRUPT
CUF	EQU	06264		CLEAR USER FLAG
SUF	EQU	06274		CLEAR USER FLAG
*
*	LA8-E LINE PRINTER
*
LA8	EQU	066		I/O ADDRESS
SE	EQU	03		SKIP ON LINE PRINTER ERROR FLAG
EIN	EQU	05		ENABLE LINE PRINTER INTERRUPTS
DIN	EQU	07		DISABLE LINE PRINTER INTERRUPTS
*
*	DATA PRINTER V-132 LINE PRINTER
*
LSEP	EQU	06641		SKIP ON END-OF-PAGE FLAG
LSRF	EQU	06642		SKIP ON IF RUN FLAG IS TRUE
LCEP	EQU	06644		CLEAR END-OF-PAGE FLAG
LSCP	EQU	06645		SKIP ON END-OF-PAGE FLAG & CLEAR FLAG
LSPR	EQU	06651		SKIP ON PRINTER FLAG
LRLC	EQU	06652		REQUEST LOAD CYCLE
LCPF	EQU	06653		CLEAR PRINTER FLAG
LIP	EQU	06654		INITIATE PRINTING
LSSD	EQU	06661		SKIP IF SEND DATA IS TRUE
LLPB	EQU	06662		LOAD PRINTER BUFFER
LCLA	EQU	06664		CLEAR AC
LPBC	EQU	06666		LOAD PRINTER BUFFER & CLEAR AC
*
*	GENERAL IOT SUFFIXES
*
TFL	EQU	0		SET TTY FLAG
SF	EQU	1		SKIP ON FLAG
CF	EQU	2		CLEAR FLAG
TSK	EQU	5		SKIP IF KEYBOARD/TTY FLAG IS SET
LS	EQU	6		LOAD SEQUENCE
	LIST
	TITLE	USER STATUS AND WAIT BIT DEFINITIONS
*
*	USER STATUS AREA DEFINITIONS
*
DWAIT	.STAT	1		DEVICE WAIT BITS
LWAIT	.STAT	1		LOGIC WAIT BITS
FLAGS	.STAT	1		HARDWARE FLAGS
PC	.STAT	1		PROGRAM COUNTER
AC	.STAT	1		ACCUMULATOR
MQ	.STAT	1		MULTIPLIER/QUOTIENT
SC	.STAT	1		STEP COUNTER/EAE MODE
SR	.STAT	2		SWITCH REGISTER FLAG AND SWITCH REGISTER
RESTART	.STAT	2		REAL TIME RESTART TIME
IBF	.STAT	1		INPUT BUFFER FILL POINTER
CURJOB	EQU	IBF		USED ONLY BY EXECUTIVE JOBS (SUCH AS SPOOLER)
IBE	.STAT	1		INPUT BUFFER EMPTY POINTER
OUTIOT	.STAT	1		OUTPUT IOT
MF	.STAT	1		OUTPUT MOTION FLAG
OBF	.STAT	1		OUTPUT BUFFER FILL POINTER
OBE	.STAT	1		OUTPUT BUFFER EMPTY POINTER
OBC	.STAT	1		OUTPUT BUFFER CHARACTER COUNTER
JMSPC	.STAT	1		STORE JMS PC FOR NON-RESIDENT 'IF'
JMSAVE	.STAT	14		SPECIAL SAVE REGISTER AREA (6 ITEMS MAX)
MTCM	.STAT	1		MAGTAPE COMMAND
MTWC	.STAT	1		    WORD COUNT
MTCA	.STAT	1		    CURRENT ADDRESS
MTMSR	.STAT	1		    MAIN STATUS
MTFN	.STAT	1		    FUNCTION
DTWC	EQU	MTWC		DECTAPE WORD COUNT
DTCADR	EQU	MTCA		    CURRENT ADDRESS
DTSRA	EQU	MTMSR		    STATUS REGISTER 'A'
DTSRB	EQU	MTFN		    STATUS REGISTER 'B'
USER:ST	EQU	0100		LENGTH OF USER STATUS AREA
*
*	LOGIC WAIT DEFINITIONS
*
HALTW	.LWAIT			HALT WAIT
NRESW	.LWAIT			NON-RESIDENT WAIT
EXECW	.LWAIT			SPECIAL EXECUTIVE WAIT
JMSW	.LWAIT			'JMS' AFTER 'CIF' WAIT
ISUSPW	.LWAIT			INDEFINITE SUSPEND WAIT
REALW	.LWAIT			REAL TIME WAIT
*
*	DEVICE WAIT DEFINITIONS
*
DISKW	.DWAIT			DISK WAIT
TTYW	.DWAIT			TTY OUTPUT WAIT
KEYW	.DWAIT			KEYBOARD INPUT WAIT
PUNW	.DWAIT			PUNCH WAIT
READW	.DWAIT			READER WAIT
FLOPW	.DWAIT			RX8-E FLOPPY WAIT
LPTW	.DWAIT			LINE PRINTER WAIT
DTAW	.DWAIT			DECTAPE WAIT
MTAW	.DWAIT			MAGTAPE WAIT
*
*	INPUT/OUTPUT BUFFER DEFINITIONS
*	(ALL I/O BUFFERS ARE IN FIELD 1)
*
BUFFERS	.BUFF	0		START OF BUFFERS
LPB	.BUFF	128		LINE PRINTER BUFFER (128 CHARACTERS)
	AIF	NO:PTR,.PTR
RB	.BUFF	128		READER BUFFER (128 CHARACTERS)
.PTR	AIF	NO:PTP,.PTP
PB	.BUFF	128		PUNCH BUFFER (128 CHARACTERS)
.PTP	ANOP
JOB1OB	.BUFF	128		JOB 1 OUTPUT BUFFER (128 CHAR'S EACH)
JOB2OB	.BUFF	128		JOB 2 OUTPUT BUFFER
	AIF	TERMS.LT.3,.TERMS
JOB3OB	.BUFF	128		JOB 3 OUTPUT BUFFER
	AIF	TERMS.LT.4,.TERMS
JOB4OB	.BUFF	128		JOB 4 OUTPUT BUFFER
	AIF	TERMS.LT.5,.TERMS
JOB5OB	.BUFF	128		JOB 5 OUTPUT BUFFER
	AIF	TERMS.LT.6,.TERMS
JOB6OB	.BUFF	128		JOB 6 OUTPUT BUFFER
.TERMS	ANOP
DQB	.BUFF	64		DISK QUEUE BUFFER (16 ENTRIES)
	AIF	SPOOL.EQ.0,.SPOOL
SPLQ	.BUFF	32*5		SPOOL QUEUE BUFFER (32 5-WORD ENTRIES)
.SPOOL	ANOP
JOB1IB	.BUFF	32		JOB 1 INPUT BUFFER (32 CHAR'S EACH)
JOB2IB	.BUFF	32		JOB 2 INPUT BUFFER
	AIF	TERMS.LT.3,.TERMS
JOB3IB	.BUFF	32		JOB 3 INPUT BUFFER
	AIF	TERMS.LT.4,.TERMS
JOB4IB	.BUFF	32		JOB 4 INPUT BUFFER
	AIF	TERMS.LT.5,.TERMS
JOB5IB	.BUFF	32		JOB 5 INPUT BUFFER
	AIF	TERMS.LT.6,.TERMS
JOB6IB	.BUFF	32		JOB 6 INPUT BUFFER
.TERMS	AIF	NO:FLOPPY,.FLOPPY
RXQB	.BUFF	16		FLOPPY QUEUE BUFFER (4 ENTRIES)
.FLOPPY	AIF	NO:DECTAPE,.DECTAPE
DTQB	.BUFF	16		DECTAPE QUEUE BUFFER (4 ENTRIES)
.DECTAPE AIF	NO:MAGTAPE,.MAGTAPE
MTQB	.BUFF	4		MAGTAPE QUEUE BUFFER (4 ENTRIES)
.MAGTAPE ANOP
*
BUFFEND	.BUFF	0		FIRST FREE LOCATION AFTER BUFFERS
	TITLE	ASCII CHARACTERS AND MISCELLANEOUS DEFINITIONS
*
*	ASCII CHARACTER DEFINITIONS
*
BELL	EQU	07		BELL CHARACTER
LOGON	EQU	010		LOG-ON CHARACTER
TAB	EQU	011		TAB
LF	EQU	012		LINE FEED
FF	EQU	014		FORM FEED
CR	EQU	015		CARRIAGE RETURN
ESC	EQU	033		ESCAPE
SPACE	EQU	040		SPACE
DOLLAR	EQU	044		DOLLAR SIGN
DEL	EQU	0177		DELETE
CTRLA	EQU	'A.AN.077	CONTROL/A
CTRLC	EQU	'C.AN.077	CONTROL/C
CTRLH	EQU	'H.AN.077	CONTROL/H
CTRLO	EQU	'O.AN.077	CONTROL/O
CTRLP	EQU	'P.AN.077	CONTROL/P
CTRLQ	EQU	'Q.AN.077	CONTROL/Q
CTRLS	EQU	'S.AN.077	CONTROL/S
CTRLZ	EQU	'Z.AN.077	CONTROL/Z
*
*	TIME QUANTUM DEFINITION
*
QUANTUM	EQU	2*TENTH		1/5 SECOND
*
*	TIMESHARING IOT DEFINITIONS
*
FSD	EQU	06110		FILE STRUCTURED DEVICE HANDLER IOT
TSS	EQU	06111		SKIP IF TIMESHARING
SSR	EQU	06112		SET SWITCH REGISTER
RCR	EQU	06113		RETURN CLOCK RATE (IN TICKS PER SECOND)
TOD	EQU	06114		RETURN TIME-OF-DAY
DATE	EQU	06115		RETURN SYSTEM DATE
TASK	EQU	06116		RETURN TASK NUMBER
IHLT	EQU	06117		HALT WITHOUT SENDING A MESSAGE
SYN	EQU	06120		SUSPEND UNTIL NEXT TIME QUANTUM
STM	EQU	06121		SUSPEND UNTIL SPECIFIED TIME
RAN	EQU	06122		RETURN A RANDOM NUMBER
ALONE	EQU	06123		RETURN TO STANDALONE OS/8
TALK	EQU	06124		TRANSMIT A CHARACTER TO ANOTHER TERMINAL
SPR	EQU	06125		RETURN SYSTEM PARAMETERS
*
*	MISCELLANEOUS DEFINITIONS
*
KCDF	EQU	06201		CONSTANT 'CDF 0'
KCIF	EQU	06202		CONSTANT 'CIF 0'
KCID	EQU	06203		CONSTANT 'CID 0'
KNOP	EQU	07000		CONSTANT 'NOP'
KHLT	EQU	07402		CONSTANT 'HLT'
KSKP	EQU	07410		CONSTANT 'SKP'
*
RK:BIAS	EQU	06260		FOR SECOND HALF OF RK05 DRIVES 1, 2, & 3
*
KBM:DA	EQU	07		KEYBOARD MONITOR DISK ADDRESS
USR:DA	EQU	013		USER SERVICE ROUTINE DISK ADDRESS
CD:DA	EQU	051		COMMAND DECODER DISK ADDRESS
*
RELBIT	EQU	0200		IF SET IN USER STATUS AREA FLSV WORD,
*				THEN FIELD BITS ARE RELATIVE
UM	EQU	0100		USER MODE BIT USED IN FLAGS WORD
*
*	FLAGS USED IN FIELD INFORMATION WORDS
*
IF	EQU	04000		'IF' RESIDENCY BIT
DF	EQU	02000		'DF' RESIDENCY BIT
*
LOCK	EQU	01000		LOCK THIS FIELD IN MEMORY
*
N:EXIST	EQU	0400		NON-EXISTANT MEMORY FLAG
	LIST
*
*	SOME DISK PARAMETERS
*
*	SWAP	=	THE BEGINNING OF THE SWAP TRACKS
*			(EACH TERMINAL HAS 128 SWAP SECTORS;
*			EACH EXECUTIVE JOB HAS 16 SWAP SECTORS)
*
*THE DISK LAYOUT IS AS FOLLOWS (FOR ALL CONFIGURATIONS):
*	JOB 1			LOW DISK ADDRESSES
*	SWAP TRACKS
*	JOB 2
*	JOB 3 (IF PRESENT)
*	...ETC...
*				HIGH DISK ADDRESSES
*
*THE FOLLOWING ARE THE DISK ALLOCATIONS FOR MULTIPLE JOBS:
*		 SWAP	SECTORS/USER	      DISK STARTING ADDRESSES
* TERMS+EXJOBS	SECTORS	& SWAP START	USER1 USER2 USER3 USER4 USER5 USER6
*	2+0	  0400	   06060	00000 06460   -     -     -     -
*	3+1	  0620	   03760	00000 04600 10560   -     -     -
*	4+1	 01020	   02720	00000 03740 06660 11600   -     -
*	4+2	 01040	   02720	00000 03760 06700 11620   -     -
*
*THE FOLLOWING EXPRESSION COMPUTES THE STARTING ADDRESS OF
*THE SWAPPING SECTORS FOR JOB 1 AND IS ALSO THE NUMBER OF
*SECTORS ALLOCATED TO EACH JOB'S SYSTEM DEVICE.
*
SWAP	EQU	((((06260.RS.1)-(JOBS*(128/4)))/TERMS).AN.07774)*4
PIP	EQU	-SWAP		FOR USE IN PIP TABLE LOC 13641
*
*	Macro definition to print a note statement in the listing file
*
	MACRO
	.PIP
:SWAP	EQU	SWAP
:PIP	EQU	PIP
!	NOTE:	SYS DEVICE SIZE = \:SWAP
	NOTE:	SET PIP LOCATIONS 13623, 13656,
	NOTE:	AND 13657 TO \:PIP
	MEND
*
	.PIP			Now print it.

