	ORG	$5f938
	LOAD	$5f938

trynew=0

>extern "SfarMahoneyR",SFM
>extern "SfarKaktus",SFM2
>extern "SfarThe",SFM3
>extern "SfarEnd",SFM4
>extern "Sin255",Sin255
>extern "newmods",Modules
>extern "smallfontr",SmFont

SFM=$59000		;224
SFM2=SFM+224		;192
SFM3=SFM2+192		;416
SFM4=SFM3+416		;416
Sin255=SFM4+416		;256
smfont=sin255+256	;1024
Modules=smfont+1024	;$5f52
exend=modules+$5f52

s1:	dc.l	$6b000
s2:	dc.l	$6b000+$d20
s3:	dc.l	$6b000+$d20+$d20
s4=$6b000+$d20+$d20+$d20
up_screen=$71000	;$172

tabell=$c0

m0=modules
m1=m0+5554
m2=m1+2476
m3=m2+4530
m4=m3+1698
m5=m4+928
m6=m5+2214
m7=m6+1708
m8=m7+1896
m9=m8+1438
mend=m9+1960

dots=1500

mod:	dc.l	m0

nollfyra:
	blk.l	50/4,0

init:	move.l	#nollfyra,$04.w
	move.l	$04.w,a6
	lea	s(pc),a0
	move.l	a0,42(a6)
	lea	34(a6),a1
	moveq	#0,d0
	moveq	#$17,d1
.s_1:	add.w	(a1)+,d0
	dbf	d1,.s_1
	not.w	d0
	move.w	d0,(a1)
.k:	bra.s	.k

S:	move.l	$04.w,a6
	clr.w	34(a6)
	clr.l	42(a6)
	lea	$dff000,A6
;	move.w	$1c(a6),oldena
	move.w	#$7fff,$9a(a6)
	move.w	#$c000,$9a(a6)
;	move.w	$1e(a6),oldreq
	move.w	#$3fff,$9c(a6)
;	move.w	$02(a6),olddma
	move.w	#$03df,$96(a6)
	lea	$7ff00,a7
	move.l	#super,$80.w
	trap	#0
	lea	$7ff00,a7

	lea	zero(pc),a0
	move.w	#[[zeroend-zero]/$10]-1,d7
	moveq	#0,d0
.ll:	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	dbf	d7,.ll
	clr.w	$dff180
	lea	s4,a0
	move.w	#[[4*$d20]/$10]-1,d7
.l2:	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	dbf	d7,.l2

	bsr	rnd_init
	bsr	sv_init
	bsr	s_init
	bsr	t_init
	bsr	up_init
	BSR.L MUS_INIT
	move.l	s1(pc),d0
	sub.l	#[$46*18]+8,d0
	move.w	d0,co+6
	swap	d0
	move.w	d0,co+2

	lea	L486ec,A0	;fixa vectordata
L4675a: move.w	(A0),D0
	lsl.w	#2,D0	;mulu #$4
	move.w	D0,(A0)+
	cmpa.l	#L487e4,A0
	bne.s	L4675a

	lea	$dff000,a6
Sync:	move.l	$04(a6),d0
	and.l	#$1ff00,d0
	cmp.l	#$13700,d0
	bne.s	Sync
	MOVE.L	#COP,$80(a6)
	move.w	#$83e0,$96(a6)
	bsr	SetLv2Irq

	bsr	s_init3

	if	trynew=0
	move.w	#1,Vgo
	endc

	bsr	s_init2
	move.w	#1,goplot
;	clr.w	Vgo
EVER:
	bra.s	ever

;	cmp.w	#$45,ActKey
;	bne.s	ever
;END:	bsr	ClrLv2Irq
;	move.l	#user,$80.w
;	trap	#0
;	move.l	$04.w,a6
;	move.l	(a6),a5
;	move.l	(a5),a5
;	lea	$dff000,a6
;	move.l	38(a5),$80(a6)
;
;	move.w	#$3fff,$9c(a6)
;	move.w	#$7fff,$9a(a6)
;	move.w	#$03ff,$96(a6)
;	move.w	oldena(pc),d0
;	move.w	oldreq(pc),d1
;	move.w	olddma(pc),d2
;	and.w	#$3fff,d1
;	and.w	#$03f0,d2
;	or.w	#$8000,d0
;	or.w	#$8000,d1
;	or.w	#$8000,d2
;	move.w	d1,$9c(a6)
;	move.w	d0,$9a(a6)
;	move.w	d2,$96(a6)
;
rts:	rts

super:	move.w	#$2000,(a7)
	rte
;user:	move.w	#$0000,(a7)
;	rte

;----------------------------------------------------------------

t_init:	lea	t_dat,a0
	move.w	#[trons*32]-1,d7
.t:	moveq	#0,d0
	moveq	#0,d1
;	lsr.w	#1,d1
	 and.w	#$ff,d0
	 add.w	d0,d0
	 add.w	d0,d0
	 move.w	d0,(a0)+
	 and.w	#$ff,d1
	 mulu	#$400,d1
	 move.l	d1,(a0)+
	dbf	d7,.t
	rts

t_cou:	dc.w	0

t_x:	dc.l	$ff600000
t_y:	dc.l	$ffe00000

tsx:	dc.l	0
tsy:	dc.l	0

txw:	dc.w	10
direction:dc.w	0

NORULL:	dc.w	0
left:	dc.w	0

speedpoi:	dc.l	spds

spds:	dc.b	2,3,4,5,4,3,2,1,0,1,-1,-1
tgo:	dc.w	0

t_rut:	tst.w	Tgo
	beq	rts
	btst	#2,$dff016
	bne.s	.r
	cmp.w	#$20,left
	bne.s	.w
	clr.w	left
.w:	addq.w	#1,left
	cmp.w	#1,left
	bne.s	.rr

	move.l	speedpoi(pc),a0
	move.b	(a0)+,d0
	bpl.s	.rt
	lea	spds(pc),a0
	move.b	(a0)+,d0
.rt:	move.b	d0,speed+1
	move.l	a0,speedpoi
	bra.s	.rr
.r:	clr.w	left
.rr:
	moveq	#0,d0
	move.b	$dff00b,d0
	eor.b	#$ff,d0
	lea	sin255,a0
	moveq	#0,d1
	moveq	#0,d2
	move.b	(a0,d0.w),d1
	add.b	#$40,d0
	move.b	(a0,d0.w),d2
	add.b	#$80,d1
	add.b	#$80,d2
	ext.w	d1
	ext.w	d2
	ext.l	d1
	ext.l	d2
	asl.l	#$8,d1
	asl.l	#$8,d2
	add.l	d1,d1
	add.l	d2,d2
	move.l	d1,tsx
	move.l	d2,tsy



	lea	t_dat,a0

speed:	moveq	#1,d6
.lop:	move.l	tsx(pc),d0
	add.l	d0,t_x
	move.l	tsy(pc),d0
	add.l	d0,t_y

	move.b	t_x+1(pc),d0
	move.b	t_y+1(pc),d1

	move.w	t_cou(pc),d7
	 and.w	#$ff,d0
	 add.w	d0,d0
	 add.w	d0,d0
	 move.w	d0,(a0,d7.w)
	 and.w	#$ff,d1
	 mulu	#$400,d1
	 move.l	d1,2(a0,d7.w)

	move.w	t_cou(pc),d0
	addq.w	#6,d0
	cmp.w	#trons*32*6,d0
	bne.s	.e
	clr.w	d0
.e:	move.w	d0,t_cou
	dbf	d6,.lop


	move.l	t_x(pc),d0
	neg.l	d0
	move.l	d0,xpo
	move.l	t_y(pc),d0
	neg.l	d0
	move.l	d0,ypo

	move.b	xpo+1(pc),d6
	move.b	ypo+1(pc),d7
	move.w	#trons-1,d5
	lea	T_dat,a0
	bsr	Draw
	rts

trons=26

;----------------------------------------------------------------

calctabell:
	if	trynew=1
	cmp.l	#$ff00ffed,tabell
	beq	rts
	endc
.x:	lea	tabell,a0
	moveq	#0,d7
.q:	moveq	#0,d6
.k:
	move.w	d6,d2
	move.w	d7,d3
	ext.w	d2
	ext.w	d3
	move.w	d2,d0
	move.w	d3,d1
	ext.w	d0
	tst.w	d0
	bmi.s	.we
	addq.w	#1,d2
.we:	ext.w	d1
	tst.w	d1
	bmi.s	.qe
	addq.w	#1,d3
.qe:
	muls	d0,d0
	muls	d1,d1
	add.l	d0,d1
	cmp.l	#$3200,d1	;$3200
	blt.s	.nope
	moveq	#0,d0
	moveq	#-40,d2
	moveq	#-72,d3
	bra.s	.er

.nope:	move.l	#$8000,d0	;$8000
	sub.l	d1,d0
.rr:
	add.w	d2,d2
	add.w	d3,d3
	muls	d0,d2
	muls	d0,d3
	swap	d2
	swap	d3

.er:	muls	#18,d3
	move.w	d2,d0
	not.b	d0
	asr.w	#3,d2
	add.w	d2,d3

	move.w	d0,(a0)+
	move.w	d3,(a0)+
	addq.b	#1,d6
	bne.s	.k
	addq.b	#1,d7
	bne.s	.q
	rts


s_init:
.e:	btst	#14,$dff002
	bne.s	.e
	move.l	s1(pc),d0
	sub.l	#[18*$46]+8,d0
	move.l	d0,$dff054
	clr.w	$dff066
	move.l	#$01000000,$dff040
	move.w	#[$d20*3/$40*$40]+[$20],$dff058	;tom alla s1
	rts

s_init3:lea	s4,a0
	lea	s4+$d20,a1
	lea	s4+$d20+$d20,a2
	lea	s4+$d20+$d20+$d20,a3
	move.w	#144,d7
