Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap2_198111 - decus/20-0027/driver.mac
There are 2 other files named driver.mac in the archive. Click here to see a list.
00100		TITLE	DRIVER FOR THE PDP8 SIMULATOR	VERSION #2	SEPT. 1 '69
00200		SUBTTL	DAVE MCCLURE	JULY/9/69
00300	
00400	EXTERNAL	DOOR,INI,S,C,L,DP,E,SS,.JBDDT,STARTT,IF,IBR
00500	EXTERNAL	FETCHY,STOREY,PRINT,FCLOSE,SR,IFSW,DFSW,DFF,EXIT
00600	
00700	IFE INLINE,<EXTERNAL CORE
00800	IFE PACK,<EXTERNAL FETPNT>>
00900	
01000	GO:	MOVEI	AC0,GO1
01100		MOVEM	AC0,DOOR		;SET RETURN ADDRESS
01200		JRST	INI		;INITIALIZE LOTS OF STUFF
01300	GO1:	SIZE=<MEMSIZ-^D4096>/^D4096
01400		IFE SIZE, <OUTSTR [ASCIZ /You have a 4K simulated PDP/]
01500		RIMADR=7756>
01600		SIZE=SIZE-1
01700		IFE SIZE,<OUTSTR [ASCIZ /You have aN 8K simulated PDP/]
01800		RIMADR=117756>
01900		SIZE=SIZE-1
02000		IFE SIZE,<OUTSTR [ASCIZ /You have a 12K simulated PDP/]
02100		RIMADR=227756>
02200		SIZE=SIZE-1
02300		IFE SIZE,<OUTSTR [ASCIZ /You have a 16K simulated PDP/]
02400		RIMADR=33756>
02500		SIZE=SIZE-1
02600		IFE SIZE,<OUTSTR [ASCIZ /You have a 20K simulated PDP/]
02700		RIMADR=447756>
02800		SIZE=SIZE-1
02900		IFE SIZE,<OUTSTR [ASCIZ /You have a 24K simulated PDP/]
03000		RIMADR=557756>
03100		SIZE=SIZE-1
03200		IFE SIZE,<OUTSTR [ASCIZ /You have a 28K simulated PDP/]
03300		RIMADR=667756>
03400		SIZE=SIZE-1
03500		IFE SIZE,<OUTSTR [ASCIZ /You have a 32K simulated PDP/]
03600		RIMADR=777756>
03700		PURGE	SIZE
03800		IFE PDP8,<OUTSTR [ASCIZ /-8/]>
03900		IFE PDP8I,<OUTSTR [ASCIZ /8I/]>
04000		IFE PDP8S,<OUTSTR [ASCIZ /8S/]>
04100		IFE PDP8L,<OUTSTR [ASCIZ /8L/]>
04200		IFE INLINE,<OUTSTR [ASCIZ /(inline version)/]>
04300		IFN INLINE,<OUTSTR [ASCIZ /(subroutine version)/]>
04400		IFE PACK,<OUTSTR [ASCIZ / with a packed memory.
04500	
04600	/]>
04700		IFN PACK,<OUTSTR [ASCIZ / with an unpacked memory.
04800	
04900	/]>
05000		IFE ESTOP,<OUTSTR [ASCIZ /stop on illegal instructions
05100	/]>
05200		IFN ESTOP,<OUTSTR [ASCIZ /noop illegal instructions
05300	/]>
05400		IFE <DDF32-1>,<OUTSTR [ASCIZ /1 DF32 disk
05500	/]>
05600		IFE <DDF32-2>,<OUTSTR [ASCIZ /2 DF32 disks
05700	/]>
05800		IFE <DDF32-3>,<OUTSTR [ASCIZ /3 DF32 disks
05900	/]>
06000		IFE <DDF32-4>,<OUTSTR [ASCIZ /4 DF32 disks
06100	/]>
06200		IFE DRM08,<OUTSTR [ASCIZ /RM08
06300	/]>
06400		IFE DCS680,<OUTSTR [ASCIZ /680/
06500	/]>
06600		IFE PLOTER,<OUTSTR [ASCIZ /PLOTTER
06700	/]>
06800		MOVEI	AC0,GO3
06900		MOVEM	AC0,DOOR		;SET RETURN ADDRESS
07000	
07100	ENTRY	OPR,DRDATA,ALPHA,SIXOUT
07200	
07300	;GET A COMMAND - DECODE IT AND DISPATCH TO PROPER ROUTINES
07400	OPR:	CLRBFI			;DELETE TYPE AHEAD
07500		SETOM	AC0		;LOAD -1
07600		GETLIN	AC0		;GET CHARACTERISTIC OF THIS LINE
07700		TLZ	AC0,6		;SET TO FULL DUPLEX NORMAL MODE
07800		SETLIN	AC0		;EFFECT CHANGES
07900		OUTSTR	[ASCIZ /
08000	*/]
08100		SETZM	LASTC#		;ENABLE COMMAND INPUT
08200		PUSHJ	PDP,SIXIN	;GET A COMMAND
08300		HLRZS	AC1		;REDUCE TO AT MOST 3 CHARACTERS
08400	COM:	MOVSI	AC3,CLIST-ENDC	;ESTABLISH COUNTER
08500		HLRZ	AC4,CLIST(AC3)	;LOAD COMMAND TO COMPARE
08600		CAIE	AC1,(AC4)	;ARE THEY THE SAME?
08700		AOBJN	AC3,.-2		;N0 - TRY ANOTHER?
08800		MOVEI	AC3,(AC3)	;ZERO LEFT HALF OF AC3
08900		HRRZ	AC0,CLIST(AC3)	;LOAD DISPATCH ADDRESS
09000		CAIGE	AC3,LL		;IS THIS A CONSOL COMMAND?
09100		JRST	LEAVE		;YES SO CLEAN UP AREA BEFORE LEAVING
09200		JRST	(AC0)
09300	
09400	;PUT NEXT CHARACTER IN AC2	IF ALPHABETIC SKIP RETURN
09500	;				IF NOT ALPHABETIC NONSKIP RETURN
09600	;TO CALL PUSHJ	PDP,ALPHA
09700	ALPHA:	MOVE	AC2,LASTC
09800		CAIE	AC2,12		;WAS IT A LINE FEED
09900		INCHWL	AC2		;NO SO ITS OK TO READ ANOTHER
10000		MOVEM	AC2,LASTC	;NOTE LAST CHARACTER
10100		CAIL	AC2,101
10200		AOS	(PDP)
10300		CAILE	AC2,132
10400		SOS	(PDP)
10500		POPJ	PDP,
10600	
10700		MOVE	AC2,LASTC	;NOTE LAST CHARACTER
10800		CAIE	AC2,12		;WAS IT A LINE FEED?
10900		INCHWL	AC2		;NO SO GET NEXT CHARACTER
11000		MOVEM	AC2,LASTC	;REMEMBER WHAT WAS LAST CHARACTER
11100	NUMER:	CAIL	AC2,60		;LESS THAN ASCII 0?
11200		AOS	(PDP)		;NO SO PERHAPS A SKIP
11300		CAILE	AC2,67		;LESS THAN ASCII 7?
11400		SOS	(PDP)		;NO SO CHANGE SKIP TO NONSKIP
11500		POPJ	PDP,
11600	
11700	;GET AN OCTAL NUMBER FROM TTY, LOAD IN AC1 AND RETURN
11800	;IF AN ERROR OCCURES (8 OR 9) "EH!"
11900	OCTAL:	SETZ	AC1,
12000		MOVEI	AC3,^D11	;LOAD COUNTER FOR # OF DIGITS
12100	OCT1:	PUSHJ	PDP,NUMER-4	;GET NUMBER
12200		JRST	OCT2		;NONNUMERIC
12300		ROT	AC2,-3		;LEFT JUSTIFY
12400		ROTC	AC1,3		;SAVE JUST ACQUIRED LSD
12500		SOJGE	AC3,OCT1	;CAN WE ACCEPT MORE?
12600		JRST	EH		;NO
12700	OCT2:	CAIE	AC2,70		;ASCII "8"
12800		CAIN	AC2,71		;ASCII "9"
12900		JRST	EH		;YES
13000		CAIN	AC2,32(AC3)	;LEADING BLANK?
13100		JRST	OCT1		;YES
13200		POPJ	PDP,		;LEAVE
13300	
13400	DDT:	HRRZ	AC0,.JBDDT	;LOAD EXIT WITH DDT START
13500		JUMPE	AC0,EH		;IF NO DDT THEM MOAN
13600	
13700	LEAVE:	PUSHJ	PDP,ALPHA	;GET NEXT CHARACTER
13800		CAIE	AC2,12		;WAS IT A LINE FEED
13900		JRST	.-2		;NO
14000		JRST	(AC0)		;END OF LINE SO DISPATCH
14100	
14200	RIM:	MOVEI	AC1,RIMADR	;LOAD ADDRES OF RIM LOADER
14300		JRST	ST+1
14400	
14500	BIN:	MOVEI	AC1,MEMSIZ-1	;LOAD STARTING ADDRESS OF BINARY LOADER
14600		MOVEI	AC0,3777	;TELL LOADER TO USE HIGH SPEED READER
14700		MOVEM	AC0,SR
14800		JRST	ST+1		;START THE BINARY LOADER
14900	
15000	EXTERNAL RDATA,PDATA,KDATA,TDATA
15100	ZIP:	OUTSTR	[ASCIZ /READER/]
15200		MOVE	AC2,RDATA	;LOAD THE READER TIME CONSTANT
15300		PUSHJ	PDP,ZIP1
15400		MOVEM	AC1,RDATA	;STORE NEW TIME CONSTANT
15500		OUTSTR	[ASCIZ /PUNCH/]
15600		MOVE	AC2,PDATA
15700		PUSHJ	PDP,ZIP1
15800		MOVEM	AC1,PDATA
15900		OUTSTR	[ASCIZ /KEYBOARD/]
16000		MOVE	AC2,KDATA
16100		PUSHJ	PDP,ZIP1
16200		MOVEM	AC1,KDATA
16300		OUTSTR	[ASCIZ /TELEPRINTER/]
16400		MOVE	AC2,TDATA
16500		PUSHJ	PDP,ZIP1
16600		MOVEM	AC1,TDATA
16700		IFE PLOTER,<
16800		OUTSTR	[ASCIZ /PLOTTER/]
16900		MOVE	AC2,PLDATA
17000		PUSHJ	PDP,ZIP1
17100		MOVEM	AC1,PLDATA>
17200		JRST	REOPR		;GET ANOTHER CONSOLE COMMAND
17300	ZIP1:	OUTSTR	[ASCIZ / speed was /]
17400		MOVE	AC1,[^D4000000]	;LOAD 4,000,000 QUARTER MICROSEC.
17500		IDIV	AC1,AC2		;GET CPS
17600		MOVEI	AC2,^D12	;LOAD DIGIT COUNTER
17700		SOJE	AC2,EH		;ARE THERE ANY DIGITS LEFT
17800		LSH	AC1,3		;SHIFT OFF MOST SIGNIFICANT ZERO
17900		TLNN	AC1,700000	;LEADING DIGIT A ZERO?
18000		JRST	.-3
18100		PUSHJ	PDP,OCTP+2	;TYPE TIME CONSTANT
18200		OUTSTR	[ASCIZ /cps, change to /]
18300		SETZM	LASTC		;ENABLE INPUT
18400		PUSHJ	PDP,OCTAL	;GET A NEW TIME CONSTANT
18500		CAIG	AC1,		;IS THE NUMBER 0 OR NEGATIVE?
18600		JRST	OCT3		;YES SO SKIP OUT
18700		MOVE	AC2,[^D4000000]	;LOAD 1 SECOND
18800		IDIV	AC2,AC1		;GET TIME CONSTANT
18900		MOVE	AC1,AC2		;PUT AC2 WHERE LEAVING WON'T KILL IT
19000		CAIG	AC1,		;ISCONSTANT 0 OR NEGATIVE
19100	OCT3:	AOS	(PDP)		;YES
19200		POP	PDP,AC0
19300		JRST	LEAVE
19400	
19500	
19600	;TYPE OUT FILE NAMES AND MODIFY IF REQUESTED
19700	EXTERNAL	RCDATA,PCDATA,PRCDAT
19800	FIL:	OUTSTR	[ASCIZ /READER/]
19900		MOVEI	FDB,RCDATA	;LOAD FDB WITH READER DATA BLOCK ADD
20000		JSP	AC0,FILE	;WORK WITH IT
20100		OUTSTR	[ASCIZ /PUNCH/]
20200		MOVEI	FDB,PCDATA	;LOAD FDB WITH PUNCH DATA BLOCK ADD
20300		JSP	AC0,FILE	;MASSAGE IT
20400		OUTSTR	[ASCIZ /PRINTER/]
20500		MOVEI	FDB,PRCDATA
20600		JSP	AC0,FILE
20700		IFE PLOTER,<EXTERNAL PLCDAT,PLDATA
20800		OUTSTR [ASCIZ /PLOTTER/]
20900		MOVEI	FDB,PLCDAT
21000		JSP	AC0,FILE>
21100		IFN DDF32,<EXTERNAL DCDATA
21200		OUTSTR [ASCIZ /DF32/]
21300		MOVEI	FDB,DCDATA
21400		JSP	AC0,FILE>
21500		JRST	REOPR		;RETURN TO COMMAND LEVEL
21600	;TYPE	DEV:FILE.EXT	AND REQUEST MODIFICATIONS
21700	;CALL:	LOAD FDB	JSP AC0,FILE
21800	FILE:	OUTCHR	[11]		;TAB
21900		MOVE	AC1,CDNAM(FDB)	;LOAD DEVICE NAME
22000		PUSHJ	PDP,SIXOUT	;TYPE IT
22100		OUTCHR	[72]		;":"
22200		MOVE	AC1,@CDIR(FDB)	;FILE NAME
22300		PUSHJ	PDP,SIXOUT	;TYPE IT
22400		MOVE	AC1,CDIR(FDB)	;LOAD ADDRESS OF ENTER BLOCK
22500		HLLZ	AC1,1(AC1)	;GET FILE EXTENSION
22600		OUTCHR	[56]		;"."
22700		PUSHJ	PDP,SIXOUT	;TYPE IT
22800		OUTSTR	[ASCIZ / modify this with /]
22900		SETZM	LASTC		;ENABLE INPUT
23000		PUSHJ	PDP,SIXIN	;GET DEVICE NAME
23100		PUSH	PDP,AC1		;SAVE INPUT WORD FOR CLOSING TEST
23200		CAIE	AC2,72		;":"?
23300		JRST	FNME		;NO TRY FOR A FILE NAME INSTEAD
23400		MOVEM	AC1,CDNAM(FDB)	;SAVE DEVICE NAME
23500		PUSHJ	PDP,SIXIN	;GET FILE EXTENSION
23600	FNME:	CAIE	AC1,0		;FILE NAME?
23700		MOVEM	AC1,@CDIR(FDB)	;YES SO SAVE
23800		PUSHJ	PDP,SIXIN	;GET EXTENSION
23900		MOVE	AC2,CDIR(FDB)	;ADDRESS OF ENTER BLOCK
24000		CAIE	AC1,0		;FILE EXTENSION HERE?
24100		HLLZM	AC1,1(AC2)	;YES SO SAVE IT
24200		POP	PDP,AC2
24300		CAME	AC1,AC2		;DEVICE NAME AND EXTENSION SAME?
24400		JSP	SRR,FCLOSE	;NO - SOMETHING CHANGED,CLOSE
24500		JRST	LEAVE
24600	
24700	;TYPE SIXBIT CONTENTS OF AC1, UP TO 6 CHARS, STOP ON A BLANK
24800	;DOESN'T USE AC0
24900	;CALL		LOAD AC1	PUSHJ PDP,SIXOUT
25000	SIXOUT:	MOVE	AC2,[POINT 6,AC1]	;BYTE POINTER TO GET CHARS
25100		MOVEI	AC4,6		;WATCH FOR MAX COUNT
25200		ILDB	AC3,AC2		;GET NEXT CHAR
25300		JUMPE	AC3,POP	;EXIT ON BLANK
25400		ADDI	AC3,40		;CONVERT TO ASCII
25500		OUTCHR	AC3		;TYPE
25600		SOJG	AC4,.-4
25700	POP:	POPJ	PDP,
25800	
25900	
26000	
26100	;PUT NEXT ALPHABETIC WORD FROM TTY IN AC1 AS LEFT JUSTIFIED SIXBIT.
26200	;IF WORD IS MORE THAN SIX CHARACTERS SLUFF OFF TRAILING EXCESS.
26300	;LEAVE THE DELIMITER IN AC2 AND LASTC.
26400	SIXIN:	MOVEI	AC3,6		;LOAD A COUNTER FOR NUMBER OF CHARACTERS
26500		PUSHJ	PDP,ALPHA	;GET NEXT ALPHA CHAR
26600		JRST	.+2		;NOT ALPHA PERHAPS DIGIT?
26700		JRST	.+3		;ALPHABETIC SO CONTINUE
26800		PUSHJ	PDP,NUMER	;TEST FOR NUMERIC
26900		JRST	S2		;NOT NUMMERIC EITHER
27000		SUBI	AC2,40		;CONVERT TO SIXBIT
27100		ROT	AC2,-6		;LEFT JUSTIFY CHAR IN AC2
27200		LSHC	AC1,6		;PUT NEW CHAR IN AC1
27300		SOJG	AC3,SIXIN+1	;GET NEXT CHAR AND CONTINUE
27400		PUSHJ	PDP,ALPHA	;TOO MANY CHARACTERS!
27500		JRST	.+2		;FINALLY A DELIMITER
27600		JRST	.-2		;STILL MORE TO SLUFF
27700	S2:	CAIN	AC2,32(AC3)	;PERHAPS A LEADING BLANK?
27800		JRST	SIXIN		;PROBABLY SO TRY AGAIN
27900		CAIN	AC3,		;IS SIXBIT WORD LEFT JUSTIFIED
28000		POPJ	PDP,		;AC1 FULLY JUSTIFIED SO RETURN
28100		LSH	AC1,6		;SHIFT ONE MORE POSITION
28200		SOJA	AC3,.-3		;MODIFY CHAR COUNT AND PROCEED
28300	
28400	
28500	SW:	PUSHJ	PDP,OCTAL	;GET AN OCTAL NUMBER IN AC1
28600		MOVE	AC0,AC1
28700		ANDI	AC0,7777	;REDUCE TO 12 BITS
28800		MOVEM	AC0,SR		;LOAD SWITCH REGISTER
28900		PUSH	PDP,AC1
29000		ANDI	AC1,70000	;MASK OUT SR AND DFF
29100		MOVEM	AC1,IFSW	;STORE IFSW
29200		POP	PDP,AC1
29300		ANDI	AC1,700000	;MASK OUT IF AND SR
29400		LSH	AC1,-3		;POSITION
29500		MOVEM	AC1,DFSW	;STORE DFSW
29600		JRST	REOPR		;GET ANOTHER COMMAND AND CONTINUE
29700	
29800	ST:	PUSHJ	PDP,OCTAL	;GET AN OCTAL NUMBER
29900		MOVE	PC,AC1		;LOAD PC
30000		ANDI	PC,7777		;REMOVE DFF AND IF IF PRESENT
30100		PUSH	PDP,AC1		;SAVE AC1
30200		ANDI	AC1,70000	;MASK OFF PC AND DFF
30300		MOVEM	AC1,IF		;AND SAVE IF
30400		MOVEM	AC1,IBR		;AND SAVE IBR
30500		POP	PDP,AC1		;RESTORE AC1
30600		ANDI	AC1,700000	;MASK OFF IF AND PC
30700		LSH	AC1,-3		;POSITION FOR DFF
30800		MOVEM	AC1,DFF		;AND SAVE DFF
30900		MOVEI	AC0,S		;PREPARE TO LEAVE
31000		JRST	LEAVE
31100	
31200	DDD:	PUSHJ	PDP,PCSAVE	;SAVE PC
31300		PUSHJ	PDP,OCTAL	;GET FIRST ADDRESS
31400		ANDI	AC1,77777	;REMOVE DFF IF PRESENT
31500		MOVE	PC,AC1		;LOAD PC
31600		TRZ	PC,770000	;AND MASK OFF IF
31700		TRZ	AC1,707777	;MASK OFF DFF AND PC
31800		MOVEM	AC1,IF		;AND STORE IF
31900	D1:	PUSHJ	PDP,OCTAL	;GET A DATA WORD
32000		CAIN	AC3,^D11		;WERE ANY DIGITS PICKED UP?
32100		JRST	PCREST		;NO SO RESTORE PC AND EXIT
32200		CAIN	AC2,72		;LAST CHAR A":"?
32300		JRST	DDD+2		;YES WE PICKED UP AN ADDRESS
32400		MOVE	MB,AC1		;SO LOAD MEMORY BUFFER
32500		ANDI	MB,7777		;AND MASK OFF EXTRA BITS
32600		MOVE	MA,PC		;LOAD ADDRESS FOR THE DATA
32700		PUSHJ	PDP,STOREY
32800		AOS	PC		;INCREMENT MEMORY ADDRESS
32900		TRZ	PC,10000	;TEST FOR PC CARRYOUT
33000		JRST	D1		;GET ANOTHER DATA WORD
33100	
33200	;PRINT WORD(12 BITS) IN AC0
33300	PWORD:	PUSH	PDP,AC0		;PRESERVE AC0
33400		MOVE	AC1,AC4		;LOAD WORD NUMBER
33500		IDIVI	AC1,30
33600		SKIPN	AC2		;DIVISIBLE BY 30?
33700		PUSHJ	PDP,LINEN	;YES SO A NEW LINE
33800		MOVEI	AC1,40		;LOAD A BLANK
33900		ANDI	AC2,7		;LEAVE RESIDUE MODULO 8
34000		JUMPN	AC2,.+3		;DIVISIBLE BY 8?
34100		PUSHJ	PDP,PRINT
34200		PUSHJ	PDP,PRINT
34300		PUSHJ	PDP,PRINT
34400		POP	PDP,AC0		;RESTORE AC0
34500	PWRD:	ROT	AC0,-^D12	;LEFT JUSTIFY
34600		MOVEI	AC2,4		;DIGIT COUNTER
34700		HRRI	AC1,6
34800		ROTC	AC0,3		;SHIFT IN MSD AND CONVERT TO ASCII
34900		PUSHJ	PDP,PRINT
35000		SOJG	AC2,.-3
35100		POPJ	PDP,
35200	
35300	CARRET:	MOVEI	AC1,15		;CARRIAGE RETURN
35400		PUSHJ	PDP,PRINT
35500		MOVEI	AC1,12		;LINE FEED
35600		PUSHJ	PDP,PRINT
35700		POPJ	PDP,		;RETURN
35800	
35900	LINEN:	PUSHJ	PDP,CARRET	;CARRIAGE RETURN LINE FEED
36000		TRNN	AC4,37		;EXTRA CARRIAGE RETURN FOR LEGIBILITY?
36100		PUSHJ	PDP,CARRET	;YES
36200		SKIPE	AC1,IF
36300		ORI	AC1,600000	;CONVERT TO ASCII NUMBER
36400		IORI	AC1,400000	;CONVERT TO ASCII OR BLANK
36500		LSH	AC1,-^D12	;RIGHT JUSTIFY
36600		PUSHJ	PDP,PRINT
36700		MOVE	AC0,AC4
36800		PUSHJ	PDP,PWRD	;PRINT LSD'S OF ADDRESS
36900		MOVE	AC0,AC4
37000		IDIVI	AC0,30
37100		MOVE	AC0,AC1		;SAVE REMAINDER
37200		IMULI	AC0,5		;CALCULATE NUMBER OF WORDS TO SKIP
37300		IDIVI	AC1,10		;DIVIDE BY 8
37400		LSH	AC2,1		;MULTIPLY QUOTIENT BY 2
37500		ADD	AC0,AC2		;ADD 2SPACE/ GROUP OF 8WORDS SKIPED
37600		MOVEI	AC1,40
37700		SOJL	AC0,.+3
37800		PUSHJ	PDP,PRINT
37900		JRST	.-2
38000		POPJ	PDP,
38100	
38200	PCSAVE:	MOVE	AC0,PC		;LOAD PC
38300		OR	AC0,IF		;SAVE THE INSTRUCTION FIELD
38400		ROT	AC0,-3
38500		OR	AC0,DFF		;SAVE DFF ALSO
38600		ROT	AC0,-^D12	;SHIFT DFF TO LS BITS
38700		MOVEM	AC0,REM		;SAVE PC
38800		POPJ	PDP,
38900	
39000	IFN DDF32,<
39100	;READ THE FIRST BLOCK OF THE DISK INTO THE TOP PAGE OF CORE
39200	BOOT:	SETZM	IF
39300		MOVSI	AC4,-7
39400	LOAD0:	HLR	MA,LOADL(AC4)
39500		HRR	MB,LOADL(AC4)
39600		PUSHJ	PDP,STOREY
39700		AOBJN	AC4,LOAD0
39800		MOVEI	AC1,200		;STARTING ADDRESS
39900		JRST	ST+1
40000	
40100	LOADL:	XWD	200,6603
40200		XWD	201,6622
40300		XWD	202,5201
40400		XWD	203,5604
40500		XWD	204,7600
40600		XWD	7750,7576
40700		XWD	7751,7576>
40800	
40900	DUMP:	MOVE	AC0,FLAGS	;LOAD FLAGS TO PRINT
41000		MOVEI	AC2,6		;6 DIGITS PER HALF WORD
41100		PUSHJ	PDP,PWRD+2
41200		MOVEI	AC2,6
41300		PUSHJ	PDP,PWRD+2
41400		MOVEI	AC1,11		;TAB
41500		PUSHJ	PDP,PRINT
41600		MOVE	AC0,DFF		;LOAD THE DATA FIELD
41700		LSH	AC0,3
41800		IORI	AC0,IF		;ADD INSTRUCTION FIELD
41900		OR	AC0,PC		;ADD PC
42000		MOVEI	AC2,6
42100		PUSHJ	PDP,PWRD+2
42200		MOVEI	AC1,11		;TAB
42300		PUSHJ	PDP,PRINT
42400		MOVE	AC0,AC		;LOAD THE AC AND LINK
42500		MOVEI	AC2,5
42600		PUSHJ	PDP,PWRD+2
42700		PUSHJ	PDP,CARRET
42800		SETZM	AC4
42900		PUSHJ	PDP,PCSAVE
43000	DMP3:	PUSHJ	PDP,DASHC
43100		JRST	DMP1		;NOT INPUT NUMBERS
43200		PUSHJ	PDP,CARRET
43300	DMP2:	AOS	AC1,AC4		;INCREMENT ADDRESS
43400		IDIVI	AC1,30		;DIVISIBLE BY 30?
43500		CAIE	AC1,0
43600		PUSHJ	PDP,LINEN	;YES SO START A NEW LINE
43700		SOS	AC4		;CORRECT AC4
43800		PUSHJ	PDP,GET		;GET FIRST NUMBER
43900	DMP0:	MOVE	AC0,MB
44000		PUSHJ	PDP,PWORD	;TYPE THIS LOCATION
44100		CAML	AC4,DASH	;UNFINISHED N-M?
44200		JRST	DMP3		;NO
44300		PUSHJ	PDP,GET
44400		JRST	DMP0
44500	DMP1:	JUMPE	AC4,DALL
44600		MOVEI	FDB,PRCDAT
44700		JSP	SRR,FCLOSE	;DUMP BUFFERS
44800	PCREST:	PUSHJ	PDP,REST1
44900		JRST	REOPR
45000	REST1:	MOVE	AC0,REM
45100		DPB	AC0,[POINT 3,DFF,23]	;RESTORE DFF
45200		ROT	AC0,3
45300		DPB	AC0,[POINT 3,IF,23]	;RESTORE IF
45400		HLRZ	PC,AC0		;RESTORE PC
45500		LSH	PC,-6
45600		POPJ	PDP,
45700	
45800	DALL:	SETOM	AC4
45900		MOVEI	AC0,MEMSIZ-1
46000		MOVEM	AC0,DASH
46100		JRST	DMP2
46200	
46300	DASHC:	SETZM	DASH#
46400		PUSHJ	PDP,OCTAL
46500		CAIN	AC3,^D11		;ANY DIGITS PRESENTED?
46600		POPJ	PDP,		;NO SO SIMPLE POP RETURN
46700		ANDI	AC1,77777	;REDUCE TO 5OCTAL DIGITS
46800		SOS	AC1
46900		MOVEM	AC1,AC4		;SET LOCATION TO EXAMINE OR DUMP
47000		ANDI	AC1,70000	;LEAVE ONLY IF
47100		MOVEM	AC1,IF		;LOAD IF
47200		CAIE	AC2,55		;"-" AS IN N-M
47300		JRST	SPOP		;NO
47400		PUSHJ	PDP,OCTAL
47500		ANDI	AC1,77777	;BE SURE WE HAVE ONLY 5 OCTAL DIGITS
47600		CAIL	AC1,MEMSIZ	;TOO LARGE?
47700		MOVEI	AC1,MEMSIZ-1	;YES SO SET TO MAX CORE
47800		MOVEM	AC1,DASH	;SAVE N FROM M-N
47900	SPOP:	AOS	(PDP)
48000		POPJ	PDP,
48100	
48200	GET:	AOS	AC4		;INCREMENT CURRENT ADDRESS
48300		LDB	MA,[POINT 12,AC4,35]	;LOAD 4 LSD'S IN MA
48400		LDB	AC1,[POINT 3,AC4,23]	;LOAD IF
48500		LSH	AC1,^D12
48600		MOVEM	AC1,IF
48700		PUSHJ	PDP,FETCHY	;GET CORE LOCATION
48800		POPJ	PDP,		;DONE SO EXIT
48900	
49000	EX:	PUSHJ	PDP,PCSAVE
49100		PUSHJ	PDP,DASHC
49200		JRST	PCREST		;NOTHING TENDERED SO EXIT
49300		PUSHJ	PDP,GET		;GET CONTENTS OF LOCATION
49400		SKIPE	AC1,IF		;IS IF 0?
49500		IORI	AC1,200000	;CONVERT TO A ASCII NUMBER
49600		IORI	AC1,400000	;CONVERT TO ASCII
49700		LSH	AC1,-^D12	;RIGHT JUSTIFY THE CHARACTER
49800		OUTCHR	AC1		;PRINT A BLANK OR A NUMBER
49900		MOVE	AC1,AC4		;LOAD THE CURRENT ADDRESS
50000		PUSHJ	PDP,OCTP	;TYPE 4 LSD'S
50100		MOVE	AC1,MB		;LOAD MEMORY CONTENTS TO TYPE
50200		PUSHJ	PDP,REG		;TYPE THEM
50300		CAML	AC4,DASH	;UNFINISHED N-M?
50400		JRST	EX+1		;NO
50500		JRST	EX+3		;YES
50600	
50700	P:	PUSHJ	PDP,OCTAL	;GET AN OCTAL NUMBER
50800		PUSH	PDP,AC1
50900		MOVE	PC,AC1		;LOAD PC
51000		ANDI	PC,7777		;MASK OUT DF AND IF
51100		ANDI	AC1,70000	;MASK TO LEAVE IF
51200		MOVEM	AC1,IF		;LOAD IF
51300		MOVEM	AC1,IBR		;LOAD INSTRUCTION BRANCH REGISTER
51400		POP	PDP,AC1
51500		ANDI	AC1,700000	;MASK OUT IF AND SR
51600		LSH	AC1,-3		;POSITION
51700		MOVEM	AC1,DFF
51800		JRST	REOPR
51900	
52000	;RETURN HERE WHENEVER LEAVING THE PDP8
52100	;DIAGNOS CAUSE OF EXIT AND ANNOUNCE SAME OR SOURCE OF EXIT
52200	GO3:	OUTSTR	[ASCIZ	/
52300	
52400	/]
52500		HLLI	AC0,		;CLEAR STATUS FLAGS FROM SAVED PC
52600		MOVSI	AC1,ELIST-ENDL	;COUNTER AND INDEX
52700	DIA:	HLRZ	AC2,ELIST(AC1)
52800		CAIE	AC0,(AC2)	;ERROR SOURCE?
52900	DIA2:	AOBJN	AC1,DIA		;NO
53000		MOVE	AC2,ELIST(AC1)
53100		OUTSTR	(AC2)		;PRINT DIAGNOSTIC
53200		JRST	@DLIST(AC1)	;DISPATCH TO SPECIAL ROUTINE
53300	
53400	LIST0:	OUTSTR	[ASCIZ /	SOURCE /]
53500		LSHC	AC0,-^D15	;PUT ERROR SOURCE ADDRES IN AC1
53600		MOVEI	AC2,5		;COUNTER
53700		PUSHJ	PDP,OCTP+2
53800	
53900	LIST:	OUTSTR	[ASCIZ /
54000	FLAGS	/]
54100		MOVE	AC1,FLAGS	;LOAD THE FLAGS IN AC1
54200		PUSHJ	PDP,WORDP	;TYPE IT
54300		OUTSTR	[ASCIZ /
54400	PC  /]
54500		MOVE	AC1,DFF		;LOAD DATA FIELD
54600		LSH	AC1,^D17	;POSITION DFF FOR TYPING
54700		TLO	AC1,301000	;CONVERT TO ASCII
54800		OUTSTR	AC1
54900		MOVE	AC1,IF		;LOAD INSTRUCTION FIELD IN AC1
55000		LSH	AC1,-^D12	;POSITION FOR TYPING
55100		ORI	AC1,60		;CONVERT TO ASCII
55200		OUTCHR	AC1
55300		MOVE	AC1,PC
55400		PUSHJ	PDP,REG
55500		OUTSTR	[ASCIZ /AC    /]
55600		TRNE	AC,10000	;IS LINK 1
55700		OUTCHR	[61]		;YES
55800		MOVE	AC1,AC
55900		PUSHJ	PDP,REG
56000		OUTSTR	[ASCIZ /MA/]
56100		MOVE	AC1,MA
56200		PUSHJ	PDP,REG
56300		OUTSTR	[ASCIZ /MB/]
56400		MOVE	AC1,MB
56500		PUSHJ	PDP,REG
56600		IFN DDF32,<EXTERNAL DMA
56700		OUTSTR	[ASCIZ /DMA   /]
56800		HRLZ	AC1,DMA
56900		MOVEI	AC2,6
57000		PUSHJ	PDP,OCTP+2
57100		OUTSTR	[ASCIZ /
57200	/]>
57300		OUTSTR	[ASCIZ /MQ/]
57400		MOVE	AC1,MQ
57500		PUSHJ	PDP,REG
57600		OUTSTR	[ASCIZ /IR/]
57700		MOVE	AC1,IR
57800		PUSHJ	PDP,REG
57900		OUTSTR	[ASCIZ /SR  /]
58000		MOVE	AC1,DFSW	;LOAD DATA FIELD SWITCHES
58100		LSH	AC1,^D17	;POSITION FOR CONVERSION TO ASCII
58200		TLO	AC1,301000	;AND ADDITION OF A BLANK
58300		OUTSTR	AC1
58400		MOVE	AC1,IFSW	;LOAD INSTRUCTION SWITCHES
58500		LSH	AC1,-^D12	;POSITION
58600		ORI	AC1,60		;CONVERT TO ASCII
58700		OUTCHR	AC1
58800		MOVE	AC1,SR
58900		PUSHJ	PDP,REG
59000		SKIPN	TIME		;WAS THE MACHINE RUNNING?
59100		JRST	OPR
59200		PUSHJ	PDP,TIM		;TYPE RUNNING TIME
59300	
59400	RUNT:	OUTSTR	[ASCIZ /RUNNING TIME /]
59500		SETZB	AC0,AC3
59600		CALLI	AC0,27		;GET RUNNING TIME FOR JOB
59700		SUB	AC0,STARTT	;EXTRACT TIME FOR PREVIOUS JOB STEPS
59800		MOVEI	AC2,9		;LOAD COUNTER
59900		IDIVI	AC0,^D10	;FIND LSD
60000		OR	AC3,AC1		;SAVE LSD
60100		ROT	AC3,-4		;PRESERVE LSD
60200		SOJG	AC2,.-3		;MORE DIGITS?
60300		MOVEI	AC1,9		;LOAD COUNTER
60400		TLNE	AC3,740000	;IS MSD NONZERO?
60500		JRST	.+5		;YES
60600		LSH	AC3,4		;NO SO REMOVE MSD
60700		SOS	AC1		;AND FORGET IT
60800		CAIE	AC1,4		;CAN MORE BE FORGOTTEN?
60900		JRST	.-5		;YES
61000		MOVEI	AC2,3		;PREPARE TO RECEIVE DECIMEL DIGIT
61100		ROTC	AC2,4		;SHIFT IN DIGIT AND CONVER TO ASCII
61200		OUTCHR	AC2		;TYPE IT
61300		CAIN	AC1,4		;READY FOR A "."
61400		OUTCHR	[56]
61500		CAIN	AC1,7		;READY FOR A ","
61600		OUTCHR	[54]
61700		SOJG	AC1,.-7		;DONE?
61800		OUTSTR	[ASCIZ / SECONDS
61900	
62000	/]
62100	
62200		JRST	OPR
62300	
62400	TIM:	OUTSTR	[ASCIZ /
62500		SIMULATED RUNTIME   /]
62600		MOVE	AC0,TIME	;LOAD TIME
62700		IDIVI	AC0,4		;CONVERT TO MICROSECONDS
62800		MOVEM	AC1,REM#	;SAVE FRACTIONAL MICROSECONDS
62900		MOVEI	AC2,9		;LOAD COUNTER
63000		SETZ	AC3,		;CONVERT TO DECIMEL
63100		IDIVI	AC0,^D10	;FIND LEAST SIGNIFICANT DIGIT
63200		OR	AC3,AC1		;SAVE LSD
63300		ROT	AC3,-4		;PRESERVE LAST DIGIT ENTERED
63400		SOJG	AC2,.-3		;DONE?
63500		MOVEI	AC1,9		;LOAD COUNTER
63600		TLNE	AC3,740000	;LEADING DIGIT 0
63700		JRST	.+7		;NO
63800		LSH	AC3,4		;THEN GET RID OF IT
63900		SOS	AC1		;AND FORGET IT
64000		TLNE	AC3,740000	;NEXT DIGIT 0?
64100		JRST	.+3		;NO
64200		LSH	AC3,4		;DESTROY
64300		SOS	AC1		;AND FORGET
64400		MOVEI	AC2,3		;READY TO ROTATE IN ASCII
64500		ROTC	AC2,4		;PUT MSD IN AC2
64600		OUTCHR	AC2		;TYPE
64700		CAIN	AC1,7		;NEED "."
64800		OUTCHR	[56]		;YES
64900		CAIN	AC1,4		;PERHAPS A ","
65000		OUTCHR	[54]		;YES
65100		SOJG	AC1,.-7		;DONE?
65200		MOVE	AC1,REM		;RESTORE FRACTIONAL MICROSECONDS
65300		CAIN	AC1,1
65400		OUTSTR	[ASCIZ /,25/]
65500		CAIN	AC1,2
65600		OUTSTR	[ASCIZ /,5/]
65700		CAIN	AC1,3
65800		OUTSTR	[ASCIZ /,75/]
65900		OUTSTR	[ASCIZ / SECONDS
66000	
66100	/]				;YES
66200		POPJ	PDP,
66300	
66400	REG:	OUTCHR	[11]		;TAB
66500		PUSHJ	PDP,OCTP
66600		OUTSTR	[ASCIZ /
66700	/]
66800		POPJ	PDP,
66900	
67000	OCTP:	ROT	AC1,^D24	;LEFT JUSTIFY REGISTER
67100		MOVEI	AC2,4		;COUNTER
67200		MOVEI	AC0,6		;SET UP AC0 TO ROTATE IN ASCII OCTAL DIGIT
67300		ROTC	AC0,3		;PUT MSD IN AC0
67400		OUTCHR	AC0		;TYPE
67500		SOJG	AC2,.-3		;DONE?
67600		POPJ	PDP,		;SO RETURN
67700	
67800	EXTERNAL	TIME,IOINI,TC,NTIME,NXIOT,EAE,OPR2
67900	;LIST OF ERROR SOURCES AND MESSAGES TO TYPE
68000	DEFINE	EXWD (A,B) <
68100		XWD	A,B
68200		EXTERNAL A>
68300	ELIST:	IFE ESTOP,<
68400		EXTERNAL	INSFET
68500		XWD	INSFET+2,[ASCIZ	/CYCLING IN MEMORY/]
68600		XWD	EAE+1,[ASCIZ /EAE INSTRUCTION/]
68700		XWD	NXIOT+1,[ASCIZ /UNRECOGNIZABLE IOT/]
68800		EXWD	OPR2,[ASCIZ /ROTATE BOTH RIGHT AND LEFT?/]>
68900		EXWD	EFLG3,[ASCIZ /EFLG3/]
69000		EXWD	EFLG4,[ASCIZ /EFLG4/]
69100		EXWD	EFLG5,[ASCIZ /EFLG5/]
69200		EXWD	EFLG6,[ASCIZ /EFLG6/]
69300		EXWD	EFLG7,[ASCIZ /EFLG7/]
69400		EXWD	EFLG8,[ASCIZ /END OF FILE ON PTR/]
69500		IFE DRM08,<EXWD	EFLG9,[ASCIZ /DISK/]
69600		EXWD	DMOUT0,[ASCIZ /DMOUT0/]
69700		EXWD	EFLG10,[ASCIZ /EFLG10 DSIK/]>
69800		EXWD	TIME,[ASCIZ /EXIT/]
69900		EXWD	IOINI,[ASCIZ /IOINI/]
70000		EXWD	TC,[ASCIZ /PDP8 HALTED/]
70100	ENDL:	XWD	,[ASCIZ /UNRECOGNIZABLE EXIT/]
70200	
70300		IFE ESTOP,<
70400	IOT:	OUTCHR	[11]		;TAB
70500		MOVE	AC1,MB		;LOAD FOR TYPING
70600		PUSHJ	PDP,OCTP	;TYPE
70700		OUTSTR	[ASCIZ /	PC /]
70800		MOVE	AC1,PC
70900		OR	AC1,IF		;ADD INSTRUCTION FIELD
71000		ROT	AC1,-^D15	;LEFT JUSTIFY
71100		SUBI	AC1,1		;CALCULATE CORRECT PC
71200		MOVEI	AC2,5		;COUNT
71300		PUSHJ	PDP,OCTP+2	;TYPE
71400		OUTSTR	[ASCIZ	/
71500	/]				;CR&LF
71600		POP	PDP,AC0		;CLEAR OUT PD LIST
71700		JRST	OPR		;GET ORDERS>
71800	
71900	DLIST:	IFE ESTOP,<EXP	OPR,IOT,IOT,OPR>
72000		EXP	ECF,ECD,ECD,ECF,ECD
72100		EXP	OPR
72200		IFE DRM08,<ECF,ECD,OPR>
72300		EXP	OPR,OPR,OPR,LIST0
72400	
72500	ECF:	OUTSTR	[ASCIZ /	CFSTAT /]
72600		JRST	.+2		;SKIP
72700	
72800	ECD:	OUTSTR	[ASCIZ /	CDSTAT /]
72900		MOVE	AC1,AC3
73000		PUSHJ	PDP,WORDP
73100		JRST	OPR
73200	
73300	WORDP:	MOVEI	AC2,6		;LOAD COUNTER
73400		PUSHJ	PDP,OCTP+2	;TYPE LEFT HALF
73500		OUTCHR	[40]		;SEPERATE HALFWORDS
73600		MOVEI	AC2,6		;COUNTER FOR THE RIGHT HALF
73700		JRST	OCTP+2	;TYPE RIGHT HALF
73800	
73900	
74000	INT:	SETZ	AC0,
74100		PUSHJ	PDP,OCTAL
74200		CAIE	AC2,46		;"&"
74300		JRST	.+3
74400		MOVE	AC0,TIME
74500		JRST	INT+1		;NOW GET A NUMEBER TO ADD
74600		LSH	AC1,2		;MULTIPLY BY 4
74700		ADD	AC0,AC1
74800		MOVEM	AC0,DRDATA+1	;SET TIME TO INTERRUPT
74900		CAMGE	AC0,NTIME
75000		MOVEM	AC0,NTIME
75100		JRST	REOPR
75200	INT1:	POP	PDP,AC0
75300		HRLOI	AC0,377777
75400		MOVEM	AC0,DRDATA+1	;REPAIR TIME TO INTERRUPT NEXT
75500		TLO	FLAGS,RUN	;REPAIR RUN FLAG
75600		OUTSTR	[ASCIZ /
75700	
75800	BREAK POINT/]
75900		SETZM	RUNTIM
76000		JRST	LIST
76100	DRDATA:	4*^D1000000
76200		377777777777		;SET TO MAXIMUM TIME
76300		XWD	RUN,
76400		INT1
76500	
76600	EH:	OUTSTR	[ASCIZ /EH?
76700	/]				;ERROR SO COMPLAIN
76800	REOPR:	MOVEI	AC0,OPR		;GET ANOTHER COMMAND AFTER
76900		JRST	LEAVE		;WIPING CURRENT LINE
77000	
77100	
77200	
77300		DEFINE	DISPATCH	(X)<	<SIXBIT	/X/>!<X>>
77400	CLIST:	DISPATCH	BIN
77500		DISPATCH	C
77600		DISPATCH	DDT
77700		DISPATCH	E
77800		<SIXBIT /DIS/>!<LIST>
77900		DISPATCH	DP
78000		<SIXBIT /EXI/>!<EXIT>
78100		DISPATCH	FIL
78200		DISPATCH	L
78300		DISPATCH	RIM
78400		DISPATCH	S
78500		DISPATCH	SS
78600		DISPATCH	ZIP
78700	
78800		LL=.-CLIST
78900	
79000		<SIXBIT /D/>!<DDD>
79100		<SIXBIT /DUM/>!<DUMP>
79200		DISPATCH	EX
79300		DISPATCH	INT
79400		IFN DDF32,<<SIXBIT /BOO/>!<BOOT>>
79500		<SIXBIT	/PC/>!<P>
79600		DISPATCH	ST
79700		<SIXBIT /SR/>!<SW>
79800	ENDC:	EXP	EH		;ENTRY FOR ERRORS
79900	
80000		END	GO