***************************************************************************
*	this is the source for
*       chase (a brilliant 3d
*	space shootemup thingie)                        *
*
start:	clr.l	-(SP)		;Go into supervisor mode
	move.w	#$20,-(SP)
	trap	#1
	addq.l	#6,SP
	move.l	D0,spv_sp
*	move.b	#0,$ff8260
*	move.b	#0,$44c
	move.l	#mytest,$46e
	move.w	#0,-(sp)
	move.l	#-1,-(sp)
	move.l	#-1,-(sp)
	move.w	#5,-(sp)
	trap	#14
	add.l	#12,sp


	move.b	#0,$484
	bsr	putrout
	bsr	linea
	bsr	getscrn
	dc.w	$a00a
ftf:	bsr	darkcolors
	bsr	clearsc
	bsr	loadscr
	bsr	copysc
	bsr	colors
	move.w	#1000,extram
	move.w	#0,xmin
	move.w	#13,ymin
	move.w	#319,xmax
	move.w	#151,ymax
	move.w	#160,whx
	move.w	#80,why
	move.w	#0,level
	move.w	#150,speed
	move.w	#90,fspeed
	move.w	#150,spsav
	move.w	#-4,velcnt
	move.l	#0,levob
	move.w	#10,sheilds
	move.w	#0,passed
	move.w	#400,my2
	move.w	#400,spsav
	move.w	#105,off
	move.w	#0,doffs
	move.w	#0,yvel
	move.w	#0,xvel
	move.w	#0,score
	move.w	#0,shiphit
	move.w	#4,plspeed
	move.w	#4,spsav
	move.w	#400,towerwide
	move.w	#-1,allflg
	move.w	#50,missvel
	move.w	#-1,ptts
	move.w	#-1,ptts2
	move.w	#-1,exp
*	bra	allover
	bra	theopener
intro:	
	move.w	#0,xoffs
	move.w	#0,yoffs
	move.w	#0,zoffs

	move.w	#1,pl1
	move.w	#0,pl2
	move.w	#0,pl3
	move.w	#1,pl4

	move.w	#0,bpl1
	move.w	#1,bpl2
	move.w	#0,bpl3
	move.w	#1,bpl4

	move.w	#1,cpl1
	move.w	#1,cpl2
	move.w	#0,cpl3
	move.w	#1,cpl4
	move.w	#-1,ptts

	move.w	#-1,ob1
	move.w	#-1,ob2
	move.w	#-1,ob3
	move.w	#-1,ob4
	move.w	#-1,ob5
	move.w	#-1,ob6
	move.w	#-1,ob7
	move.w	#-1,ob8
	move.w	#-1,ob9
	move.w	#-1,oba
	move.w	#40,mmax
	move.w	#-40,mmin
	move.w	#90,off2x
	move.w	#0,plx
	move.w	#0,ply
	move.w	#0,plz
	move.w	#90,fspeed
	move.w	#-1,special
	move.w	#-1,allflg
	lea	view_pb7,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb2,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb3,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb5,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb4,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	bsr	open
	rts

theopener:
	bsr	waitfkey

prt1:
	bsr	intro
	move.w	#-1,ptts
	move.w	#1,pl1
	move.w	#0,pl2
	move.w	#1,pl3
	move.w	#1,pl4

	move.w	#0,bpl1
	move.w	#1,bpl2
	move.w	#1,bpl3
	move.w	#1,bpl4

	move.w	#1,cpl1
	move.w	#1,cpl2
	move.w	#1,cpl3
	move.w	#1,cpl4

	move.w	#-1,ob1
	move.w	#-1,ob2
	move.w	#-1,ob3
	move.w	#-1,ob4
	move.w	#-1,ob5
	move.w	#-1,ob6
	move.w	#-1,ob7
	move.w	#-1,ob8
	move.w	#-1,ob9
	move.w	#-1,oba
	move.w	#40,mmax
	move.w	#-40,mmin
	addq.w	#5,off
	subq.w	#5,off2x
	move.w	#0,plx
	move.w	#10,ply
	move.w	#0,plz
	move.w	#90,fspeed
	move.w	#-1,special
	move.w	#-1,allflg
	move.l	#levlist,a6
	move.w	level,d0
	asl.w	#2,d0
	move.l	(a6,d0.w),d1
	bsr	putlevs
	bra	ptest
prt2:
	bsr	intro
	bsr	undrawit
	bsr	flip_scr
	bsr	undrawit
	move.w	#-4,velcnt
	move.w	#1,pl1
	move.w	#0,pl2
	move.w	#1,pl3
	move.w	#1,pl4

	move.w	#0,bpl1
	move.w	#1,bpl2
	move.w	#1,bpl3
	move.w	#1,bpl4

	move.w	#1,cpl1
	move.w	#1,cpl2
	move.w	#1,cpl3
	move.w	#1,cpl4

	move.w	#150,speed
	move.w	#150,spsav
	move.w	#4,plspeed
	move.w	#0,passed
	move.w	#-1,allflg
	move.w	#-1,ob1
	move.w	#-1,ob2
	move.w	#-1,ob3
	move.w	#-1,ob4
	move.w	#-1,ob5
	move.w	#-1,ob6
	move.w	#-1,ob7
	move.w	#-1,ob8
	move.w	#-1,ob9
	move.w	#-1,oba
	move.w	#0,xvel
	move.w	#0,yvel
	move.w	#2,mmax
	move.w	#-2,mmin
	move.w	#0,shiphit
	move.l	#tower,levob
	move.l	#tower,levob2
	bra	second
prt3:
	bsr	intro
	bsr	undrawit
	bsr	flip_scr
	bsr	undrawit
	move.w	#1,pl1
	move.w	#0,pl2
	move.w	#0,pl3
	move.w	#1,pl4

	move.w	#0,bpl1
	move.w	#1,bpl2
	move.w	#0,bpl3
	move.w	#1,bpl4

	move.w	#1,cpl1
	move.w	#1,cpl2
	move.w	#0,cpl3
	move.w	#1,cpl4
	move.w	#-1,ptts
	move.w	#-1,allflg
	move.w	#-1,ob1
	move.w	#-1,ob2
	move.w	#-1,ob3
	move.w	#-1,ob4
	move.w	#-1,ob5
	move.w	#-1,ob6
	move.w	#-1,ob7
	move.w	#-1,ob8
	move.w	#-1,ob9
	move.w	#-1,oba
	move.w	#0,ob1x
	move.w	#0,ob1y
	move.w	#0,ob1z
	move.w	#0,ob2x
	move.w	#0,ob2y
	move.w	#0,ob2z
	move.w	#0,ob3x
	move.w	#0,ob3y
	move.w	#0,ob3z
	move.w	#0,ob4x
	move.w	#0,ob4y
	move.w	#0,ob4z
	move.w	#0,ob5x
	move.w	#0,ob5y
	move.w	#0,ob5z
	move.w	#0,ob7x
	move.w	#0,ob7y
	move.w	#0,ob7z
	move.w	#0,xvel
	move.w	#0,yvel
	move.w	#30,mmax
	move.w	#20,speed
	move.w	#20,spsav
	move.w	#-30,mmin
	move.w	#0,shiphit
	move.l	#square,d1
	bsr	putlevs
	move.w	#-1,special
	lea	view_pb7,a6
	move.w	#700,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb2,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb3,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb5,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb4,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	move.w	#0,sqxv
	move.w	#0,sqyv	
	bra	third
prt4:
	bsr	intro
	bsr	undrawit
	bsr	flip_scr
	bsr	undrawit
	move.w	#55,fspeed
	move.w	#1,pl1
	move.w	#0,pl2
	move.w	#0,pl3
	move.w	#1,pl4

	move.w	#0,bpl1
	move.w	#1,bpl2
	move.w	#0,bpl3
	move.w	#1,bpl4

	move.w	#1,cpl1
	move.w	#1,cpl2
	move.w	#0,cpl3
	move.w	#1,cpl4
	move.w	#50,spsav
	move.w	#50,speed
	move.w	#-1,ptts
	move.w	#-1,allflg
	move.w	#-1,ob1
	move.w	#-1,ob2
	move.w	#-1,ob3
	move.w	#-1,ob4
	move.w	#-1,ob5
	move.w	#-1,ob6
	move.w	#-1,ob7
	move.w	#-1,ob8
	move.w	#-1,ob9
	move.w	#-1,oba
	move.w	#0,ob1x
	move.w	#0,ob1y
	move.w	#0,ob1z
	move.w	#0,ob2x
	move.w	#0,ob2y
	move.w	#0,ob2z
	move.w	#0,ob3x
	move.w	#0,ob3y
	move.w	#0,ob3z
	move.w	#0,ob4x
	move.w	#0,ob4y
	move.w	#0,ob4z
	move.w	#0,ob5x
	move.w	#0,ob5y
	move.w	#0,ob5z
	move.w	#0,ob7x
	move.w	#0,ob7y
	move.w	#0,ob7z
	bsr	pre4
	move.w	#150,speed
	move.w	#150,spsav
	move.w	#0,xvel
	move.w	#0,yvel
	move.w	#10,mmax
	move.w	#-10,mmin
	move.w	#0,shiphit
	move.l	#corri,levob
	move.l	#u,levob2
	move.l	#u,levob3
	move.l	#bar,levob4
	move.l	#bar,levob5
	move.l	#bar,levob7
	move.l	#bar,levob8
	move.l	#u,levob9
	move.l	#u,levoba


	move.w	#-1,special
	lea	view_pb7,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb2,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb3,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb5,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb4,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb8,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb9,a6
	move.w	#0,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pba,a6
	move.w	#3000,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)

	move.w	#0,sqxv
	move.w	#0,sqyv	

	bra	fourth
prt5:	move.w	#-1,allflg
	move.w	#0,shiphit
	addq.w	#1,level
	cmpi.w	#10,level
	bge	allover
	bra	prt1
*********************************
mytest:
	rts

cul:	blk.w	1,0
even
***********************************
allover:
	bsr	darkcolors
	bsr	flip_scr
	bsr	undrawit
	bsr	flip_scr
	bsr	undrawit
	bsr	loadend
	bsr	copysc
	bsr	colors

	bsr	waitfkey
	move.l	#60000,d0
ddd:
	dbf	d0,ddd

	bsr	colors
	move.w	#0,xoffs
	move.w	#0,yoffs
	move.w	#0,zoffs

	move.w	#1,pl1
	move.w	#0,pl2
	move.w	#0,pl3
	move.w	#1,pl4

	move.w	#0,bpl1
	move.w	#1,bpl2
	move.w	#0,bpl3
	move.w	#1,bpl4

	move.w	#1,cpl1
	move.w	#1,cpl2
	move.w	#0,cpl3
	move.w	#1,cpl4
	move.w	#-1,ptts
	
	move.w	#0,ob1x
	move.w	#0,ob1y
	move.w	#500,ob1z

	move.w	#100,ob2x
	move.w	#0,ob2y
	move.w	#200,ob2z

	move.w	#0,ob3x
	move.w	#100,ob3y
	move.w	#500,ob3z

	move.w	#50,ob4x
	move.w	#20,ob4y
	move.w	#00,ob4z

	move.w	#10,ob5x
	move.w	#0,ob5y
	move.w	#90,ob5z

	move.w	#100,ob7x
	move.w	#100,ob7y
	move.w	#40,ob7z

	move.w	#150,ob8x
	move.w	#120,ob8y
	move.w	#0,ob8z

	move.w	#0,ob9x
	move.w	#0,ob9y
	move.w	#170,ob9z

	move.w	#70,obax
	move.w	#10,obay
	move.w	#30,obaz

	move.w	#1,ob1
	move.w	#1,ob2
	move.w	#1,ob3
	move.w	#1,ob4
	move.w	#1,ob5
	move.w	#-1,ob6
	move.w	#1,ob7
	move.w	#1,ob8
	move.w	#1,ob9
	move.w	#1,oba
	move.w	#40,mmax
	move.w	#-40,mmin
	move.w	#90,off2x
	move.w	#0,plx
	move.w	#0,ply
	move.w	#0,plz
	move.w	#90,fspeed
	move.w	#-1,special
	move.w	#-1,allflg
	lea	view_pb7,a6
	move.w	#500,rho(a6)
	move.w	#100,phi(a6)
	move.w	#100,theta(a6)
	lea	view_pb,a6
	move.w	#500,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb2,a6
	move.w	#500,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb3,a6
	move.w	#500,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb5,a6
	move.w	#500,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	lea	view_pb8,a6
	move.w	#500,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)

	lea	view_pb9,a6
	move.w	#500,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)

	lea	view_pb4,a6
	move.w	#500,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)

	lea	view_pba,a6
	move.w	#500,rho(a6)
	move.w	#0,phi(a6)
	move.w	#0,theta(a6)
	move.l	#pyr,levob
	move.l	#square,levob2
	move.l	#missile,levob3
	move.l	#tri,levob4
	move.l	#diamond,levob5
	move.l	#thing,levob7
	move.l	#cube,levob8
	move.l	#pyr,levob9
	move.l	#square,levoba
	move.w	#-1,special
	move.w	#-1,ob1xvel
	move.w	#2,ob1yvel
	move.w	#-5,ob1zvel

	move.w	#-4,ob2xvel
	move.w	#-1,ob2yvel
	move.w	#2,ob2zvel

	move.w	#3,ob3xvel
	move.w	#3,ob3yvel
	move.w	#-1,ob3zvel

	move.w	#-2,ob4xvel
	move.w	#5,ob4yvel
	move.w	#1,ob4zvel

	move.w	#-4,ob5xvel
	move.w	#-3,ob5yvel
	move.w	#-4,ob5zvel

	move.w	#2,ob7xvel
	move.w	#-5,ob7yvel
	move.w	#-5,ob7zvel

	move.w	#4,ob8xvel
	move.w	#3,ob8yvel
	move.w	#-2,ob8zvel

	move.w	#-2,ob9xvel
	move.w	#1,ob9yvel
	move.w	#-5,ob9zvel

	move.w	#-5,obaxvel
	move.w	#-3,obayvel
	move.w	#2,obazvel


endloop:
	lea	view_pb,a6
	addq.w	#3,phi(a6)
	addq.w	#1,theta(a6)
	move.w	ob1xvel,d0
	add.w	d0,ob1x
	move.w	ob1yvel,d1
	add.w	d1,ob1y
	move.w	ob1zvel,d2
	add.w	d2,ob1z
	lea	ob1xvel,a0
	lea	ob1yvel,a1
	lea	ob1zvel,a2
	move.w	ob1x,d0
	move.w	ob1y,d1
	move.w	ob1z,d2
	bsr	testbound

	lea	view_pb2,a6
	addq.w	#3,phi(a6)
	addq.w	#2,theta(a6)
	move.w	ob2xvel,d0
	add.w	d0,ob2x
	move.w	ob2yvel,d1
	add.w	d1,ob2y
	move.w	ob2zvel,d2
	add.w	d2,ob2z
	lea	ob2xvel,a0
	lea	ob2yvel,a1
	lea	ob2zvel,a2
	move.w	ob2x,d0
	move.w	ob2y,d1
	move.w	ob2z,d2
	bsr	testbound

	lea	view_pb3,a6
	addq.w	#4,phi(a6)
	addq.w	#1,theta(a6)
	move.w	ob3xvel,d0
	add.w	d0,ob3x
	move.w	ob3yvel,d1
	add.w	d1,ob3y
	move.w	ob3zvel,d2
	add.w	d2,ob3z
	lea	ob3xvel,a0
	lea	ob3yvel,a1
	lea	ob3zvel,a2
	move.w	ob3x,d0
	move.w	ob3y,d1
	move.w	ob3z,d2
	bsr	testbound

	lea	view_pb4,a6
*	addq.w	#0,phi(a6)
	addq.w	#3,theta(a6)
	move.w	ob4xvel,d0
	add.w	d0,ob4x
	move.w	ob4yvel,d1
	add.w	d1,ob4y
	move.w	ob4zvel,d2
	add.w	d2,ob4z
	lea	ob4xvel,a0
	lea	ob4yvel,a1
	lea	ob4zvel,a2
	move.w	ob4x,d0
	move.w	ob4y,d1
	move.w	ob4z,d2
	bsr	testbound

	lea	view_pb5,a6
	addq.w	#5,phi(a6)
	addq.w	#2,theta(a6)
	move.w	ob5xvel,d0
	add.w	d0,ob5x
	move.w	ob5yvel,d1
	add.w	d1,ob5y
	move.w	ob5zvel,d2
	add.w	d2,ob5z
	lea	ob5xvel,a0
	lea	ob5yvel,a1
	lea	ob5zvel,a2
	move.w	ob5x,d0
	move.w	ob5y,d1
	move.w	ob5z,d2
	bsr	testbound

	lea	view_pb7,a6
	addq.w	#2,phi(a6)
	addq.w	#2,theta(a6)
	move.w	ob7xvel,d0
	add.w	d0,ob7x
	move.w	ob7yvel,d1
	add.w	d1,ob7y
	move.w	ob7zvel,d2
	add.w	d2,ob7z
	lea	ob7xvel,a0
	lea	ob7yvel,a1
	lea	ob7zvel,a2
	move.w	ob7x,d0
	move.w	ob7y,d1
	move.w	ob7z,d2
	bsr	testbound

	lea	view_pb8,a6
	addq.w	#1,phi(a6)
	addq.w	#1,theta(a6)
	move.w	ob8xvel,d0
	add.w	d0,ob8x
	move.w	ob8yvel,d1
	add.w	d1,ob8y
	move.w	ob8zvel,d2
	add.w	d2,ob8z
	lea	ob8xvel,a0
	lea	ob8yvel,a1
	lea	ob8zvel,a2
	move.w	ob8x,d0
	move.w	ob8y,d1
	move.w	ob8z,d2
	bsr	testbound

	lea	view_pb9,a6
	addq.w	#4,phi(a6)
	addq.w	#2,theta(a6)
	move.w	ob9xvel,d0
	add.w	d0,ob9x
	move.w	ob9yvel,d1
	add.w	d1,ob9y
	move.w	ob9zvel,d2
	add.w	d2,ob9z
	lea	ob9xvel,a0
	lea	ob9yvel,a1
	lea	ob9zvel,a2
	move.w	ob9x,d0
	move.w	ob9y,d1
	move.w	ob9z,d2
	bsr	testbound

	lea	view_pba,a6
	addq.w	#4,phi(a6)
	addq.w	#5,theta(a6)
	move.w	obaxvel,d0
	add.w	d0,obax
	move.w	obayvel,d1
	add.w	d1,obay
	move.w	obazvel,d2
	add.w	d2,obaz
	lea	obaxvel,a0
	lea	obayvel,a1
	lea	obazvel,a2
	move.w	obax,d0
	move.w	obay,d1
	move.w	obaz,d2
	bsr	testbound
	bsr	keyornot
	bsr	keyboard
	bsr	plot_obj
	bra	endloop


testbound:

	cmpi.w	#250,d0
	blt	tb1
	neg	(a0)
	bra	tb2
tb1:
	cmpi.w	#-250,d0
	bgt	tb2
	neg	(a0)
tb2:
	cmpi.w	#200,d1
	blt	tb3
	neg	(a1)
	bra	tb4
