/F/B/( 9 AM OCT 31 69	/1
/
/DISK TRANSFER VECTOR:
/WHICH IS THE SAME FOR EVERY LEVEL OF DISK ACCESS
/PLACE POINTER TO FLAGN IN APROPRIATE PRIORITY LEVEL
/PRI1,PRI2, OR PRI3
/
/FLAGN,	0	/7777 IF REQUEST UN SERVICED
/		/4000 IF WAITING FOR COMPLETION
/		1 WHEN COMPLETE
/		3 IF COMPLETE AND ERROR
/		0 IF INACTIVE
/	WORDCOUNT
/	CURRENT ADDRESS
/	EXTENDED BITS FOR DISK
/	FUNCTION (DMAR OR DMAW)
/	DISK MEMORY ADDRESS
/
/FLAGN MUST BE TESTED FOR COMPLETION WITH INTERRUPTS ENABLED
/
/FOREGROUND DISC SERVICE SHOULD BE THROUGH A PROGRAM 
/SIMILAR TO XTEST2.	THERE IS NO NEED TO AIT2 OR
/WAIT3, SINCE FOREGROULD PROGRAM HAS PRIORITY ON THE
/DISK CHANNEL, AND WILL BUMP OTHER ACCESSES
/IN PROGRESS, BUT RESTORE THEM WHEN FOREGROUND
/REQUEST IS COMPLETED.	
/FOREGROUND SHOULD USE "PRI1" AS ITS POINTER
/TO THE DISK	TRANSFER VECTOR
/
/FOREGROUND PROGRAM SHOULD OPERATE WITH INTERRUPTS ENABLED
/
/INTERRUPT SERVICE FOR FOREGROUND IS VIA JMS I FOREINT
/AND FOREGROUND PROGRAM SHOULD RETURN VIA JMP I ENTRY
/FOR CONTINING INTERRUPT SERVICE FOR BACKGROUND ROUTINE
/
/CONVENTIONS:	ALL SUBROUTINES ENTERED AND EXITED WITH ACC
/CLEAR,UNLESS OTHERWISE SPECIFIED.	
	/2
FIELD 0
/DEFINITIONS
DCMA=6601
DMAR=6603
DMAW=6605
DFSC=6622
DFSE=6621
USERIF=CDF CIF 10
USERDF=CDF 10
GETAC=TAD TEMP+1
LOADAC=DCA TEMP+1
SKIP=ISZ TEMP+2
SETTRAP=6274
CLRTRAP=6204
DETRAP=6264
SKPTRAP=6254
DOTEA=1010	/2ND SURFACE,FIELD 1 (DISK MONITOR HEAD)
DOTDMA=0	/1ST BLOCK OF DISK
NEXT=DISKTEST
USERCORE=710	/END OF FIRST SURFACE,FIELD 1
	/3
*0
HLT
	JMP I INTP
*16
0	/USED BY XSORTJ
0	/USED BY DTEST & RETURN
K7750,	7750
K7751,	7751
SAVEL,	0
SAVEAC,	0
PRILST,	
PRI1,	ZERO
PRI2,	ZERO
PRI3,	DFLAG3
ZERO,	0
FOREFLAG,0	/INHIBIT BACKGROUND EXECUTION WHEN SET
START,	7600	/OR OTHER USER FIELD ADDRESS
FLAGS,	0	/USER INTERRUPT FLAGS
	/BIT NUMBER	7	8	9	10	11
	/		DISK	HSP	HSR	TTO	TTI
ULNK,
TEMP,		0	/LINK AT TRAP TIME
UACC,		0	/ACCUMULATOR AT TRAP TIME
UPC,		0	/LOCATION OF TRAP
UMB,		0	/INSTRUCTION CAUSING TRAP
UIO,		0	/INTERRUPT STATUS FOR BACKGROUND
UKBD,		0	/KEYBOARD BUFFER
UHSR,		0	/HSR BUFFER
DFLAG3,	0	/FLAG
	0	/WC
	0	/CA
	0	/EA
	0	/FUNCTION
	0	/DMA
	/4
/PSEUDO-INSTRUCTIONS
/
USERDISK,	1010	/2ND SURFACE,FIELD 1
K4,	4
K10,	10
K20,	20
K100,	100
FOREINT,	DEFAULT
INTEXIT=JMP I .
XINTEXIT
INTP,	INTSERV
IOEXIT=JMP I .
XIOEXIT
EXIT=JMP I .
XEXIT
EXEC=JMS I .
TRAPGO
REENTER=JMP I .
XREENTER
	DTEST=JMS I .
	XDTEST
/5
*200
/LIST OF LEGAL TRAP INSTRUCTIONS
/
ITRAPS, RSF;I6011
	PSF;I6021
	KSF;I6031
	TSF;I6041
	DFSC;I6622
	RRB RFC;I6016
	RRB;I6012
	RFC;I6014
	PLS;I6026
	PCF;I6022
	PPC;I6024
	KRB;I6036
	KCC;I6032
	KRS;I6034
	TLS;I6046
	TCF;I6042
	TPC;I6044
	DFSE;I6621
	DEAL;I6615
	DEAC;I6616
	DCMA;I6601
	DMAR;I6603
	DMAW;I6605
	ION;I6001
	IOF;I6002
	OSR;I7404
	LAS;I7604
	HLT;DOTIN
	0	/TERMINATOR
/6

/TRAP SERVICE FOR HSP
/
I6024,	STL
I6026,	GETAC
	PPC
	SNL CLA
I6022,	TAD K10
	IOEXIT
/HSR TRAP SERVICE/7
/
I6016,	RFC
I6012,	TAD TEMP+6
	LOADAC
	TAD K4
	IOEXIT
I6014,	RFC
	EXIT
/

/8
/FAST READER SERVICE ROUTINE
/
RTEST,	RSF
	JMP PTEST
	RRB
	DCA TEMP+6
	TAD K4
	JMP I .+6
/
/FAST PUNCH INTERRUPT SERVICE
/
PTEST,	PSF
	INTEXIT	/NO RECOGNIZABLE INTERRUPTS **BKPT FOR DEBUGGING**
	PCF
	TAD K10
	JMP I .+1
	USERINT
/9
/KEYBOARD,PRINTER, AND SWITCHES TRAP SERVICE
/
I6021,	TAD K10
	SKP
I6031,	IAC CLA CLL
	SKP
I6041,	STL RTL
	SKP
I6011,	TAD K4
	SKP
I6622,	TAD K20
	AND FLAGS
	SZA CLA
	SKIP
	EXIT
I6036,	TAD TEMP+5
I6032,	LOADAC
	IAC
	IOEXIT
I6034,	TAD TEMP+5
	JMP I7604+1
I6044,	STL
I6046,	GETAC
	TPC
	SNL CLA	/SKIP IF 6044
I6042,	STL RTL CLA	/2
	IOEXIT
/10
/SWITCH REGISTER EMULATION
/
I7404,	GETAC
I7604,	OSR
	LOADAC
	EXIT
/
/11
/USER	ION INSTRUCTION
/
I6001,	TAD TEMP+2
	DCA TEMP+4
	EXIT
	/
I6621,	STA CLL RTL	/-3
	TAD I PRI3
	JMP I6622+2
INTSERV,	DCA SAVEAC
	RAL
	DCA SAVEL
	JMS I FOREINT
PAGE	/ARGUMENT VECTOR FOR USER DISK HANDLING
/
/DISK TRANSFER VECTOR FOR MONITOR HEAD
/
HEAD,	0
	-200
	7577
	1010
	DMAR
1
/
/12
/ITRAP SERVICE ROUTINE
/
	UTMP,
TRAPGO,	0	/ENTER WITH IOF!
	STA
	TAD 0
	DCA TEMP+2
	TAD SAVEAC
	DCA TEMP+1
	TAD SAVEL
	DCA TEMP
	USERDF
	TAD I TEMP+2
	CDF CIF
	DCA TEMP+3
	CLRTRAP
	DETRAP
	JMP I TRAPGO
/13
WAIT2=JMS .
XWAIT2,	0
	TAD I PRI2
	SPA CLA
	JMP .-2
	JMP I XWAIT2
/
WAIT3=JMS .
XWAIT3,	0	/THIS MUST PRESERVE LINK!
	TAD I PRI3
	SPA CLA
	JMP .-2
	JMP I XWAIT3
/
/14
/
/	JMS XTEST2	/EXECUTIVE LEVEL DISK TEST AND SETUP
/	 ADDRESS OF ARGUMENTS LIST
/
PNTR,
XTEST2,	0
	TAD I XTEST2	/PICKUP ADDRESS OF DTV
	DCA PRI2
	ISZ XTEST2
TL1,	STA
	DCA I PRI2	/SET REQUEST
	IOF
	DTEST
	ION
	WAIT2		/UNTIL COMPLETION
	STA CLL RTL	/-3
	TAD I PRI2
	SZA CLA		/SKIP IF DISK ERRED
	JMP I XTEST2
	JMP TL1		/TRY AGAIN
/
/15
/SERVICE A TRAP
/
DEFAULT,0
	CLL CLA
	SKPTRAP
	JMP I KTESTP
	EXEC
TRAPSERV,	RIB
	SNA CLA /EXIT IF BACKGROUND LOCKED-OUT
	INTEXIT
	ION
XSORTJ,	TAD KTRAP
	DCA 16
SORTLO,	ISZ 16
	TAD I 16
	SNA
	EXIT
	CIA
	TAD TEMP+3
	SZA CLA
	JMP SORTLOOP
	TAD I 16
	DCA PNTR
	CLA CLL
	JMP I PNTR
KTESTP,	KTEST
KTRAP,	ITRAPS-2
/16
/LOAD THE MONITOR HEAD INTO USER FIELD AND START
/EXECUTION OF IT
/
DOTIN,	TAD FOREFLAG
	RAL CLL
	DCA FOREFLAG
	SZL
	INTEXIT
	ION
	WAIT3
	TAD K1010
	DCA USERDISK
	JMS XTEST2
	 HEAD
ENTER,	IOF
	KCC		/START MONITOR HEAD
	TLS
	DCA FOREFLAG	/ENABLE BACKGROULD PROGRAM
	DCA FLAGS	/CLEAR USER'S FLAGS
	DCA TEMP+4	/AND HIS INTERRUPT
	TAD START
	DCA TEMP+2
	REENTER
K1010,	1010	/DISK 1, FIELD 1
/17
/SERVICE DISK TRAPS
/
I6615,	GETAC
	AND K3700
	TAD USERDISK
	DCA DFLAG3+3
	GETAC
	DCA DEALT
	EXIT
DEALT,	0	/CONTENTS OF DEAL
K3700,	3700	/DISK TRACK EXTENSION MASK
I6616,	JMS XWAIT3
	TAD DFLAG3+1	/GET WORDCOUNT
	CIA CLL		/AND ADD IT
	TAD DFLAG3+5	/TO DMA
	SZL CLA	/SKIP IF NO DMA OVERFLOW
	TAD K100
	TAD DEALT
	LOADAC
	EXIT
/18
/RETURN FROM AN INTERRUPT
/
XINTEX,	CLA CLL
	TAD SAVEL
	RAR CLL
	TAD SAVEAC
	RMF
	ION
	JMP I 0
/19
/
/HONOR A BACKGROUND "INTERRUPT"
/
	TAD K20
USERINT,	DCA TRAPGO
	TAD FLAGS
	CMA
	AND TRAPGO
	TAD FLAGS
	DCA FLAGS
	RIB
	TAD TEMP+4
	SNA CLA
	INTEXIT
	EXEC
	EXIT
/
/20
KDMAR,	DMAR
I6605,	STL
I6603,	JMS I PWAIT3
	CLA RTL
	TAD KDMAR
	DCA DFLAG3+4
	GETAC
	DCA DFLAG3+5
	USERDF
	TAD I K7750
	DCA DFLAG3+1
	TAD I K7751
	DCA DFLAG3+2
	LOADAC	/
	CDF
	STA
I6601,	DCA DFLAG3
	IOF
	DTEST
	TAD K20
/
/21
/REENTER USER PROGRAM AFTER TRAP SERVICE
/
XIOEXIT, IOF
	CMA CLL
	AND FLAGS
	DCA FLAGS
/
/22
/IF "IOF" OR NO FLAGS, RETURN TO USER'S PROGRAM
/IF "ION" AND FLAGS, TEST INSTRUCTION+1, AND IF IT
/IS "JMP I 0" (RETURNING FROM AN INTERRUPT SERVICE) THEN
/DO NOT CHANGE RETURN ADDRESS IN 10000, AND RE-ENTER
/USER'S INTERRUPT SERVICE ROUTINE AT 10001.
/
XEXIT,	CLA CLL
	IOF
	TAD TEMP+4	/FETCH INTERRUPT STATUS
	SNA CLA	/SKP IF ION
	JMP RET
	TAD FLAGS
	SNA CLA	/SKIP IF ANY FLAGS SET
	JMP RET
	ISZ TEMP+2
L2,	USERDF
	TAD I TEMP+2	/FETCH FOLLOWING INSTRUCTION
	TAD M5400
	SNA CLA 	/SKIP IF NOT JMP I 0
	JMP .+3
	TAD TEMP+2	/SETUP FOR USER INTERRUPT SERVICE
	DCA I ZERO
	CDF
	DCA TEMP+2
I6002,	DCA TEMP+4	/IOF
RET,	ISZ TEMP+2
	TAD TEMP
	RAR CLL
	TAD TEMP+1
XREENT,	SETTRAP
	USERIF
	ION
	JMP I TEMP+2
M5400,	-5400
/23
/
/BEGIN INTERRUPT SERVICE ROUTINES
/
DTMP,	0
KTEST,	KSF
	JMP TTEST
	KRB
	TAD M202
	SNA	/SKIP IF NOT CTRL/B
	JMP I KDOTIN
	TAD K202
	DCA TEMP+5	/DEPOSIT IN INPUT BUFFER
	STL RAL
	JMP USERINT
TTEST,	TSF
	JMP DISKTEST
	TCF
	STL RTL
	JMP USERINT
M202,	-202
K202,	202
KDOTIN,	DOTIN
/24
/
/DISK INTERRUPT SERVICE ROUTINE
/
DISKTEST, DFSC	/SKIP IF DISK COMPLETE
	JMP RTEST
	DFSE	/SKIP IF NO ERROR
	IAC
	STL RAL
	DCA I DTMP1
	DCMA	/CLEAR THE DISK CONTROLLER
	TAD DTMP1
	TAD KDFLAG3
	SNA CLA	/SKIP IF NOT FLAG3
	JMP I L10
	DTEST
	INTEXIT
L10,	USERINT-1
XDTEST,	0	/SEE COMMENTS ON DISK TRANSFER VECTOR (DTV) A
	DCMA	/CLEAR THE DISK CONTROLLER
	TAD KPRILST	/SET POINTER TO TOP-OF-PRIORITY
	DCA DTMP
DL1,	ISZ DTMP
	TAD I DTMP	/DTMP POINTS TO PRIORITY LIST ENTRY
	SNA	/SKIP IF NOT END-OF-LIST
	JMP I XDTEST
	DCA DTMP1	/DTMP1 POINTS TO FLAGWORD OF DTV
	TAD I DTMP1	/PICKUP FLAGWORD
	SMA CLA	/SKIP IF REQUESTING OR WAITING
	JMP DL1
	JMP DSTART	/SETUP A TRANSFER
KDFLAG3,	-DFLAG3
KPRILST,	PRILST-1
DTMP1,	0
PWAIT3,	XWAIT3
/
/SACRED LOCATIONS
*.&7600+150
/
0	/DWC
0	/DCA
0	/MTWC
0	/MTCA
0	/DTWC
0	/DTCA
/
/25
DSTART,	STL CLA RAR	/4000
	DCA I DTMP1	/SET FLAG TO AITING STATE
	TAD DTMP1
	DCA 17
	TAD I 17
	DCA I K7750
	TAD I 17
	DCA I K7751
	TAD I 17
	DEAL
	CLA CLL
	TAD I 17
	DCA .+2
	TAD I 17
	0	/THIS INSTRUCTION MUST CLEAR ACC!
	JMP I XDTEST
$