.s:	move.w	#144,d6
.w:
	move.w	d6,d0
	move.w	d7,d1
	sub.w	#72,d0
	sub.w	#70,d1
	muls	d0,d0
	muls	d1,d1
	add.l	d0,d1
	divu	#$150,d1	;$150

	move.w	d1,d5

	cmp.w	#$f,d5
	ble.s	.tt
	move.w	#$f,d5
.tt:	move.w	d7,d0
	mulu	#18,d0
	move.w	d6,d1
	move.w	d6,d2
	lsr.w	#3,d1
	add.w	d1,d0
	not.w	d2
	btst	#0,d5
	bne.s	.s1
	bset	d2,(a0,d0.w)
	bra.s	.e1
.s1:	bclr	d2,(a0,d0.w)
.e1:
	btst	#1,d5
	bne.s	.s2
	bset	d2,(a1,d0.w)
	bra.s	.e2
.s2:	bclr	d2,(a1,d0.w)
.e2:
	btst	#2,d5
	bne.s	.s3
	bset	d2,(a2,d0.w)
	bra.s	.e3
.s3:	bclr	d2,(a2,d0.w)
.e3:
	btst	#3,d5
	bne.s	.s4
	bset	d2,(a3,d0.w)
	bra.s	.e4
.s4:	bclr	d2,(a3,d0.w)
.e4:
	dbf	d6,.w
	dbf	d7,.s
	rts

s_init2:bsr	CalcTabell
	lea	Mahoney,a0
	lea	SFM,a1
	moveq	#0,d7
	moveq	#0,d6
.l:	moveq	#127,d5

.y:	move.w	d5,d0
	move.w	d7,d1
	add.w	d0,d0
	add.w	d1,d1
	move.w	d7,d2
	mulu	#$10,d2
	move.w	d5,d3
	move.w	d5,d4
	lsr.w	#3,d3
	add.w	d3,d2
	not.w	d4
	btst	d4,(a1,d2)
	beq.s	.nopix

	 and.w	#$ff,d0
	 add.w	d0,d0
	 add.w	d0,d0
	 move.w	d0,(a0)+
	 and.w	#$ff,d1
	 mulu	#$400,d1
	 move.l	d1,(a0)+
	addq.w	#1,d6
.nopix:	dbf	d5,.y
	addq.w	#1,d7
	cmp.w	#14,d7
	bne.s	.l


r2:	lea	Kaktus,a0
	lea	SFM2,a1
	moveq	#0,d7
	moveq	#0,d6
.l:	moveq	#127,d5

.y:	move.w	d5,d0
	move.w	d7,d1
	add.w	d0,d0
	add.w	d1,d1
	move.w	d7,d2
	mulu	#$10,d2
	move.w	d5,d3
	move.w	d5,d4
	lsr.w	#3,d3
	add.w	d3,d2
	not.w	d4
	btst	d4,(a1,d2)
	beq.s	.nopix

	 and.w	#$ff,d0
	 add.w	d0,d0
	 add.w	d0,d0
	 move.w	d0,(a0)+
	 and.w	#$ff,d1
	 mulu	#$400,d1
	 move.l	d1,(a0)+
	addq.w	#1,d6
.nopix:	dbf	d5,.y
	addq.w	#1,d7
	cmp.w	#12,d7
	bne.s	.l



r:	lea	The,a0
	lea	SFM3,a1
	moveq	#0,d7
	moveq	#0,d6
.l:	moveq	#127,d5

.y:	move.w	d5,d0
	move.w	d7,d1

	move.w	d7,d2
	mulu	#$10,d2
	move.w	d5,d3
	move.w	d5,d4
	lsr.w	#3,d3
	add.w	d3,d2
	not.w	d4
	btst	d4,(a1,d2)
	beq.s	.nopix

	 and.w	#$ff,d0
	 add.w	d0,d0
	 add.w	d0,d0
	 move.w	d0,(a0)+
	 and.w	#$ff,d1
	 mulu	#$400,d1
	 move.l	d1,(a0)+
	addq.w	#1,d6
.nopix:	dbf	d5,.y
	addq.w	#1,d7
	cmp.w	#26,d7
	bne.s	.l


r3:	lea	SEnd,a0
	lea	SFM4,a1
	moveq	#0,d7
	moveq	#0,d6
.l:	moveq	#127,d5

.y:	move.w	d5,d0
	move.w	d7,d1
	move.w	d7,d2
	mulu	#$10,d2
	move.w	d5,d3
	move.w	d5,d4
	lsr.w	#3,d3
	add.w	d3,d2
	not.w	d4
	btst	d4,(a1,d2)
	beq.s	.nopix

	 and.w	#$ff,d0
	 add.w	d0,d0
	 add.w	d0,d0
	 move.w	d0,(a0)+
	 and.w	#$ff,d1
	 mulu	#$400,d1
	 move.l	d1,(a0)+
	addq.w	#1,d6
.nopix:	dbf	d5,.y
	addq.w	#1,d7
	cmp.w	#26,d7
	bne.s	.l

r4:	lea	Star,a0
	move.w	#1471,d7
.l:	bsr	Random

	move.b	rnd+5,d0
	move.b	rnd+6,d1
	 and.w	#$ff,d0
	 add.w	d0,d0
	 add.w	d0,d0
	 move.w	d0,(a0)+
	 and.w	#$ff,d1
	 mulu	#$400,d1
	 move.l	d1,(a0)+
	dbf	d7,.l
	rts



s_swap:	move.l	s3(pc),d0
	move.l	s2(pc),s3
	move.l	s1(pc),s2
	move.l	d0,s1

.e:	btst	#14,$dff002
	bne.s	.e
	move.l	s2(pc),d0
	sub.l	#[18*$46]+8,d0
	move.l	d0,$dff054
	move.w	#0,$dff066
	move.l	#$01000000,$dff040
	move.w	#[$8c*$40]+[18/2],$dff058

	move.l	s1(pc),d0
	sub.l	#[$46*18]+8,d0
	move.w	d0,co+6
	swap	d0
	move.w	d0,co+2

	move.l	#s4,d0
	move.w	d0,co2+6
	swap	d0
	move.w	d0,co2+2
	swap	d0
	add.l	#$d20,d0
	move.w	d0,co3+6
	swap	d0
	move.w	d0,co3+2
	swap	d0
	add.l	#$d20,d0
	move.w	d0,co4+6
	swap	d0
	move.w	d0,co4+2
	swap	d0
	add.l	#$d20,d0
	move.w	d0,co5+6
	swap	d0
	move.w	d0,co5+2

	tst.w	NORULL
	bne	rts

	moveq	#0,d0
	move.b	rot+1(pc),d0
	lea	sin255,a0
	moveq	#0,d1
	move.b	(a0,d0.w),d1
	eor.b	#$80,d1
	ext.w	d1
	ext.l	d1
	asl.l	#$8,d1
	asl.l	#$2,d1
	add.l	d1,xpo
	add.b	#$40,d0
	moveq	#0,d1
	move.b	(a0,d0.w),d1
	eor.b	#$80,d1
	ext.w	d1
	ext.l	d1
	asl.l	#$8,d1
	asl.l	#$2,d1
	add.l	d1,ypo
	rts

s_rut:	add.l	#$2000,rot

	addq.w	#1,xpp
	tst.w	MahoneyGo
	beq.s	.n4
	moveq	#-$3c,d7
	move.w	xpp(pc),d6
	lea	Mahoney,a0
	add.b	xpo+1(pc),d6
	add.b	ypo+1(pc),d7
	move.w	#9,d5
	bsr	Draw
.n4:
	tst.w	KaktusGo
	beq.s	.n5
	moveq	#-$20,d7
	move.w	xpp(pc),d6
	not.w	d6
	lea	Kaktus,a0
	add.b	xpo+1(pc),d6
	add.b	ypo+1(pc),d7
	move.w	#7,d5
	bsr	Draw
.n5:
	tst.w	thego
	beq.s	.n2
	moveq	#-$20,d6
	moveq	#-$20,d7
	add.b	xpo+1(pc),d6
	add.b	ypo+1(pc),d7
	move.w	#8,d5
	lea	The,a0
	bsr	Draw
.n2:
	tst.w	endgo
	beq.s	.n1
	move.b	xpo+1(pc),d6
	move.b	ypo+1(pc),d7
	move.w	#9,d5
	lea	SEnd,a0
	bsr	Draw
.n1:
	move.b	xpo+1(pc),d6
	move.b	ypo+1(pc),d7
stgo:	move.w	#0,d5		;6
	if trynew=1
	moveq	#10,d5
	endc
	lea	Star,a0
	bsr	Draw

	if trynew=0

	move.w	cou(pc),d7
	cmp.w	#38-32,d7
	bge.s	.e3
	cmp.w	#-570,d7
	ble.s	.e3
	and.w	#$0f,d7
	bne.s	.e3
	addq.w	#1,stgo+2

.e3:	cmp.w	#$ac,d7
	blt.s	.e0
	cmp.w	#$be,d7
	bgt.s	.e0
	subq.w	#1,stgo+2

.e0:	cmp.w	#$b8,d7
	bne.s	.e1
	move.w	#1,endgo
.e1:	cmp.w	#$c2,d7
	bne.s	.e2
	move.w	#1,thego
.e2:
	cmp.w	#$37d,d7
	bne.s	.e4
	clr.w	thego
	clr.w	endgo
.e4:
	cmp.w	#$3f0,d7
	bne.s	.e5
	move.w	#1,mahoneygo
.e5:
	cmp.w	#$3f8,d7
	bne.s	.e6
	move.w	#1,KaktusGo
.e6:
	cmp.w	#$6ea,d7
	bne.s	.e7
	clr.w	MahoneyGo
	clr.w	KaktusGo
.e7:
	cmp.w	#$700,d7
	bne.s	.e8
	move.w	#10,stgo+2