tb3:
	cmpi.w	#-200,d1
	bgt	tb4
	neg	(a1)
tb4:
	cmpi.w	#1200,d2
	blt	tb5
	neg	(a2)
	bra	tb6
tb5:
	cmpi.w	#0,d2
	bgt	tb6
	neg	(a2)
tb6:
	rts



keyornot:
	tst.w	buttondat
	bne	yep
	rts

yep:
	bra	prefirst

ob1xvel:	blk.w	1,0
ob1yvel:	blk.w	1,0
ob1zvel:	blk.w	1,0

ob2xvel:	blk.w	1,0
ob2yvel:	blk.w	1,0
ob2zvel:	blk.w	1,0

ob3xvel:	blk.w	1,0
ob3yvel:	blk.w	1,0
ob3zvel:	blk.w	1,0

ob4xvel:	blk.w	1,0
ob4yvel:	blk.w	1,0
ob4zvel:	blk.w	1,0

ob5xvel:	blk.w	1,0
ob5yvel:	blk.w	1,0
ob5zvel:	blk.w	1,0

ob7xvel:	blk.w	1,0
ob7yvel:	blk.w	1,0
ob7zvel:	blk.w	1,0

ob8xvel:	blk.w	1,0
ob8yvel:	blk.w	1,0
ob8zvel:	blk.w	1,0

ob9xvel:	blk.w	1,0
ob9yvel:	blk.w	1,0
ob9zvel:	blk.w	1,0

obaxvel:	blk.w	1,0
obayvel:	blk.w	1,0
obazvel:	blk.w	1,0

*********************************
tmode:	move.w	#1,ob1
	move.w	#-1,ob2
	move.w	#-1,ob3
	move.w	#-1,ob4
	move.w	#-1,ob5
	move.w	#-1,ob6
	move.w	#-1,ob7
	move.w	#-1,ob8
	move.w	#-1,ob9
	move.w	#-1,oba
	move.w	#-1,special
	move.w	#0,ob1x
	move.w	#0,ob1y
	move.w	#0,mmin
	move.w	#500,mmax
	move.l	#pyr,levob

more:	move.w	#$ff,-(sp)
	move.w	#6,-(sp)
	trap	#1
	addq.l	#4,sp
	tst.w	d0
	beq	doit
	swap	d0
f1:	cmpi.w	#$63,d0
	bne	f2
	move.l	#pyr,levob
	bra	doit
f2:	cmpi.w	#$64,d0
	bne	f3
	move.l	#diamond,levob
	bra	doit
f3:	cmpi.w	#$65,d0
	bne	f4
	move.l	#ship,levob
	bra	doit
f4:	cmpi.w	#$66,d0
	bne	f5
	move.l	#missile,levob
	bra	doit
f5:	cmpi.w	#$67,d0
	bne	f6
	move.l	#chase,levob
	bra	doit
f6:	cmpi.w	#$68,d0
	bne	f7
	move.l	#tower,levob
	bra	doit
f7:	cmpi.w	#$69,d0
	bne	f8
	move.l	#tri,levob
	bra	doit
f8:	cmpi.w	#$6a,d0
	bne	f9
	move.l	#thing,levob
	bra	doit
f9:	cmpi.w	#$6b,d0
	bne	f10
	move.l	#cube,levob
	bra	doit
f10:	cmpi.w	#$6c,d0
	bne	f11
	move.l	#square,levob
	bra	doit
f11:	cmpi.w	#$6d,d0
	bne	f12
	move.l	#corri,levob
	bra	doit
f12:	cmpi.w	#$6e,d0
	bne	f13
	move.l	#u,levob
	bra	doit
f13:	cmpi.w	#$6f,d0
	bne	plus
	move.l	#bar,levob
	bra	doit
plus:	cmpi.w	#$4e,d0
	bne	esc
*	move.l	#myship,levob
	bra	doit

esc:	cmpi.w	#$1,d0
	bne	doit
	bra	ftf	
	
	

doit:	lea	view_pb,a6
	move.w	mx,theta(a6)
	move.w	my,phi(a6)
	cmpi.w	#1,buttondat
	beq	inout
plmode:	bsr	plot_obj
	bra	more

inout:	lea	view_pb,a6
	move.w	my,rho(a6)
	bra	plmode	

	




*********************************
open:	move.l	#chase,levob
	move.w	#0,xvel
	move.w	#0,yvel
*	move.w	#0,plz
	lea	view_pb6,a6
	move.w	#1000,rho(a6)

	move.w	#1,ob1
	lea	view_pb,a6
	move.w	openspeed,d0
	add.w	d0,rho(a6)
	cmpi.w	#4000,rho(a6)
	bge	open1
	move.w	#192,theta(a6)
	move.w	#95,phi(a6)
	move.w	#0,ob1x
	move.w	#0,ob1y
	move.w	#0,ob1z
	bsr	plot_obj
	addq.w	#2,openspeed
	bra	open
open1:
	move.w	#5,openspeed
	rts


waitfkey:
	clr.l	d0
	move.w	#$ff,-(sp)
	move.w	#6,-(sp)
	trap	#1
	addq.l	#4,sp
	tst.l	d0
	bne	wfk1
	tst.w	buttondat
	bne	wfk1
	bra	waitfkey
wfk1:	rts	
*********************************
fourth:	tst.w	allflg
	bpl	prt5
*	move.w	#-5,mmin
*	move.w	#5,mmax
	lea	view_pb,a6
	move.w	#64,theta(a6)
	move.w	#0,phi(a6)
	move.w	#5,rho(a6)
	move.w	xvel,d0
	add.w	d0,ob1x
	move.w	yvel,d0
	add.w	d0,ob1y

limit:	cmpi.w	#-72,ob1x
	bgt	limit1
	move.w	#-72,ob1x
	bra	limit2
limit1:	cmpi.w	#72,ob1x
	blt	limit2
	move.w	#72,ob1x
limit2:	cmpi.w	#-25,ob1y
	bgt	limit3
	move.w	#-25,ob1y
	bra	limit4
limit3:	cmpi.w	#57,ob1y
	blt	limit4
	move.w	#57,ob1y
limit4:	nop


fthb:	lea	view_pb2,a6
	tst.w	ob2
	bpl	fthbmov
	move.w	#1,ob2
	move.w	#0,phi(a6)
	move.w	#64,theta(a6)
	lea	view_pba,a5
	move.w	rho(a5),rho(a6)
	addi.w	#700,rho(a6)
fthbmov:
	move.w	speed,d0
	sub.w	d0,rho(a6)
	move.w	ob1x,ob2x
	move.w	ob1y,ob2y
	cmpi.w	#10,rho(a6)
	blt	fthboff
***************
fthc:	lea	view_pb3,a6
	tst.w	ob3
	bpl	fthcmov
	move.w	#1,ob3
	move.w	#0,phi(a6)
	move.w	#64,theta(a6)
	lea	view_pb2,a5
	move.w	rho(a5),rho(a6)
	addi.w	#700,rho(a6)
fthcmov:
	move.w	speed,d0
	sub.w	d0,rho(a6)
	move.w	ob1x,ob3x
	move.w	ob1y,ob3y
	cmpi.w	#10,rho(a6)
	blt	fthcoff
***************
fthd:	lea	view_pb4,a6
	tst.w	ob4
	bpl	fthdmov
	move.w	#1,ob4
	move.w	#0,phi(a6)
	move.w	#64,theta(a6)
	move.w	#4600,rho(a6)
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	asr.l	#8,d0
	divu	#21845,d0
	tst.w	d0
	bgt	dda
	move.w	#50,bar1x
	bra	fthdmov
dda:	cmpi.w	#1,d0
	bgt	ddb
	move.w	#0,bar1x
	bra	fthdmov
ddb:	move.w	#-50,bar1x

fthdmov:
	move.w	speed,d0
	sub.w	d0,rho(a6)
	move.w	ob1y,ob4y
	move.w	ob1x,d0
	move.w	bar1x,d1
	add.w	d1,d0
	move.w	d0,ob4x
	cmpi.w	#55,rho(a6)
	blt	fthdoff
***************
fthe:	lea	view_pb5,a6
	tst.w	ob5
	bpl	fthemov
	move.w	#1,ob5
	move.w	#0,phi(a6)
	move.w	#64,theta(a6)
	move.w	#5300,rho(a6)
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	asr.l	#8,d0
	divu	#21845,d0
	tst.w	d0
	bgt	eea
	move.w	#50,bar2x
	bra	fthemov
eea:	cmpi.w	#1,d0
	bgt	eeb
	move.w	#0,bar2x
	bra	fthemov
eeb:	move.w	#-50,bar2x


fthemov:
	move.w	speed,d0
	sub.w	d0,rho(a6)
	move.w	ob1y,ob5y
	move.w	ob1x,d0
	move.w	bar2x,d1
	add.w	d1,d0
	move.w	d0,ob5x
	cmpi.w	#55,rho(a6)
	blt	ftheoff

***************
fthf:	lea	view_pb7,a6
	tst.w	ob7
	bpl	fthfmov
	move.w	#1,ob7
	move.w	#0,phi(a6)
	move.w	#64,theta(a6)
	move.w	#5700,rho(a6)
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	asr.l	#8,d0
	divu	#21845,d0
*	move.w	#3,d0
	tst.w	d0
	bgt	ffa
	move.w	#50,bar3x
	bra	fthfmov
ffa:	cmpi.w	#1,d0
	bgt	ffb
	move.w	#0,bar3x
	bra	fthfmov
ffb:	move.w	#-50,bar3x

fthfmov:
	move.w	speed,d0
	sub.w	d0,rho(a6)
	move.w	ob1y,ob7y
	move.w	ob1x,d0
	move.w	bar3x,d1
	add.w	d1,d0
	move.w	d0,ob7x
	cmpi.w	#55,rho(a6)
	blt	fthfoff
***************
fthg:	lea	view_pb8,a6
	tst.w	ob8
	bpl	fthgmov
	move.w	#1,ob8
	move.w	#0,phi(a6)
	move.w	#64,theta(a6)
	move.w	#6700,rho(a6)
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	asr.l	#8,d0
	divu	#21845,d0
*	move.w	#3,d0
	tst.w	d0
	bgt	gga
	move.w	#50,bar4x
	bra	fthgmov
gga:	cmpi.w	#1,d0
	bgt	ggb
	move.w	#0,bar4x
	bra	fthgmov
ggb:	move.w	#-50,bar4x

fthgmov:
	move.w	speed,d0
	sub.w	d0,rho(a6)
	move.w	ob1y,ob8y
	move.w	ob1x,d0
	move.w	bar4x,d1
	add.w	d1,d0
	move.w	d0,ob8x
	cmpi.w	#55,rho(a6)
	blt	fthgoff


fthh:	lea	view_pb6,a6
	tst.w	ob6
	bpl	fthhmov
	move.w	#1,ob6
	move.w	#3000,rho(a6)
	move.w	#64,theta(a6)
	move.w	#191,phi(a6)
fthhmov:move.w	speed,d0
	sub.w	d0,rho(a6)
	move.w	fspeed,d0
	add.w	d0,rho(a6)
	move.w	xvel,d0
	add.w	d0,ob6x
	move.w	yvel,d0
	add.w	d0,ob6y
	move.w	xrand,d0
	add.w	d0,ob6x
	move.w	yrand,d0
	add.w	d0,ob6y
	cmpi.w	#-2,velcnt
	bgt	hitrot
hlimit:	move.w	ob6x,d0
	move.w	ob1x,d1
	subi.w	#75,d1
	cmp.w	d1,d0
	bgt	hlimit1
	move.w	d1,ob6x
	bra	hlimit2
hlimit1:move.w	ob6x,d0
	move.w	ob1x,d1
	addi.w	#75,d1
	cmp.w	d1,d0
	blt	hlimit2
	move.w	d1,ob6x
hlimit2:move.w	ob6y,d0
	move.w	ob1y,d1
	subi.w	#20,d1
	cmpi.w	d1,d0
	bgt	hlimit3
	move.w	d1,ob6y
	bra	hlimit4
hlimit3:move.w	ob6y,d0
	move.w	ob1y,d1
	addi.w	#50,d1
	cmpi.w	d1,d0
	blt	hlimit4
	move.w	d1,ob6y
hlimit4:	nop
	bsr	newrnd
	cmpi.w	#200,rho(a6)
	blt	hclose
	cmpi.w	#3000,rho(a6)
	bgt	hfar
	bra	fthi
hclose:	move.w	#200,rho(a6)
	bra	fthi
hfar:	move.w	#3000,rho(a6)
	


***************
fthi:	lea	view_pb9,a6
	tst.w	ob9
	bpl	fthimov
	move.w	#1,ob9
	move.w	#0,phi(a6)
	move.w	#64,theta(a6)
	lea	view_pb3,a5
	move.w	rho(a5),rho(a6)
	addi.w	#700,rho(a6)
fthimov:
	move.w	speed,d0
	sub.w	d0,rho(a6)
	move.w	ob1x,ob9x
	move.w	ob1y,ob9y
	cmpi.w	#10,rho(a6)
	blt	fthioff
***************
fthj:	lea	view_pba,a6
	tst.w	oba
	bpl	fthjmov
	move.w	#1,oba
	move.w	#0,phi(a6)
	move.w	#64,theta(a6)
	lea	view_pb9,a5
	move.w	rho(a5),rho(a6)
	addi.w	#700,rho(a6)

fthjmov:
	move.w	speed,d0
	sub.w	d0,rho(a6)
	move.w	ob1x,obax
	move.w	ob1y,obay
	cmpi.w	#10,rho(a6)
	blt	fthjoff



pplot4:	bsr	plot_obj
	bsr	keyboard
	cmpi.w	#2,buttondat
	beq	spd4
	move.w	my,yvel
	move.w	#0,my
	move.w	mx,xvel
	neg.w	xvel
	move.w	#0,mx


ppp4:	cmpi.w	#1,buttondat
	beq	fshoot
	move.w	spsav,my2
	bra	fourth

spd4:	move.w	my2,d0
	move.w	d0,spsav
	move.w	#420,d1
	sub.w	d0,d1
	addi.w	#50,d1
	move.w	d1,speed
	move.w	#0,xvel
	move.w	#0,yvel
	bra	ppp4

fshoot:	tst.w	miss1
	bpl	fshb
	tst.w	velcnt	
	bpl	fshb
	tst.w	exp
	bpl	fshb
	move.w	#1,miss1
	move.l	#shootsnd,-(sp)
	move.w	#32,-(sp)
	trap	#14
	addq.l	#6,sp
fshb:	bra	fourth		


hitrot:
	move.w	#-1,miss1
	tst.w	velcnt
	bmi	hitrotb
	move.w	#-1,miss1
	lea	view_pb6,a6
	move.w	rtheta,d0
	add.w	d0,theta(a6)
	move.w	rphi,d0
	add.w	d0,phi(a6)
	subq.w	#1,velcnt
	bra	hlimit	

hitrotb:
	bsr	boom3
	addq.w	#1,shiphit
	move.w	#-3,velcnt
	move.w	ob6x,miss1x
	move.w	ob6y,miss1y
	move.w	ob6z,miss1z
	move.l	#view_pb6,a6
	move.l	#view_pbex,a5
	move.w	rho(a6),rho(a5)
	addi.w	#500,rho(a5)
	move.w	#100,phi(a5)
	move.w	#8000,rho(a6)

	move.w	#1,exp
	move.w	#-1,ob6
	bra	hlimit		
*****************************
newrnd:	tst.w	rndcnt
	bpl	rndback
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	#8000,d0
	move.w	d0,xrand
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	#8000,d0
	move.w	d0,yrand
	move.w	#15,rndcnt
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	asr.l	#8,d0
	divu	#800,d0
	move.w	d0,fspeed
	rts
rndback:subi.w	#1,rndcnt
	rts


*********************
fthboff:move.w	#-1,ob2
	bra	fthb
fthcoff:move.w	#-1,ob3
	bra	fthd
fthdoff:move.w	#-1,ob4
	cmpi.w	#-25,ob4x
	blt	do1
	cmpi.w	#25,ob4x	
	bgt	do1
	subq.w	#1,sheilds
	bsr	boom
do1:	bra	fthe

ftheoff:move.w	#-1,ob5
	cmpi.w	#-25,ob5x
	blt	eo1
	cmpi.w	#25,ob5x	
	bgt	eo1
	subq.w	#1,sheilds
	bsr	boom
eo1:	bra	fthf


fthfoff:move.w	#-1,ob7
	cmpi.w	#-25,ob7x
	blt	fo1
	cmpi.w	#25,ob7x	
	bgt	fo1
	subq.w	#1,sheilds
	bsr	boom

fo1:	bra	fthg
fthgoff:move.w	#-1,ob8
	cmpi.w	#-25,ob8x
	blt	go1
	cmpi.w	#25,ob8x	
	bgt	go1
	subq.w	#1,sheilds
	bsr	boom

go1:	bra	fthi

fthioff:move.w	#-1,ob9
	bra	fthj
fthjoff:move.w	#-1,oba
	bra	pplot4

*********************************
putlevs:
	move.l	d1,levob2
	move.l	d1,levob3
	move.l	d1,levob4
	move.l	d1,levob5
	move.l	d1,levob7
	move.l	d1,levob8
	move.l	d1,levob9
	move.l	d1,levoba
	move.l	d1,levob
	rts
***********************************
pre4:	move.l	#corri,levob
	move.w	#1,ob1
	move.w	#0,ob1x
	move.w	#0,ob1y
	move.w	#0,ob1z
	lea	view_pb,a6
	move.w	#64,theta(a6)
	move.w	#00,phi(a6)
	move.w	#18000,rho(a6)
ppa:	lea	view_pb,a6
	addq.w	#2,phi(a6)
	subi.w	#500,rho(a6)
	cmpi.w	#4000,rho(a6)
	ble	ppb
	bsr	plot_obj
	bra	ppa

ppb:	lea	view_pb,a6
	move.w	#64,theta(a6)
	move.w	#64,phi(a6)
	move.w	#4000,rho(a6)
pp4:	lea	view_pb,a6
	addq.w	#8,theta(a6)
	subq.w	#1,phi(a6)
	subi.w	#61,rho(a6)
	cmpi.w	#5,rho(a6)
	ble	pre4b
	bsr	plot_obj
	bra	pp4		

pre4b:	lea	view_pb,a6
	move.w	#55,rho(a6)
	move.w	#64,theta(a6)
	move.w	#0,phi(a6)
	bsr	plot_obj
	bsr	plot_obj
	rts






***********************************
third:
	tst.w	allflg
	bpl	prt4	
	lea	view_pb,a6
	tst.w	ob1
	bpl	amove
	move.w	#1,ob1
	move.w	sqxv2,d0
	add.w	d0,sqxv
	move.w	sqyv2,d0
	add.w	d0,sqyv
	move.w	sqxv,d0
	add.w	d0,ob1x
	move.w	sqyv,d0
	add.w	d0,ob1y
	lea	view_pb7,a5
	move.w	rho(a5),d0
	addi.w	#200,d0
	move.w	d0,rho(a6)
