	.TITLE	LSD349
/
/  7 JUL 72 - FURTHER MODIFIED BY P. HENDERSON
/
JMS=JMS
//MIND-BLOWER -- SAN -- 8/11/68
/FOR USE WITH MODIFIED KALEIDOSCOPE AND MINSKYTRON
/MODIFIED FOR USE WITH PDP-9 ADVANCED SOFTWARE SYSTEM BY MMT
/
	.IODEV	-2,-3
IN=0
KB=-2
OUT=1
TTY=-3
IOPS=2
IDCF=700704
IDLA=700606
IDRC=700712
IDHE=701001
IDSI=700601
IDSP=700701
IDVE=700501
KRB=700312
KSF=700301
DCFH=IDCF
DCL=IDLA
DRC=IDRC
CLON=700044
CLOF=700004
DJP=400000
	.DEFIN	TTCHECK,?A
	.WAITR	TTY,A
A=.+1
	.ENDM
/
	.DEFIN	SETCLOCK
	DAC	.+4	/SAVE CLOCK COUNT IN .TIMER LOCATION
	.TIMER	0,CLOCK
	.OCT
	LAC	.-1	/SAVE PREVIOUS AC, JUST IN CASE.
	.ENDM
/
	.DEFIN	CLSF
	JMS	CFLCH
	.ENDM
	.DEFIN	DSI
	JMS	DFLCH
	.ENDM
	.DEFIN	DSH
	JMS	DFLCH
	.ENDM
	.DEFIN	DSV
	JMS	DFLCH
	.ENDM
	.DEFIN	DSP
	JMS	LPFCH
	.ENDM
	.IFUND	NOTRACK
	
TRACKER	0
	DAC TRSAV	/TRACKER JUST SAVES PARTIAL MACHINE STATE
	LAC TRACKER	/FROM TIME TO TIME THROUGH THE PROGRAMME
	SAD	OLTRACK	/AND NOTES HOW MANY CONSECUTIVE
	JMP AGAIN	/TIMES IT WAS CALLED FROM THE SAME
	DAC	OLTRACK	/LOCATION.
	DZM	TRCNT
AGAIN	ISZ	TRCNT	/INCREMENT CALL COUNT
	SKP
	HLT		/IF WE GET 2^18 CALLS,SOMETHING'S WRONG
	LAC	TRSAV	/RESTORE AC
	JMP*	TRACKER
OLTRACK	0
TRCNT	0
TRSAV	0
	.DEFIN	TRACK
	JMS	TRACKER
	.ENDM
	.ENDC
	.IFDEF	NOTRACK	/IF NOTRACK IS DEFINED, IGNORE TRACKER
	.DEFIN	TRACK
	.ENDM
	.ENDC
PATCH	.BLOCK	40	/AREA SAVED FOR PATCHING
MSG	MSG-MSGEND/2*1000
	0
	.ASCII "STRIKE A KEY AND LOOK AT THE SCOPE"<15>