.e8:
	cmp.w	#$702,d7
	bne.s	.e88
	move.w	#1,ligo
.e88:
	cmp.w	#$d14,d7
	bne.s	.e9
	clr.w	ligo
	move.w	#1,Vgo
.e9:	

	cmp.w	#$1160,d7
	blt.s	.ea
	cmp.w	#$1167,d7
	bge.s	.ea
	clr.w	Vgo
	subq.w	#1,stgo+2
.ea:

	cmp.w	#$1180,d7
	ble.s	.eb
	move.w	#1,Tgo
	move.w	#1,norull
	move.w	#10,Stgo+2
	move.l	xpo(pc),d0
	neg.l	d0
	move.l	d0,t_x
	move.l	ypo(pc),d0
	neg.l	d0
	move.l	d0,t_y
	rts
.eb:

	addq.w	#1,cou
	endc
	rts

rot:	dc.l	$400000-$476000

PlotOne:Macro
	move.w	(a0)+,d2
	move.l	(a0)+,d3
	add.w	a3,d2
	add.l	a4,d3
	and.w	d4,d2
	and.l	d6,d3
	add.w	d2,d3
	move.w	(a2,d3.l),d0
	move.w	2(a2,d3.l),d1
	bset	d0,(a1,d1.w)
	EndM

Draw:	and.w	#$ff,d6
	and.w	#$ff,d7
	add.w	d6,d6
	add.w	d6,d6
	mulu	#$400,d7
	move.l	d6,a3
	move.l	d7,a4
	move.l	s3(pc),a1
	lea	tabell,a2
	lea	1(a1),a1
	move.w	#$3fc,d4
	move.l	#$3fc00,d6
	addq.w	#1,d5
	bra.w	.loe

.l:	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
	PlotOne
.loe:	dbf	d5,.l
	rts

;----------------------------------------------------------------

sv_init:bsr	random
	lea	sv2_datlist(pc),a0
	moveq	#$7f,d7
sv_il:	move.b	rnd+5(pc),$80(a0)
	move.b	rnd+5(pc),$100(a0)
	move.b	rnd+5(pc),(a0)+
	move.b	rnd+5(pc),d6
	bsr	Random
	move.b	rnd+5(pc),d0
	sub.b	d0,d6
	ext.w	d6
	bpl.s	sv2_neg
	neg.w	d6
sv2_neg:cmp.w	#$3,d6
	bgt.s	sv2_ok
	add.b	#$a9,rnd+5
sv2_ok:	dbf	d7,sv_il
	rts

sv_rut:	move.w	ypo(pc),d0
;	lsr.w	#1,d0
	move.w	d0,d6
	lea	sv2_spr0(pc),a0
	and.w	#1,d0
	beq.s	.e
	lea	sv2_spr1(pc),a0
.e:	move.w	a0,sv2_cop+6
	move.l	a0,d1
	swap	d1
	move.w	d1,sv2_cop+2
	addq.w	#1,d6
	lsr.w	#1,d6
	and.w	#$7f,d6

	move.w	#$8b,d7
	lea	sv2_datlist(pc),a1
	lea	(a1,d6.w),a1
	move.w	xpo(pc),d5
;	lsr.w	#1,d5
	not.w	d5
	move.w	d5,d1
	lsr.w	#1,d5
	and.w	#1,d1
	addq.l	#1,a0
sv2_loop:
	move.b	(a1)+,d0
	add.b	d5,d0
	move.b	d0,(a0)
	and.b	#$fe,2(a0)
	or.b	d1,2(a0)

	addq.l	#8,a0
	dbf	d7,sv2_loop
	rts

sv2_spr0:
dc.l	$1f002000,$10000
dc.l	$21002200,$10000
dc.l	$23002400,$10000
dc.l	$25002600,$10000
dc.l	$27002800,$10000
dc.l	$29002a00,$10000
dc.l	$2b002c00,$10000
dc.l	$2d002e00,$10000
dc.l	$2f003000,$10000
dc.l	$31003200,$10000
dc.l	$33003400,$10000
dc.l	$35003600,$10000
dc.l	$37003800,$10000
dc.l	$39003a00,$10000
dc.l	$3b003c00,$10000
dc.l	$3d003e00,$10000
dc.l	$3f004000,$10000
dc.l	$41004200,$10000
dc.l	$43004400,$10000
dc.l	$45004600,$10000
dc.l	$47004800,$10000
dc.l	$49004a00,$10000
dc.l	$4b004c00,$10000
dc.l	$4d004e00,$10000
dc.l	$4f005000,$10000
dc.l	$51005200,$10000
dc.l	$53005400,$10000
dc.l	$55005600,$10000
dc.l	$57005800,$10000
dc.l	$59005a00,$10000
dc.l	$5b005c00,$10000
dc.l	$5d005e00,$10000
dc.l	$5f006000,$10000
dc.l	$61006200,$10000
dc.l	$63006400,$10000
dc.l	$65006600,$10000
dc.l	$67006800,$10000
dc.l	$69006a00,$10000
dc.l	$6b006c00,$10000
dc.l	$6d006e00,$10000
dc.l	$6f007000,$10000
dc.l	$71007200,$10000
dc.l	$73007400,$10000
dc.l	$75007600,$10000
dc.l	$77007800,$10000
dc.l	$79007a00,$10000
dc.l	$7b007c00,$10000
dc.l	$7d007e00,$10000
dc.l	$7f008000,$10000
dc.l	$81008200,$10000
dc.l	$83008400,$10000
dc.l	$85008600,$10000
dc.l	$87008800,$10000
dc.l	$89008a00,$10000
dc.l	$8b008c00,$10000
dc.l	$8d008e00,$10000
dc.l	$8f009000,$10000
dc.l	$91009200,$10000
dc.l	$93009400,$10000
dc.l	$95009600,$10000
dc.l	$97009800,$10000
dc.l	$99009a00,$10000
dc.l	$9b009c00,$10000
dc.l	$9d009e00,$10000
dc.l	$9f00a000,$10000
dc.l	$a100a200,$10000
dc.l	$a300a400,$10000
dc.l	$a500a600,$10000
dc.l	$a700a800,$10000
dc.l	$a900aa00,$10000
dc.l	$ab00ac00,$10000
dc.l	$ad00ae00,$10000
dc.l	$af00b000,$10000
dc.l	$b100b200,$10000
dc.l	$b300b400,$10000
dc.l	$b500b600,$10000
dc.l	$b700b800,$10000
dc.l	$b900ba00,$10000
dc.l	$bb00bc00,$10000
dc.l	$bd00be00,$10000
dc.l	$bf00c000,$10000
dc.l	$c100c200,$10000
dc.l	$c300c400,$10000
dc.l	$c500c600,$10000
dc.l	$c700c800,$10000
dc.l	$c900ca00,$10000
dc.l	$cb00cc00,$10000
dc.l	$cd00ce00,$10000
dc.l	$cf00d000,$10000
dc.l	$d100d200,$10000
dc.l	$d300d400,$10000
dc.l	$d500d600,$10000
dc.l	$d700d800,$10000
dc.l	$d900da00,$10000
dc.l	$db00dc00,$10000
dc.l	$dd00de00,$10000
dc.l	$df00e000,$10000
dc.l	$e100e200,$10000
dc.l	$e300e400,$10000
dc.l	$e500e600,$10000
dc.l	$e700e800,$10000
dc.l	$e900ea00,$10000
dc.l	$eb00ec00,$10000
dc.l	$ed00ee00,$10000
dc.l	$ef00f000,$10000
dc.l	$f100f200,$10000
dc.l	$f300f400,$10000
dc.l	$f500f600,$10000
dc.l	$f700f800,$10000
dc.l	$f900fa00,$10000
dc.l	$fb00fc00,$10000
dc.l	$fd00fe00,$10000
dc.l	$ff000002,$10000
dc.l	$01000206,$10000
dc.l	$03000406,$10000
dc.l	$05000606,$10000
dc.l	$07000806,$10000
dc.l	$09000a06,$10000
dc.l	$0b000c06,$10000
dc.l	$0d000e06,$10000
dc.l	$0f001006,$10000
dc.l	$11001206,$10000
dc.l	$13001406,$10000
dc.l	$15001606,$10000
dc.l	$17001806,$10000
dc.l	$19001a06,$10000
dc.l	$1b001c06,$10000
dc.l	$1d001e06,$10000
dc.l	$1f002006,$10000
dc.l	$21002206,$10000
dc.l	$23002406,$10000
dc.l	$25002606,$10000
dc.l	$27002806,$10000
dc.l	$29002a06,$10000
dc.l	$2b002c06,$10000
dc.l	$2d002e06,$10000
dc.l	$2f003006,$10000
dc.l	$31003206,$10000
dc.l	$33003406,$10000
dc.l	$35003606,$10000
dc.l	0,0
dc.l	0,0