amove:	move.w	speed,d0
	sub.w	d0,rho(a6)
	move.w	xvel,d0
	add.w	d0,ob1x
	move.w	yvel,d0
	add.w	d0,ob1y

	tst.w	rho(a6)	
	blt	p3off
***************
thirdb:	lea	view_pb2,a6
	tst.w	ob2
	bpl	bmove
	move.w	#1,ob2
	move.w	sqxv2,d0
	add.w	d0,sqxv
	move.w	sqyv2,d0
	add.w	d0,sqyv
	move.w	sqxv,d0
	add.w	d0,ob2x
	move.w	sqyv,d0
	add.w	d0,ob2y
	lea	view_pb,a5
	move.w	rho(a5),d0
	addi.w	#200,d0
	move.w	d0,rho(a6)
bmove:	move.w	speed,d0
	sub.w	d0,rho(a6)
	move.w	xvel,d0
	add.w	d0,ob2x
	move.w	yvel,d0
	add.w	d0,ob2y
	tst.w	rho(a6)	
	blt	bp3off
***************
thirdc:	lea	view_pb3,a6
	tst.w	ob3
	bpl	cmove
	move.w	#1,ob3
	move.w	sqxv2,d0
	add.w	d0,sqxv
	move.w	sqyv2,d0
	add.w	d0,sqyv
	move.w	sqxv,d0
	add.w	d0,ob3x
	move.w	sqyv,d0
	add.w	d0,ob3y
	lea	view_pb2,a5
	move.w	rho(a5),d0
	addi.w	#200,d0
	move.w	d0,rho(a6)
cmove:	move.w	speed,d0
	sub.w	d0,rho(a6)
	move.w	xvel,d0
	add.w	d0,ob3x
	move.w	yvel,d0
	add.w	d0,ob3y
	tst.w	rho(a6)	
	blt	cp3off
***************
thirdd:	lea	view_pb4,a6
	tst.w	ob4
	bpl	dmove
	move.w	#1,ob4
	move.w	sqxv2,d0
	add.w	d0,sqxv
	move.w	sqyv2,d0
	add.w	d0,sqyv
	move.w	sqxv,d0
	add.w	d0,ob4x
	move.w	sqyv,d0
	add.w	d0,ob4y
	lea	view_pb3,a5
	move.w	rho(a5),d0
	addi.w	#200,d0
	move.w	d0,rho(a6)
dmove:	move.w	speed,d0
	sub.w	d0,rho(a6)
	move.w	xvel,d0
	add.w	d0,ob4x
	move.w	yvel,d0
	add.w	d0,ob4y
	tst.w	rho(a6)	
	blt	dp3off
***************
thirde:	lea	view_pb5,a6
	tst.w	ob5
	bpl	emove
	move.w	#1,ob5
	move.w	sqxv2,d0
	add.w	d0,sqxv
	move.w	sqyv2,d0
	add.w	d0,sqyv
	move.w	sqxv,d0
	add.w	d0,ob5x
	move.w	sqyv,d0
	add.w	d0,ob5y
	lea	view_pb4,a5
	move.w	rho(a5),d0
	addi.w	#200,d0
	move.w	d0,rho(a6)
emove:	move.w	speed,d0
	sub.w	d0,rho(a6)
	move.w	xvel,d0
	add.w	d0,ob5x
	move.w	yvel,d0
	add.w	d0,ob5y
	tst.w	rho(a6)	
	blt	ep3off

***************
thirdf:	lea	view_pb7,a6
	tst.w	ob7
	bpl	fmove
	move.w	#1,ob7
	move.w	sqxv2,d0
	add.w	d0,sqxv
	move.w	sqyv2,d0
	add.w	d0,sqyv
	move.w	sqxv,d0
	add.w	d0,ob7x
	move.w	sqyv,d0
	add.w	d0,ob7y
	lea	view_pb5,a5
	move.w	rho(a5),d0
	addi.w	#200,d0
	move.w	d0,rho(a6)
fmove:	move.w	speed,d0
	sub.w	d0,rho(a6)
	move.w	xvel,d0
	add.w	d0,ob7x
	move.w	yvel,d0
	add.w	d0,ob7y
	tst.w	rho(a6)	
	blt	fp3off







****************

prt3plot:
	bsr	plot_obj
	bsr	keyboard
	bsr	movsqr
*	move.w	#20,speed
	move.w	my,yvel
	move.w	#0,my
	move.w	mx,xvel
	neg.w	xvel
	move.w	#0,mx
	bsr	past
	move.w	spsav,my2
	bra	third


*******************************
past:	cmpi.w	#80,through
	blt	pasta
	move.w	#1,allflg
	move.w	#0,through

pasta:	rts



******************************
movsqr:	tst.w	sqrcnt
	bpl	sqrback
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	#4000,d0
	move.w	d0,sqxv2
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	#4000,d0
	move.w	d0,sqyv2
mm1:	move.w	#40,sqrcnt
	rts
sqrback:
	subq.w	#1,sqrcnt
	rts

****************************
p3off:
	move.w	#-1,ob1
	cmpi.w	#-20,ob1x
	blt	aa1
	cmpi.w	#-20,ob1y
	blt	aa1
	cmpi.w	#20,ob1x
	bgt	aa1		
	cmpi.w	#20,ob1y
	bgt	aa1
	bra	aboff1
aa1:	subq.w	#1,sheilds
	move.w	#1,miss2
	move.w	#1,allflg
	bsr	boom
aboff1:
	addq.w	#1,through
	addi.w	#10,score
	bra	thirdb	
****************************
bp3off:
	move.w	#-1,ob2
	cmpi.w	#-20,ob2x
	blt	bb1
	cmpi.w	#-20,ob2y
	blt	bb1
	cmpi.w	#20,ob2x
	bgt	bb1		
	cmpi.w	#20,ob2y
	bgt	bb1
	bra	bboff1
bb1:	subq.w	#1,sheilds
	move.w	#1,miss2
	move.w	#1,allflg
	bsr	boom
bboff1:
	addq.w	#1,through
	addi.w	#10,score
	bra	thirdc	
****************************
cp3off:
	move.w	#-1,ob3
	cmpi.w	#-20,ob3x
	blt	ccc1
	cmpi.w	#-20,ob3y
	blt	ccc1
	cmpi.w	#20,ob3x
	bgt	ccc1		
	cmpi.w	#20,ob3y
	bgt	ccc1
	bra	cboff1
ccc1:	subq.w	#1,sheilds
	move.w	#1,miss2
	move.w	#1,allflg
	bsr	boom
cboff1:
	addq.w	#1,through
	addi.w	#10,score
	bra	thirdd	
****************************
dp3off:
	move.w	#-1,ob4
	cmpi.w	#-20,ob4x
	blt	dd1
	cmpi.w	#-20,ob4y
	blt	dd1
	cmpi.w	#20,ob4x
	bgt	dd1		
	cmpi.w	#20,ob4y
	bgt	dd1
	bra	dboff1
dd1:	subq.w	#1,sheilds
	move.w	#1,miss2
	move.w	#1,allflg
	bsr	boom
dboff1:
	addq.w	#1,through
	addi.w	#10,score
	bra	thirde	
****************************
ep3off:
	move.w	#-1,ob5
	cmpi.w	#-20,ob5x
	blt	ee1
	cmpi.w	#-20,ob5y
	blt	ee1
	cmpi.w	#20,ob5x
	bgt	ee1		
	cmpi.w	#20,ob5y
	bgt	ee1
	bra	eboff1
ee1:	subq.w	#1,sheilds
	move.w	#1,miss2
	move.w	#1,allflg
	bsr	boom
eboff1:
	addq.w	#1,through
	addi.w	#10,score
	bra	thirdf	

****************************
fp3off:
	move.w	#-1,ob7
	cmpi.w	#-20,ob7x
	blt	ff1
	cmpi.w	#-20,ob7y
	blt	ff1
	cmpi.w	#20,ob7x
	bgt	ff1		
	cmpi.w	#20,ob7y
	bgt	ff1
	bra	fboff1
ff1:	subq.w	#1,sheilds
	move.w	#1,miss2
	move.w	#1,allflg
	bsr	boom
fboff1:
	addq.w	#1,through
	addi.w	#10,score
	addq.w	#1,speed
	bra	prt3plot		








********************************
pre3:	lea	view_pbpt,a6
	move.w	#64,theta(a6)
	move.w	#0,pt1x
	move.w	#0,pt1y
	move.w	#0,pt1z

prea:	addq.w	#2,phi(a6)
	cmpi.w	#194,phi(a6)	
	bgt	pre32
	bsr	plot_obj
	bra	pre3

pre32:	lea	view_pbpt,a6
	addi.w	#150,rho(a6)
	cmpi	#4000,rho(a6)
	bgt	pre33
	bsr	plot_obj
	bra	pre32

pre33:	lea	view_pbpt,a6
	subi.w	#250,rho(a6)
	addi.w	#15,phi(a6)
	cmpi	#0,rho(a6)
	blt	prt3
	cmpi.w	#1,buttondat
	bge	gem
	bsr	plot_obj
	bra	pre33


********************************
second:	lea	view_pbpt,a6
	tst.w	ptts
	bpl	secit
	move.w	#0,plx
	move.w	#0,ply
	move.w	#0,plz

	move.w	#1,ptts
	move.w	#0,pt1y
	move.w	#5000,rho(a6)
	move.w	#64,theta(a6)
	move.w	#130,phi(a6)
secit:	move.w	speed,d0
	subi.w	#280,rho(a6)
	addq.w	#8,theta(a6)
	tst.w	rho(a6)	
	blt	begin2
	bsr	plot_obj
	bra	second

	

begin2:
	move.l	#view_pbpt,a6
	move.w	#200,rho(a6)
	move.w	#64,theta(a6)
	move.w	#130,phi(a6)
	move.w	#1,special
	move.w	#100,speed
	subi.w	#10,towerwide
	move.l	#tower,levob
	move.w	#100,off
	move.w	#0,pt1z
	move.w	#0,pt1x
	move.w	#0,plx
	move.w	#0,ply
	move.w	#0,plz

part2a:	
	tst.w	allflg
	bpl	pre3		
	move.l	#view_pbpt,a6
	move.w	xvel,d0
	move.w	yvel,d1
	neg.w	d0
	add.w	d0,theta(a6)
	move.w	plspeed,d7
	sub.w	d7,pt1z
	move.w	#10,pt1y	
	move.w	#130,phi(a6)
	cmpi.w	#54,theta(a6)
	ble	pa1
	cmpi.w	#74,theta(a6)
	bge	pa2
paa:	move.w	theta(a6),d0
	move.w	#255,d1
	sub.w	d0,d1
	move.w	#128,d0
	sub.w	d1,d0
	move.w	d0,thetasav
	cmpi.w	#64,theta(a6)
	blt	pa3
	bgt	pa4
	move.w	#0,obad
paa2:	;tst.w	pt1y
	;bmi	pa5
paa3:	;cmpi.w	#50,pt1y
	;bgt	pa6
paa4:	cmpi.w	#-110,pt1x
	blt	pa7
	cmpi.w	#110,pt1x
	bgt	pa8
paa5:	cmpi.w	#-35,pt1z
	blt	pa9

paa6:	bra	part2b

pa1:	move.w	#54,theta(a6)
	bra	paa
pa2:	move.w	#74,theta(a6)
	bra	paa

pa3:	addq.w	#2,pt1x
	move.w	#-15,obad
	bra	paa2
pa4:	subq.w	#2,pt1x
	move.w	#15,obad
	bra	paa2
pa5:	move.w	#0,pt1y
	bra	paa3
pa6:	move.w	#50,pt1y
	bra	paa4
pa7:	move.w	#0,pt1x
	bra	paa5
pa8:	move.w	#0,pt1x
	bra	paa5

pa9:	move.w	#0,pt1z
	bra	paa6

part2b:	lea	view_pb,a6
	tst.w	ob1
	bpl	pb1
	move.w	#1,ob1
	move.w	#-10,ob1y
	move.w	#6000,rho(a6)
	move.w	#64,theta(a6)
	move.w	#128,phi(a6)
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	asr.l	#4,d0
	ext.l	d0
	divs	off2x,d0
	add.w	pt1x,d0
	move.w	d0,ob1x
	move.w	d0,off1sav
pb1:	move.w	speed,d0
	sub.w	d0,rho(a6)
	move.w	thetasav,theta(a6)
	move.w	obad,d0
	add.w	d0,ob1x
*	move.w	my2,ob1y
	move.w	#128,phi(a6)
	cmpi.w	#50,rho(a6)	
	blt	part2boff
*******************
part2c:	lea	view_pb2,a6
	tst.w	ob2
	bpl	pbc
	move.w	#1,ob2
	move.w	#-10,ob2y
	move.w	#6000,rho(a6)
	move.w	#64,theta(a6)
	move.w	#128,phi(a6)
	move.w	off1sav,d0
	add.w	towerwide,d0
	move.w	d0,ob2x
pbc:	move.w	speed,d0
	sub.w	d0,rho(a6)
	move.w	thetasav,theta(a6)
	move.w	obad,d0
	add.w	d0,ob2x

	move.w	#128,phi(a6)
	cmpi.w	#50,rho(a6)	
	blt	part2coff


plotit2:bsr	keyboard
	bsr	plot_obj
	move.w	my,yvel
	move.w	#0,my
	move.w	mx,xvel
	move.w	#0,mx
	cmpi.w	#10,passed
	bge	ppl2
	bra	part2a
ppl2:	move.w	#1,allflg
	bra	part2a



part2boff:
	addq.w	#1,passed
	addi.w	#20,speed
	addq.w	#2,plspeed
	cmpi.w	#15,plspeed
	blt	lab1
	move.w	#15,plspeed
		
lab1:	move.w	#-1,ob1
	cmpi.w	#-40,ob1x
	blt	boff1
	cmpi.w	#-40,ob1y
	blt	boff1
	cmpi.w	#40,ob1x
	bgt	boff1		
	cmpi.w	#40,ob1y
	bgt	boff1
	subq.w	#1,sheilds
	move.w	#1,miss2
	bsr	boom
boff1:	tst.w	ob1x
	bmi	th1
	bra	part2c
th1:	tst.w	ob2x
	bpl	th2
	bra	part2c
th2:	addi.w	#100,score
*	move.w	#1,miss3
	bra	part2c	

part2coff:
	move.w	#-1,ob2
	cmpi.w	#-40,ob2x
	blt	boff2
	cmpi.w	#-40,ob2y
	blt	boff2
	cmpi.w	#40,ob2x
	bgt	boff2		
	cmpi.w	#40,ob2y
	bgt	boff2
	subq.w	#1,sheilds
	move.w	#1,miss2
	bsr	boom
boff2:	bra	plotit2


******************************

***************************************************************************
ptest:	tst.w	allflg
	bpl	prt2	
	lea	view_pb,a6
	tst.w	ob1
	bpl	moveit
	move.w	#1,ob1
	move.w	#0,ob1y
	move.w	#8000,rho(a6)
	move.w	#30,theta(a6)
	move.w	#150,phi(a6)
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,ob1x
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,ob1y

moveit:	move.w	speed,d0
	sub.w	d0,rho(a6)
	addi.w	#10,theta(a6)
	addq.w	#2,phi(a6)
	move.w	xvel,d0
	add.w	d0,ob1x
	move.w	yvel,d0
	add.w	d0,ob1y
	cmpi.w	#100,rho(a6)	
	blt	offscreen
**********
doob2:	lea	view_pb2,a6
	tst.w	ob2
	bpl	moveit2
	move.w	#1,ob2
	move.w	#0,ob2y
	move.w	#7000,rho(a6)
	move.w	#30,theta(a6)
	move.w	#150,phi(a6)
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,ob2x
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,ob2y

moveit2:move.w	speed,d0
	sub.w	d0,rho(a6)
	addq.w	#6,theta(a6)
	addq.w	#1,phi(a6)
	move.w	xvel,d0
	add.w	d0,ob2x
	move.w	yvel,d0
	add.w	d0,ob2y
	cmpi.w	#100,rho(a6)	
	blt	offscreen2
**********
doob3:	lea	view_pb3,a6
	tst.w	ob3
	bpl	moveit3
	move.w	#1,ob3
	move.w	#0,ob3x
	move.w	#8000,rho(a6)
	move.w	#30,theta(a6)
	move.w	#150,phi(a6)

	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,ob3x
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,ob3y

moveit3:move.w	speed,d0
	sub.w	d0,rho(a6)
	addq.w	#5,theta(a6)
	addq.w	#4,phi(a6)
	move.w	xvel,d0
	add.w	d0,ob3x
	move.w	yvel,d0
	add.w	d0,ob3y
	cmpi.w	#100,rho(a6)	
	blt	offscreen3
**************
doob4:	lea	view_pb4,a6
	tst.w	ob4
	bpl	moveit4
	move.w	#1,ob4
	move.w	#0,ob4x
	move.w	#9500,rho(a6)
	move.w	#30,theta(a6)
	move.w	#150,phi(a6)

	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,ob4x
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,ob4y

moveit4:move.w	speed,d0
	sub.w	d0,rho(a6)
	addq.w	#7,theta(a6)
	addq.w	#4,phi(a6)
	move.w	xvel,d0
	add.w	d0,ob4x
	move.w	yvel,d0
	add.w	d0,ob4y
	cmpi.w	#100,rho(a6)	
	blt	offscreen4
*********************
doob5:	lea	view_pb5,a6
	tst.w	ob5
	bpl	moveit5
	move.w	#1,ob5
	move.w	#0,ob5x
	move.w	#7500,rho(a6)
	move.w	#30,theta(a6)
	move.w	#150,phi(a6)

	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,ob5x
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,ob5y


moveit5:move.w	speed,d0
	sub.w	d0,rho(a6)
	addq.w	#5,theta(a6)
	addq.w	#8,phi(a6)
	move.w	xvel,d0
	add.w	d0,ob5x
	move.w	yvel,d0
	add.w	d0,ob5y
	cmpi.w	#100,rho(a6)	
	blt	offscreen5
*********************
doob6:	lea	view_pb6,a6
	tst.w	ob6
	bpl	moveit6
	move.w	#1,ob6
	move.w	#0,ob6x
	move.w	#0,ob6y
	move.w	#8000,rho(a6)
	move.w	#64,theta(a6)
	move.w	#191,phi(a6)
	bra	moveit6

	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,ob6x
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,ob6y

moveit6:move.w	speed,d0
	sub.w	d0,rho(a6)
	move.w	fspeed,d0
	add.w	d0,rho(a6)
	move.w	xvel,d0
	add.w	d0,ob6x
	move.w	yvel,d0
	add.w	d0,ob6y
	move.w	dodgex,d0
	add.w	d0,ob6x
	move.w	dodgey,d0
	add.w	d0,ob6y
	cmpi.w	#-2,velcnt
	bgt	hitrotx
qqqq:	cmpi.w	#200,rho(a6)	
	blt	off6
	cmpi.w	#8000,rho(a6)
	bgt	shfar
ssss:	bsr	chdod
	bra	doob7
