Google
 

Trailing-Edge - PDP-10 Archives - klad_sources - klad.sources/dakdbm.mac
There are no other files named dakdbm.mac in the archive.
SUBTTL	DIAGNOSTIC CONTROL

PGMNAM:	ASCIZ/
PDP-10 KA10 RANDOM INSTRUCTION RELIABILITY DIAGNOSTIC (DAKDB)
/

RENTR1:	JSR	PNTTOT		;PRINT TOTALS
	DROPDV			;CLOSE OUTPUT
	CALL	[SIXBIT/EXIT/]

DDTEX:	MOVE	0,SAC0
	JRST	DDTSRT

;SIMULATOR -DDT- INITIALIZATION SEQUENCE

SIMDDT:	PGMINT
	SWITCH
	TRNN	INHMT		;PRINT MACHINE STATES ?
	JRST	SIMPRG		;YES
	JRST	SIMIF		;NO, INITIAL/FINAL
;PROGRAM INITIALIZATION

SFSRT1:	SETZM	ERRTLS
	SETZM	PASCNT
	SETZM	TICKS
	SETZM	TSTIMR#
	JRST	BEGIN

START:	PGMINT			;INITIALIZE SUBROUTINES
	SETZM	PNTSIM#
	SETZM	LINCNT#
	MOVEI	<^D32*^D1024>-1
	MOVEM	VMEM#
	MOVE	[JSR PNTTOT]
	MOVEM	HNGERR		;SETUP HUNG FOR TOTALS
	SWITCH
	MOVNI	1,^D100000
	TRNE	ALINES		;PRINT ALL OUTPUT LINES
	MOVEM	1,PNTENB	;YES
	SKIPN	USER		;IF USER, USE TIME OF DAY IN JIFFIES
	JRST	.+3
	CALL	1,[SIXBIT/TIMER/]
	MOVEM	1,RANDBS	;INIT RANDOM NUMBER GENERATOR
	TRNN	RANBAS		;SPECIFY RANDOM NUMBER BASE ?
	JRST	STARTA		;NO
	MOVEI	[ASCIZ/
SPECIFY BASE RANDOM NUMBER - /]
	PNTALF
	TTIOCT			;INPUT OCTAL NUMBER
	JRST	.-3		;ERROR
	MOVEM	0,RANDBS	;INIT RANDOM NUMBER GENERATOR
STARTA:	SETOM	SIMFLG#		;SETUP CONTROL FLAGS
	SETZM	PNTSPC
	SWITCH
	TRNE	INHSIM		;INHIBIT SIMULATION ?
	SETZM	SIMFLG		;YES
	MOVEI	1,^D10
	TRNE	SNGFL		;SINGLE FAST LOOP ?
	MOVEI	1,1		;YES
	MOVEM	1,FLCNT#
	TRNE	ENTDDT		;ENTER DDT SWITCH SET ?
	JRST	DDTSRT		;YES
	SKIPE	USER		;USER MODE ?
	JRST	BEG		;YES

STARTB:	TRNE	INHCLK		;EXEC, INHIBIT CLOCK INTERRUPTS ?
	JRST	STARTC		;YES
	MOVE	1,[JRST ITRCLK]	;SETUP INTERRUPT ROUTINE
	MOVEM	1,$ITRHL	;TO ALLOW FOR CLOCK
	MOVEI	1,^D60		;50 OR 60 HZ. ?
	SKIPE	CYCL60
	MOVEI	1,^D50		;50 HZ.
	MOVEM	1,HERTZ#
	MOVE	[JSR ITRCH1]	;SETUP FOR ALL CHANNELS
	MOVEM	42
	MOVEM	44
	MOVEM	46
	MOVEM	50
	MOVEM	52
	MOVEM	54
	MOVEM	56
	CONO	APR,CLKENB!CLKCLR!AAPRC1	;TURN ON CLOCK
	CONO	PI,PARENB!CHNON!PION!PICHNA
	JRST	BEG

STARTC:	CONO	PI,PICLR!CHNOFF!PIOFF	;CLEAR INTERRUPTS
	CONO	APR,AAPRC1		;TURN ON ERROR CHANNEL 1
	CONO	PI,PARENB!CHNON!PION!PICHN1
	JRST	BEG