sv2_spr1:
dc.l	$20002100,$10000
dc.l	$22002300,$10000
dc.l	$24002500,$10000
dc.l	$26002700,$10000
dc.l	$28002900,$10000
dc.l	$2a002b00,$10000
dc.l	$2c002d00,$10000
dc.l	$2e002f00,$10000
dc.l	$30003100,$10000
dc.l	$32003300,$10000
dc.l	$34003500,$10000
dc.l	$36003700,$10000
dc.l	$38003900,$10000
dc.l	$3a003b00,$10000
dc.l	$3c003d00,$10000
dc.l	$3e003f00,$10000
dc.l	$40004100,$10000
dc.l	$42004300,$10000
dc.l	$44004500,$10000
dc.l	$46004700,$10000
dc.l	$48004900,$10000
dc.l	$4a004b00,$10000
dc.l	$4c004d00,$10000
dc.l	$4e004f00,$10000
dc.l	$50005100,$10000
dc.l	$52005300,$10000
dc.l	$54005500,$10000
dc.l	$56005700,$10000
dc.l	$58005900,$10000
dc.l	$5a005b00,$10000
dc.l	$5c005d00,$10000
dc.l	$5e005f00,$10000
dc.l	$60006100,$10000
dc.l	$62006300,$10000
dc.l	$64006500,$10000
dc.l	$66006700,$10000
dc.l	$68006900,$10000
dc.l	$6a006b00,$10000
dc.l	$6c006d00,$10000
dc.l	$6e006f00,$10000
dc.l	$70007100,$10000
dc.l	$72007300,$10000
dc.l	$74007500,$10000
dc.l	$76007700,$10000
dc.l	$78007900,$10000
dc.l	$7a007b00,$10000
dc.l	$7c007d00,$10000
dc.l	$7e007f00,$10000
dc.l	$80008100,$10000
dc.l	$82008300,$10000
dc.l	$84008500,$10000
dc.l	$86008700,$10000
dc.l	$88008900,$10000
dc.l	$8a008b00,$10000
dc.l	$8c008d00,$10000
dc.l	$8e008f00,$10000
dc.l	$90009100,$10000
dc.l	$92009300,$10000
dc.l	$94009500,$10000
dc.l	$96009700,$10000
dc.l	$98009900,$10000
dc.l	$9a009b00,$10000
dc.l	$9c009d00,$10000
dc.l	$9e009f00,$10000
dc.l	$a000a100,$10000
dc.l	$a200a300,$10000
dc.l	$a400a500,$10000
dc.l	$a600a700,$10000
dc.l	$a800a900,$10000
dc.l	$aa00ab00,$10000
dc.l	$ac00ad00,$10000
dc.l	$ae00af00,$10000
dc.l	$b000b100,$10000
dc.l	$b200b300,$10000
dc.l	$b400b500,$10000
dc.l	$b600b700,$10000
dc.l	$b800b900,$10000
dc.l	$ba00bb00,$10000
dc.l	$bc00bd00,$10000
dc.l	$be00bf00,$10000
dc.l	$c000c100,$10000
dc.l	$c200c300,$10000
dc.l	$c400c500,$10000
dc.l	$c600c700,$10000
dc.l	$c800c900,$10000
dc.l	$ca00cb00,$10000
dc.l	$cc00cd00,$10000
dc.l	$ce00cf00,$10000
dc.l	$d000d100,$10000
dc.l	$d200d300,$10000
dc.l	$d400d500,$10000
dc.l	$d600d700,$10000
dc.l	$d800d900,$10000
dc.l	$da00db00,$10000
dc.l	$dc00dd00,$10000
dc.l	$de00df00,$10000
dc.l	$e000e100,$10000
dc.l	$e200e300,$10000
dc.l	$e400e500,$10000
dc.l	$e600e700,$10000
dc.l	$e800e900,$10000
dc.l	$ea00eb00,$10000
dc.l	$ec00ed00,$10000
dc.l	$ee00ef00,$10000
dc.l	$f000f100,$10000
dc.l	$f200f300,$10000
dc.l	$f400f500,$10000
dc.l	$f600f700,$10000
dc.l	$f800f900,$10000
dc.l	$fa00fb00,$10000
dc.l	$fc00fd00,$10000
dc.l	$fe00ff00,$10000
dc.l	$00000106,$10000
dc.l	$02000306,$10000
dc.l	$04000506,$10000
dc.l	$06000706,$10000
dc.l	$08000906,$10000
dc.l	$0a000b06,$10000
dc.l	$0c000d06,$10000
dc.l	$0e000f06,$10000
dc.l	$10001106,$10000
dc.l	$12001306,$10000
dc.l	$14001506,$10000
dc.l	$16001706,$10000
dc.l	$18001906,$10000
dc.l	$1a001b06,$10000
dc.l	$1c001d06,$10000
dc.l	$1e001f06,$10000
dc.l	$20002106,$10000
dc.l	$22002306,$10000
dc.l	$24002506,$10000
dc.l	$26002706,$10000
dc.l	$28002906,$10000
dc.l	$2a002b06,$10000
dc.l	$2c002d06,$10000
dc.l	$2e002f06,$10000
dc.l	$30003106,$10000
dc.l	$32003306,$10000
dc.l	$34003506,$10000
dc.l	$36003706,$10000
dc.l	0,0
dc.l	0,0

;----------------------------------------------------------------

dada:	dc.l $9a0000,$434010,$11000,$10000,$3
	dc.l $110000,$220000,-$10000,$10000,-1
	dc.l $d32000,$c43000,$03000,$10000,2
	dc.l $870000,$e40230,$10000,$00000,3
	dc.l $2b0000,$550000,$10000,-$10000,-4
	dc.l $430000,$754000,$10000,$08000,-2
	dc.l $780000,$370000,$08000,-$10000,1
	dc.l $960000,$220000,$10000,$02000,-3
	dc.l $620000,$9b0000,-$20000,$00000,2
	dc.l $1e0000,$e20000,-$03333,$10000,3
	dc.l $2f0000,$f30000,$05555,$02000,-1
	dc.l $850000,$ff0000,$01320,$00000,1
	dc.l $340000,$a50000,-$20000,$02000,3
	dc.l $b30000,$380000,$00000,$00000,2
	dc.l $470000,$820000,$00000,$00000,-2
	dc.l $f20000,$6a0000,$00000,$00000,1
	dc.l $330000,$4c0000,$00000,$00000,2
	dc.l $6c0000,$fe0000,$00000,$00000,3
	dc.l $7a0000,$ee0000,$00000,$00000,-1

	dc.l $dc0000,$280000,$00000,$00000,-1
dadaslut:

Li_rut:	tst.w	ligo
	beq	rts

	lea	dada(pc),a2
.lo:
	move.w	(a2),lix
	move.w	4(a2),liy
	move.l	8(a2),d0
	add.l	d0,(a2)
	move.l	12(a2),d0
	add.l	d0,4(a2)
	move.b	16(a2),sila
	move.b	19(a2),d0
	add.b	d0,16(a2)
	bsr	lii
	lea	$14(a2),a2
	cmp.l	#dadaslut,a2
	bne.s	.lo
	rts

lii:	lea	thedots(pc),a0
	lea	Sin255,a1
	moveq	#0,d5
	move.b	sila(pc),d5
	move.l	d5,d4
	add.b	#$40,d4
	move.b	(a1,d5.w),d6
	move.b	(a1,d4.w),d7
	lsr.b	#3,d6
	lsr.b	#3,d7
	add.b	xpo+1(pc),d6
	add.b	ypo+1(pc),d7
	add.b	lix+1(pc),d6
	add.b	liy+1(pc),d7
	bsr	CalcDot
	add.b	#$40,d5
	add.b	#$40,d4
	move.b	(a1,d5.w),d6
	move.b	(a1,d4.w),d7
	lsr.b	#3,d6
	lsr.b	#3,d7
	add.b	xpo+1(pc),d6
	add.b	ypo+1(pc),d7
	add.b	lix+1(pc),d6
	add.b	liy+1(pc),d7
	bsr	CalcDot
	add.b	#$40,d5
	add.b	#$40,d4
	move.b	(a1,d5.w),d6
	move.b	(a1,d4.w),d7
	lsr.b	#3,d6
	lsr.b	#3,d7
	add.b	xpo+1(pc),d6
	add.b	ypo+1(pc),d7
	add.b	lix+1(pc),d6
	add.b	liy+1(pc),d7
	bsr	CalcDot
	add.b	#$40,d5
	add.b	#$40,d4
	move.b	(a1,d5.w),d6
	move.b	(a1,d4.w),d7
	lsr.b	#3,d6
	lsr.b	#3,d7
	add.b	xpo+1(pc),d6
	add.b	ypo+1(pc),d7
	add.b	lix+1(pc),d6
	add.b	liy+1(pc),d7
	bsr	CalcDot

	lea	$dff000,a5
	move.l	s3(pc),a0
	sub.l	#[72*18]+8,a0
	move.w	thedots(pc),d0
	beq.s	.w1
	move.w	thedots+2(pc),d1
	move.w	thedots+4(pc),d2
	beq.s	.w1
	move.w	thedots+6(pc),d3
	bsr	L_rut
.w1:	move.w	thedots+4(pc),d0
	beq.s	.w2
	move.w	thedots+6(pc),d1
	move.w	thedots+8(pc),d2
	beq.s	.w2
	move.w	thedots+10(pc),d3
	bsr	L_rut
.w2:	move.w	thedots+8(pc),d0
	beq.s	.w3
	move.w	thedots+10(pc),d1
	move.w	thedots+12(pc),d2
	beq.s	.w3
	move.w	thedots+14(pc),d3
	bsr	L_rut
.w3:	move.w	thedots+12(pc),d0
	beq.s	.w4
	move.w	thedots+14(pc),d1
	move.w	thedots+0(pc),d2
	beq.s	.w4
	move.w	thedots+2(pc),d3
	bra	L_rut
.w4:	rts

calcdot:move.w	d6,d2
	move.w	d7,d3
	ext.w	d2
	ext.w	d3
	move.w	d2,d0
	bmi.s	.we
	addq.w	#1,d2
.we:	move.w	d3,d1
	bmi.s	.qe
	addq.w	#1,d3
.qe:	muls	d0,d0
	muls	d1,d1
	add.l	d0,d1
	cmp.l	#$3000,d1	;$3200
	bge.s	.nope
	move.l	#$8000,d0	;$8000
	sub.l	d1,d0
	add.w	d2,d2
	add.w	d3,d3
	muls	d0,d2
	muls	d0,d3
	swap	d2
	swap	d3
	add.w	#72,d2
	add.w	#72,d3
	move.w	d2,(a0)+
	move.w	d3,(a0)+
	bra.s	.ok
.nope:	clr.w	(a0)+
	clr.w	(a0)+
.ok:	rts

;d0=X1 d1=Y1 d2=X2 d3=Y2
;a2=pattern A0=scrpoi