MSGEND=.
/
/
/***************INTERRUPT INTERCEPTION MODULE ***********
.SCOM=100
INTINIT	0
	LAC*	(.SCOM+2	/CONTAINS FIRST FREE LOCATION
	DAC	ONEFREE#	/SAVE POINTER
	TAD	(1
	DAC	TWOFREE#	/SECOND FREE LOCATION
	TAD	(1
	DAC*	(.SCOM+2	/MAKE THE SCOM TABLE CORRECT
	LAC*	(2	/GET THE INTERRUPT LOCATION ENTRY
	DAC*	ONEFREE	/AND SAVE IT FOR LATER USE
	LAC	(SERVICE	/GET POINTER TO LOCAL SERVICE ROUTINE
	DAC*	TWOFREE	/SAVE IT IN BANK ZERO
	LAC	TWOFREE	/GET ADDRESS OF THE POINTER
	AND	(760000	/CHECK FOR REALLY BANK ZERO
	SZA
	HLT		/ERROR HALT. COULD BE ERROR JUMP
	LAC	TWOFREE	/OK. GET THE POINTER ADDRESS
	TAD	(JMP*	/MAKE IT INTO A JUMP TO THE SERVICE ROUTINE
	DAC*	(2	/IN THE INTERRUPT LOCATION
	JMP*	INTINIT	/THAT'S ALL, FOLKS
/
/************THE SERVICE MODULE**************
/
SERVICE	DAC	INTSAVE#	/SAVE AC. THIS ENTRY IS RIGHT FROM
	LAC*	(0	/LOCATION 2 ON PI ENTRY
	DAC	INTRETURN#	/SAVE RETURN POINTER
	JMS	FLAGCHECK	/CHECK LOCAL FLAGS
	LAC	INTSAVE	/RESTORE AC
	NOP		/PLACE TO PUT CHECKING HALT
	JMP*	ONEFREE	/LOCAL CHECK FAILS, NOW DO THE ADSS CHECK
INTEXIT	LAC	INTSAVE	/LOCAL CHECK SUCCEEDS, EXIT FROM INTERRUPT
	DBR		/RETURN MIGHT BE FROM API LEVEL
	XCT	.+1
	JMP*	INTRETURN	/THEN GO.
/
/FLAG CHECK ROUTINE FOR MINDBLOWER (CLOCK AND 340 DISPLAY)
/
FLAGCHECK	0
	IDSI		/STOP FLAG FROM DISPLAY
	SKP
	JMP	DSINT
	IDHE		/HORIZONTAL EDGE FLAG
	SKP
	JMP	DSINT
	IDVE
	SKP		/VERTICAL EDGE FLAG
	JMP	DSINT
	IDSP		/LIGHT PEN HIT (SHOULDN'T HAPPEN)
	SKP
	JMP	LTPEN
	JMP*	FLAGCHECK	/FLAG SHOULD BE KNOWN TO ADSS IF IT
			/WAS NONE OF THESE.
/MINOR FLAG SERVICE ROUTINES
/
CLOCK	0		/CLOCK IS SUBROUTINE ACCESSED BY .TIMER
	DAC	INTSAVE
	CLA!CMA		/-1 TO CLFLAG
	DAC	CFLAG#
	LAC	CLOCK
	RAL		/RESTORE INTERRUPTED LINK
	LAC	INTSAVE	/AND AC
	JMP*	CLOCK
	.DEFIN	FLAGS,FLAGNAME,?R,?NO
R	0
	IOF
	ISZ	FLAGNAME	/CHECK WHETHER THE FLAG IS -1
	JMP	NO
	ISZ	R	/IT IS, SO SKIP INSTRUCTION AFTER CALL
	ION
	JMP*	R	/AND EXIT
NO	DZM	FLAGNAME	/IT ISN'T SO WARD OFF 2^18 OFLOW
	JMP	.-3	/AND EXIT WITHOUT SKIP
	.ENDM
	FLAGS	CFLAG,CFLCH,
	FLAGS	DFLAG,DFLCH
	FLAGS	LPFLAG,LPFCH
/
/NOW THE DISPLAY INTERRUPTS, UNDIFFERENTIATED
/
DSINT	CLA!CMA		/SET IT TO -1
	DAC	DFLAG#
DSEXIT	DCFH		/CLEAR ALL DISPLAY FLAGS
	JMP	INTEXIT	/AND SIMPLY GET RID OF LIGHTPEN
LTPEN	CLA!CMA		/SET LT PEN SOFTWARE FLAG
	DAC	LPFLAG#
	JMP	DSINT
/
/
INITAPI	0
	LAC*	(.SCOM+2	/POINTER TO FIRST FREE LOCATION
	DAC	THREE#FREE	/DEFINED IN PI INITIALIZATION
	LAC	(L2SAVE	/POINTER TO L2 SAVE ROUTINE
	DAC*	THREEFREE	/PLACED IN FREE LOCATION
	LAC	THREEFREE
	TAD	(1	/BRING SCOM TABLE UP TO DATE
	DAC*	(.SCOM+2
	LAC	THREEFREE	/NOW MAKE A JMS TO THE REAL DISPLAY
	TAD	(JMS*	/SERVICE ROUTINE IN THIS BANK
	DAC*	(70	/70 IS THE DISPLAY PORTAL ADDRESS
	JMP*	INITAPI	/AND WE ALREADY KNOW THAT ONEFREE IS
			/IN BANK ZERO, BECAUSE WE HAVE
			/INITIALIZED THE PI
/
/NOW THE LEVEL 2 SAVE ROUTINE, WHICH REALLY APPLIES ONLY TO THE
/DISPLAY INTERRUPT
/
L2SAVE	0
	DAC	L2AC#	/SAVE AC
	CLA!CMA		/SET SOFTWARE DISPLAY FLAG TO -1
	DAC	DFLAG
	DCFH		/CLEAR ALL DISPLAY FLAGS
	LAC	L2AC	/RESTORE AC
	DBR		/AND EXIT
	XCT	.+1
	JMP*	L2SAVE
/
/******************************************************
/
MNDBLO	IOF
	CAF
	EEM		/MAKE SURE OF EXTEND MODE
	JMS	INTINIT	/INITIALIZE THE PI LOCAL SERVICE ENTRY
	JMS	INITAPI	/INITIALIZE THE DISPLAY PORTAL
	ION	/START THE MESSAGE OUTPUT
	.INIT	TTY,OUT,CNTL
	.WRITE	TTY,IOPS,MSG,34
	.OCT
	.WAIT	TTY
	IOF
	CLON	/WAIT AN INDETERMINATE PERIOD FOR A TYPED
	KSF	/CHARACTER, SO CLOCK HAS SOMETHING IN IT TO
	JMP	.-1	/MAKE A RANDOM NUMBER WITH.
	KRB		/CLEAR KB BUFFER
	DAC	KBHIT#
	CLOF
	ION
	LAC (HLT
	DAC 21	/HALT IF PROGRAM CALS WHEN NOT IN EXTEND MODE
	LAC* (7
	ADD	KBHIT
	AND (176
	ADD BUFFT
	DAC BUFPTR
	LAC* BUFPTR
	ADD* (7
	ADD	KBHIT
	DAC ZARRAY	/PUT A REALLY RANDOM NUMBER IN ZARRAY
	.INIT	KB,IN,CNTL	/INITIALIZE KB FOR ^C, ^P
	LAC	(777000	/SET TIME FOR INTRO TEXT
	SETCLOCK
LOOP	LAC	(BEGTXT	/DISPLAY INTRO TEXT
	DCL
	JMS CHKSFL
	CLSF
	JMP LOOP
	JMS RAND
	DAC SAVERN
	JMP KALEID	/TO KALEIDOSCOPE FIRST
CNTL	XCT	SSMNSK	/SKP IF MINDBLOWER, NOP IF STRAIGHT MINSKY
	JMP	MNSKN
	.WAITR	KB,RUNTIMER
	.READ	KB,IOPS,INPUT,34
	.OCT
RUNTIMER	LAW	17740
	SETCLOCK
	CLSF
	JMP	.-1
	TRACK
	LAW	17700
	SETCLOCK
OFFMSG	LAW	OFFTXT	/START LT-PEN SWITCH OFF MESSAGE
	DCL
XLOOP	DSP	/CHECK FOR LIGHT PEN FLAG
	SKP
	JMP	GETOP	/DISPLAY EXIT MESSAGE IF LT PEN HIT
	JMS	CHKSFL	/CHECK SCOPE FLAG
	CLSF
	JMP	OFFMSG
	LAC (NOP
	DAC SSREVA
	DAC SSREVB
	DAC SSREVC
	LAC (SKP
	DAC SSXWRD
	DAC SSRANN
	DAC SSFAHL
	TTCHECK	..O1	/LOOK FOR FLOW CONTROL CHAR ON KB
	JMS READIN
	XCT	SSMNSK	/TO NORMAL MINSKYTRON IF NOP, MINDBLOWER
	JMP	MNSKN	/IF SKIP
CNTL1	JMS RAND
	TRACK
	DAC SAVERN
	AND (1700
	SNA
	JMP SETWRD	/ADD A MESSAGE TO DIPLAY EVERY
	LAC SAVERN
	AND (74	/   SIXTEEN PATTERNS OR SO
	SNA
	JMP RANNUM	/TAKE A RANDOM MINSKY NUMBER
	LAC SAVERN
	AND (63
	SNA
	JMS RANIF	/MESSAGE OR RANDOM MINSKY NO OR KALEID
	LAC SAVERN
	AND (17
	SNA
	JMP KALEID	/TO KALEIDOSCOPE
	LAC SAVERN
	AND (52
	SAD (50
	JMS SETFHL	/ADD FAHLES FOLLY TO DISPLAY
	LAW -1-21
	DAC CTR
	LAC	(SSCHAA
	DAC BUFPTR
	LAC (SKP
CNTL2	DAC* BUFPTR	/SET SENSE SWITCHES
	TRACK
	ISZ BUFPTR
	ISZ CTR
	JMP CNTL2
/MIND-BLOWER, PAGE 2
DISA	LAC SAVERN
	TRACK
	AND (3	/LOOK AT BITS 16-17
	SAD (2
	JMP VECA	/DISPLAY AS VECTOR
	DAC SAVDIS
	SZA
	JMP .+6
	LAC SAVERN
	AND (4
	SZA
	JMP VECA	/DISPLAY AS VECTOR
	JMP DISB	/NOT DISPLAYED ONE-EIGHTH OF TIME
	LAC (NOP
	DAC SSVECA
	LAC SAVDIS
	SAD (1
	JMP DISB	/DISPLAY AS POINT
	LAC (NOP
	DAC SSCHAA
	JMP GCHA	/DISPLAY AS CHARACTER
VECA	JMS SETSSW	/SET SENSE SWITCHES FOR VECTOR OPTIONS
	DAC SSRANA
	DAC SSVXPA
	DAC SSREVA
	DAC SSVCTA
	JMP DISB
	LAC SAVERN
	AND (1000
	SNA	/ADD CHARACTER TO VECTOR
	JMP DISB
GCHA	LAC (NOP
	DAC SSCHVA
	LAC SAVERN
	RTR
	AND (3
	SZA
	JMP GETAA
	SAD (1
	JMP GETAA
	JMS GETRCH	/GET RANDOM CHAR HALF THE TIME
GETAA	LAC (13737	/SET CHAR TO "A" OTHER TIMES
	DAC CHARA
/MIND-BLOWER, PAGE 3
DISB	LAC SAVERN
	TRACK
	RTR
	AND (3	/LOOK AT BITS 14-15
	SAD (2
	JMP VECB
	DAC SAVDIS
	SZA
	JMP .+6
	LAC SAVERN
	AND (20
	SZA
	JMP VECB
	JMP DISC
	LAC (NOP
	DAC SSVECB
	LAC SAVDIS
	SAD (1
	JMP DISC
	LAC (NOP
	DAC SSCHAB
	JMP GCHB
VECB	JMS SETSSW
	DAC SSRANB
	DAC SSVXPB
	DAC SSREVB
	DAC SSVCTB
	JMP DISC
	LAC SAVERN
	AND (2000
	SNA
	JMP DISC
GCHB	LAC (NOP
	DAC SSCHVB
	LAC SAVERN
	RTR;	RTR
	AND (3
	SZA
	JMP GETAB
	SAD (1
	JMP GETAB
	JMS GETRCH
GETAB	LAC (23737
	DAC CHARB
/MIND-BLOWER, PAGE 4
DISC	LAC SAVERN
	TRACK
	RTR;	RTR
	AND (3	/LOOK AT BITS 12-13
	SAD (2
	JMP VECC
	DAC SAVDIS
	SZA
	JMP .+6
	LAC SAVERN
	AND (1
	SZA
	JMP VECC
	JMP CNTLGO
	LAC (NOP
	DAC SSVECC
	LAC SAVDIS
	SAD (1
	JMP CNTLGO
	LAC (NOP
	DAC SSCHAC
	JMP GCHC
VECC	JMS SETSSW
	DAC SSRANC
	DAC SSVXPC
	DAC SSREVC
	DAC SSVCTC
	JMP CNTLGO
	LAC SAVERN
	AND (4000
	SNA
	JMP CNTLGO
GCHC	LAC (NOP
	DAC SSCHVC
	LAC SAVERN
	AND (3
	SZA
	JMP GETAC
	SAD (1
	JMP GETAC
	JMS GETRCH
GETAC	LAC (33737
	DAC CHARC
/MIND-BLOWER, PAGE 5
CNTLGO	LAC SAVERN
	RTL;	RTL
	RTL;	RTL
	AND (176	/BITS 0-5 GIVE INDEX FOR MINSKY NUMBER TABLE
	ADD BUFFT
	DAC BUFPTR
	LAC* BUFPTR	/GET NUMBER FROM TABLE
	XCT SSRANN
	JMS RAND	/RANDOM NO IF SS IS CLEARED
	DAC SETREG
	ISZ BUFPTR
	LAC* BUFPTR	/GET DURATION FROM TABLE
	RTL;	RTL
	JMS NEWTIM	/VARY TIME DEPENDING ON DISPLAY TYPE
	CMA
	SETCLOCK
	JMP MNSKYT	/TO MINSKYTRON
GETRCH	0	/GET A RANDOM CHAR AND RA2
	ISZ GETRCH
	AND (2
	SNA	/GET ONE OR TWO CHARS
	JMP GT2RCH
	JMS RAND
	AND (770000	/GET ONE RANDOM CHAR
	ADD (3737	/ADD ESCAPE CODE
	JMP* GETRCH
GT2RCH	JMS RAND
	AND (777700	/GET TWO RANDOM CHARS
	ADD (37
	JMP* GETRCH
RANNUM	LAC (NOP
	DAC SSRANN
	JMP CNTL1
RANIF	0	/TO KALEIDOSCOPE OR ADD MESSAGE OR GET
	TRACK
	LAC SAVERN
	AND (14
	SAD (4
	JMP KALEID
	TRACK
	SAD (10
	JMP SETWRD
	TRACK
	SAD (14
	JMP RANNUM
	TRACK
	JMP* RANIF
SETSSW
	JMS RAND
	TRACK
	DAC CHECK
	AND (1
	SNA
	JMP .+3
	LAC (NOP
	XCT* SETSSW	/SET RANDOM ORIGIN FOR VECTOR EVERY TWO
	ISZ SETSSW
	LAC CHECK
	AND (70
	SZA
	JMP .+3
	LAC (NOP
	XCT* SETSSW	/EXPAND VECTOR TO TWICE NORMAL SIZE
	ISZ SETSSW	/   EVERY EIGHT
	LAC CHECK
	AND (400
	SZA
	JMP .+3
	LAC (SKP
	XCT* SETSSW	/REVERSE VECTOR, DISPLAY AGAIN EVERY
	ISZ SETSSW	/   FOUR
	LAC CHECK
	AND (7000
	SZA
	JMP .+4
	LAC (NOP
	XCT* SETSSW	/DISPLAY IN VEC CONT MODE EVERY EIGHT
	SKP	/RA5 TO NOT GET CH
	ISZ SETSSW
	ISZ SETSSW
	JMP* SETSSW
/MIND-BLOWER, PAGE 6
SSMNSK	SKP	/NOP FOR STRAIGHT MINSKYTRON
SSCHAA	SKP	/NOP FOR CHARACTER ONLY
SSCHAB	SKP
SSCHAC	SKP
SSVECA	SKP	/SKP FOR VECTORS, NOP FOR POINTS
SSVECB	SKP
SSVECC	SKP
SSVXPA	SKP	/SKP FOR NORMAL, NOP FOR DOUBLED SIZE
SSVXPB	SKP
SSVXPC	SKP
SSRANA	SKP	/SKP FOR USUAL, NOP FOR RANDOM
SSRANB	SKP
SSRANC	SKP
SSCHVA	SKP	/SKP FOR NO CHAR, NOP FOR CHAR
SSCHVB	SKP
SSCHVC	SKP
SSVCTA	SKP	/NOP FOR VECTOR CONTINUE MODE
SSVCTB	SKP
SSVCTC	SKP
SSREVA	NOP	/SKP TO REVERSE VECTOR AND DISPLAY AGAIN
SSREVB	NOP
SSREVC	NOP
SSXWRD	SKP	/NOP TO DISPLAY ADDED WORD
SSRANN	SKP	/NOP TO GET RANDOM MINSKY NUMBER
SSFAHL	SKP	/NOP TO DISPLAY FAHLES FOLLY
REVERA	NOP
REVERB	NOP
REVERC	NOP
CHARA	373737
CHARB	373737
CHARC	373737
SAVDIS	0
SAVERN	0
SETFHL	0	/SET PARAMETERS FOR FAHLES FOLLY
	TRACK
	LAC (NOP
	DAC SSFAHL
	JMS RAND
	AND (1777
	DAC XC
	JMS RAND
	AND (1777
	DAC Y
	JMS RAND
	AND (1777
	DAC X0
	JMS RAND
	AND (1777
	DAC Y0
	JMP* SETFHL
/MIND-BLOWER, PAGE 7
/TABLE OF GOOD MINSKYTRON NUMBERS AND TIMINGS IN SECONDS
/SIXTY-FOUR NUMBERS IN ALL...
BUFPTR	0
BUFFT	.+1
	761665;	130	/00
	125436;	120
	16663;	100
	14353;	15
	44177;	50
	771777;	340
	767415;	10
	17073;	20
	22726;	24	/10
	403575;	40
	207722;	40
	11347;	30
	677;	30
	734176;	140
	456;	40
	215436;	50
	217435;	100	/20
	555177;	140
	11447;	60
	555177;	100
	666177;	240
	770774;	60
	564720;	40
	550473;	40
	542071;	110	/30
	100077;	20
	551072;	40
	542210;	32
	514076;	35
	770757;	140
	26354;	100
	543467;	40
	555175;	60	/40
	372277;	130
	222177;	45
	777176;	200
	333177;	45
	666174;	40
	444277;	60
	534220;	40
	771775;	100	/50
	473615;	10
	665561;	20
	216651;	35
	753120;	40
	362511;	32
	36712;	50
	31767;	30
	11447;	60	/60
	300077;	40
	365760;	5
	342511;	10
	665516;	4
	66520;	3
	364650;	12
	363557;	3
	243575;	4	/70
	717276;	4
	773765;	15
	100075;	4
	4443;	20
	403377;	50
	443777;	10
	400073;	20	/77
/MIND-BLOWER, PAGE 8
/SCOPE CODED TEXTS
BEGTXT	020134	/SCOPE CONDING FOR INTRO TEXT
	020512
	261400
BEGTX1	270514	/WEL	  E	GOO
	031715	/COM	NJO	D-B
	054024	/E T	YIN	YE 
	174024	/O T	G T	FRO
	100537	/HE	HE	M
BEGTX2	020157
	060612
	334040
	331533	/LF,M,LF
	113316	/I,LF,N
	330433	/LF,D,LF
	553302	/-,LF,B
	331433	/LF,L,LF
	173327	/O,LF,W
	330533	/LF,E,LF
BEGTX3	223737	/R	R,LF,?	R,LF,^
	020132
	021600
	260000
	230116	/SAN
	373737
	003000
LOVTXT	020132
	XX
	XX
	141726	/LOVE IS RANDOM
	054011
	234022
	011604
	171537
	003000
WRKTXT	020132
	XX
	XX
	271031	/WHY ARENT YOU WORKING?
	400122
	051647
	244031
	172540
	271722
	131116
	077737
	003000
PCETXT	020173
	XX
	XX
	200501	/PEACE
	030537
	003000
OFFTXT	034155	/PAR TO PT MODE, SET LPEN, SCALE 4, INT 5
	221400		/Y COORDINATE
	060020	/X COORDINATE, AND SET CHARACTER MODE
	.SIXBT	"YOU CAN STOP THIS CRAZY"<34>
	.SIXBT	<33>"THING BY HITTING THIS"<34><33>
	.SIXBT	"MESSAGE WITH THE LIGHT PEN."<37>
	003000		/DISPLAY STOP.
/MIND-BLOWER, PAGE 9
SETQRY	/CHANGE INTRO BUFFER TO CONTAIN TEXT FOR
		/   "ENJOYING THE MINDBLOWER?"
	LAC (20134
	DAC BEGTXT
	LAC (404005
	DAC BEGTX1
	LAC (161217
	DAC BEGTX1+1
	LAC (311116
	DAC BEGTX1+2
	LAC (074024
	DAC BEGTX1+3
	LAC (20153
	DAC BEGTX2
	LAC (223377
	DAC BEGTX3
	LAC (373737
	DAC BEGTX3+1
	LAC (3000
	DAC BEGTX3+2
	LAC (JMP* SETQRY	/CHANGE ONLY ONCE
	DAC SETQRY+1
	JMP* SETQRY
SETWRD	LAC	(NOP	/SET MESSAGE TO ADD TO DISPLAY
	DAC SSXWRD	/CLEAR SENSE SWITCH
	LAC SAVERN
	TRACK
	RTL;	RTL
	AND (7	/LOOK AT BITS 0-2
	SAD (0
	JMP SETWRK
	AND (3
	SAD (1
	JMP SETLOV
	SAD (2
	JMP SETPCE
	JMS SETQRY	/MESSAGE IS "ENJOYING..."
	LAC	(BEGTXT
SETWEX	DAC DISPA1
	JMP CNTL1
DISPA1	0	/ADDRESS AT WHICH MESSAGE STARTS
SETWRK	JMS	RAND	/MESSAGE IS "WHY ARENT YOU WORKING
	AND (1277
	ADD (20000
	DAC WRKTXT+1
	JMS RAND
	AND (1760
	ADD (260000
	DAC WRKTXT+2	/GET RANDOM X,Y COORDINATES
	LAC	(WRKTXT
	JMP SETWEX
SETPCE	JMS	RAND	/MESSAGE IS "PEACE"
	AND (1400
	ADD (20000
	DAC PCETXT+1
	JMS RAND
	AND (1700
	ADD (260000
	DAC PCETXT+2	/SET RANDOM COORDINATES
	LAC	(PCETXT
	JMP SETWEX
SETLOV	JMS	RAND	/MESSAGE IS "LOVE IS RANDOM"
	AND (1277
	ADD (20000
	DAC LOVTXT+1
	JMS RAND
	AND (1760
	ADD (260000
	DAC LOVTXT+2	/SET RANDOM COORDINATES
	LAC	(LOVTXT
	JMP SETWEX
/MIND-BLOWER, PAGE 10
NEWTIM	/EXPAND TIME FOR PATTERN TO RUN
		/   DEPENDING ON OPTIONS CHOSEN
	DAC CHECK
	RCR
	DAC HALF
	RCR
	DAC ADDTIM
	RCR
	DAC EIGHTH
	LAC ADDTIM
	XCT SSVECA;	SKP;	ADD HALF
	XCT SSVECB;	SKP;	ADD HALF
	XCT SSVECC;	SKP;	ADD HALF
	XCT SSREVA;	SKP;	ADD HALF
	XCT SSREVB;	SKP;	ADD HALF
	XCT SSREVC;	SKP;	ADD HALF
	XCT SSCHVA;	ADD EIGHTH
	XCT SSCHVB;	ADD EIGHTH
	XCT SSCHVC;	ADD EIGHTH
	ADD CHECK
	JMP* NEWTIM
HALF	0
ADDTIM	0
EIGHTH	0
GETOP	NOP	/GIVE FINAL MESSAGE AND CALL OP
	LAC (071717	/CHANGE INTRO BUFFER TO CONTAIN TEXT FOR
	DAC BEGTX1	/   "GGOD-BYE FROM MIND-BLOWER^"
	LAC (045502
	DAC BEGTX1+1
	LAC (310540
	DAC BEGTX1+2
	LAC (062217
	DAC BEGTX1+3
	LAC (153737
	DAC BEGTX1+4
	LAC (223341
	DAC BEGTX3
	LAC (373737
	DAC BEGTX3+1
	LAC (3000
	DAC BEGTX3+2
	LAW 17000
	SETCLOCK
	LAC	(BEGTXT
	DCL
	JMS CHKSFL
	CLSF
	JMP .-4
	JMP CALOP	/CALL OPERATOR
/MIND-BLOWER, PAGE 11
CALOP	.EXIT		/RETURN TO NON-EXISTENT MONITOR
/ANGLES, DN, 3-16-66
/ASSEMBLE WITH RAND
/WITH MODIFICATIONS FOR MIND-BLOWER BY SAN
KALEID	LAC SAVERN
	RTR;	RTR
	AND (3
	ADD (LAW -1-5
	DAC CTR2
ANGDPY	JMS RAND
	DAC MGKNUM
	AND MSK
	ADD K
	CMA
	DAC CTR
	JMS SETANG
ANGDP1	JMS ANGLES
	TRACK
	ISZ CTR
	JMP ANGDP1
	ISZ CTR2
	JMP ANGDPY
	JMP CNTL
CTR	0
CTR2	0
MSK	1777
K	100
SETANG
	LAC MGKNUM	/MAGIC NUMBER
	AND (177777
	ADD (600000
	DAC SLOPE
	LAC	(LINE0
	JMS PLOT
	JMP* SETANG
ANGLES
	LAC	(LINE
	JMS PLOT
	JMP* ANGLES
MGKNUM	030014	/ALSO TRY 401201,400405,401222,030014,040020
PLOT
	IOF
	DCL
	DSH
	SKP;	JMP REVERSE
	DSV
	SKP;	JMP REVERSE
	DSP
	SKP;	JMP REVERSE
	JMP PLOT+3
REVERSE	LAC SLOPE	/OR TAD SLOPE IF VELOCITY IS WANTED
	TRACK
	AND (177777
	ADD (600000
	DAC SLOPE
	DRC
	TRACK
	AND (777
	SAD (0
	JMP VERTTOP
	SAD (777
	JMP VERTBOT
	DRC
	AND (777000
	SAD (0
	JMP HORRT
	SAD (777000
	JMP HORLFT
	JMP RESETP+3
/ANGLES PAGE2
VERTTOP	LAC (201774
	SKP
VERTBOT	LAC (200007
	DAC RESET
	JMP VERT
HORRT	LAC (001770
	SKP
HORLFT	LAC (000007
	DAC RESET
	JMP HOR
VERT	LAC	SLOPE	/CHANGE THE SLOPE OF DELTA Y
	XOR (100000
	DAC SLOPE
	LAC	(RESET0
	JMP RESETP
HOR	LAC	SLOPE	/CHANGE THE SLOPE OF DELTA X
	XOR (200
	JMP VERT+2
RESETP	DCL
	DSI
	JMP .-1
	TRACK
	DCFH
	JMP* PLOT
LINE0	030115	/TO POINT MODE
	221002	/Y = 1002
	000000	/X = 0
LINE	120015	/TO VECT CONT OR 020000 FOR VECTOR
SLOPE	730014
	003000
RESET0	020000	/TO POINT MODE
RESET	0	/RESET THE PROPER AXIS
	3000	/STOP
	3000	/AN EXTRA STOP, JUST IN CASE
/RAND -  A RANDOM NUMBER GENERATOR, EBN(JM), 12-15-65
RAND
	LAC* ZEKE
	ISZ ZEKE
	ADD* ZEKE
	DAC* ZEKE
	ISZ ZEKECT
	JMP* RAND
	LAC ZEKSET
	DAC ZEKECT
	LAC ZESTAR
	DAC ZEKE
	LAC ZARRAY+20
	DAC ZARRAY
	JMP* RAND
ZARRAY	213616;	520634;	174030;	172416
	606510
	533407;	405264;	205727;	327304
	317401;	477454;	625742;	416766
	761172;	006531;	365100;	321553
ZEKECT	-1-17	/VARIABLE COUNT
ZEKSET	-1-17	/USE TO RESET COUNT
ZEKE	ZARRAY	/VARRIABLE WORD LOCATION
ZESTAR	ZARRAY	/USE TO RESET LOCATION
/NEW TRON OF MINSKY, MODIFIED BY SAN, 7/28/68
MNSKYT	LAC SETREG
	TRACK
	JMS SETUP
	DAC SHFTCX	/JMP R10-I5 TO	SHFTCX
	LAC SETREG
	RCR;	RCR;	RCR
	JMS SETUP
	DAC SHFTCY	/	I4	SHFTCY
	LAC SETREG
	RCR;	RCR;	RCR
	JMS SETUP
	DAC SHFTBX	/	I3	SHFTBX
	LAC SETREG
	RCR;	RCR;	RCR
	JMS SETUP
	DAC SHFTBY	/	I2	SHFTBY
	LAC SETREG
	RCR;	RCR;	RCR
	JMS SETUP
	DAC SHFTAX	/	I1	SHFTAX
	LAC SETREG
	RCR;	RCR;	RCR
	JMS SETUP
	DAC SHFTAY	/	I0	SHFTAY
	TRACK
	LAC (1000	/SET ORIGINAL A,B,C LOCATIONS
	DAC XTEMA
	LAC (1010
	DAC XTEMB
	LAC (770
	DAC XTEMC
	ADD (-1-1
	DAC YTEMA
	DAC YTEMB
	LAC (1006
	DAC YTEMC
	LAC (NOP	/CLEAR FIRST PASS SS
	DAC SETSS
	LAC (JMP APNT1
	DAC JMPAPT
	JMP APOINT
APNT1	LAC (SKP	/SET FIRST PASS SS
	TRACK
	DAC SETSS
	LAC (JMP APOINT
	DAC JMPAPT
/NEW TRON, PAGE 2
APOINT	LAC	SSREVA	/DISPLAY A
	DAC REVERA
	LAC SSREVB
	DAC REVERB
	LAC SSREVC
	DAC REVERC
	LAC (NOP
	DAC DSPCHC
	TTCHECK
	JMS	READIN
	XCT	SSMNSK	/SKIP OR NOP SWITCH
	SKP		/SKIP CLOCK CHECK IF STRAIGHT MINSKY
MCLCK	CLSF
	SKP
	JMP CNTL	/GET NEW PATTERN WHEN CLOCK ELAPSES
	XCT SSXWRD
	JMS DISWRD	/DISPLAY EXTRA MESSAGE IF DESIRED
	XCT SSFAHL
	JMS DSPFHL	/DISPLAY FAHLES FOLLY IF DESIRED
	LAC XTEMA
	CMA
	ADD XTEMB
	CMA	/AX - BX
	JMS MOVEIT
SHFTAY	XX	/DIVIDE BY 2^I0
	TRACK
	ADD YTEMA
	DAC YTEMA	/ADD TO Y COORDINATE
	CMA
	ADD YTEMB
	CMA	/AY - BY
	JMS MOVEIT
SHFTAX	XX	/DIVIDE BY 2^I1
	TRACK
	CMA
	ADD XTEMA
	DAC XTEMA	/SUBTRACT FROM X COORDINATE
	AND (1777
	XCT SSCHAA
	JMP SHFTA1	/TO GET CHAR, DO NOT INTENSIFY POINT
	XCT SSVECA
	JMS DISPPT	/SET FOR POINT, INTENSIFIED
	ADD (100000	/SET FOR VECTOR
SHFTA1	DAC XWORD
	LAC YTEMA
	AND (1777
	ADD (220000
	DAC YWORD
	JMS SETPAR	/SET DISPLAY PARAMETER AND STOP WORDS
	XCT SSVECA
	JMP DISPLA	/DISPLAY NOW UNLESS VECTOR
	XCT SETSS
	JMP SETA	/SET ORIGINS IF FIRST PASS
	LAC SAVEAX
	DAC OLDX
	LAC SAVEAY
	DAC OLDY
	JMS SETDIS	/SET UP VECTOR DISPLAY
	XCT SSVXPA
	JMS EXPAND	/DOUBLE VECTOR SIZE IF DESIRED
	XCT SSVCTA
	JMS VECCON	/DISPLAY IN VEC CONT MODE IF DESIRED
DISPLA	LAC	(DSPADR
	DCL
	JMS CHKSFL
	XCT REVERA
	JMP DSPCHA
	LAC (NOP
	DAC REVERA
	LAC (JMP BPOINT
	DAC DSPCHA	/SUPPRESS CHAR DISPLAY IF VECTOR REVERSED
	JMS REVRSE	/REVERSE VECTOR AND DISPLAY AGAIN
	JMP DISPLA
DSPCHA	NOP
	LAC CHARA
	XCT SSCHVA
	JMS DISPCH	/DISPLAY CHARACTER
/NEW TRON, PAGE 3
BPOINT	LAC (NOP	/DISPLAY B
	TRACK
	DAC DSPCHB
	LAC XTEMB
	CMA
	ADD XTEMC
	CMA
	JMS MOVEIT
SHFTBY	XX
	ADD YTEMB
	DAC YTEMB
	CMA
	ADD YTEMC
	CMA
	JMS MOVEIT
SHFTBX	XX
	CMA
	ADD XTEMB
	DAC XTEMB
	AND (1777
	XCT SSCHAB
	JMP SHFTB1
	XCT SSVECB
	JMS DISPPT
	ADD (100000
SHFTB1	DAC XWORD
	LAC YTEMB
	AND (1777
	ADD (220000
	DAC YWORD
	JMS SETPAR
	XCT SSVECB
	JMP DISPLB
	XCT SETSS
	JMP SETB
	LAC SAVEBX
	DAC OLDX
	LAC SAVEBY
	DAC OLDY
	JMS SETDIS
	XCT SSVXPB
	JMS EXPAND
	XCT SSVCTB
	JMS VECCON
DISPLB	LAC	(DSPADR
	DCL
	JMS CHKSFL
	XCT REVERB
	JMP DSPCHB
	LAC (NOP
	DAC REVERB
	LAC (JMP CPOINT
	DAC DSPCHB
	JMS REVRSE
	JMP DISPLB
DSPCHB	NOP
	LAC CHARB
	XCT SSCHVB
	JMS DISPCH
/NEW TRON, PAGE 4
CPOINT	LAC (NOP	/DISPLAY C
	TRACK
	DAC DSPCHB
	LAC XTEMC
	CMA
	ADD XTEMA
	CMA
	JMS MOVEIT
SHFTCY	XX
	ADD YTEMC
	DAC YTEMC
	CMA
	ADD YTEMA
	CMA
	JMS MOVEIT
SHFTCX	XX
	CMA
	ADD XTEMC
	DAC XTEMC
	AND (1777
	XCT SSCHAC
	JMP SHFTC1
	XCT SSVECC
	JMS DISPPT
	ADD (100000
SHFTC1	DAC XWORD
	LAC YTEMC
	AND (1777
	ADD (220000
	DAC YWORD
	JMS SETPAR
	XCT SSVECC
	JMP DISPLC
	XCT SETSS
	JMP SETC
	LAC SAVECX
	DAC OLDX
	LAC SAVECY
	DAC OLDY
	JMS SETDIS
	XCT SSVXPC
	JMS EXPAND
	XCT SSVCTC
	JMS VECCON
DISPLC	LAC	(DSPADR
	DCL
	JMS CHKSFL
	XCT REVERC
	JMP DSPCHC
	LAC (NOP
	DAC REVERC
	LAC (JMP APOINT
	XCT SETSS
	LAC (JMP APNT1
	DAC DSPCHC
	JMS REVRSE
	JMP DISPLC
DSPCHC	NOP
	LAC CHARC
	XCT SSCHVC
	JMS DISPCH
JMPAPT	JMP APOINT	/JMP APNT1 ON PASS 1, ELSE JMP APOINT
/NEW TRON, PAGE 5
SETUP
	DAC SETREG
	AND (7
	ADD (LAC JMPTAB
	DAC .+1
	XX	/LAC JMPTAB+I
	JMP* SETUP
JMPTAB	JMP R10	/DIVIDE BY   2
	JMP R7	/	   4
	JMP R6	/	   8
	JMP R5	/	  16
	JMP R4	/  	  32
	JMP R3	/	  64
	JMP R2	/	 128
	JMP R1	/	 256
MOVEIT
	XCT* MOVEIT	/JMP R10-I
R1	JMS SHIFTR	/SHIFT RIGHT 10
R2	JMS SHIFTR
R3	JMS SHIFTR
R4	JMS SHIFTR
R5	JMS SHIFTR
R6	JMS SHIFTR
R7	JMS SHIFTR
R10	JMS SHIFTR	/SHIFT RIGHT 1
	TRACK
	ISZ MOVEIT
	JMP* MOVEIT
SHIFTR	/ROTATE AC ONE RIGHT, PRESERVING SIGN
	SPA+CLL-OPR
	CML
	RAR
	JMP* SHIFTR
DSPADR	20115	/DISPLAY BUFFER
YWORD	XX
XWORD	XX
VECTOR	XX
	3000;	3000;	3000
	3000;	3000;	3000
	3000;	3000;	3000
	3000;	3000;	3000
	3000;	3000;	3000
	3000
XTEMA	0
XTEMB	0
XTEMC	0
YTEMA	0
YTEMB	0
YTEMC	0
SETREG	0
/NEW TRON, MODIFIED BY SAN -- PAGE 6
SETA	XCT	SSRANA	/SAVE ORIGIN POINT OF A
	JMS SETRAN	/GET RANDOM ORG IF SS CLEARED
	LAC XWORD
	DAC SAVEAX
	LAC YWORD
	DAC SAVEAY
	JMP BPOINT
SETB	XCT	SSRANB	/SAVE ORIGIN OF POINT B
	JMS SETRAN
	LAC XWORD
	DAC SAVEBX
	LAC YWORD
	DAC SAVEBY
	JMP CPOINT
SETC	XCT	SSRANC	/SAVE ORIGIN OF C
	XCT SSRANC
	JMS SETRAN
	LAC XWORD
	DAC SAVECX
	LAC YWORD
	DAC SAVECY
	JMP APNT1
SETRAN	/SET X,Y DISPLAY COORDS TO RANDOM VALUES
	JMS RAND
	AND (1777
	ADD (100000
	DAC XWORD
	JMS RAND
	AND (1777
	ADD (220000
	DAC YWORD
	JMP* SETRAN
SAVEAX	0
SAVEAY	0
SAVEBX	0
SAVEBY	0
SAVECX	0
SAVECY	0
OLDX	0
OLDY	0
TEMPX	0
TEMPY	0
SETSS	NOP
/NEW TRON, MODIFIED BY SAN -- PAGE 7
DISPCH	/DISPLAY A CHARACTER
	DAC YWORD	/ENTER WITH CHAR WORD IN AC
	LAC (3000
	DAC XWORD
	LAC (060134
	DAC DSPADR	/SET TO CHAR MODE
	LAC	(DSPADR
	DCL
	JMS CHKSFL
	JMP* DISPCH
DISWRD	/DISPLAY ADDED WORD
	LAC DISPA1
	DCL
	JMS CHKSFL
	JMP* DISWRD
DISPPT
	ADD (2000	/SET INTENSIFY BIT TO DISPLAY POINT
	ISZ DISPPT
	JMP* DISPPT
DSPFHL	/DISPLAY FAHLES FOLLY
	LAW -1-30
	DAC CTR
	JMS CIRCLE
	JMS CHKSFL
	ISZ CTR
	JMP .-3	/DISPLAY A FEW POINTS BEFORE EXITING
	JMP* DSPFHL
EXPAND	/CHANGE DISPLAY TO SCALE 01 TO DOUBLE
	LAC (20135
	DAC DSPADR
	JMP* EXPAND
CHKSFL	/WAIT FOR SCOPE FLAG
	DSI
	SKP;	JMP* CHKSFL
	DSH
	SKP;	JMP* CHKSFL
	DSV
	JMP CHKSFL+1;	JMP* CHKSFL
SETPAR	/SET PARAMETER MODE WORD AND STOP WORD
	TRACK
	LAC (20117
	DAC DSPADR
	LAC (3000
	DAC VECTOR
	JMP* SETPAR
/NEW TRON, MODIFIED BY SAN -- PAGE 8
SETDIS	/SET UP DISPLAY BUFFER TO GIVE VECTOR
	LAC (20115
	DAC DSPADR
	LAC	(VECTOR-1
	DAC BUFPTR
	LAC XWORD
	DAC TEMPX
	LAC OLDX
	DAC XWORD
	LAC YWORD
	DAC TEMPY
	LAC OLDY
	DAC YWORD
	JMP SETD2
SETD1	CLL	/CHANGE OLDX, OLDY BY LENGTH OF ALREADY
	TRACK
	LAC TEMPX2
	AND (200
	SZA
	STL
	JMS SETOX
	CLL
	LAC CTR2
	SZA
	STL
	JMS SETOY
SETD2	DZM TEMPX2
	TRACK
	DZM TEMPY2
	DZM CTR
	DZM CTR2
	LAC OLDX
	CMA
	ADD TEMPX	/FIND DELTAX
	SAD (-1-0
	JMP SETD3
	CLL!SPA
	CMA!STL
	DAC CHECK
	AND (177
	SAD CHECK
	SKP
	JMS ROTAT	/DIVIDE BY 2 IF DELTAX G.T. 177
	SZL
	ADD (200	/PRESERVE SIGN BIT
	DAC TEMPX2
SETD3	LAC OLDY
	TRACK
	CMA
	ADD TEMPY	/FIND DELTAY
	SAD (-1-0
	JMP SETD4
	CLL!SPA
	CMA!STL
	JMS ROTIF	/DIVIDE IF DELTAX WAS DIVIDED
	DAC CHECK
	AND (177
	SAD CHECK
	SKP
	JMS ROTYT	/DIVIDE IF DELTAY G.T. 177
	SZL
	ADD (200	/PRESERVE SIGN BIT
	SZL
	ISZ CTR2
	DAC TEMPY2
	CLL
	RTL;	RTL
	RTL;	RTL	/SHIFT DELTAY TO APPROPRIATE POSITION
SETD4	ADD TEMPX2	/SET UP DISPLAY WORD WITH DELTAY, DELTAX
	TRACK
	ADD (200000	/SET INTENSIFY BIT
	ISZ BUFPTR
	DAC* BUFPTR	/DEPOSIT WORD
	LAC CTR
	SZA
	JMP SETD1	/FIND NEXT WORD IF VECTOR TOO SHORT
	LAC* BUFPTR
	ADD (400000
	DAC* BUFPTR	/SET ESCAPE BIT ON LAST VECTOR MODE WORD
	ISZ BUFPTR
	LAC (3000
	DAC* BUFPTR	/SET STOP CODE
	JMP* SETDIS
/NEW TRON, MODIFIED BY SAN -- PAGE 9
ROTAT	/ROTATE DELTAX RIGHT AND INDEX CTR UNTIL
	TRACK
		/   DELTAX L.T. 177
	LAC CHECK
	RCR
	ISZ CTR
	DAC CHECK
	AND (177
	SAD CHECK
	SKP
	JMP ROTAT+1
	LAC ROTAT
	RAL
	LAC CHECK
	JMP* ROTAT
ROTYT	/ROTATE DELTAX AND DELTAY RIGHT AND
	TRACK
		/   INDEX CTR UNTIL DELTAY L.T. 177
	CLL
	LAC TEMPX2
	AND (200
	SZA
	STL
	LAC TEMPX2
	AND (177
	SZL
	ADD (400
	RCR
	DAC TEMPX2
	LAC CHECK
	RCR
	ISZ CTR
	DAC CHECK
	AND (177
	SAD CHECK
	SKP
	JMP ROTYT+1
	LAC ROTYT
	RAL
	LAC CHECK
	JMP* ROTYT
ROTIF	/ROTATE AC RIGHT AS MANY PLACES AS
	TRACK
		/   DELTAX WAS ROTATED
	DAC CHECK
	LAC CTR
	SZA
	JMP ROTIF1
	LAC CHECK
	JMP* ROTIF
ROTIF1	CMA
	DAC ROTTMP
	ISZ ROTTMP
	LAC CHECK
	RCR
	ISZ ROTTMP
	JMP .-2
	DAC CHECK
	LAC ROTIF
	RAL
	LAC CHECK
	JMP* ROTIF
ROTTMP
/NEW TRON, MODIFIED BY SAN -- PAGE 10
SETOX	/SET OLDX
	LAC TEMPX2
	SZL
	ADD (-1-200
	SZL
	CMA
	ADD OLDX
	DAC OLDX
	JMP* SETOX
SETOY	/SET OLDY
	LAC TEMPY2
	SZL
	ADD (-1-200
	SZL
	CMA
	ADD OLDY
	DAC OLDY
	JMP* SETOY
REVRSE	/REVERSE VECTOR DISPLAY
	LAC	(VECTOR
	DAC BUFPTR
REVER1	LAC* BUFPTR
	TRACK
	SAD (3000
	JMP* REVRSE
	XOR (100200	/CHANGE SIGN BITS OF INCREMENTS
	DAC* BUFPTR
	ISZ BUFPTR
	JMP REVER1
VECCON	/CHANGE DISPLAY TO VECTOR CONTINUE MODE
	TRACK
	LAC VECTOR
	AND (177777
	SNA
	JMP* VECCON	/DO NOT DISPLAY ZERO VECTOR IN VEC CONT
	ADD (600000
	DAC VECTOR
	LAC XWORD
	ADD (20000
	DAC XWORD	/CHANGE MODE OF PREVIOUS INSTRUCTION
	LAC (3000
	DAC VECTOR+1
	JMP* VECCON
TEMPX2	0
TEMPY2	0
CHECK	0
/FAHLE'S FOLLY, DN - KL - WF (JM), 5-23-65 (1)
/NEEDS SIGNED MULTIPLY
/CIRCLE CENTER IS AT X0, Y0
/CIRCLE PASSES THROUGH X, Y
/SPIRAL SPEED IS SET BY ACS
/SPIRAL SIZE IS LIMITED BY MASK
/CIRCLE IS A SUBROUTINE WITHOUT ANY EXIT, AH WELL
/NOT ANY LONGER, AH YES^
CIRCLE
	TRACK
	LAC (JMP PLOTPT
	DAC CIRC1
CIRCA	LAC Y
	CLL	/FAKE MULTIPLICATION
	SPA
	STL
	RAR
	ADD XC
	DAC XC	/X = X + AY
	CLL
	SPA
	STL
	RAR
	CMA
	ADD Y	/Y = Y - AY
	DAC Y
CIRC1	JMP PLOTPT
PLOTPT	ADD Y0
	AND (1777
	ADD (220000
	DAC PLOTY
	LAC XC
PLOTSP	ADD X0
	AND (1777
	ADD (002000
	DAC PLOTX
	LAC	(PLOT0
	DCL
	JMP* CIRCLE
/FAHLES FOLLY, PAGE 2
XC	0
Y	60
X0	1000
Y0	1000
XNEW	0
YNEW	0
Z	400
MASK	3777
FLAG	0
SAVE	0
PLOT0	030177
PLOTY	403700
PLOTX	403700
	003000
/
/
/GET7 UNPACKS AN ASCII 5/7 WORD PAIR INTO A 5-WORD CHARACTER
/BUFFER POINTED AT BY THE CALL+1. THE ASCII WORD PAIR IS 
/POINTED AT BY CALL+2. 
/CONSECUTIVE CALLS TO GET7 FROM THE SAME CALLING POINT (OR CALLS
/WITH THE SAME ARGUMENTS PROPERLY INCREMENTED) GET CONSECUTIVE
/CHARACTERS FROM THE ASCII BUFFER. THE CHARACTERS ARE RETURNED IN
/THE AC ON EXIT FROM GET7.
/THE ACTUAL POINTER TO THE NEXT CHARACTER TO BE RETURNED VIA THE
/AC IS AT THE TAIL OF THE 5-WORD BUFFER,MAKING THE BUFFER 6 WORDS
/LONG INCLUDING THIS POINTER.
/THE WORD AT CALL+2 IS INCREMENTED BY THE GET7 ROUTINE, SO THAT IT
/PROPERLY POINTS TO THE NEXT ASCII WORD PAIR READY FOR ANOTHER
/CALL. IT MUST BE INITIALIZED WHEN GET7 IS FIRST CALLED WITH A NEW
/BUFFERLOAD.
/
GET7	0
	LAC*	GET7	/PICK UP POINTER TO CHARACTER BUFFER
	ISZ	GET7
	DAC	BUF5PT
	ISZ*	BUF5PT	/CHARACTER NUMBER GOES FROM -5 TO -1
	JMP	NEXCHR	/INCREMENTS OK, GET NEXT FROM 5 LIST
ASCI5	LAC*	GET7	/GET ASCII BUFFER POINTER
	DAC	ASCIPTR
	LAC*	ASCIPTR	/GET FIRST WORD OF PAIR
	DAC	ONEASCI
	ISZ	ASCIPTR
	LAC*	ASCIPTR	/GET SECOND WORD OF PAIR
	DAC	TWOASCI
	ISZ	ASCIPTR
	LAC	ASCIPTR
	DAC*	GET7	/POINT TO NEXT ASCII PAIR
	LAC	(-5	/NOW INITIALIZE THE CHARACTER BUFFER
	DAC*	BUF5PT	/SAVE EMPTY COUNT IN POINTER WORD
	DAC	FILCT
	TAD	BUF5PT	/GET PROPER ADDRESS FOR CHARACTER
	DAC	FIL5PT
	LAC	TWOASCI	/START SPLITTING ASCII 5
	LMQ
	LAC	ONEASCII
	CLL
ASCILOOP	DAC	ASCAC	/SAVE AC FOR LOOP
	JMP	CH5FIL
	LAC	ASCAC	/RESTORE AC AFTER DESTRUCTION
	LLS+7		/SHIFT UP 7 BITS
	JMP	ASCILOOP	/DO THE NEXT ONE
CH5FIL	AND	(774000	/SPLIT OFF 7 BITS
	RTL;	RTL
	RTL;	RTL	/SHIFT 8 LEFT TO GET BY LINK
	DAC*	FIL5PT	/STORE THE CHARACTER
	ISZ	FIL5PT	/INCREMENT BUFFER POINTER
	ISZ	FILCT
	JMP	ASCILOOP+2	/DO THE NEXT
NEXCHR	LAC*	BUF5PT	/BUFFER INTO THE AC
	TAD	BUF5PT	/FIRST FORM THE ADDRESS
	DAC	BUF5PT
	LAC*	BUF5PT	/THEN GET THE CHARACTER
	ISZ	GET7
	JMP*	GET7	/AND EXIT
BUF5PT
ASCIPTR
ONEASCI
TWOASCI
FILCT
FIL5PT
ASCAC
GET7INIT	0
	DAC	ASCAC	/SAVE AC. WHY NOT?
	LAC*	GET7INIT	/POINTER TO CHARACTER BUFFER COUNT
	DAC	BUF5PT
	CLA!CMA
	DAC*	BUF5PT	/NOW GET7 WILL INITIALIZE CH BUF.
	LAC	ASCAC
	ISZ	GET7INIT
	JMP*	GET7INIT
	.EJECT
/**************MODS TO PERMIT STRAIGHT MINSKYTRON OPERATION*********
/
/
MNSKN	.WRITE	TTY,IOPS,MOUT,34	/"VALUE"
	TRACK
	.WAIT	TTY
	.WAITR	KB,KBWAIT	/KEYBOARD OPERATION MAY ALREADY BE PRIMED
	.READ	KB,IOPS,MNUM,34	/THE MINSKY NUMBER
	TRACK
KBWAIT	.WAIT	KB
	.OCT
	JMS	GETOCT	/GETS THE OCTAL NUMBER PRESUMED IN MNUM
	MNUM+2
	DAC	SETREG
	.WAITR	KB,MNSKYT
	.READ	KB,IOPS,MNUM,34	/PRIME TTCHECK FOR EXIT WITH CR
	TRACK
	.OCT
	JMP	MNSKYT	/THE MINDBLOWER VERSION IN POINT MODE
/
MNSKXIT	LAC	(SKP	/HERE ON L CODE, TO RETURN TO NORMAL
	DAC	SSMNSK	/MINDBLOWER OPERATION
	JMP	CNTL
/
GETOCT	0	/DECODE AN OCTAL NUMBER WITH NO LEADING ANYTHINGS.
	CLA!CMA
	DAC	OCTBUF	/SETUP GET7 BUFFER
	LAC*	GETOCT	/GET POINTER TO ASCII BUFFER
	ISZ	GETOCT	/SETUP EXIT
	DAC	OCTPTR	/SETUP GET7 ASCII POINTER
GETLOOP	JMS	GET7	/GET THE CHARACTERS ONE BY ONE
	OCTBUF
OCTPTR	0
	SAD	(130	/X CHARACTER SAYS GOODBYE
	JMP	GETOP
	DAC	NTEM	/SAVE PUTATIVE NUMBER
	SAD	(114	/L CHARACTER GOES TO MINDBLOWER
	JMP	MNSKXIT
	AND	(160	/NOW CHECK FOR OCTALITY
	SAD	(60
	JMP	OCT	/IT IS OK, REALLY OCTAL
OCTXIT	LAC	OCTNUM	/NOT OCTAL, END THE NUMBER
	JMP*	GETOCT	/AND EXIT
OCT	LAC	OCTNUM	/AUGMENT THE NUMBER
	AND	(77777	/CLEAR OFF THE TOP BITS
	DAC	OCTNUM
	LAC	NTEM	/NOW STRIP THE NEW DIGIT
	AND	(7
	RTR;	RAR	/3 BITS RIGHT
	ADD	OCTNUM
	RTL;	RAL	/AND BACK AGAIN, BUT WITH THE OLD PART
	DAC	OCTNUM	/SHIFTED UP
	JMP	GETLOOP	/NOW GET ANOTHER DIGIT
	.BLOCK	5	/BUFFER FOR GET7
OCTBUF	0
OCTNUM
NTEM
/
/
/
READIN	0	/CHECKS FOR CONTROL CHARACTERS STARTING LINES
	CLA!CMA
	DAC	RDBUF	/SETUP READ BUFFER COUNTER
	LAC	(INPUT+2
	DAC	RLOOP+2	/INITIALIZE BUFFER POINTER
RLOOP	JMS	GET7	/GET A CHARACTER
	RDBUF
	INPUT+2
	SAD	(115	/M CHARACTER GETS STRAIGHT MINSKY
	JMP	MCODE
	SAD	(130	/X CHARACTER SAYS GOODBYE
	JMP	GETOP
	SAD	(114	/L CHARACTER SAYS MINDBLOWER
	JMP	MNSKXIT
	SAD	(15	/CR MEANS END OF BUFFER WITH NO
	JMP	CNTL	/OTHER COMMAND, SO GET A NEW PATTERN
	JMP	RLOOP	/HAVEN'T HAD ANY OF THEM YET
	CLA!CMA
	JMP*	READIN	/EXIT WITH -1 IN AC (UNUSED FACILITY)
	.BLOCK	5
RDBUF
/
/
/
MCODE	LAC	(NOP	/HERE WHEN STRAIGHT MINSKY WANTED
	DAC	SSMNSK	/SET UP THE SENSE SWITCHES
	DAC	SSVECA
	DAC	SSVECB
	DAC	SSVECC
	LAC	(SKP
	DAC	SSVXPA
	DAC	SSVXPB
	DAC	SSVXPC
	DAC	SSRANA
	DAC	SSRANB
	DAC	SSRANC
	DAC	SSCHVA
	DAC	SSCHVB
	DAC	SSCHVC
	DAC	SSVCTA
	DAC	SSVCTB
	DAC	SSVCTC
	DAC	SSCHAA
	DAC	SSCHAB
	DAC	SSCHAC
ENDSWSET	JMP	MNSKN	/GO TO THE MINSKY READ LOCATION
/
/
/
/
/
/HEADER MACRO
	.DEFIN	HEADER,MBEG,MEND
MBEG	MEND-MBEG/2*1000
	0
	.ENDM
/
	HEADER	MOUT,MOUTEND
	.ASCII	"VALUE   "<175>
MOUTEND=.
INPUT=.
	HEADER	MNUM,MNUMEND
	.BLOCK	34
MNUMEND=.
	.END	MNDBLO