SUBTTL	DIAGNOSTIC SECTION

BEG:	SETZM	ERRCNT#		;ERROR COUNT
CONTNU:	MOVE	RANDBS
	MOVEM	K1#
	MOVE	10,FLCNT
	MOVEM	10,K2#		;ITR COUNT
	SETZM	PRNT#		;PRINT FLAG
	SETZ	12,0
	MOVS	10,K1		;RESTART TO CONTINUE RANDOM NUMBERS
	MULI	10,6065		
	DIV	10,[XWD 377777,777741]
	MOVEM	11,K1
	MOVEM	11,0(12)
	AOS	12,12
	CAIE	12,10
	JRST	CONTNU+6
	HRRI	12,RAND		;STOR NUM IN RAND TO RAND+7 AND AC 0-7
	HRLI	12,0
	BLT	12,RAND+7

VIT:	SETZ	12,0		;TEST FOR VALID INST
	MOVE	11,@12
	AND	11,[XWD 770000,0]
	ROT	11,6
	CAIGE	11,14		;LESS THAN 140
	JRST	BYTTST		;YES GO CHECK FOR POSSIBLE BYTE OR FSC
	CAIN	11,26		;CHECK FOR PUSH,POP
	JRST	XIMUL		;GO MAKE NEW INST (IMUL)
	CAIN	11,25		;CHECK FOR JMP INST
	JRST	ECHTST		;GO CHECK FOR POSSIBLE EXCH
	LSH	11,-3
	CAIN	11,3		;CHECK FOR SKIPS & JMPS
	JRST	XFSBR		;GO MAKE NEW INST(FSBR)
	CAIN	11,6		;CHECK FOR TST INST
	JRST	TSTTST		;GO CHECK FOR LAST INST IN GROUP
	CAIN	11,7		;CHECK FOR IOT
	JRST	XFMPR		;GO MAKE NEW INST(FMPR)
	CAIE	11,2		;CHECK FOR JFFO
	JRST	MASKX		;NO
	JSR	ARANGE		;YES, POSSIBLE
	CAIN	13,243
	JRST	XIMUL		;GO MAKE NEW INST (IMUL)
	CAIN	13,247		;NOOP INSTRUCTION
	JRST	XIMUL		;MAKE IMUL
	JRST	MASKX		;GO MASKX OUT UNWANTED BITS
ARANGE: 0			;GET OPERATION CODE OF OPERAND
	MOVE	13,@12
	AND	13,[XWD 777000,0]
	ROT	13,9
	JRST	@ARANGE

BYTTST:	JSR	ARANGE
	CAIGE	13,130
	JRST	XROTC
	CAILE	13,132		;CHECK FOR FSC OR BYTE
	JRST	XASHC		;NO,MAKE NEW INST (ASHC)
	JRST	MASKX		;YES,GO MASKX OUT UNWANTED BITS

ECHTST:	JSR	ARANGE		;GO GET OP CODE
	CAIE	13,250		;POSSIBLE EXCHANGE INST
	JRST	XIMUL		;NO,MAKE NEW INST (IMUL)
	JRST	MASKX		;YES,GO MASKX OUT UNWANTED BITS

TSTTST:	CAILE	12,4		;POSSIBLE TST INST IF NOT LAST IN GROUP
	JRST	XFDVR		;NO,GO MAKE NEW INST (FDVR)
	JRST	MASKX		;YES,GO MASKX OUT UNWANTED BITS

VITEXT:	AOS	12
	MOVEM	11,INSBLK-1(12)	;STOR VALID INST IN INSBLK TO INS BLK+7
	CAIN	12,7
	JRST	SLO		;GO SET UP SLOW LOOP
	JRST	VIT+1		;GO TEST MORE

MMASKX:	0			;MAKE NEW INST
	MOVE	11,@12
	TLZ	11,777000
	XCT	@MMASKX
	JRST	MASKX+1

XROTC:	JSR	MMASKX
	ADD	11,[XWD 245000,0]	;MAKE IT A ROTC