L_rut:	ext.l	d0
	ext.l	d1
	ext.l	d2
	ext.l	d3
	move.l	d0,d4
	sub.l	d1,d4
	move.l	d2,d5
	sub.l	d3,d5
	eor.l	d4,d5
	beq.s	L_1
	move.l	d3,d5
	sub.l	d2,d5
	eor.l	d4,d5
	beq	L_1
	bra.s	L_2
L_1:	addq.l	#1,d1
L_2:	moveq	#18,d4
	muls	d1,d4
	moveq	#-16,d5
	and.w	d0,d5
	asr.w	#3,d5
	add.w	d5,d4
	add.l	a0,d4
	moveq	#0,d5
	sub.w	d1,d3
	roxl.b	#1,d5
	tst.w	d3
	bge.s	L_3
	neg.w	d3
L_3:	sub.w	d0,d2
	roxl.b	#1,d5
	tst.w	d2
	bge.s	L_4
	neg.w	d2
L_4:	move.w	d3,d1
	sub.w	d2,d1
	bge.s	L_5
	exg	d3,d2
L_5:	roxl.b	#1,d5
	move.b	l_tal(pc,d5.w),d5
	add.w	d2,d2
l_wait:	btst	#14,$02(a5)
	bne.s	l_wait
	move.w	d2,$62(a5)
	sub.w	d3,d2
	bge.s	L_6
	ori.b	#$40,d5
L_6:	move.w	d2,$52(a5)
	sub.w	d3,d2
	move.w	d2,$64(a5)
	move.w	#$8000,$74(a5)
	move.w	#$ffff,$72(a5)
	move.w	#$ffff,$44(a5)
	andi.w	#$f,d0
	ror.w	#4,d0
	ori.w	#$0bca,d0
	move.w	d0,$40(a5)
	move.w	d5,$42(a5)
	move.l	d4,$48(a5)
	move.l	d4,$54(a5)
	move.w	#18,$60(a5)
	move.w	#18,$66(a5)
	lsl.w	#6,d3
	addq	#2,d3
	move.w	d3,$58(a5)
	rts

l_tal:	dc.b	$01,$11,$09,$15,$05,$19,$0d,$1d

;----------------------------------------------------------------

rnd_init:
	move.w	$dff004,rnd
	move.w	$dff006,rnd+2
	move.b	$dc0001,rnd+4
	move.b	$dc0003,rnd+5
	move.w	$dff00a,rnd+6
	rts

RANDOM:	MOVEM.L	RND,D0/D1	;D0=LSB's, D1=MSB's of rnd num
	ANDI.B	#$0E,D0		;ensure upper 59 bits are an...
	ORI.B	#$20,D0		;...odd binary number
	MOVE.L	D0,D2
	MOVE.L	D1,D3
	ADD.L	D2,D2		;accounts for 1 of 17 left shifts
	ADDX.L	D3,D3		;[D2/D3] = RND*2
	ADD.L	D2,D0
	ADDX.L	D3,D1		;[D0/D1] = RND*3
	SWAP	D3		;shift [D2/D3] additional 16 times
	SWAP	D2
	MOVE.W	D2,D3
	CLR.W	D2
	ADD.L	D2,D0		;add to [D0/D1]
	ADDX.L	D3,D1
	add.w	$dff006,d0
	add.w	$dff00a,d1
	MOVEM.L	D0/D1,RND	;save for next time through
;	MOVE.L D0,D1
	RTS
RND:	DC.L 0,0

;----------------------------------------------------------------

V_rut:	tst.w	Vgo
	beq	rts

	bsr.l	L46aa8	;calc points

	moveq	#[[Mel-L4850c]/4]-1,d5
	lea	VecDest(pc),a0

.l:	move.w	xpo(pc),d6
	move.w	ypo(pc),d7
	lsr.w	#1,d6
	lsr.w	#1,d7

	add.w	(a0),d6
	add.w	2(a0),d7	
	bsr	CalcDot
	dbf	d5,.l

	moveq	#[[L486ec-Mel]/4]-1,d5
.lo:	move.w	(a0),d6
	move.w	2(a0),d7	
	add.b	xpo+1(pc),d6
	add.b	ypo+1(pc),d7
	add.b	#$40,d6
	add.b	#$40,d7
	bsr	CalcDot
	dbf	d5,.lo

	lea	VecDest,A3	;draw lines
	lea	L486ec,A4
	lea	$dff000,a5
	move.l	s3(pc),a0
	sub.l	#[72*18]+8,a0
L4680a: move.w	(A4),D0	;punkt 1
	move.w	2(A3,D0.W),D1
	move.w	(A3,D0.W),D0
	beq.s	.l
	move.w	2(A4),D2	;punkt 2
	move.w	2(A3,D2.W),D3
	move.w	(A3,D2.W),D2
	beq.s	.l
	bsr	L_rut		;linjerut
.l:	tst.l	(a4)+
	cmpa.l	#L487e4,A4
	blt.s	L4680a
	rts

ZVal:	dc.w	0

L46aa8: lea	L4850c(pc),A2	;calc points
	lea	VecDest(pc),A1
	addq.w	#$1,ZVal

	lea	sin255,a0
	move.w	Zval(pc),d0
	and.w	#$ff,d0
	moveq	#0,d6
	moveq	#0,d7
	move.b	(a0,d0.w),d6
	add.b	#$80,d6
	ext.w	d6
	add.b	#$40,d0
	move.b	(a0,d0.w),d7
	add.b	#$80,d7
	ext.w	d7
	lsl.w	#1,d6
	lsl.w	#1,d7

L46ab4: move.w	(A2)+,D0
	move.w	(A2)+,D1
	move.w	D0,D4
	move.w	D1,D5
	muls	d6,d0
	muls	d6,d1
	muls	d7,d4
	muls	d7,d5

	sub.l	d1,d4
	add.l	d0,d5

	asr.l	#8,d4
	asr.l	#8,d5

	move.w	d4,(A1)+
	move.w	d5,(A1)+

	cmp.l	#L486ec,A2
	blt.s	L46ab4
	rts

L4850C:	dc.w -$8,-$10,	$0008,-$10	;0 - o
	dc.w -$8,$0010,	$0008,$0010
	dc.w $c,-$10,	$c,$10		;4 - n
	dc.w $1c,-$10,	$1c,$10
	dc.w $20,-$10,	$30,-$10	;8 - e
	dc.w $20,$10,	$30,$10
	dc.w $20,$8,	$2c,$8
	dc.w $34,-$10,	$44,-$10	;14 - y
	dc.w $3c,$8,	$3c,$10
	dc.w -$1c,-$10,	-$c,-$10	;18 - h
	dc.w -$1c,$10,	-$c,$10
	dc.w -$1c,$8,	-$c,$8
	dc.w -$30,-$10,	-$20,-$10	;24 - a
	dc.w -$30,$10,	-$20,$10
	dc.w -$30,$8,	-$20,$8
	dc.w -$44,-$10,	-$34,-$10	;30 - m
	dc.w -$44,$10,	-$34,$10
	dc.w -$3c,$8
mel:
	dc.w -$10,$3a,	-$10,$2a		;35 - k
	dc.w $10,$3a,	$10,$2a
	dc.w $8,$3a
	dc.w -$10,$26,	-$10,$16		;40 - a
	dc.w $10,$26,	$10,$16
	dc.w $8,$26,	$8,$16		;oups
	dc.w -$10,$12,	-$10,$6	;oups	;46 - k
	dc.w $10,$12,	$10,$2
	dc.w $8,$12
	dc.w -$10,-2,	-$10,-$12		;51 - t
	dc.w -$10,-$a,	$10,-$a
	dc.w -$10,-$16,	-$10,-$26		;55 - u
	dc.w $10,-$16,	$10,-$26
	dc.w -$10,-$2a,	-$10,-$3a		;59 - s
	dc.w $10,-$2a,	$10,-$3a
	dc.w $8,-$2a,	$8,-$3a

	;linjedragn. mellan punkterna ovan

L486ec:	dc.w 30,32, 30,34, 31,33, 31,34	;m
	dc.w 24,26, 24,25, 25,27, 28,29	;a
	dc.w 18,20, 19,21, 22,23	;h
	dc.w 0,1, 0,2, 2,3, 1,3		;o
	dc.w 4,5, 4,7, 6,7		;n
	dc.w 8,9, 8,10, 10,11, 12,13	;e
	dc.w 14,16, 15,16, 16,17	;y

	dc.w 35,37, 36,39, 39,38	;k
	dc.w 40,41, 40,42, 41,43, 44,45	;a
	dc.w 46,48, 47,50, 50,49	;k
	dc.w 51,52, 53,54		;t
	dc.w 55,57, 56,58, 57,58	;u
	dc.w 59,60, 59,63, 63,64, 64,62, 61,62	;s
L487e4:

;----------------------------------------------------------------

up_init:lea	up_screen,a4
	move.w	#[46*8]/2,d7
up_lop:	clr.w	(a4)+
	dbf	d7,up_lop
up_rts:	rts

up_rut:	subq.b	#$1,up_cou
	bne.w	up_hej

	move.l	up_poi(pc),a0
	moveq	#0,d0
up_c:	move.b	(a0)+,d0
	cmp.b	#$ff,d0
	bne.s	up_b
	lea	up_text(pc),a0
	bra.s	up_c

