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SMA
	JMP	RT2B
	LAC	L44
	DAC	ROT2
RT2B	JMS	DIR2
	JMP*	RT2
/
/  ESTABLISH DIRECTION COMPONENTS OF TURRET OF SHIP 1, AND PLACE
/  THEM IN DISPLAY FILE
/
DIR1	XX
	LAC	A600
	DAC	P2
	ADD	ROT1
	DAC	P1
	LAC*	P1
	DAC	Y1DM
	LAC	ROT1
	CMA
	ADD	L11
	SPA
	ADD	L44
	ADD	P2
	DAC	P1
	LAC*	P1
	DAC	X1DM
	DZM	TEMP
	LAC	Y1DM
	JMS	SGNMAG	/GET SIGN & MAGNITUDE OF Y-COMPONENT
	RTL
	RTL
	RTL
	RTL
	AND	L7400	/MAKE DY OF VECTOR
	DAC	TEMP
	LAC	X1DM
	JMS	SGNMAG	/GET SAME FOR X-COMPONENT
	ADD	TEMP
	DAC	TUR11
	ADD	L600T	/INTENSIFY 2ND VECTOR & ESCAPE
	DAC	TUR12
	JMP*	DIR1
/
/  ESTABLISH DIRECTION COMPONENTS FOR SHIP 2
/
DIR2	XX
	LAC	A600
	DAC	P2
	ADD	ROT2
	DAC	P1
	LAC*	P1
	DAC	Y2DM
	LAC	ROT2
	CMA
	ADD	L11
	SPA
	ADD	L44
	ADD	P2
	DAC	P1
	LAC*	P1
	DAC	X2DM
	DZM	TEMP
	LAC	Y2DM
	JMS	SGNMAG
	RTL
	RTL
	RTL
	RTL
	AND	L7400	/GET DY OF VECTOR
	DAC	TEMP
	LAC	X2DM
	JMS	SGNMAG
	ADD	TEMP
	ADD	L200T	/INTENSIFY 1ST VECTOR OF SHIP2 TURRET
	DAC	TUR21
	ADD	L400T	/AND ESCAPE
	DAC	TUR22
	JMP*	DIR2
/
FIRE1	XX
	LAC	L1
	DAC	F1
	JMP*	FIRE1
/
FIRE2	XX
	LAC	L1
	DAC	F2
	JMP*	FIRE2
/
AC8	XX
	NOP
	JMP*	AC8
/
AC9	XX
	NOP
	JMP*	AC9
/
DRIFT	XX
	LAC	X1
	ADD	X1D
	DAC	X1
	LAC	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MP*	SWITCH
/
	400000		/AC0
	200000
	100000
	40000
	20000		/AC4
	1000		/AC8
	400		/AC9
	20		/AC13
	10
	4
	2
	1
ACMASK	0
/
	LEFT1
	RT1
	REV1
	FOR1
	FIRE1
	AC8
	AC9
	LEFT2
	RT2
	REV2
	FOR2
	FIRE2
SUBTBL	0
	0
	0
DIRTBL	0
	3
	7
	12
	15
	17
	21
	23
	24
	24
	24
	23
	21
	17
	15
	12
	7
	3
	0
	777774
	777770
	777765
	777762
	777760
	777756
	777754
	777753
	777753
	777753
	777754
	777756
	777760
	777762
	777765
	777770
	777774
	0
	0