XIMUL:	JSR	MMASKX
	ADD	11,[XWD 220000,0]	;MAKE IT A IMUL

XFDVR:	JSR	MMASKX			;MAKE IT A FDVR
	ADD	11,[XWD 174000,0]
XFMPR:	JSR	MMASKX
	ADD	11,[XWD 164000,0]	;MAKE IT A FMPR

XFSBR:	JSR	MMASKX
	ADD	11,[XWD 154000,0]	;MAKE IT A FSBR

XASHC:	JSR	MMASKX
	ADD	11,[XWD 244000,0]	;MAKE IT A ASHC

MASKX:	MOVE	11,@12		;MASK OUT INDEX REG & HIGH ORDER E FIELD
	AND	11,[XWD 777340,7]
	JRST	VITEXT


SLO:	MOVE	10,INSBLK	;GO STORE INSTRUCTIONS
	MOVEM	10,CORIN1	;IN CORE LOOP
	MOVE	10,INSBLK+1
	MOVEM	10,CORIN2
	MOVE	10,INSBLK+2
	MOVEM	10,CORIN3
	MOVE	10,INSBLK+3
	MOVEM	10,CORIN4
	MOVE	10,INSBLK+4
	MOVEM	10,CORIN5
	MOVE	10,INSBLK+5
	MOVEM	10,CORIN6
	SETZM	SVINPC#		;CLEAR SVINPC FOR ERROR
SLO1:	MOVEM	0,SAC0#
	TTALTM			;ALTMODE CHECK
	SKIPA			;NONE
	JRST	DDTEX		;YES, GO TO DDT
	MOVE	0,SAC0
	SETZM	COREXF		;CLEAR FLAG FOR SIMULATION
	MOVSI	10,RAND
	BLT	10,7		;SETUP AC OPERANDS
	MOVE	10,[RAND,,ACS]
	BLT	10,ACS+7	;SETUP SIMULATOR OPERANDS
	SETZB	10,ACS+10	;AC10 IS 0 IN BOTH
	JRSTF	@.+1		;CLEAR FLAGS
		.+1
CORLOP:	SETZM	NOSKPF		;CLEAR NO SKIP FLAG
CORIN1:	0			;1ST INSTRUCTION
	SETOM	NOSKPF		;NO SKIP
	JSR	COREX		;GO TO SIMULATION
CORIN2:	0			;2ND INST
	SETOM	NOSKPF
	JSR	COREX
CORIN3:	0			;3RD INST
	SETOM	NOSKPF
	JSR	COREX
CORIN4:	0			;4TH INST
	SETOM	NOSKPF
	JSR	COREX
CORIN5:	0			;5TH INST
	SETOM	NOSKPF
	JSR	COREX
CORIN6:	0			;6TH INST
	SETOM	NOSKPF
	JSR	COREX
	JRST	.+3
COREXF:	0			;SIMULATION FLAG
NOSKPF:	0			;NO SKIP FLAG
	SKIPGE	K2		;PREVIOUS FAILURE, BUT NONE THIS TIME ?
	JRST	CORER1		;YES
	MOVEI	10,ANSBLK
	BLT	10,ANSBLK+7	;SAVE ANSWERS
	MOVE	10,FLCNT
	MOVEM	10,K2		;SETUP FAST LOOP COUNT
	SETZM	COREXF		;CLEAR SIMULATION FLAG
	MOVEM	0,SAC0
	TTALTM			;ALTMODE CHECK
	SKIPA			;NONE
	JRST	DDTEX		;YES, GO TO DDT
	MOVE	0,SAC0

FAST:	MOVE	10,[INSBLK,,11]
	BLT	10,17		;LOAD FAST LOOP INSTRUCTIONS
	MOVSI	10,RAND
	BLT	10,7		;LOAD OPERANDS
	SETZM	10
;EXECUTE FAST LOOP

EXFAST:	MOVE	17,[JRST CHEC]	;SETUP EXIT INST
	JRSTF	@.+1		;CLEAR FLAGS
		.+1
	JRST	11		;GO TO FAST LOOP