up_b:	move.l	a0,up_poi
	lea	sfontbredds(pc),a0
	move.b	(a0,d0.w),up_cou

	move.w	d0,d1
	and.w	#$1f,d0
	and.w	#$e0,d1
	asl.w	#$3,d1
	add.w	d1,d0
	lea	smfont,a0
	lea	(a0,d0.w),a0
	lea	up_screen+44,a1
	moveq	#0,d0
	move.b	(a0),(a1)
	move.b	$20(a0),46(a1)
	move.b	$20*2(a0),46*2(a1)
	move.b	$20*3(a0),46*3(a1)
	move.b	$20*4(a0),46*4(a1)
	move.b	$20*5(a0),46*5(a1)
	move.b	$20*6(a0),46*6(a1)
	move.b	$20*7(a0),46*7(a1)
	move.b	d0,1(a1)
	move.b	d0,47(a1)
	move.b	d0,[2*46]+1(a1)
	move.b	d0,[3*46]+1(a1)
	move.b	d0,[4*46]+1(a1)
	move.b	d0,[5*46]+1(a1)
	move.b	d0,[6*46]+1(a1)
	move.b	d0,[7*46]+1(a1)

up_hej:	btst	#14,$dff002
	bne.s	up_hej
	move.l	#up_screen,$dff050
	move.l	#up_screen-2,$dff054
	move.l	#$ffffffff,$dff044
	move.l	#$f9f00000,$dff040
	clr.l	$dff064
	move.w	#[$9*$40]+[46/2],$dff058
	rts

up_cou:	dc.b	$10
	dc.b	0
up_poi:	dc.l	up_text

sfontbredds:	dc.b 0,11,8,6,13,8,6,12,8,8,4,8,4,6,6,8
		dc.b 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
		 dc.b 5,3,7,8,6,8,8,4,5,5,8,7,4,7,4,9
		 dc.b 6,6,6,6,6,6,6,6,6,6,3,4,8,5,8,6
		dc.b 0,9,9,9,9,9,9,9,9,4,9,9,9,9,9,9
		dc.b 9,9,9,9,8,9,9,9,9,9,9,9,9,9,9,9
		 dc.b 0,6,6,6,6,6,6,6,6,3,6,6,6,6,6,6
		 dc.b 6,6,6,6,7,6,6,6,6,6,6,6,6,6,6,6

UP_TEXT:
dc.b "This is the end, I suppose ...            I mean, this is REALLY the end."
dc.b "     We hope you've enjoyed this show, but has it been a pleasurable"
dc.b " voyage into the world of computermusic?         Who knows?  "
dc.b "             Today it's the 14th of September 1991.   Time flies!"
dc.b "        This short reset-part was coded by Mahoney, with 1500 dots"
dc.b " in 16 colours rotated on a sphere, all in one frame.    The music"
dc.b " was made by Gluemaster, and you can press F1-F10 for different"
dc.b " tunes.   Each tune takes about 1200 bytes in memory, and replayroutine"
dc.b " takes about 3 rasterlines, with calculated drums!      Nice, isn't it?"
dc.b "     I have to give him credit for this!          "
dc.b "      Well, what can I tell you now?      Some messages, why not?"
dc.b "        The first goes to Jas of Phenomena:    Hi there!   You're"
dc.b " very, very right, this musicdisk has been just as delayed as yours"
dc.b ". I have had a one-month vacation from computers, and that was really"
dc.b " wonderful. When this is ready, it'll last a lifetime!   I loved"
dc.b " the Crystal Symphonies!            The second to Ziphoid of Razor:"
dc.b " Finally, I got through this hell. Give Maria a BIG kiss from me!"
dc.b "           The third, and also the last one, goes to you, and it's"
dc.b " rather important:          I'm through.  I've loved all the things"
dc.b " that has ever happened on the Amiga, as well as on the 64.   "
dc.b " Before I go, I just want to tell you that if the Amiga is ever going"
dc.b " to be a great computer, SOMEONE (and that's you!) has to use his"
dc.b " imagination.     Blenk-vectors and bobs won't do.     If you get"
dc.b " a new demo, do you wanna see another vectorroutine?     "
dc.b " If your answer is no, then at least I am happy.            "
dc.b "         This is Mahoney & Kaktus, once upon a time members of"
dc.b " CFO, Defiers, Triad, S.O.S. and NorthStar, now members of another"
dc.b " group.       The name of the group is life.    And it's my life!"
dc.b "                                                                 "
dc.b "                                                        "
dc.b	$ff
Helene:
dc.b "    Yes, you're right, I LOVE Helene.   Vi skall vara r|dda om"
dc.b " varandra, det |r det enda reciproka pronomenet vi har.         ",$ff
even

;----------------------------------------------------------------

;	GLUE MASTER'S SMALLER SIZE TUNE PLAYER
;	CREATED TO FIT IN A BOOT-INTRO !!!
;	MODIFIED 26/2-90 TO BE EVEN SHORTER ...
;	AND RE-ORGANIZED 25/6-90 TO SUPPLY A MODULE-FORMAT!!!
;	FURTHER MORE DEVELOPED TO PLAY DRUMS 31/8-90!!!
;
;	SPECIAL REPLAYER FOR BOTH WITH & WITHOUT DRUMS!
;	THIS IS THE REPLAY-SOURCE FOR THE MUSIC-DISK 'HIS MASTERS NOISE'!
;
;	© 1990 GLUE MASTER

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

W=	255
BRK=	254
BDRUM=	200
SDRUM=	201
T1DRUM=	202
T2DRUM=	203
T3DRUM=	204
T4DRUM=	205
HCDRUM=	206
HODRUM=	207

dontplay:	dc.w	0

MUS_PLAY:
	tst.w	dontplay
	bne	rts

MUS_RANDOMIZE:
	LEA MUS_RNDWAVE,A3
	MOVE.L MUS_SEED,D1
	MOVEQ #$7,D0
MUS_RNDLOOP:
	ROL.L #7,D1
	ADD.L #$6ECA756D,D1
	EOR.L #$9E59A92B,D1
	MOVE.L D1,(A3)+
	DBF D0,MUS_RNDLOOP
	MOVE.L D1,MUS_SEED

	LEA $DFF000,A6

MUS_S1:	CMP.W #0,MUS_VOL1		;SUSTAIN-LEVEL
	BLS.S MUS_SETVOL2
MUS_D1:	SUB.W #1,MUS_VOL1		;DECAY-RATE
MUS_SETVOL2:
MUS_S2:	CMP.W #0,MUS_VOL2		;
	BLS.S MUS_SETVOL3
MUS_D2:	SUB.W #1,MUS_VOL2		;
MUS_SETVOL3:
MUS_S3:	CMP.W #0,MUS_VOL3		;
	BLS.S MUS_SETVOL4
MUS_D3:	SUB.W #1,MUS_VOL3		;
MUS_SETVOL4:
MUS_S4:	CMP.W #$0,MUS_VOL4		;
	BLS.S MUS_TESTNEWTONE
MUS_D4:	SUB.W #1,MUS_VOL4		;

MUS_TESTNEWTONE:
	ADDq.B #1,MUS_WAITPOS
MUS_RP:	CMP.B #4,MUS_WAITPOS	;REPLAY-SPEED
	BCC.S MUS_DOSONG

	move.l	Mod(pc),a4
	CMP.W	#'RM',18(a4)
	BNE.L MUS_NODRUMSOUNDFIN
	BRA.L MUS_SOUNDFIN

MUS_DOSONG:
	CLR.B MUS_WAITPOS
	ADD.W #4,MUS_MODPAT
MUS_PL:	CMP.W #[64*4],MUS_MODPAT	;PATTERN-LENGTH * 4
	BCS.S MUS_CONTPAT
	CLR.W MUS_MODPAT
	ADDQ.W #1,MUS_MODSONG
	MOVE.W MUS_MODSONG,D0
	move.l	Mod(pc),a0
	LEA	151(a0),A0	;SONG-START
	MOVE.B (A0,D0.W),D1
	CMP.B #$FF,D1
	BNE.S MUS_CONTSONG
	CLR.W MUS_MODSONG
	MOVE.B (A0),D1

MUS_CONTSONG:
	AND.W #$00FF,D1
	ASL.W #2,D1
	LEA MUS_PATTERNS(PC),A0
	MOVE.L 0(A0,D1.W),A2
	MOVE.L A2,MUS_CURRPAT

MUS_CONTPAT:
	MOVE.L MUS_CURRPAT,A0
	MOVE.W MUS_MODPAT,D0

MUS_CHAN1HANDL:
	MOVE.B 0(A0,D0.W),D1
	CMP.B #BRK,D1
	BNE.S MUS_CHAN1NOBRK
	CLR.W MUS_VOL1
	BRA.S MUS_CHAN2HANDL
MUS_CHAN1NOBRK:
	CMP.B #W,D1
	BEQ.S MUS_CHAN2HANDL
	BSR.L MUS_GETPER
	MOVE.W D1,$0A6(A6)
MUS_A1:	MOVE.W #$40,MUS_VOL1	;ATTACK-LEVEL
MUS_CHAN2HANDL:
	MOVE.B 1(A0,D0.W),D1
	CMP.B #BRK,D1
	BNE.S MUS_CHAN2NOBRK
	CLR.W MUS_VOL2
	BRA.S MUS_CHAN3HANDL
MUS_CHAN2NOBRK:
	CMP.B #W,D1
	BEQ.S MUS_CHAN3HANDL
	BSR.L MUS_GETPER
	MOVE.W D1,$0B6(A6)
MUS_A2:	MOVE.W #$28,MUS_VOL2	;
MUS_CHAN3HANDL:
	MOVE.B 2(A0,D0.W),D1
	CMP.B #BRK,D1
	BNE.S MUS_CHAN3NOBRK
	CLR.W MUS_VOL3
	BRA.S MUS_CHAN4HANDL
MUS_CHAN3NOBRK:
	CMP.B #W,D1
	BEQ.S MUS_CHAN4HANDL
	BSR.L MUS_GETPER
	MOVE.W D1,$0C6(A6)
MUS_A3:	MOVE.W #$30,MUS_VOL3	;
MUS_CHAN4HANDL:
	move.l	Mod(pc),a4
	CMP.W #'RM',18(a4)	;'DRM'
	BEQ.S MUS_MAKEDRUMS

	MOVE.B 3(A0,D0.W),D1
	CMP.B #BRK,D1
	BNE.S MUS_CHAN4NOBRK
	CLR.W MUS_VOL4
	BRA.L MUS_NODRUMSOUNDFIN