shfar:	move.w	#8000,rho(a6)	
*********************
doob7:	lea	view_pb7,a6
	tst.w	ob7
	bpl	moveit7
	move.w	#1,ob7
	move.w	#300,ob7y
	move.w	#8500,rho(a6)
	move.w	#30,theta(a6)
	move.w	#150,phi(a6)

	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,ob7x
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,ob7y

moveit7:move.w	speed,d0
	sub.w	d0,rho(a6)
	addq.w	#8,theta(a6)
	addq.w	#8,phi(a6)
	move.w	xvel,d0
	add.w	d0,ob7x
	move.w	yvel,d0
	add.w	d0,ob7y
	cmpi.w	#100,rho(a6)	
	blt	offscreen7

*********************
doob8:	lea	view_pb8,a6
	tst.w	ob8
	bpl	moveit8
	move.w	#1,ob8
	move.w	#300,ob8x
	move.w	#9500,rho(a6)
	move.w	#30,theta(a6)
	move.w	#150,phi(a6)
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,ob8x
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,ob8y

moveit8:move.w	speed,d0
	sub.w	d0,rho(a6)
	addq.w	#5,theta(a6)
	addq.w	#8,phi(a6)
	move.w	xvel,d0
	add.w	d0,ob8x
	move.w	yvel,d0
	add.w	d0,ob8y
	cmpi.w	#100,rho(a6)	
	blt	offscreen8

*********************
doob9:	lea	view_pb9,a6
	tst.w	ob9
	bpl	moveit9
	move.w	#1,ob9
	move.w	#300,ob9x
	move.w	#6500,rho(a6)
	move.w	#30,theta(a6)
	move.w	#150,phi(a6)

	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,ob9x
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,ob9y

moveit9:move.w	speed,d0
	sub.w	d0,rho(a6)
	addi.w	#9,theta(a6)
	addq.w	#1,phi(a6)
	move.w	xvel,d0
	add.w	d0,ob9x
	move.w	yvel,d0
	add.w	d0,ob9y
	cmpi.w	#100,rho(a6)	
	blt	offscreen9

*********************
dooba:	lea	view_pba,a6
	tst.w	oba
	bpl	moveita
	move.w	#1,oba
	move.w	#300,obay
	move.w	#11000,rho(a6)
	move.w	#0,theta(a6)
	move.w	#0,phi(a6)

	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,obax
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	off,d0
	move.w	d0,obay

moveita:move.w	speed,d0
	sub.w	d0,rho(a6)
	addq.w	#8,phi(a6)
	move.w	xvel,d0
	add.w	d0,obax
	move.w	yvel,d0
	add.w	d0,obay
	cmpi.w	#100,rho(a6)	
	blt	offscreena

****************

plotit:	bsr	plot_obj
	bsr	keyboard
	cmpi.w	#2,buttondat
	beq	spd
	move.w	my,yvel
	move.w	#0,my
	move.w	mx,xvel
	neg.w	xvel
	move.w	#0,mx

ppl1:	cmpi.w	#1,buttondat
	beq	shoot
	move.w	spsav,my2
	bra	ptest

spd:	move.w	my2,d0
	move.w	d0,spsav
	move.w	#420,d1
	sub.w	d0,d1
	addi.w	#50,d1
	move.w	d1,speed
	bra	ppl1

shoot:	tst.w	miss1
	bpl	shb
	tst.w	velcnt
	bpl	shb
	tst.w	exp
	bpl	shb
	move.l	#shootsnd,-(sp)
	move.w	#1,miss1
	move.w	#32,-(sp)
	trap	#14
	addq.l	#6,sp
shb:	bra	ptest		

***************************
hitrotx:
	move.w	#-1,miss1
	tst.w	velcnt
	bmi	hitrotbx
	move.w	#-1,miss1
	lea	view_pb6,a6
	move.w	rtheta,d0
	add.w	d0,theta(a6)
	move.w	rphi,d0
	add.w	d0,phi(a6)
	subq.w	#1,velcnt
	bra	qqqq	

hitrotbx:
	bsr	boom3
	addq.w	#1,shiphit
	move.w	#-3,velcnt
	move.w	#0,xvel
	move.w	#0,yvel
	move.w	ob6x,miss1x
	move.w	ob6y,d0
	move.w	d0,miss1y
	move.w	ob6z,miss1z
	move.l	#view_pb6,a6
	move.l	#view_pbex,a5
	move.w	rho(a6),rho(a5)
	addi.w	#500,rho(a5)
	move.w	#100,phi(a5)
	move.w	#8000,rho(a6)

	move.w	#1,exp
	move.w	#-1,ob6
	bra	qqqq		



*************************
keyboard:
	move.w	#$ff,-(sp)
	move.w	#6,-(sp)
	trap	#1
	addq.l	#4,sp
	tst.l	d0
	beq	keyback
	swap	d0
si:	cmpi.w	#$1f,d0
	bne	info
	neg.w	sightflg
	move.l	#inst,-(sp)
	move.w	#32,-(sp)
	trap	#14
	addq.l	#6,sp
	rts	
info:	cmpi.w	#$13,d0
	bne	quit
	neg.w	infoflg
	move.l	#inst,-(sp)
	move.w	#32,-(sp)
	trap	#14
	addq.l	#6,sp
	rts	
quit:	cmpi.w	#$10,d0
	bne	aman
	bra	gem
aman:	cmpi.w	#57,d0
	bne	moveon
	bra	pause
moveon:	cmpi.w	#$0f,d0
	bne	keyback
	move.w	#1,allflg
keyback:rts
*****************************
pause:	
	move.w	#$ff,-(sp)
	move.w	#6,-(sp)
	trap	#1
	addq.l	#4,sp
	tst.l	d0
	beq	pause
	swap	d0
	cmpi.w	#$1e,d0
	bne	keyback	
	bsr	gkey
	cmpi.w	#$32,d0
	bne	keyback
	bsr	gkey
	cmpi.w	#$1e,d0
	bne	keyback
	bsr	gkey
	cmpi.w	#$31,d0
	bne	keyback
	bsr	gkey
	cmpi.w	#$20,d0
	bne	keyback
	bsr	gkey
	cmpi.w	#$1e,d0
	bne	keyback
	bra	tmode

gkey:
	move.w	#$ff,-(sp)
	move.w	#6,-(sp)
	trap	#1
	addq.l	#4,sp
	tst.l	d0
	beq	gkey
	swap	d0
	rts
*****************************
offscreen:
	move.w	#-1,ob1
	cmpi.w	#-40,ob1x
	blt	off1
	cmpi.w	#-40,ob1y
	blt	off1
	cmpi.w	#40,ob1x
	bgt	off1		
	cmpi.w	#40,ob1y
	bgt	off1
	subq.w	#1,sheilds
	move.w	#1,miss2
	bsr	boom
off1:	bra	doob2

offscreen2:
	move.w	#-1,ob2
	cmpi.w	#-40,ob2x
	blt	off2
	cmpi.w	#-40,ob2y
	blt	off2
	cmpi.w	#40,ob2x
	bgt	off2		
	cmpi.w	#40,ob2y
	bgt	off2
	move.w	#1,miss2
	subq.w	#1,sheilds
	bsr	boom
off2:	bra	doob3

offscreen3:
	move.w	#-1,ob3
	cmpi.w	#-40,ob3x
	blt	off3
	cmpi.w	#-40,ob3y
	blt	off3
	cmpi.w	#40,ob3x
	bgt	off3		
	cmpi.w	#40,ob3y
	bgt	off3
	move.w	#1,miss2
	subq.w	#1,sheilds
	bsr	boom
off3:	bra	doob4

offscreen4:
	move.w	#-1,ob4
	cmpi.w	#-40,ob4x
	blt	off4
	cmpi.w	#-40,ob4y
	blt	off4
	cmpi.w	#40,ob4x
	bgt	off4		
	cmpi.w	#40,ob4y
	bgt	off4
	subq.w	#1,sheilds
	move.w	#1,miss2
	bsr	boom
off4:	bra	doob5

offscreen5:
	move.w	#-1,ob5
	cmpi.w	#-40,ob5x
	blt	off5
	cmpi.w	#-40,ob5y
	blt	off5
	cmpi.w	#40,ob5x
	bgt	off5		
	cmpi.w	#40,ob5y
	bgt	off5
	subq.w	#1,sheilds
	move.w	#1,miss2
	bsr	boom
off5:	bra	doob6

offscreen6:
	move.w	#-1,ob6
	cmpi.w	#-40,ob6x
	blt	off6
	cmpi.w	#-40,ob6y
	blt	off6
	cmpi.w	#40,ob6x
	bgt	off6		
	cmpi.w	#40,ob6y
	bgt	off6
*	bsr	boom
off6:	move.w	#200,rho(a6)
	bra	ssss

offscreen7:
	move.w	#-1,ob7
	cmpi.w	#-40,ob7x
	blt	off7
	cmpi.w	#-40,ob7y
	blt	off7
	cmpi.w	#40,ob7x
	bgt	off7		
	cmpi.w	#40,ob7y
	bgt	off7
	subq.w	#1,sheilds
	move.w	#1,miss2
	bsr	boom
off7:	bra	doob8


offscreen8:
	move.w	#-1,ob8
	cmpi.w	#-40,ob8x
	blt	off8
	cmpi.w	#-40,ob8y
	blt	off8
	cmpi.w	#40,ob8x
	bgt	off8		
	cmpi.w	#40,ob8y
	bgt	off8
	subq.w	#1,sheilds
	move.w	#1,miss2
	bsr	boom
off8:	bra	doob9

offscreen9:
	move.w	#-1,ob9
	cmpi.w	#-40,ob9x
	blt	off9
	cmpi.w	#-40,ob9y
	blt	off9
	cmpi.w	#40,ob9x
	bgt	off9		
	cmpi.w	#40,ob9y
	bgt	off9
	subq.w	#1,sheilds
	move.w	#1,miss2
	bsr	boom
off9:	bra	dooba

offscreena:
	move.w	#-1,oba
	cmpi.w	#-40,obax
	blt	offa
	cmpi.w	#-40,obay
	blt	offa
	cmpi.w	#40,obax
	bgt	offa		
	cmpi.w	#40,obay
	bgt	offa
	subq.w	#1,sheilds
	move.w	#1,miss2
	bsr	boom
offa:	bra	plotit

return:	bra	gem		;Return to GEM
********************************
chdod:	tst.w	chcnt
	bpl	chome
	move.w	#9,chcnt
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	#5000,d0
	move.w	d0,dodgex

	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	#5000,d0
	move.w	d0,dodgey

	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	asr.l	#8,d0
	divu	#300,d0
	move.w	d0,fspeed
	rts

chome:	subq.w	#1,chcnt
	rts


******************************************************
boom:	move.w	#2,shake
	move.l	#boomsnd,-(sp)
	move.w	#32,-(sp)
	trap	#14
	addq.l	#6,sp
	tst.w	sheilds
	bmi	prefirst
	rts
******************************************************
boom3:	move.l	#boomsnd,-(sp)
	move.w	#32,-(sp)
	trap	#14
	addq.l	#6,sp
	tst.w	sheilds
	bmi	prefirst
	rts
******************************************************
boom2:	move.l	#rotsnd,-(sp)
	move.w	#32,-(sp)
	trap	#14
	addq.l	#6,sp
	addi.w	#50,score	
	move.w	#-1,miss1
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	#3500,d0
	move.w	d0,rtheta
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	ext.l	d0
	divs	#3500,d0
	move.w	d0,rphi
	move.w	#8,velcnt
*	move.w	#1,exp
*	move.w	#-1,ob6
	rts


*******************************************************************
prefirst:
	addq.l	#4,sp
	move.w	#0,sheilds
	bsr	plot_obj
	bsr	plot_obj
	bsr	waitfkey
	bra	ftf
	

***************************************************************************

*		PLOT AN OBJECT

*		On entry, a4 = pointer to object defintion

*	Plota 3-D object on the screen.

plot_obj:
	bsr	flip_scr
	bsr	undrawit
	move.l	#view_pb,view
	bsr	init_vtrans
	tst.w	ob1
	bmi	plot2
	lea.l	view_pb,a6
	move.w	rho(a6),dist
	move.l	#view_pb,viewsav
	move.l	levob,a4
	move.w	(a4)+,d6 	;Get number of verticies in object
	move.l	(a4)+,a3 	;Point to verticies
	move.w	(a4)+,numsav
	move.l	(a4)+,linesav
	tst.w	special
	bmi	spec1
	move.w	ob1y,ply
	move.w	ob1x,plx
	move.w	ob1z,plz
	bra	speca
	
spec1:	move.w	ob1y,yoffs
	move.w	ob1x,xoffs
	move.w	ob1z,zoffs

speca:	bsr	trans_vert	;Transform verticies
	cmpi.w	#5000,dist
	blt	pa
	move.w	#1,plm1
	move.w	#0,plm2
	move.w	#1,plm3
	move.w	#1,plm4
	bra	pd
pa:	cmpi.w	#1400,dist
	blt	pb
	move.w	#0,plm1
	move.w	#1,plm2
	move.w	#1,plm3
	move.w	#1,plm4
	bra	pd
pb:	move.w	#1,plm1
	move.w	#1,plm2
	move.w	#1,plm3
	move.w	#1,plm4
pd:	bsr	drawit
plot2:	tst.w	ob2
	bmi	plot3
	move.l	#view_pb2,view
	bsr	init_vtrans
	lea.l	view_pb2,a6
	move.w	rho(a6),dist
	move.l	#view_pb2,viewsav
	move.l	levob2,a4
	move.w	(a4)+,d6 	;Get number of verticies in object
	move.l	(a4)+,a3 	;Point to verticies
	move.w	(a4)+,numsav
	move.l	(a4)+,linesav
	tst.w	special
	bmi	spec2
	move.w	ob2y,ply
	move.w	ob2x,plx
	move.w	ob2z,plz
	bra	specb

spec2:	move.w	ob2y,yoffs
	move.w	ob2x,xoffs
	move.w	ob2z,zoffs
specb:	bsr	trans_vert	;Transform verticies
	cmpi.w	#5000,dist
	blt	p1a
	move.w	#1,plm1
	move.w	#0,plm2
	move.w	#1,plm3
	move.w	#1,plm4

	bra	p1d
p1a:	cmpi.w	#1400,dist
	blt	p1b
	move.w	#0,plm1
	move.w	#1,plm2
	move.w	#1,plm3
	move.w	#1,plm4

	bra	p1d
p1b:
	move.w	#1,plm1
	move.w	#1,plm2
	move.w	#1,plm3
	move.w	#1,plm4

p1d:	bsr	drawit
plot3:	tst.w	ob3
	bmi	plot4
	move.l	#view_pb3,view
	bsr	init_vtrans
	lea.l	view_pb3,a6
	move.w	rho(a6),dist
	move.l	#view_pb3,viewsav
	move.l	levob3,a4
	move.w	(a4)+,d6 	;Get number of verticies in object
	move.l	(a4)+,a3 	;Point to verticies
	move.w	(a4)+,numsav
	move.l	(a4)+,linesav
	tst.w	special
	bmi	spec3
	move.w	ob3y,ply
	move.w	ob3x,plx
	move.w	ob3z,plz
	bra	specc

spec3:	move.w	ob3y,yoffs
	move.w	ob3x,xoffs
	move.w	ob3z,zoffs
specc:	bsr	trans_vert	;Transform verticies
	cmpi.w	#5000,dist
	blt	p2a
	move.w	#1,plm1
	move.w	#0,plm2
	move.w	#1,plm3
	move.w	#1,plm4

	bra	p2d
p2a:	cmpi.w	#1400,dist
	blt	p2b
	move.w	#0,plm1
	move.w	#1,plm2
	move.w	#1,plm3
	move.w	#1,plm4
	bra	p2d
p2b:
	move.w	#1,plm1
	move.w	#1,plm2
	move.w	#1,plm3
	move.w	#1,plm4

p2d:	bsr	drawit
plot4:	tst.w	ob4
	bmi	plot5
	move.l	#view_pb4,view
	bsr	init_vtrans
	lea.l	view_pb4,a6
	move.w	rho(a6),dist
	move.l	#view_pb4,viewsav
	move.l	levob4,a4
	move.w	(a4)+,d6 	;Get number of verticies in object
	move.l	(a4)+,a3 	;Point to verticies
	move.w	(a4)+,numsav
	move.l	(a4)+,linesav
	tst.w	special
	bmi	spec4
	move.w	ob4y,ply
	move.w	ob4x,plx
	move.w	ob4z,plz
	bra	specd

spec4:	move.w	ob4y,yoffs
	move.w	ob4x,xoffs
	move.w	ob4z,zoffs
specd:	bsr	trans_vert	;Transform verticies
	cmpi.w	#5000,dist
	blt	p3a
	move.w	pl1,plm1
	move.w	pl2,plm2
	move.w	pl3,plm3
	move.w	pl4,plm4

	bra	p3d
p3a:	cmpi.w	#1400,dist
	blt	p3b
	move.w	bpl1,plm1
	move.w	bpl2,plm2
	move.w	bpl3,plm3
	move.w	bpl4,plm4

	bra	p3d
p3b:
	move.w	cpl1,plm1
	move.w	cpl2,plm2
	move.w	cpl3,plm3
	move.w	cpl4,plm4


p3d:	bsr	drawit

plot5:	tst.w	ob5
	bmi	plot7
	move.l	#view_pb5,view
	bsr	init_vtrans
	lea.l	view_pb5,a6
	move.w	rho(a6),dist
	move.l	#view_pb5,viewsav
	move.l	levob5,a4
	move.w	(a4)+,d6 	;Get number of verticies in object
	move.l	(a4)+,a3 	;Point to verticies
	move.w	(a4)+,numsav
	move.l	(a4)+,linesav
	tst.w	special
	bmi	spec5
	move.w	ob5y,ply
	move.w	ob5x,plx
	move.w	ob5z,plz
	bra	spece

spec5:	move.w	ob5y,yoffs
	move.w	ob5x,xoffs
	move.w	ob5z,zoffs
spece:	bsr	trans_vert	;Transform verticies
	cmpi.w	#5000,dist
	blt	p4a
	move.w	pl1,plm1
	move.w	pl2,plm2
	move.w	pl3,plm3
	move.w	pl4,plm4

	bra	p4d
p4a:	cmpi.w	#1400,dist
	blt	p4b
	move.w	bpl1,plm1
	move.w	bpl2,plm2
	move.w	bpl3,plm3
	move.w	bpl4,plm4

	bra	p4d
p4b:
	move.w	cpl1,plm1
	move.w	cpl2,plm2
	move.w	cpl3,plm3
	move.w	cpl4,plm4


p4d:	bsr	drawit
******
plot7:	tst.w	ob7
	bmi	plot8
	move.l	#view_pb7,view
	bsr	init_vtrans
	lea.l	view_pb7,a6
	move.w	rho(a6),dist
	move.l	#view_pb7,viewsav
	move.l	levob7,a4
	move.w	(a4)+,d6 	;Get number of verticies in object
	move.l	(a4)+,a3 	;Point to verticies
	move.w	(a4)+,numsav
	move.l	(a4)+,linesav
	tst.w	special
	bmi	spec6
	move.w	ob7y,ply
	move.w	ob7x,plx
	move.w	ob7z,plz
	bra	specf