CHEC:	MOVEM	0,ANSSV0#
	MOVE	P,PLIST
	MOVEI	$PSHER
	PUT	0
	MOVE	0,ANSSV0
	CAME	0,ANSBLK	;CHECK FAST LOOP AND SLOW LOOP ANS
	JSR	ERRX
	CAME	1,ANSBLK+1
	JSR	ERRX
	CAME	2,ANSBLK+2
	JSR	ERRX
	CAME	3,ANSBLK+3
	JSR	ERRX
	CAME	4,ANSBLK+4
	JSR	ERRX
	CAME	5,ANSBLK+5
	JSR	ERRX
	CAME	6,ANSBLK+6
	JSR	ERRX
	CAME	7,ANSBLK+7
	JSR	ERRX
CHEC1:	SKIPGE	K2		;FAILURE ?
	JRST	FSTER1		;YES
	SOSE	K2		;REPEAT FAST LOOP ?
	JRST	FAST		;YES

CHEC2:	MOVE	K1
	MOVEM	RANDBS		;UPDATE RANDOM BASE
	SWITCH
	TLNE	RSTART!TOTALS
	JSR	PNTTOT		;GO PRINT TOTALS
	AOS	16,PASCNT
	TLNE	RELIAB
	JRST	.+4
	TRNE	16,3
	JRST	CONTNU
	JRST	BEGEND
	TRNE	16,37
	JRST	CONTNU
	JRST	BEGEND

FSTER1:	SWITCH
	TLNN	LOOPER		;STAY IN ERROR LOOP
	JRST	CHEC2		;NO
	JRST	FAST		;YES, REPEAT FAILING LOOP
COREX:	0
	MOVEM	10,SAC10#
	MOVE	10,COREX	;GET CALL PC
	SUBI	10,3		;-3, POINTS TO INST
	MOVEM	10,INPC		;SAVE AS SIM PC
	ADDI	10,3
	SKIPN	NOSKPF		;DID INST SKIP ?
	ADDI	10,3		;YES, SET RETURN TO SKIP NEXT INST
	MOVEM	10,COREX
	SETZM	NOSKPF
	MOVE	10,SAC10
	SKIPN	SIMFLG		;SIMULATE INSTRUCTION ?
	JRST	@COREX		;NO

COREX1:	SETOM	COREXF
	MOVE	10,[ACS,,SIMBLK]
	BLT	10,SIMBLK+10	;SAVE ORIG SIM AC'S FOR ERROR
	SETOM	MASK
	JSR	SIMNST		;SIMULATE INSTRUCTION
	CAME	0,ACS+0		;COMPARE AC RESULTS & SIM RESULTS
	JSR	ERRX		;ERROR
	CAME	1,ACS+1
	JSR	ERRX
	CAME	2,ACS+2
	JSR	ERRX
	CAME	3,ACS+3
	JSR	ERRX
	CAME	4,ACS+4
	JSR	ERRX
	CAME	5,ACS+5
	JSR	ERRX
	CAME	6,ACS+6
	JSR	ERRX
	CAME	7,ACS+7
	JSR	ERRX
	MOVE	10,SAC10
	JRST	@COREX		;EXIT

CORER1:	SWITCH
	TLNN	LOOPER		;LOOP ON ERROR ?
	JRST	CHEC2		;NO
	JRST	SLO1		;YES, STAY IN SLOW LOOP
;ERROR ROUTINES

ERRX:	0
	MOVEM	0,SAV0#
	SWITCH
	MOVEM	0,10
	MOVE	0,SAV0
	SKIPE	PRNT		;FIRST OUTPUT
	TLNE	10,PALERS	;PRINT ALL ERRORS ?
	JSR	EROUT		;GO OUTPUT

ERRX1:	AOS	ERRCNT
	AOS	ERRTLS
	SWITCH
	TLNE	ERSTOP		;HALT ON ERROR ?
	JSR	GOING		;YES
	TLNE	0,LOOPER	;LOOP ON ERROR ?
	SETOM	K2		;YES, MAKES LOOP EFF FOREVER
	SKIPN	USER
	DATAO	PI,ERRCNT	;DISPLAY
	TLNN	DING		;RING TTY BELL ?
	JRST	.+3		;NO
	MOVEI	BELL		;YES
	PNTAF