MUS_CHAN4NOBRK:
	CMP.B #W,D1
	BEQ.L MUS_NODRUMSOUNDFIN
	BSR.L MUS_GETPER
	MOVE.W D1,$0D6(A6)
MUS_A4:	MOVE.W #$30,MUS_VOL4	;
	BRA.L MUS_NODRUMSOUNDFIN


MUS_MAKEDRUMS:
	MOVE.B 3(A0,D0.W),D1
	CMP.B #W,D1
	BEQ.L MUS_SOUNDFIN

MUS_DRUMSELECT:
	CMP.B #BDRUM,D1
	BNE.S MUS_DC1
	MOVE.L #MUS_CLRWAVE,A0
	MOVE.W #1808,MUS_DRUMRATE
	MOVE.W #-255,MUS_DRUMPITCH
	MOVE.W #$40,MUS_VOL4
	MOVE.B #8,MUS_D4+3
	BRA.L MUS_PLAYDRUM
MUS_DC1:
	CMP.B #SDRUM,D1
	BNE.S MUS_DC2
	MOVE.L #MUS_RNDWAVE,A0
	MOVE.W #1808,MUS_DRUMRATE
	MOVE.W #20,MUS_DRUMPITCH
	MOVE.W #$40,MUS_VOL4
	MOVE.B #4,MUS_D4+3
	BRA.L MUS_PLAYDRUM
MUS_DC2:
	CMP.B #T1DRUM,D1
	BNE.S MUS_DC3
	MOVE.L MUS_EXTWAVE,A0
	MOVE.W #452,MUS_DRUMRATE
	MOVE.W #-50,MUS_DRUMPITCH
	MOVE.W #$40,MUS_VOL4
	MOVE.B #4,MUS_D4+3
	BRA.L MUS_PLAYDRUM
MUS_DC3:
	CMP.B #T2DRUM,D1
	BNE.S MUS_DC4
	MOVE.L MUS_EXTWAVE,A0
	MOVE.W #604,MUS_DRUMRATE
	MOVE.W #-50,MUS_DRUMPITCH
	MOVE.W #$40,MUS_VOL4
	MOVE.B #4,MUS_D4+3
	BRA.L MUS_PLAYDRUM
MUS_DC4:
	CMP.B #T3DRUM,D1
	BNE.S MUS_DC5
	MOVE.L MUS_EXTWAVE,A0
	MOVE.W #904,MUS_DRUMRATE
	MOVE.W #-50,MUS_DRUMPITCH
	MOVE.W #$40,MUS_VOL4
	MOVE.B #4,MUS_D4+3
	BRA.L MUS_PLAYDRUM
MUS_DC5:
	CMP.B #T4DRUM,D1
	BNE.S MUS_DC6
	MOVE.L MUS_EXTWAVE,A0
	MOVE.W #1208,MUS_DRUMRATE
	MOVE.W #-50,MUS_DRUMPITCH
	MOVE.W #$40,MUS_VOL4
	MOVE.B #4,MUS_D4+3
	BRA.S MUS_PLAYDRUM
MUS_DC6:
	CMP.B #HCDRUM,D1
	BNE.S MUS_DC7
	MOVE.L #MUS_RNDWAVE,A0
	MOVE.W #604,MUS_DRUMRATE
	MOVE.W #-10,MUS_DRUMPITCH
	MOVE.W #$30,MUS_VOL4
	MOVE.B #16,MUS_D4+3
	BRA.S MUS_PLAYDRUM
MUS_DC7:
	CMP.B #HODRUM,D1
	BNE.S MUS_DC8
	MOVE.L #MUS_RNDWAVE,A0
	MOVE.W #604,MUS_DRUMRATE
	MOVE.W #-10,MUS_DRUMPITCH
	MOVE.W #$28,MUS_VOL4
	MOVE.B #2,MUS_D4+3
	BRA.W MUS_PLAYDRUM
MUS_DC8:

MUS_PLAYDRUM:
	MOVE.W #$0008,$096(A6)
	MOVE.L A0,$0D0(A6)		;SET WAVE
	MOVE.W #$8008,$096(A6)

MUS_SOUNDFIN:
	MOVE.W MUS_DRUMPITCH,D1
	SUB.W D1,MUS_DRUMRATE
	MOVE.W MUS_DRUMRATE,$0D6(A6)

MUS_NODRUMSOUNDFIN:

	MOVE.W MUS_VOL1,$0A8(A6)
	MOVE.W MUS_VOL2,$0B8(A6)
	MOVE.W MUS_VOL3,$0C8(A6)
	MOVE.W MUS_VOL4,$0D8(A6)

	RTS

;;;;;;;;;;;

MUS_GETPER:
	LEA MUS_PERIODTAB(PC),A1
	AND.W #$00FE,D1
	MOVE.W 0(A1,D1.W),D1
	RTS

;;;;;;;;;;;;;;;;;;;

MUS_INIT:
	move.w	#1,Dontplay
	LEA $DFF000,A6
	move.l	Mod(pc),A5

	MOVE.W #$000F,$096(A6)		;SET WAVEFORMS
	MOVE.L A5,D0
	ADD.L #22,D0
	MOVE.L D0,$0A0(A6)
	MOVE.W #16,$0A4(A6)
	ADD.L #32,D0
	MOVE.L D0,$0B0(A6)
	MOVE.W #16,$0B4(A6)
	ADD.L #32,D0
	MOVE.L D0,$0C0(A6)
	MOVE.W #16,$0C4(A6)
	ADD.L #32,D0
	MOVE.L D0,MUS_EXTWAVE
	MOVE.L D0,$0D0(A6)
	MOVE.W #16,$0D4(A6)
	MOVE.W #$800F,$096(A6)

	MOVE.B 21(A5),D1	;PATTERN-LENGTH
	AND.W #$FF,D1
	ASL.W #2,D1		; * 4
	MOVE.W D1,MUS_PL+2

	MOVE.W D1,D2
	SUB.W #4,D2
	MOVE.W D2,MUS_MODPAT	;LAST STEP IN PATTERN

	MOVE.B 150(A5),D0	;SONG-LENGTH
	MOVE.B D0,D2
	SUB.B #2,D2
	AND.W #$00FF,D2
	MOVE.W D2,MUS_MODSONG	;LAST STEP IN SONG

	ADD.B #150+1,D0		;BEGIN OF PATTERNS
	AND.L #$FF,D0
	ADD.L A5,D0

	LEA MUS_PATTERNS(PC),A0

	AND.L #$FFFF,D1
	MOVEQ #63,D7
MUS_SETPATTERNS:
	MOVE.L D0,(A0)+
	ADD.L D1,D0		;NEXT PATTERN
	DBF D7,MUS_SETPATTERNS

	MOVE.B 08(A5),MUS_A1+3	;ENVELOPES
	MOVE.B 09(A5),MUS_D1+3
	MOVE.B 10(A5),MUS_S1+3
	MOVE.B 11(A5),MUS_A2+3
	MOVE.B 12(A5),MUS_D2+3
	MOVE.B 13(A5),MUS_S2+3
	MOVE.B 14(A5),MUS_A3+3
	MOVE.B 15(A5),MUS_D3+3
	MOVE.B 16(A5),MUS_S3+3

	move.l	Mod(pc),a4
	CMP.W #'RM',18(a4)
	BEQ.S .MUS_DRUMSINIT
	MOVE.B 17(A5),MUS_A4+3
	MOVE.B 18(A5),MUS_D4+3
	MOVE.B 19(A5),MUS_S4+3
	BRA.S MUS_CHAN4INITED
.MUS_DRUMSINIT:
	CLR.B MUS_S4+3
MUS_CHAN4INITED:
	MOVE.B 20(A5),MUS_RP+3	;REPLAY-SPEED

	MOVE.B 20(A5),D0
	SUB.B #1,D0
	MOVE.B D0,MUS_WAITPOS	;LAST FRAME ON TONE
	CLR.L MUS_VOL1
	CLR.L MUS_VOL3
	CLR.W $0A8(A6)
	CLR.W $0B8(A6)
	CLR.W $0C8(A6)
	CLR.W $0D8(A6)
	clr.w	DontPlay
	RTS

MUS_PERIODTAB:
	DC.W 3424,3232,3048,2880,2712,2560,2416,2280,2152,2032,1920,1808
	DC.W 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,904
	DC.W 856,808,762,720,678,640,604,570,538,508,480,452
	DC.W 428,404,381,360,339,320,302,285,269,254,240,226
	DC.W 214
MUS_DRUMRATE:	DC.W 0
MUS_DRUMPITCH:	DC.W 0
MUS_SEED:	DC.L $986FA0B9
MUS_RNDWAVE:	BLK.B 32,0

MUS_CLRWAVE:
	DC.B $7F,$7F,-$7F,-$7F,00,10,20,30
	DC.B 40,50,60,70,80,90,100,110
	DC.B 120,130,140,150,160,170,180,190
	DC.B 180,160,140,120,100,80,60,40
MUS_EXTWAVE:	DC.L 0
MUS_VOL1:	DC.W 0
MUS_VOL2:	DC.W 0
MUS_VOL3:	DC.W 0
MUS_VOL4:	DC.W 0
MUS_WAITPOS:	DC.B 0,0
MUS_CURRPAT:	DC.L 0
MUS_MODSONG:	DC.W 0
MUS_PATTERNS:	BLK.L 64,0
MUS_MODPAT:	DC.W 0

;----------------------------------------------------------------

OldLv2Irq:	dc.l	0
OldLv6Irq:	dc.l	0
SetLv2Irq:	move.l	$68.w,OldLv2Irq
	move.b	#$7f,$bfed01	;clr irq ctrlreg
		move.l	#NewLv2Int,$68.w