spec6:	move.w	ob7y,yoffs
	move.w	ob7x,xoffs
	move.w	ob7z,zoffs
specf:	bsr	trans_vert	;Transform verticies
	cmpi.w	#5000,dist
	blt	p5a
	move.w	pl1,plm1
	move.w	pl2,plm2
	move.w	pl3,plm3
	move.w	pl4,plm4

	bra	p5d
p5a:	cmpi.w	#1400,dist
	blt	p5b
	move.w	bpl1,plm1
	move.w	bpl2,plm2
	move.w	bpl3,plm3
	move.w	bpl4,plm4

	bra	p5d
p5b:
	move.w	cpl1,plm1
	move.w	cpl2,plm2
	move.w	cpl3,plm3
	move.w	cpl4,plm4


p5d:	bsr	drawit

plot8:	tst.w	ob8
	bmi	plot9
	move.l	#view_pb8,view
	bsr	init_vtrans
	lea.l	view_pb8,a6
	move.w	rho(a6),dist
	move.l	#view_pb8,viewsav
	move.l	levob8,a4
	move.w	(a4)+,d6 	;Get number of verticies in object
	move.l	(a4)+,a3 	;Point to verticies
	move.w	(a4)+,numsav
	move.l	(a4)+,linesav
	tst.w	special
	bmi	spec7
	move.w	ob8y,ply
	move.w	ob8x,plx
	move.w	ob8z,plz
	bra	specg

spec7:	move.w	ob8y,yoffs
	move.w	ob8x,xoffs
	move.w	ob8z,zoffs
specg:	bsr	trans_vert	;Transform verticies
	cmpi.w	#5000,dist
	blt	p6a
	move.w	pl1,plm1
	move.w	pl2,plm2
	move.w	pl3,plm3
	move.w	pl4,plm4

	bra	p6d
p6a:	cmpi.w	#1400,dist
	blt	p6b
	move.w	bpl1,plm1
	move.w	bpl2,plm2
	move.w	bpl3,plm3
	move.w	bpl4,plm4

	bra	p6d
p6b:
	move.w	cpl1,plm1
	move.w	cpl2,plm2
	move.w	cpl3,plm3
	move.w	cpl4,plm4


p6d:	bsr	drawit

plot9:	tst.w	ob9
	bmi	plota
	move.l	#view_pb9,view
	bsr	init_vtrans
	lea.l	view_pb9,a6
	move.w	rho(a6),dist
	move.l	#view_pb9,viewsav
	move.l	levob9,a4
	move.w	(a4)+,d6 	;Get number of verticies in object
	move.l	(a4)+,a3 	;Point to verticies
	move.w	(a4)+,numsav
	move.l	(a4)+,linesav
	tst.w	special
	bmi	spec8
	move.w	ob9y,ply
	move.w	ob9x,plx
	move.w	ob9z,plz
	bra	spech

spec8:	move.w	ob9y,yoffs
	move.w	ob9x,xoffs
	move.w	ob9z,zoffs
spech:	bsr	trans_vert	;Transform verticies
	cmpi.w	#5000,dist
	blt	p7a
	move.w	#1,plm1
	move.w	#0,plm2
	move.w	#1,plm3
	move.w	#1,plm4

	bra	p7d
p7a:	cmpi.w	#1400,dist
	blt	p7b
	move.w	#0,plm1
	move.w	#1,plm2
	move.w	#1,plm3
	move.w	#1,plm4

	bra	p7d
p7b:
	move.w	#1,plm1
	move.w	#1,plm2
	move.w	#1,plm3
	move.w	#1,plm4


p7d:	bsr	drawit

plota:	tst.w	oba
	bmi	plot6
	move.l	#view_pba,view
	bsr	init_vtrans
	lea.l	view_pba,a6
	move.w	rho(a6),dist
	move.l	#view_pba,viewsav
	move.l	levoba,a4
	move.w	(a4)+,d6 	;Get number of verticies in object
	move.l	(a4)+,a3 	;Point to verticies
	move.w	(a4)+,numsav
	move.l	(a4)+,linesav
	tst.w	special
	bmi	spec9
	move.w	obay,ply
	move.w	obax,plx
	move.w	obaz,plz
	bra	speci

spec9:	move.w	obay,yoffs
	move.w	obax,xoffs
	move.w	obaz,zoffs
speci:	bsr	trans_vert	;Transform verticies
	cmpi.w	#5000,dist
	blt	p8a
	move.w	#1,plm1
	move.w	#0,plm2
	move.w	#1,plm3
	move.w	#1,plm4

	bra	p8d
p8a:	cmpi.w	#1400,dist
	blt	p8b
	move.w	#0,plm1
	move.w	#1,plm2
	move.w	#1,plm3
	move.w	#1,plm4

	bra	p8d
p8b:
	move.w	#1,plm1
	move.w	#1,plm2
	move.w	#1,plm3
	move.w	#1,plm4


p8d:	bsr	drawit
*************


plot6:	tst.w	ob6
	bmi	plotshoot
	move.l	#view_pb6,view
	bsr	init_vtrans
	lea.l	view_pb6,a6
	move.w	rho(a6),dist
	move.l	#view_pb6,viewsav
	move.l	#ship,a4
	move.w	(a4)+,d6 	;Get number of verticies in object
	move.l	(a4)+,a3 	;Point to verticies
	move.w	(a4)+,numsav
	move.l	(a4)+,linesav
	tst.w	special
	bmi	spec10
	move.w	ob6y,ply
	move.w	ob6x,plx
	move.w	ob6z,plz
	bra	specj

spec10:	move.w	ob6y,yoffs
	move.w	ob6x,xoffs
	move.w	ob6z,zoffs
specj:	bsr	trans_vert	;Transform verticies
	cmpi.w	#1200,dist
	blt	psa
	move.w	#0,plm1
	move.w	#0,plm2
	move.w	#1,plm3
	move.w	#1,plm4
	move.w	#$005,$ff8258
	bra	psd
psa:	cmpi.w	#600,dist
	blt	psb
	move.w	#0,plm1
	move.w	#0,plm2
	move.w	#1,plm3
	move.w	#1,plm4
	move.w	#$0006,$ff8258
	bra	psd
psb:	move.w	#0,plm1
	move.w	#0,plm2
	move.w	#1,plm3
	move.w	#1,plm4
	move.w	#$0007,$ff8258

psd:	bsr	drawit


plotshoot:
	tst.w	miss1
	bmi	plotpts
	cmpi.w	#1,shtcnt
	bne	sht1
	move.l	#stage1,a6
	addq.w	#1,shtcnt
	move.w	#1,plm1
	move.w	#1,plm2
	move.w	#0,plm3
	move.w	#1,plm4
	bra	shootdr
sht1:	cmpi.w	#2,shtcnt
	bne	sht2
	addq.w	#1,shtcnt
	move.l	#stage2,a6
	move.w	#0,plm1
	move.w	#1,plm2
	move.w	#0,plm3
	move.w	#1,plm4
	bra	shootdr
sht2:	
	cmpi.w	#-8,ob6x
	blt	offsh
	cmpi.w	#-8,ob6y
	blt	offsh
	cmpi.w	#8,ob6x
	bgt	offsh		
	cmpi.w	#8,ob6y
	bgt	offsh
	move.w	#1,gotit
*	move.w	#-1,miss1
	bsr	boom2
offsh:	move.w	#-1,miss1
	move.w	#1,shtcnt
	move.l	#stage3,a6
	move.w	#1,plm1
	move.w	#0,plm2
	move.w	#0,plm3
	move.w	#1,plm4

shootdr:
	move.l	linepar,a0
	move.w	plm1,24(a0)	;note d6 cont. nuber of vert
	move.w	plm2,26(a0)
	move.w	plm3,28(a0)
	move.w	plm4,30(a0)
	move.w	#$ffff,34(a0)
	move.w	#0,36(a0)
	move.w	#-1,32(a0)
	move.w	(a6)+,38(a0)
	move.w	(a6)+,40(a0)
	move.w	(a6)+,42(a0)
	move.w	(a6)+,44(a0)
	dc.w	$a003
	move.l	linepar,a0
	move.w	(a6)+,38(a0)
	move.w	(a6)+,40(a0)
	move.w	(a6)+,42(a0)
	move.w	(a6)+,44(a0)
	dc.w	$a003
	move.l	linepar,a0
	move.w	(a6)+,38(a0)
	move.w	(a6)+,40(a0)
	move.w	(a6)+,42(a0)
	move.w	(a6)+,44(a0)
	dc.w	$a003
	move.l	linepar,a0
	move.w	(a6)+,38(a0)
	move.w	(a6)+,40(a0)
	move.w	(a6)+,42(a0)
	move.w	(a6)+,44(a0)
	dc.w	$a003


plotpts:tst.w	ptts
	bmi	plotexp

	move.l	#view_pbpt,view
	bsr	init_vtrans
	lea.l	view_pbpt,a6
	move.l	#view_pbpt,viewsav
	move.l	#plane,a4
	move.w	(a4)+,d6 	;Get number of verticies in object
	move.w	d6,numsav
	move.l	(a4)+,a3 	;Point to verticies
	tst.w	special
	bmi	spec12
	move.w	pt1y,ply
	move.w	pt1x,plx
	move.w	pt1z,plz
	bra	specz
spec12:	move.w	pt1y,yoffs
	move.w	pt1x,xoffs
	move.w	pt1z,zoffs
specz:	bsr	trans_vert	;Transform verticies
	move.w	#11,color
	bsr	drpoints


plotexp:tst.w	exp
	bmi	plotpts2
	move.w	#0,plx
	move.w	#0,ply
	move.w	#0,plz

	move.l	#view_pbex,view
	bsr	init_vtrans
	lea.l	view_pbex,a6
	subi.w	#300,rho(a6)
	addi.w	#15,phi(a6)
	tst.w	rho(a6)
	ble	pexdone
	move.l	#view_pbex,viewsav
	move.l	#explo,a4
	move.w	(a4)+,d6 	;Get number of verticies in object
	move.w	d6,numsav
	move.l	(a4)+,a3 	;Point to verticies
	clr.l	d0
	move.w	miss1y,yoffs
	move.w	yvel,d0
	add.w	d0,yoffs
	move.w	miss1x,xoffs
	move.w	xvel,d0
	add.w	d0,xoffs
	move.w	miss1z,zoffs
	bsr	trans_vert	;Transform verticies
	move.w	#11,color
	bsr	drpoints
	bra	plotpts2

pexdone:

	move.w	#0,yoffs
	move.w	#0,zoffs
	move.w	#0,xoffs
	move.w	#-1,exp
	


plotpts2:
	tst.w	ptts2
	bmi	phome
	move.w	#0,plx
	move.w	#0,ply
	move.w	#0,plz
	move.l	#view_pbpt2,view
	bsr	init_vtrans
	lea.l	view_pbpt2,a6
	move.l	#view_pbpt2,viewsav
	move.l	#plane,a4
	move.w	(a4)+,d6 	;Get number of verticies in object
	move.w	d6,numsav
	move.l	(a4)+,a3 	;Point to verticies
	move.w	pt2y,yoffs
	move.w	pt2x,xoffs
	move.w	pt2z,zoffs
	bsr	trans_vert	;Transform verticies
	move.w	#15,color
	bsr	drpoints


phome:	bsr	putsight
	bsr	puttele
	bsr	putnums
	bsr	chkend
	rts

******************************
chkend:	cmpi.w	#5,shiphit
	bge	chk2
	rts
chk2:	move.w	#1,allflg
	rts





***************************
drpoints:
	move.l	ptsin,a5
	move.l	intin,a4
	move.l	a0,a6
	move.w	color,(a4)
	move.w	numsav,d7
	subq.w	#1,d7
drpts:	move.w	(a6)+,d0
	move.w	(a6)+,d1
	bra	fit
drp1:	move.w	d0,(a5)
	move.w	d1,2(a5)
	dc.w	$a001
	addq.w	#1,(a5)
	dc.w	$a001
drp2:	move.l	ptsin,a5
	move.l	intin,a4
	dbf	d7,drpts
	rts		



fit:	tst.w	d0
        bge    .S flip1
        bra	drp2
        
flip1: 	cmpi.w  #319,d0
        ble    .S flip2
        bra	drp2

flip2:	cmpi.w  #13,d1
        bge    .S flip3
        bra	drp2

flip3:	cmpi.w  #151,d1
        ble    .S flip4
        bra	drp2

flip4:	bra	drp1




**********************************
putnums:
prtscr:	move.l	#scorepos,pos
	move.l	#greencol,col
	move.w	score,d7
	cmp.w	extram,d7
	blt	noex
	addq.w	#1,sheilds
	addi.w	#10000,extram
noex:	move.w	score,number
	bsr	prtnum

prtsh:	move.l	#bikepos,pos
	move.l	#redcol,col
	move.w	sheilds,number
	bsr	prtnum

prtlev:	move.l	#levpos,pos
	move.l	#redcol,col
	move.w	level,number
	bsr	prtnum

prtinfo:
	tst.w	infoflg
	bmi	pthome
	move.l	#shipvelpos,pos
	move.l	#redcol,col
*	lea	view_pb,a6
*	move.w	phi(a6),d0
	move.w	fspeed,d0
	asl.w	#4,d0
	move.w	d0,number
	bsr	prtnum
	move.l	#myvelpos,pos
	move.l	#redcol,col
*	lea	view_pb,a6
*	move.w	theta(a6),d0
	move.w	speed,d0
	asl.w	#4,d0
	move.w	d0,number
	bsr	prtnum




pthome:	rts



***********************************
putsight:
	tst.w	sightflg
	bmi	sightb	
        move.w  #11,d1        ;height to d1
        subq.w  #1,d1           ;height - 1 = height if count starts at zero
        move.l  #sight,a1       ;image pointer to a1
        move.l  #sightm,a2       ;mask pointer to a2
        move.l  hiden,a3       ;screen buffer pointer to a3
	addi.l	#12072,a3

di1:    move.w  #1,d0        ;width to d0
        move.l  a3,a0        ;absolute screen address to a0
di0:    move.l  (a2)+,d3        ;load mask data into d3
	eor.l	#-1,d3
        move.l  (a1)+,d6        ;load screen image into d6 and d7
        move.l  (a1)+,d7        ;2 words each covers all 4 planes
        move.l  (a3)+,d4        ;do the same for the background
        move.l  (a3)+,d5        ;in d4 and d5 (from buffer, not screen)
        and.l   d3,d4           ;mask background
        and.l   d3,d5
        or.l    d6,d4           ;copy image onto background
        or.l    d7,d5           ;giving final image on top of background
        move.l  d4,(a0)+        ;copy final image into screen memory
        move.l  d5,(a0)+
	move.l	(a2)+,dummy
        dbf     d0,di0          ;repeat for 'width' times
        addi.l   #144,a3      ;move to next screen line
        dbf     d1,di1          ;repeat 'height' times
sightb: rts                     ;done




**********************************
puttele:
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp
	cmpi.w	#-27000,d0
	bgt	norm
	move.w	#$12,d0
	move.l	hiden,a0
	addi.l	#25672,a0
	move.l	#alt,a1
	
qpts1:	move.w	#1,d2
qpts2:	move.l	(a1)+,(a0)+
	move.l	(a1)+,(a0)+
	dbf	d2,qpts2
	addi.l	#144,a0
	dbf	d0,qpts1
	bra	distplot




norm:	move.w	#$12,d0
	move.l	hiden,a0
	addi.l	#25672,a0
	move.l	#posind,a1
pts1:	move.w	#1,d2
pts2:	move.l	(a1)+,(a0)+
	move.l	(a1)+,(a0)+
	dbf	d2,pts2
	addi.l	#144,a0
	dbf	d0,pts1

	clr.l	d0
	clr.l	d1
	move.w	ob6x,d0
	ext.l	d0
	divs	#10,d0
	addi.l	#159,d0
	move.w	ob6y,d1
	asr.w	#3,d1
	addi.w	#168,d1
	bsr	drpos

distplot:
	move.l	hiden,a0
	addi.l	#30152,a0
	move.l	#0,(a0)+
	move.l	#0,(a0)+
	move.l	#0,(a0)+
	move.l	#0,(a0)+
	move.l	#view_pb6,a0
	clr.l	d0
	move.w	rho(a0),d0
	divu	#260,d0
	addi.l	#144,d0	
	move.l	linepar,a0
	move.w	#144,38(a0)
	move.w	#188,40(a0)
	move.w	d0,42(a0)
	move.w	#0,24(a0)
	move.w	#0,26(a0)
	move.w	#1,28(a0)
	move.w	#1,30(a0)
	move.w	#0,36(a0)
	move.l	#patmsk,46(a0)
	move.w	#0,50(a0)
	dc.w	$a004
	rts	



*****************************
drpos:
	move.l	ptsin,a5
	move.l	intin,a4
	move.w	#12,(a4)

	bra	fitz
drp1z:
	move.w	d0,(a5)
	move.w	d1,2(a5)
	dc.w	$a001
	addq.w	#1,(a5)
	dc.w	$a001
	addq.w	#1,2(a5)	
	dc.w	$a001
	subq.w	#1,(a5)
	dc.w	$a001
drp2z:	rts		



fitz:	cmpi.w	#144,d0
        bge    .S flip1z
        move.w	#144,d0
        bra	flip2z

flip1z:	cmpi.w  #174,d0
        ble    .S flip2z
	move.w	#174,d0
	

flip2z:	cmpi.w  #160,d1
        bgt	flip3z
	move.w	#160,d1
        bra	drp1z
	
flip3z:	cmpi.w  #177,d1
        blt     flip4z
	move.w	#177,d1

flip4z:	bra	drp1z






*************************************

undrawit:
	move.l	hiden,a6
	adda	#2080,a6
	move.w	#55,d0	
	tst.w	shake
	bmi	zero
	move.w	#1599,d7
	move.w	#17,-(sp)
	trap	#14
	addq.l	#2,sp

inter:
	move.w	d0,(a6)+
	move.w	d0,(a6)+
	addq.l	#8,a6
	
	addq.l	#2,a6
	muls	#3,d0
	dbf	d7,inter
	subq.w	#1,shake
	bra	unb



zero:	move.l	#0,d1
	move.l	#0,d2
	move.l	#0,d3
	move.l	#0,d4
	move.l	#0,d5
	move.l	#0,d6
	move.l	#0,d7
	move.l	#0,a0
	move.l	#0,a1
	move.l	#0,a2
clrit:	movem.l	d1-d7/a0-a2,(a6)
	addi.l	#40,a6
	movem.l	d1-d7/a0-a2,(a6)
	addi.l	#40,a6
	movem.l	d1-d7/a0-a2,(a6)
	addi.l	#40,a6
	movem.l	d1-d7/a0-a2,(a6)
	addi.l	#40,a6
	movem.l	d1-d7/a0-a2,(a6)
	addi.l	#40,a6
	movem.l	d1-d7/a0-a2,(a6)
	addi.l	#40,a6
	movem.l	d1-d7/a0-a2,(a6)
	addi.l	#40,a6
	movem.l	d1-d7/a0-a2,(a6)
	addi.l	#40,a6
	movem.l	d1-d7/a0-a2,(a6)
	addi.l	#40,a6
	movem.l	d1-d7/a0-a2,(a6)
	addi.l	#40,a6
	dbf	d0,clrit