ERRX2:	SKIPE	COREXF		;IN SIMULATION ?
	JRST	CORER1		;YES
	JRST	FSTER1		;NO
;HALT AND SAVE AC'S

GOING:	0
	CONI	APR,$SVAPR
	CONI	PI,$SVPI
	CONO	PI,PIOFF
	MOVEM	0,$ACC0
	MOVE	GOING
	MOVEM	ITRCH1
	HALT	BEGIN		;%%%FOR NOW

EROUT:	0
	SETZM	EXIT1#		;CLEAR EXIT FLAG
	MOVEI	10,FSTANS	;SAVE FAST LOOP ANSWERS
	BLT	10,FSTANS+7
	MOVEI	0,7		;INIT INST CNT,
	MOVEM	0,INTCNT#
	MOVEM	0,ACCNT#	;AND AC CNT
	PNTNM
	MOVEI	[ASCIZ/
**********/]
	PNTAL
	SKIPE	USER
	JRST	EROUTX
	MOVE	0,CONSW
	TRNE	INHCLK
	JRST	EROUTX
	MOVE	0,TICKS
	CAIL	^D<60*60*10>	;BEEN RUNNING TEN MINUTES ?
	JSR	RUNTIM		;YES, PRINT RUN TIME
EROUTX:	MOVEI	0,[ASCIZ/
RANDOM INSTRUCTION FAILURE
    INST GROUP        OPERANDS           /]
	PNTAL
	MOVEI	[ASCIZ/SLOW ANS          SIM ANS/]
	SKIPN	COREXF
	MOVEI	[ASCIZ/FAST ANS          SLOW ANS/]
	PNTAL			;PRINT HEADER
	SETZM	PNTSPC
EROUT1:	MOVE	10,INTCNT
	SOJE	10,LOOP		;MONITOR CNT
	MOVEM	10,INTCNT
	SETCA	10,0
	ANDI	10,7
	MOVEI	CRLF
	PNTA
	SETZM	PNTSPC
	MOVEI	0,1		;PRINT FIRST DIGIT
	PNT1			;OF INST GROUP AND,
	MOVE	0,10
	PNT1			;2ND DIGIT
	JSR	SLSHSP		;PRINT / SPACE 
	MOVE	0,INSBLK-1(10)
	PNTHW			;PRINT INST

EROUT2:	JSR	ACPNT1		;PRINT AC
	MOVE	0,RAND(10)
	PNTHW			;PRINT OPERANDS
	JSR	ACPNT1		;PRINT AC
	MOVE	0,FSTANS(10)	;PRINT FAST ANS/SIM - SLOW ANS
	PNTHW			;PRINT AC
	JSR	ACPNT1		;PRINT AC NUMBER
	MOVE	0,ACS(10)
	SKIPN	COREXF
	MOVE	0,ANSBLK(10)
	PNTHW			;PRINT SLOW ANS/SIM - SIM ANS
	SOSLE	ACCNT
	JRST	EROUT1

EROUT3:	SKIPE	EXIT1
	JRST	EROUT4
	MOVEI	0,[ASCIZ /
                  / ]		;PRINT MARGIN
	PNTAL
	SETOM	EXIT1
	JRST	EROUT2
EROUT4:	SETOM	PRNT
	MOVEI	CRLF
	PNTA
	MOVEI	[ASCIZ/
BASE RANDOM NUMBER = /]
	PNTAL
	MOVE	0,RANDBS
	PNTHW			;PRINT RANDOM BASE
	MOVEI	CRLF
	PNTA