/
/  STOP INTERRUPT ROUTINE
/
STINT	DAC	DSAC
	LAC*	(0
	DAC	DSOUT
	LAC	FILER1
	JMP	DSGO
/
/  EDGE INTERRUPT ROUTINE
/
EDGE	DAC	DSAC
	LAC*	(0
	DAC	DSOUT
IDC	IDCF
	IDRA
	CMA
	TAD	L1
	TAD	FILER2	/FILER2-ADDR
	SPA
	JMP	.+3
	LAC	FILER2
	SKP
	LAC	FILER3
DSGO	IDLA
	LAC	DSAC
	ION
	DBR
	XCT	.+1
	JMP*	DSOUT
/
START	CAL		/SET UP FOR EDGE INTERRUPTS
DSAC	16
DSOUT	IDVE
	EDGE
	CAL
	16
	IDHE
	EDGE
	CAL
	16
	IDSI
	STINT
	DBK
	LAC	(JMP .+2
	DAC	START
	LAC	(20117	/INTENSIFY BOTH SHIPS
	DAC	SHIP1
	DAC	SHIP2
	LAC	L400T
	DAC	Y1	/INITIALIZE SHIP POSITIONS AND SHELL COUNTS
	DAC	Y2
	LAC	L200T
	DAC	X1
	LAC	L600T
	DAC	X2
	LAC	L10
	RCR
	DAC	TWAIT1
	LAC	L10.
	RCR
	DAC	TWAIT2
	LAC	L11
	DAC	ROT1
	JMS	DIR1
	LAC	L33
	DAC	ROT2
	JMS	DIR2
	DZM	X1D
	DZM	X2D
	DZM	Y1D
	DZM	Y2D
	LAC	L757
	DAC	SHC1
	DAC	SHC2
	DZM	S1WAIT
	DZM	S2WAIT
	LAC	A1162	/GET SHELL TABLE ADDRESS
	DAC	SHELLP
	DZM	WINNER
	LAC	L765
	DAC	COUNTR
	LAC	A1166
	DAC	SHELPT
CLEAR	DZM*	SHELPT	/CLEAR SHELL TABLE TO INDICATE NO SHELLS
	LAC	SHELPT	/ARE IN TRANSIT
	ADD	L5
	DAC	SHELPT
	ISZ	COUNTR
	JMP	CLEAR
	LAC	IDL
	DAC	DSGO
	LAC	FILER1
IDL	IDLA
/
/  MAIN LOOP RETURNS TO HERE.  CHECK FOR WINNER
/
LOOP	LAC	WINNER
	SNA!CMA
	JMP	PAST
	SMA!RAR
	JMP	.+3
	LAC	(20110
	DAC	SHIP1
	SML
	JMP	.+3
	LAC	(20110
	DAC	SHIP2
	JMP	.
/
PAST	JMS	SWITCH	/CHECK AC SWITCHES
	JMS	DRIFT	/SET ORIGINS FOR SHIPS
	JMS	CDRIFT	/CHANGE POSSIBLE DRIFT RATE
	JMP	CONTINUE
/
VEL	ISZ*	SHELPT	/CALCULATE SHELL VELOCITY
	JMP	.+1
	LAC	SHELPT
	ADD	L773
	DAC	SHELPT
	LAC*	SHELPT
	ISZ	SHELPT
	ADD*	SHELPT
	DAC*	SHELPT
	RTR
	RTR
	RTR
	RTR
	AND	L1776
	ADD	VPNT
	DAC*	SHOTPT
	ISZ	SHOTPT
	ISZ	SHELPT
	LAC*	SHELPT
	ISZ	SHELPT
	ADD*	SHELPT
	DAC*	SHELPT
	RTR
	RTR
	RTR
	RTR
	AND	L1776
	ADD	L142T
	DAC*	SHOTPT
	ISZ	SHOTPT
	LAC	VCTR
	DAC*	SHOTPT
	ISZ	SHOTPT
	LAC	L20T
	DAC*	SHOTPT
	ISZ	SHOTPT
	ISZ	SHELPT
	JMP	SHOTS1
/
HIT	XX
	LAC	A1537	/GET ADDRESS OF FIRST SHELL
	DAC	HITPNT
HIT1	LAC*	HITPNT
	SNA
	JMP*	HIT	/SHELL HAS EXPIRED
	AND	L1777	/GET Y-COORD
	CMA
	ADD	Y1Y2
	SMA
	CMA
	ADD	L21	/IS SHELL WITHIN 21 UNITS Y OF SHIP (1 OR 2)
	SMA
	JMP	HIT3	/MAY BE DISASTER.  CHECK X DIVERGENCE
	ISZ	HITPNT
HIT2	ISZ	HITPNT
	JMP	HIT1
HIT3	ISZ	HITPNT
	LAC*	HITPNT
	AND	L1777
	CMA
	ADD	X1X2
	SMA
	CMA
	ADD	L21	/IS SHELL WITHIN 21 UNITS X OF SHIP?
	SPA
	JMP	HIT2	/NO.  CHECK FOR NEXT SHELL
	LAC	T.WIN
	DAC	WINNER	/INDICATE WINNER
	JMP*	HIT
/
SHOOT	XX
	LAC*	COUNTR	/ARE WE OUT OF SHELLS?
	SMA
	JMP*	SHOOT	/YES
	LAC	COUNTR
	ADD	L1
	DAC	SHELPT
	LAC*	SHELPT
	SPA
	JMP*	SHOOT	/IF TOO SOON SINCE LAST SHELL, WAIT
	LAC	SHELLP
	SNA
	JMP*	SHOOT
	ISZ*	COUNTR	/COUNT SHELLS
	JMP	.+1
	LAC	WAIT
	DAC*	SHELPT	/RESET INTERVAL BETWEEN SHELLS
	LAC	T1160
	RCL
	RTL
	RTL
	AND	L7600
	ADD	TEMP2
	DAC*	SHELLP	/CHANGE YD & SAVE FOR SHELL
	ISZ	SHELLP
	LAC	T1160
	RCL
	RTL
	RTL
	RTL
	RTL
	AND	L7600	/CHANGE YDM AND SAVE FOR SHELL
	ADD	Y1Y2
	DAC*	SHELLP
	ISZ	SHELLP
	LAC	T1161
	RCL
	RTL
	RTL
	AND	L7600
	ADD	HITPNT
	DAC*	SHELLP
	LAC	T1161
	ISZ	SHELLP
	RCL
	RTL
	RTL
	RTL
	RTL
	AND	L7600
	ADD	X1X2
	DAC*	SHELLP
	ISZ	SHELLP
	LAC	L7377
	DAC*	SHELLP
	DZM	SHELLP
	JMP*	SHOOT
L7377	777377
WAIT	777717
SHC1
S1WAIT
SHC2
S2WAIT
COUNTR
SHELPT
HITPNT
TEMP2
SHOTPT
SHELLP
X1X2
Y1Y2
T.WIN
WINNER
T1160
T1161
SHL62	1200
	125201
	777777
	200000
SHELLS	0
	1200
	125201
	777777
	200000
	0
	1200
	125201
	777777
	200000
	0
	1200
	125201
	777777
	200000
	0
	1200
	125201
	777777
	200000
	0
	776400
	552201
	777777
	600000
	0
	776400
	552201
	777777
	600000
	0
	776400
	552201
	777777
	600000
	0
	776400
	552201
	777777
	600000
	0
	1421
	351310
	2315
	476476
	0
	774273
	407102
	777004
	572366
	777425
	.REPT	12
	0		/PROBABLY NOT NEEDED
/
CONTINU	LAC	A1537
	DAC	SHOTPT
	LAC	L765
	DAC	COUNTR
	LAC	A1166
	DAC	SHELPT
SHOTS	LAC*	SHELPT
	SPA
	JMP	VEL	/CHECK LAST ENTRY IN SHELL BLOCK TO SEE IF
	LAC	SHELPT	/THERE ARE ANY LIVE SHELLS
	ADD	L773
	DAC	SHELLP
SHOTS1	LAC	SHELPT
	ADD	L5
	DAC	SHELPT
	ISZ	COUNTR
	JMP	SHOTS
	DZM*	SHOTPT
	ISZ	SHOTPT
	LAC	STOP
	DAC*	SHOTPT
	LAC	X1C
	AND	L1777	/GET X-COORD OF SHIP 1
	DAC	X1X2
	LAC	X2C	/GET X-COORD OF SHIP 2
	AND	L1777
	CMA
	ADD	X1X2	/X1-X2
	SMA
	CMA
	ADD	L40	/ARE SHIPS WITHIN 40 UNITS X OF EACH OTHER?
	SPA
	JMP	NOBANG	/NO
	LAC	Y1C
	AND	L1777
	DAC	X1X2
	LAC	Y2C	/GET Y2
	AND	L1777
	CMA
	ADD	X1X2	/Y1-Y2
	SMA
	CMA
	ADD	L40	/ARE SHIPS WITHIN 40 UNITS Y OF EACH OTHER?
	SPA
	JMP	NOBANG	/NO
	LAC	TIE	/COLLISION!! - SET BOTH WINNERS
	DAC	WINNER
NOBANG	LAC	X1C
	AND	L1777
	DAC	X1X2
	LAC	Y1C
	AND	L1777
	DAC	Y1Y2	/GET Y1
	LAC	W2
	DAC	T.WIN	/SET INDICATOR TO SHIP 1 WIN
	JMS	HIT
	LAC	X2C
	AND	L1777	/GET X2
	DAC	X1X2
	LAC	Y2C
	AND	L1777	/GET Y2
	DAC	Y1Y2
	LAC	W1
	DAC	T.WIN	/SET TO SHIP 2 WIN
	JMS	HIT
	LAC	S1WAIT
	SPA
	ISZ	S1WAIT	/WAIT BETWEEN SHELLS
	JMP	.+1
	LAC	S2WAIT
	SPA
	ISZ	S2WAIT
	JMP	.+1
	LAC	F1	/DOES PILOT 1 WANT TO FIRE?
	SNA
	JMP	SHOOT2	/NO
	DZM	F1
	LAC	A1142	/SHIP 1 IS FIRING
	DAC	COUNTR
	LAC	X1D
	DAC	HITPNT
	LAC	Y1D
	DAC	TEMP2
	LAC	X1
	DAC	X1X2
	LAC	Y1
	DAC	Y1Y2
	LAC	Y1DM
	DAC	T1160
	LAC	X1DM
	DAC	T1161
	JMS	SHOOT
SHOOT2	LAC	F2
	SNA
	JMP	GO
	DZM	F2
	LAC	A1144	/SHIP 2 IS FIRING
	DAC	COUNTR
	LAC	X2D
	DAC	HITPNT
	LAC	Y2D
	DAC	TEMP2
	LAC	X2
	DAC	X1X2
	LAC	Y2
	DAC	Y1Y2
	LAC	Y2DM
	DAC	T1160
	LAC	X2DM
	DAC	T1161
	JMS	SHOOT
GO	LAC	L770
	DAC	COUNT
LOOP2	IOT
	LAC	L7537
	DAC	CNT
VE	IOT
	IOT
	IOT
	ISZ	CNT
	JMP	VE
	ISZ	COUNT
	JMP	LOOP2	/WAIT FOR AWHILE BEFORE RE-CALCULATING
	JMP	LOOP
/
/  DISPLAY FILES GO HERE
/
SHIP1	020117
Y1C	221153
X1C	101427
	24
	205203
	203607
	201612
	301612
	303607
	305203
	305003
	303407
	301412
	201412
	203407
	205003
	224
TUR11	111607
TUR12	700607
/
SHIP2	020117
Y2C	221000
X2C	103400
	24
	205203
	203607
	201612
	301612
	303607
	305203
	305003
	303407
	301412
	201412
	203407
	205003
	224
TUR21	200224
TUR22	100224
/
DSHOT	020017
	221016
	143364
	701303
	20000
	0
	2000
/
	701303
	20000
	0
	2000
/
	701303
	20000
	0
	2000
/
	701303
	20000
	0
	2000
/
	701303
	20000
	0
	2000
/
	701303
	20000
	0
	2000
/
	701303
	20000
	0
	2000
/
	701303
	20000
	0
	2000
/
	701303
	20000
	0
	2000
/
	701303
	20000
	0
	2000
/
	701303
	20000
	0
	2000
/
	.REPT	5
	0
/
P1
P2
TEMP
T1643
T1644
L770	777770
L10	10
L10.	10
L7537	777537
L772	777772
CNT
COUNT
Y2
X2
Y1
X1
F2
F1
ROT2
TWAIT2
ROT1
TWAIT1
Y2DM
Y2D
X2DM
X2D
Y1DM
Y1D
X1DM
X1D
A1144	SHC2
A1142	SHC1
W1	777000
L1777	1777
W2	777
TIE	777777
L40	40
STOP	3000
L5	5
L773	777773
A1166	SHELLS
L765	777765
A1537	DSHOT+1
L7600	777600
L1	1
L21	21
L20T	20000
VCTR	701303
L142T	142000
L1776	1776
VPNT	220000
A1162	SHL62
L757	777757
L33	33
L11	11
L600T	600000
L200T	200000
L400T	400000
L764	777764
L177	177
SIGN	200
L102T	102000
L100T	100000
L7400	177400
L44	44
L776	777776
L1.	1
A600	DIRTBL
A560	ACMASK
A575	SUBTBL
FILER1	SHIP1
FILER2	SHIP2
FILER3	DSHOT
	.END	START