unb:	rts











		
****************************************************************
drawit:	move.w	#1,ynflg
	move.l	a0,a6		;add of transformed vertices
	move.l	a6,vsav
	move.l	linepar,a0
	move.w	plm1,24(a0)	;note d6 cont. nuber of vert
	move.w	plm2,26(a0)
	move.w	plm3,28(a0)
	move.w	plm4,30(a0)
	move.w	#$ffff,34(a0)
	move.w	#0,36(a0)
	move.w	#-1,32(a0)
	move.w	numsav,d7
	subq.w	#1,d7
	move.l	linesav,a5

dr1:	move.w	(a5)+,d4
	move.w	(a5)+,d5
	asl.w	#2,d4
	asl.w	#2,d5
	move.w	(a6,d4.w),d0
	move.w	2(a6,d4.w),d1
	move.w	(a6,d5.w),d2
	move.w	2(a6,d5.w),d3
	movem.l	d0-d7/a0-a6,-(sp)
	bsr	clipit
	movem.l	(sp)+,d0-d7/a0-a6
*	dc.w	$a003		;draw the line
	move.l	linepar,a0
	dbf	d7,dr1
	rts
*/**//*/*//*//*/*//*//*/*/*//*/*/*/*//*/*/*/*//*//*//*///*/*/
bitcode:clr.l	d4
	cmpi.w	xmin,d0
	bge	b1
	or.b	#8,d4
b1:	cmpi.w	xmax,d0
	ble	b2
	or.b	#4,d4
b2:	cmpi.w	ymin,d1
	bge	b3
	or.b	#1,d4
b3:	cmpi.w	ymax,d1
	ble	b4
	or.b	#2,d4
b4:	move.w	d4,cbits
	rts
*****
bit2:	clr.l	d5
	cmpi.w	xmin,d2
	bge	b5
	or.b	#8,d5
b5:	cmpi.w	xmax,d2
	ble	b6
	or.b	#4,d5
b6:	cmpi.w	ymin,d3
	bge	b7
	or.b	#1,d5
b7:	cmpi.w	ymax,d3
	ble	b8
	or.b	#2,d5
b8:	move.w	d5,cbits2
	rts
********************************************************
clipit:	bsr	bitcode
	bsr	bit2
clipit2:or.b	d4,d5
	tst.b	d5
	beq	cliphome	;finish if
	move.w	cbits,d4
	move.w	d2,xsav
	move.w	d3,ysav
	move.w	cbits2,d5
clip1:	and.b	d4,d5
	tst.b	d5
	bgt	clipb		;home if line completely out
	move.w	cbits,d4
	move.w	cbits2,d5
	sub.w	d0,d2		;d1 has dx
	move.w	d2,dx
	sub.w	d1,d3		;d3 has dy
	move.w	d3,dy
	move.w	xsav,d2
	move.w	ysav,d3
	tst.w	d4
	beq	clip2	;if x1<xmin
	cmpi.w	xmin,d0	;y1=y1+dy*(xmin-x1)/dx
	bge	c1	
	move.w	xmin,d7		;put xmin in d7
	sub.w	d0,d7
	muls	dy,d7		;multiply by dy
	divs	dx,d7
	add.w	d1,d7
	move.w	d7,d1
	move.w	xmin,d0		;x1=xmin
	bra	c4
c1:	cmpi.w	xmax,d0		;if x1>xmax
	ble	c2		;y1=y1+dy*(xmax-x1)/dx
	move.w	xmax,d7		;put xmax in d7
	sub.w	d0,d7
	muls	dy,d7		;multiply by dy
	divs	dx,d7
	add.w	d1,d7
	move.w	d7,d1
	move.w	xmax,d0		;x1=xmax
	bra	c4
c2:	cmpi.w	ymin,d1		;if y1<ymin
	bge	c3
	move.w	ymin,d7		;put ymin in d7
	sub.w	d1,d7
	muls	dx,d7		;multiply by dx
	divs	dy,d7
	add.w	d0,d7
	move.w	d7,d0
	move.w	ymin,d1		;y1=ymin
	bra	c4
c3:	cmpi.w	ymax,d1		;if y1>xmax
	ble	c4
	move.w	ymax,d7		;put ymax in d7
	sub.w	d1,d7
	muls	dx,d7		;multiply by dy
	divs	dy,d7
	add.w	d0,d7
	move.w	d7,d0
	move.w	ymax,d1		;y1=ymax
c4:	bsr	bitcode
	bra	cliploop
******
clip2:	cmpi.w	xmin,d2	;y1=y1+dy*(xmin-x1)/dx
	bge	cc1	
	move.w	xmin,d7		;put xmin in d7
	sub.w	d2,d7
	muls	dy,d7		;multiply by dy
	divs	dx,d7
	add.w	d3,d7
	move.w	d7,d3
	move.w	xmin,d2		;x2=xmin
	bra	cc4
cc1:	cmpi.w	xmax,d2		;if x2>xmax
	ble	cc2
	move.w	xmax,d7		;put xmax in d7
	sub.w	d2,d7
	muls	dy,d7		;multiply by dy
	divs	dx,d7
	add.w	d3,d7
	move.w	d7,d3
	move.w	xmax,d2		;x1=xmax
	bra	cc4
cc2:	cmpi.w	ymin,d3		;if y1<ymin
	bge	cc3
	move.w	ymin,d7		;put ymin in d7
	sub.w	d3,d7
	muls	dx,d7		;multiply by dx
	divs	dy,d7
	add.w	d2,d7
	move.w	d7,d2
	move.w	ymin,d3		;y1=ymin
	bra	cc4
cc3:	cmpi.w	ymax,d3		;if y1>xmax
	ble	cc4
	move.w	ymax,d7		;put ymax in d7
	sub.w	d3,d7
	muls	dx,d7		;multiply by dy
	divs	dy,d7
	add.w	d2,d7
	move.w	d7,d2
	move.w	ymax,d3		;y1=ymax
*	bra	cliploop	
cc4:	bsr	bit2
	bra	cliploop

cliploop:
	bra	clipit2
cliphome:
*	movem.l	d0-d7/a0-a6,-(sp)
	move.l	linepar,a0
	move.w	d0,38(a0)
	move.w	d1,40(a0)
	move.w	d2,42(a0)
	move.w	d3,44(a0)
	dc.w	$a003
*	movem.l	(sp)+,d0-d7/a0-a6

clipb:	rts
***************************************************************************

*		TRANSFORM A LIST OF VERTICIES

*		On entry,   d6 = number of verticies
*			    a3 = pointer to verticies
*		On exit , a0 = pointer to transformed verticies

*	Transform a list of verticies in 3-D space according to the
* viewing transformation.

trans_vert:
	lea.l	vtrans_vrt,a1	;Point to vertex tables
	lea.l	ptrans_vrt,a0
	move.l	a0,-(SP)

	subq	#1,d6		;Pre-decrement vertex counter
trans_vert0:
	move	(a3)+,d0	;Get x-coordinate of vertex
	add.w	plx,d0
	move	(a3)+,d1	;Get y-coordinate
	add.w	ply,d1
	move	(a3)+,d2	;Get z-coordinate
	add.w	plz,d2
	
	bsr	view_trans	;Apply view transformatrmed coordinates
	add.w	xoffs,d3
	move.w	d3,(a1)+
	add.w	yoffs,d4
	move	d4,(a1)+
	add.w	zoffs,d5
	move	d5,(a1)+

	bsr	prsp_trans	;Apply perspective transformation
	move	d3,(a0)+	;Save transformed x-coordinate		
	move	d4,(a0)+	;Save transformed y-coordinate
		
	dbf	d6,trans_vert0
	move.l	(SP)+,a0	;Restore transformed vertex pointer

	rts

vtrans_vrt:	blk.w	1000	;View transformed coordinates	
ptrans_vrt:	blk.w	1000	;Perspective transformed coordinates


***************************************************************************
pyr:	dc.w	5
	dc.l	pyrvrt
	dc.w	8
	dc.l	pyrline

pyrvrt:	dc.w	-30,30,-30	
	dc.w	30,30,-30
	dc.w	30,-30,-30
	dc.w	-30,-30,-30
	dc.w	0,0,30
pyrline:
	dc.w	0,1
	dc.w	1,2
	dc.w	2,3
	dc.w	3,0
	dc.w	0,4
	dc.w	1,4
	dc.w	2,4
	dc.w	3,4

******************************************************************
fpar:	dc.w	1
	dc.l	fpnt

fpnt:	dc.w	0,0,0

****************************************0***********************************
diamond:
	dc.w	6
	dc.l	dievrt
	dc.w	12
	dc.l	dieline

dievrt:	dc.w	-30,30,0	
	dc.w	30,30,0
	dc.w	30,-30,0
	dc.w	-30,-30,0
	dc.w	0,0,40
	dc.w	0,0,-40
dieline:
	dc.w	0,1
	dc.w	1,2
	dc.w	2,3
	dc.w	3,0
	dc.w	0,4
	dc.w	1,4
	dc.w	2,4
	dc.w	3,4
	dc.w	0,5
	dc.w	1,5
	dc.w	2,5
	dc.w	3,5


********************
ship:	dc.w	6
	dc.l	shipvrt
	dc.w	12
	dc.l	shiplin

shipvrt:dc.w	0,50,0
	dc.w	20,-20,0
	dc.w	0,-30,0
	dc.w	-20,-20,0
	dc.w	0,-15,10
	dc.w	0,-20,-5

shiplin:
	dc.w	0,1	
	dc.w	0,3
	dc.w	0,4
	dc.w	0,5
	dc.w	3,4
	dc.w	4,1
	dc.w	1,5
	dc.w	5,3
	dc.w	3,2
	dc.w	2,1
	dc.w	4,2
	dc.w	5,2


************************
missile:dc.w	4
	dc.l	missvrt
	dc.w	6
	dc.l	misslin

missvrt:dc.w	0,40,0
	dc.w	40,-40,0
	dc.w	-40,-40,0
	dc.w	0,0,60

misslin:
	dc.w	0,1
	dc.w	1,2
	dc.w	2,0
	dc.w	0,3
	dc.w	1,3
	dc.w	2,3

*************************

**************************
tower:	dc.w	16
	dc.l	towvrt
	dc.w	24
	dc.l	towline

towvrt:
	dc.w	-30,-30,30
	dc.w	30,-30,30
	dc.w	30,-30,-30
	dc.w	-30,-30,-30

	dc.w	-30,150,30
	dc.w	30,150,30
	dc.w	30,150,-30
	dc.w	-30,150,-30

	dc.w	-50,150,50
	dc.w	50,150,50
	dc.w	50,150,-50
	dc.w	-50,150,-50

	dc.w	-50,170,50
	dc.w	50,170,50
	dc.w	50,170,-50
	dc.w	-50,170,-50

towline:
	dc.w	0,1
	dc.w	1,2
	dc.w	2,3
	dc.w	3,0
	dc.w	0,4
	dc.w	1,5
	dc.w	2,6
	dc.w	3,7
	dc.w	4,5
	dc.w	5,6
	dc.w	6,7
	dc.w	7,4

	dc.w	8,9
	dc.w	9,10
	dc.w	10,11
	dc.w	11,8
	dc.w	8,12
	dc.w	9,13
	dc.w	10,14
	dc.w	11,15
	dc.w	12,13
	dc.w	13,14
	dc.w	14,15
	dc.w	15,12

***************************
explo:	dc.w	30
	dc.l	explovrt

explovrt:
	dc.w	0,110,120
	dc.w	-110,110,20
	dc.w	-20,-120,0
	dc.w	0,40,-50
	dc.w	0,-120,-20
	dc.w	10,80,10
	dc.w	5,90,-15
	dc.w	-30,-4,28
	dc.w	0,-82,-15
	dc.w	-1,110,16
	dc.w	113,7,-12
	dc.w	80,-13,0
	dc.w	0,0,0
	dc.w	10,30,-12
	dc.w	0,-70,10

	dc.w	-50,10,120
	dc.w	110,-110,20
	dc.w	-120,120,0
	dc.w	0,80,-50
	dc.w	0,20,-20
	dc.w	10,-80,10
	dc.w	5,45,-15
	dc.w	30,-4,28
	dc.w	0,-102,-15
	dc.w	-1,-110,16
	dc.w	54,7,-12
	dc.w	-80,-13,0
	dc.w	0,-33,0
	dc.w	10,-30,-12
	dc.w	10,70,10

********************************
plane:	dc.w	66+55
	dc.l	planevrt

planevrt:
	dc.w	-200,0,200
	dc.w	-160,0,200
	dc.w	-120,00,200
	dc.w	-80,00,200
	dc.w	-40,00,200
	dc.w	0,00,200
	dc.w	200,00,200
	dc.w	160,00,200
	dc.w	120,00,200
	dc.w	80,00,200
	dc.w	40,00,200

	dc.w	-200,0,160
	dc.w	-160,0,160
	dc.w	-120,0,160
	dc.w	-80,0,160
	dc.w	-40,0,160
	dc.w	0,0,160
	dc.w	200,0,160
	dc.w	160,0,160
	dc.w	120,0,160
	dc.w	80,0,160
	dc.w	40,0,160

	dc.w	-200,0,120
	dc.w	-160,0,120
	dc.w	-120,0,120
	dc.w	-80,0,120
	dc.w	-40,0,120
	dc.w	0,0,120
	dc.w	200,0,120
	dc.w	160,0,120
	dc.w	120,0,120
	dc.w	80,0,120
	dc.w	40,0,120

	dc.w	-200,0,80
	dc.w	-160,0,80
	dc.w	-120,0,80
	dc.w	-80,0,80
	dc.w	-40,0,80
	dc.w	0,0,80
	dc.w	200,0,80
	dc.w	160,0,80
	dc.w	120,0,80
	dc.w	80,0,80
	dc.w	40,0,80

	dc.w	-200,0,40
	dc.w	-160,0,40
	dc.w	-120,0,40
	dc.w	-80,0,40
	dc.w	-40,0,40
	dc.w	0,0,40
	dc.w	200,0,40
	dc.w	160,0,40
	dc.w	120,0,40
	dc.w	80,0,40
	dc.w	40,0,40

	dc.w	-200,0,0
	dc.w	-160,0,0
	dc.w	-120,0,0
	dc.w	-80,0,0
	dc.w	-40,0,0
	dc.w	0,0,0
	dc.w	200,0,0
	dc.w	160,0,0
	dc.w	120,0,0
	dc.w	80,0,0
	dc.w	40,0,0



	dc.w	-200,0,-200
	dc.w	-160,0,-200
	dc.w	-120,00,-200
	dc.w	-80,00,-200
	dc.w	-40,00,-200
	dc.w	0,00,-200
	dc.w	200,00,-200
	dc.w	160,00,-200
	dc.w	120,00,-200
	dc.w	80,00,-200
	dc.w	40,00,-200

	dc.w	-200,0,-160
	dc.w	-160,0,-160
	dc.w	-120,0,-160
	dc.w	-80,0,-160
	dc.w	-40,0,-160
	dc.w	0,0,-160
	dc.w	200,0,-160
	dc.w	160,0,-160
	dc.w	120,0,-160
	dc.w	80,0,-160
	dc.w	40,0,-160

	dc.w	-200,0,-120
	dc.w	-160,0,-120
	dc.w	-120,0,-120
	dc.w	-80,0,-120
	dc.w	-40,0,-120
	dc.w	0,0,-120
	dc.w	200,0,-120
	dc.w	160,0,-120
	dc.w	120,0,-120
	dc.w	80,0,-120
	dc.w	40,0,-120

	dc.w	-200,0,-80
	dc.w	-160,0,-80
	dc.w	-120,0,-80
	dc.w	-80,0,-80
	dc.w	-40,0,-80
	dc.w	0,0,-80
	dc.w	200,0,-80
	dc.w	160,0,-80
	dc.w	120,0,-80
	dc.w	80,0,-80
	dc.w	40,0,-80

	dc.w	-200,0,-40
	dc.w	-160,0,-40
	dc.w	-120,0,-40
	dc.w	-80,0,-40
	dc.w	-40,0,-40
	dc.w	0,0,-40
	dc.w	200,0,-40
	dc.w	160,0,-40
	dc.w	120,0,-40
	dc.w	80,0,-40
	dc.w	40,0,-40
**********************************
cube:	dc.w	8	
	dc.l	cubevrt
	dc.w	12
	dc.l	cublin

cubevrt:
	dc.w	-40,40,-40
	dc.w	-40,-40,-40
	dc.w	40,-40,-40
	dc.w	40,40,-40
	dc.w	-40,40,40
	dc.w	-40,-40,40
	dc.w	40,-40,40
	dc.w	40,40,40

cublin:
	dc.w	0,1
	dc.w	1,2
	dc.w	2,3
	dc.w	3,0
	dc.w	4,5
	dc.w	5,6
	dc.w	6,7
	dc.w	7,4
	dc.w	0,4
	dc.w	1,5
	dc.w	3,7
	dc.w	2,6


*******************************
square:	dc.w	4
	dc.l	sqrvrt
	dc.w	4
	dc.l	sqrlin

sqrvrt:	dc.w	-20,20,0
	dc.w	20,20,0
	dc.w	20,-20,0
	dc.w	-20,-20,0

sqrlin:	dc.w	0,1
	dc.w	1,2
	dc.w	2,3
	dc.w	3,0


**********************************
corri:	dc.w	8
	dc.l	corrivrt
	dc.w	12
	dc.l	corlin

corrivrt:
	dc.w	-75,60,0
	dc.w	-75,-30,0
	dc.w	75,-30,0
	dc.w	75,60,0
	dc.w	-75,60,-3200
	dc.w	-75,-30,-3200
	dc.w	75,-30,-3200
	dc.w	75,60,-3200

corlin:	dc.w	0,1
	dc.w	1,2
	dc.w	2,3
	dc.w	4,5
	dc.w	5,6
	dc.w	6,7
	dc.w	0,4
	dc.w	1,5
	dc.w	2,6
	dc.w	3,7
	dc.w	3,0
	dc.w	7,4


**********************************
u:	dc.w	4
	dc.l	uvrt
	dc.w	4
	dc.l	ulin

uvrt:
	dc.w	-75,60,0	
	dc.w	-75,-30,0	
	dc.w	75,-30,0	
	dc.w	75,60,0	
ulin:	dc.w	0,1
	dc.w	1,2
	dc.w	2,3
	dc.w	3,0

**********************************
bar:	dc.w	8
	dc.l	barvrt
	dc.w	12
	dc.l	barlin

barvrt:
	dc.w	-25,60,0
	dc.w	-25,-30,0
	dc.w	25,-30,0
	dc.w	25,60,0
	dc.w	-25,60,40
	dc.w	-25,-30,40
	dc.w	25,-30,40
	dc.w	25,60,40

barlin:	dc.w	0,1
	dc.w	1,2
	dc.w	2,3
	dc.w	3,0
	dc.w	4,5
	dc.w	5,6
	dc.w	6,7
	dc.w	7,4
	dc.w	0,4
	dc.w	1,5
	dc.w	2,6
	dc.w	3,7