EROUT5:	SKIPN	SIMFLG		;SIMULATION INHIBITED ?
	JRST	@EROUT		;YES
	SKIPN	COREXF		;SLOW LOOP FAILURE ?
	JRST	SIMFST		;NO
	MOVEI	[ASCIZ/

INSTRUCTION SIMULATION - CORE LOOP INST # /]
	PNTAL
	HRRZ	INPC		;COMPUTE INST NUMBER
	SUBI	CORIN1
	IDIVI	3
	ADDI	1
	PNT1			;PRINT
	MOVEI	[ASCIZ/
----------
/]
	PNTAL
	MOVS	10,[ACS,,SIMBLK]
	BLT	10,ACS+10	;RESTORE SIM OPERANDS
	JRST	SIMMT		;SIM & PRINT INSTRUCTION
SLSHSP:	0			;PRINT / SPACE  
	MOVEI	0,[ASCIZ X/ X]
	PNTAL
	JRST	@SLSHSP

ACPNT1:	0			;PRINT SPACE
	MOVEI	0,SPACE
	PNTA
	MOVE	10,ACCNT	;GET AC NUMBER
	SETCA	10,0
	ANDI	10,7
	MOVE	0,10
	SETZM	PNTSPC
	PNT1			;PRINT IT
	JSR	SLSHSP
	JRST	@ACPNT1

LOOP:	MOVEI	CRLF
	PNTA
	MOVEI	0,17		;PRINT 17
	SETZM	PNTSPC
	PNT2
	JSR	SLSHSP
	MOVEI	0,[ASCIZ/   EXIT       /]		;PRINT EXIT
	PNTAL
	JRST	EROUT2

PCR:	PCRL
	RTN

PCR1:	PNTCI	14
	RTN
RUNTIM:	0
	CONO	APR,CLKDIS!AAPRC1	;DISABLE CLOCK
	JSR	TSTIMA		;PRINT RUN TIME
	CONO	APR,CLKENB!CLKCLR!AAPRC1	;ENABLE CLOCK
	JRST	@RUNTIM

;CLOCK SERVICE ROUTINE

ITRCLK:	CONSO	APR,CLK
	JRST	$ITRHL+1	;NOT CLOCK
	AOS	TICKS		;INC CLOCK COUNTER
	MOVEM	0,CLKAC0#	;SAVE AC'S
	MOVEM	1,CLKAC1#
	JSR	TSTIME		;CHECK AND PRINT TIME
	MOVE	1,K1		;GET RANDOM NUMBER
	ANDI	1,7
	SKIPN	1		;IF 0, MAKE 1
	AOS	1		;SETUP CLOCK ON RANDOM CHANNEL
	CONO	APR,CLKENB!CLKCLR(1)
	MOVE	0,CLKAC0
	MOVE	1,CLKAC1
	JEN	@ITRCH1		;RETURN

PNTTOT:	0
	SKIPE	USER		;NO TIME IF USER
	JRST	.+4
	TRNE	INHCLK		;NO TIME IF CLOCK INHIBITED
	JRST	.+2
	JSR	RUNTIM		;PRINT RUN TIME
	MOVEI	[ASCIZ/
TOTAL PASSES = /]
	PNTAL
	MOVE	PASCNT
	PNTDEC
	MOVEI	[ASCIZ/
TOTAL ERRORS = /]
	PNTAL
	MOVE	ERRTLS
	PNTDEC			;PRINT TOTAL ERRORS
	MOVEI	[ASCIZ/
BASE RANDOM NUMBER = /]
	PNTAL
	MOVE	0,RANDBS
	PNTHW			;PRINT RANDOM BASE
	MOVEI	CRLF2
	PNTA
	SWITCH
	TLNN	RSTART		;RESTART PROGRAM ?
	JRST	@PNTTOT		;NO, CONTINUE
	JRST	SFSTRT		;YES, RESTART AS STAND-ALONE
;TEST RUN TIME SUBROUTINE
;PRINTS TIME AT HALF HOUR INTERVALS OR WHEN REQUESTED

TSTIME:	0
	MOVE	TICKS		;HAS HALF HOUR PASSED ?
	SUB	TSTIMR
	MOVE	1,HERTZ
	CAIE	1,^D60		;60 HZ. ?
	JRST	TSTIMB		;NO, 50
	CAIGE	^D<60*60*30>
	JRST	@TSTIME		;NOT HALF HOUR YET
TSTIMC:	SETOM	TIMFRC
	JSR	TSTIMA
	JRST	@TSTIME

TSTIMA:	0
	SKIPE	PNTFLG		;INTERRUPTED OUT OF PRINT ROUTINE
	JRST	@TSTIMA		;YES, DO NEXT CLOCK
	MOVEI	[ASCIZ/
RUN TIME = /]
	PNTALF
	MOVE	TICKS		;GET TIME
	SKIPE	TIMFRC#		;REQUESTED TIME, IF SO DON'T
	MOVEM	TSTIMR		;UPDATE HALF HOUR COMPARE
	IDIV	HERTZ		;CONVERT TO SECONDS
	IDIVI	^D<60*60>	;CONVERT TO HOURS
	MOVEM	1,TIMAC1#	;SAVE MIN:SEC
	PNTDCF			;PRINT HOURS
	MOVEI	[ASCIZ/:/]
	PNTAF
	MOVE	0,TIMAC1	;RETURN MIN:SEC
	IDIVI	^D60		;CONVERT TO MINUTES
	MOVEM	1,TIMAC1	;SAVE :SEC
	PNTDCF			;PRINT MINUTES
	MOVEI	[ASCIZ/:/]
	PNTAF
	MOVE	0,TIMAC1	;RETURN :SEC
	PNTDCF			;PRINT SECONDS
	MOVEI	CRLF
	PNTAF
	SETZM	TIMFRC
	JRST	@TSTIMA

TSTIMB:	CAIGE	^D<60*60*25>	;50 HZ HALF HOUR
	JRST	@TSTIME		;NO
	JRST	TSTIMC
;SIMULATE INSTRUCTION

SIMNST:	0
	MOVEM	0,SAVAC
	MOVE	[1,,SAVAC+1]
	BLT	SAVAC+17	;SAVE AC'S
	SETZM	INSTR
	SETZM	CNTLPC
	MOVEI	-1
	MOVEM	UPRPC
	MOVE	P,PLIST
	MOVEI	$PSHER
	PUSH	P,0
	GO	SENTRY		;GO TO SIMULATOR

	MOVS	[1,,SAVAC+1]
	BLT	17		;RESTORE AC'S
	MOVE	0,SAVAC
	JRST	@SIMNST

;SIMULATE INSTRUCTION, PRINT

SIMMT:	SETZM	MASK		;ALLOW PRINTOUT
	JSR	SIMNST		;GO SIMULATE
	MOVEI	CRLF
	PNTA
	JRST	@EROUT

SENTRY:	SKIPE	MASK		;ALLOW PRINTOUT ?
	JRST	SMNST1		;NO
	JRST	SMMT1		;YES

RAND:	BLOCK	10
INSBLK:	BLOCK	10
ANSBLK:	BLOCK	10
FSTANS:	BLOCK	10
SAVAC:	BLOCK	20
SIMBLK:	BLOCK	^D10
;SIMULATE AND PRINT ALL INSTRUCTIONS
;FAST LOOP RELIABILITY/SPEED FAILURE

SIMFST:	MOVEI	[ASCIZ/

INSTRUCTION SIMULATION - FAST LOOP FAILURE
----------
/]
	PNTAL
	SETZM	MASK
	MOVE	[1,,SAVAC+1]
	BLT	SAVAC+17	;SAVE AC'S
	MOVE	[INSBLK,,ACS+11]
	BLT	ACS+17		;SETUP INSTRUCTIONS
	MOVE	[RAND,,ACS]
	BLT	ACS+7
	SETZM	ACS+10		;SETUP OPEARANDS
	MOVEI	11
SIMFS1:	MOVEM	INPC		;SET INPC TO FIRST INSTRUCTION
	SETZM	INSTR
	SETZM	CNTLPC
	MOVEI	-1
	MOVEM	UPRPC
	MOVE	P,PLIST
	MOVEI	$PSHER
	PUSH	P,0
	GO	SENTRY		;GO TO SIMULATOR

	HRRZ	PC
	CAIE	17		;COMPLETED SIM ?
	JRST	SIMFS1		;NO
	MOVS	[1,,SAVAC+1]
	BLT	17		;RESTORE AC'S
	MOVEI	CRLF
	PNTA
	JRST	@EROUT