;	move.w	#$3700,d0
	tst.b	$bfee01		;ctrl a - stop timer a
	tst.b	$bfef01
;	move.b	d0,$bfe401	;timer a low
;	lsr.w	#$8,d0
;	move.b	d0,$bfe501	;timer a high
	move.b	#$88,$bfed01	;irq ctrlreg - from timer a + sp full
;	move.b	#$19,$bfee01	;- start timer a one-shot
	move.w	#$8008,$dff09a


	move.l	$78.w,OldLv6Irq
	move.b	#$7f,$bfdd00	;clr irq ctrlreg
	move.l	#NewLv6Int,$78.w
	move.w	#$3700,d0	;$3781
	tst.b	$bfde00		;ctrl a - stop timer a
	tst.b	$bfdf00
	move.b	d0,$bfd400	;timer a low
	lsr.w	#$8,d0
	move.b	d0,$bfd500	;timer a high
	move.b	#$81,$bfdd00	;irq ctrlreg - from timer a
	move.b	#$11,$bfde00	;- start timer a one-shot
	move.w	#$e000,$dff09a	;enable lv6	+ main
	rts

ClrLv2Irq:	move.w	#$2008,$dff09a
		tst.b	$bfee01
		tst.b	$bfde00
		tst.b	$bfef01
		tst.b	$bfdf00
		tst.b	$bfed01
		tst.b	$bfdd00

		move.b	#$7f,$bfed01
		move.b	#$7f,$bfdd00
		move.b	#$9f,$bfed01
		move.b	#$9f,$bfdd00
		move.l	OldLv2Irq(pc),$68.w
		move.l	OldLv6Irq(pc),$78.w
		rts


NewLv6Int:
	movem.l	d0-d7/a0-a6,-(a7)
Sunc:	move.l	$dff004,d0
	and.l	#$1ff00,d0
	cmp.l	#$13000,d0	;e6
	blt.s	Sunc

	move.w	#$3700,d0	;$3752
	tst.b	$bfdd00
	tst.b	$bfde00		;ctrl a - stop timer a
	move.w	d0,d1
	lsr.w	#$8,d1
	move.b	d0,$bfd400	;timer a low
	move.b	d1,$bfd500	;timer a high
	move.b	#$81,$bfdd00	;irq ctrlreg - set irq from timer a
	move.b	#$11,$bfde00	;force load+start timer a - continuos

.ever:
	bsr	Random
;	btst	#6,$bfe001
;	beq	.skip

;	move.w	#$600,$dff180
	bsr	sv_rut
	bsr	s_swap
	bsr	up_rut

	addq.l	#1,coo
	tst.w	GoPlot
	beq.s	.no
	if trynew=0
	cmp.l	#$300,coo
	bne.s	.ugha
	clr.w	Vgo
.ugha:	ble.s	.no
	endc
	subq.l	#1,coo
	bsr	t_rut
	bsr	S_rut
.no:
	bsr	li_rut
	bsr	V_rut
;	move.w	#$006,$dff180

.skip:	BSR.L MUS_PLAY

	movem.l	(a7)+,d0-d7/a0-a6
	move.w	#$2000,$dff09c
	rte

Coo:	dc.l	0
GoPlot:	dc.w	0

NewLv2Int:	movem.l	d0-d2/a0,-(a7)
		move.b	$bfed01,d0
		bclr	#7,d0
		bclr	#3,d0
		beq	.NII_Ex
		moveq	#0,d2
		move.b	$bfec01,d2
		bset	#6,$bfee01
		not.b	d2
		ror.b	#1,d2
		moveq	#60,d1
.NII_Wait:	dbf	d1,.NII_Wait
		bclr	#6,$bfee01

		btst	#7,d2
		bne.s	.NII_UpKey
		move.w	d2,ActKey
	bsr	NIIHelene
	cmp.w	#$50,d2
	blt.s	.NII_UpKey
	cmp.w	#$59,d2
	bgt.s	.NII_UpKey

	movem.l	d0-d7/a0-a6,-(a7)
	move.w	#1,DontPlay
	sub.w	#$50,d2
	asl.l	#2,d2
	lea	Modoffs(pc),a0
	move.l	(a0,d2.w),Mod
	bsr	Mus_init
	movem.l	(a7)+,d0-d7/a0-a6

.NII_UpKey:	move.w	d2,AllKey
.NII_Ex:	move.w	#$8,$dff09c
		movem.l	(a7)+,d0-d2/a0
		rte

ActKey:		dc.w	0
AllKey:		dc.w	0

ModOffs:	dc.l m0,m1,m2,m3,m4,m5,m6,m7,m8,m9

NIImpoi:dc.l	NIImdat
NIImdat:dc.b	$25,$12,$28,$12,$36,$12,$ff,$ff
NIIhelene:
	move.l	NIImpoi(pc),a0
	cmp.b	(a0)+,d2
	beq.s	.NIIm2
	lea	NIImdat(pc),a0
.NIIm2:	move.l	a0,NIImpoi
	tst.b	(a0)
	bpl.s	.NIIm1
;	move.l	#$fff0fff,$dff180
	clr.w	ActKey
	move.l	#Helene,up_poi
	move.l	#NIImdat,NIImpoi
.NIIm1:	rts








c=$110
d=$000

cop:	dc.w $0100,$1200
	dc.w $0102,$00ff,$0104,$0000
	dc.w $0108,-18,$010a,$0000
	dc.w $008e,$206e,$0090,$37c7
	dc.w $0092,$0030,$0094,$0070
	dc.w $00e0,dummy/$10000,$00e2,dummy&$ffff

co2:	dc.w $00e4,[s4+[$d20*0]]/$10000,$00e6,[s4+[$d20*0]]&$ffff
co3:	dc.w $00e8,[s4+[$d20*1]]/$10000,$00ea,[s4+[$d20*1]]&$ffff
co4:	dc.w $00ec,[s4+[$d20*2]]/$10000,$00ee,[s4+[$d20*2]]&$ffff
co5:	dc.w $00f0,[s4+[$d20*3]]/$10000,$00f2,[s4+[$d20*3]]&$ffff

sv2_cop:dc.w $120,dummy/$10000,$122,dummy&$ffff
	dc.w $124,dummy/$10000,$126,dummy&$ffff
	dc.w $128,dummy/$10000,$12a,dummy&$ffff
	dc.w $12c,dummy/$10000,$12e,dummy&$ffff
	dc.w $130,dummy/$10000,$132,dummy&$ffff
	dc.w $134,dummy/$10000,$136,dummy&$ffff
	dc.w $138,dummy/$10000,$13a,dummy&$ffff
	dc.w $13c,dummy/$10000,$13e,dummy&$ffff
	dc.w $0180,$0000,$0182,$f00
	dc.w $0096,$8020
	dc.w $182,$330,$186,$440,$18a,$550,$18e,$770
	dc.w $192,$990,$196,$bb0,$19a,$dd0,$19e,$ff0
	dc.w $1a2,$ff1,$1a6,$ff2,$1aa,$ff3,$1ae,$ff4
	dc.w $1b2,$ff5,$1b6,$ff6,$1ba,$ff7,$1be,$ff8

	dc.w $180,$000,$184,d*$1,$188,d*$2,$18c,d*$3
	dc.w $190,d*$4,$194,d*$5,$198,d*$6,$19c,d*$7
	dc.w $1a0,d*$8,$1a4,d*$9,$1a8,d*$a,$1ac,d*$b
	dc.w $1b0,d*$d,$1b4,d*$d,$1b8,d*$e,$1bc,d*$f

	dc.w $6201,$fffe,$0100,$5200
co:	dc.w $00e0,0,$00e2,0
	dc.w $0108,0,$010a,0


	dc.w $ee01,$fffe,$0100,$1200
	dc.w $00e0,dummy/$10000,$00e2,dummy&$ffff
	dc.w $0108,-18

	dc.w $ffe1,$fffe,$0102,$0000

	dc.w $0501,$fffe,$00e0,[up_screen+0]/$10000,$00e2,[up_screen+0]&$ffff
	dc.w $0108,$0002,$0182,$e29,$0092,$0030,$0094,$00d8


	dc.w $0607,$fffe,$0182,$e4a
	dc.w $0707,$fffe,$0182,$e6b
	dc.w $0807,$fffe,$0182,$e8c
	dc.w $0907,$fffe,$0182,$ead
	dc.w $0a07,$fffe,$0182,$ccb
	dc.w $0b07,$fffe,$0182,$ae9
	dc.w $0c07,$fffe,$0182,$8f7

	dc.l	-2

cou:	dc.w	-570

rend:
zero:
oldstack:dc.l	0
oldena:	dc.w	0
oldreq:	dc.w	0
olddma:	dc.w	0

endgo:	dc.w	0
thego:	dc.w	0
MahoneyGo:dc.w	0
KaktusGo:dc.w	0
Vgo:	dc.w	0

xpp:	dc.w	0
xpo:	dc.l	$a00000
ypo:	dc.l	$200000
ligo:	dc.w	0
sila:	dc.b	0
	dc.b	0
thedots:dc.w	0,0
	dc.w	0,0
	dc.w	0,0
	dc.w	0,0
lix:	dc.w	0
liy:	dc.w	0

sv2_datlist:	blk.b	$80,0
		blk.b	$80,0
		blk.b	$80,0

dummy:	blk.l	44/4,0
VecDest:blk.w	$108/2,0
Mahoney:blk.w	[$139/$20*$20+$20]*6/2,0
Kaktus:	blk.w	[$f8/$20*$20+$20]*6/2,0
The:	blk.w	[$11f/$20*$20+$20]*6/2,0
SEnd:	blk.w	[$125/$20*$20+$20]*6/2,0
Star:	blk.w	1472*6/2,0
s_dat:	blk.w	Dots*3,0
t_dat:	blk.w	trons*32*3,0

zeroend:
	end