**********************************
tri:	dc.w	3
	dc.l	trivrt
	dc.w	3
	dc.l	trilin

trivrt:	dc.w	0,40,0
	dc.w	40,-40,0
	dc.w	-40,-40,0
trilin:	dc.w	0,1
	dc.w	1,2
	dc.w	2,0

	
********************************

thing:	dc.w	6
	dc.l	thvrt
	dc.w	6
	dc.l	thlin

thvrt:	dc.w	20,20,0
	dc.w	40,0,0
	dc.w	20,-20,0
	dc.w	-20,-20,0
	dc.w	-40,0,0
	dc.w	-20,20,0
thlin:
	dc.w	0,1
	dc.w	1,2
	dc.w	2,3
	dc.w	3,4
	dc.w	4,5
	dc.w	5,0




********************************
myship:	dc.w	33	
	dc.l	msvrt

msvrt:	dc.w	-10,30,0
	dc.w	-10,-20,0
	dc.w	0,-40,20
	dc.w	10,-20,0
	dc.w	10,30,0
	dc.w	0,-40,20
	dc.w	-10,30,0
	dc.w	10,30,0
	dc.w	60,-20,0
	dc.w	70,0,0
	dc.w	70,-40,0
	dc.w	70,-30,10
	dc.w	70,0,0
	dc.w	60,-20,0
	dc.w	60,-40,0
	dc.w	70,-30,10
	dc.w	70,-40,0
	dc.w	60,-40,0
	dc.w	10,0,0
	dc.w	10,-20,0
	dc.w	-10,-20,0
	dc.w	-10,0,0
	dc.w	-60,-40,0
	dc.w	-70,-40,0
	dc.w	-70,0,0
	dc.w	-60,-20,0
	dc.w	-60,-40,0
	dc.w	-70,-30,10
	dc.w	-70,-40,0
	dc.w	-70,-30,10
	dc.w	-70,0,0
	dc.w	-60,-20,0
	dc.w	-10,30,0
********************************
chase:	dc.w	77
	dc.l	chvrt
	dc.w	76
	dc.l	chlin

chvrt:
	dc.w	-120,30,0
	dc.w	-120,-20,0
	dc.w	-110,-30,0
	dc.w	-90,-30,0
	dc.w	-80,-20,0
	dc.w	-80,-10,0
	dc.w	-90,-10,0
	dc.w	-90,-20,0
	dc.w	-110,-20,0
	dc.w	-110,30,0
	dc.w	-90,30,0
	dc.w	-90,20,0
	dc.w	-80,20,0
	dc.w	-80,30,0
	dc.w	-90,40,0
	dc.w	-110,40,0
	dc.w	-70,40,0
	dc.w	-70,-30,0
	dc.w	-60,-30,0
	dc.w	-60,-10,0
	dc.w	-40,-10,0
	dc.w	-40,-30,0
	dc.w	-30,-30,0
	dc.w	-30,40,0
	dc.w	-40,40,0
	dc.w	-40,0,0
	dc.w	-60,0,0
	dc.w	-60,40,0
	dc.w	-20,30,0
	dc.w	-20,-30,0
	dc.w	-10,-30,0
	dc.w	-10,-10,0
	dc.w	10,-10,0
	dc.w	10,-30,0
	dc.w	20,-30,0
	dc.w	20,30,0
	dc.w	10,40,0
	dc.w	-10,40,0
	dc.w	-10,30,0
	dc.w	-10,0,0
	dc.w	10,0,0
	dc.w	10,30,0
	dc.w	30,30,0
	dc.w	30,10,0
	dc.w	40,0,0
	dc.w	60,0,0
	dc.w	60,-20,0
	dc.w	40,-20,0
	dc.w	40,-10,0
	dc.w	30,-10,0
	dc.w	30,-20,0
	dc.w	40,-30,0
	dc.w	60,-30,0
	dc.w	70,-20,0
	dc.w	70,0,0
	dc.w	60,10,0
	dc.w	40,10,0
	dc.w	40,30,0
	dc.w	60,30,0
	dc.w	60,20,0
	dc.w	70,20,0
	dc.w	70,30,0
	dc.w	60,40,0
	dc.w	40,40,0
	dc.w	80,40,0
	dc.w	80,-30,0
	dc.w	120,-30,0
	dc.w	120,-20,0
	dc.w	90,-20,0
	dc.w	90,-10,0
	dc.w	110,-10,0
	dc.w	110,0,0
	dc.w	90,0,0
	dc.w	90,30,0
	dc.w	120,30,0
	dc.w	120,40,0

chlin:	dc.w	0,1,1,2,2,3,3,4
	dc.w	4,5,5,6,6,7,7,8,8
	dc.w	9,9,10,10,11,11
	dc.w	12,12,13,13,14
	dc.w	14,15,15,0

	dc.w	16,17,17,18,18
	dc.w	19,19,20,20,21,21
	dc.w	22,22,23,23,24,24
	dc.w	25,25,26,26,27,27
	dc.w	16

	dc.w	28,29,29,30,30,31
	dc.w	31,32,32,33,33,34
	dc.w	34,35,35,36,36,37
	dc.w	37,28
	dc.w	38,39,39,40,40
	dc.w	41,41,38

	dc.w	42,43,43,44,44
	dc.w	45,45,46,46,47,47
	dc.w	48,48,49,49,50,50
	dc.w	51,51,52,52,53,53
	dc.w	54,54,55,55,56,56
	dc.w	57,57,58,58,59,59
	dc.w	60,60,61,61,62,62
	dc.w	63,63,42

	dc.w	64,65,65,66,66
	dc.w	67,67,68,68,69,69
	dc.w	70,70,71,71,72,72
	dc.w	73,73,74,74,75,75
	dc.w	64

*******************************
*		VIEW TRANSFORM ON A VERTEX

*		On entry, d0 = x-coordinate of vertex
*			  d1 = y-coordinate of vertex
*			  d2 = z-coordinate of vertex
*		On exit , d3 = x-coordinate view transformed
*			  d4 = y-coordinate view transformed
*			  d5 = z-coordinate view transformed

*	Apply the view transform to a vertex.

view_trans:
	move.l	viewsav,a5
	move	d0,d7		;Calculate Xe
	muls	Va(a5),d7
	move.l	d7,d3
	move	d1,d7
	muls	Vb(a5),d7
	add.l	d7,d3
	swap	d3
	rol.l	#1,d3
		
	move	d0,d7		;Calculate Ye
	muls	Ve(a5),d7
	move.l	d7,d4
	move	d1,d7
	muls	Vf(a5),d7
	add.l	d7,d4
	move	d2,d7
	muls	Vg(a5),d7
	add.l	d7,d4
	swap	d4
	rol	#1,d4
		
	move	d0,d7		;Calculate Ze
	muls	Vi(a5),d7
	move.l	d7,d5
	move	d1,d7
	muls	Vj(a5),d7
	add.l	d7,d5
	move	d2,d7
	muls	Vk(a5),d7
	add.l	d7,d5
	swap	d5
	rol.l	#1,d5
	add	Vl(a5),d5
		
	rts
		
***************************************************************************

*		PERSPECTIVE TRANSFORM

*		On entry, d3 = view transformed x-coordinate
*			  d4 = view transformed y-coordinate
*			  d5 = view transformed z-coordinate
*		On exit , d3 = screen x-coordinate ( Xe )
*			  d4 = screen y-coordinate ( Ye )

*	Calculate the screen coordinates of the vertex. The coordinates are
* centered about the centre of the screen.
*	Note, the distance to the screen is 2048.

prsp_trans:
	swap	d3		;Calculate Xs
	clr	d3		
	asr.l	#8,d3	  
*	asr.l	#1,d3
	divs	d5,d3
		
	swap	d4		;Calculate Ys
	clr	d4
	asr.l	#8,d4
*	asr.l	#1,d4
	divs	d5,d4

	add	whx,d3		;Adjust for centre of screen
	add	why,d4

	rts
***************************************************************************

*		VIEW PARAMETER BLOCK

*	This is the parameter block for the view coordinate system
* and view transformation.

view_pb:blk.w	40		;Parameter block declaration
view_pb2:blk.w	40
view_pb3:blk.w	40
view_pb4:blk.w	40
view_pb5:blk.w	40
view_pb6:blk.w	40
view_pb7:blk.w	40
view_pb8:blk.w	40
view_pb9:blk.w	40
view_pba:blk.w	40
view_pbm1:blk.w	40
view_pbm2:blk.w	40
view_pbm3:blk.w	40
view_pbex:blk.w	40
view_pbpt:blk.w	40
view_pbpt2:blk.w	40

rho:	equ	0
theta:	equ	2
phi:	equ	4
s_theta:equ	6
c_theta:equ	8
s_phi:	equ	10
c_phi:	equ	12
va:	equ	14
vb:	equ	16
Ve:	equ	18
Vf:	equ	20
Vg:	equ	22
Vi:	equ	24
Vj:	equ	26
Vk:	equ	28
Vl:	equ	30

***************************************************************************

*		INITIALISE VIEW TRANSFORM

*	Initialise the viewing transformation.

init_vtrans:
	move.l	view,a5	;Point to parameter block
	move	theta(a5),d3	;Calculate SIN amd COS theta
	bsr	trig
	move	d4,s_theta(a5)
	move	d5,c_theta(a5)
	
	neg	d4		;Calcualte Va and Vb
	move	d4,Va(a5)
	move	d5,Vb(a5)

	move	phi(a5),d3	;Calculate SIN and COS phi
	bsr	trig
	move	d4,s_phi(a5)
	move	d5,c_phi(a5)

	move	d4,-(SP)	;Save SIN and COS phi
	move	d5,-(SP)
		
	neg	d5		;calculate Vg and Vk
	move	d4,Vg(a5)
	move	d5,Vk(a5)
		
	muls	c_theta(a5),d5  ;Calculate Ve
	swap	d5
	rol.l	#1,d5
	move	d5,Ve(a5)
		
	muls	c_theta(a5),d4  ;Calculate Vi
	swap	d4
	rol.l	#1,d4
	neg	d4
	move	d4,Vi(a5)
		
	move	(SP)+,d5	;Restore SIN and COS phi
	move	(SP)+,d4

	muls	Va(a5),d5	;Calculate Vf
	swap	d5
	rol.l	#1,d5
	move	d5,Vf(a5)
		
	muls	Va(a5),d4	;Calculate Vj
	swap	d4
	rol.l	#1,d4
	move	d4,Vj(a5)
		
	move	rho(a5),Vl(a5)	;Calculate Vl
	
	rts

***************************************************************************

*		CALCULATE SINE AND COSINE OF ANGLE
*		On entry, d3 = angle
*		On exit ,   d4 = sine of angle
*			    d5 = cosine of angle

*	Find the sine and cosine of an angle.

trig:	addi.w	#$40,d3		;Find cCOS of angle
	bsr	find_sin
	move	d4,d5
	subi.w	#$40,d3		;Find SIN of angle
	bsr	find_sin

	rts
		
***************************************************************************

*		FIND SINE OF AN ANGLE

*		On entry, d3 = angle
*		On exit ,   d5 = cosine of angle 

*	Find the cosine of an angle. The value of the sign is a 16 bit
* signed number.
*	Note, to scale down, divide by 15 bits, ie &8000.

find_cos:
	move	d4,-(SP)	;Save SIN
	move	d3,-(SP)	;Save angle
	addi.w	#$40,d3		;Find COS of angle
	bsr	find_sin
	move	d4,d5
		
	move	(SP)+,d3	;Restore angle
	move	(SP)+,d4	;Restore SIN
		
	rts	

***************************************************************************

*		FIND THE SIN OF AN ANGLE

*		On entry, d3 = angle
*		On exit ,   d4 = SIN of angle

*	Find the SIN of an angle. The value of the sign is a 16 bit
* signed number.
*	Note, to scale down, divide by 15 bits, ie &8000.

find_sin:
	move	d3,-(SP)	;Save angle	

	and.l	#$7F,d3		;Move to quadrants 1 and 2
	btst	#6,d3		;Test if in 1st quadrant
	beq	quad0		;Branch if in 1st quadrant
	bclr	#6,d3		;Reflect angle into 1st quadrant
	subi.b	#$3F,d3
	neg.b	d3
		
quad0:	asl	#1,d3		;Get value of SIN from table
	lea.l	sin_vt,a6
	move	0(a6,d3),d4
		
	move	(SP)+,d3

	btst	#7,d3		;Adjust value if 3rd or 4th quadrant
	beq	quad1
	neg	d4		;Negate SIN value
		
quad1:	rts

***************************************************************************

*		SIN LOOK UP TABLE

*	This is the SIN value look up table. Values for the 1st quadrant
* are given only. The values range from 0 - 32758 for angles 0 - 63.
* Thus, the value of a sine in the 1st quadrant is a 15 bit number.
* Therefore, the table can be used to construct a 16 bit signed value of
* SIN for angles 0 - 255.

sin_vt:	dc.w	0,804,1608,2411
	dc.w	3212,4011,4808,5602
	dc.w	6393,7180,7962,8740
	dc.w	9512,10279,11039,11793
	dc.w	12540,13279,14010,14733
	dc.w	15447,16151,16846,17531
	dc.w	18205,18868,19520,20160
	dc.w	20788,21403,22006,22595
	dc.w	23170,23732,24279,24812
	dc.w	25330,25832,26320,26791
	dc.w	27246,27684,28106,28511
	dc.w	28899,29269,29622,29957
	dc.w	30274,30572,30853,31114
	dc.w	31357,31581,31786,31972
	dc.w	32138,32286,32413,32522
	dc.w	32610,32679,32729,32758


***************************************************************************

*		RETURN TO GEM

gem:
	move.w  #34,-(sp)
        trap    #14
        addq.l  #2,sp
        move.l  d0,a0
        move.l  oldmouse,16(a0)

	move.b	#7,$484
	move.w	#1,-(sp)
	move.l	screen1,-(sp)
	move.l	screen1,-(sp)
	move.w	#5,-(sp)
	trap	#14
	addi.l	#12,sp
	

	move.l	spv_sp,-(SP)	;Back to user mode
	move.w	#$20,-(SP)
	trap	#1
	addq.l	#6,(SP)



illegal
        CLR.W   -(SP)		;RETURN TO GEM
   
        TRAP    #1

spv_sp:	blk.l	1		;supervisor SP store


***************************************************************************

*		FLIP SCREEN

*	Flip displayed screen.

flip_scr:

	move.l	seen,A6
	move.l	hiden,seen
	move.l	A6,hiden
df:	move.w	#-1,-(sp)
	move.l	seen,-(sp)
	move.l	hiden,-(sp)
	move.w	#5,-(sp)
	trap	#14
	addi.l	#12,sp	
	move.w	#37,-(SP)		;Wait for vertical sync
	trap	#14
	addq	#2,SP
	rts

****************************************************
getkey:	lea	key,a1
	move.b	(a1),d0
	rts

getjoy1:lea.l   joy1,a1
        move.b  (a1),d0
        rts

getjoy2:lea.l   joy2,a1
        move.b  (a1),d0
        rts




keyset:
	pea     mess1
        move.w  #1,-(sp)
        move.w  #25,-(sp)
        trap    #14
        addq.l  #8,sp
        pea     mess2
        move.w  #1,-(sp)
        move.w  #25,-(sp)

        trap    #14
        addq.l  #8,sp
       
        move.w  #34,-(sp)
        trap    #14
        addq.l  #2,sp
        move.l  d0,a0
        lea.l   keyint,a1
        move.l  a1,32(a0)
        rts
even
mess1:  dc.b    $12,$14
mess2:  dc.b    $13,$14


even
keyint: lea.l   $fffffc00,a1
        move.b  0(a1),d0
        btst    #7,d0
        beq.s   intk4
        btst    #0,d0
        bne.s   kriti
        andi.b  #$20,d0
        bne.s   kerror
kriti:  movem.l d2/a0-a4,-(sp)
        move.b  2(a1),d0
        lea.l   intwt,a2
        cmpi.b  #0,(a2)
        bne.s   keyj7
        cmpi.b  #$fc,d0
        bcs.s   keyj
        lea.l   joystat,a1
        cmpi.b  #$ff,d0
        bne.s   intk1
        move.b  #2,(a1)
intko:  bra.s   ekraj
kerror: move.b  2(a1),d0
intk4:  rts

ekraj:  movem.l (sp)+,d2/a0-a4
        and.b   #$20,d2
        beq.s   ekraj1
        move.b  2(a1),d0
ekraj1: rts

intk1:  cmpi.b  #$fe,d0
        beq.s   intk2
        lea.l   intwt,a4
        subi.b  #$f6,d0
        and.l   #$ff,d0
        lea.l   kentlen,a3
        move.b  0(a3,d0.w),(a4)
        bra.S   ekraj
intk2:  move.b  #1,(a1)
        bra     ekraj
keyj:   lea.l   intwt,a2
        cmpi.b  #0,(a2)
        beq.s   keyj5
keyj7:  subq.b  #1,(a2)
        bra     ekraj
keyj5:  lea.l   joystat,a1
        btst    #0,(a1)
        bne.s   jop1
        btst    #1,(a1)
        bne.s   jop2
	lea.l   nkey,a3
        move.b  d0,(a3)
        cmpi.b  #$80,d0
        bcs.s   keji
        move.b  #0,d0
        ;
keji:   lea.l   key,a3
keyj1:  move.b  d0,(a3)
        move.b  #0,(a1)
        bra     ekraj
jop1:   lea.l   joy1,a3
        bra.s   keyj1
jop2:   lea.l   joy2,a3
        bra.s   keyj1
scre:   rts
even
nkey:   dc.b    0
key:    dc.b    0
joy1:   dc.b    0
joy2:   dc.b    0
joystat:dc.b    0
intwt:  dc.b    0
kentlen:dc.b    7,5,2,2,2,2,6,2,1,1
bojaflg:dc.b    0
even
        dc.b    0,0,0,0,0,0,0,0
even
setloc: dc.l    0
cintno: dc.b    0
intim:  dc.b    0
        

even




*************************************************
linea:	dc.w	$a000
	move.l	a0,linepar
	move.l	8(a0),intin
	move.l	12(a0),ptsin
	rts

*************************************************

***********************fancy clear screen****************
clearsc:move.l  #99,d0
        move.l  screen,a0
cl1:    move.w  #159,d1
cl2:    move.w  #0,(a0)+
        dbf     d1,cl2
        addi.l  #160,a0
        dbf     d0,cl1
        move.w  #99,d0
        move.l  screen,a0
        addi.l  #160,a0
cl3:    move.w  #159,d1
cl4:    move.w  #0,(a0)+
        dbf     d1,cl4
        addi.l  #160,a0
        dbf     d0,cl3
        rts


cldel:  move.w  #3000,d2
cdel1:  nop
        dbf     d2,cdel1
        rts
********************fancy copy screen*************
copysc: move.w  #99,d0
        move.l  screen,a0
        move.l  screen2,a1
cop1:   move.w  #159,d1
cop2:   move.w  (a1)+,(a0)+
        dbf     d1,cop2
        addi.l  #160,a0
        addi.l  #160,a1
        dbf     d0,cop1
        move.w  #99,d0
        move.l  screen,a0
        addi.l  #160,a0
        move.l  screen2,a1
        addi.l  #160,a1
cop3:   move.w  #159,d1
cop4:   move.w  (a1)+,(a0)+
        dbf     d1,cop4
        addi.l  #160,a0
        addi.l  #160,a1
	dbf     d0,cop3
        rts
**********************routine to print a dec nuber*************
prtnum: 
        move.l  #0,d7
        move.w  number,d7
        andi.l  #$ffff,d7
        move.l  #line,a5

dodec:  move.l  d7,d6
        divu    #10,d6
        move.w  d6,d7
        swap    d6
        addi.w  #16,d6
        move.b  d6,(a5)+
        cmpi.w  #0,d7
        bne     dodec

        move.l  pos,-(sp)
        move.w  #9,-(sp)
        trap    #1
        addq.l  #6,sp
        move.l  col,-(sp)
        move.w  #9,-(sp)
        trap    #1
        addq.l  #6,sp

out:    cmpa.l  #line,a5
        beq     decback

        move.b  -(a5),d7
        andi.w  #$ff,d7
        
        move.w  d7,-(sp)
	move.w	#5,-(sp)
        move.w  #3,-(sp)
        trap    #13
        addq.l  #6,sp

        bra     out


decback:
        move.w  #' ',-(sp)
        move.w  #2,-(sp)
        trap    #1
        addq.l  #4,sp

	rts

*************puts my mouse interupt in***************** 


putrout:move.w  #34,-(sp)
        trap    #14
        addq.l  #2,sp
        move.l  d0,a0
	move.l	16(a0),oldmouse
        move.l  #myrout,16(a0)
        rts
**************my ubeut mouse interupt*******************
myrout:
	movem.l	d0-d2/a0-a1,-(sp)
	moveq	#0,d0	
	move.b	(a0),d0
	cmpi.b	#$fa,d0
	bne	myr1
	move.w	#1,buttondat
	bra	myrxy
myr1:
	cmpi.b	#$f9,d0
	bne	myr2
	move.w	#2,buttondat
	bra	myrxy
myr2:
	cmpi.b	#$fb,d0
	bne	myr3
	move.w	#3,buttondat
	bra	myrxy
myr3:
	move.w	#0,buttondat

myrxy:
	moveq	#0,d0
	move.b	1(a0),d0
	ext.w	d0
	moveq	#0,d1
	move.b	2(a0),d1
	ext.w	d1
	move.w	d1,d2
	add.w	d0,mx
	add.w	d1,my
	add.w	d1,my2
	move.w	mx,d0
	move.w	my,d1
	move.w	my2,d2
	bsr	extra
	move.w	d0,mx
	move.w	d1,my
	move.w	d2,my2
	movem.l	(sp)+,d0-d2/a0-a1
	rts


extra:  cmpi.w	mmin,d0
        bge    .S extra1
        move.w	mmin,d0
        bra    .S extra2
extra1: cmpi.w   mmax,d0
        ble    .S extra2
        move.w  mmax,d0
extra2:	cmpi.w  mmin,d1
        bge    .S extra3
        move.w  mmin,d1
        bra	extra4
extra3: cmpi.w   mmax,d1
        ble    .S extra4
        move.w  mmax,d1
extra4:	cmpi.w  #150,d2
        bge    .S extra5
        move.w  #150,d2
        rts
extra5: cmpi.w	#420,d2
        ble    .S extra6
        move.w  #420,d2
extra6:	rts


 rts



************get screen address***************
getscrn:move.w  #2,-(sp)
        trap    #14
        addq.l  #2,sp
        move.l  d0,screen
        move.l  d0,screen1
        move.l  d0,screen2
        subi.l  #$8000,screen2
	move.l	screen1,seen
	move.l	screen2,hiden
        rts



************change colors****************
colors: move.l #palette,-(sp)
        move.w #6,-(sp)
        trap #14
        addq.l #6,sp
        rts
************change colors****************
darkcolors:
	move.l #palette2,-(sp)
        move.w #6,-(sp)
        trap #14
        addq.l #6,sp
        rts

*****************wait for a key*********************
wait:   move.w  buttondat,d0
        cmpi.w  #2,d0
        beq     wback
        bra     wait
wback:  rts
***************turn mouse off***********************
mousof: dc.w    $a00a   
        rts



*********************************************************
*       a brilliant routine courtesy of janko to        *
*       insert the vbi addresses in the jump table      *
*       lea address of routine in a0 do a jsr           *
*       putvbl and thats it!!!                          *
*********************************************************


putvbl: lea     $452,a1
        move.w  #1,(a1)
        moveq   #7,d1
        lea     $456,a1
        move.l  (a1),a1
vbl3:   subq.b  #1,d1
        cmpi.b  #0,d1
        beq.s   vbl4
        move.l  (a1)+,d0
        cmpi.l  #0,d0
        bne.S   vbl3
        suba.l  #4,a1
        move.l  a0,(a1)
vbl4:   rts

*********************************************************
*       my routines for loading in the screens          *
*       note i use degas format even though I           *
*       hate the package,due to it's simple format      *
*       ie: 32l for pallette and straight 32k screen    *
*       dump                                            *
*********************************************************

loadscr:move    #0,-(SP)        ;Open file
        move.l  #filename,-(SP) ;Address of filename
        move    #$3D,-(SP)
        trap    #1              ;Get handle number in D0
        addq.l  #8,SP
                
        move    D0,-(SP)        ;Save handle

        move.l  #dummy,-(SP)    ;load pallette into safe area
        move.l  #128,-(SP)       ;length to read in
        move    D0,-(SP)        ;Handle
        move    #$3F,-(SP)      ;bios number
        trap    #1              ;Read file in
        addi.l   #12,SP
        move    (sp),d0        
               
        move.l  screen2,-(SP)    ;load it straight onto screen
        move.l  #32000,-(SP)    ;length to read in
        move    D0,-(SP)        ;Handle
        move    #$3F,-(SP)      ;bios number
        trap    #1              ;Read file in
        addi.l   #12,SP
                
        move    #$3E,-(SP)      ;Handle already on stack
        trap    #1              ;Close file
        addq.l  #4,SP
        rts
*********************************

loadend:move    #0,-(SP)        ;Open file
        move.l  #fileend,-(SP) ;Address of filename
        move    #$3D,-(SP)
        trap    #1              ;Get handle number in D0
        addq.l  #8,SP
                
        move    D0,-(SP)        ;Save handle

        move.l  #dummy,-(SP)    ;load pallette into safe area
        move.l  #128,-(SP)       ;length to read in
        move    D0,-(SP)        ;Handle
        move    #$3F,-(SP)      ;bios number
        trap    #1              ;Read file in
        addi.l   #12,SP
        move    (sp),d0        
               
        move.l  screen2,-(SP)    ;load it straight onto screen
        move.l  #32000,-(SP)    ;length to read in
        move    D0,-(SP)        ;Handle
        move    #$3F,-(SP)      ;bios number
        trap    #1              ;Read file in
        addi.l   #12,SP
                
        move    #$3E,-(SP)      ;Handle already on stack
        trap    #1              ;Close file
        addq.l  #4,SP
        rts

fileend:
	dc.b	'bikeend.dat',0
	even

*******************blocks for rotated sprites*************
pblock: blk.l   40
screen: blk.l   1
off:	blk.w	1
ynflg:  blk.w   1
screen2:blk.l   1
screen1:blk.l   1
dummy:  blk.l   32
xvel:	blk.w	1
yvel:	blk.w	1
filename:       dc.b    'bike.dat',0  
even
line:   blk.b   10
pos:	blk.l	1
col:	blk.l	1
number:	blk.w	1
shipvelpos:	dc.b	27,89,49,32,0
myvelpos:	dc.b	27,89,50,32,0
levpos:		dc.b	27,89,32,39,0
scorepos:	dc.b	27,89,32,51,0
bikepos:	dc.b	27,89,32,68,0
redcol:		dc.b    27,98,11,0
greencol:	dc.b	27,98,15,0

even
intin:  blk.l   1
ptsin:  blk.l   1
putpix: equ     $a001
getpix: equ     $a002
seen:	blk.l	1
hiden:	blk.l	1

linepar:blk.l	1
numsav:	blk.w	1
vsav:	blk.l	1
cbits:	blk.w	1
cbits2:	blk.w	1
dx:	blk.w	1
dy:	blk.w	1
xsav:	blk.w	1
ysav:	blk.w	1
whx:	blk.w	1
why:	blk.w	1
xmax:	blk.w	1
ymax:	blk.w	1
xmin:	blk.w	1
ymin:	blk.w	1
xoffs:	blk.w	1
yoffs:	blk.w	1
zoffs:	blk.w	1
current:blk.w	1
ob1:	blk.w	1
ob2:	blk.w	1
ob3:	blk.w	1
ob4:	blk.w	1
ob5:	blk.w	1
ob6:	blk.w	1
ob7:	blk.w	1
ob8:	blk.w	1
ob9:	blk.w	1
oba:	blk.w	1
miss1:	blk.w	1
miss2:	blk.w	1
miss3:	blk.w	1
ptts:	blk.w	1
ptts2:	blk.w	1

ob1y:	blk.w	1
ob2y:	blk.w	1
ob3y:	blk.w	1
ob4y:	blk.w	1
ob5y:	blk.w	1
ob6y:	blk.w	1
ob7y:	blk.w	1
ob8y:	blk.w	1
ob9y:	blk.w	1
obay:	blk.w	1
miss1y:	blk.w	1
miss2y:	blk.w	1
miss3y:	blk.w	1
pt1y:	blk.w	1
pt2y:	blk.w	1

ob1x:	blk.w	1
ob2x:	blk.w	1
ob3x:	blk.w	1
ob4x:	blk.w	1
ob5x:	blk.w	1
ob6x:	blk.w	1
ob7x:	blk.w	1
ob8x:	blk.w	1
ob9x:	blk.w	1
obax:	blk.w	1
miss1x:	blk.w	1
miss2x:	blk.w	1
miss3x:	blk.w	1
pt1x:	blk.w	1
pt2x:	blk.w	1

ob1z:	blk.w	1
ob2z:	blk.w	1
ob3z:	blk.w	1
ob4z:	blk.w	1
ob5z:	blk.w	1
ob6z:	blk.w	1
ob7z:	blk.w	1
ob8z:	blk.w	1
ob9z:	blk.w	1
obaz:	blk.w	1
miss1z:	blk.w	1
miss2z:	blk.w	1
miss3z:	blk.w	1
pt1z:	blk.w	1
pt2z:	blk.w	1

viewsav:blk.l	1
view:	blk.l	1
speed:	blk.w	1
fx:	blk.w	1
fy:	blk.w	1
fhigh:	blk.w	1
fwide:	blk.w	1
whichface:blk.l	1
facetemp:blk.w	1000
dodgex:	blk.w	1
dodgey:	blk.w	1
chcnt:	blk.w	1
levob:	blk.l	1
levob2:	blk.l	1
levob3:	blk.l	1
levob4:	blk.l	1
levob5:	blk.l	1
levob7:	blk.l	1
levob8:	blk.l	1
levob9:	blk.l	1
levoba:	blk.l	1
fspeed:	blk.w	1
plm1:	blk.w	1
plm2:	blk.w	1
plm3:	blk.w	1
plm4:	blk.w	1
dist:	blk.w	1
doffs:	blk.w	1,0
missvel:blk.w	1
misscnt:blk.w	1
tests:	blk.w	1
spsav:	blk.w	1
shtcnt:	blk.w	1,0
gotit:	blk.w	1,-1
sheilds:blk.w	1,0
exp:	blk.w	1,-1
score:	blk.w	1
color:	blk.w	1
shiphit:blk.w	1
allflg:	blk.w	1
obad:	blk.w	1,0
thetasav:blk.w	1
plx:	blk.w	1
ply:	blk.w	1
plz:	blk.w	1
special:blk.w	1,-1
oldmouse:blk.l	1,0
plspeed:blk.w	1,0
tospeed:blk.w	1
off1sav:blk.w	1,0
off2sav:blk.w	1,0
towerwide:blk.w	1,0
passed:	blk.w	1,-1
sightflg:blk.w	1,-1
infoflg:blk.w	1,-1
level:	blk.w	1,1
off2x:	blk.w	1,0
mmin:	blk.w	1,0
mmax:	blk.w	1,0
sqxv:	blk.w	1,0
sqyv:	blk.w	1,0
sqxv2:	blk.w	1,0
sqyv2:	blk.w	1,0
sqrcnt:	blk.w	1,0
pl1:	blk.w	1
pl2:	blk.w	1
pl3:	blk.w	1
pl4:	blk.w	1
bpl1:	blk.w	1
bpl2:	blk.w	1
bpl3:	blk.w	1
bpl4:	blk.w	1
cpl1:	blk.w	1
cpl2:	blk.w	1
cpl3:	blk.w	1
cpl4:	blk.w	1
bar1x:	blk.w	1
bar2x:	blk.w	1
bar3x:	blk.w	1
bar4x:	blk.w	1
xrand:	blk.w	1
yrand:	blk.w	1
rndcnt:	blk.w	1
velcnt:	blk.w	1
through:blk.w	1,0
rtheta:	blk.w	1,0
rphi:	blk.w	1,0
shake:	blk.w	1,-1
linesav:blk.l	1,0
openspeed:	blk.w	1,5
extram:	blk.w	1,0
mx:	blk.w	1,0
my:	blk.w	1,0
my2:	blk.w	1,0
buttondat:
	blk.w	1,0


palette:dc.w	$0000,$0033,$0044,$0055,$0077,$0777,$0310,$0420
	dc.w	$0530,$0500,$0600,$0730,$0007,$0030,$0050,$0070

palette2:
	dc.w	$0000,$0000,$0000
	dc.w	$0000,$0000,$0000
	dc.w	$0000,$0000,$0000
	dc.w	$0000,$0000,$0000
	dc.w	$0000,$0000,$0000
	dc.w	$0000




list:	dc.w	-5,0,0,5,0,50,5,0,-20
	dc.w	-5,5,-40,0,-5,-10,0,-5,0
	dc.w	0,5,20,5,-5,50,-5,0,-35
	dc.w	-5,0,20,5,5,-15



sight:	dc.w	$0000,$0000,$001E,$0000,$0000,$0000,$3C00,$0000
	dc.w	$0000,$0000,$0018,$0000,$0000,$0000,$0C00,$0000
	dc.w	$0000,$0000,$0014,$0000,$0000,$0000,$1400,$0000
	dc.w	$0000,$0000,$0012,$0000,$0000,$0000,$2400,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0012,$0000,$0000,$0000,$2400,$0000
	dc.w	$0000,$0000,$0014,$0000,$0000,$0000,$1400,$0000
	dc.w	$0000,$0000,$0018,$0000,$0000,$0000,$0C00,$0000
	dc.w	$0000,$0000,$001E,$0000,$0000,$0000,$3C00,$0000


sightm:	dc.w	$001E,$001E,$001E,$001E,$3C00,$3C00,$3C00,$3C00
	dc.w	$0018,$0018,$0018,$0018,$0C00,$0C00,$0C00,$0C00
	dc.w	$0014,$0014,$0014,$0014,$1400,$1400,$1400,$1400
	dc.w	$0012,$0012,$0012,$0012,$2400,$2400,$2400,$2400
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0012,$0012,$0012,$0012,$2400,$2400,$2400,$2400
	dc.w	$0014,$0014,$0014,$0014,$1400,$1400,$1400,$1400
	dc.w	$0018,$0018,$0018,$0018,$0C00,$0C00,$0C00,$0C00
	dc.w	$001E,$001E,$001E,$001E,$3C00,$3C00,$3C00,$3C00

*    pixels/scanline    = $0020 (bytes/scanline: $0010)
*  # scanlines (height) = $0013
posind:	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0002,$0002,$0000,$0002,$4000,$4000,$0000,$4000
	dc.w	$0003,$0003,$0000,$0003,$C000,$C000,$0000,$C000
	dc.w	$0002,$0002,$0000,$0002,$4000,$4000,$0000,$4000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000






boomsnd:dc.b	0,0,1,$f,2,0,3,0,4,0,5,0,6,$1f,7,$2e,8,$10
	dc.b	9,$10,10,$10,11,0,12,$80,13,$9,130,0

inst:	dc.b	0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,$3e,8,$10
	dc.b	9,$10,10,0,11,0,12,1,13,$f
	dc.b	$80,$73,$81,0,$f,1,130,0

shootsnd:
	dc.b	0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,$3e,8,$10
	dc.b	9,$10,10,0,11,0,12,$10,13,$9
	dc.b	$80,2,$81,0,$20,$40,130,0
rotsnd:
	dc.b	0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,$3c,8,$10
	dc.b	9,0,10,0,11,8,12,0,13,$e
	dc.b	$80,3,$81,0,$fc,$1,130,0


stage1:	dc.w	0,136,76,109,24,151,94,114
	dc.w	288,151,221,114
	dc.w	319,136,243,109

stage2:	dc.w	48,119,115,95,64,130,124,98
	dc.w	250,130,191,98,271,119,202,95

stage3:	dc.w	102,100,159,80,120,101,159,80
	dc.w	198,101,159,80,215,100,159,80


levlist:
	dc.l	pyr,square,missile,tri,diamond,thing
	dc.l	cube,square,tri,diamond,thing
	dc.l	pyr,missile

	

patmsk:	dc.w	$ffff


alt:	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$E2F2,$0000,$FAF2,$0000,$F6F4,$0000,$F6F4,$0000
	dc.w	$1823,$0000,$1823,$0000,$8000,$0000,$8000,$0000
	dc.w	$BC3C,$0000,$BDFC,$0000,$FF8F,$0000,$FF8F,$0000
	dc.w	$03E0,$0000,$03E0,$0000,$0005,$0000,$0005,$0000
	dc.w	$29FA,$0000,$69FA,$0000,$F40E,$0000,$F40E,$0000
	dc.w	$8000,$0000,$8000,$0000,$0001,$0000,$0001,$0000
	dc.w	$0000,$0000,$F77F,$0000,$0000,$0000,$5797,$0000
	dc.w	$0002,$0002,$0000,$0002,$4000,$4000,$3818,$4000
	dc.w	$0002,$0002,$7F6D,$0002,$0000,$0000,$DBCE,$0000
	dc.w	$0002,$0002,$0000,$0002,$4000,$4000,$0000,$4000
	dc.w	$4CFF,$0000,$4CFF,$0000,$2BF0,$0000,$2BF5,$0000
	dc.w	$0000,$0000,$0700,$0000,$0000,$0000,$0000,$0000
	dc.w	$0000,$0000,$FD53,$0000,$0000,$0000,$9993,$0000
	dc.w	$0000,$0000,$000C,$0000,$0000,$0000,$1B80,$0000
	dc.w	$0000,$0000,$3E3E,$0000,$0000,$0000,$43CE,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
	dc.w	$F7AA,$0000,$F7AA,$0000,$FE5B,$0000,$FE5B,$0000
	dc.w	$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000


