	ORG	$39d40
	LOAD	$39d40

;His Master's Noise

L698=$c0	;:	blk.l	$20,0	;samplestarts
mt_data=$c0	;:	dc.l	0

Packedtune=$c0+[$20*4]	;$6824=Russian Bear nast langsta efter Warm Valley

tunedatadest:	dc.l	$c0+[$20*4]+$1000	;$400=crunch-safemem
CrunchedInstrument=$c0+$34000	;langsta ljud ar ca $4a00 brass.yes
TuneInMemory:	dc.w	0

>extern "reset$59000j$5f974",reset
>extern "SmallFontR",SFontR
>extern "FontR",FontR
>extern "Sin255",Sin255
>extern "Bolle",bolle
>extern "MKbobR",MKbobR
>extern "TrainRR",TrainR
>extern "DroppenR",Droppen
>extern "Hallon",Hallon
>extern "Steffi2R",Digispr
>extern "Steffi3R",Digispr2
>extern "Steffi5R",Digispr3
>extern "Steffi4R",Digispr4
>extern "Barn",Barn
>extern "SpokeR",SpokeR
>extern "PacR",PacR
>extern "HelpR",HelpR

reset=$59000		;$9a08
SfontR=reset+$9a08	;$400	;$58000
FontR=SfontR+$400	;$2000
Sin255=FontR+$2000	;$100
Bolle=Sin255+$100	;$168
MKbobR=Bolle+$168	;$528
TrainR=MKbobR+$528	;$438
Droppen=TrainR+$438	;$308
Hallon=Droppen+$338	;$800
Digispr=Hallon+$800	;$c20
Digispr2=Digispr+$c20	;$c20
Digispr3=Digispr2+$c20	;$c20
Digispr4=Digispr3+$c20	;$c20
SpokeR=Digispr4+$c20	;$168
PacR=SpokeR+$168	;$168
HelpR=PacR+$168		;$b40

Barn=HelpR+$b40		;$5620

end=barn+$5626

menu1=$70000
menu2=$72200
textbpl=$74400	;$26ac
plotbpl=$77002	;$2200	ca
barnbpl=$79242	;$630

MaxAntalRaderITexter=500

stack:	blk.l	$c0,0
S:	move.l	$04.w,a6
	tst.l	0.w
	beq.s	.ingetFast
	move.w	#2,FastMemFlag
	move.l	0.w,TypeOFastMem
.ingetFast:
	move.l	a7,oldstack
	lea	s(pc),a7
	moveq	#0,d0
	moveq	#0,d1
	moveq	#0,d2
	moveq	#0,d3
	moveq	#0,d4
	moveq	#0,d5
	moveq	#0,d6
	moveq	#0,d7
	move.l	d0,a0
	move.l	d1,a1
	move.l	d2,a2
	move.l	d3,a3
	move.l	d4,a4
	move.l	d5,a5
	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)
	move.l	#super,$80.w
	trap	#0
	lea	s(pc),a7
	or.b	#2,$bfe001

	jsr	$5f974		;resetinit
	jsr	Init_drives

	lea	mulu44(pc),a0
	move.w	#$c7,d7
	moveq	#0,d0
pl_il:	move.w	d0,(a0)+
	add.w	#44,d0
	dbf	d7,pl_il

	bsr	Menu_init
	bsr	rnd_init
	jsr	gr_init
	bsr	sv_init
	bsr	sv_init2
	bsr	Text_init
	bsr	plot_init
	bsr	barn_init
	clr.w	TuneInMemory
	clr.l	mt_data
	bsr	printnotune
	jsr	newscrollmessage

	lea	menu1+[$25*44]+6,a0
	lea	menu2+[$25*44]+6,a1
	move.b	#%01101100,(a0)
	move.b	#%11110011,(a1)
	move.b	#%01101110,1*44(a0)
	move.b	#%11110001,1*44(a1)
	move.b	#%01101111,2*44(a0)
	move.b	#%11110000,2*44(a1)
	move.w	#%0110111110000000,3*44(a0)
	move.w	#%1111000001111111,3*44(a1)
	move.b	#%01101111,4*44(a0)
	move.b	#%11110000,4*44(a1)
	move.b	#%01101110,5*44(a0)
	move.b	#%11110001,5*44(a1)
	move.b	#%01101100,6*44(a0)
	move.b	#%11110011,6*44(a1)

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


EVER:
	tst.b	tunetoload
	beq.s	.noload
	jsr	depacktune
	clr.w	actkey
	clr.b	Tunetoload
.noload:

	tst.w	loadwholedisk1
	beq.s	.nod1
	jsr	loaddisk1
.nod1:
	move.w	SpokeGo,d0
	bpl.s	.nospooke
	cmp.w	#-1,d0
	bne.s	.pac
	bsr	sv_spokeinit
	move.w	#1,spokeGo
	bra.s	.nospooke
.pac:	move.w	#0,SpokeGo
	lea	Bolle,a6
	eor.w	#1,paconoff
	beq.s	.norm
	lea	PacR,a6
.norm:	bsr	sv4
.nospooke:
	bsr	CheckFastLoad
	bra	ever

dc.b "    >-- FAN VAD JAG ALSKAR HELENE! --<   "
	even

;END:	jsr	mt_end
;	bsr	ClrLv2Irq
;
;	lea	$00.w,a0		;swap $00-$18000 -> $c60000
;	lea	$c6a000,a1
;	move.w	#[$15000/$10]-1,d7
;memcopybackrut:
;	move.l	(a0),d0
;	move.l	(a1),(a0)+
;	move.l	d0,(a1)+
;	move.l	(a0),d0
;	move.l	(a1),(a0)+
;	move.l	d0,(a1)+
;	move.l	(a0),d0
;	move.l	(a1),(a0)+
;	move.l	d0,(a1)+
;	move.l	(a0),d0
;	move.l	(a1),(a0)+
;	move.l	d0,(a1)+
;	dbf	d7,memcopybackrut
;
;
;	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)
;
;	move.l	$04.w,a6
;	move.l	oldstack(pc),a7
;	moveq	#0,d0
rts:	rts

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

oldstack:dc.l	0
oldena:	dc.w	0
oldreq:	dc.w	0
olddma:	dc.w	0
spokeGo:dc.w	0
PacOnOff:dc.w	0

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

CheckFastLoad:
	cmp.w	#2,FastMemFlag
	bne	ba_rts
	cmp.w	#2,PlayMode
	bne	ba_rts

	move.w	TuneInMemory(pc),d0
	beq	ba_rts
	addq.w	#1,d0
	move.l	d0,d1
	lea	LongPlayOnOffs-1(pc),a0
.l:	cmp.w	#101,d0
	bne.s	.r
	move.w	#1,d0
.r:	tst.b	(a0,d0.w)
	bne.s	.go
	addq.w	#1,d0
	cmp.w	d0,d1	;ett varv
	beq	qkrts
	bra.s	.l
.go:	cmp.w	Fa_1TuneNo,d0
	beq	ba_rts
	cmp.w	Fa_2TuneNo,d0
	beq	ba_rts
	move.b	#1,LoadNoSwap
	move.b	d0,tunetoload	;aktivera laddningsrut
	rts

	even
tminut1:	dc.b	"0",0
tminut2:	dc.b	"0",0
tsekund1:	dc.b	"0",0
tsekund2:	dc.b	"0",0

tSek1GO:	dc.b	0
tMin2GO:	dc.b	0
tMin1GO:	dc.b	0
		dc.b	0
ttim1:	dc.w	0

TuneTimer:
	move.w	pr_xpos(pc),-(a7)
	bsr.s	.timme
	move.w	(a7)+,pr_xpos
	rts

.timme:	cmp.w	#2,stoppauseplaymode
	bne	.noadd

	addq.w	#1,ttim1
.noadd:	cmp.w	#50,ttim1
	blt.s	ttim_ChSek1
	clr.w	ttim1
	lea	tsekund2(pc),a0
	addq.b	#1,(a0)
	cmp.b	#$3a,(a0)
	bne.s	ttim_1
	move.b	#$30,(a0)
	move.b	#1,tSek1GO
ttim_1:	move.w	#$5d-44,pr_xpos
	bra	tprintTimer
ttim_ChSek1:
	tst.b	tSek1GO
	beq.s	ttim_ChMin2
	clr.b	tSek1GO
	lea	tsekund1(pc),a0
	addq.b	#1,(a0)
	cmp.b	#$36,(a0)
	bne.s	ttim_2
	move.b	#$30,(a0)
	move.b	#1,tMin2GO
ttim_2:	move.w	#$57-44,pr_xpos
	bra	tprintTimer
ttim_ChMin2:
	tst.b	tMin2GO
	beq.s	ttim_ChMin1
	clr.b	tMin2GO
	lea	tMinut2(pc),a0
	addq.b	#1,(a0)
	cmp.b	#$3a,(a0)
	bne.s	ttim_3
	move.b	#$30,(a0)
	move.b	#1,tMin1GO
ttim_3:	move.w	#$4e-44,pr_xpos
	bra	tprintTimer
ttim_ChMin1:
	tst.b	tMin1GO
	beq.s	ttim_ChTim2
	clr.b	tMin1GO
	lea	tMinut1(pc),a0
	addq.b	#1,(a0)
	move.w	#$48-44,pr_xpos
	bra	tprintTimer
ttim_ChTim2:
	rts

tPrintTimer:
 	moveq	#0,d0
	move.b	(a0)+,d0
	lea	menu1+[[$68+2]*44],a1
	bra	PrintTimerJumpIn

SetTuneTimer:
	move.l	L693,d0
	lea	PattFrames(pc),a0
	add.l	d0,d0
	moveq	#0,d1
	move.w	(a0,d0.w),d1
	divu	#50,d1
	swap	d1
	move.w	#50,ttim1	;d1
	swap	d1
	ext.l	d1
	divu	#60,d1
	add.w	#$2f,d1
	move.b	d1,tminut2
	swap	d1
	ext.l	d1
	divu	#10,d1
	move.l	d1,d2
	swap	d2
	add.w	#$2f,d2
	move.b	d2,tsekund2

	ext.l	d1
	divu	#10,d1
	move.l	d1,d2
	swap	d2
	add.w	#$2f,d2
	move.b	d2,tsekund1

	move.b	#$2f,tminut1
	move.b	#1,tsek1go
	move.b	#1,tmin1go
	move.b	#1,tmin2go
	rts


printnotune:
	jsr	clearreq
	lea	menu1+[$44*44]+2,a0
	moveq	#$5c-$44-1,d7
.k:	or.l	#$00ffffff,(a0)
	move.l	#$ffffffff,4(a0)
	move.w	#$ffff,8(a0)
;	and.b	#$1f,10(a0)
	or.l	#$07ffffff,menu2-menu1(a0)
	move.l	#$ffffffff,4+menu2-menu1(a0)
	move.w	#$ffff,8+menu2-menu1(a0)
	or.b	#$e0,10+menu2-menu1(a0)
	lea	44(a0),a0
	dbf	d7,.k
	lea	.notunetext1(pc),a0
	bra	print1
.notunetext1:
	dc.b $ff,$80,$3c,$46,'please load'
	dc.b $ff,$80,$3c,$50,'- waiting -',0
	even



PattFrames:	blk.w	128,0
Pattspds:	blk.b	128,0

Tunetext_init:
	moveq	#6,d6	;speed
	moveq	#0,d5	;framecounter
	lea	PattFrames(pc),a0
	lea	PattSpds(pc),a5
	move.l	mt_data,a1
	lea	$3b8(a1),a2
	lea	$43c(a1),a3

	moveq	#0,d7
	move.b	$3b6(a1),d7
	subq.w	#1,d7
Tunepi:	moveq	#0,d0
	move.b	(a2)+,d0
	asl.w	#8,d0
	asl.w	#2,d0
	lea	(a3,d0.l),a4
	move.w	d5,(a0)+	;framecou-> songposlist
	move.b	d6,(a5)+

	moveq	#$3f,d4
tunepipattlop:
	add.l	d6,d5
	moveq	#3,d3
tunepipattlopvoice:
	move.b	$2(a4),d0
	and.w	#$f,d0
	cmp.b	#$d,d0
	beq.s	tunepinextpatt
	cmp.b	#$f,d0
	bne.s	tuy
	move.b	3(a4),d6	;newspeed
tuy:	tst.l	(a4)+
	dbf	d3,tunepipattlopvoice
	dbf	d4,tunepipattlop

tunepinextpatt:
	dbf	d7,tunepi
	move.w	d5,(a0)+

	move.l	d5,d1
	divu	#50,d1
	ext.l	d1
	divu	#60,d1
	add.b	#$30,d1
	move.b	d1,tMinSek+1
	swap	d1

	ext.l	d1
	divu	#10,d1
	add.b	#$30,d1
	move.b	d1,tMinSek+3
	swap	d1
	add.b	#$30,d1
	move.b	d1,tMinSek+4

	jsr	clearreq

	bsr	random
	lea	headlines(pc),a1
	moveq	#0,d0
	move.b	rnd+6(pc),d0
	and.w	#$f,d0
	bra.s	.tunerndtext
.trn:	tst.b	(a1)+
	bne.s	.trn
.tunerndtext:
	dbf	d0,.trn

	lea	tunetext(pc),a0
	lea	4(a0),a2
.tunemoveon:
	move.b	(a1)+,(a2)+
	bne.s	.tunemoveon
	bsr	print1

	lea	authorline(pc),a1
	moveq	#0,d0
	move.b	rnd+4(pc),d0
	and.w	#$f,d0
	bra.s	.tunearndtext
.tarn:	tst.b	(a1)+
	bne.s	.tarn
.tunearndtext:
	dbf	d0,.tarn

	lea	tune2text(pc),a0
	lea	4(a0),a2
.tuneamoveon:
	move.b	(a1)+,(a2)+
	bne.s	.tuneamoveon

	bsr	print1
	lea	tune3text(pc),a0
	bsr	print1


	moveq	#0,d0
	move.b	tunetoload,d0
	lea	TuneList,a0
	bra.s	.yy

.t:	tst.b	(a0)+
	bpl.s	.t
.yy:	dbf	d0,.t

	move.l	a0,a1
.y:	tst.b	(a1)+
	bne.s	.y
	addq.l	#6,a1	;a0=tunenamn
			;a1=composernamn

	lea	au+4(pc),a2
	move.l	a2,a3
	clr.l	(a3)+
	clr.l	(a3)+
	clr.l	(a3)+
	clr.l	(a3)+

.lop:	move.b	(a1)+,(a2)+
	bpl.s	.lop
	clr.b	-1(a2)

	cmp.b	#'S',(a0)
	bne.s	.re
	cmp.b	#'k',1(a0)
	bne.s	.re
	cmp.b	#'r',2(a0)
	bne.s	.re
	cmp.b	#'e',3(a0)
	bne.s	.re

	lea	.skreckText(pc),a0
	move.l	a0,reprpoi
	move.l	#print3,reprrut
	bsr	print3
	bra	.nopr
.re:
	move.l	a0,a1
	moveq	#0,d0
.ko:	cmp.b	#' ',(a1)+	;kolla # mellanslag
	bne.s	.no
	addq.w	#1,d0
.no:	tst.b	(a1)
	bne.s	.ko

	lea	.tunetext2(pc),a1

	tst.w	d0
	bne.s	.intenoll
	move.l	#$ff803b3e,(a1)+
.e:	move.b	(a0)+,(a1)+
	bne.s	.e
	lea	.tuneText2(pc),a0
	move.l	a0,reprpoi
	move.l	#print3double,reprrut
	bsr	print3double
	bra	.nopr
.intenoll:
	cmp.w	#1,d0
	bne.s	.inteett
	move.l	#$ff803b3e,(a1)+
.l:	move.b	(a0)+,d0
	cmp.b	#' ',d0
	bne.s	.l2
	move.b	#$ff,(a1)+
	move.b	#$80,(a1)+
	move.b	#$3b,(a1)+
	moveq	#$47,d0
.l2:	move.b	d0,(a1)+
	bne.s	.l
	bra.s	.pr

.inteett:
	move.l	#$ff803b3e,(a1)+	;tva och tre
	moveq	#2,d1
.a:	move.b	(a0)+,d0
	cmp.b	#' ',d0
	bne.s	.a2
	subq.w	#1,d1
	bne.s	.a2
	move.b	#$ff,(a1)+
	move.b	#$80,(a1)+
	move.b	#$3b,(a1)+
	moveq	#$47,d0
.a2:	move.b	d0,(a1)+
	bne.s	.a


.pr:	lea	.tunetext2(pc),a0
	move.l	a0,reprpoi
	move.l	#print3,reprrut
	bsr	print3
.nopr:	lea	au(pc),a0
	bra	print3

.Tunetext2:	blk.b	$20,0

.SkreckText:
	dc.b $ff,$80,$3b,$3e,"Skreck-"
	dc.b $ff,$80,$3b,$47,"eksempel",0

au:	dc.b	$ff,$80,$3b,$5e
	dc.l	0,0,0,0

reprpoi:dc.l	0
reprrut:dc.l	rts

reprinttunetext:
	tst.w	TuneInMemory
	beq	printnotune
	jsr	ClearReq
	lea	tunetext(pc),a0
	bsr	print1
	lea	tune2text(pc),a0
	bsr	print1
	lea	au(pc),a0
	bsr	print3

	move.l	reprpoi(pc),a0
	move.l	reprrut(pc),a1
	jmp	(a1)

Tunetext:
	dc.b $ff,$80,$3b,$33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
tune2text:
	dc.b $ff,$80,$3b,$53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
tune3text:
	dc.b $ff,$00,$1c,$68,"00:00/"
TMinSek:dc.b	"00:00"
	dc.b 0

Authorline:
	dc.b "created by",0
	dc.b "mixed by",0
	dc.b "squeezed by",0
	dc.b "mastered by",0
	dc.b "by the master",0
	dc.b "not him again",0
	dc.b "adore him:",0
	dc.b "ihopg}kad av",0
	dc.b "sponsored by",0
	dc.b "transposing:",0
	dc.b "vocals by",0
	dc.b "harmonics by",0
	dc.b "thank him!",0
	dc.b "game over",0
	dc.b "100 points to",0
	dc.b "go swimming",0


headlines:
	dc.b "current crap:",0
	dc.b "another hit:",0
	dc.b "what about",0
	dc.b "this is",0
	dc.b "dig this:",0
	dc.b "get down to",0
	dc.b "funky stuff:",0
	dc.b "go to sleep",0
	dc.b "a nice one:",0
	dc.b "try this one:",0
	dc.b "the adorable",0
	dc.b "the stunning",0
	dc.b "never bored:",0
	dc.b "fly away with",0
	dc.b "deep down to",0
	dc.b "here comes",0,0,0


	even
;----------------------------------------------------------------

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	#$89,$bfed01	;irq ctrlreg - from timer a + sp full
Spuk:	move.l	$dff004,d0
	and.l	#$1ff00,d0
	cmp.l	#$0d500,d0
	bne.s	Spuk
	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	#$3600/4,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.w	#$a000,$dff09a	;enable lv6
	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



MyVblRut:
	movem.l	d0-d7/a0-a6,-(a7)
Sunc:	move.l	$dff004,d0
	and.l	#$1ff00,d0
	cmp.l	#$0e000,d0	;e6
	blt.s	Sunc
	bne.s	.ever

	move.w	#$36ff,d0	;$3752
;	tst.b	$bfee01		;ctrl a - stop timer a
	move.w	d0,d1
	lsr.w	#$8,d1
	move.b	d0,$bfe401	;timer a low
	move.b	d1,$bfe501	;timer a high
	move.b	#$81,$bfed01	;irq ctrlreg - set irq from timer a
	move.b	#$10,$bfee01

.ever:
	move.b	#$01,$bfee01	;- start timer a - continuos


	addq.w	#1,framecou
;move.w	#$0f0,$dff180
	bsr	EverTimer	;datum_rut

	bsr	Random		;get new rnd

	tst.w	AnotherCopper
	bne	ForgetEverything

	bsr	pek_rut		;muspekar_rut
	bsr	dot_rut		;irrdot i menun

	bsr	mc_rut		;menu-colour-lines, sedan till bo_rut
	bsr	pt_rut		;latlista-scrollrut
	jsr	sv_rut		;starfield i bakgrunden
	bsr	mk_rut ;->pl_rut;MahoneyKaktus move + plotrut
;move.w	#$f00,$dff180
	bsr	sc_rut		;tunescrollen

	bsr	barn_rut	;ordspråk
;move.w	#$880,$dff180
	bsr	Bu_rut		;button_rut
	bsr	Tryckpa123
	bsr	Menu_rut	;updat av menuknappar

	bsr	digi_rut	;set digicopper if go

Forgetted:
;move.w	#$00f,$dff180
	jsr	MT_YIEAHO
	jsr	gr_rut		;the ground

;bltwait:btst	#14,$dff002
;	bne.s	bltwait

	movem.l	(a7)+,d0-d7/a0-a6
	tst.l	KorDennaRutEfterVbl
	beq.s	EndMyVbl
	movem.l	(a7)+,d0-d2	;gamla sedan KeyIrq
	move.l	KorDennaRutEfterVbl,-(a7)
	move.w	#$2000,-(a7)
	movem.l	d0-d2,-(a7)
	clr.l	KorDennaRutEfterVbl
EndMyVbl:
	bra.w	ReturnFromVbl

KorDennaRutEfterVbl:	dc.l	0
AnotherCopper:	dc.w	0

ForgetEverything:
	bsr	CheckBack
	bra	Forgetted

CheckBack:
	cmp.w	#2,AnotherCopper
	bne.s	.nohelp

	move.w	#$7a8,d1
	addq.b	#1,.hc
	move.b	.hc(pc),d0
	and.w	#$20,d0
	beq.s	.k
	move.w	#$eac,d1
.k:	move.w	d1,hcs+2
	move.w	d1,hcs+6
	rts

.nohelp:tst.w	digiback
	beq.s	.nodigi

	bsr	barn_rut
	tst.w	ba_newcou
	bpl.s	.tuttar
	move.w	#$ffff,ba_newcou	;aldrig ny
.tuttar:
	tst.l	ba_bplpoi
	bne.s	.nodigi
	addq.w	#1,mahkakcou
	move.w	mahkakcou(pc),d0
	cmp.w	#75+75,d0
	bne.s	.e
	move.w	#$969,mahcol+2
.e:	cmp.w	#75+100,d0
	bne.s	.t
	move.w	#$697,kakcol+2
.t:

.nodigi:move.b	actKey+1(pc),d2
	beq	ba_rts
	bmi	ba_rts
	tst.w	digiback
	beq.s	.no2digi

	move.l	digioldpoi(pc),ba_textpoi
	lea	$dff000,a6
.ba_bltw:btst	#14,$02(a6)
	bne.s	.ba_bltw
	move.l	#barnbpl,$54(a6)
	clr.l	$66(a6)
	move.l	#$01000000,$40(a6)
	move.w	#[$24*$40]+[44/2],$58(a6)
	move.w	#10,ba_newcou
	move.w	#1,ba_wegcou
	clr.l	ba_bplpoi
	clr.w	ba_radcou
	clr.w	digiback

.no2digi:
	move.l	#cop,$dff080
	clr.w	AnotherCopper
	clr.w	ActKey
	rts

.hc:	dc.b	0
	dc.b	0

NewLv2Int:	movem.l	d0-d2,-(a7)
		move.b	$bfed01,d0
		btst	#0,d0
		bne	MyVblRut
ReturnFromVbl:	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

		cmp.b	#$65,d2
		bne.s	NII_AltOn1
		bset	#0,AltMode
		bra	NII_Ex
NII_AltOn1:	cmp.b	#$e5,d2
		bne.s	NII_AltOff1
		bclr	#0,AltMode
		bra	NII_Ex
NII_AltOff1:	cmp.b	#$64,d2
		bne.s	NII_AltOn2
		bset	#1,AltMode
		bra	NII_Ex
NII_AltOn2:	cmp.b	#$e4,d2
		bne.s	NII_AltOff2
		bclr	#1,AltMode
		bra	NII_Ex
NII_AltOff2:	cmp.b	#$61,d2
		bne.s	NII_ShiftOn1
		bset	#0,ShiftMode
		bra	NII_Ex
NII_ShiftOn1:	cmp.b	#$e1,d2
		bne.s	NII_ShiftOff1
		bclr	#0,ShiftMode
		bra	NII_Ex
NII_ShiftOff1:	cmp.b	#$60,d2
		bne.s	NII_ShiftOn2
		bset	#1,ShiftMode
		bra	NII_Ex
NII_ShiftOn2:	cmp.b	#$e0,d2
		bne.s	NII_ShiftOff2
		bclr	#1,ShiftMode
		bra	NII_Ex
NII_ShiftOff2:	cmp.b	#$4f,d2
		bne.s	NII_LeftOn
		move.w	#-1,CursorKeyX
		bra	NII_Ex
NII_LeftOn:	cmp.b	#$cf,d2
		bne.s	NII_LeftOff
		tst.w	CursorKeyX
		bpl	NII_Ex
		clr.w	CursorKeyX
		bra	NII_Ex
NII_LeftOff:	cmp.b	#$4e,d2
		bne.s	NII_RightOn
		move.w	#1,CursorKeyX
		bra	NII_Ex
NII_RightOn:	cmp.b	#$ce,d2
		bne.s	NII_RightOff
		tst.w	CursorKeyX
		bmi	NII_Ex
		clr.w	CursorKeyX
		bra.L	NII_Ex
NII_RightOff:	cmp.b	#$4c,d2
		bne.s	NII_UpOn
		move.w	#-1,CursorKeyY
		bra.w	NII_Ex
NII_UpOn:	cmp.b	#$cc,d2
		bne.s	NII_UpOff
		tst.w	CursorKeyY
		bpl.w	NII_Ex
		clr.w	CursorKeyY
		bra.w	NII_Ex
NII_UpOff:	cmp.b	#$4d,d2
		bne.s	NII_DownOn
		move.w	#1,CursorKeyY
		bra.w	NII_Ex
NII_DownOn:	cmp.b	#$cd,d2
		bne.s	NII_DownOff
		tst.w	CursorKeyY
		bmi.w	NII_Ex
		clr.w	CursorKeyY
		bra.w	NII_Ex
NII_DownOff:
		cmp.b	#$66,d2
		bne.s	.NII_Lbutton
		move.w	#1,LeftAmiga
		bra.w	NII_Ex
.NII_Lbutton:	cmp.b	#$e6,d2
		bne.s	.NII_NoLbutton
		clr.w	LeftAmiga
		bra.w	NII_Ex
.NII_NoLbutton:
		cmp.b	#$67,d2
		bne.s	.NII_Rbutton
		move.w	#1,RightAmiga
		bra.w	NII_Ex
.NII_Rbutton:	cmp.b	#$e7,d2
		bne.s	.NII_NoRbutton
		clr.w	RightAmiga
		bra.s	NII_Ex
.NII_NoRbutton:
	cmp.b	#$5f,d2
	bne.s	.nohelp
	tst.w	AnotherCopper
	bne.s	.nohep
	move.l	#HelpCop,$dff080
	move.w	#2,AnotherCopper
	bra.s	NII_Ex
.nohep:	cmp.w	#2,AnotherCopper
	bne.s	.nohelp
	move.l	#cop,$dff080
	clr.w	AnotherCopper
	clr.w	ActKey
	bra.s	NII_Ex

.nohelp:	btst	#7,d2
		bne.s	NII_UpKey
		move.w	d2,ActKey
	move.l	a0,-(a7)
	bsr	NIIPacMan
	bsr	NIIMahoney
	bsr	NIIKaktus
	bsr	NIIHelene
	bsr	NIIFuck
	bsr	NIIHallonsoft
	bsr	NIIlove
	bsr.s	NIItrain
	bsr.s	NIIgul
	move.l	(a7)+,a0
NII_UpKey:	move.w	d2,AllKey
NII_Ex:		move.w	#$8,$dff09c
		movem.l	(a7)+,d0-d2
		rte

ActKey:		dc.w	0
AllKey:		dc.w	0
AltMode:	dc.w	0
ShiftMode:	dc.w	0
CursorKeyX:	dc.w	0
CursorKeyY:	dc.w	0
LeftAmiga:	dc.w	0
RightAmiga:	dc.w	0

NIItpoi:dc.l	NIItdat
NIItdat:dc.b	$14,$13,$20,$17,$36,$ff
NIItrain:move.l	NIItpoi(pc),a0
	cmp.b	(a0)+,d2
	beq.s	NIIt2
	lea	NIItdat(pc),a0
NIIt2:	move.l	a0,NIItpoi
	tst.b	(a0)
	bpl.s	NIIt1
	move.w	#1,traingo
	move.l	#NIItdat,NIItpoi
NIIt1:	rts

NIIgpoi:dc.l	NIIgdat
NIIgdat:dc.b	$24,$16,$28,$ff
NIIgul:	move.l	NIIgpoi(pc),a0
	cmp.b	(a0)+,d2
	beq.s	NIIg2
	lea	NIIgdat(pc),a0
NIIg2:	move.l	a0,NIIgpoi
	tst.b	(a0)
	bpl.s	NIIg1
	cmp.w	#plotcol,mk_col1+2
	bne.s	.no
	move.w	#$cc0,mk_col1+2
	move.w	#$cc0,mk_col2+2
.no:	move.l	#NIIgdat,NIIgpoi
NIIg1:	rts

NIIlpoi:dc.l	NIIldat
NIIldat:dc.b	$28,$18,$34,$12,$ff,$ff
NIIlove:move.l	NIIlpoi(pc),a0
	cmp.b	(a0)+,d2
	beq.s	NIIl2
	lea	NIIldat(pc),a0
NIIl2:	move.l	a0,NIIlpoi
	tst.b	(a0)
	bpl.s	NIIl1
	move.w	#1,bu_golove
	move.l	#NIIldat,NIIlpoi
NIIl1:	rts

NIIhpoi:dc.l	NIIhdat
NIIhdat:dc.b	$25,$20,$28,$28,$18,$36,$21,$18,$23,$14,$ff,$ff
NIIhallonsoft:
	move.l	NIIhpoi(pc),a0
	cmp.b	(a0)+,d2
	beq.s	NIIh2
	lea	NIIhdat(pc),a0
NIIh2:	move.l	a0,NIIhpoi
	tst.b	(a0)
	bpl.s	NIIh1
	move.l	#HallonCop,$dff080
	move.w	#1,AnotherCopper
	clr.w	ActKey
	move.l	#NIIhdat,NIIhpoi
NIIh1:	rts

NIIfpoi:dc.l	NIIfdat
NIIfdat:dc.b	$23,$16,$33,$27,$ff,$ff
NIIfuck:move.l	NIIfpoi(pc),a0
	cmp.b	(a0)+,d2
	beq.s	.NIIf2
	lea	NIIfdat(pc),a0
.NIIf2:	move.l	a0,NIIfpoi
	tst.b	(a0)
	bpl.s	.NIIf1
	move.l	#Digispr,Digipic
	move.l	#fucktxt,digitxt
	move.w	#$9c7,fucktxtcols+2+$8
	addq.w	#1,Digigo
	clr.w	ActKey
	move.l	#NIIfdat,NIIfpoi
.NIIf1:	rts

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	#Digispr2,Digipic
	move.l	#Helenetxt,Digitxt
	move.w	#$cc2,fucktxtcols+2
	move.w	#$bb2,fucktxtcols+2+$8
	move.w	#$aa2,fucktxtcols+2+$10
	move.w	#$a8f,fucktxtcols+2+$18
	addq.w	#1,Digigo
	clr.w	ActKey
	move.l	#NIImdat,NIImpoi
.NIIm1:	rts

NIIkpoi:dc.l	NIIkdat
NIIkdat:dc.b	$27,$20,$27,$14,$16,$21,$ff,$ff
NIIKaktus:
	move.l	NIIkpoi(pc),a0
	cmp.b	(a0)+,d2
	beq.s	.NIIk2
	lea	NIIkdat(pc),a0
.NIIk2:	move.l	a0,NIIkpoi
	tst.b	(a0)
	bpl.s	.NIIk1
	move.l	#Digispr3,Digipic
	move.l	#Kaktustxt,Digitxt
	move.w	#$a4a,fucktxtcols+2+$8
	move.w	#$4c4,fucktxtcols+2+$10
	addq.w	#1,Digigo
	clr.w	ActKey
	move.l	#NIIkdat,NIIkpoi
.NIIk1:	rts

NIIzpoi:dc.l	NIIzdat
NIIzdat:dc.b	$37,$20,$25,$18,$36,$12,$15,$ff
NIIMahoney:
	move.l	NIIzpoi(pc),a0
	cmp.b	(a0)+,d2
	beq.s	.NIIz2
	lea	NIIzdat(pc),a0
.NIIz2:	move.l	a0,NIIzpoi
	tst.b	(a0)
	bpl.s	.NIIz1
	move.l	#Digispr4,Digipic
	move.l	#Mahoneytxt,Digitxt
	move.w	#$ccc,fucktxtcols+2
	move.w	#$ddb,fucktxtcols+2+$8
	move.w	#$eea,fucktxtcols+2+$10
	move.w	#$ff9,fucktxtcols+2+$18
	addq.w	#1,Digigo
	clr.w	ActKey
	move.l	#NIIzdat,NIIzpoi
.NIIz1:	rts

NIIppoi:dc.l	NIIpdat
NIIpdat:dc.b	$19,$20,$33,$37,$20,$36,$ff,$ff
NIIPacMan:
	move.l	NIIppoi(pc),a0
	cmp.b	(a0)+,d2
	beq.s	.NIIp2
	lea	NIIpdat(pc),a0
.NIIp2:	move.l	a0,NIIppoi
	tst.b	(a0)
	bpl.s	.NIIp1
	move.w	#$fffe,SpokeGo
	clr.w	ActKey
	move.l	#NIIpdat,NIIppoi
.NIIp1:	rts

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

Digigo:		dc.w	0
Digipic:	dc.l	Digispr

Digi_rut:
	tst.w	digigo
	beq	rts

	lea	$dff000,a6
.ba_bltw:btst	#14,$02(a6)
	bne.s	.ba_bltw
	move.l	#barnbpl,$54(a6)
	clr.l	$66(a6)
	move.l	#$01000000,$40(a6)
	move.w	#[$24*$40]+[44/2],$58(a6)

	move.l	Digipic(pc),d0
	move.l	d0,a1
	lea	.di_0(pc),a0
	swap	d0
	move.w	d0,.di_0+2-.di_0(a0)
	move.w	d0,.di_1+2-.di_0(a0)
	move.w	d0,.di_2+2-.di_0(a0)
	move.w	d0,.di_3+2-.di_0(a0)
	move.w	d0,.di_4+2-.di_0(a0)
	move.w	d0,.di_5+2-.di_0(a0)
	move.w	d0,.di_6+2-.di_0(a0)
	move.w	d0,.di_7+2-.di_0(a0)
	swap	d0
	move.w	d0,.di_0+6-.di_0(a0)
	add.w	#[95*4]+8,d0
	move.w	d0,.di_1+6-.di_0(a0)
	add.w	#[95*4]+8,d0
	move.w	d0,.di_2+6-.di_0(a0)
	add.w	#[95*4]+8,d0
	move.w	d0,.di_3+6-.di_0(a0)
	add.w	#[95*4]+8,d0
	move.w	d0,.di_4+6-.di_0(a0)
	add.w	#[95*4]+8,d0
	move.w	d0,.di_5+6-.di_0(a0)
	add.w	#[95*4]+8,d0
	move.w	d0,.di_6+6-.di_0(a0)
	add.w	#[95*4]+8,d0
	move.w	d0,.di_7+6-.di_0(a0)
	clr.w	digigo
	move.l	#$40809f00,d0
	move.l	d0,d1
	add.l	#$00000080,d1
	move.l	a1,a0
	move.l	d0,(a0)
	move.l	d1,[97*4](a0)
	add.l	#$00080000,d0
	add.l	#$00080000,d1
	move.l	d0,[97*4]*2(a0)
	move.l	d1,[97*4]*3(a0)
	add.l	#$00080000,d0
	add.l	#$00080000,d1
	move.l	d0,[97*4]*4(a0)
	move.l	d1,[97*4]*5(a0)
	add.l	#$00080000,d0
	add.l	#$00080000,d1
	move.l	d0,[97*4]*6(a0)
	move.l	d1,[97*4]*7(a0)

	move.l	ba_textoldpoi(pc),DigioldPoi
	move.l	digitxt(pc),a1
	move.l	a1,ba_textpoi

	move.w	#75,ba_newcou
	move.w	#$0,ba_wegcou
	clr.l	ba_bplpoi

	clr.w	mahcol+2
	clr.w	kakcol+2
	clr.w	mahkakcou

	move.l	#.DigiCop,$dff080
	move.w	#1,digiback
	move.w	#1,AnotherCopper
	rts

.DigiCop:
 dc.w $100,$1200,$104,$0000,$108,-42,$102,$0000
 dc.w $08e,$2071,$090,$38c7,$092,$0038,$094,$00d8
 dc.w $180,$0,$182,$800
	dc.w $0e0,dummy/$10000,$0e2,dummy&$ffff
.di_0:	dc.w $120,dummy/$10000,$122,dummy&$ffff
.di_1:	dc.w $124,dummy/$10000,$126,dummy&$ffff
.di_2:	dc.w $128,dummy/$10000,$12a,dummy&$ffff
.di_3:	dc.w $12c,dummy/$10000,$12e,dummy&$ffff
.di_4:	dc.w $130,dummy/$10000,$132,dummy&$ffff
.di_5:	dc.w $134,dummy/$10000,$136,dummy&$ffff
.di_6:	dc.w $138,dummy/$10000,$13a,dummy&$ffff
.di_7:	dc.w $13c,dummy/$10000,$13e,dummy&$ffff

.c=$111
 dc.w $1a0,$0*.c,$1a2,$8*.c,$1a4,$4*.c,$1a6,$c*.c
 dc.w $1a8,$2*.c,$1aa,$a*.c,$1ac,$6*.c,$1ae,$e*.c
 dc.w $1b0,$1*.c,$1b2,$9*.c,$1b4,$5*.c,$1b6,$d*.c
 dc.w $1b8,$3*.c,$1ba,$b*.c,$1bc,$7*.c,$1be,$f*.c


	dc.w $ae01,$fffe,$0100,$0000
	dc.w $e0,MKbobR/$10000,$e2,MKbobR&$ffff
mahcol:	dc.w $0182,$000,$0108,$0000
	dc.w $008e,$b071,$0090,$ccc7,$0092,$0050,$0094,$00a8

	dc.w $b007,$fffe,$0100,$1200

	dc.w $d007,$fffe
	dc.w  $0e0,barnbpl/$10000,$0e2,barnbpl&$ffff
	dc.w $008e,$d171,$0090,$f5c7,$0092,$0030,$0094,$00d8

fucktxtcols:
	dc.w $182,$000,$da07,$fffe
	dc.w $182,$000,$e307,$fffe
	dc.w $182,$000,$ec07,$fffe
	dc.w $182,$000

	dc.w $f701,$fffe,$0100,$0000
	dc.w $e0,[MKbobR+$2a0]/$10000,$e2,[MKbobR+$2a0]&$ffff
kakcol:	dc.w $0182,$000
	dc.w $008e,$f971,$0090,$14c7,$0092,$0070,$0094,$00c8

	dc.w $e007,$fffe,$0100,$1200
	dc.l	-2

digioldpoi:	dc.l	0
digiback:	dc.w	0
mahkakcou:	dc.w	0

Digitxt:	dc.l	0

fucktxt:
 dc.b " ",0
 dc.b "Come on handsome, $300 and you'll get a night to remember.",0
 dc.b " ",0
 dc.b " ",0,$ff

spoketxt:
 dc.b "Now hear what your grandmother says:",0
 dc.b '"Dont you stay up late: at midnight, when all slimy',0
 dc.b "creatures creep up floating through your room, there shall",0
 dc.b 'be trouble. I can feel that the ghosts will come tonight."',0,$ff

Helenetxt:
 dc.b "This musicdisk is dedicated to the girl of my heart,",0
 dc.b "Helene, to whom I wish to send my dearest and highest",0
 dc.b "thoughts and dreams. I love you Helene ...",0
 dc.b 15," K|rleken krossas av smulor i s|ngen ",15,0,$ff

Kaktustxt:
 dc.b " ",0
 dc.b "Nothing is ever so bad it can't get worse ...",0
 dc.b "Kaktus is here, creeping around in your memory!",0
 dc.b " ",0,$ff

Mahoneytxt:
 dc.b "------",0
 dc.b "The mastergoat himself, Mahoney ...",0
 dc.b "----",0
 dc.b "---",0,$ff
 even

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

barn_init:
	lea	barnbpl,a0
	moveq	#$23,d7
	moveq	#0,d0
.ba:	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	dbf	d7,.ba
	rts

ba_bplpoi:	dc.l	0
ba_textpoi:	dc.l	Engelska
ba_textoldpoi:	dc.l	0
ba_bplsidpos:	dc.w	0
ba_radcou:	dc.w	0
ba_wegcou:	dc.w	0
ba_newcou:	dc.w	1
ba_hogvans:	dc.w	0

ba_restartpoi:	dc.l	Engelska
pbac:	dc.w	0

barn_rut:
	move.l	ba_textpoi(pc),a1
	subq.w	#1,ba_newcou
	bne.w	ba_nonew

ba_new:	move.w	#20*50,ba_newcou	;20 sek på varje ordspråk
	tst.l	ba_bplpoi
	bne.w	ba_nonew
	tst.w	pbac
	bne.s	.t
	move.w	#$48,ba_wegcou
	eor.w	#1,ba_hogvans
.t:	clr.w	pbac

	tst.w	digiback
	beq.s	.nodigi
	move.w	#1,ba_wegcou
	move.w	#$ffff,ba_newcou

.nodigi:cmp.b	#$ff,(a1)
	bne.s	ba_nowrap
	move.l	ba_restartpoi(pc),a1
	move.l	a1,ba_textpoi
ba_nowrap:
	move.l	a1,ba_textoldpoi
	move.l	#barnbpl,ba_bplpoi
	clr.w	ba_radcou
	moveq	#0,d0
	moveq	#0,d1
	lea	sfontbredds(pc),a0
	move.l	a1,a2
c2enterloop:
	move.b	(a2)+,d1
	beq.s	c2enterend
	move.b	(a0,d1.w),d1
	add.w	d1,d0
	bra.s	c2enterloop
c2enterend:
	move.w	#$ac,d1
	lsr.w	#1,d0
	sub.w	d0,d1
	move.w	d1,ba_bplsidpos
	rts

ba_nonew:
	move.w	ba_wegcou(pc),d0
	beq	ba_noweg

	tst.w	ba_hogvans
	beq.s	.ba_gohoger
	lea	$dff000,a6
.ba_bltw:btst	#14,$02(a6)
	bne.s	.ba_bltw
	move.l	#barnbpl+2,$50(a6)
	move.l	#barnbpl,$54(a6)
	move.l	#$ffff07ff,$44(a6)
	move.l	#$00000000,$64(a6)
	move.l	#$b9f00000,$40(a6)
	move.w	#[$24*$40]+[44/2],$58(a6)
	subq.w	#1,ba_wegcou
	bra	ba_rts

.ba_gohoger:
	lea	$dff000,a6
.ba_blhw:btst	#14,$02(a6)
	bne.s	.ba_blhw
	move.l	#barnbpl,$50(a6)
	move.l	#barnbpl,$54(a6)
	move.l	#$ffffffe0,$44(a6)
	move.l	#$00000000,$64(a6)
	move.l	#$59f00000,$40(a6)
	move.w	#[$24*$40]+[44/2],$58(a6)

	subq.w	#1,ba_wegcou
	bra.L	ba_rts

ba_noweg:
	tst.l	ba_bplpoi
	beq	ba_rts

	moveq	#0,d0
ba_getnext:
	move.b	(a1)+,d0
	bne.s	ba_nonewrad
	addq.w	#1,ba_radcou
	cmp.w	#4,ba_radcou
	bne.s	ba_noend
	clr.l	ba_bplpoi
	move.l	a1,ba_textoldpoi
	bra	ba_exit
ba_noend:
	add.l	#44*9,ba_bplpoi
	moveq	#0,d0
	moveq	#0,d1
	lea	sfontbredds(pc),a0
	move.l	a1,a2
centerloop:
	move.b	(a2)+,d1
	beq.s	centerend
	move.b	(a0,d1.w),d1
	add.w	d1,d0
	bra.s	centerloop
centerend:
	move.w	#$ac,d1
	lsr.w	#1,d0
	sub.w	d0,d1
	move.w	d1,ba_bplsidpos

	bra.s	ba_getnext
ba_nonewrad:

	lea	SfontR,a0
	move.w	d0,d1
	and.w	#$1f,d0
	and.w	#$60,d1
	asl.w	#3,d1
	add.w	d1,d0
	lea	(a0,d0.w),a0

	move.l	ba_bplpoi(pc),a2
	move.w	ba_bplsidpos(pc),d0
	move.w	d0,d1
	and.w	#$7,d0
	lsr.w	#3,d1
	lea	(a2,d1.w),a2

	eor.w	#$7,d0

	moveq	#7,d7
ba_chlop:
	moveq	#0,d1
	move.b	(a0),d1
	asl.w	d0,d1
	or.b	d1,1(a2)
	lsr.w	#8,d1
	or.b	d1,(a2)
	lea	$20(a0),a0
	lea	44(a2),a2
	dbf	d7,ba_chlop

	moveq	#0,d0
	move.b	-1(a1),d0
	lea	Sfontbredds(pc),a2
	move.b	(a2,d0.w),d0
	add.w	d0,ba_bplsidpos

ba_exit:move.l	a1,ba_textpoi
ba_rts:	rts

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

bpl=PlotBpl+$10

mk_fas:	dc.w	4	;0-init 1-wait 2-exit 3-exit andra 4-pl_rut
mk_fascou:	dc.w	$7c
mk_exitnow:	dc.w	0
mk_moldpos:	dc.l	0
mk_koldpos:	dc.l	0
mk_mpos:	dc.w	0
mk_kpos:	dc.w	0

mk_rut:	lea	$dff000,a6
	cmp.w	#$ec,pe_ypos
	bge.L	mk_noexitnow
	cmp.w	#$d8,pe_xpos
	bgt.s	mk_nom
	cmp.w	#$7f,pe_xpos
	blt.s	mk_nom
	cmp.w	#$da,pe_ypos
	bgt.s	mk_nom
	cmp.w	#$2d,pe_ypos
	bge.s	mk_noexitnow
mk_nom:	move.w	#1,mk_exitnow
	bra.s	mk_1
mk_noexitnow:
	clr.w	mk_exitnow

mk_1:	lea	sin255,a0
	move.w	mk_fascou(pc),d1
	move.w	mk_fas(pc),d0
	bne.s	mk_fas1

	move.b	(a0,d1.w),d0
	add.b	#$50,d0
	addq.b	#1,d1
	cmp.w	#$c3,d1
	bne.L	mk_setpos
	tst.w	mk_exitnow
	beq.s	mk_gofas1
	move.w	#2,mk_fas
	bra.L	mk_setpos
mk_gofas1:
	move.w	#1,mk_fas
	bra.L	mk_setpos
mk_fas1:
	subq.w	#1,d0
	bne.s	mk_fas2
	move.b	(a0,d1.w),d0
	lsr.b	#2,d0
	add.b	#$51,d0
	addq.b	#2,d1

	tst.w	mk_exitnow
	beq.L	mk_setpos
	cmp.w	#$c3,d1
	bne.s	mk_kolla3
	move.w	#2,mk_fas
	bra.L	mk_setpos
mk_kolla3:
	cmp.w	#$3d,d1
	bne.L	mk_setpos
	move.w	#3,mk_fas
	bra.L	mk_setpos

mk_fas2:subq.w	#1,d0
	bne.s	mk_fas3
	move.b	(a0,d1.w),d0
	add.b	#$50,d0
	addq.b	#1,d1
	cmp.w	#$08,d1
	bne.L	mk_setpos
	move.w	#4,mk_fas
	move.w	#plotcol,mk_col1+2
	move.w	#plotcol,mk_col2+2
	addq.w	#1,pl_newdotrutno
	cmp.w	#9,pl_newdotrutno
	bne.s	mk_oker
	clr.w	pl_newdotrutno
mk_oker:clr.w	mk_exitnow
	bra.s	mk_setpos

mk_fas3:subq.w	#1,d0
	bne	pl_rut
	move.b	(a0,d1.w),d0
	add.b	#$50+$41,d0
	addq.b	#1,d1
	cmp.w	#$88,d1
	bne.s	mk_setpos
	move.w	#4,mk_fas
	move.w	#plotcol,mk_col1+2
	move.w	#plotcol,mk_col2+2
	addq.w	#1,pl_newdotrutno
	cmp.w	#9,pl_newdotrutno
	bne.s	mk_oker
	clr.w	pl_newdotrutno
	clr.w	mk_exitnow

mk_setpos:
	move.w	d1,mk_fascou
	and.w	#$ff,d0
	move.w	d0,mk_mpos
	move.w	#$e2,d1
	sub.b	d0,d1
	move.w	d1,mk_kpos

	move.l	mk_moldpos(pc),d0
	beq.s	mk_nosudd
mk_w2it:btst	#14,$02(a6)
	bne.s	mk_w2it
	move.l	d0,$54(a6)
	move.l	#$01000000,$40(a6)
	move.w	#$0014,$66(a6)
	move.w	#[28*$40]+[192/16],$58(a6)
mk_nosudd:
	move.l	mk_koldpos(pc),d0
	beq.s	mk_knosudd
mk_w5it:btst	#14,$02(a6)
	bne.s	mk_w5it
	move.l	d0,$54(a6)
	move.l	#$01000000,$40(a6)
	move.w	#$0014,$66(a6)
	move.w	#[27*$40]+[192/16],$58(a6)
mk_knosudd:

	clr.l	mk_moldpos
	move.w	mk_mpos(pc),d0
	beq	mk_cont
	cmp.w	#$c6,d0
	bgt.s	mk_mplotnedre
	cmp.w	#$1b,d0
	blt	mk_mplotupper
	mulu	#44,d0
	lea	bpl-[27*44],a0
	lea	(a0,d0.w),a0

mk_wait:btst	#14,$02(a6)
	bne.s	mk_wait
	move.l	#MKbobR,$50(a6)
	move.l	a0,$54(a6)
	move.l	#-1,$44(a6)
	move.l	#$09f00000,$40(a6)
	move.l	#$00000014,$64(a6)
	move.w	#[28*$40]+[192/16],$58(a6)
	move.l	a0,mk_moldpos
	bra.L	mk_cont
mk_mplotnedre:
	move.w	#$e2,d1
	sub.w	d0,d1
	bmi.L	mk_cont
	beq.L	mk_cont
	mulu	#44,d0
	lea	bpl-[27*44],a0
	lea	(a0,d0.w),a0
	asl.w	#6,d1
	or.w	#192/16,d1
mk_w3it:btst	#14,$02(a6)
	bne.s	mk_w3it
	move.l	#MKbobR,$50(a6)
	move.l	a0,$54(a6)
	move.l	#-1,$44(a6)
	move.l	#$09f00000,$40(a6)
	move.l	#$00000014,$64(a6)
	move.w	d1,$58(a6)
	move.l	#bpl-[27*44]+[$c6*44],mk_moldpos
	bra.s	mk_cont

mk_mplotupper:
	move.w	#$1b,d1
	sub.w	d0,d1
	mulu	#192/8,d1
	lea	MKbobR,a0
	lea	(a0,d1.w),a0
	asl.w	#6,d0
	or.w	#192/16,d0
mk_w4it:btst	#14,$02(a6)
	bne.s	mk_w4it
	move.l	a0,$50(a6)
	move.l	#bpl,$54(a6)
	move.l	#-1,$44(a6)
	move.l	#$09f00000,$40(a6)
	move.l	#$00000014,$64(a6)
	move.w	d0,$58(a6)
	move.l	#bpl,mk_moldpos
	bra.w	mk_cont


mk_cont:clr.l	mk_koldpos
	move.w	mk_kpos(pc),d0
	beq	mk_cont2
	cmp.w	#$c7,d0
	bgt.s	mk_kplotnedre
	cmp.w	#$1b,d0
	blt	mk_kplotupper
	mulu	#44,d0
	lea	bpl-[27*44],a0
	lea	(a0,d0.w),a0

mk_kait:btst	#14,$02(a6)
	bne.s	mk_kait
	move.l	#MKbobR+[28*192/8],$50(a6)
	move.l	a0,$54(a6)
	move.l	a0,$4c(a6)
	move.l	#-1,$44(a6)
	move.l	#$0dfc0000,$40(a6)
	move.w	#$0014,$62(a6)
	move.l	#$00000014,$64(a6)
	move.w	#[27*$40]+[192/16],$58(a6)
	move.l	a0,mk_koldpos
	bra	mk_cont2
mk_kplotnedre:
	move.w	#$e2,d1
	sub.w	d0,d1
	bmi	mk_cont2
	beq	mk_cont2
	mulu	#44,d0
	lea	bpl-[27*44],a0
	lea	(a0,d0.w),a0
	asl.w	#6,d1
	or.w	#192/16,d1
mk_k3it:btst	#14,$02(a6)
	bne.s	mk_k3it
	move.l	#MKbobR+[28*192/8],$50(a6)
	move.l	a0,$54(a6)
	move.l	#-1,$44(a6)
	move.l	#$09f00000,$40(a6)
	move.l	#$00000014,$64(a6)
	move.w	d1,$58(a6)
	move.l	#bpl-[27*44]+[$c7*44],mk_koldpos
	bra.s	mk_cont2

mk_kplotupper:
	move.w	#$1b,d1
	sub.w	d0,d1
	mulu	#192/8,d1
	lea	MKbobR+[28*192/8],a0
	lea	(a0,d1.w),a0
	asl.w	#6,d0
	or.w	#192/16,d0
mk_k4it:btst	#14,$02(a6)
	bne.s	mk_k4it
	move.l	a0,$50(a6)
	move.l	#bpl,$54(a6)
	move.l	#-1,$44(a6)
	move.l	#$09f00000,$40(a6)
	move.l	#$00000014,$64(a6)
	move.w	d0,$58(a6)
	move.l	#bpl,mk_koldpos
mk_cont2:
	rts

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

plot_init:
	lea	plotbpl,a0
	move.w	#$8,d7
	moveq	#0,d0
pl_ilo:	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	dbf	d7,pl_ilo
	move.w	#$ab,d7
	moveq	#0,d0
pl_illo:move.l	#$ffff,(a0)+
	move.l	#$ffffffff,(a0)+
	move.l	#$ffffffff,(a0)+
	move.l	#$ff000000,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	dbf	d7,pl_illo
	move.w	#$12,d7
	moveq	#0,d0
pl_iluo:move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	dbf	d7,pl_iluo
	rts

pl_newdotrutno:	dc.w	0
pl_newdotrutpois:
	dc.l	pl_rnd
	dc.l	pl_cycle1,pl_onlyx,pl_mousespd,pl_cycle2
	dc.l	pl_zero,pl_cyclernd,pl_cycle3,pl_starfield

pl_sty:	dc.l	0
pl_stx:	dc.l	0

pl_starfield:
	move.l	pl_stx(pc),d1
	add.l	svj_xspd(pc),d1
	asr.l	#8,d1
	asr.l	#4,d1
	move.w	rnd+4(pc),d0
	ext.w	d0
	asr.w	#$3,d0
	add.w	d0,d1
	move.w	d1,2(a0)
	move.l	pl_sty(pc),d2
	add.l	svj_yspd(pc),d2
	neg.l	d2
	asr.l	#8,d2
	asr.l	#4,d2
	move.w	rnd+6(pc),d0
	ext.w	d0
	asr.w	#$3,d0
	add.w	d0,d2
	move.w	d2,6(a0)
	move.w	#1,pl_newdotwait
	rts

pl_mousespd:
	move.l	pe_xspd(pc),d1
	asr.l	#8,d1
	asr.l	#3,d1
	move.w	d1,2(a0)
	move.l	pe_yspd(pc),d2
	asr.l	#8,d2
	asr.l	#3,d2
	move.w	d2,6(a0)
	move.w	#1,pl_newdotwait
	rts


pl_cyclernd:
	subq.b	#1,pl_cyclecou	
	lea	sin255,a1
	moveq	#0,d0
	move.b	pl_cyclecou(pc),d0
	move.b	(a1,d0.w),d1
	add.b	#$40,d0
	move.b	(a1,d0.w),d2
	 sub.b	#$80,d1
	 ext.w	d1
	 move.w	rnd+4(pc),d0
	 and.w	#$7f,d0
	 add.w	#$1c,d0
	 muls	d0,d1
	 asr.w	#$8,d1
	 move.w	d1,2(a0)
	 sub.b	#$80,d2
	 ext.w	d2
	 muls	d0,d2
	 asr.w	#$8,d2
	 move.w	d2,6(a0)
	move.w	#1,pl_newdotwait
	rts

pl_rnd:	move.w	rnd+6(pc),d0
	and.w	#$3f,d0
	sub.w	#$20,d0
	move.w	d0,2(a0)
	move.w	rnd+2(pc),d0
	and.w	#$3f,d0
	sub.w	#$20,d0
	move.w	d0,6(a0)
	move.w	#1,pl_newdotwait
	rts



pl_zoldxy:	dc.l	0,0
pl_zero:movem.l	pl_zoldxy,d0-d1
	cmp.l	pe_xpos,d0
	bne.s	pl_znew
	cmp.l	pe_ypos,d1
	beq.s	pl_znnew
pl_znew:move.w	#1,pl_newdotwait
	move.l	pe_xpos,pl_zoldxy
	move.l	pe_ypos,pl_zoldxy+4
pl_znnew:
	subq.w	#1,pl_newdotwait
	bne	pl_nonewdot
	move.w	#9,pl_newdotwait
	move.w	pl_newdot(pc),d0
	add.w	#40,d0
	cmp.w	#40*dots,d0
	bne.s	pl_2thisdotok
	clr.w	d0
pl_2thisdotok:
	move.w	d0,pl_newdot
	lea	pl_list,a0
	lea	(a0,d0.w),a0
	move.l	pe_xpos(pc),d0
	sub.l	#$700000,d0
	lsr.l	#8,d0
	lsr.l	#3,d0
	move.w	d0,(a0)
	move.l	pe_ypos(pc),d0
	sub.l	#$250000,d0
	lsr.l	#8,d0
	lsr.l	#3,d0
	move.w	d0,4(a0)
	move.w	#-$10,2(a0)
	clr.w	6(a0)
	bra	pl_nonewdot


pl_onlyx:
	move.w	rnd+6(pc),d0
	and.w	#$3f,d0
	sub.w	#$20,d0
	move.w	d0,2(a0)
	move.w	#-$20,6(a0)
	move.w	#4,pl_newdotwait
	rts

pl_cyclecou:	dc.b	0
		dc.b	0
pl_cycle3:
	add.b	#$55,pl_cyclecou
	lea	sin255,a1
	moveq	#0,d0
	move.b	pl_cyclecou(pc),d0
	move.b	(a1,d0.w),d1
	add.b	#$40,d0
	move.b	(a1,d0.w),d2
	 sub.b	#$80,d1
	 ext.w	d1
	 asr.w	#2,d1
	 move.w	d1,2(a0)
	 sub.b	#$80,d2
	 ext.w	d2
	 asr.w	#2,d2
	 move.w	d2,6(a0)
	move.w	#1,pl_newdotwait
	rts

pl_cycle2:
	add.b	#$7d,pl_cyclecou
	lea	sin255,a1
	moveq	#0,d0
	move.b	pl_cyclecou(pc),d0
	move.b	(a1,d0.w),d1
	add.b	#$40,d0
	move.b	(a1,d0.w),d2
	 sub.b	#$80,d1
	 ext.w	d1
	 asr.w	#2,d1
	 move.w	d1,2(a0)
	 sub.b	#$80,d2
	 ext.w	d2
	 asr.w	#2,d2
	 move.w	d2,6(a0)
	move.w	#1,pl_newdotwait
	rts

pl_cycle1:
	addq.b	#7,pl_cyclecou	
	lea	sin255,a1
	moveq	#0,d0
	move.b	pl_cyclecou(pc),d0
	move.b	(a1,d0.w),d1
	add.b	#$40,d0
	move.b	(a1,d0.w),d2
	 sub.b	#$80,d1
	 ext.w	d1
	 asr.w	#2,d1
	 move.w	d1,2(a0)
	 sub.b	#$80,d2
	 ext.w	d2
	 asr.w	#2,d2
	 move.w	d2,6(a0)
	move.w	#1,pl_newdotwait
	rts

pl_newdotwait:	dc.w	1
pl_suddno:	dc.w	0
pl_newdot:	dc.w	0
mulu44:	blk.w	$c8,0

pl_rut:	cmp.w	#$ec,pe_ypos
	bge.L	pl_nonewdot
	cmp.w	#$d8,pe_xpos
	bgt.s	pl_nom
	cmp.w	#$7f,pe_xpos
	blt.s	pl_nom
	cmp.w	#$da,pe_ypos
	bgt.s	pl_nom
	cmp.w	#$2d,pe_ypos
	bge.s	pl_nonewdot

pl_nom:	cmp.w	#5,pl_newdotrutno
	beq	pl_zero
	subq.w	#1,pl_newdotwait
	bne.s	pl_nonewdot
	move.w	#9,pl_newdotwait
	move.w	pl_newdot(pc),d0
	add.w	#40,d0
	cmp.w	#40*dots,d0
	bne.s	pl_thisdotok
	clr.w	d0
pl_thisdotok:
	move.w	d0,pl_newdot
	lea	pl_list,a0
	lea	(a0,d0.w),a0

	lea	pl_newdotrutpois(pc),a1
	move.w	pl_newdotrutno(pc),d0
	asl.w	#2,d0
	move.l	(a1,d0.w),a1
	pea	pl_nonewdot
	move.l	pe_xpos(pc),d0
	sub.l	#$700000,d0
	lsr.l	#8,d0
	lsr.l	#3,d0
	move.w	d0,(a0)
	move.l	pe_ypos(pc),d0
	sub.l	#$250000,d0
	lsr.l	#8,d0
	lsr.l	#3,d0
	move.w	d0,4(a0)
	jmp	(a1)

pl_nonewdot:
	addq.w	#4,pl_suddno
	and.w	#$1c,pl_suddno

	lea	pl_list,a0
	lea	plotbpl,a1
	lea	mulu44(pc),a2
	move.w	#$1600*2,a3
	move.w	#$691*2,a4
	move.w	#$0f0*2,a5
	move.w	#$83*2,a6
	moveq	#40,d3
	move.w	#$c70*2,d4
	move.w	#$b50*2,d5
	move.w	pl_suddno(pc),d6
	moveq	#dots-1,d7
	clr.b	-2(a1)

pl_lop:	move.w	8(a0,d6.w),d0
	beq.s	pl_nosudd
	move.w	10(a0,d6.w),d1
	bclr	d1,(a1,d0.w)
pl_nosudd:
	move.w	(a0),d0
	beq	pl_next
	add.w	2(a0),d0

	move.b	d4,-2(a1)
	cmp.w	a3,d0	;#$1600*2
	bcs.s	pl_ok
	clr.w	(a0)
	bra	pl_next
pl_ok:
	move.w	4(a0),d1

	cmp.w	a4,d0	;#$690*2
	bge.s	pl_ejstudsx
	cmp.w	a5,d0	;#$0f1*2
	blt.s	pl_ejstudsx

	cmp.w	a6,d1	;#$83*2
	blt.s	pl_ejstudsxmenkollay
	cmp.w	d5,d1	;#$b50*2
	bge.s	pl_ejstudsxmenkollay
	neg.w	2(a0)
	add.w	2(a0),d0
	bra.s	pl_ejstudsx
pl_ejstudsxmenkollay:
	add.w	6(a0),d1
	cmp.w	a6,d1	;#$83*2
	blt.s	pl_ejstudsy
	cmp.w	d5,d1	;#$b50*2
	bge.s	pl_ejstudsy
	move.w	4(a0),d1
	neg.w	6(a0)
	bpl.s	pl_undersidstuds
	addq.w	#2,6(a0)
	bmi.s	pl_ejstudsy
	move.w	#-5,6(a0)
	bra.s	pl_ejstudsy
pl_ejstudsx:
	move.w	d0,(a0)
pl_nonewx:
	add.w	6(a0),d1
	bra.s	pl_conti
pl_undersidstuds:
	subq.w	#2,6(a0)
pl_ejstudsy:
	move.w	d0,(a0)

pl_conti:
	cmp.w	d4,d1	;#$c70*2
	bcs.s	pl_oky
	bmi.s	pl_takstuds
	neg.w	6(a0)
	addq.w	#8,6(a0)
	bmi.s	pl_next
	clr.w	(a0)
	bra.s	pl_next
pl_takstuds:
	neg.w	6(a0)
	bra.s	pl_next

pl_oky:
	move.w	d1,4(a0)
	addq.w	#1,6(a0)

	lsr.w	#5,d1
	lsr.w	#5,d0
	;mulu	#44,d1
	add.w	d1,d1
	move.w	(a2,d1.w),d1	;mulu44
	move.w	d0,d2
	lsr.w	#3,d0
	add.w	d0,d1
	move.w	d1,8(a0,d6.w)
	not.w	d2
	move.w	d2,10(a0,d6.w)
	bset	d2,(a1,d1.w)

pl_next:
	add.w	d3,a0	;#40
	dbf	d7,pl_lop
	tst.b	-2(a1)
	bne.s	pl_ne
	subq.w	#1,pl_necou
	bne.s	pl_ne2
	clr.w	mk_fas
	move.w	#$7c,mk_fascou
	move.w	#mk_col,mk_col1+2
	move.w	#mk_col,mk_col2+2
pl_ne:	move.w	#$80,pl_necou
pl_ne2:	clr.b	(a1)
	rts

pl_necou:	dc.w	$80
mk_col=$846
plotcol=$c11
dots=$40

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

rnd_init:
	move.w	$dff004,rnd
	move.w	$dff006,rnd+2
	move.w	$dff002,rnd+4
	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

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

text_init:
	lea	textbpl,a0
	moveq	#24,d7
	moveq	#0,d6
tx_3:	moveq	#8,d5
tx_4:	move.l	d6,(a0)+
	move.l	d6,(a0)+
	move.l	d6,(a0)+
	move.l	d6,(a0)+
	move.l	d6,(a0)+
	move.l	d6,(a0)+
	move.l	d6,(a0)+
	move.l	d6,(a0)+
	move.l	d6,(a0)+
	move.l	d6,(a0)+
	move.l	d6,(a0)+
	dbf	d5,tx_4
	dbf	d7,tx_3

	move.l	d6,(a0)+
	move.l	d6,(a0)+
	move.l	d6,(a0)+
	move.l	d6,(a0)+
	move.l	d6,(a0)+
	move.l	d6,(a0)+
	move.l	d6,(a0)+
	move.l	d6,(a0)+
	move.l	d6,(a0)+
	move.l	d6,(a0)+
	move.l	d6,(a0)+

	move.l	#TuneList,TextBase
	move.w	sr,-(a7)	;fungera bra med rte i slutet

pt_textinit:
	movem.l	d0-d7/a0-a6,-(a7)
	move.l	TextBase(pc),a0
	lea	TunePois,a1
	moveq	#0,d0
	moveq	#0,d1
pt_tilo:move.w	d0,(a1)+
	addq.w	#1,d1
pt_ti2:	addq.w	#1,d0
	tst.b	(a0,d0.w)
	bpl.s	pt_ti2
	addq.w	#1,d0
	tst.b	(a0,d0.w)
	bne.s	pt_tilo
	move.w	#0,(a1)+
	move.w	#0,(a1)+
	move.w	#0,(a1)+
	move.w	#0,(a1)+
	sub.w	#21,d1
	move.w	d1,AntalRader


	move.w	pt_TextRadNo(pc),d5
	subq.w	#1,d5
	add.w	d5,d5
	move.w	pt_listpos(pc),d6
	add.w	#24,d6
	moveq	#23,d7
text_lo:moveq	#0,d0
	move.w	d6,d0
	divu	#25,d0
	swap	d0
	mulu	#44*9,d0
	add.l	#textbpl+13+44,d0
	move.l	d0,pt_prbplpoi

	lea	TunePois,a1
	move.l	TextBase(pc),a0
	move.w	(a1,d5.w),d0
	lea	(a0,d0.w),a0
	move.l	a0,pt_prtextpoi
	move.l	#pt_back,-(a7)
	move.w	sr,-(a7)
	bra	PrintTextRow
pt_back:addq.w	#1,d6
	addq.w	#2,d5
	dbf	d7,text_lo

	cmp.l	#prefs,textbase
	bne.L	noprefsprint


	moveq	#0,d6
	move.w	pt_listpos(pc),d6
	add.w	#4,d6
	lea	Prefsvalues(pc),a1
	moveq	#$6,d7

valueloop:
	move.l	d6,d0
	divu	#25,d0
	swap	d0
	mulu	#44*9,d0
	add.l	#textbpl+13+44+[2*44]+12,d0
	move.l	d0,a0
	move.l	a0,a3

	move.w	(a1)+,d5
	move.w	d5,d4
	lsr.w	#3,d4
	bra.s	stapeldbf
stapelloop:

	move.b	#%11111111,(a0)+
	move.b	#%11110000,43(a0)
	move.b	#%11100001,87(a0)
	move.b	#%11000011,131(a0)
	move.b	#%10000111,175(a0)
	move.b	#%11111111,219(a0)
stapeldbf:
	dbf	d4,stapelloop

	and.w	#$7,d5
	lea	Prefsand(pc),a2
	move.b	(a2,d5.w),d0
	eor.w	#$7,d5

	move.b	#%11111111,d1
	and.b	d0,d1
	bset	d5,d1
	move.b	d1,(a0)+
	move.b	#%11110000,d1
	and.b	d0,d1
	bset	d5,d1
	move.b	d1,43(a0)
	move.b	#%11100001,d1
	and.b	d0,d1
	bset	d5,d1
	move.b	d1,87(a0)
	move.b	#%11000011,d1
	and.b	d0,d1
	bset	d5,d1
	move.b	d1,131(a0)
	move.b	#%10000111,d1
	and.b	d0,d1
	bset	d5,d1
	move.b	d1,175(a0)
	move.b	#%11111111,d1
	and.b	d0,d1
	bset	d5,d1
	move.b	d1,219(a0)

	moveq	#5,d5
gransloop:
	or.b	#$80,(a3)
	lea	44(a3),a3
	dbf	d5,gransloop

	addq.l	#1,d6
	dbf	d7,valueloop


	bsr	printprefsbarn
	bsr	printprefsfastmem

noprefsprint:
	movem.l	(a7)+,d0-d7/a0-a6
	clr.w	NewMenuPrintUnderArbete
	rte

printprefsbarn:
	moveq	#0,d6
	move.w	pt_listpos(pc),d6
	moveq	#0,d0
	moveq	#0,d1
	moveq	#0,d2
	tst.l	pba_engpoi
	bpl.s	.t
	moveq	#%00011111,d0
.t:	tst.l	pba_svepoi
	bpl.s	.u
	moveq	#%00011111,d1
.u:	tst.l	pba_barnpoi
	bpl.s	.v
	moveq	#%00011111,d2
.v:
	moveq	#0,d6
	move.w	pt_listpos(pc),d6
	add.w	#$d,d6
	divu	#25,d6
	swap	d6
	mulu	#44*9,d6
	add.l	#textbpl+14+[3*44],d6
	move.l	d6,a0
	move.b	d0,(a0)
	move.b	d0,44(a0)
	move.b	d0,44*2(a0)
	move.b	d0,44*3(a0)
	move.b	d0,44*4(a0)

	moveq	#0,d6
	move.w	pt_listpos(pc),d6
	add.w	#$e,d6
	divu	#25,d6
	swap	d6
	mulu	#44*9,d6
	add.l	#textbpl+14+[3*44],d6
	move.l	d6,a0
	move.b	d1,(a0)
	move.b	d1,44(a0)
	move.b	d1,44*2(a0)
	move.b	d1,44*3(a0)
	move.b	d1,44*4(a0)

	moveq	#0,d6
	move.w	pt_listpos(pc),d6
	add.w	#$f,d6
	divu	#25,d6
	swap	d6
	mulu	#44*9,d6
	add.l	#textbpl+14+[3*44],d6
	move.l	d6,a0
	move.b	d2,(a0)
	move.b	d2,44(a0)
	move.b	d2,44*2(a0)
	move.b	d2,44*3(a0)
	move.b	d2,44*4(a0)
	rts

printprefsfastmem:
	cmp.w	#4,menumode
	bne	pr_rts

	moveq	#0,d6
	move.w	pt_listpos(pc),d6
	moveq	#%0001111,d0
	moveq	#0,d1
	moveq	#0,d2

	cmp.w	#2,FastMemFlag
	bne.s	.u
	moveq	#0,d0
	moveq	#0,d1
	moveq	#%00011111,d2
.u:
	tst.w	loadwholedisk1
	bne.s	.a
	cmp.w	#1,FastMemFlag
	bne.s	.t
	move.w	#%0001111100011111,d1
	bra.s	.tte
.a:	move.w	#%0001000100011111,d1
.tte:	moveq	#0,d0
	moveq	#0,d2
.t:
	moveq	#0,d6
	move.w	pt_listpos(pc),d6
	add.w	#$12,d6
	divu	#25,d6
	swap	d6
	mulu	#44*9,d6
	add.l	#textbpl+14+[3*44],d6
	move.l	d6,a0
	move.b	d0,(a0)
	move.b	d0,44(a0)
	move.b	d0,44*2(a0)
	move.b	d0,44*3(a0)
	move.b	d0,44*4(a0)

	moveq	#0,d6
	move.w	pt_listpos(pc),d6
	add.w	#$13,d6
	divu	#25,d6
	swap	d6
	mulu	#44*9,d6
	add.l	#textbpl+14+[3*44],d6
	move.l	d6,a0
	move.b	d1,(a0)
	move.b	d1,44*4(a0)
	lsr.w	#8,d1
	move.b	d1,44(a0)
	move.b	d1,44*2(a0)
	move.b	d1,44*3(a0)

	moveq	#0,d6
	move.w	pt_listpos(pc),d6
	add.w	#$14,d6
	divu	#25,d6
	swap	d6
	mulu	#44*9,d6
	add.l	#textbpl+14+[3*44],d6
	move.l	d6,a0
	move.b	d2,(a0)
	move.b	d2,44(a0)
	move.b	d2,44*2(a0)
	move.b	d2,44*3(a0)
	move.b	d2,44*4(a0)
	rts

prefsand:	dc.b 0,$80,$c0,$e0,$f0,$f8,$fc,$fe

NewMenuPrintUnderArbete:	dc.w	0
AntalRader:	dc.w	0
TextBase:	dc.l	0	;(TuneList)
		dc.w	0	;tillhor nedan
pt_go:	dc.w	0
pt_cou:	dc.w	0
pt_TextRadNo:	dc.w	0
pt_listpos:	dc.w	0
pt_copinflytt:	dc.w	$0e6	;flyttar 1 lword till cop
pt_nyradpoi:	dc.w	0	;poi till raden som flyttas in

pt_textBases: dc.l TuneList,InstrText,GreetsText,AddrText,Prefs,FutureText
		dc.l TuneList,LoveText
pt_textPoses: dc.w 0,0,0,0,0,0,0,0

pt_selectedrad:	dc.w	1

pt_colbases:	dc.l pt_tunecols,pt_instrcols,pt_greetscols
		dc.l pt_addrcols,pt_prefscols,pt_futurecols
		dc.l pt_futurecols,pt_futurecols
pt_tunecols:
 dc.w $d50,$d50,$c60,$b71,$a82,$993,$8a4,$7b5,$6c6,$5d7,$4c8,$3b9,$2aa
 dc.w $19b,$08c,$07d,$06e,$05f,$04f,$03f,$02f,$01f,$00f,$00f
pt_instrcols:
 dc.w $008,$108,$208,$308,$408,$508,$608,$708,$818,$929,$a3a,$b4b
 dc.w $c5c,$d6d,$e7e,$f8f,$f9f,$faf,$fbf,$fcf,$fdf,$fef,$fff,$fff
pt_greetscols:
 dc.w $2dd,$3dd,$4dd,$5dd,$6dd,$7dd,$8dd,$9dd,$add,$bdd,$cdd,$ddd
 dc.w $ddc,$ddb,$dda,$dd9,$dd8,$dd7,$dd6,$dd5,$dd4,$dd3,$dd2,$dd1
pt_addrcols:
 dc.w $242,$353,$464,$575,$686,$797,$8a8,$9b9,$aca,$bdb,$cec,$dfd
 dc.w $efe,$dfd,$cec,$bdb,$aca,$9b9,$8a8,$797,$686,$575,$464,$464
pt_futurecols:
 dc.w $422,$533,$644,$755,$866,$977,$a88,$b99,$caa,$dbb,$ecc,$fdd
 dc.w $fee,$fdd,$ecc,$dbb,$caa,$b99,$a88,$977,$866,$755,$644,$644

pt_prefscols:
 dc.w $0f0,$0f0,$8d8,$6c6,$0f0,$d77,$c78,$b79,$a7a,$97b,$87c,$77d
 dc.w $0f0,$cc1,$aa2,$993,$884,$0f0,$0f0,$1e1,$2d2,$3c3,$0f0,$0f0




pt_allcolpoi:	dc.l	pt_tunecols

pt_selcoldat:
dc.w $ddd,$ddc,$ddb,$dda,$dd9,$dd8,$dd7
dc.w $dd6,$dc6,$db6,$da6,$d96,$d86,$d76
dc.w $d66,$c66,$b66,$a66,$967,$868,$769
dc.w $66a,$66b,$66c
dc.w $66d,$76d,$86d,$96d,$a6d,$b6d,$c6d
dc.w $d6d,$d7d,$d8d,$d9d,$dad,$dbd,$dcd,-1

pt_selcolpoi:	dc.l	pt_selcoldat
pt_selcol:	dc.w $ddd
pt_wait:	dc.w	1

pt_rut:	subq.w	#1,pt_wait
	beq.s	pt_nonewcol
	addq.w	#2,pt_wait
	move.l	pt_selcolpoi(pc),a0
	move.w	(a0)+,d0
	bpl.s	.pt_ook
	lea	pt_selcoldat(pc),a0
	move.w	(a0)+,d0
.pt_ook:move.w	d0,pt_selcol
	move.l	a0,pt_selcolpoi
pt_nonewcol:
	bsr	pt_scroll

	move.l	pt_allcolpoi(pc),a1
	tst.w	(a1)+
	lea	pt_this(pc),a0

	lea	LongPlayOnOffs-1(pc),a2
	add.w	pt_textradno(pc),a2

	cmp.w	#1,PlayMode	;play?
	beq.s	.ff
	tst.w	MenuMode
	beq.s	.u
.ff:	lea	Fillt,a2

.u:	moveq	#23,d7
.k:	move.w	(a1)+,d0
	tst.b	(a2)+
	bne.s	.d
	move.w	#$556,d0
.d:	move.w	d0,(a0)+
	dbf	d7,.k

	lea	pt_this(pc),a1


	move.w	pt_selcol(pc),d1
	move.w	TuneInMemory(pc),d0
	bne.s	.ee
	move.b	TuneToLoad,d0
	move.w	#$cfb,d1
.ee:	tst.w	MenuMode
	beq.s	.pt_goselected
	moveq	#1,d0
	move.w	pt_selcol(pc),d1
.pt_goselected:
	bsr	Selectedr

	addq.b	#1,BlinkaLoad
	cmp.w	#2,FastMemFlag
	bne.s	.lee
	move.w	#$fee,d1
	move.w	Fa_1TuneNo(pc),d0
	bne.s	.tu
	move.b	TuneToLoad,d0
	beq.s	.tuu
	move.w	#$cfb,d1
.tu:	bsr	FastMemTuneCol

.tuu:	move.w	#$fee,d1
	move.w	Fa_2TuneNo(pc),d0
	bne.s	.es
	move.b	TuneToLoad,d0
	beq.s	.lee
	move.w	#$cfb,d1
.es:	bsr	FastMemTuneCol


.lee:	lea	pt_rad3+$a(pc),a0	;move pt_this->cop
	lea	pt_this(pc),a1
	move.w	(a1),pt_rad0col+2
	move.w	(a1)+,pt_rad0col+6
	move.w	(a1),pt_rad1col+2
	move.w	(a1),pt_rad1col+6
	move.w	(a1),mc_col1+6
	move.w	(a1)+,mc_col1+10
	moveq	#19,d7
pt_coll:move.w	(a1)+,d0
	move.w	d0,(a0)
	move.w	d0,4(a0)
	lea	$10(a0),a0
	dbf	d7,pt_coll
	move.w	pt_understaradencol(pc),pt_forraunderstaradencol
	move.w	(a1)+,pt_understaradencol

	move.l	pt_removepoi(pc),d0
	beq.s	.pt_nocolthere
	move.l	d0,a0
	move.w	#$0184,(a0)+
	move.w	pt_understaradencol(pc),(a0)+
	move.w	#$0194,(a0)+
	move.w	pt_understaradencol(pc),(a0)+
.pt_nocolthere:
	rts

Fa_0tuneno:	dc.w	0
Fa_1tuneno:	dc.w	0,0	;+priority
Fa_2tuneno:	dc.w	0
pt_this:	blk.w	25,0

FastMemTuneCol:
	tst.w	MenuMode
	bne	rts
Selectedr:
	cmp.w	#$cfb,d1
	bne.s	.e
	move.b	BlinkaLoad,d2
	and.b	#$20,d2
	beq.s	.e
	move.w	#$fbc,d1

.e:	sub.w	pt_textradno(pc),d0
	bmi.s	.pt_noselcol
	cmp.w	#23,d0
	bge.s	.pt_noselcol
	add.w	d0,d0
	lea	pt_this(pc),a1
	move.w	d1,(a1,d0.w)
.pt_noselcol:
	rts

pt_scroll:
	move.l	pt_removepoi(pc),d0
	beq.s	pt_noremovecol
	move.l	d0,a0
	move.l	#$01020000,(a0)
	move.l	#$01020000,4(a0)
	clr.l	pt_removepoi

pt_noremovecol:
	move.l	pt_removepoi2(pc),d0
	beq.s	pt_noremovecol2
	move.l	d0,a0
	move.l	#$01020000,(a0)
	move.l	#$01020000,4(a0)
	clr.l	pt_removepoi2

pt_noremovecol2:
	tst.w	pt_go
	beq	rts
	bmi	pt_uppat

	cmp.w	#8,pt_cou
	beq.s	pt_restore

	add.w	#44,pt_rad1+6
	subq.b	#1,pt_rad2
	lea	pt_rad3(pc),a0
	moveq	#19,d7
pt_1:	subq.b	#1,(a0)
	lea	$10(a0),a0
	dbf	d7,pt_1
	subq.b	#1,pt_rad1cou

	move.w	pt_cou(pc),d0
	asl.w	#4,d0	;mulu #$10
	lea	pt_sistaraden+8+[$7*$10],a0
	sub.w	d0,a0
	move.l	pt_copinflytt(pc),(a0)
	lea	$10(a0),a0
	move.l	a0,pt_removepoi2
	move.w	#$0184,(a0)+
	move.w	pt_understaradencol(pc),(a0)+
	move.w	#$0194,(a0)+
	move.w	pt_understaradencol(pc),(a0)+
	addq.w	#1,pt_cou
	rts

pt_forraunderstaradencol:dc.w	0
pt_understaradencol:	dc.w	$f80
pt_removepoi:	dc.l	0
pt_removepoi2:	dc.l	0

pt_restore:
	move.b	#$2e,pt_rad2
	move.b	#$2d,pt_rad1cou

	move.w	pt_rad2+6,pt_rad1+6
	move.w	pt_rad3+6,pt_rad2+6

	lea	pt_rad3(pc),a0
	moveq	#19,d7
	moveq	#$37,d6
pt_2:	move.b	d6,(a0)
	move.w	$10+6(a0),6(a0)	;flytta bplpois
	add.b	#$9,d6
	lea	$10(a0),a0
	dbf	d7,pt_2

	move.w	pt_nyradpoi(pc),pt_rad3+$6+[19*$10]
	lea	pt_sistaraden+8(pc),a0
	move.l	a0,pt_removepoi2
	move.w	#$0184,(a0)+
	move.w	pt_understaradencol(pc),(a0)+
	move.w	#$0194,(a0)+
	move.w	pt_understaradencol(pc),(a0)+
	addq.w	#1,pt_cou

	addq.w	#1,pt_listpos
	addq.w	#1,pt_textradno
	clr.w	pt_go
	lea	menu2,a0
	moveq	#-1,d0
	move.w	d0,10+[$13*44](a0)
	move.w	d0,10+[$14*44](a0)
	move.w	d0,10+[$15*44](a0)
	move.w	d0,10+[$16*44](a0)
	move.w	d0,10+[$17*44](a0)
	move.w	d0,10+[$18*44](a0)
	move.w	d0,10+[$19*44](a0)
	move.w	d0,10+[$1a*44](a0)
	rts


pt_uppat:
	tst.w	pt_cou
	bne	pt_scrup

	move.b	#$26,pt_rad2
	move.b	#$25,pt_rad1cou

	move.w	#$00e6,pt_sistaraden+8
	move.w	pt_rad3+$6+[19*$10],pt_sistaraden+10

	lea	pt_sistaraden+$10+8(pc),a0
	move.l	a0,pt_removepoi

	lea	pt_rad3+[19*$10](pc),a0
	moveq	#19,d7
	move.w	#$da,d6
pt__2:	move.b	d6,(a0)
	move.w	-10(a0),6(a0)	;flytta bplpois
	sub.b	#$9,d6
	lea	-$10(a0),a0
	dbf	d7,pt__2

	move.w	pt_rad2+6,pt_rad3+6
	move.w	pt_rad1+6,pt_rad2+6
	move.w	pt_nyradpoi(pc),d0
	add.w	#[8*44],d0
	move.w	d0,pt_rad1+$6

	addq.w	#1,pt_cou
	subq.w	#1,pt_listpos
	subq.w	#1,pt_textradno
	rts


pt_scrup:
	sub.w	#44,pt_rad1+6

	addq.b	#1,pt_rad2
	addq.b	#1,pt_rad1cou
	lea	pt_rad3(pc),a0
	moveq	#19,d7
pt__1:	addq.b	#1,(a0)
	lea	$10(a0),a0
	dbf	d7,pt__1

	move.w	pt_cou(pc),d0
	asl.w	#4,d0	;mulu #$10
	lea	pt_sistaraden+8,a0
	add.w	d0,a0
	move.l	-$10(a0),(a0)
	move.l	#$01020000,-$10(a0)

	lea	$10(a0),a0
	cmp.l	#pt_sistaradenend,a0
	bge.s	pt_nocolhere
	move.l	a0,pt_removepoi

pt_nocolhere:
	addq.w	#1,pt_cou
	cmp.w	#9,pt_cou
	bne	rts
	clr.w	pt_go
	lea	menu2,a0
	moveq	#-1,d0
	move.w	d0,10+[$07*44](a0)
	move.w	d0,10+[$08*44](a0)
	move.w	d0,10+[$09*44](a0)
	move.w	d0,10+[$0a*44](a0)
	move.w	d0,10+[$0b*44](a0)
	move.w	d0,10+[$0c*44](a0)
	move.w	d0,10+[$0d*44](a0)
	move.w	d0,10+[$0e*44](a0)
	move.l	#$01020000,pt_sistaraden+8+[$10*8]
	rts



pt_prbplpoi:	dc.l	0
pt_prtextpoi:	dc.l	0

pt_end:	move.l	a1,pt_prtextpoi
	movem.l	(a7)+,d0-d7/a0-a6
	rte
PrintTextRow:
	movem.l	d0-d7/a0-a6,-(a7)
	move.l	pt_prbplpoi(pc),a0
	lea	16(a0),a5
	move.l	pt_prtextpoi(pc),a1

	lea	-1(a0),a2
	moveq	#7,d7
	moveq	#0,d6
pt_lo:	move.l	d6,(a2)+
	move.l	d6,(a2)+
	move.l	d6,(a2)+
	move.l	d6,(a2)+
	move.l	d6,(a2)+
	move.l	d6,(a2)+
	move.l	d6,(a2)+
	move.l	d6,(a2)+
	lea	44-32(a2),a2
	dbf	d7,pt_lo

	lea	sfontbredds(pc),a2
	lea	sfontr,a3
	moveq	#5,d7
pt_lo2:	moveq	#0,d0
	move.b	(a1)+,d0
	beq	pt_tab
	bmi.s	pt_end

	move.w	d0,d1
	and.w	#$1f,d0
	and.w	#$e0,d1
	asl.w	#$3,d1
	add.w	d0,d1
	lea	(a3,d1.w),a4	;a3=sfontr
	moveq	#0,d0
	moveq	#0,d1
	moveq	#0,d2
	moveq	#0,d3
	moveq	#0,d4
	moveq	#0,d5
	moveq	#0,d6
	move.b	$20*0(a4),d0
	move.b	$20*1(a4),d1
	move.b	$20*2(a4),d2
	move.b	$20*3(a4),d3
	move.b	$20*4(a4),d4
	move.b	$20*5(a4),d5
	move.b	$20*6(a4),d6
	 eor.b	#7,d7
	asl.w	d7,d0
	asl.w	d7,d1
	asl.w	d7,d2
	asl.w	d7,d3
	asl.w	d7,d4
	asl.w	d7,d5
	asl.w	d7,d6
	or.b	d0,44*0+1(a0)
	or.b	d1,44*1+1(a0)
	or.b	d2,44*2+1(a0)
	or.b	d3,44*3+1(a0)
	or.b	d4,44*4+1(a0)
	or.b	d5,44*5+1(a0)
	or.b	d6,44*6+1(a0)
	lsr.w	#8,d0
	lsr.w	#8,d1
	lsr.w	#8,d2
	lsr.w	#8,d3
	lsr.w	#8,d4
	lsr.w	#8,d5
	lsr.w	#8,d6
	or.b	d0,44*0(a0)
	or.b	d1,44*1(a0)
	or.b	d2,44*2(a0)
	or.b	d3,44*3(a0)
	or.b	d4,44*4(a0)
	or.b	d5,44*5(a0)
	or.b	d6,44*6(a0)
	moveq	#0,d0
	move.b	$20*7(a4),d0
	asl.w	d7,d0
	or.b	d0,44*7+1(a0)
	lsr.w	#8,d0
	or.b	d0,44*7(a0)
	 eor.b	#7,d7

;	moveq	#0,d0
	move.b	-1(a1),d0
	add.b	(a2,d0.w),d7
	move.w	d7,d1
	and.w	#$7,d7
	lsr.w	#3,d1
	lea	(a0,d1.w),a0	;addxpos
	bra	pt_lo2
pt_tab:	move.l	a5,a0
	moveq	#0,d7
	bra	pt_lo2

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

prefsbutton:
	cmp.w	#5,d1
	blt.L	pr_rts
	cmp.w	#$b,d1
	bgt.L	prefsandra

	cmp.w	#$124,d0
	blt.L	pr_rts

	move.w	d1,d7
	subq.w	#5,d1
	lea	prefsvalues(pc),a0
	sub.w	#$138,d0

	add.w	d1,d1
	move.w	(a0,d1.w),d2
	cmp.w	d0,d2
	beq	pr_rts
	blt.L	pr_uppat

	lea	prefsedges(pc),a5
	move.w	d1,d3
	add.w	d3,d3
	cmp.w	(a5,d3.w),d2
	ble.L	pr_rts

	subq.w	#1,(a0,d1.w)
	move.w	(a0,d1.w),d6
	mulu	2(a5,d3.w),d6
	lea	pe_fric(pc),a5
	move.l	d6,(a5,d3.w)

	moveq	#0,d6
	move.w	pt_listpos(pc),d6
	subq.w	#1,d6
	add.w	d7,d6	;prefsrad
	move.l	d6,d0
	divu	#25,d0
	swap	d0
	mulu	#44*9,d0
	add.l	#textbpl+13+44+[2*44]+12,d0
	move.l	d0,a0

	move.w	d2,d3
	move.w	d2,d0
	lsr.w	#3,d0
	lea	(a0,d0.w),a1
	and.w	#$7,d2
	eor.w	#$7,d2
	bclr	d2,(a1)
	bclr	d2,44(a1)
	bclr	d2,88(a1)
	bclr	d2,132(a1)
	bclr	d2,176(a1)
	bclr	d2,220(a1)

	subq.w	#1,d3
	move.w	d3,d0
	lsr.w	#3,d0
	lea	(a0,d0.w),a1
	and.w	#$7,d3
	eor.w	#$7,d3
	bset	d3,(a1)
	bset	d3,44(a1)
	bset	d3,88(a1)
	bset	d3,132(a1)
	bset	d3,176(a1)
	bset	d3,220(a1)

	bra.L	pr_rts
pr_uppat:
	cmp.w	#$80,d2
	bge.L	pr_rts

	addq.w	#1,(a0,d1.w)
	lea	prefsedges+2(pc),a5
	move.w	d1,d3
	add.w	d3,d3
	move.w	(a0,d1.w),d6
	mulu	(a5,d3.w),d6
	lea	pe_fric(pc),a5
	move.l	d6,(a5,d3.w)

	moveq	#0,d6
	move.w	pt_listpos(pc),d6
	subq.w	#1,d6
	add.w	d7,d6	;prefsrad

	move.l	d6,d0
	divu	#25,d0
	swap	d0
	mulu	#44*9,d0
	add.l	#textbpl+13+44+[2*44]+12,d0
	move.l	d0,a0

	move.w	d2,d3
	move.w	d2,d0
	lsr.w	#3,d0
	lea	(a0,d0.w),a1
	and.w	#$7,d2
	eor.w	#$7,d2
	bset	d2,(a1)
	bset	d2,220(a1)
	lea	prefssudd(pc),a2
	move.b	(a2,d2.w),d0
	lsr.w	#1,d0
	bcc.s	pr_1
	bclr	d2,44(a1)
pr_1:	lsr.w	#1,d0
	bcc.s	pr_2
	bclr	d2,88(a1)
pr_2:	lsr.w	#1,d0
	bcc.s	pr_3
	bclr	d2,132(a1)
pr_3:	lsr.w	#1,d0
	bcc.s	pr_4
	bclr	d2,176(a1)
pr_4:
	addq.w	#1,d3
	move.w	d3,d0
	lsr.w	#3,d0
	lea	(a0,d0.w),a1
	and.w	#$7,d3
	eor.w	#$7,d3
	bset	d3,(a1)
	bset	d3,44(a1)
	bset	d3,88(a1)
	bset	d3,132(a1)
	bset	d3,176(a1)
	bset	d3,220(a1)
pr_rts:	rts

prefsvalues:	dc.w 8,21,24,24,36,80,24
prefssudd:	dc.b %0001,%0011,%0111,%1111,%1110,%1100,%1000,%0000

pba_engpoi:	dc.l	-1,Engelska	;Engelska
pba_svepoi:	dc.l	Svenska,Svenska
pba_barnpoi:	dc.l	Barn,Barn

pba_rut:tst.l	(a0)
	bmi.s	.nes
	move.l	ba_textoldpoi(pc),d0
	tst.l	pba_engpoi
	bpl.s	.t
	move.l	d0,pba_engpoi
.t:	tst.l	pba_svepoi
	bpl.s	.u
	move.l	d0,pba_svepoi
.u:	tst.l	pba_barnpoi
	bpl.s	.v
	move.l	d0,pba_barnpoi
.v:
	move.l	(a0),ba_textpoi
	move.l	#-1,(a0)
	move.l	4(a0),ba_restartpoi
	move.w	#1,ba_newcou
	tst.w	ba_wegcou
	beq.s	.h
	move.w	#1,pbac
.h:	clr.l	ba_bplpoi
	bra	printprefsbarn

.nes:	move.w	#1,ba_newcou
	rts

prefsandra:
	cmp.w	#$e,d1
	bne.s	.noengelska
	lea	pba_engpoi(pc),a0
	bra	pba_rut
.noengelska:
	cmp.w	#$f,d1
	bne.s	.nosvenska
	lea	pba_svepoi(pc),a0
	bra	pba_rut
.nosvenska:
	cmp.w	#$10,d1
	bne.s	.nobarn
	lea	pba_barnpoi(pc),a0
	bra	pba_rut
.nobarn:

	cmp.w	#$14,d1
	bne.s	.nowhole
	tst.w	Fastmemflag
	beq.s	.nowhole
	cmp.w	#1,FastMemFlag
	beq.s	.nowhole
	tst.w	loadwholedisk1
	bne.s	.nowhole
	move.w	#1,loadwholedisk1
	bsr	printprefsFastMem
.nowhole:

	cmp.w	#$15,d1
	bne.s	.notune
	tst.w	FastMemFlag
	beq.s	.notune
	cmp.w	#2,FastMemFlag
	beq.s	.notune
	move.w	#2,FastMemFlag
	bsr	printprefsFastMem
	move.l	#$00000001,Fa_1TuneNo	;clr fasttunenos
	clr.w	Fa_2TuneNO
.notune:rts

loadwholedisk1:	dc.w	0

prefsedges:	;dc.w min*k,k
dc.w $0,$0800	;fric		0-$40000
dc.w $0,$1e00	;wallfric	0-$f0000
dc.w $1,$00ff	;ysence		$ff-$7f80
dc.w $1,$00ff	;xsence		$ff-$7f80
dc.w $1,$0020	;time		$20-$1000
dc.w $1,$0200	;grav		$200-$10000
dc.w $3,$0040	;curssense	$180-$2000

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

bu_goLove:	dc.w	0
stopbuttonold:	dc.w	0

bu_olds:moveq	#0,d0
	tst.l	mt_data
	beq.s	.ingen
	tst.w	tuneinmemory
	beq.s	.ingen
	tst.w	stopbuttonold
	bne	.bu_92

	lea	menu1+[$25*44]+11,a0
	lea	menu2+[$25*44]+11,a1
	move.b	#%11111000,1*44(a0)
	move.b	#-1,1*44(a1)
	move.b	#%11111000,2*44(a0)
	move.b	#-1,2*44(a1)
	move.b	#%11111000,3*44(a0)
	move.b	#-1,3*44(a1)
	move.b	#%11111000,4*44(a0)
	move.b	#-1,4*44(a1)
	move.b	#%11111000,5*44(a0)
	move.b	#-1,5*44(a1)
	move.w	#1,stopbuttonold
	bra.s	.bu_92

.ingen:	tst.w	stopbuttonold
	beq.s	.bu_92
	lea	menu1+[$25*44]+11,a0
	lea	menu2+[$25*44]+11,a1
	move.b	#%11111000,1*44(a0)
	move.b	#%00000111,1*44(a1)
	move.b	#%11111000,2*44(a0)
	move.b	#%00000111,2*44(a1)
	move.b	#%11111000,3*44(a0)
	move.b	#%00000111,3*44(a1)
	move.b	#%11111000,4*44(a0)
	move.b	#%00000111,4*44(a1)
	move.b	#%11111000,5*44(a0)
	move.b	#%00000111,5*44(a1)
	clr.w	stopbuttonold

.bu_92:	move.w	bu_forraselcou(pc),d0
	beq	bu_99
	subq.w	#1,bu_forraselcou
	bne	bu_99

	lea	menu1+[$25*44]+4,a0
	lea	menu2+[$25*44]+4,a1
	move.w	#%0000001100110000,(a0)
	move.w	#-1,(a1)
	move.w	#%0000011001100000,1*44(a0)
	move.w	#-1,1*44(a1)
	move.w	#%0000110011000000,2*44(a0)
	move.w	#-1,2*44(a1)
	move.w	#%0001100110000000,3*44(a0)
	move.w	#-1,3*44(a1)
	move.w	#%0000110011000000,4*44(a0)
	move.w	#-1,4*44(a1)
	move.w	#%0000011001100000,5*44(a0)
	move.w	#-1,5*44(a1)
	move.w	#%0000001100110000,6*44(a0)
	move.w	#-1,6*44(a1)
bu_99:
	move.w	bu_nastaselcou(pc),d0
	beq	bu_97
	subq.w	#1,bu_nastaselcou
	bne	bu_97
	lea	menu1+[$25*44]+8,a0
	lea	menu2+[$25*44]+8,a1
	move.b	#%00000110,-1(a0)
	move.b	#-1,-1(a1)
	move.b	#%01100000,(a0)
	move.b	#-1,(a1)
	move.b	#%00000011,-1+[1*44](a0)
	move.b	#-1,-1+[1*44](a1)
	move.b	#%00110000,1*44(a0)
	move.b	#-1,1*44(a1)
	move.b	#%00000001,-1+[2*44](a0)
	move.b	#-1,-1+[2*44](a1)
	move.b	#%10011000,2*44(a0)
	move.b	#-1,2*44(a1)
	move.b	#%11001100,3*44(a0)
	move.b	#-1,3*44(a1)
	move.b	#%00000001,-1+[4*44](a0)
	move.b	#-1,-1+[4*44](a1)
	move.b	#%10011000,4*44(a0)
	move.b	#-1,4*44(a1)
	move.b	#%00000011,-1+[5*44](a0)
	move.b	#-1,-1+[5*44](a1)
	move.b	#%00110000,5*44(a0)
	move.b	#-1,5*44(a1)
	move.b	#%00000110,-1+[6*44](a0)
	move.b	#-1,-1+[6*44](a1)
	move.b	#%01100000,6*44(a0)
	move.b	#-1,6*44(a1)
bu_97:
	move.w	bu_nastalatencou(pc),d0
	beq	bu_95
	subq.w	#1,bu_nastalatencou
	bne	bu_95
	lea	menu1+[$25*44]+10,a0
	lea	menu2+[$25*44]+10,a1
	moveq	#-1,d0
	move.b	#%11000000,0*44(a0)
	move.b	d0,0*44(a1)
	move.b	#%00001100,[0*44]-1(a0)
	move.b	d0,[0*44]-1(a1)
	move.b	#%11000000,1*44(a0)
	move.b	d0,1*44(a1)
	move.b	#%00000110,[1*44]-1(a0)
	move.b	d0,[1*44]-1(a1)
	move.b	#%11000000,2*44(a0)
	move.b	d0,2*44(a1)
	move.b	#%00000011,[2*44]-1(a0)
	move.b	d0,[2*44]-1(a1)
	move.b	#%11000000,3*44(a0)
	move.b	d0,3*44(a1)
	move.b	#%00000001,[3*44]-1(a0)
	move.b	d0,[3*44]-1(a1)
	move.b	#%11000000,4*44(a0)
	move.b	d0,4*44(a1)
	move.b	#%00000011,[4*44]-1(a0)
	move.b	d0,[4*44]-1(a1)
	move.b	#%11000000,5*44(a0)
	move.b	d0,5*44(a1)
	move.b	#%00000110,[5*44]-1(a0)
	move.b	d0,[5*44]-1(a1)
	move.b	#%11000000,6*44(a0)
	move.b	d0,6*44(a1)
	move.b	#%00001100,[6*44]-1(a0)
	move.b	d0,[6*44]-1(a1)
bu_95:
	move.w	bu_forralatencou(pc),d0
	beq	bu_94
	subq.w	#1,bu_forralatencou
	bne	bu_94
	moveq	#-1,d0
	lea	menu1+[$25*44]+3,a0
	lea	menu2+[$25*44]+3,a1
	move.b	#%11001100,0*44(a0)
	move.b	d0,(a1)
	move.b	#%11011000,1*44(a0)
	move.b	d0,44(a1)
	move.b	#%11110000,2*44(a0)
	move.b	d0,88(a1)
	move.b	#%11100000,3*44(a0)
	move.b	d0,3*44(a1)
	move.b	#%11110000,4*44(a0)
	move.b	d0,4*44(a1)
	move.b	#%11011000,5*44(a0)
	move.b	d0,5*44(a1)
	move.b	#%11001100,6*44(a0)
	move.b	d0,6*44(a1)

bu_94:	rts

bu_leftcou:	dc.w	0
bu_rightcou:	dc.w	0


bu_rut:	tst.w	bu_goLove
	bne	bu_love
	bsr	bu_olds
	bsr	bu___1
	btst	#6,$bfe001
	beq.w	bu_left
	tst.w	AltMode
	beq.s	.bu_1
	tst.w	LeftAmiga
	bne.w	Bu_left
.bu_1:	clr.w	bu_leftcou

	btst	#2,$dff016
	beq	bu_right
	tst.w	AltMode
	beq.s	.b1
	tst.w	RightAmiga
	bne	Bu_right
.b1:	clr.w	bu_rightcou

	move.w	ActKey(pc),d0
	cmp.w	#$42,d0	;tab
	bne.s	.noplLpl
	clr.w	ActKey
	cmp.w	#1,PlayMode
	beq	bu_Lplay
	bra	bu_play

.noplLpl:
	cmp.w	#$40,d0
	beq	bu_playpausekeyb

	tst.w	shiftmode
	beq	.mt_novanster
	move.w	cursorkeyx,d0
	subq.w	#1,d0
	bne.s	.mt_nohoger
	bra	bu_nastapatt
.mt_nohoger:
	clr.w	mt_pattchcou
	move.w	cursorkeyx,d0
	cmp.w	#$ffff,d0
	bne.s	.mt_novanster
	bra	bu_forrapatt
.mt_novanster:	clr.w	mt_pattvchcou

	cmp.w	#$63,AllKey
	bne	.n
	move.w	cursorkeyx,d0
	subq.w	#1,d0
	beq	bu_nastalaten

	move.w	cursorkeyx,d0
	cmp.w	#$ffff,d0
	beq	bu_forralaten
.n:

	move.w	ActKey(pc),d0

	cmp.w	#$45,d0
	beq	bu_tunes
	cmp.w	#$50,d0
	beq	bu_instr
	cmp.w	#$51,d0
	beq	bu_greets
	cmp.w	#$52,d0
	beq	bu_addr
	cmp.w	#$53,d0
	beq	bu_prefs
	cmp.w	#$54,d0
	beq	bu_future
	rts



bu___1:	tst.w	AltMode
	bne.L	rts
	tst.w	CursorKeyY
	bmi	bu_pilner
	bne	bu_pilupp
	rts


bu_right:
	addq.w	#1,bu_rightcou
	clr.w	pe_stilla
	moveq	#0,d0
	moveq	#0,d1
	move.w	pe_xpos(pc),d0
	move.w	pe_ypos(pc),d1

	cmp.w	#$da,d0
	blt.s	.notune
	cmp.w	#$ec,d1
	bge.s	.notune

	tst.w	pt_go		;ej samtidigt som scrollning av text
	bne	.notune
	tst.w	NewMenuPrintUnderArbete	;ej vid print av ny menu
	bne	.notune

	sub.w	#$26,d1
	divu	#9,d1
	add.w	pt_textradno(pc),d1
	addq.w	#1,d1

	tst.w	MenuMode	;bara i tunemenyn
	bne.s	.notune

	move.w	d1,d0
	subq.w	#2,d0
	bmi	rts
	cmp.w	#101,d0
	bge	rts

	cmp.w	#2,PlayMode
	beq.s	.LongPlaySel
	cmp.w	#2,FastMemFlag
	bne.s	.notune

	tst.b	tunetoload
	bne	rts
	tst.w	loadwholedisk1
	bne	rts
	move.w	d1,pt_selectedrad
	addq.b	#1,d0
	move.b	d0,tunetoload	;aktivera laddningsrut
	move.b	#1,LoadNoSwap
.notune:rts	

.LongPlaySel:
	lea	LongPlayOnOffs(pc),a0
	cmp.w	#1,bu_rightcou
	bne.s	.samma
	clr.b	.lo
	tst.b	(a0,d0.w)
	bne.s	.samma
	move.b	#1,.lo
.samma:	move.b	.lo,(a0,d0.w)
	rts

.lo:	dc.b	0
	blk.b	7,1
LongPlayOnOffs:
	blk.b	112,1


Tryckpa123:
	move.w	ActKey(pc),d7
	beq	rts
	cmp.w	#$03,d7
	bgt	rts
	clr.w	ActKey

	cmp.w	#2,FastMemFlag
	bne	rts

	tst.b	tunetoload
	bne	rts
	tst.w	loadwholedisk1
	bne	rts

	move.w	Fa_1TuneNo,d0
	bne.s	.ok1
	moveq	#-1,d0
.ok1:	move.w	Fa_2TuneNo,d1
	bne.s	.ok2
	moveq	#-1,d1
.ok2:	move.w	TuneInMemory,d2
	bne.s	.ok3
	moveq	#-1,d2
.ok3:
	cmp.w	d0,d1
	bge.s	.s1
	exg	d0,d1
.s1:	cmp.w	d1,d2
	bge.s	.s2
	exg	d1,d2
.s2:	cmp.w	d0,d1
	bge.s	.s3
	exg	d0,d1
.s3:

	cmp.w	#$01,d7
	beq.s	.go1
	cmp.w	#$02,d7
	bne.s	.go3
	move.w	d1,d0
	bra.s	.go1
.go3:	move.w	d2,d0

.go1:	cmp.w	#-1,d0
	beq	rts
	move.b	d0,tunetoload	;aktivera laddningsrut
	rts


bu_left:addq.w	#1,bu_leftcou
	clr.w	pe_stilla
	moveq	#0,d0
	moveq	#0,d1
	move.w	pe_xpos(pc),d0
	move.w	pe_ypos(pc),d1

	cmp.w	#$101,d1
	blt.s	.nonewbarn
	move.w	#1,ba_newcou

.nonewbarn:
	cmp.w	#$da,d0
	blt.s	notunebutton
	cmp.w	#$ec,d1
	bge.s	notunebutton

	tst.w	pt_go		;ej samtidigt som scrollning av text
	bne	notunebutton
	tst.w	NewMenuPrintUnderArbete	;ej vid print av ny menu
	bne	notunebutton

	sub.w	#$26,d1
	divu	#9,d1
	add.w	pt_textradno(pc),d1
	addq.w	#1,d1

	tst.w	MenuMode	;bara i tunemenyn
	bne.s	kollapre

	tst.b	tunetoload
	bne	rts
	tst.w	loadwholedisk1
	bne	rts
	move.w	d1,d0
	subq.w	#2,d0
	bmi	rts
	cmp.w	#101,d0
	bge	rts
	move.w	d1,pt_selectedrad
	addq.b	#1,d0
	move.b	d0,tunetoload	;aktivera laddningsrut
	rts	

kollapre:cmp.w	#$4,menumode
	beq	prefsbutton
	rts

notunebutton:
	cmp.w	#$5d,d1
	bge	bu_98
	cmp.w	#$50,d1
	blt	bu_98
	cmp.w	#$85,d0
	blt	bu_98
	cmp.w	#$91,d0
	blt	bu_forralatenmus
	cmp.w	#$9e,d0
	blt	bu_forrapattmus
	cmp.w	#$ac,d0
	blt	bu_playpause
	cmp.w	#$ba,d0
	blt	bu_nastapattmus
	cmp.w	#$c5,d0
	blt	bu_nastalatenmus
	cmp.w	#$d1,d0
	blt	bu_stop

bu_98:	cmp.w	#$33,d1
	blt.s	bu_3
	cmp.w	#$86,d0
	blt.s	bu_3
	cmp.w	#$bd,d0
	bgt.s	bu_3
	cmp.w	#$3e,d1
	ble.L	bu_play
bu_2:	cmp.w	#$4a,d1
	ble.L	bu_Lplay

bu_3:	cmp.w	#$84,d0
	blt.s	bu_4
	cmp.w	#$d2,d0
	bgt.s	bu_4
	cmp.w	#$a6,d1
	blt.s	bu_4
	cmp.w	#$c0,d1
	bgt.s	bu_4
	cmp.w	#$ac,d0
	bge.s	bu_hogerrad
	cmp.w	#$ae,d1
	ble	bu_tunes
	cmp.w	#$b7,d1
	ble	bu_greets
	bra	bu_prefs
bu_hogerrad:
	cmp.w	#$ae,d1
	ble	bu_instr
	cmp.w	#$b7,d1
	ble	bu_addr
	bra	bu_future

bu_4:	cmp.w	#$ec,d1
	blt.s	bu_5
	cmp.w	#$ff,d1
	ble.L	bu_scrollen
	rts

bu_5:	cmp.w	#$c4,d0
	blt.s	bu_6
	cmp.w	#$d2,d0
	bgt.s	bu_6
	cmp.w	#$33,d1
	blt.s	bu_6
	cmp.w	#$3e,d1
	ble.L	bu_pilner
	cmp.w	#$3f,d1
	ble.s	bu_6
	cmp.w	#$4a,d1
	ble.w	bu_pilupp

bu_6:	rts

bu_nastalatencou:	dc.w	0
bu_forralatencou:	dc.w	0

bu_forralatenmus:
	cmp.w	#1,bu_leftcou
	bne.w	ot_rts
bu_forralaten:
	clr.w	AllKey
	tst.b	TuneToLoad
	bne	ot_rts
	lea	menu1+[$25*44]+3,a0
	lea	menu2+[$25*44]+3,a1
	move.b	#%11001100,0*44(a0)
	move.b	#%00110011,0*44(a1)
	move.b	#%11011000,1*44(a0)
	move.b	#%00100111,1*44(a1)
	move.b	#%11110000,2*44(a0)
	move.b	#%00001111,2*44(a1)
	move.b	#%11100000,3*44(a0)
	move.b	#%00011111,3*44(a1)
	move.b	#%11110000,4*44(a0)
	move.b	#%00001111,4*44(a1)
	move.b	#%11011000,5*44(a0)
	move.b	#%00100111,5*44(a1)
	move.b	#%11001100,6*44(a0)
	move.b	#%00110011,6*44(a1)
	move.w	#$10,bu_forralatencou

	move.w	TuneInMemory(pc),d0
	beq.s	.e
	subq.w	#1,d0
.e:	move.l	d0,d1

	lea	LongPlayOnOffs-1(pc),a0
.l:	tst.w	d0
	bne.s	.r
	move.w	#101,d0
.r:	tst.b	(a0,d0.w)
	bne.s	.go
	subq.w	#1,d0
	cmp.w	d0,d1	;ett varv
	beq	qkrts
	bra.s	.l

.go:	move.b	d0,tunetoload	;aktivera laddningsrut
	rts

FastNastalaten:
	move.w	#$dada,d7
	bra.s	kos

bu_nastalatenmus:
	cmp.w	#1,bu_leftcou
	bne.w	ot_rts
bu_nastalaten:
	moveq	#$0,d7
kos:	clr.w	AllKey
	tst.b	TuneToLoad
	bne	ot_rts
	lea	menu1+[$25*44]+10,a0
	lea	menu2+[$25*44]+10,a1
	move.b	#%11000000,0*44(a0)
	move.b	#%00111111,0*44(a1)
	move.b	#%00001100,[0*44]-1(a0)
	move.b	#%11110011,[0*44]-1(a1)
	move.b	#%11000000,1*44(a0)
	move.b	#%00111111,1*44(a1)
	move.b	#%00000110,[1*44]-1(a0)
	move.b	#%11111001,[1*44]-1(a1)
	move.b	#%11000000,2*44(a0)
	move.b	#%00111111,2*44(a1)
	move.b	#%00000011,[2*44]-1(a0)
	move.b	#%11111100,[2*44]-1(a1)
	move.b	#%11000000,3*44(a0)
	move.b	#%00111111,3*44(a1)
	move.b	#%00000001,[3*44]-1(a0)
	move.b	#%11111110,[3*44]-1(a1)
	move.b	#%11000000,4*44(a0)
	move.b	#%00111111,4*44(a1)
	move.b	#%00000011,[4*44]-1(a0)
	move.b	#%11111100,[4*44]-1(a1)
	move.b	#%11000000,5*44(a0)
	move.b	#%00111111,5*44(a1)
	move.b	#%00000110,[5*44]-1(a0)
	move.b	#%11111001,[5*44]-1(a1)
	move.b	#%11000000,6*44(a0)
	move.b	#%00111111,6*44(a1)
	move.b	#%00001100,[6*44]-1(a0)
	move.b	#%11110011,[6*44]-1(a1)
	move.w	#$10,bu_nastalatencou

	move.w	TuneInMemory(pc),d0
	addq.w	#1,d0
	move.l	d0,d1
	lea	LongPlayOnOffs-1(pc),a0
.l:	cmp.w	#101,d0
	bne.s	.r
	move.w	#1,d0
.r:	tst.b	(a0,d0.w)
	bne.s	.go
	addq.w	#1,d0
	cmp.w	d0,d1	;ett varv
	beq	qkrts
	bra.s	.l
.go:	cmp.w	#$dada,d7
	bne.s	.n
	cmp.w	Fa_1TuneNo,d0
	beq	ot_rts
	cmp.w	Fa_2TuneNo,d0
	beq	ot_rts
	move.b	#1,LoadNoSwap
.n:	move.b	d0,tunetoload	;aktivera laddningsrut
	rts

bu_stop:cmp.w	#1,bu_leftcou
	bne	ot_rts
;	tst.w	stoppauseplaymode	;stop æven om redan stopmode
;	beq	ot_rts
	clr.w	stoppauseplaymode

	lea	menu1+[$25*44]+11,a0
	lea	menu2+[$25*44]+11,a1
	move.b	#%11111000,1*44(a0)
	move.b	#%00000111,1*44(a1)
	move.b	#%11111000,2*44(a0)
	move.b	#%00000111,2*44(a1)
	move.b	#%11111000,3*44(a0)
	move.b	#%00000111,3*44(a1)
	move.b	#%11111000,4*44(a0)
	move.b	#%00000111,4*44(a1)
	move.b	#%11111000,5*44(a0)
	move.b	#%00000111,5*44(a1)

	move.w	#$f,$dff096	;borjan av song=reset tune
	moveq	#0,d0
	move.w	d0,$dff0a8
	move.w	d0,$dff0b8
	move.w	d0,$dff0c8
	move.w	d0,$dff0d8

	clr.l	L692
	clr.l	L693
	move.l	L693(pc),d0
	lea	PattSpds(pc),a0
	move.b	(a0,d0.w),L642+3
	move.l	L642,L695	
	bsr	SetTuneTimer
	bra	PattJmpClr


bu_playpausekeyb:
	clr.w	ActKey
	 clr.l	pe_yspd		;muspek
	 clr.l	pe_xspd
	 move.w	#$8000,pe_stilla
	bra.s	bu_playpausea
bu_playpause:
	cmp.w	#1,bu_leftcou
	bne	ot_rts
bu_playpausea:
	move.w	stoppauseplaymode(pc),d0
	beq.w	.goplay
	cmp.w	#1,d0
	beq.w	.goplay
;.gopause:
	move.w	#1,stoppauseplaymode

	lea	menu1+[$25*44]+6,a0
	lea	menu2+[$25*44]+6,a1
	move.b	#%01101100,(a0)
	move.b	#%10010011,(a1)
	move.b	#%01101110,1*44(a0)
	move.b	#%10010011,1*44(a1)
	move.b	#%01101111,2*44(a0)
	move.b	#%10010011,2*44(a1)
	move.w	#%0110111110000000,3*44(a0)
	move.w	#%1001001111111111,3*44(a1)
	move.b	#%01101111,4*44(a0)
	move.b	#%10010011,4*44(a1)
	move.b	#%01101110,5*44(a0)
	move.b	#%10010011,5*44(a1)
	move.b	#%01101100,6*44(a0)
	move.b	#%10010011,6*44(a1)

	tst.w	tuneinmemory
	beq	.no
	move.w	#$f,$dff096	;borjan av patt
	moveq	#0,d0
	move.w	d0,$dff0a8
	move.w	d0,$dff0b8
	move.w	d0,$dff0c8
	move.w	d0,$dff0d8
	clr.l	L692
	move.l	L693(pc),d0
	lea	PattSpds(pc),a0
	move.b	(a0,d0.w),L642+3
	move.l	L642,L695	
	bsr	SetTuneTimer
	bsr	PattJmpClr

.no:	tst.w	stopbuttonold
	beq	ot_rts
	lea	menu1+[$25*44]+11,a0
	lea	menu2+[$25*44]+11,a1
	move.b	#%11111000,1*44(a0)
	move.b	#-1,1*44(a1)
	move.b	#%11111000,2*44(a0)
	move.b	#-1,2*44(a1)
	move.b	#%11111000,3*44(a0)
	move.b	#-1,3*44(a1)
	move.b	#%11111000,4*44(a0)
	move.b	#-1,4*44(a1)
	move.b	#%11111000,5*44(a0)
	move.b	#-1,5*44(a1)
	rts


.goplay:
	move.w	#2,stoppauseplaymode

	lea	menu1+[$25*44]+6,a0
	lea	menu2+[$25*44]+6,a1
	move.b	#%01101100,(a0)
	move.b	#%11110011,(a1)
	move.b	#%01101110,1*44(a0)
	move.b	#%11110001,1*44(a1)
	move.b	#%01101111,2*44(a0)
	move.b	#%11110000,2*44(a1)
	move.w	#%0110111110000000,3*44(a0)
	move.w	#%1111000001111111,3*44(a1)
	move.b	#%01101111,4*44(a0)
	move.b	#%11110000,4*44(a1)
	move.b	#%01101110,5*44(a0)
	move.b	#%11110001,5*44(a1)
	move.b	#%01101100,6*44(a0)
	move.b	#%11110011,6*44(a1)

	tst.w	stopbuttonold
	beq	ot_rts
	lea	menu1+[$25*44]+11,a0
	lea	menu2+[$25*44]+11,a1
	move.b	#%11111000,1*44(a0)
	move.b	#-1,1*44(a1)
	move.b	#%11111000,2*44(a0)
	move.b	#-1,2*44(a1)
	move.b	#%11111000,3*44(a0)
	move.b	#-1,3*44(a1)
	move.b	#%11111000,4*44(a0)
	move.b	#-1,4*44(a1)
	move.b	#%11111000,5*44(a0)
	move.b	#-1,5*44(a1)
	rts

stoppauseplaymode:	dc.w	2	;0=stop 1=pause 2=play

bu_pilupp:	;=scrollner
	tst.w	pt_go
	bne	rts
	tst.w	NewMenuPrintUnderArbete
	bne	rts
	move.w	pt_TextRadNo(pc),d0
	cmp.w	AntalRader(pc),d0
	beq	rts
	move.w	#1,pt_go
	clr.w	pt_cou

	moveq	#0,d0
	move.w	pt_listpos(pc),d0
	move.w	d0,d1
	add.w	#22,d0
	divu	#25,d0
	swap	d0
	mulu	#44*9,d0
	add.w	#textbpl&$ffff,d0
	move.w	d0,pt_nyradpoi

	moveq	#0,d0
	add.w	#23,d1
	move.w	d1,d0		;move.w	pt_listpos(pc),d0
	divu	#25,d0
	swap	d0
	mulu	#44*9,d0
	add.l	#textbpl+13+44,d0
	move.l	d0,pt_prbplpoi

	move.w	pt_textradno(pc),d1
	add.w	#23,d1
	add.w	d1,d1
	lea	tunepois,a0
	move.w	(a0,d1.w),d0
	move.l	TextBase(pc),a0
	lea	(a0,d0.w),a0
	move.l	a0,pt_prtextpoi
	move.l	#PrintTextRow,KorDennaRutEfterVbl
	lea	menu2,a0
	moveq	#-1,d0
	move.w	d0,10+[$07*44](a0)
	move.w	d0,10+[$08*44](a0)
	move.w	d0,10+[$09*44](a0)
	move.w	d0,10+[$0a*44](a0)
	move.w	d0,10+[$0b*44](a0)
	move.w	d0,10+[$0c*44](a0)
	move.w	d0,10+[$0d*44](a0)
	move.w	d0,10+[$0e*44](a0)
	move.w	#$fc00,10+[$13*44](a0)
	move.w	#$fe01,10+[$14*44](a0)
	move.w	#$fe01,10+[$15*44](a0)
	move.w	#$ff03,10+[$16*44](a0)
	move.w	#$ff03,10+[$17*44](a0)
	move.w	#$ff87,10+[$18*44](a0)
	move.w	#$ff87,10+[$19*44](a0)
	move.w	#$ffcf,10+[$1a*44](a0)
	rts


bu_pilner:	;scrollupp
	tst.w	pt_go
	bne	rts
	tst.w	NewMenuPrintUnderArbete
	bne	rts
	tst.w	pt_TextRadNo
	beq	rts	;bu_nonewprint
	move.w	#-1,pt_go
	clr.w	pt_cou

	moveq	#0,d0
	move.w	pt_listpos(pc),d0
	move.w	d0,d1
	subq.w	#1,d0
	divu	#25,d0
	swap	d0
	mulu	#44*9,d0
	add.w	#textbpl&$ffff,d0
	move.w	d0,pt_nyradpoi

	move.w	Pt_textRadNo(pc),d0
	sub.w	#2,d0
	bmi	bu_nonewprint
	subq.w	#2,d1
	moveq	#0,d0
	move.w	d1,d0		;move.w	pt_listpos(pc),d0
	divu	#25,d0
	swap	d0
	mulu	#44*9,d0
	add.l	#textbpl+13+44,d0
	move.l	d0,pt_prbplpoi

	move.w	pt_TextRadNo(pc),d1
	subq.w	#2,d1
	add.w	d1,d1
	lea	tunepois,a0
	move.w	(a0,d1.w),d0
	move.l	TextBase(pc),a0
	lea	(a0,d0.w),a0
	move.l	a0,pt_prtextpoi
	move.l	#PrintTextRow,KorDennaRutEfterVbl
bu_nonewprint:
	lea	menu2,a0
	moveq	#-1,d0
	move.w	d0,10+[$13*44](a0)
	move.w	d0,10+[$14*44](a0)
	move.w	d0,10+[$15*44](a0)
	move.w	d0,10+[$16*44](a0)
	move.w	d0,10+[$17*44](a0)
	move.w	d0,10+[$18*44](a0)
	move.w	d0,10+[$19*44](a0)
	move.w	d0,10+[$1a*44](a0)
	move.w	#$fc00,10+[$0e*44](a0)
	move.w	#$fe01,10+[$0d*44](a0)
	move.w	#$fe01,10+[$0c*44](a0)
	move.w	#$ff03,10+[$0b*44](a0)
	move.w	#$ff03,10+[$0a*44](a0)
	move.w	#$ff87,10+[$09*44](a0)
	move.w	#$ff87,10+[$08*44](a0)
	move.w	#$ffcf,10+[$07*44](a0)
	rts

bu_scrollen:
	cmp.w	#1,bu_leftcou
	bne	rts
	eor.w	#1,sc_onoff
	rts

bu_play:cmp.w	#1,PlayMode
	beq	rts
	tst.w	PlaySelgo
	bne	rts
	move.w	#1,PlaySelgo
	move.w	#1,PlayMode
	rts
bu_Lplay:
	cmp.w	#2,PlayMode
	beq.s	.sel
	tst.w	PlaySelgo
	bne	rts
	move.w	#$8001,PlaySelgo
	move.w	#2,PlayMode
	rts
.sel:	cmp.w	#1,bu_leftcou
	bne	rts
	eor.l	#$01010101,.s
	move.l	.s(pc),d0
	lea	LongPlayOnOffs-4(pc),a0
	moveq	#[112/$10]-1,d7
.l:	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	dbf	d7,.l
	rts

.s:	dc.l	$01010101

Bu_tunes:	moveq	#0,d0
		bra.s	bu_menu
Bu_instr:	moveq	#1,d0
		bra.s	bu_menu
Bu_greets:	moveq	#2,d0
		bra.s	bu_menu
Bu_addr:	moveq	#3,d0
		bra.s	bu_menu
Bu_prefs:	moveq	#4,d0
		bra.s	bu_menu
Bu_future:	moveq	#5,d0
		bra.s	bu_menu
Bu_love:	moveq	#7,d0
		clr.w	bu_goLove

Bu_menu:clr.w	ActKey
	cmp.w	MenuMode(pc),d0	;samma menu?
	beq	rts
	tst.w	PlaySelGo	;ej samt som play/Lplay+menusel change
	bne	rts
	tst.w	pt_go		;ej samtidigt som scrollning av text
	bne	rts
	tst.w	NewMenuPrintUnderArbete
	bne	rts
	move.w	MenuMode(pc),OldMenuMode
	move.w	d0,MenuMode
	move.w	#$c000,PlaySelGo
	asl.w	#2,d0
	lea	MenuSelScrPos(pc),a0
	move.l	(a0,d0.w),MenuSelPois
	move.w	OldMenuMode(pc),d1
	asl.w	#2,d1
	move.l	(a0,d1.w),MenuSelPois+4
	lea	MenuSelSeq(pc),a0
	lea	MenuSelSeq2(pc),a1
	cmp.w	d0,d1
	ble.s	Menu_Upe
	exg	a0,a1
Menu_Upe:
	move.l	a1,MenuSelSeqPoi
	move.w	OldMenuMode(pc),d0
	add.w	d0,d0
	lea	pt_textposes(pc),a0
	move.w	pt_TextRadNo(pc),(a0,d0.w)

	move.w	MenuMode(pc),d0
	add.w	d0,d0
	move.w	(a0,d0.w),pt_TextRadNo

	add.w	d0,d0
	lea	pt_textbases(pc),a0
	move.l	(a0,d0.w),TextBase
	lea	pt_colbases(pc),a0
	move.l	(a0,d0.w),pt_allcolpoi

	move.l	#pt_textinit,KorDennaRutEfterVbl
	move.w	#1,NewMenuPrintUnderArbete
	rts

MenuSelScrPos:
	dc.l	menu1+[44*$79]+2
	dc.l	menu1+[44*$79]+6
	dc.l	menu1+[44*$82]+2
	dc.l	menu1+[44*$82]+6
	dc.l	menu1+[44*$8b]+2
	dc.l	menu1+[44*$8b]+6
	dc.l	menu1+[44*$8b]+2	;tom
	dc.l	menu1+[44*$8b]+6	;love

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

PlayMode:	dc.w	1	;1=play 2=LongPlay
MenuMode:	dc.w	0	;0=tunes  1=instr
				;2=greets 3=addr
				;4=prefs  5=future
				;	  7=love
PlaySelgo:	dc.w	0
OldMenuMode:	dc.w	0
MenuSelPois:	dc.l	0,0
MenuSelSeqPoi:	dc.l	MenuSelSeq
MenuSelSeq:	dc.w	44*5,4,44*4,4,44*3,4,44*2,4,44*1,4,44*0,4
		dc.w	44*5,0,44*4,0,44*3,0,44*2,0,44*1,0,44*0,0
		dc.l	-1
MenuSelSeq2:	dc.w	44*0,4,44*1,4,44*2,4,44*3,4,44*4,4,44*5,4
		dc.w	44*0,0,44*1,0,44*2,0,44*3,0,44*4,0,44*5,0
		dc.l	-1

Menu_MenuModeSel:
	and.w	#$3fff,d0
	asl.w	#2,d0
	move.l	MenuSelSeqPoi(pc),a0
	lea	(a0,d0.w),a0
	lea	MenuSelPois(pc),a1
	move.w	2(a0),d0
	bmi.L	Menu_EndSel
	addq.w	#1,PlaySelGo
	move.l	(a1,d0.w),a1
	move.w	(a0)+,d0
	lea	(a1,d0.w),a1
	lea	Menu2-Menu1(a1),a2
	tst.w	(a0)
	beq.s	Menu_Rita
	move.w	OldMenuMode(pc),d0
	and.w	#1,d0
	bne.s	Menu_Rad2Sudd
	move.l	(a1),d0
	move.l	(a2),d1
	not.l	d1
	and.l	d1,d0
	and.l	#$03ffffff,d0
	or.l	d0,(a2)
	move.w	4(a1),d0
	move.w	4(a2),d1
	not.w	d1
	and.w	d1,d0
	and.w	#$fff0,d0
	or.w	d0,4(a2)
	rts
Menu_Rad2Sudd:
	move.l	(a1),d0
	move.l	(a2),d1
	not.l	d1
	and.l	d1,d0
	and.l	#$000fffff,d0
	or.l	d0,(a2)
	move.l	4(a1),d0
	move.l	4(a2),d1
	not.l	d1
	and.l	d1,d0
	and.l	#$ffffc000,d0
	or.l	d0,4(a2)
	rts

Menu_Rita:
	move.w	MenuMode(pc),d0
	and.w	#1,d0
	bne.s	Menu_Rad2Rita
	move.l	(a1),d0
	and.l	(a2),d0
	not.l	d0
	or.l	#$fc000000,d0
	and.l	d0,(a2)
	move.w	4(a1),d0
	and.w	4(a2),d0
	not.w	d0
	or.w	#$000f,d0
	and.w	d0,4(a2)
	rts
Menu_Rad2Rita:
	move.l	(a1),d0
	and.l	(a2),d0
	not.l	d0
	or.l	#$fff00000,d0
	and.l	d0,(a2)
	move.l	4(a1),d0
	and.l	4(a2),d0
	not.l	d0
	or.l	#$00007fff,d0
	and.l	d0,4(a2)
	rts

PlaySeq:dc.b 0,$3f,0,$13,"Y",0,0,0
	dc.b 0,$36,0,$13,"A",0,0,0
	dc.b 0,$2d,0,$13,"L",0,0,0
	dc.b 0,$24,0,$13,"P",0,0,0
	dc.b 0,$20,0,$13,".",0,0,0
	dc.b 0,$17,0,$13,"L",0,0,0
	dc.b 0,$17,0,$07,"P",0,0,1
	dc.b 0,$20,0,$07,"L",0,0,1
	dc.b 0,$29,0,$07,"A",0,0,1
	dc.b 0,$32,0,$07,"Y",0,0,1
	dc.l -1,-1
LPlaySeq:
	dc.b 0,$32,0,$07,"Y",0,0,0
	dc.b 0,$29,0,$07,"A",0,0,0
	dc.b 0,$20,0,$07,"L",0,0,0
	dc.b 0,$17,0,$07,"P",0,0,0
	dc.b 0,$17,0,$13,"L",0,0,1
	dc.b 0,$20,0,$13,".",0,0,1
	dc.b 0,$24,0,$13,"P",0,0,1
	dc.b 0,$2d,0,$13,"L",0,0,1
	dc.b 0,$36,0,$13,"A",0,0,1
	dc.b 0,$3f,0,$13,"Y",0,0,1
	dc.l -1,-1

Menu_rut:
	move.w	PlaySelgo(pc),d0
	beq.s	Menu_1
	bmi.s	Menu_Lplaysel

	asl.w	#3,d0
	lea	PlaySeq-8(pc),a0
	lea	(a0,d0.w),a0
	move.w	(a0)+,pr_xpos
	bmi.s	Menu_endSel
	move.w	(a0)+,pr_ypos
	tst.w	2(a0)
	beq.s	menu_2
	bsr	Print1
	bra.s	Menu_3
Menu_2:	bsr	Print3
menu_3:	addq.w	#1,PlaySelGo
	rts
menu_endsel:
	clr.w	PlaySelGo
	rts

Menu_LplaySel:
	cmp.w	#$c000,d0
	bge	Menu_MenuModeSel
	and.w	#$3fff,d0
	asl.w	#3,d0
	lea	LPlaySeq-8(pc),a0
	lea	(a0,d0.w),a0
	move.w	(a0)+,pr_xpos
	bmi.s	Menu_endSel
	move.w	(a0)+,pr_ypos
	tst.w	2(a0)
	beq.s	menu_4
	bsr	Print1
	bra.s	Menu_5
Menu_4:	bsr	Print3
menu_5:	addq.w	#1,PlaySelGo
	rts

Menu_1:	rts

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

sc_poi:	dc.l	dummy
sc_cou:	dc.w	$0
sc_jmps:dc.l	sc_0,sc_1,sc_2,sc_3
sc_wait:dc.w	1
sc_onoff:dc.w	1

sc_rut:	tst.w	sc_onoff
	beq	rts
	tst.w	tuneinmemory
	beq	rts
	tst.l	mt_data
	beq	rts
	subq.w	#1,sc_wait
	bne	rts
	move.w	#1,sc_wait
	lea	$dff000,a6
	move.w	sc_cou(pc),d0
	addq.w	#4,sc_cou
	and.w	#$e,sc_cou
	lea	sc_jmps(pc),a0
	move.l	(a0,d0.w),a0
	jmp	(a0)

sc_0:	move.l	sc_poi(pc),a0
	moveq	#0,d0
sc_a:	move.b	(a0)+,d0
	bne.s	sc_cont
	move.l	tunedatadest,a0
	bra.s	sc_a
sc_cont:cmp.b	#$0a,d0	;return=inget
	beq.s	sc_a

	cmp.b	#$b4,d0	;xerxes j-a apostrof
	bne.s	.e
	moveq	#$27,d0
.e:
	cmp.b	#$f6,d0	;litet o
	bne.s	.noo
	moveq	#$7d,d0
.noo:	cmp.b	#$e4,d0	;litet ae
	bne.s	.noae
	moveq	#$7c,d0
.noae:	cmp.b	#$e5,d0	;litet ao
	bne.s	.noao
	moveq	#$7b,d0
.noao:
	cmp.b	#$d6,d0	;stort o
	bne.s	.eoo
	moveq	#$5d,d0
.eoo:	cmp.b	#$c4,d0	;stort ae
	bne.s	.eoae
	moveq	#$5c,d0
.eoae:	cmp.b	#$c5,d0	;stort ao
	bne.s	.eoao
	moveq	#$5b,d0
.eoao:
	move.l	a0,sc_poi
	sub.w	#$20,d0
	cmp.w	#$40,d0
	blt.s	sc_55
	sub.w	#$20,d0
sc_55:	and.w	#$3f,d0
	move.l	d0,d1
	and.w	#$f,d0
	asl.w	#$2,d0
	and.w	#$30,d1
	asl.w	#$6,d1
	add.w	d1,d0
	add.l	#fontR,d0
sc_b:	btst	#14,$02(a6)
	bne.s	sc_b
	move.l	d0,$50(a6)
	move.l	#sc_screen1+46+44,$54(a6)
	move.l	#$09f00000,$40(a6)
	move.l	#-1,$44(a6)
	move.l	#$003c005c,$64(a6)
	move.w	#[$10*$40]+2,$58(a6)
sc_c:	btst	#14,$02(a6)
	bne.s	sc_c
	add.l	#$1000,d0
	move.l	d0,$50(a6)
	move.l	#sc_screen2+46+44,$54(a6)
	move.l	#$09f00000,$40(a6)
	move.l	#-1,$44(a6)
	move.l	#$003c005c,$64(a6)
	move.w	#[$10*$40]+2,$58(a6)

sc_d:	btst	#14,$02(a6)
	bne.s	sc_d
	move.l	#sc_screen1-4,$54(a6)
	move.l	#sc_screen1,$50(a6)
	move.l	#$09f00000,$40(a6)
	move.l	#-1,$44(a6)
	move.l	#$00000000,$64(a6)
	move.w	#[$6*$40]+[96/2],$58(a6)

	subq.w	#2,sc_p1+6
	addq.w	#2,sc_p11+6
	addq.w	#2,sc_p2+6
	addq.w	#2,sc_p12+6
	move.w	#$44,sc_sid+2
	rts

sc_1:	btst	#14,$02(a6)
	bne.s	sc_1
	move.l	#sc_screen1+[$6*96]-4,$54(a6)
	move.l	#sc_screen1+[$6*96],$50(a6)
	move.l	#$09f00000,$40(a6)
	move.l	#-1,$44(a6)
	move.l	#$00000000,$64(a6)
	move.w	#[$a*$40]+[96/2],$58(a6)
	subq.w	#4,sc_p11+6
	move.w	#$00,sc_sid+2
	rts

sc_2:	btst	#14,$02(a6)
	bne.s	sc_2
	move.l	#sc_screen2-4,$54(a6)
	move.l	#sc_screen2,$50(a6)
	move.l	#$09f00000,$40(a6)
	move.l	#-1,$44(a6)
	move.l	#$00000000,$64(a6)
	move.w	#[$8*$40]+[96/2],$58(a6)
	addq.w	#2,sc_p1+6
	addq.w	#2,sc_p11+6
	subq.w	#2,sc_p2+6
	addq.w	#2,sc_p12+6
	move.w	#$44,sc_sid+2
	rts

sc_3:	btst	#14,$02(a6)
	bne.s	sc_3
	move.l	#sc_screen2+[$8*96]-4,$54(a6)
	move.l	#sc_screen2+[$8*96],$50(a6)
	move.l	#$09f00000,$40(a6)
	move.l	#-1,$44(a6)
	move.l	#$00000000,$64(a6)
	move.w	#[$8*$40]+[96/2],$58(a6)
	subq.w	#4,sc_p12+6
	move.w	#$00,sc_sid+2
	rts

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

Dot_xpos:	dc.w $13
Dot_ypos:	dc.w $03*44

Dot_cou:	dc.w 1
Dot_dir:	dc.w 0
Dot_poi:	dc.l Dot_dat

Dot_oldPosses:	blk.l	$20,$00130000+[$11*44]
Dot_Draw:	dc.w	$7c
Dot_Erase:	dc.w	$50

Dot_dat:	;0=hoger, 1=vanster 2=ner 3=upp
dc.b$a5,2,$51,0,$a5,3,$51,1,$a5,2,$51,0,$a5,3,$51,1
dc.b $a5,2,$51,0,$10,3,$51,1,$10,2,$51,0,$10,3,$51,1,$22,3
dc.b $51,0,$05,3,$51,1,$6e,3
dc.b $51,0,$1a,2,$51,1,$05,2,$51,0,$05,3
dc.b $51,1,$05,2,$51,0,$05,3,$51,1,$05,2,$51,0
dc.b $86,2,$51,1,$10,3,$51,0,$95,3,$51,1
dc.b 0,0

Dot_rut:subq.w	#1,Dot_cou
	bne.s	Dot_nonewdir
	move.l	Dot_poi(pc),a0
	moveq	#0,d0
	move.b	(a0)+,d0
	bne.s	Dot_NoEnd
	lea	Dot_dat(pc),a0
	move.b	(a0)+,d0
Dot_NoEnd:
	move.w	d0,Dot_cou
	move.b	(a0)+,Dot_dir+1
	move.l	a0,Dot_poi
Dot_nonewdir:

	move.w	Dot_dir(pc),d0
	bne.s	Dot_nothoger
	addq.w	#1,Dot_xpos
	bra.s	Dot_1
Dot_notHoger:
	subq.w	#1,d0
	bne.s	Dot_notVanster
	subq.w	#1,Dot_xpos
	bra.s	Dot_1
Dot_notVanster:
	subq.w	#1,d0
	bne.s	Dot_notNer
	add.w	#44,Dot_ypos
	bra.s	Dot_1
Dot_notNer:
	sub.w	#44,Dot_ypos

Dot_1:	lea	menu1,a0
	lea	menu2,a1
	move.w	Dot_xpos(pc),d0
	move.w	d0,d1
	not.w	d1
	and.w	#$7,d1
	lsr.w	#3,d0
	add.w	Dot_ypos(pc),d0
	bset	d1,(a0,d0.w)
	bclr	d1,(a1,d0.w)

	lea	Dot_oldPosses(pc),a2
	move.w	Dot_draw(pc),d3
	move.w	Dot_erase(pc),d2
	move.l	Dot_xPos(pc),(a2,d3.w)
	subq.w	#4,d3
	and.w	#$7e,d3

	move.w	(a2,d3.w),d0
	move.w	d0,d1
	not.w	d1
	and.w	#$7,d1
	lsr.w	#3,d0
	add.w	2(a2,d3.w),d0
	bset	d1,(a1,d0.w)

	move.w	(a2,d2.w),d0
	move.w	d0,d1
	not.w	d1
	and.w	#$7,d1
	lsr.w	#3,d0
	add.w	2(a2,d2.w),d0
	bclr	d1,(a0,d0.w)
	bset	d1,(a1,d0.w)

	addq.w	#4,Dot_draw
	and.w	#$7e,Dot_draw
	addq.w	#4,Dot_erase
	and.w	#$7e,Dot_erase
	rts

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

Window_maker:
	;d0=xpos i bytes
	;d1=ypos i pix
	;d2=xbredd i bytes
	;d3=yhojd i pix
	lea	menu1,a0
	lea	menu2,a1
	mulu	#44,d1
	add.w	d1,d0
	lea	(a0,d0.w),a0
	lea	(a1,d0.w),a1

	moveq	#1,d4		;oversta 2 raderna
	move.w	d2,d5
	move.b	#%11111111,(a0)
	move.b	#%00000000,(a1)
	move.b	#%11111111,44(a0)
	move.b	#%00000000,44(a1)
	bra.s	wi_loi
wi_lop:	move.b	#%11111111,(a0,d4.w)
	move.b	#%00000000,(a1,d4.w)
	move.b	#%11111111,44(a0,d4.w)
	move.b	#%00000000,44(a1,d4.w)
	addq.w	#1,d4
wi_loi:	dbf	d5,wi_lop
	move.b	#%11111110,(a0,d4.w)
	move.b	#%00000001,(a1,d4.w)
	move.b	#%11111101,44(a0,d4.w)
	move.b	#%00000011,44(a1,d4.w)
	lea	44*2(a0),a0
	lea	44*2(a1),a1

	move.w	d3,d6		;mittenfaltet
	bra.s	wi_loi3
wi_lop3:
	moveq	#1,d4
	move.w	d2,d5
	move.b	#%11000000,(a0)
	move.b	#%00111111,(a1)
	bra.s	wi_loi2
wi_lop2:move.b	#%00000000,(a0,d4.w)
	move.b	#%11111111,(a1,d4.w)
	addq.w	#1,d4
wi_loi2:dbf	d5,wi_lop2
	move.b	#%00000011,(a0,d4.w)
	move.b	#%11111111,(a1,d4.w)
	lea	44(a0),a0
	lea	44(a1),a1
wi_loi3:dbf	d6,wi_lop3

	moveq	#1,d4		;understa 2 raderna
	move.w	d2,d5
	move.b	#%10111111,(a0)
	move.b	#%01111111,(a1)
	move.b	#%01111111,44(a0)
	move.b	#%11111111,44(a1)
	bra.s	wi_loi5
wi_lop5:move.b	#%11111111,(a0,d4.w)
	move.b	#%11111111,(a1,d4.w)
	move.b	#%11111111,44(a0,d4.w)
	move.b	#%11111111,44(a1,d4.w)
	addq.w	#1,d4
wi_loi5:dbf	d5,wi_lop5
	move.b	#%11111111,(a0,d4.w)
	move.b	#%11111111,(a1,d4.w)
	move.b	#%11111111,44(a0,d4.w)
	move.b	#%11111111,44(a1,d4.w)
	rts


Menu_init:
	lea	menu1,a0
	lea	menu2,a1
	move.w	#[[menu2-menu1]/2]-1,d7
me_lo:	clr.w	(a0)+
	clr.w	(a1)+
	dbf	d7,me_lo

	moveq	#2,d0	;x-bytes
	moveq	#$00,d1	;y-pix
	move.w	#9,d2	;x-bredd
	move.w	#$a8,d3	;y-pixhojd
	bsr	window_maker

	lea	menu1+[$95*44]+3,a0
	move.b	#-1,(a0)+
	move.l	#-1,(a0)+
	move.l	#-1,(a0)
	lea	menu1+[$96*44]+3,a0
	lea	menu2-menu1(a0),a1
	move.b	#-1,(a0)+
	move.l	#-1,(a0)+
	move.l	#-1,(a0)
	clr.b	(a1)+
	clr.l	(a1)+
	clr.l	(a1)+

	lea	menu1+[$73*44]+3,a0
	move.b	#-1,(a0)+
	move.l	#-1,(a0)+
	move.l	#-1,(a0)
	lea	menu1+[$74*44]+3,a0
	lea	menu2-menu1(a0),a1
	move.b	#-1,(a0)+
	move.l	#-1,(a0)+
	move.l	#-1,(a0)
	clr.b	(a1)+
	clr.l	(a1)+
	clr.l	(a1)+

	lea	menu1+[$1f*44]+3,a0
	move.b	#-1,(a0)+
	move.l	#-1,(a0)+
	move.l	#-1,(a0)
	lea	menu1+[$20*44]+3,a0
	lea	menu2-menu1(a0),a1
	move.b	#-1,(a0)+
	move.l	#-1,(a0)+
	move.l	#-1,(a0)
	clr.b	(a1)+
	clr.l	(a1)+
	clr.l	(a1)+

	lea	menu1+[$30*44]+3,a0
	move.b	#-1,(a0)+
	move.l	#-1,(a0)+
	move.l	#-1,(a0)
	lea	menu1+[$31*44]+3,a0
	lea	menu2-menu1(a0),a1
	move.b	#-1,(a0)+
	move.l	#-1,(a0)+
	move.l	#-1,(a0)
	clr.b	(a1)+
	clr.l	(a1)+
	clr.l	(a1)+

	lea	MenuText(pc),a0
	bsr	print3
	lea	MenuSelText(pc),a0
	bsr	print1
	bsr	GetCal

	tst.w	CalNotValid
	bne	.printIkkeKlocka

	bsr	.kolladatum
	tst.w	CalNotValid
	bne	rts

	lea	VeckoPois(pc),a0
	move.w	veckodag(pc),d0
	asl.w	#2,d0
	move.l	(a0,d0.w),a0
	bsr	print1

	lea	dagge(pc),a1
	lea	manadsdag(pc),a0
	move.w	datnr(pc),d0
	add.w	d0,d0
	move.w	(a1,d0.w),(a0)
	move.w	#$13,pr_xpos
	move.w	#$9f,pr_ypos
	bsr	print1

	lea	months-4(pc),a0
	move.w	monnr(pc),d0
	asl.w	#2,d0
	lea	(a0,d0.w),a0
	move.w	#$22,pr_xpos
	move.w	#$9f,pr_ypos
	bsr	print1

	lea	timme1(pc),a0
	move.w	#$39,pr_xpos
	bsr	print1
	lea	timme2(pc),a0
	move.w	#$3f,pr_xpos
	bsr	print1
	lea	kolon(pc),a0
	move.w	#$45,pr_xpos
	bsr	print1
	lea	minut1(pc),a0
	move.w	#$48,pr_xpos
	bsr	print1
	lea	minut2(pc),a0
	move.w	#$4e,pr_xpos
	bsr	print1
	lea	kolon(pc),a0
	move.w	#$54,pr_xpos
	bsr	print1
	lea	sekund1(pc),a0
	move.w	#$57,pr_xpos
	bsr	print1
	lea	sekund2(pc),a0
	move.w	#$5d,pr_xpos
	bsr	print1
	rts

.PrintIkkeKlocka:
	lea	.IkkeKlockaText(pc),a0
	bra	print1


.kolladatum:
	move.w	dayno(pc),d0
	lea	.datumlist(pc),a0

.kd:	cmp.w	(a0),d0
	bne.s	.not
	move.w	2(a0),d1
	lea	.t(pc),a0
	lea	(a0,d1.w),a0
	addq.w	#1,CalNotValid
	bra	print1

.not:	tst.l	(a0)+
	tst.w	(a0)
	bpl.s	.kd

	cmp.w	#13,datnr
	bne.s	.y
	cmp.w	#4,veckodag
	bne.s	.y
	addq.w	#1,CalNotValid
	lea	.Friday13(pc),a0
	bra	Print1
	
.y:	cmp.w	#12,monnr
	bne.s	.u
	cmp.w	#24,datnr
	bne.s	.tu
	addq.w	#1,CalNotValid
	lea	.Xmas(pc),a0
	bra	Print1
.tu:	cmp.w	#25,datnr
	bne.s	.u
	addq.w	#1,CalNotValid
	lea	.Xmas(pc),a0
	bra	Print1
.u:
	rts


.datumlist:
	dc.w $0507,.gut91-.t
	dc.w $0517,.john91-.t
	dc.w $051d,.john-.t
	dc.w $0531,.sch-.t
	dc.w $0532,.glu-.t
	dc.w $0555,.jos-.t
	dc.w $05b6,.kak92-.t
	dc.w $05c0,.min92-.t
	dc.w $0637,.pan92-.t
	dc.w $063d,.helene-.t
	dc.w $0724,.kak93-.t
	dc.w $072e,.min93-.t
	dc.w -1

.t:
.john91:dc.b $ff,$80,$3b,$98,"ziphoid's"
	dc.b $ff,$80,$3b,$9f,"birthday!!!",0
.pan92:	dc.b $ff,$80,$3b,$98,"panda's 19th"
	dc.b $ff,$80,$3b,$9f,"birthday!!!",0
.jos:	dc.b $ff,$80,$3b,$98,"josefin's 17th"
	dc.b $ff,$80,$3b,$9f,"birthday!!!",0
.glu:	dc.b $ff,$80,$3b,$98,"gluemaster's"
	dc.b $ff,$80,$3b,$9f,"birthday!!!",0
.sch:	dc.b $ff,$80,$3b,$98,"school starts"
	dc.b $ff,$80,$3b,$9f,"here in lund!",0
.john:	dc.b $ff,$80,$3b,$98,"ziphoid moves"
	dc.b $ff,$80,$3b,$9f,"to a new house",0
.gut91:	dc.b $ff,$80,$3b,$98,"today guts is"
	dc.b $ff,$80,$3b,$9f,"17 years old!!",0
.kak92:	dc.b $ff,$80,$3b,$98,"kaktus' 20th"
	dc.b $ff,$80,$3b,$9f,"birthday!!",0
.kak93:	dc.b $ff,$80,$3b,$98,"kaktus' 21st"
	dc.b $ff,$80,$3b,$9f,"birthday!!",0
.min92:	dc.b $ff,$80,$3b,$98,"my 18th"
	dc.b $ff,$80,$3b,$9f,"birthday!!",0
.min93:	dc.b $ff,$80,$3b,$98,"my 19th"
	dc.b $ff,$80,$3b,$9f,"birthday!!",0
.helene:dc.b $ff,$80,$3b,$98,"helene's 18th"
	dc.b $ff,$80,$3b,$9f,"birthday!!",0

.Xmas:	dc.b $ff,$80,$3b,$98,"merry"
	dc.b $ff,$80,$3b,$9f,"christmas!!!",0
.friday13:
	dc.b $ff,$80,$3b,$98,"beware of"
	dc.b $ff,$80,$3b,$9f,"friday 13th!!",0
.IkkeKlockaText:
	dc.b $ff,$80,$3b,$98,"his master's"
	dc.b $ff,$80,$3b,$9f,"noise 1991",0

MenuSelText:	dc.b $ff,$00,$17,$07,"PLAY"
		dc.b $ff,$00,$57,$25,$08	;stop-button
		dc.b $ff,$00,$15,$77,"tunes"
		dc.b 0
Menutext:	dc.b $ff,$00,$55,$07,$09,$0a
		dc.b $ff,$00,$17,$13,"L.PLAY",$ff,$00,$55,$13,$0b,$0c
		dc.b $ff,$00,$17,$25,$01,$02,$03,$04,$05,$06,$07
		dc.b $ff,$00,$45,$77,"instr"
		dc.b $ff,$00,$15,$80,"greets",$ff,$00,$49,$80,"addr"
		dc.b $ff,$00,$15,$89,"prefs",$ff,$00,$3c,$89,"future"
		dc.b 0
Mandag:	dc.b $ff,$00,$1d,$98,"monday the",0
Tisdag:	dc.b $ff,$00,$19,$98,"tuesday the",0
Onsdag:	dc.b $ff,$00,$14,$98,"wednesday the",0
Torsdag:dc.b $ff,$00,$17,$98,"thursday the",0
Fredag:	dc.b $ff,$00,$1e,$98,"friday the",0
Lordag:	dc.b $ff,$00,$17,$98,"saturday the",0
Sondag:	dc.b $ff,$00,$1d,$98,"sunday the",0
even
Manadsdag:	dc.w	0,0	;har laggs printet
Dagge:		dc.b "0001020304050607080910111213141516171819202122232425262728293031"
Months:		dc.b "jan",0,"feb",0,"mar",0,"apr",0,"may",0,"jun",0
		dc.b "jul",0,"aug",0,"sep",0,"oct",0,"nov",0,"dec",0
VeckoPois:	dc.l Mandag,Tisdag,Onsdag,Torsdag,Fredag,Lordag,Sondag

trydatum=0
year:		dc.w	1991	;ar 1988-2087
monnr:		dc.w	1	;manad 1-12
datnr:		dc.w	11	;datum 1-31
dayno:		dc.w	0	;dag sedan 1 jan 1988
veckodag:	dc.w	0	;veckodag 0-6
timme1:		dc.b	"2",0
timme2:		dc.b	"3",0
minut1:		dc.b	"5",0
minut2:		dc.b	"9",0
sekund1:	dc.b	"3",0
sekund2:	dc.b	"8",0
kolon:		dc.b	":",0
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
pr_xpos:	dc.w	0
pr_ypos:	dc.w	0

print3:	moveq	#0,d0
	move.b	(a0)+,d0
	beq	pr_end3
	cmp.b	#$ff,d0
	bne.s	pr_nopos3
	move.b	(a0)+,d0
	bpl.s	nocenter
	and.b	#$7f,d0
	move.b	d0,pr_xpos
	move.b	(a0)+,pr_xpos+1
	move.b	(a0)+,pr_ypos+1

	move.l	a0,a1		;calc mitten, sub xpos!
	moveq	#0,d0
	moveq	#0,d1
	lea	sfontbredds(pc),a2
pr3l:	move.b	(a1)+,d0
	beq.s	pr3e
	bmi.s	pr3e
	add.b	(a2,d0.w),d1
	bra.s	pr3l
pr3e:	lsr.w	#1,d1
	sub.w	d1,pr_xpos
	bra.s	print3

nocenter:move.b	d0,pr_xpos
	move.b	(a0)+,pr_xpos+1
	move.b	(a0)+,pr_ypos+1
	bra.s	print3
pr_nopos3:
	lea	menu1,a1
	move.w	pr_xpos(pc),d1
	move.w	d1,d7
	and.w	#$7,d7
	eor.w	#$7,d7
	lsr.w	#3,d1
	move.w	pr_ypos(pc),d2
	;mulu	#44,d2
	lea	mulu44(pc),a3
	add.w	d2,d2
	add.w	(a3,d2.w),d1
	lea	(a1,d1.w),a1
	lea	menu2-menu1(a1),a3
	lea	sfontbredds(pc),a2
	moveq	#0,d2
	move.b	(a2,d0.w),d2
	add.w	d2,pr_xpos
	move.w	d0,d1
	and.w	#$1f,d0
	and.w	#$e0,d1
	asl.w	#$3,d1
	add.w	d0,d1
	lea	sfontr,a2
	lea	(a2,d1.w),a2
	moveq	#0,d0
	moveq	#0,d1
	moveq	#0,d2
	moveq	#0,d3
	moveq	#0,d4
	moveq	#0,d5
	moveq	#0,d6
	move.b	$20*0(a2),d0
	move.b	$20*1(a2),d1
	move.b	$20*2(a2),d2
	move.b	$20*3(a2),d3
	move.b	$20*4(a2),d4
	move.b	$20*5(a2),d5
	move.b	$20*6(a2),d6
	asl.w	d7,d0
	asl.w	d7,d1
	asl.w	d7,d2
	asl.w	d7,d3
	asl.w	d7,d4
	asl.w	d7,d5
	asl.w	d7,d6
	or.b	d0,44*0+1(a1)
	or.b	d1,44*1+1(a1)
	or.b	d2,44*2+1(a1)
	or.b	d3,44*3+1(a1)
	or.b	d4,44*4+1(a1)
	or.b	d5,44*5+1(a1)
	or.b	d6,44*6+1(a1)
	or.b	d0,44*0+1(a3)
	or.b	d1,44*1+1(a3)
	or.b	d2,44*2+1(a3)
	or.b	d3,44*3+1(a3)
	or.b	d4,44*4+1(a3)
	or.b	d5,44*5+1(a3)
	or.b	d6,44*6+1(a3)
	lsr.w	#$8,d0
	lsr.w	#$8,d1
	lsr.w	#$8,d2
	lsr.w	#$8,d3
	lsr.w	#$8,d4
	lsr.w	#$8,d5
	lsr.w	#$8,d6
	or.b	d0,44*0(a1)
	or.b	d1,44*1(a1)
	or.b	d2,44*2(a1)
	or.b	d3,44*3(a1)
	or.b	d4,44*4(a1)
	or.b	d5,44*5(a1)
	or.b	d6,44*6(a1)
	or.b	d0,44*0(a3)
	or.b	d1,44*1(a3)
	or.b	d2,44*2(a3)
	or.b	d3,44*3(a3)
	or.b	d4,44*4(a3)
	or.b	d5,44*5(a3)
	or.b	d6,44*6(a3)
	moveq	#0,d0
	move.b	$20*7(a2),d0
	asl.w	d7,d0
	or.b	d0,44*7+1(a1)
	or.b	d0,44*7+1(a3)
	lsr.w	#$8,d0
	or.b	d0,44*7(a1)
	or.b	d0,44*7(a3)
	bra	print3
pr_end3:rts

print3double:
	moveq	#0,d0
	move.b	(a0)+,d0
	beq.s	pr_end3
	cmp.b	#$ff,d0
	bne.s	.pr_nopos3
	move.b	(a0)+,d0
	bpl.s	.nocenter
	and.b	#$7f,d0
	move.b	d0,pr_xpos
	move.b	(a0)+,pr_xpos+1
	move.b	(a0)+,pr_ypos+1

	move.l	a0,a1		;calc mitten, sub xpos!
	moveq	#0,d0
	moveq	#0,d1
	lea	sfontbredds(pc),a2
.pr3l:	move.b	(a1)+,d0
	beq.s	.pr3e
	bmi.s	.pr3e
	add.b	(a2,d0.w),d1
	bra.s	.pr3l
.pr3e:	lsr.w	#1,d1
	sub.w	d1,pr_xpos
	bra.s	print3double

.nocenter:move.b d0,pr_xpos
	move.b	(a0)+,pr_xpos+1
	move.b	(a0)+,pr_ypos+1
	bra.s	print3double
.pr_nopos3:
	lea	menu1,a1
	move.w	pr_xpos(pc),d1
	move.w	d1,d7
	and.w	#$7,d7
	eor.w	#$7,d7
	lsr.w	#3,d1
	move.w	pr_ypos(pc),d2
	;mulu	#44,d2
	lea	mulu44(pc),a3
	add.w	d2,d2
	add.w	(a3,d2.w),d1
	lea	(a1,d1.w),a1
	lea	menu2-menu1(a1),a3
	lea	sfontbredds(pc),a2
	moveq	#0,d2
	move.b	(a2,d0.w),d2
	add.w	d2,pr_xpos
	move.w	d0,d1
	and.w	#$1f,d0
	and.w	#$e0,d1
	asl.w	#$3,d1
	add.w	d0,d1
	lea	sfontr,a2
	lea	(a2,d1.w),a2
	moveq	#0,d0
	moveq	#0,d1
	moveq	#0,d2
	moveq	#0,d3
	moveq	#0,d4
	moveq	#0,d5
	moveq	#0,d6
	move.b	$20*0(a2),d0
	move.b	$20*1(a2),d1
	move.b	$20*2(a2),d2
	move.b	$20*3(a2),d3
	move.b	$20*4(a2),d4
	move.b	$20*5(a2),d5
	move.b	$20*6(a2),d6
	asl.w	d7,d0
	asl.w	d7,d1
	asl.w	d7,d2
	asl.w	d7,d3
	asl.w	d7,d4
	asl.w	d7,d5
	asl.w	d7,d6
	or.b	d0,44*0+1(a1)
	or.b	d0,44*1+1(a1)
	or.b	d1,44*2+1(a1)
	or.b	d1,44*3+1(a1)
	or.b	d2,44*4+1(a1)
	or.b	d2,44*5+1(a1)
	or.b	d3,44*6+1(a1)
	or.b	d3,44*7+1(a1)
	or.b	d4,44*8+1(a1)
	or.b	d4,44*9+1(a1)
	or.b	d5,44*10+1(a1)
	or.b	d5,44*11+1(a1)
	or.b	d6,44*12+1(a1)
	or.b	d6,44*13+1(a1)

	or.b	d0,44*0+1(a3)
	or.b	d0,44*1+1(a3)
	or.b	d1,44*2+1(a3)
	or.b	d1,44*3+1(a3)
	or.b	d2,44*4+1(a3)
	or.b	d2,44*5+1(a3)
	or.b	d3,44*6+1(a3)
	or.b	d3,44*7+1(a3)
	or.b	d4,44*8+1(a3)
	or.b	d4,44*9+1(a3)
	or.b	d5,44*10+1(a3)
	or.b	d5,44*11+1(a3)
	or.b	d6,44*12+1(a3)
	or.b	d6,44*13+1(a3)
	lsr.w	#$8,d0
	lsr.w	#$8,d1
	lsr.w	#$8,d2
	lsr.w	#$8,d3
	lsr.w	#$8,d4
	lsr.w	#$8,d5
	lsr.w	#$8,d6
	or.b	d0,44*0(a1)
	or.b	d0,44*1(a1)
	or.b	d1,44*2(a1)
	or.b	d1,44*3(a1)
	or.b	d2,44*4(a1)
	or.b	d2,44*5(a1)
	or.b	d3,44*6(a1)
	or.b	d3,44*7(a1)
	or.b	d4,44*8(a1)
	or.b	d4,44*9(a1)
	or.b	d5,44*10(a1)
	or.b	d5,44*11(a1)
	or.b	d6,44*12(a1)
	or.b	d6,44*13(a1)
	or.b	d0,44*0(a3)
	or.b	d0,44*1(a3)
	or.b	d1,44*2(a3)
	or.b	d1,44*3(a3)
	or.b	d2,44*4(a3)
	or.b	d2,44*5(a3)
	or.b	d3,44*6(a3)
	or.b	d3,44*7(a3)
	or.b	d4,44*8(a3)
	or.b	d4,44*9(a3)
	or.b	d5,44*10(a3)
	or.b	d5,44*11(a3)
	or.b	d6,44*12(a3)
	or.b	d6,44*13(a3)
	moveq	#0,d0
	move.b	$20*7(a2),d0
	asl.w	d7,d0
	or.b	d0,44*14+1(a1)
	or.b	d0,44*15+1(a1)
	or.b	d0,44*14+1(a3)
	or.b	d0,44*15+1(a3)
	lsr.w	#$8,d0
	or.b	d0,44*14(a1)
	or.b	d0,44*15(a1)
	or.b	d0,44*14(a3)
	or.b	d0,44*15(a3)
	bra	print3double
pr_end4:rts

print1:	moveq	#0,d0
	move.b	(a0)+,d0
	beq.s	pr_end4
	cmp.b	#$ff,d0
	bne.s	pr_nopos1
	move.b	(a0)+,d0
	bpl.s	no1center
	and.b	#$7f,d0
	move.b	d0,pr_xpos
	move.b	(a0)+,pr_xpos+1
	move.b	(a0)+,pr_ypos+1
	move.l	a0,a1		;calc mitten, sub xpos!
	moveq	#0,d0
	moveq	#0,d1
	lea	sfontbredds(pc),a2
pr1l:	move.b	(a1)+,d0
	beq.s	pr1e
	bmi.s	pr1e
	add.b	(a2,d0.w),d1
	bra.s	pr1l
pr1e:	lsr.w	#1,d1
	sub.w	d1,pr_xpos
	bra.s	print1
no1center:
	move.b	d0,pr_xpos
	move.b	(a0)+,pr_xpos+1
	move.b	(a0)+,pr_ypos+1
	bra.s	print1

pr_nopos1:
	lea	menu1,a1
	move.w	pr_xpos(pc),d1
	move.w	d1,d7
	and.w	#$7,d7
	eor.w	#$7,d7
	lsr.w	#3,d1
	move.w	pr_ypos(pc),d2
	;mulu	#44,d2
	lea	mulu44(pc),a3
	add.w	d2,d2
	add.w	(a3,d2.w),d1
	lea	(a1,d1.w),a1
	lea	menu2-menu1(a1),a3
	lea	sfontbredds(pc),a2
	moveq	#0,d2
	move.b	(a2,d0.w),d2
	add.w	d2,pr_xpos
	move.w	d0,d1
	and.w	#$1f,d0
	and.w	#$e0,d1
	asl.w	#$3,d1
	add.w	d0,d1
	lea	sfontr,a2
	lea	(a2,d1.w),a2
	moveq	#0,d0
	moveq	#0,d1
	moveq	#0,d2
	moveq	#0,d3
	moveq	#0,d4
	moveq	#0,d5
	moveq	#0,d6
	move.b	$20*0(a2),d0
	move.b	$20*1(a2),d1
	move.b	$20*2(a2),d2
	move.b	$20*3(a2),d3
	move.b	$20*4(a2),d4
	move.b	$20*5(a2),d5
	move.b	$20*6(a2),d6
	asl.w	d7,d0
	asl.w	d7,d1
	asl.w	d7,d2
	asl.w	d7,d3
	asl.w	d7,d4
	asl.w	d7,d5
	asl.w	d7,d6
	or.b	d0,44*0+1(a1)
	or.b	d1,44*1+1(a1)
	or.b	d2,44*2+1(a1)
	or.b	d3,44*3+1(a1)
	or.b	d4,44*4+1(a1)
	or.b	d5,44*5+1(a1)
	or.b	d6,44*6+1(a1)
	not.b	d0
	not.b	d1
	not.b	d2
	not.b	d3
	not.b	d4
	not.b	d5
	not.b	d6
	and.b	d0,44*0+1(a3)
	and.b	d1,44*1+1(a3)
	and.b	d2,44*2+1(a3)
	and.b	d3,44*3+1(a3)
	and.b	d4,44*4+1(a3)
	and.b	d5,44*5+1(a3)
	and.b	d6,44*6+1(a3)
	lsr.w	#$8,d0
	lsr.w	#$8,d1
	lsr.w	#$8,d2
	lsr.w	#$8,d3
	lsr.w	#$8,d4
	lsr.w	#$8,d5
	lsr.w	#$8,d6
	or.b	d0,44*0(a1)
	or.b	d1,44*1(a1)
	or.b	d2,44*2(a1)
	or.b	d3,44*3(a1)
	or.b	d4,44*4(a1)
	or.b	d5,44*5(a1)
	or.b	d6,44*6(a1)
	not.b	d0
	not.b	d1
	not.b	d2
	not.b	d3
	not.b	d4
	not.b	d5
	not.b	d6
	and.b	d0,44*0(a3)
	and.b	d1,44*1(a3)
	and.b	d2,44*2(a3)
	and.b	d3,44*3(a3)
	and.b	d4,44*4(a3)
	and.b	d5,44*5(a3)
	and.b	d6,44*6(a3)
	moveq	#0,d0
	move.b	$20*7(a2),d0
	asl.w	d7,d0
	or.b	d0,44*7+1(a1)
	not.b	d0
	and.b	d0,44*7+1(a3)
	lsr.w	#$8,d0
	or.b	d0,44*7(a1)
	not.b	d0
	and.b	d0,44*7(a3)
	bra	print1

PrintTimer:
	moveq	#0,d0
	move.b	(a0)+,d0
	lea	menu1+[[$9f+2]*44],a1
PrintTimerJumpIn:
	move.w	pr_xpos(pc),d1
	move.w	d1,d7
	and.w	#$7,d7
	eor.w	#$7,d7
	lsr.w	#3,d1
	lea	(a1,d1.w),a1
	lea	menu2-menu1(a1),a3
	lea	sfontr+$110+$40,a2
	and.w	#$f,d0
	lea	(a2,d0.w),a2
	moveq	#0,d0
	moveq	#0,d1
	moveq	#0,d2
	moveq	#0,d3
	moveq	#0,d4
	moveq	#0,d5
	move.b	$20*0(a2),d0
	move.b	$20*1(a2),d1
	move.b	$20*2(a2),d2
	move.b	$20*3(a2),d3
	move.b	$20*4(a2),d4
	move.b	$20*5(a2),d5
	move.w	#%11111000,d6
	asl.w	d7,d0
	asl.w	d7,d1
	asl.w	d7,d2
	asl.w	d7,d3
	asl.w	d7,d4
	asl.w	d7,d5
	asl.w	d7,d6
	not.w	d6
	and.b	d6,44*0+1(a1)
	and.b	d6,44*1+1(a1)
	and.b	d6,44*2+1(a1)
	and.b	d6,44*3+1(a1)
	and.b	d6,44*4+1(a1)
	and.b	d6,44*5+1(a1)
	or.b	d0,44*0+1(a1)
	or.b	d1,44*1+1(a1)
	or.b	d2,44*2+1(a1)
	or.b	d3,44*3+1(a1)
	or.b	d4,44*4+1(a1)
	or.b	d5,44*5+1(a1)
	not.b	d6
	or.b	d6,44*0+1(a3)
	or.b	d6,44*1+1(a3)
	or.b	d6,44*2+1(a3)
	or.b	d6,44*3+1(a3)
	or.b	d6,44*4+1(a3)
	or.b	d6,44*5+1(a3)
	not.b	d0
	not.b	d1
	not.b	d2
	not.b	d3
	not.b	d4
	not.b	d5
	and.b	d0,44*0+1(a3)
	and.b	d1,44*1+1(a3)
	and.b	d2,44*2+1(a3)
	and.b	d3,44*3+1(a3)
	and.b	d4,44*4+1(a3)
	and.b	d5,44*5+1(a3)
	lsr.w	#$8,d0
	lsr.w	#$8,d1
	lsr.w	#$8,d2
	lsr.w	#$8,d3
	lsr.w	#$8,d4
	lsr.w	#$8,d5
	lsr.w	#$8,d6
	and.b	d6,44*0(a1)
	and.b	d6,44*1(a1)
	and.b	d6,44*2(a1)
	and.b	d6,44*3(a1)
	and.b	d6,44*4(a1)
	and.b	d6,44*5(a1)
	or.b	d0,44*0(a1)
	or.b	d1,44*1(a1)
	or.b	d2,44*2(a1)
	or.b	d3,44*3(a1)
	or.b	d4,44*4(a1)
	or.b	d5,44*5(a1)
	not.b	d0
	not.b	d1
	not.b	d2
	not.b	d3
	not.b	d4
	not.b	d5
	not.b	d6
	or.b	d6,44*0(a3)
	or.b	d6,44*1(a3)
	or.b	d6,44*2(a3)
	or.b	d6,44*3(a3)
	or.b	d6,44*4(a3)
	or.b	d6,44*5(a3)
	and.b	d0,44*0(a3)
	and.b	d1,44*1(a3)
	and.b	d2,44*2(a3)
	and.b	d3,44*3(a3)
	and.b	d4,44*4(a3)
	and.b	d5,44*5(a3)
qkrts:	rts


PrintScrolly:
	lea	sc_screen1-8,a2
	lea	sc_screen2-8,a3
	move.w	#[[sc_screen2-sc_screen1]/$10],d7
	moveq	#0,d0
.p:	move.l	d0,(a2)+
	move.l	d0,(a2)+
	move.l	d0,(a2)+
	move.l	d0,(a2)+
	move.l	d0,(a3)+
	move.l	d0,(a3)+
	move.l	d0,(a3)+
	move.l	d0,(a3)+
	dbf	d7,.p

	move.w	#352,pr_xpos
	move.l	a0,a1		;calc mitten, sub xpos!
	moveq	#0,d0
	moveq	#0,d1
	lea	sfontbredds(pc),a2
.pr1l:	move.b	(a1)+,d0
	beq.s	.pr1e
	bmi.s	.pr1e
	moveq	#0,d2
	move.b	(a2,d0.w),d2
	add.w	d2,d1
	bra.s	.pr1l
.pr1e:	lsr.w	#1,d1
	sub.w	d1,pr_xpos
printScroll:
	moveq	#0,d0
	move.b	(a0)+,d0
	beq.s	qkrts
	lea	sc_screen1+6*96,a1
	move.w	pr_xpos(pc),d1
	move.w	d1,d7
	and.w	#$7,d7
	eor.w	#$7,d7
	lsr.w	#3,d1
	lea	(a1,d1.w),a1
	lea	sfontbredds(pc),a2
	moveq	#0,d2
	move.b	(a2,d0.w),d2
	add.w	d2,pr_xpos
	move.w	d0,d1
	and.w	#$1f,d0
	and.w	#$e0,d1
	asl.w	#$3,d1
	add.w	d0,d1
	lea	sfontr,a2
	lea	(a2,d1.w),a2
	moveq	#0,d0
	moveq	#0,d1
	moveq	#0,d2
	moveq	#0,d3
	moveq	#0,d4
	moveq	#0,d5
	moveq	#0,d6
	move.b	$20*0(a2),d0
	move.b	$20*1(a2),d1
	move.b	$20*2(a2),d2
	move.b	$20*3(a2),d3
	move.b	$20*4(a2),d4
	move.b	$20*5(a2),d5
	move.b	$20*6(a2),d6
	asl.w	d7,d0
	asl.w	d7,d1
	asl.w	d7,d2
	asl.w	d7,d3
	asl.w	d7,d4
	asl.w	d7,d5
	asl.w	d7,d6
	or.b	d0,96*0+1(a1)
	or.b	d1,96*1+1(a1)
	or.b	d2,96*2+1(a1)
	or.b	d3,96*3+1(a1)
	or.b	d4,96*4+1(a1)
	or.b	d5,96*5+1(a1)
	or.b	d6,96*6+1(a1)
	lsr.w	#$8,d0
	lsr.w	#$8,d1
	lsr.w	#$8,d2
	lsr.w	#$8,d3
	lsr.w	#$8,d4
	lsr.w	#$8,d5
	lsr.w	#$8,d6
	or.b	d0,96*0(a1)
	or.b	d1,96*1(a1)
	or.b	d2,96*2(a1)
	or.b	d3,96*3(a1)
	or.b	d4,96*4(a1)
	or.b	d5,96*5(a1)
	or.b	d6,96*6(a1)
	moveq	#0,d0
	move.b	$20*7(a2),d0
	asl.w	d7,d0
	or.b	d0,96*7+1(a1)
	lsr.w	#$8,d0
	or.b	d0,96*7(a1)
	bra	printScroll

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

tim1:	dc.w	$0	;frames
timdc:	dc.w	$0

EverTimer:
	tst.w	CalNotValid
	bne	rts
	addq.w	#1,timdc
	cmp.w	#596,timdc
	bne.s	.time6
	addq.w	#1,tim1
	clr.w	timdc

.time6:	move.w	pr_xpos(pc),-(a7)
	bsr.s	.k
	move.w	(a7)+,pr_xpos
	rts

.k:	addq.w	#1,tim1
	cmp.w	#50,tim1
	blt.s	tim_ChSek1
	sub.w	#50,tim1
	lea	sekund2(pc),a0
	addq.b	#1,(a0)
	cmp.b	#$3a,(a0)
	bne.s	tim_1
	move.b	#$30,(a0)
	move.b	#1,Sek1GO
tim_1:	move.w	#$5d,pr_xpos
	bra	printTimer
tim_ChSek1:
	tst.b	Sek1GO
	beq.s	tim_ChMin2
	clr.b	Sek1GO
	lea	sekund1(pc),a0
	addq.b	#1,(a0)
	cmp.b	#$36,(a0)
	bne.s	tim_2
	move.b	#$30,(a0)
	move.b	#1,Min2GO
tim_2:	move.w	#$57,pr_xpos
	bra	printTimer
tim_ChMin2:
	tst.b	Min2GO
	beq.w	tim_ChMin1
	clr.b	Min2GO
	lea	Minut2(pc),a0
	addq.b	#1,(a0)
	cmp.b	#$3a,(a0)
	bne.s	tim_3
	move.b	#$30,(a0)
	move.b	#1,Min1GO
tim_3:
	cmp.b	#'2',Timme1
	bne.s	.nospoke
	cmp.b	#'3',Timme2
	bne.s	.nospoke
	cmp.b	#'5',Minut1
	bne.s	.nospoke
	cmp.b	#'9',Minut2
	bne.s	.nospoke
	move.l	#Digispr,Digipic
	move.l	#spoketxt,digitxt
	move.w	#$669,fucktxtcols+2
	move.w	#$d44,fucktxtcols+2+$8
	move.w	#$c55,fucktxtcols+2+$10
	move.w	#$b66,fucktxtcols+2+$18
	addq.w	#1,Digigo
.nospoke:move.w	#$4e,pr_xpos
	bra	printTimer
tim_ChMin1:
	tst.b	Min1GO
	beq.s	tim_ChTim2
	clr.b	Min1GO
	lea	Minut1(pc),a0
	addq.b	#1,(a0)
	cmp.b	#$36,(a0)
	bne.s	tim_4
	move.b	#$30,(a0)
	move.b	#1,Tim2GO
tim_4:	move.w	#$48,pr_xpos
	bra	printTimer
tim_ChTim2:
	tst.b	Tim2GO
	beq.s	tim_ChTim1
	clr.b	Tim2GO
	lea	Timme2(pc),a0
	addq.b	#1,(a0)
	cmp.b	#$34,(a0)
	bne.s	tim_6
	cmp.b	#$32,Timme1
	bne.s	tim_6
	move.b	#$30,(a0)
	move.b	#$2f,Timme1
	move.b	#1,Tim1GO
	move.w	#1,NewDayCou
	move.w	#-1,spokego
tim_6:	cmp.b	#$3a,(a0)
	bne.s	tim_5
	move.b	#$30,(a0)
	move.b	#1,Tim1GO
tim_5:	move.w	#$3f,pr_xpos
	bra	printTimer
tim_ChTim1:
	tst.b	Tim1GO
	beq.s	tim_Shit
	clr.b	Tim1GO
	lea	Timme1(pc),a0
	addq.b	#1,(a0)
	move.w	#$39,pr_xpos
	bra	printTimer
tim_Shit:
	move.w	NewDayCou(pc),d0
	beq	rts
	addq.w	#1,NewDayCou
	cmp.w	#1,d0
	beq	rts

	cmp.w	#$8,d0
	bge.s	ClrCont
	lea	Menu1+2+[$98*44],a0
	mulu	#44,d0
	lea	(a0,d0.w),a0
	lea	Menu2-Menu1(a0),a1
	move.l	#$c0000000,(a0)+
	move.l	#$3fffffff,(a1)+
	move.l	#$00000000,(a0)+
	move.l	#$ffffffff,(a1)+
	move.w	#$0000,(a0)+
	move.w	#$ffff,(a1)+
	move.b	#$03,(a0)
	move.b	#$ff,(a1)
	rts
Clrcont:
	cmp.w	#$f,d0
	bge	NewDate
	lea	Menu1+2+[$98*44],a0
	mulu	#44,d0
	lea	(a0,d0.w),a0
	lea	Menu2-Menu1(a0),a1
	move.l	#$c0000000,(a0)+
	move.l	#$3fffffff,(a1)+
	move.b	#$00,(a0)+
	move.b	#$ff,(a1)+
	rts
NewDate:cmp.w	#$f,d0
	bne.L	PrintAll

	addq.w	#1,veckodag
	cmp.w	#7,veckodag
	bne.s	okthisvecko
	clr.w	veckodag
okthisvecko:
	lea	VeckoPois(pc),a0
	move.w	veckodag(pc),d0
	asl.w	#2,d0
	move.l	(a0,d0.w),a0
	move.b	1(a0),PrintVex
	move.b	2(a0),PrintVex+1
	lea	4(a0),a0
	move.l	a0,PrintVePoi
	move.b	#1,PrintVeckodag

	addq.w	#1,dayno
	addq.w	#1,datnr
	lea	Skottarstabell-2(pc),a0
	moveq	#0,d0
	move.w	year(pc),d0
	and.w	#$3,d0
	beq.s	Skottar
	lea	NormalarsTabell-2(pc),a0
Skottar:move.w	Monnr(pc),d1
	add.w	d1,d1
	move.w	datnr(pc),d0
	cmp.w	(a0,d1.w),d0
	ble.s	DatisOk
	move.w	#1,datnr
	addq.w	#1,Monnr
	cmp.w	#13,Monnr
	bne.s	DatisOK
	addq.w	#1,Year
	move.w	#1,Monnr
DatisOK:
	lea	dagge(pc),a1
	lea	DatumPrint(pc),a0
	move.w	datnr(pc),d0
	add.w	d0,d0
	move.w	(a1,d0.w),(a0)+
	move.w	#$13,daxpos
	tst.b	(a0)+
	lea	months-4(pc),a1
	move.w	monnr(pc),d0
	asl.w	#2,d0
	lea	(a1,d0.w),a1
	move.b	(a1)+,(a0)+
	move.b	(a1)+,(a0)+
	move.b	(a1)+,(a0)+
	move.l	#DatumPrint,DaxPoi
	move.b	#1,DaxOn
	rts

DatumPrint:	dc.b	"00",$1f,"jan",0,0
DaxPoi:	dc.l	DatumPrint
Daxpos:	dc.w	0
DaxOn:	dc.b	0
	dc.b	0

NormalarsTabell:dc.w 31,28,31,30,31,30,31,31,30,31,30,31
SkottarsTabell:	dc.w 31,29,31,30,31,30,31,31,30,31,30,31

PrintAll:
	cmp.w	#$1f,d0
	bge.s	PrintDax
	tst.b	PrintVeckodag
	beq	rts
	lea	PriVe(pc),a0
	move.l	PrintVePoi(pc),a1
	move.b	(a1)+,(a0)
	beq.s	EndPrintVe
	move.l	a1,PrintVePoi
	move.w	PrintVex,pr_xpos
	move.w	#$98,pr_ypos
	bsr	Print1
	move.w	pr_xpos,PrintVex
	rts
EndPrintVe:
	clr.b	PrintVeckodag
	rts


PrintDax:
	cmp.w	#$2f,d0
	bge.s	EndNewDate
	tst.b	DaxOn
	beq.s	EndNewDate
	lea	PriVe(pc),a0
	move.l	DaxPoi(pc),a1
	move.b	(a1)+,(a0)
	beq.s	EndPrintDax
	move.l	a1,DaxPoi
	move.w	Daxpos,pr_xpos
	move.w	#$9f,pr_ypos
	bsr	Print1
	move.w	pr_xpos,DaxPos
	rts
EndPrintDax:
	clr.b	DaxOn
	rts
EndNewDate:
	clr.w	NewDayCou
	rts

Sek1GO:	dc.b	0
Min2GO:	dc.b	0
Min1GO:	dc.b	0
Tim2GO:	dc.b	0
Tim1GO:	dc.b	0
PrintVeckodag:	dc.b	0
NewDayCou:	dc.w	0
PrintVex:	dc.w	0
PrintVePoi:	dc.l	Mandag
PriVe:	dc.b	0,0

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

pe_old:	dc.w	0
pe_nu:	dc.w	0
pe_xpos:	dc.l $007e8000
pe_ypos:	dc.l $002d2000
pe_xspd:	dc.l $00000000
pe_yspd:	dc.l $00000000
pe_stilla:	dc.w 0

pe_fric:	dc.l	$4000	;$0-ungefar $f0000
pe_studsfric:	dc.l	$28000	;$0- $f0000
pe_xsence:	dc.l	$1800	;$80-$7fff
pe_ysence:	dc.l	$1800	;$80-$7fff
pe_stilllength:	dc.l	$480	;$20-
pe_stillspd:	dc.l	$A000	;pe_fric+$200 - $40000
pe_curssence:	dc.l	$600	;$200-$4000

pec_selcolpoi:	dc.l	pt_selcoldat
pec_wait:	dc.w	1

pek_rut:subq.w	#1,pec_wait
	bne.s	.pec_nonewcol
	add.w	#20,pec_wait
	move.l	pec_selcolpoi(pc),a0
	move.w	(a0)+,d0
	bpl.s	.pt_ook
	lea	pt_selcoldat(pc),a0
	move.w	(a0)+,d0
.pt_ook:move.w	d0,pec_col+2
	move.l	a0,pec_selcolpoi
.pec_nonewcol:

	move.w	$dff00a,d0
	move.w	d0,pe_nu
	cmp.w	pe_old(pc),d0	;mouseStilla?
	bne.s	pe_nostill

	tst.w	AltMode
	beq.s	pe_345
	tst.w	CursorKeyX	;cursorStilla?
	bne.s	pe_nostill
	tst.w	CursorKeyY
	bne.s	pe_nostill

pe_345:	addq.w	#1,pe_stilla
	move.w	pe_stilllength+2(pc),d0
	cmp.w	pe_stilla,d0
	bgt.s	pe_still
	tst.w	pe_stilla
	bmi.s	pe_still
	move.l	pe_stillspd(pc),d1
	add.l	pe_fric(pc),d1
	add.l	d1,pe_yspd
	move.l	pe_yspd(pc),d0
	bpl.s	pe_ko
	neg.l	d0
pe_ko:	subq.w	#1,pe_stilla
	cmp.l	#$10000,d0
	bge.s	pe_still
	cmp.w	#$127,pe_ypos
	ble.s	pe_still

	clr.l	pe_yspd
	move.w	#$8000,pe_stilla
	bra.s	pe_still

pe_nostill:
	clr.w	pe_stilla
pe_still:
	move.l	pe_fric(pc),d0	;normalfric
	lsr.l	#$4,d0
	move.w	pe_xspd(pc),d4
	bpl.s	pe_e
	neg.w	d4
pe_e:	move.w	pe_yspd(pc),d5
	bpl.s	pe_f
	neg.w	d5
pe_f:	tst.w	pe_xspd+2
	beq.s	pe_i
	addq.w	#1,d4
pe_i:	tst.w	pe_yspd+2
	beq.s	pe_j
	addq.w	#1,d5
pe_j:	move.w	d4,d3
	add.w	d5,d3
	bne.s	pe_g
	addq.w	#1,d3
pe_g:	divu	d3,d0
	mulu	d0,d4
	mulu	d0,d5
	asl.l	#$4,d4
	asl.l	#$4,d5

	move.l	pe_xspd(pc),d0	;xnormfric
	bpl.s	pe_a
	add.l	d4,d0
	bmi.s	pe_b
	moveq	#0,d0
	bra.s	pe_b
pe_a:	sub.l	d4,d0
	bpl.s	pe_b
	moveq	#0,d0
pe_b:	move.l	d0,pe_xspd

	move.l	pe_yspd(pc),d0	;ynormfric
	bpl.s	pe_c
	add.l	d5,d0
	bmi.s	pe_d
	moveq	#0,d0
	bra.s	pe_d
pe_c:	sub.l	d5,d0
	bpl.s	pe_d
	moveq	#0,d0
pe_d:	move.l	d0,pe_yspd

	tst.w	AltMode		;move cursor with alt+cursor
	beq.s	pe_Mu
	move.w	CursorKeyX(pc),d0
	move.w	CursorKeyY(pc),d1
	move.l	pe_curssence(pc),d2
	muls	d2,d0
	muls	d2,d1
	asl.l	#5,d0
	asl.l	#5,d1
	add.l	d0,pe_xspd
	add.l	d1,pe_yspd

pe_Mu:
	moveq	#0,d1		;add musmoves to spds
	move.b	pe_old(pc),d0
	move.b	pe_nu(pc),d1
	ext.w	d0
	ext.w	d1
	sub.w	d0,d1
	ext.w	d1
	add.w	d1,d1
	muls	pe_ysence+2(pc),d1
	add.l	d1,pe_yspd
	moveq	#0,d1
	move.b	pe_old+1(pc),d0
	move.b	pe_nu+1(pc),d1
	ext.w	d0
	ext.w	d1
	sub.w	d0,d1
	ext.w	d1
	add.w	d1,d1
	muls	pe_xsence+2(pc),d1
	add.l	d1,pe_xspd

	move.l	pe_xpos(pc),d0
	add.l	pe_xspd(pc),d0
	move.l	d0,d1
	swap	d1
	cmp.w	#$70,d1
	bgt.s	pe_2
	bsr	pe_studs
	tst.l	pe_xspd
	bpl.s	pe_22
	neg.l	pe_xspd
pe_22:	sub.l	#$70ffff,d0
	neg.l	d0
	add.l	#$710000,d0
	bra.s	pe_3
pe_2:	cmp.w	#$1c4,d1
	blt.s	pe_3
	bsr	pe_studs
	tst.l	pe_xspd
	bmi.s	pe_23
	neg.l	pe_xspd
pe_23:	sub.l	#$1c40000,d0
	neg.l	d0
	add.l	#$1c3ffff,d0
pe_3:	move.l	d0,pe_xpos


	move.l	pe_ypos(pc),d0
	add.l	pe_yspd(pc),d0
	move.l	d0,d1
	swap	d1
	cmp.w	#$25,d1
	bgt.s	pe_4
	bsr	pe_studs
	tst.l	pe_yspd
	bpl.s	pe_44
	neg.l	pe_yspd
pe_44:	sub.l	#$25ffff,d0
	neg.l	d0
	add.l	#$260000,d0
	bra.s	pe_5
pe_4:	cmp.w	#$12d,d1
	blt.s	pe_5
	bsr.s	pe_studs
	tst.l	pe_yspd
	bmi.s	pe_55
	neg.l	pe_yspd
pe_55:	sub.l	#$12d0000,d0
	neg.l	d0
	add.l	#$12cffff,d0
pe_5:	move.l	d0,pe_ypos


	lea	pek(pc),a0	;set spr-pos i spr-data
	move.w	pe_xpos(pc),d0
	moveq	#0,d1
	lsr.w	#1,d0
	bcc.s	pe_1
	moveq	#1,d1
pe_1:	move.b	d0,1(a0)
	move.b	d1,3(a0)
	move.b	pe_ypos+1(pc),(a0)
	move.b	pe_ypos(pc),d0
	asl.b	#2,d0
	or.b	d0,3(a0)
	move.w	pe_ypos(pc),d0
	add.w	#$e,d0
	move.b	d0,2(a0)
	lsr.w	#$8,d0
	asl.b	#1,d0
	or.b	d0,3(a0)

	move.w	pe_nu(pc),pe_old
	rts

pe_studs:
	move.l	pe_studsfric(pc),d1
	lsr.l	#$4,d1
	move.w	pe_xspd(pc),d4
	bpl.s	pe_1e
	neg.w	d4
pe_1e:	move.w	pe_yspd(pc),d5
	bpl.s	pe_1f
	neg.w	d5
pe_1f:	tst.w	pe_xspd+2
	beq.s	pe_1p
	addq.w	#1,d4
pe_1p:	tst.w	pe_yspd+2
	beq.s	pe_1o
	addq.w	#1,d5
pe_1o:	move.w	d4,d3
	add.w	d5,d3
	bne.s	pe_1i
	addq.w	#1,d3
pe_1i:	divu	d3,d1
	mulu	d1,d4
	mulu	d1,d5
	asl.l	#$4,d4
	asl.l	#$4,d5

	move.l	pe_xspd(pc),d1
	bpl.s	pe_aa
	add.l	d4,d1
	bmi.s	pe_ab
	moveq	#0,d1
	bra.s	pe_ab
pe_aa:	sub.l	d4,d1
	bpl.s	pe_ab
	moveq	#0,d1
pe_ab:	move.l	d1,pe_xspd

	move.l	pe_yspd(pc),d1
	bpl.s	pe_ac
	add.l	d5,d1
	bmi.s	pe_ad
	moveq	#0,d1
	bra.s	pe_ad
pe_ac:	sub.l	d5,d1
	bpl.s	pe_ad
	moveq	#0,d1
pe_ad:	move.l	d1,pe_yspd
	rts

PEK:
dc.w $8090,$8e00
dc.w $0000,$E000
dc.w $6000,$9800
dc.w $7800,$8600
dc.w $3E00,$4180
dc.w $3F80,$4060
dc.w $1FE0,$2018
dc.w $1FC0,$2020
dc.w $0F80,$1040
dc.w $0FC0,$1020
dc.w $06E0,$0910
dc.w $0460,$0A90
dc.w $0000,$0470
dc.w $0000,$0400
dc.w $0000,$0000
dc.l 0

;-------------------------------------------
;menu-colours-line-shit-rut

mc_colnow:	dc.w	$ffff
mc_on:	dc.w	1

mc_shift:	dc.w	120*50

mc_rut:	subq.w	#1,mc_shift
	bne.s	oker
	move.w	#120*50,mc_shift	;120 sek mellan byte boll-linje
	tst.w	bo_rut2go
	bne.s	oker
	move.w	#1,bo_rut2go
oker:


	tst.w	mc_on
	beq	bo_rut
	subq.w	#1,mc_cou
	bpl.L	mc_nonew
	move.l	mc_poi(pc),a0
mc_back:move.w	(a0)+,d0
	bpl.s	mc_noend
	cmp.w	#$8000,d0
	bne.s	mc_end
	eor.w	#$ffff,mc_colnow
	bne.s	mc_1
	move.w	(a0)+,mc_col1+2
	move.w	(a0)+,mc_col23+2
	move.w	(a0)+,mc_col23+6
	bra.s	mc_back
mc_1:	
	move.w	(a0)+,mc_2col123+2
	move.w	(a0)+,mc_2col123+6
	move.w	(a0)+,mc_2col123+10
	bra.s	mc_back
mc_end:	clr.w	mc_on
	rts
mc_noend:
	move.w	d0,mc_cou
	lea	mc_x1(pc),a1
	move.w	(a0)+,(a1)+	;x1pos
	clr.w	(a1)+
	moveq	#0,d0
	move.w	(a0)+,d0
	ext.l	d0
	asl.l	#4,d0
	move.l	d0,(a1)+
	move.w	(a0)+,(a1)+	;y1pos
	clr.w	(a1)+
	moveq	#0,d0
	move.w	(a0)+,d0
	ext.l	d0
	asl.l	#4,d0
	move.l	d0,(a1)+
	move.w	(a0)+,(a1)+	;x2pos
	clr.w	(a1)+
	moveq	#0,d0
	move.w	(a0)+,d0
	ext.l	d0
	asl.l	#4,d0
	move.l	d0,(a1)+
	move.w	(a0)+,(a1)+	;y2pos
	clr.w	(a1)+
	moveq	#0,d0
	move.w	(a0)+,d0
	ext.l	d0
	asl.l	#4,d0
	move.l	d0,(a1)+
	move.l	a0,mc_poi

mc_nonew:
	move.w	mc_colnow(pc),a2
	lea	plotbpl+2+[8*44],a0
	moveq	#0,D0
	moveq	#0,D1
	moveq	#0,D2
	moveq	#0,D3

	move.w	mc_x1(pc),d0
	move.w	mc_y1(pc),d1
	move.w	mc_x2(pc),d2
	move.w	mc_y2(pc),d3
	bsr	l_rut

	move.l	mc_x1+4(pc),d0
	add.l	d0,mc_x1
	move.l	mc_y1+4(pc),d0
	add.l	d0,mc_y1
	move.l	mc_x2+4(pc),d0
	add.l	d0,mc_x2
	move.l	mc_y2+4(pc),d0
	add.l	d0,mc_y2
	rts

mc_poi:	dc.l	mc_dat
		;cou,xpos,xspd,ypos,yspd
		;    x2po,x2sp,y2po,y2sp
mc_dat:	dc.w $8000,$00b,$007,$004
	dc.w	$58,$00,$00,$01,$00
	dc.w	    $00,$1000,$ad,$00
	dc.w	$ac,$00,$00,$01,$00
	dc.w	    $58,$00,$ad,-$1000
	dc.w $8000,$0bb,$077,$044
	dc.w	$57,$00,$00,$00,$1000
	dc.w	    $00,$1000,$00,$00
	dc.w	$ac,$00,$00,$58,$7d1
	dc.w	    $58,$0000,$00,$1000
	dc.w $8000,$ebb,$977,$544
	dc.w	$01,$00,$00,$01,$00
	dc.w	    $00,$00,$ad,$00
	dc.w	$ab,$00,$00,$01,$1000
	dc.w	    $00,$817,$ac,$00
	dc.w	$02,$57,-$817,$01,$00
	dc.w	    $57,$00,$ac,-$1000
	dc.w	$ac,$57,-$817,$01,$00
	dc.w	    $57,$00,$ad,-$1000
	dc.w	$ac,$00,$817,$01,$00
	dc.w	    $00,$00,$ad,-$1000
	dc.w	$a8,$00,$817,$ac,$00
	dc.w	    $57,$00,$ac,-$1000

	dc.w	$90,$47,-$770,$9c,-$1000
	dc.w	      $57,$00,$9c,-$1000
	dc.w	$50,$00,$1000,$02,$00
	dc.w	    $00,$1000,$ab,$00
	dc.w	-1

	;pos,spd
mc_cou:	dc.w	0
mc_x1:	dc.l	0,0
mc_y1:	dc.l	0,0
mc_x2:	dc.l	0,0
mc_y2:	dc.l	0,0

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

bo_ritaboll2:
	move.w	(a4),d0
	move.w	$8(a4),d1
	;mulu	#44,d1
	;lea	mulu44(pc),a3
	add.w	d1,d1
	move.w	(a3,d1.w),d1
	move.w	d0,d2
	lsr.w	#3,d2
	add.w	d2,d1
	and.w	#$f,d0
	ror.w	#4,d0
	or.w	#$0dfc,d0
	move.w	d1,(a5)+
	move.w	d0,(a5)
	lea	(a1,d1.w),a0
bo_wfit:btst	#14,$02(a6)
	bne.s	bo_wfit
	move.l	a0,$54(a6)
	move.l	a0,$4c(a6)	;b-source
bo_poi1:move.l	#bolle,$50(a6)
	move.w	d0,$40(a6)
	move.w	#[$0f*$40]+2,$58(a6)
	rts
bo_rut2go:	dc.w	1
bo_nowrut:	dc.w	1

bo_rut:	move.w	bo_nowrut(pc),d0
	bne	bo_rut2
	move.w	bo_rut2go(pc),d0
	beq.L	bo_nonewrut

	cmp.w	#[12*4]-1,d0
	bge.s	bo_line
	subq.w	#1,d0
	lsr.w	#2,d0
	asl.w	#2,d0
	lea	bo_anim(pc),a0
	move.l	(a0,d0.w),a0
	move.l	a0,bo_poi1+2
	move.l	a0,bo_poi2+2
	addq.w	#1,bo_rut2go
	bra.L	bo_nonewrut
bo_line:move.w	#1,bo_nowrut
	clr.w	bo_rut2go
	lea	b2_olds(pc),a0
	moveq	#[$20/4]-1,d7
	moveq	#0,d0
bo_lopp:move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	move.l	d0,(a0)+
	dbf	d7,bo_lopp
	move.l	b2_poi(pc),a0
	tst.l	(a0)
	bne.s	b2_ok
	lea	b2_dat(pc),a0
b2_ok:	move.l	(a0)+,b2_x1
	move.l	(a0)+,b2_x2
	move.l	a0,b2_poi
	bsr.L	bo_getnewcols
	rts
bo_anim:dc.l	bolle,bolle+2,bolle+4,bolle+8,bolle+10,bolle+12
	dc.l	bolle+14,bolle+16,bolle+18,bolle+20,bolle+22
	dc.l	dummy
b2_poi:	dc.l	b2_dat
b2_dat:
dc.l $00800400,$04400080
dc.l $04400480,$05400580
dc.l $02800140,$0480fe40
dc.l $0180fe40,$03400400
dc.l $01400100,$01600120
dc.l $0540fd18,$046001c0
dc.l $034000c0,$04600040
dc.l $03407ec0,$04608140
dc.l $0340fbc0,$05600940
dc.l $41004140,$418041c0
dc.l $41004240,$41404280
dc.l $55005540,$55405580
dc.l $54005440,$543054a0
dc.l $04000440,$063006a0
dc.l 0

bo_cols:	;$ebb,$977,$544
dc.w $eb0,$970,$540
dc.w $ccc,$777,$444
dc.w $ebb,$797,$544
dc.w $0bb,$077,$044
dc.w $b09,$907,$806
dc.w $ea0,$960,$530
dc.w $e44,$933,$522
dc.w $a99,$a99,$a99
dc.w $977,$655,$000
dc.w $bbe,$779,$445
dc.w $edb,$997,$554
dc.w $ebb,$777,$544
dc.w $bbb,$777,$444
dc.w $ebe,$979,$545
dc.w $e6b,$947,$524
dc.w -1
bo_copoi:	dc.l	bo_cols
bo_getnewcols:
	move.l	bo_copoi(pc),a0
	tst.w	(a0)
	bpl.s	bo_okut
	lea	bo_cols(pc),a0
bo_okut:move.w	(a0)+,mc_2col123+2
	move.w	(a0)+,mc_2col123+6
	move.w	(a0)+,mc_2col123+10
	move.l	a0,bo_copoi
	rts

bo_nonewrut:
	lea	$dff000,a6
	move.w	bo_oldpos1(pc),d1
	move.l	bo_oldpos1+2(pc),d0
	and.l	#$ff0fffff,d0
	lea	plotbpl+[11*44]+2,a1
	lea	(a1,d1.w),a0
bo_w2:	btst	#14,$02(a6)
	bne.s	bo_w2
	move.l	a0,$54(a6)
	move.l	a0,$4c(a6)	;b-source
bo_opoi1:move.l	#bolle,$50(a6)
	move.l	#$ffff0000,$44(a6)
	move.l	d0,$40(a6)
	move.w	#$0028,$62(a6)		;b
	move.l	#$00140028,$64(a6)	;a d
	move.w	#[$0f*$40]+2,$58(a6)

	move.w	bo_b1x(pc),d0
	sub.w	bo_b2x(pc),d0
	muls	d0,d0
	move.w	bo_b1y(pc),d1
	sub.w	bo_b2y(pc),d1
	muls	d1,d1
	move.w	d1,d2
	add.w	d0,d2
	cmp.w	#$e0,d2
	bcc.s	bo_nk1	;bge-u
	tst.w	bo_kn1
	bne.s	bo_stk1
	addq.w	#1,bo_kn1
	move.l	bo_b1x+4(pc),d0
	move.l	bo_b2x+4(pc),bo_b1x+4
	move.l	d0,bo_b2x+4
	move.l	bo_b1y+4(pc),d0
	move.l	bo_b2y+4(pc),bo_b1y+4
	move.l	d0,bo_b2y+4
	bra.s	bo_stk1
bo_nk1:	clr.w	bo_kn1
bo_stk1:
	move.w	bo_oldpos2(pc),d1
	move.w	bo_oldpos2+2(pc),d0
	and.w	#$ff0f,d0
	lea	(a1,d1.w),a0
bo_wf2:	btst	#14,$02(a6)
	bne.s	bo_wf2
	move.l	a0,$54(a6)
	move.l	a0,$4c(a6)	;b-source
bo_opoi2:move.l	#bolle,$50(a6)
	move.w	d0,$40(a6)
	move.w	#[$0f*$40]+2,$58(a6)

	move.w	bo_b1x(pc),d0
	sub.w	bo_b3x(pc),d0
	muls	d0,d0
	move.w	bo_b1y(pc),d1
	sub.w	bo_b3y(pc),d1
	muls	d1,d1
	move.w	d1,d2
	add.w	d0,d2
	cmp.w	#$e0,d2
	bcc.s	bo_nk2	;bge-u
	tst.w	bo_kn2
	bne.s	bo_stk2
	addq.w	#1,bo_kn2
	move.l	bo_b1x+4(pc),d0
	move.l	bo_b3x+4(pc),bo_b1x+4
	move.l	d0,bo_b3x+4
	move.l	bo_b1y+4(pc),d0
	move.l	bo_b3y+4(pc),bo_b1y+4
	move.l	d0,bo_b3y+4
	bra.s	bo_stk2
bo_nk2:	clr.w	bo_kn2
bo_stk2:
	move.w	bo_oldpos3(pc),d1
	move.w	bo_oldpos3+2(pc),d0
	and.w	#$ff0f,d0
	lea	(a1,d1.w),a0
bo_wg2:	btst	#14,$02(a6)
	bne.s	bo_wg2
	move.l	a0,$54(a6)
	move.l	a0,$4c(a6)	;b-source
bo_opoi3:move.l	#bolle,$50(a6)
	move.w	d0,$40(a6)
	move.w	#[$0f*$40]+2,$58(a6)

	move.w	bo_b2x(pc),d0
	sub.w	bo_b3x(pc),d0
	muls	d0,d0
	move.w	bo_b2y(pc),d1
	sub.w	bo_b3y(pc),d1
	muls	d1,d1
	move.w	d1,d2
	add.w	d0,d2
	cmp.w	#$e0,d2
	bcc.s	bo_nk3	;bge-u
	tst.w	bo_kn3
	bne.s	bo_stk3
	addq.w	#1,bo_kn3
	move.l	bo_b2x+4(pc),d0
	move.l	bo_b3x+4(pc),bo_b2x+4
	move.l	d0,bo_b3x+4
	move.l	bo_b2y+4(pc),d0
	move.l	bo_b3y+4(pc),bo_b2y+4
	move.l	d0,bo_b3y+4
	bra.s	bo_stk3
bo_nk3:	clr.w	bo_kn3
bo_stk3:
	move.w	bo_b1x(pc),d0
	move.w	bo_b1x+$8(pc),d1
	;mulu	#44,d1
	lea	mulu44(pc),a3
	add.w	d1,d1
	move.w	(a3,d1.w),d1
	move.w	d0,d2
	lsr.w	#3,d2
	add.w	d2,d1
	and.l	#$f,d0
	ror.l	#4,d0
	or.l	#$0dfc0000,d0
	lea	bo_oldpos1(pc),a5
	move.w	d1,(a5)+
	move.l	d0,(a5)
	lea	plotbpl+[11*44]+2,a1
	lea	(a1,d1.w),a0
bo_wait:btst	#14,$02(a6)
	bne.s	bo_wait
	move.l	a0,$54(a6)
	move.l	a0,$4c(a6)	;b-source
bo_poi2:move.l	#bolle,$50(a6)
	move.l	#$ffff0000,$44(a6)
	move.l	d0,$40(a6)
	move.w	#$0028,$62(a6)		;b
	move.l	#$00140028,$64(a6)	;a d
	move.w	#[$0f*$40]+2,$58(a6)
	lea	bo_oldpos2(pc),a5
	lea	bo_b2x(pc),a4
	bsr	bo_ritaboll2
	lea	bo_oldpos3(pc),a5
	lea	bo_b3x(pc),a4
	bsr	bo_ritaboll2

	move.l	#$480000,a2
	move.l	#$20000,a3
	move.l	#$9a0000,a4
	move.l	#$600,a6
	lea	bo_b1x(pc),a5
	move.l	(a5)+,a0
	move.l	(a5)+,d0
	move.l	(a5)+,a1
	move.l	(a5)+,d1
	add.l	d0,a0
	add.l	d1,a1
	cmp.l	a2,a0	;#$480000
	blt.s	bo_noxh
	sub.l	d0,a0
	neg.l	d0
bo_noxh:cmp.l	a3,a0	;#$20000
	bge.s	bo_noxl
	sub.l	d0,a0
	neg.l	d0
bo_noxl:cmp.l	a4,a1	;#$9a0000
	bcs.s	bo_nostuds	;blt-u
	sub.l	d1,a1
	neg.l	d1
bo_nostuds:
	add.l	a6,d1	;#$600
	move.l	d1,-4(a5)
	move.l	a1,-8(a5)
	move.l	d0,-12(a5)
	move.l	a0,-16(a5)

	move.l	(a5)+,a0
	move.l	(a5)+,d0
	move.l	(a5)+,a1
	move.l	(a5)+,d1
	add.l	d0,a0
	add.l	d1,a1
	cmp.l	a2,a0	;#$480000
	blt.s	bo2_noxh
	sub.l	d0,a0
	neg.l	d0
bo2_noxh:cmp.l	a3,a0	;#$20000
	bge.s	bo2_noxl
	sub.l	d0,a0
	neg.l	d0
bo2_noxl:cmp.l	a4,a1	;#$9a0000
	bcs.s	bo2_nostuds	;blt-u
	sub.l	d1,a1
	neg.l	d1
bo2_nostuds:
	add.l	a6,d1	;#$600
	move.l	d1,-4(a5)
	move.l	a1,-8(a5)
	move.l	d0,-12(a5)
	move.l	a0,-16(a5)

	move.l	(a5)+,a0
	move.l	(a5)+,d0
	move.l	(a5)+,a1
	move.l	(a5)+,d1
	add.l	d0,a0
	add.l	d1,a1
	cmp.l	a2,a0	;#$480000
	blt.s	bo3_noxh
	sub.l	d0,a0
	neg.l	d0
bo3_noxh:cmp.l	a3,a0	;#$20000
	bge.s	bo3_noxl
	sub.l	d0,a0
	neg.l	d0
bo3_noxl:cmp.l	a4,a1	;#$9a0000
	bcs.s	bo3_nostuds	;blt-u
	sub.l	d1,a1
	neg.l	d1
bo3_nostuds:
	add.l	a6,d1	;#$600
	move.l	d1,-(a5)
	move.l	a1,-(a5)
	move.l	d0,-(a5)
	move.l	a0,-(a5)
	rts
bo_kn1:	dc.w	0
bo_kn2:	dc.w	0
bo_kn3:	dc.w	0
	;	pos,spd
bo_b1x:	dc.l	$300000,$10000
bo_b1y:	dc.l	$200000,$0000
bo_b2x:	dc.l	$320000,-$1800
bo_b2y:	dc.l	$400000,$0
bo_b3x:	dc.l	$450000,$b000
bo_b3y:	dc.l	$620000,$00

bo_oldpos1:	dc.w	0
bo_oldpos1x:	dc.l	0
bo_oldpos2:	dc.w	0
bo_oldpos2x:	dc.l	0
bo_oldpos3:	dc.w	0
bo_oldpos3x:	dc.l	0

b2_olds:blk.l	$20,0
b2_x1:	dc.b	$04,$00
b2_y1:	dc.b	$04,$40
b2_x2:	dc.b	$06,$30
b2_y2:	dc.b	$06,$a0
b2_oldpos:dc.w	0

b2_gorut1:
	cmp.w	#$22,d0
	bge.s	b2_go1
	bsr	b2_sudda
	addq.w	#1,bo_rut2go
	rts
b2_go1:	bne.s	b2_ggo1
	bsr	bo_getnewcols
	addq.w	#1,bo_rut2go
	rts
b2_ggo1:move.w	#$22+[12*4],d1
	sub.w	d0,d1
	lsr.w	#2,d1
	asl.w	#2,d1
	lea	bo_anim(pc),a0
	move.l	(a0,d1.w),a0
	move.l	a0,bo_poi1+2
	move.l	a0,bo_poi2+2
	bsr	bo_nonewrut
	addq.w	#1,bo_rut2go
	cmp.w	#$23+[12*4],bo_rut2go
	bge.s	b2_end
	rts
b2_end:	clr.w	bo_rut2go
	clr.w	bo_nowrut
	rts

b2_sudda:
	lea	sin255,a4
	addq.w	#4,b2_oldpos
	and.w	#$7c,b2_oldpos
	lea	plotbpl+[$3c*44]+2,a0
	lea	0.w,a2
	lea	b2_olds(pc),a3
	move.w	b2_oldpos(pc),d4
	moveq	#0,d0
	moveq	#0,d1
	moveq	#0,d2
	moveq	#0,d3
	move.b	(a3,d4.w),d0
	move.b	1(a3,d4.w),d1
	move.b	2(a3,d4.w),d2
	move.b	3(a3,d4.w),d3
	clr.l	(a3,d4.w)
	bsr	l_rut
	rts

bo_rut2:move.w	bo_rut2go(pc),d0
	bne	b2_gorut1
	bsr.s	b2_sudda
	move.w	b2_oldpos(pc),d4
	move.w	#$ffff,a2
	moveq	#0,d0
	moveq	#0,d1
	moveq	#0,d2
	moveq	#0,d3
	move.b	b2_x1(pc),d0
	move.b	b2_y1(pc),d1
	move.b	b2_x2(pc),d2
	move.b	b2_y2(pc),d3
	add.b	d0,b2_x1+1
	add.b	d1,b2_y1+1
	add.b	d2,b2_x2+1
	add.b	d3,b2_y2+1
	move.b	b2_x1+1(pc),d0
	move.b	b2_y1+1(pc),d1
	move.b	b2_x2+1(pc),d2
	move.b	b2_y2+1(pc),d3
	move.b	(a4,d0.w),d0
	move.b	(a4,d1.w),d1
	move.b	(a4,d2.w),d2
	move.b	(a4,d3.w),d3
	lsr.b	#$2,d0
	lsr.b	#$2,d2
	lsr.b	#$2,d1
	lsr.b	#$2,d3
	add.b	#$c,d0
	add.b	#$c,d2
	move.b	d0,(a3,d4.w)
	move.b	d1,1(a3,d4.w)
	move.b	d2,2(a3,d4.w)
	move.b	d3,3(a3,d4.w)
	bsr	l_rut
	rts

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

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

L_rut:	lea	$dff000,a5
	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	#44,d4
	mulu	d1,d4
	moveq	#-16,d5
	and.w	d0,d5
	lsr.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	a2,$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	#44,$60(a5)
	move.w	#44,$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

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

sv_init2:
	bsr	random
	lea	sv2_datlist(pc),a0
	moveq	#$7f,d7
sv_il:	move.b	rnd+5,$80(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

	lea	sv3_datlist(pc),a0
	moveq	#$5f,d7
sv_3il:	move.b	rnd+5,$60(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	sv3_neg
	neg.w	d6
sv3_neg:cmp.w	#$5,d6
	bgt.s	sv3_ok
	add.b	#$53,rnd+5
sv3_ok:	dbf	d7,sv_3il
	rts

sv_pacinit:
	lea	PacR,a6
	bra.s	sv4
sv_spokeinit:
	lea	spokeR,a6
	bra.s	sv4
sv_init:lea	bolle,a6
sv4:	lea	sv_spr,a0
	lea	$16(a6),a1
	moveq	#0,d0
	moveq	#$b,d6
sv_o:	lea	(a1),a2
	move.l	d0,(a0)+
	moveq	#$e,d7
sv_l:	move.w	(a2),(a0)+
	move.w	(a2),(a0)+
	lea	$18(a2),a2
	dbf	d7,sv_l
	subq.w	#2,a1
	dbf	d6,sv_o

	lea	(a6),a1
	moveq	#$b,d6
sv_2o:	lea	(a1),a2
	move.l	d0,(a0)+
	moveq	#$e,d7
sv_2l:	move.w	(a2),(a0)+
	move.w	(a2),(a0)+
	lea	$18(a2),a2
	dbf	d7,sv_2l
	addq.w	#2,a1
	dbf	d6,sv_2o

	lea	$16(a6),a1
	moveq	#$b,d6
sv_3o:	lea	(a1),a2
	move.l	d0,(a0)+
	moveq	#$e,d7
sv_3l:	move.w	(a2),(a0)+
	move.w	(a2),(a0)+
	lea	$18(a2),a2
	dbf	d7,sv_3l
	subq.w	#2,a1
	dbf	d6,sv_3o

	lea	(a6),a1
	moveq	#$b,d6
sv_4o:	lea	(a1),a2
	move.l	d0,(a0)+
	moveq	#$e,d7
sv_4l:	move.w	(a2),(a0)+
	move.w	(a2),(a0)+
	lea	$18(a2),a2
	dbf	d7,sv_4l
	addq.w	#2,a1
	dbf	d6,sv_4o

	lea	$16(a6),a1
	moveq	#$b,d6
sv_5o:	lea	(a1),a2
	move.l	d0,(a0)+
	moveq	#$e,d7
sv_5l:	move.w	(a2),(a0)+
	move.w	(a2),(a0)+
	lea	$18(a2),a2
	dbf	d7,sv_5l
	subq.w	#2,a1
	dbf	d6,sv_5o
	clr.l	(a0)+
	rts


Sv_rut:	lea	sv_spr+[4*16],a0
	move.w	sv_cou(pc),d0
	asl.w	#6,d0
	lea	(a0,d0.w),a0
	moveq	#0,d5
	move.w	sv_pos(pc),d5
	move.w	d5,d1
	lsr.w	#4,d5
	divu	#24,d5
	swap	d5
	add.w	d5,d5
	move.w	d5,d3
	asl.w	#$5,d3
	lea	(a0,d3.w),a0

	lea	sv_datlist(pc),a1
	move.l	a0,a6

	move.l	sv_oldcutpoi(pc),a2
	move.l	sv_oldcutlongw(pc),(a2)

	move.w	sv_pos(pc),d0
	and.w	#$f,d0
	cmp.w	#$d,d0
	bgt.s	sv_nocut
	move.w	d0,d2
	asl.w	#2,d2
	lea	-4*16(a0,d2.w),a0	;a0=newstartpoi

	asl.w	#8,d0
	move.l	#$24a03300,d2
	sub.w	d0,d2

	move.l	a0,sv_oldcutpoi
	move.l	(a0),sv_oldcutlongw
	move.l	d2,(a0)
	move.w	d5,d2
	subq.w	#2,d2
	bpl.s	sv_neneg
	add.w	#$30,d2
sv_neneg:
	add.w	d2,d2
	move.l	(a1,d2.w),d2
	add.l	sv_posx(pc),d2
	swap	d2
	lsr.w	#1,d2
	bcc.s	sv_hr
	move.b	#$1,3(a0)
sv_hr:	move.b	d2,1(a0)

sv_nocut:
	move.w	a0,sv_cop+6
	move.l	a0,d0
	swap	d0
	move.w	d0,sv_cop+2

	move.l	a6,a0

	and.w	#$f,d1
	eor.w	#$f,d1
	move.l	#$25003400,d0
	asl.w	#8,d1
	add.w	d1,d0
	swap	d0
	add.w	d1,d0
	swap	d0

	moveq	#$40,d6
	moveq	#12,d7
	move.l	sv_posx(pc),d4
	add.w	d5,d5
	moveq	#$60,d2
sv_ml:	move.l	d0,(a0)
	move.l	(a1,d5.w),d1
	add.l	d4,d1
	swap	d1
	lsr.w	#1,d1
	bcc.s	sv_3r
	move.b	#1,3(a0)
sv_3r:	move.b	d1,1(a0)

	add.l	d6,a0
	addq.w	#4,d5
	cmp.w	d2,d5	;#$60
	bne.s	sv_ko
	clr.w	d5
sv_ko:
	add.l	#$10001000,d0
	dbf	d7,sv_ml

	subq.w	#1,sv_wait
	bpl.s	sv_1
	move.w	#2,sv_wait	;animspeed

	moveq	#23,d0
	sub.w	sv_cou(pc),d0
	subq.w	#1,d0
	bpl.s	sv_okit
	add.w	#$18,d0
sv_okit:asl.w	#2,d0
	lea	sv_datlist(pc),a0
	tst.w	spokego	;ingen nypos
	bne.s	sv_4
	move.l	rnd+4(pc),(a0,d0.w)

sv_4:	addq.w	#1,sv_cou
	cmp.w	#24,sv_cou
	bne.s	sv_1
	clr.w	sv_cou
sv_1:	bra	sv2_rut

sv_old:	dc.w	0
sv_pos:	dc.l	0
sv_posy:dc.l	0
sv3_pos:dc.l	$13364
sv4_pos:dc.l	$5d920
sv_posx:dc.l	0
sv_oldcutpoi:	dc.l	0
sv_oldcutlongw:	dc.l	0
sv_mdir:	dc.w	0
sv_mdirspeedpoi:	dc.w	$a000
sv_mdirspeedpoispeed:	dc.w	$2e
sv_mdirkraft:		dc.w	$100
sv_mdirkraftdir:	dc.w	$c000
sv_mdirkraftspeed:	dc.w	$36

sv_datlist:	blk.l	24,$1f00000
sv_wait:dc.w	0
sv_cou:	dc.w	0


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

sv2_rut:move.w	sv_posy(pc),d0
	lsr.w	#4,d0
	move.w	d0,d6
	and.w	#3,d0
	mulu	#$330,d0
	lea	sv2_spr0(pc),a0
	lea	(a0,d0.w),a0
	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


	moveq	#$63,d7
	lea	sv2_datlist(pc),a1
	lea	(a1,d6.w),a1
	move.l	sv_posx(pc),d5
	lsr.l	#4,d5
	swap	d5
	move.l	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)
	move.b	d1,2(a0)

	addq.l	#8,a0
	dbf	d7,sv2_loop


	moveq	#0,d0		;sv3_rut
	move.w	sv3_pos(pc),d0
	lsr.w	#3,d0
	divu	#3,d0
	move.l	d0,d6
	swap	d0
	mulu	#$340,d0
	lea	sv3_spr0(pc),a0
	lea	(a0,d0.w),a0
	move.w	a0,sv3_cop+6
	move.l	a0,d7
	swap	d7
	move.w	d7,sv3_cop+2

	moveq	#$42,d7
	lea	sv3_datlist(pc),a1
	lea	(a1,d6.w),a1
	move.l	sv_posx(pc),d5
	add.l	#$47ab5372,d5
	lsr.l	#3,d5
	swap	d5
	move.l	d5,d1
	lsr.w	#1,d5
	and.w	#1,d1
	addq.l	#1,a0
	moveq	#$c,d4
sv3_loop:
	move.b	(a1)+,d0
	add.b	d5,d0
	move.b	d0,(a0)
	move.b	d1,2(a0)

	add.l	d4,a0
	dbf	d7,sv3_loop

	moveq	#0,d0		;sv4_rut
	move.w	sv4_pos(pc),d0
	lsr.w	#2,d0
	divu	#5,d0
	move.l	d0,d5
	lea	sv2_datlist(pc),a1
	lea	(a1,d0.w),a1

	swap	d5
	and.l	#$f,d5
	move.l	d5,d6
	swap	d6
	or.l	d6,d5
	asl.l	#8,d5
	move.l	#$25002900,d6
	sub.l	d5,d6

	lea	sv4_spr0(pc),a0
	moveq	#$28,d7
	move.l	sv_posx(pc),d5
	add.l	#$89327a32,d5
	lsr.l	#2,d5
	swap	d5
	move.l	d5,d1
	lsr.w	#1,d5
	and.w	#1,d1
	move.l	#$05000500,d3
	moveq	#$14,d4
sv4_loop:
	move.l	d6,(a0)
	move.b	(a1)+,d0
	add.b	d5,d0
	move.b	d0,1(a0)
	move.b	d1,3(a0)

	add.l	d3,d6
	add.l	d4,a0
	dbf	d7,sv4_loop


	lea	sin255,a0		;moveoffset
	move.w	sv_mdirspeedpoi(pc),d0
	add.w	sv_mdirspeedpoispeed(pc),d0
	move.w	d0,sv_mdirspeedpoi

	lsr.w	#8,d0
	move.b	(a0,d0.w),d0
	sub.w	#$20,d0
	add.w	d0,sv_mdir

	move.w	sv_mdir(pc),d0
	lsr.w	#8,d0
	move.b	(a0,d0.w),d1
	add.b	#$40,d0
	move.b	(a0,d0.w),d2
	sub.b	#$80,d1
	sub.b	#$80,d2
	ext.w	d1
	ext.w	d2
	muls	sv_mdirkraft(pc),d1
	muls	sv_mdirkraft(pc),d2

	add.l	d1,sv_posy
	add.l	d1,sv3_pos
	add.l	d1,sv_pos
	add.l	d1,sv4_pos
	add.l	d2,sv_posx
	move.l	d1,pl_sty
	move.l	d2,pl_stx
	move.w	sv_mdirkraftdir(pc),d0
	add.w	sv_mdirkraftspeed(pc),d0
	move.w	d0,sv_mdirkraftdir

	lsr.w	#8,d0
	move.b	(a0,d0.w),d0
	asl.w	#3,d0
	add.w	#$100,d0
	move.w	d0,sv_mdirkraft


	move.w	$dff00c,d0	;CheckJoy
	move.w	d0,d1
	lsr.w	#1,d1
	eor.w	d0,d1
		btst	#1,d0
		bne.s	svj_right
		btst	#9,d0
		beq.s	svj_updown
		sub.l	#svj_sense,svj_xspd	;left
		bra.s	svj_updown
svj_right:	add.l	#svj_sense,svj_xspd
svj_updown:	btst	#0,d1
		bne.s	svj_down
		btst	#8,d1
		beq.s	svj_af
		add.l	#svj_sense,svj_yspd	;up
		bra.s	svj_af
svj_down:	sub.l	#svj_sense,svj_yspd

svj_af:	move.l	svj_xspd(pc),d0
	beq.s	svj_nofric
	bmi.s	svj_xneg
	sub.l	#svj_fric,d0
	cmp.l	#svj_max,d0
	ble.s	svj_nofric
	move.l	#svj_max,d0
	bra.s	svj_nofric
svj_xneg:
	add.l	#svj_fric,d0
	cmp.l	#-svj_max,d0
	bge.s	svj_nofric
	move.l	#-svj_max,d0
svj_nofric:
	move.l	d0,svj_xspd
	add.l	d0,sv_posx

	move.l	svj_yspd(pc),d0
	beq.s	svj_noyfric
	bmi.s	svj_yneg
	sub.l	#svj_fric,d0
	cmp.l	#svj_max,d0
	ble.s	svj_noyfric
	move.l	#svj_max,d0
	bra.s	svj_noyfric
svj_yneg:
	add.l	#svj_fric,d0
	cmp.l	#-svj_max,d0
	bge.s	svj_noyfric
	move.l	#-svj_max,d0
svj_noyfric:
	move.l	d0,svj_yspd
	add.l	d0,sv_posy
	add.l	d0,sv_pos
	add.l	d0,sv3_pos
	add.l	d0,sv4_pos

	cmp.w	#$180,sv_pos
	blt.s	sv_bo
	sub.w	#$180,sv_pos
sv_bo:	tst.w	sv_pos
	bpl.s	sv_br
	add.w	#$180,sv_pos
sv_br:
	cmp.w	#$900,sv3_pos
	blt.s	sv3_bo
	sub.w	#$900,sv3_pos
sv3_bo:	tst.w	sv3_pos
	bpl.s	sv3_br
	add.w	#$900,sv3_pos
sv3_br:
	cmp.w	#$A00,sv4_pos
	blt.s	sv4_bo
	sub.w	#$A00,sv4_pos
sv4_bo:	tst.w	sv4_pos
	bpl.s	sv4_br
	add.w	#$A00,sv4_pos
sv4_br:	rts

svj_sense=$4000
svj_fric=$1000
svj_max=$7c000
svj_xspd:	dc.l	0
svj_yspd:	dc.l	0


sv4_spr0:
dc.l $25002900,$6,$f,$f,$6
dc.l $2a002e00,$6,$f,$f,$6
dc.l $2f003300,$6,$f,$f,$6
dc.l $34003800,$6,$f,$f,$6
dc.l $39003d00,$6,$f,$f,$6
dc.l $3e004200,$6,$f,$f,$6
dc.l $43004700,$6,$f,$f,$6
dc.l $48004c00,$6,$f,$f,$6
dc.l $4d005100,$6,$f,$f,$6
dc.l $52005600,$6,$f,$f,$6
dc.l $57005b00,$6,$f,$f,$6
dc.l $5c006000,$6,$f,$f,$6
dc.l $61006500,$6,$f,$f,$6
dc.l $66006a00,$6,$f,$f,$6
dc.l $6b006f00,$6,$f,$f,$6
dc.l $70007400,$6,$f,$f,$6
dc.l $75007900,$6,$f,$f,$6
dc.l $7a007e00,$6,$f,$f,$6
dc.l $7f008300,$6,$f,$f,$6
dc.l $84008800,$6,$f,$f,$6
dc.l $89008d00,$6,$f,$f,$6
dc.l $8e009200,$6,$f,$f,$6
dc.l $93009700,$6,$f,$f,$6
dc.l $98009c00,$6,$f,$f,$6
dc.l $9d00a100,$6,$f,$f,$6
dc.l $a200a600,$6,$f,$f,$6
dc.l $a700ab00,$6,$f,$f,$6
dc.l $ac00b000,$6,$f,$f,$6
dc.l $b100b500,$6,$f,$f,$6
dc.l $b600ba00,$6,$f,$f,$6
dc.l $bb00bf00,$6,$f,$f,$6
dc.l $c000c400,$6,$f,$f,$6
dc.l $c500c900,$6,$f,$f,$6
dc.l $ca00ce00,$6,$f,$f,$6
dc.l $cf00d300,$6,$f,$f,$6
dc.l $d400d800,$6,$f,$f,$6
dc.l $d900dd00,$6,$f,$f,$6
dc.l $de00e200,$6,$f,$f,$6
dc.l $e300e700,$6,$f,$f,$6
dc.l $e800ec00,$6,$f,$f,$6
dc.l $ed00f100,$6,$f,$f,$6
dc.l $f200f600,$6,$f,$f,$6
dc.l 0

sv3_spr0:
dc.l $25002700,$30000,$30000
dc.l $28002a00,$30000,$30000
dc.l $2b002d00,$30000,$30000
dc.l $2e003000,$30000,$30000
dc.l $31003300,$30000,$30000
dc.l $34003600,$30000,$30000
dc.l $37003900,$30000,$30000
dc.l $3a003c00,$30000,$30000
dc.l $3d003f00,$30000,$30000
dc.l $40004200,$30000,$30000
dc.l $43004500,$30000,$30000
dc.l $46004800,$30000,$30000
dc.l $49004b00,$30000,$30000
dc.l $4c004e00,$30000,$30000
dc.l $4f005100,$30000,$30000
dc.l $52005400,$30000,$30000
dc.l $55005700,$30000,$30000
dc.l $58005a00,$30000,$30000
dc.l $5b005d00,$30000,$30000
dc.l $5e006000,$30000,$30000
dc.l $61006300,$30000,$30000
dc.l $64006600,$30000,$30000
dc.l $67006900,$30000,$30000
dc.l $6a006c00,$30000,$30000
dc.l $6d006f00,$30000,$30000
dc.l $70007200,$30000,$30000
dc.l $73007500,$30000,$30000
dc.l $76007800,$30000,$30000
dc.l $79007b00,$30000,$30000
dc.l $7c007e00,$30000,$30000
dc.l $7f008100,$30000,$30000
dc.l $82008400,$30000,$30000
dc.l $85008700,$30000,$30000
dc.l $88008a00,$30000,$30000
dc.l $8b008d00,$30000,$30000
dc.l $8e009000,$30000,$30000
dc.l $91009300,$30000,$30000
dc.l $94009600,$30000,$30000
dc.l $97009900,$30000,$30000
dc.l $9a009c00,$30000,$30000
dc.l $9d009f00,$30000,$30000
dc.l $a000a200,$30000,$30000
dc.l $a300a500,$30000,$30000
dc.l $a600a800,$30000,$30000
dc.l $a900ab00,$30000,$30000
dc.l $ac00ae00,$30000,$30000
dc.l $af00b100,$30000,$30000
dc.l $b200b400,$30000,$30000
dc.l $b500b700,$30000,$30000
dc.l $b800ba00,$30000,$30000
dc.l $bb00bd00,$30000,$30000
dc.l $be00c000,$30000,$30000
dc.l $c100c300,$30000,$30000
dc.l $c400c600,$30000,$30000
dc.l $c700c900,$30000,$30000
dc.l $ca00cc00,$30000,$30000
dc.l $cd00cf00,$30000,$30000
dc.l $d000d200,$30000,$30000
dc.l $d300d500,$30000,$30000
dc.l $d600d800,$30000,$30000
dc.l $d900db00,$30000,$30000
dc.l $dc00de00,$30000,$30000
dc.l $df00e100,$30000,$30000
dc.l $e200e400,$30000,$30000
dc.l $e500e700,$30000,$30000
dc.l $e800ea00,$30000,$30000
dc.l $eb00ed00,$30000,$30000
dc.l $ee00f000,$30000,$30000
dc.l $f100f300,$30000,$30000
dc.l 0

sv3_spr1:
dc.l $24002600,$30000,$30000
dc.l $27002900,$30000,$30000
dc.l $2a002c00,$30000,$30000
dc.l $2d002f00,$30000,$30000
dc.l $30003200,$30000,$30000
dc.l $33003500,$30000,$30000
dc.l $36003800,$30000,$30000
dc.l $39003b00,$30000,$30000
dc.l $3c003e00,$30000,$30000
dc.l $3f004100,$30000,$30000
dc.l $42004400,$30000,$30000
dc.l $45004700,$30000,$30000
dc.l $48004a00,$30000,$30000
dc.l $4b004d00,$30000,$30000
dc.l $4e005000,$30000,$30000
dc.l $51005300,$30000,$30000
dc.l $54005600,$30000,$30000
dc.l $57005900,$30000,$30000
dc.l $5a005c00,$30000,$30000
dc.l $5d005f00,$30000,$30000
dc.l $60006200,$30000,$30000
dc.l $63006500,$30000,$30000
dc.l $66006800,$30000,$30000
dc.l $69006b00,$30000,$30000
dc.l $6c006e00,$30000,$30000
dc.l $6f007100,$30000,$30000
dc.l $72007400,$30000,$30000
dc.l $75007700,$30000,$30000
dc.l $78007a00,$30000,$30000
dc.l $7b007d00,$30000,$30000
dc.l $7e008000,$30000,$30000
dc.l $81008300,$30000,$30000
dc.l $84008600,$30000,$30000
dc.l $87008900,$30000,$30000
dc.l $8a008c00,$30000,$30000
dc.l $8d008f00,$30000,$30000
dc.l $90009200,$30000,$30000
dc.l $93009500,$30000,$30000
dc.l $96009800,$30000,$30000
dc.l $99009b00,$30000,$30000
dc.l $9c009e00,$30000,$30000
dc.l $9f00a100,$30000,$30000
dc.l $a200a400,$30000,$30000
dc.l $a500a700,$30000,$30000
dc.l $a800aa00,$30000,$30000
dc.l $ab00ad00,$30000,$30000
dc.l $ae00b000,$30000,$30000
dc.l $b100b300,$30000,$30000
dc.l $b400b600,$30000,$30000
dc.l $b700b900,$30000,$30000
dc.l $ba00bc00,$30000,$30000
dc.l $bd00bf00,$30000,$30000
dc.l $c000c200,$30000,$30000
dc.l $c300c500,$30000,$30000
dc.l $c600c800,$30000,$30000
dc.l $c900cb00,$30000,$30000
dc.l $cc00ce00,$30000,$30000
dc.l $cf00d100,$30000,$30000
dc.l $d200d400,$30000,$30000
dc.l $d500d700,$30000,$30000
dc.l $d800da00,$30000,$30000
dc.l $db00dd00,$30000,$30000
dc.l $de00e000,$30000,$30000
dc.l $e100e300,$30000,$30000
dc.l $e400e600,$30000,$30000
dc.l $e700e900,$30000,$30000
dc.l $ea00ec00,$30000,$30000
dc.l $ed00ef00,$30000,$30000
dc.l $f000f200,$30000,$30000
dc.l 0

sv3_spr2:
dc.l $23002500,$30000,$30000
dc.l $26002800,$30000,$30000
dc.l $29002b00,$30000,$30000
dc.l $2c002e00,$30000,$30000
dc.l $2f003100,$30000,$30000
dc.l $32003400,$30000,$30000
dc.l $35003700,$30000,$30000
dc.l $38003a00,$30000,$30000
dc.l $3b003d00,$30000,$30000
dc.l $3e004000,$30000,$30000
dc.l $41004300,$30000,$30000
dc.l $44004600,$30000,$30000
dc.l $47004900,$30000,$30000
dc.l $4a004c00,$30000,$30000
dc.l $4d004f00,$30000,$30000
dc.l $50005200,$30000,$30000
dc.l $53005500,$30000,$30000
dc.l $56005800,$30000,$30000
dc.l $59005b00,$30000,$30000
dc.l $5c005e00,$30000,$30000
dc.l $5f006100,$30000,$30000
dc.l $62006400,$30000,$30000
dc.l $65006700,$30000,$30000
dc.l $68006a00,$30000,$30000
dc.l $6b006d00,$30000,$30000
dc.l $6e007000,$30000,$30000
dc.l $71007300,$30000,$30000
dc.l $74007600,$30000,$30000
dc.l $77007900,$30000,$30000
dc.l $7a007c00,$30000,$30000
dc.l $7d007f00,$30000,$30000
dc.l $80008200,$30000,$30000
dc.l $83008500,$30000,$30000
dc.l $86008800,$30000,$30000
dc.l $89008b00,$30000,$30000
dc.l $8c008e00,$30000,$30000
dc.l $8f009100,$30000,$30000
dc.l $92009400,$30000,$30000
dc.l $95009700,$30000,$30000
dc.l $98009a00,$30000,$30000
dc.l $9b009d00,$30000,$30000
dc.l $9e00a000,$30000,$30000
dc.l $a100a300,$30000,$30000
dc.l $a400a600,$30000,$30000
dc.l $a700a900,$30000,$30000
dc.l $aa00ac00,$30000,$30000
dc.l $ad00af00,$30000,$30000
dc.l $b000b200,$30000,$30000
dc.l $b300b500,$30000,$30000
dc.l $b600b800,$30000,$30000
dc.l $b900bb00,$30000,$30000
dc.l $bc00be00,$30000,$30000
dc.l $bf00c100,$30000,$30000
dc.l $c200c400,$30000,$30000
dc.l $c500c700,$30000,$30000
dc.l $c800ca00,$30000,$30000
dc.l $cb00cd00,$30000,$30000
dc.l $ce00d000,$30000,$30000
dc.l $d100d300,$30000,$30000
dc.l $d400d600,$30000,$30000
dc.l $d700d900,$30000,$30000
dc.l $da00dc00,$30000,$30000
dc.l $dd00df00,$30000,$30000
dc.l $e000e200,$30000,$30000
dc.l $e300e500,$30000,$30000
dc.l $e600e800,$30000,$30000
dc.l $e900eb00,$30000,$30000
dc.l $ec00ee00,$30000,$30000
dc.l $ef00f100,$30000,$30000
dc.l 0


sv2_spr0:
dc.l	$25002600,$00001
dc.l	$27002800,$10001
dc.l	$29002a00,$00001
dc.l	$2b002c00,$10001
dc.l	$2d002e00,$00001
dc.l	$2f003000,$10001
dc.l	$31003200,$00001
dc.l	$33003400,$10001
dc.l	$35003600,$00001
dc.l	$37003800,$10001
dc.l	$39003a00,$00001
dc.l	$3b003c00,$10001
dc.l	$3d003e00,$00001
dc.l	$3f004000,$10001
dc.l	$41004200,$00001
dc.l	$43004400,$10001
dc.l	$45004600,$00001
dc.l	$47004800,$10001
dc.l	$49004a00,$00001
dc.l	$4b004c00,$10001
dc.l	$4d004e00,$00001
dc.l	$4f005000,$10001
dc.l	$51005200,$00001
dc.l	$53005400,$10001
dc.l	$55005600,$00001
dc.l	$57005800,$10001
dc.l	$59005a00,$00001
dc.l	$5b005c00,$10001
dc.l	$5d005e00,$00001
dc.l	$5f006000,$10001
dc.l	$61006200,$00001
dc.l	$63006400,$10001
dc.l	$65006600,$00001
dc.l	$67006800,$10001
dc.l	$69006a00,$00001
dc.l	$6b006c00,$10001
dc.l	$6d006e00,$00001
dc.l	$6f007000,$10001
dc.l	$71007200,$00001
dc.l	$73007400,$10001
dc.l	$75007600,$00001
dc.l	$77007800,$10001
dc.l	$79007a00,$00001
dc.l	$7b007c00,$10001
dc.l	$7d007e00,$00001
dc.l	$7f008000,$10001
dc.l	$81008200,$00001
dc.l	$83008400,$10001
dc.l	$85008600,$00001
dc.l	$87008800,$10001
dc.l	$89008a00,$00001
dc.l	$8b008c00,$10001
dc.l	$8d008e00,$00001
dc.l	$8f009000,$10001
dc.l	$91009200,$00001
dc.l	$93009400,$10001
dc.l	$95009600,$00001
dc.l	$97009800,$10001
dc.l	$99009a00,$00001
dc.l	$9b009c00,$10001
dc.l	$9d009e00,$00001
dc.l	$9f00a000,$10001
dc.l	$a100a200,$00001
dc.l	$a300a400,$10001
dc.l	$a500a600,$00001
dc.l	$a700a800,$10001
dc.l	$a900aa00,$00001
dc.l	$ab00ac00,$10001
dc.l	$ad00ae00,$00001
dc.l	$af00b000,$10001
dc.l	$b100b200,$00001
dc.l	$b300b400,$10001
dc.l	$b500b600,$00001
dc.l	$b700b800,$10001
dc.l	$b900ba00,$00001
dc.l	$bb00bc00,$10001
dc.l	$bd00be00,$00001
dc.l	$bf00c000,$10001
dc.l	$c100c200,$00001
dc.l	$c300c400,$10001
dc.l	$c500c600,$00001
dc.l	$c700c800,$10001
dc.l	$c900ca00,$00001
dc.l	$cb00cc00,$10001
dc.l	$cd00ce00,$00001
dc.l	$cf00d000,$10001
dc.l	$d100d200,$00001
dc.l	$d300d400,$10001
dc.l	$d500d600,$00001
dc.l	$d700d800,$10001
dc.l	$d900da00,$00001
dc.l	$db00dc00,$10001
dc.l	$dd00de00,$00001
dc.l	$df00e000,$10001
dc.l	$e100e200,$00001
dc.l	$e300e400,$10001
dc.l	$e500e600,$00001
dc.l	$e700e800,$10001
dc.l	$e900ea00,$00001
dc.l	$eb00ec00,$10001
dc.l	0,0
dc.l	0,0

sv2_spr1:
dc.l	$26002700,$10001
dc.l	$28002900,$00001
dc.l	$2a002b00,$10001
dc.l	$2c002d00,$00001
dc.l	$2e002f00,$10001
dc.l	$30003100,$00001
dc.l	$32003300,$10001
dc.l	$34003500,$00001
dc.l	$36003700,$10001
dc.l	$38003900,$00001
dc.l	$3a003b00,$10001
dc.l	$3c003d00,$00001
dc.l	$3e003f00,$10001
dc.l	$40004100,$00001
dc.l	$42004300,$10001
dc.l	$44004500,$00001
dc.l	$46004700,$10001
dc.l	$48004900,$00001
dc.l	$4a004b00,$10001
dc.l	$4c004d00,$00001
dc.l	$4e004f00,$10001
dc.l	$50005100,$00001
dc.l	$52005300,$10001
dc.l	$54005500,$00001
dc.l	$56005700,$10001
dc.l	$58005900,$00001
dc.l	$5a005b00,$10001
dc.l	$5c005d00,$00001
dc.l	$5e005f00,$10001
dc.l	$60006100,$00001
dc.l	$62006300,$10001
dc.l	$64006500,$00001
dc.l	$66006700,$10001
dc.l	$68006900,$00001
dc.l	$6a006b00,$10001
dc.l	$6c006d00,$00001
dc.l	$6e006f00,$10001
dc.l	$70007100,$00001
dc.l	$72007300,$10001
dc.l	$74007500,$00001
dc.l	$76007700,$10001
dc.l	$78007900,$00001
dc.l	$7a007b00,$10001
dc.l	$7c007d00,$00001
dc.l	$7e007f00,$10001
dc.l	$80008100,$00001
dc.l	$82008300,$10001
dc.l	$84008500,$00001
dc.l	$86008700,$10001
dc.l	$88008900,$00001
dc.l	$8a008b00,$10001
dc.l	$8c008d00,$00001
dc.l	$8e008f00,$10001
dc.l	$90009100,$00001
dc.l	$92009300,$10001
dc.l	$94009500,$00001
dc.l	$96009700,$10001
dc.l	$98009900,$00001
dc.l	$9a009b00,$10001
dc.l	$9c009d00,$00001
dc.l	$9e009f00,$10001
dc.l	$a000a100,$00001
dc.l	$a200a300,$10001
dc.l	$a400a500,$00001
dc.l	$a600a700,$10001
dc.l	$a800a900,$00001
dc.l	$aa00ab00,$10001
dc.l	$ac00ad00,$00001
dc.l	$ae00af00,$10001
dc.l	$b000b100,$00001
dc.l	$b200b300,$10001
dc.l	$b400b500,$00001
dc.l	$b600b700,$10001
dc.l	$b800b900,$00001
dc.l	$ba00bb00,$10001
dc.l	$bc00bd00,$00001
dc.l	$be00bf00,$10001
dc.l	$c000c100,$00001
dc.l	$c200c300,$10001
dc.l	$c400c500,$00001
dc.l	$c600c700,$10001
dc.l	$c800c900,$00001
dc.l	$ca00cb00,$10001
dc.l	$cc00cd00,$00001
dc.l	$ce00cf00,$10001
dc.l	$d000d100,$00001
dc.l	$d200d300,$10001
dc.l	$d400d500,$00001
dc.l	$d600d700,$10001
dc.l	$d800d900,$00001
dc.l	$da00db00,$10001
dc.l	$dc00dd00,$00001
dc.l	$de00df00,$10001
dc.l	$e000e100,$00001
dc.l	$e200e300,$10001
dc.l	$e400e500,$00001
dc.l	$e600e700,$10001
dc.l	$e800e900,$00001
dc.l	$ea00eb00,$10001
dc.l	$ec00ed00,$00001
dc.l	0,0
dc.l	0,0

sv2_spr2:
dc.l	$25002600,$10001
dc.l	$27002800,$00001
dc.l	$29002a00,$10001
dc.l	$2b002c00,$00001
dc.l	$2d002e00,$10001
dc.l	$2f003000,$00001
dc.l	$31003200,$10001
dc.l	$33003400,$00001
dc.l	$35003600,$10001
dc.l	$37003800,$00001
dc.l	$39003a00,$10001
dc.l	$3b003c00,$00001
dc.l	$3d003e00,$10001
dc.l	$3f004000,$00001
dc.l	$41004200,$10001
dc.l	$43004400,$00001
dc.l	$45004600,$10001
dc.l	$47004800,$00001
dc.l	$49004a00,$10001
dc.l	$4b004c00,$00001
dc.l	$4d004e00,$10001
dc.l	$4f005000,$00001
dc.l	$51005200,$10001
dc.l	$53005400,$00001
dc.l	$55005600,$10001
dc.l	$57005800,$00001
dc.l	$59005a00,$10001
dc.l	$5b005c00,$00001
dc.l	$5d005e00,$10001
dc.l	$5f006000,$00001
dc.l	$61006200,$10001
dc.l	$63006400,$00001
dc.l	$65006600,$10001
dc.l	$67006800,$00001
dc.l	$69006a00,$10001
dc.l	$6b006c00,$00001
dc.l	$6d006e00,$10001
dc.l	$6f007000,$00001
dc.l	$71007200,$10001
dc.l	$73007400,$00001
dc.l	$75007600,$10001
dc.l	$77007800,$00001
dc.l	$79007a00,$10001
dc.l	$7b007c00,$00001
dc.l	$7d007e00,$10001
dc.l	$7f008000,$00001
dc.l	$81008200,$10001
dc.l	$83008400,$00001
dc.l	$85008600,$10001
dc.l	$87008800,$00001
dc.l	$89008a00,$10001
dc.l	$8b008c00,$00001
dc.l	$8d008e00,$10001
dc.l	$8f009000,$00001
dc.l	$91009200,$10001
dc.l	$93009400,$00001
dc.l	$95009600,$10001
dc.l	$97009800,$00001
dc.l	$99009a00,$10001
dc.l	$9b009c00,$00001
dc.l	$9d009e00,$10001
dc.l	$9f00a000,$00001
dc.l	$a100a200,$10001
dc.l	$a300a400,$00001
dc.l	$a500a600,$10001
dc.l	$a700a800,$00001
dc.l	$a900aa00,$10001
dc.l	$ab00ac00,$00001
dc.l	$ad00ae00,$10001
dc.l	$af00b000,$00001
dc.l	$b100b200,$10001
dc.l	$b300b400,$00001
dc.l	$b500b600,$10001
dc.l	$b700b800,$00001
dc.l	$b900ba00,$10001
dc.l	$bb00bc00,$00001
dc.l	$bd00be00,$10001
dc.l	$bf00c000,$00001
dc.l	$c100c200,$10001
dc.l	$c300c400,$00001
dc.l	$c500c600,$10001
dc.l	$c700c800,$00001
dc.l	$c900ca00,$10001
dc.l	$cb00cc00,$00001
dc.l	$cd00ce00,$10001
dc.l	$cf00d000,$00001
dc.l	$d100d200,$10001
dc.l	$d300d400,$00001
dc.l	$d500d600,$10001
dc.l	$d700d800,$00001
dc.l	$d900da00,$10001
dc.l	$db00dc00,$00001
dc.l	$dd00de00,$10001
dc.l	$df00e000,$00001
dc.l	$e100e200,$10001
dc.l	$e300e400,$00001
dc.l	$e500e600,$10001
dc.l	$e700e800,$00001
dc.l	$e900ea00,$10001
dc.l	$eb00ec00,$00001
dc.l	0,0
dc.l	0,0

sv2_spr3:
dc.l	$26002700,$00001
dc.l	$28002900,$10001
dc.l	$2a002b00,$00001
dc.l	$2c002d00,$10001
dc.l	$2e002f00,$00001
dc.l	$30003100,$10001
dc.l	$32003300,$00001
dc.l	$34003500,$10001
dc.l	$36003700,$00001
dc.l	$38003900,$10001
dc.l	$3a003b00,$00001
dc.l	$3c003d00,$10001
dc.l	$3e003f00,$00001
dc.l	$40004100,$10001
dc.l	$42004300,$00001
dc.l	$44004500,$10001
dc.l	$46004700,$00001
dc.l	$48004900,$10001
dc.l	$4a004b00,$00001
dc.l	$4c004d00,$10001
dc.l	$4e004f00,$00001
dc.l	$50005100,$10001
dc.l	$52005300,$00001
dc.l	$54005500,$10001
dc.l	$56005700,$00001
dc.l	$58005900,$10001
dc.l	$5a005b00,$00001
dc.l	$5c005d00,$10001
dc.l	$5e005f00,$00001
dc.l	$60006100,$10001
dc.l	$62006300,$00001
dc.l	$64006500,$10001
dc.l	$66006700,$00001
dc.l	$68006900,$10001
dc.l	$6a006b00,$00001
dc.l	$6c006d00,$10001
dc.l	$6e006f00,$00001
dc.l	$70007100,$10001
dc.l	$72007300,$00001
dc.l	$74007500,$10001
dc.l	$76007700,$00001
dc.l	$78007900,$10001
dc.l	$7a007b00,$00001
dc.l	$7c007d00,$10001
dc.l	$7e007f00,$00001
dc.l	$80008100,$10001
dc.l	$82008300,$00001
dc.l	$84008500,$10001
dc.l	$86008700,$00001
dc.l	$88008900,$10001
dc.l	$8a008b00,$00001
dc.l	$8c008d00,$10001
dc.l	$8e008f00,$00001
dc.l	$90009100,$10001
dc.l	$92009300,$00001
dc.l	$94009500,$10001
dc.l	$96009700,$00001
dc.l	$98009900,$10001
dc.l	$9a009b00,$00001
dc.l	$9c009d00,$10001
dc.l	$9e009f00,$00001
dc.l	$a000a100,$10001
dc.l	$a200a300,$00001
dc.l	$a400a500,$10001
dc.l	$a600a700,$00001
dc.l	$a800a900,$10001
dc.l	$aa00ab00,$00001
dc.l	$ac00ad00,$10001
dc.l	$ae00af00,$00001
dc.l	$b000b100,$10001
dc.l	$b200b300,$00001
dc.l	$b400b500,$10001
dc.l	$b600b700,$00001
dc.l	$b800b900,$10001
dc.l	$ba00bb00,$00001
dc.l	$bc00bd00,$10001
dc.l	$be00bf00,$00001
dc.l	$c000c100,$10001
dc.l	$c200c300,$00001
dc.l	$c400c500,$10001
dc.l	$c600c700,$00001
dc.l	$c800c900,$10001
dc.l	$ca00cb00,$00001
dc.l	$cc00cd00,$10001
dc.l	$ce00cf00,$00001
dc.l	$d000d100,$10001
dc.l	$d200d300,$00001
dc.l	$d400d500,$10001
dc.l	$d600d700,$00001
dc.l	$d800d900,$10001
dc.l	$da00db00,$00001
dc.l	$dc00dd00,$10001
dc.l	$de00df00,$00001
dc.l	$e000e100,$10001
dc.l	$e200e300,$00001
dc.l	$e400e500,$10001
dc.l	$e600e700,$00001
dc.l	$e800e900,$10001
dc.l	$ea00eb00,$00001
dc.l	$ec00ed00,$10001
dc.l	0,0
dc.l	0,0

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

CalNotValid:	dc.w	0

GetCal:
 IF TryDatum=0
	LEA $DC0001.L,A0
	move.b	$2c(a0),d0
	and.w	#$f,d0
	cmp.w	#$9,d0
	ble.s	.u
	addq.w	#1,CalNotValid
.u:
	mulu	#10,d0
	move.b	$28(a0),d1
	and.w	#$f,d1
	cmp.w	#9,d1
	ble.s	.v
	addq.w	#1,CalNotValid
.v:	add.w	d0,d1
	add.w	#1900,d1
	cmp.w	#1988,d1
	bge.s	yearok
	add.w	#0100,d1
yearok:	move.w	d1,year

	moveq	#0,d0
	move.b	$24(a0),d0
	and.w	#$f,d0
	mulu	#10,d0
	move.b	$20(a0),d1
	and.w	#$f,d1
	add.w	d1,d0
	move.w	d0,monnr
	tst.w	d0
	bne.s	.ok
	addq.w	#1,CalNotValid
.ok:	cmp.w	#12,d0
	ble.s	.k
	addq.w	#1,CalNotValid
.k:

	moveq	#0,d0
	move.b	$1c(a0),d0
	and.w	#$f,d0
	mulu	#10,d0
	move.b	$18(a0),d1
	and.w	#$f,d1
	add.w	d1,d0
	move.w	d0,Datnr
	tst.w	d0
	bne.s	.w
	addq.w	#1,CalNotValid
.w:	cmp.w	#31,d0
	ble.s	.g
	addq.w	#1,CalNotValid
.g:

	move.b	$14(a0),d0
	and.w	#$f,d0
	cmp.w	#2,d0
	ble.s	.t
	addq.w	#1,CalNotValid	;tiotalstimme>2=err
.t:
	add.b	#$30,d0
	move.b	d0,timme1
	move.b	$10(a0),d0
	and.w	#$f,d0
	add.b	#$30,d0
	move.b	d0,timme2

	move.b	$c(a0),d0
	and.w	#$f,d0
	cmp.w	#6,d0
	ble.s	.y
	addq.w	#1,CalNotValid
.y:
	add.b	#$30,d0
	move.b	d0,minut1
	move.b	$8(a0),d0
	and.w	#$f,d0
	add.b	#$30,d0
	move.b	d0,minut2

	move.b	$4(a0),d0
	and.w	#$f,d0
	cmp.w	#6,d0
	ble.s	.q
	addq.w	#1,CalNotValid
.q:
	add.b	#$30,d0
	move.b	d0,sekund1
	move.b	(a0),d0
	and.w	#$f,d0
	add.b	#$30,d0
	move.b	d0,sekund2
 ENDC
;CalculateVeckodag:
	tst.w	CalNotValid
	bne	ot_rts

	moveq	#0,d1
	moveq	#0,d0
	move.w	year(pc),d0
	sub.w	#1988,d0
	tst.w	d0
	beq.s	.yeok
.yelop:	add.w	#366,d1
	subq.w	#1,d0
	beq.s	.yeok
	add.w	#365,d1
	subq.w	#1,d0
	beq.s	.yeok
	add.w	#365,d1
	subq.w	#1,d0
	beq.s	.yeok
	add.w	#365,d1
	subq.w	#1,d0
	bne.s	.yelop
.yeok:
	moveq	#0,d0
	move.w	monnr(pc),d0
	subq.w	#1,d0
	cmp.w	#2,d0
	blt.s	.nofebruariadd
	moveq	#0,d2
	move.w	year(pc),d2
	divu	#4,d2
	swap	d2
	tst.w	d2		;skottar?
	bne.s	.nofebruariadd
	addq.w	#1,d1
.nofebruariadd:
	lea	monthlen(pc),a1
	add.w	d0,d0
	add.w	(a1,d0.w),d1
	add.w	datnr(pc),d1
	move.w	d1,dayno
	addq.w	#3,d1
	and.l	#$ffff,d1
	divu	#7,d1
	swap	d1
	move.w	d1,veckodag
	rts
			;j  f  m  a  m  j  j  a  s  o  n  d
monthlen:	;dc.w	31,28,31,30, 31, 30, 31, 31, 30, 31, 30, 31
		dc.w	0,31,59,90,120,151,181,212,243,273,304,334,365

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

gr_init:moveq	#[28*4]-1,d7
	lea	gr_spr1dat,a0
gr_ilo:	bsr	random
	move.l	rnd+6,(a0)+
	dbf	d7,gr_ilo
	rts

gr_speed:	dc.l	0

traingo:	dc.w	0

tr_rut:	cmp.w	#1,traingo
	bne	tr_1
	move.w	#TrainCopCont/$10000,TrainCopPoi+2
	move.w	#TrainCopCont&$ffff,TrainCopPoi+6
	move.w	#[TrainR+[$d8*0]]/$10000,Tr0+2
	move.w	#[TrainR+[$d8*0]]&$ffff,Tr0+6
	move.w	#[TrainR+[$d8*1]]/$10000,Tr1+2
	move.w	#[TrainR+[$d8*1]]&$ffff,Tr1+6
	move.w	#[TrainR+[$d8*2]]/$10000,Tr2+2
	move.w	#[TrainR+[$d8*2]]&$ffff,Tr2+6
	move.w	#[TrainR+[$d8*3]]/$10000,Tr3+2
	move.w	#[TrainR+[$d8*3]]&$ffff,Tr3+6
	move.w	#[TrainR+[$d8*4]]/$10000,Tr4+2
	move.w	#[TrainR+[$d8*4]]&$ffff,Tr4+6
	addq.w	#1,traingo
	move.l	#$00003406,TrainR+[$d8*0]
	move.l	#$00083406,TrainR+[$d8*1]
	move.l	#$00103406,TrainR+[$d8*2]
	move.l	#$00183406,TrainR+[$d8*3]
	move.l	#$00203406,TrainR+[$d8*4]
	rts

tr_1:	addq.w	#1,traingo

	subq.b	#1,TrainR+[$d8*4]+1
	subq.b	#1,TrainR+[$d8*3]+1
	subq.b	#1,TrainR+[$d8*2]+1
	subq.b	#1,TrainR+[$d8*1]+1
	subq.b	#1,TrainR+[$d8*0]+1
	beq.s	tr_end
	rts

tr_end:	clr.w	traingo
	move.w	#NormCopCont/$10000,TrainCopPoi+2
	move.w	#NormCopCont&$ffff,TrainCopPoi+6

	move.l	gr_5pek(pc),d0
	move.w	d0,Tr0+6
	swap	d0
	move.w	d0,Tr0+2
	move.w	#gr_spr1/$10000,Tr1+2
	move.w	#gr_spr1&$ffff,Tr1+6
	move.w	#gr_spr2/$10000,Tr2+2
	move.w	#gr_spr2&$ffff,Tr2+6
	move.w	#gr_spr3/$10000,Tr3+2
	move.w	#gr_spr3&$ffff,Tr3+6
	move.w	#gr_spr4/$10000,Tr4+2
	move.w	#gr_spr4&$ffff,Tr4+6
	rts

gr_5pek:	dc.l	Droppen
gr_5cou:	dc.w	0
gr_sidl:	dc.l	0

gr_rut:	tst.w	traingo
	bne	tr_rut

	addq.w	#1,gr_5cou
	cmp.w	#[$17*8]+$44,gr_5cou
	bne.s	gr_5ok
	clr.w	gr_5cou
	move.l	rnd(pc),gr_sidl

gr_5ok:	move.w	gr_5cou(pc),d0
	move.w	d0,d1
	cmp.w	#[$d*8],d0
	blt.s	gr_53
	cmp.w	#[$d*8]+$40,d0
	bge.s	gr_54
	move.w	#[$d*8]+$40,d0

gr_54:	sub.w	#$40,d0
gr_53:	lsr.w	#3,d0
	asl.w	#5,d0
	lea	Droppen,a0
	lea	(a0,d0.w),a0
	move.l	a0,gr_5pek

	sub.w	#$d*8,d1
	bpl.s	gr_51
	clr.w	d1
gr_51:	cmp.w	#$44,d1
	blt.s	gr_52
	moveq	#$44,d1
	move.l	gr_speed(pc),d2
	add.l	d2,d2
	move.l	d2,d3
	add.l	d2,d2
	add.l	d3,d2
	lsr.l	#2,d3
	add.l	d3,d2
	sub.l	d2,gr_sidl

gr_52:	lsr.b	#1,d1
	move.b	d1,(a0)
	addq.b	#6,d1
	move.b	d1,2(a0)

	move.l	gr_sidl(pc),d2
	swap	d2
	move.b	#$6,3(a0)
	lsr.w	#1,d2
	bcc.s	gr_72
	move.b	#$7,3(a0)
gr_72:	move.b	d2,1(a0)


	move.l	gr_5pek(pc),d0
	move.w	d0,Tr0+6
	swap	d0
	move.w	d0,Tr0+2

	move.l	pe_xpos(pc),d0
	sub.l	#$11a0000,d0
	swap	d0
	asr.w	#2,d0
	neg.w	d0
	ext.l	d0
	move.l	gr_speed(pc),d1
	add.l	d0,gr_speed

	move.l	gr_speed(pc),d0
	bpl.s	gr_sp2
	neg.l	d0
gr_sp2:	cmp.l	#$6000,d0
	ble.s	gr_sp3
	move.l	d1,gr_speed
gr_sp3:

	moveq	#27,d7
	lea	gr_spr1+1(pc),a0
	lea	gr_spr2+1(pc),a2
	lea	gr_spr1dat,a1
	lea	gr_spr2dat,a3

	move.l	gr_speed(pc),d6
	move.l	d6,d5
	asr.l	#$4,d5
gr_lop1:move.l	(a1),d0
	sub.l	d6,d0
	move.l	d0,(a1)+
	moveq	#6,d1
	tst.w	d0
	bpl.s	gr_1
	moveq	#7,d1
gr_1:	swap	d0
	move.b	d0,(a0)
	move.b	d1,2(a0)

	add.l	d5,d6

	move.l	(a3),d0
	sub.l	d6,d0
	move.l	d0,(a3)+
	moveq	#6,d1
	tst.w	d0
	bpl.s	gr_2
	moveq	#7,d1
gr_2:	swap	d0
	move.b	d0,(a2)
	move.b	d1,2(a2)

	add.l	d5,d6
	addq.l	#8,a0
	addq.l	#8,a2
	dbf	d7,gr_lop1


	moveq	#27,d7
	addq.l	#4,a0
	addq.l	#4,a2

	move.l	gr_speed(pc),d6
	move.l	d6,d5
	asr.l	#$4,d5
	add.l	#$100,d6
gr_lop2:move.l	(a1),d0
	sub.l	d6,d0
	move.l	d0,(a1)+
	moveq	#6,d1
	tst.w	d0
	bpl.s	gr_3
	moveq	#7,d1
gr_3:	swap	d0
	move.b	d0,(a0)
	move.b	d1,2(a0)

	add.l	d5,d6

	move.l	(a3),d0
	sub.l	d6,d0
	move.l	d0,(a3)+
	moveq	#6,d1
	tst.w	d0
	bpl.s	gr_4
	moveq	#7,d1
gr_4:	swap	d0
	move.b	d0,(a2)
	move.b	d1,2(a2)

	add.l	d5,d6
	addq.l	#8,a0
	addq.l	#8,a2
	dbf	d7,gr_lop2
	rts

gr_spr1:
dc.l $00a00106,$e0000000
dc.l $02a00306,$e0000000
dc.l $04a00506,$f0000000
dc.l $06a00706,$f0000000
dc.l $08a00906,$f8000000
dc.l $0aa00b06,$f8000000
dc.l $0ca00d06,$fc000000
dc.l $0ea00f06,$fc000000

dc.l $10a01106,$fe000000
dc.l $12a01306,$fe000000
dc.l $14a01506,$ff000000
dc.l $16a01706,$ff000000
dc.l $18a01906,$ff800000
dc.l $1aa01b06,$ff800000
dc.l $1ca01d06,$ffc00000
dc.l $1ea01f06,$ffc00000

dc.l $20a02106,$ffe00000
dc.l $22a02306,$ffe00000
dc.l $24a02506,$fff00000
dc.l $26a02706,$fff00000
dc.l $28a02906,$fff80000
dc.l $2aa02b06,$fff80000
dc.l $2ca02d06,$fffc0000
dc.l $2ea02f06,$fffc0000

dc.l $30a03106,$fffe0000
dc.l $32a03306,$fffe0000
dc.l $34a03506,$ffff0000
dc.l $36a03706,$ffff0000
dc.l 0

gr_spr3:
dc.l $00a00106,$e0000000
dc.l $02a00306,$e0000000
dc.l $04a00506,$f0000000
dc.l $06a00706,$f0000000
dc.l $08a00906,$f8000000
dc.l $0aa00b06,$f8000000
dc.l $0ca00d06,$fc000000
dc.l $0ea00f06,$fc000000

dc.l $10a01106,$fe000000
dc.l $12a01306,$fe000000
dc.l $14a01506,$ff000000
dc.l $16a01706,$ff000000
dc.l $18a01906,$ff800000
dc.l $1aa01b06,$ff800000
dc.l $1ca01d06,$ffc00000
dc.l $1ea01f06,$ffc00000

dc.l $20a02106,$ffe00000
dc.l $22a02306,$ffe00000
dc.l $24a02506,$fff00000
dc.l $26a02706,$fff00000
dc.l $28a02906,$fff80000
dc.l $2aa02b06,$fff80000
dc.l $2ca02d06,$fffc0000
dc.l $2ea02f06,$fffc0000

dc.l $30a03106,$fffe0000
dc.l $32a03306,$fffe0000
dc.l $34a03506,$ffff0000
dc.l $36a03706,$ffff0000
dc.l 0

gr_spr2:
dc.l $01a00206,$e000
dc.l $03a00406,$e000
dc.l $05a00606,$f000
dc.l $07a00806,$f000
dc.l $09a00a06,$f800
dc.l $0ba00c06,$f800
dc.l $0da00e06,$fc00
dc.l $0fa01006,$fc00

dc.l $11a01206,$fe00
dc.l $13a01406,$fe00
dc.l $15a01606,$ff00
dc.l $17a01806,$ff00
dc.l $19a01a06,$ff80
dc.l $1ba01c06,$ff80
dc.l $1da01e06,$ffc0
dc.l $1fa02006,$ffc0

dc.l $21a02206,$ffe0
dc.l $23a02406,$ffe0
dc.l $25a02606,$fff0
dc.l $27a02806,$fff0
dc.l $29a02a06,$fff8
dc.l $2ba02c06,$fff8
dc.l $2da02e06,$fffc
dc.l $2fa03006,$fffc

dc.l $31a03206,$fffe
dc.l $33a03406,$fffe
dc.l $35a03606,$ffff
dc.l $37a03806,$ffff
dc.l 0

gr_spr4:
dc.l $01a00206,$e000
dc.l $03a00406,$e000
dc.l $05a00606,$f000
dc.l $07a00806,$f000
dc.l $09a00a06,$f800
dc.l $0ba00c06,$f800
dc.l $0da00e06,$fc00
dc.l $0fa01006,$fc00

dc.l $11a01206,$fe00
dc.l $13a01406,$fe00
dc.l $15a01606,$ff00
dc.l $17a01806,$ff00
dc.l $19a01a06,$ff80
dc.l $1ba01c06,$ff80
dc.l $1da01e06,$ffc0
dc.l $1fa02006,$ffc0

dc.l $21a02206,$ffe0
dc.l $23a02406,$ffe0
dc.l $25a02606,$fff0
dc.l $27a02806,$fff0
dc.l $29a02a06,$fff8
dc.l $2ba02c06,$fff8
dc.l $2da02e06,$fffc
dc.l $2fa03006,$fffc

dc.l $31a03206,$fffe
dc.l $33a03406,$fffe
dc.l $35a03606,$ffff
dc.l $37a03806,$ffff
dc.l 0

gr_spr5:	dc.l 0

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

HallonCop:
	dc.w $0100,$2000,$0102,$00cc,$0104,$0000
	dc.w $0108,$0000,$010a,$0000,$0096,$8020
hal1:	dc.w $e0,hallon/$10000,$e2,hallon&$ffff
hal2:	dc.w $e4,[hallon+$400]/$10000,$e6,[hallon+$400]&$ffff
	dc.w $0180,$4bf,$0182,$166,$0184,$5aa,$0186,$aff
	dc.w $008e,$5071,$0090,$90c7,$0092,$0060,$0094,$0098
	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 $6373,-2,$186,$3ff,$63a9,-2,$186,$aff
dc.w $6473,-2,$186,$4ff,$64a9,-2,$186,$aff
dc.w $6573,-2,$186,$5ff,$65a9,-2,$186,$aff
dc.w $6673,-2,$186,$6ff,$66a9,-2,$186,$aff
dc.w $6773,-2,$186,$7ff,$67a9,-2,$186,$aff
dc.w $6873,-2,$186,$8ff,$68a9,-2,$186,$aff
dc.w $6973,-2,$186,$9ff,$69a9,-2,$186,$aff
dc.w $6a73,-2,$186,$aff,$6aa9,-2,$186,$aff
dc.w $6b73,-2,$186,$aef,$6ba9,-2,$186,$aff
dc.w $6c73,-2,$186,$adf,$6ca9,-2,$186,$aff
dc.w $6d73,-2,$186,$acf,$6da9,-2,$186,$aff
dc.w $6e73,-2,$186,$abf,$6ea9,-2,$186,$aff
dc.w $6f73,-2,$186,$aaf,$6fa9,-2,$186,$aff
dc.w $7073,-2,$186,$a9f,$70a9,-2,$186,$aff
dc.w $7173,-2,$186,$a8f,$71a9,-2,$186,$aff
dc.l $fffffffe

Helpcop:dc.w $0100,$1200,$0102,$00a0,$0104,$0020,$0108,0,$010a,0
	dc.w $0096,$8020
	dc.w $008e,$6071,$0090,$c4c7,$0092,$0048,$0094,$00c0
	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 $00e0,HelpR/$10000,$00e2,HelpR&$ffff
	dc.w $00e4,HelpR/$10000,$00e6,HelpR&$ffff
	dc.w $0180,$475,$0184,$353
hcs:	dc.w $0182,$eac,$0186,$eac
	dc.w $6a07,$fffe,$0100,$2200
	dc.w $ba01,$fffe,$0100,$1200
	dc.w $00e0,[HelpR+$a00]/$10000,$00e2,[HelpR+$a00]&$ffff
	dc.w $0182,$353,$0102,$000a
	dc.l	-2

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

cop:	dc.w $100,$2200,$102,$0000,$104,$0008
	dc.w $096,$8020
	dc.w $08e,$2571,$090,$38c7,$092,$0030,$094,$00d8

	dc.w $120,pek/$10000,$122,pek&$ffff
sv_cop:	dc.w $124,sv_spr/$10000,$126,sv_spr&$ffff
	dc.w $128,dummy/$10000,$12a,dummy&$ffff
sv4_cop:dc.w $12c,sv4_spr0/$10000,$12e,sv4_spr0&$ffff
sv3_cop:dc.w $130,sv3_spr2/$10000,$132,sv3_spr2&$ffff
sv2_cop:dc.w $134,sv2_spr0/$10000,$136,sv2_spr0&$ffff
	dc.w $138,dummy/$10000,$13a,dummy&$ffff
	dc.w $13c,dummy/$10000,$13e,dummy&$ffff

pec_col:dc.w $1a2,$f84,$1a4,$000

	dc.w $1a6,$997,$1ac,$657
	dc.w $1b4,$65a,$1b6,$575,$1b2,$644


	dc.w $180,$000
mc_col23:dc.w	$188,$000,$18a,$000
pt_rad0col:
	dc.w $184,$d50,$186,$d50

	dc.w $108,$0000,$10a,$0000
	dc.w $0e0,plotbpl/$10000,$0e2,plotbpl&$ffff
pt_rad1:dc.w $0e4,textbpl/$10000,$0e6,textbpl&$ffff
mk_col1:dc.w $182,plotcol

	dc.w $2007,$fffe,$180,$004
	dc.w $2107,$fffe,$180,$006
	dc.w $2207,$fffe,$180,$008
	dc.w $2307,$fffe,$180,$00a
	dc.w $2407,$fffe,$180,$00c
	dc.w $2507,$fffe,$180,$000

mc_2col123:	dc.w $192,$000,$198,$000,$19a,$000

pt_rad1cou:	dc.w $2dd5,$fffe
pt_rad1col:	dc.w $184,$d50,$186,$d50

pt_rad2:dc.w $2e03,$fffe,$0e6,[textbpl+[9*44]]&$ffff

	dc.w $2e07,$fffe,$100,$4200
	dc.w $0e0,menu1/$10000,$0e2,menu1&$ffff
	dc.w $0e8,menu2/$10000,$0ea,menu2&$ffff
	dc.w $0ec,[plotbpl+[$9*44]]/$10000,$0ee,[plotbpl+[$9*44]]&$ffff

mk_col2:dc.w $190,plotcol
mc_col1:dc.w $182,$000,	$194,$c60,$184,$c60

pt_rad3:dc.w $3707,$fffe,$0e6,[textbpl+[18*44]]&$ffff,$184,$b71,$194,$b71
	dc.w $4007,$fffe,$0e6,[[textbpl+[27*44]]]&$ffff,$184,$a82,$194,$a82
	dc.w $4907,$fffe,$0e6,[textbpl+[36*44]]&$ffff,$184,$993,$194,$993
	dc.w $5207,$fffe,$0e6,[textbpl+[45*44]]&$ffff,$184,$8a4,$194,$8a4
	dc.w $5b07,$fffe,$0e6,[textbpl+[54*44]]&$ffff,$184,$7b5,$194,$7b5
	dc.w $6407,$fffe,$0e6,[textbpl+[63*44]]&$ffff,$184,$6c6,$194,$6c6
	dc.w $6d07,$fffe,$0e6,[textbpl+[72*44]]&$ffff,$184,$5d7,$194,$5d7
	dc.w $7607,$fffe,$0e6,[textbpl+[81*44]]&$ffff,$184,$4c8,$194,$4c8
	dc.w $7f07,$fffe,$0e6,[textbpl+[90*44]]&$ffff,$184,$3b9,$194,$3b9
	dc.w $8807,$fffe,$0e6,[textbpl+[99*44]]&$ffff,$184,$2aa,$194,$2aa
	dc.w $9107,$fffe,$0e6,[textbpl+[108*44]]&$ffff,$184,$19b,$194,$19b
	dc.w $9a07,$fffe,$0e6,[textbpl+[117*44]]&$ffff,$184,$08c,$194,$08c
	dc.w $a307,$fffe,$0e6,[textbpl+[126*44]]&$ffff,$184,$07d,$194,$07d
	dc.w $ac07,$fffe,$0e6,[textbpl+[135*44]]&$ffff,$184,$06e,$194,$06e
	dc.w $b507,$fffe,$0e6,[textbpl+[144*44]]&$ffff,$184,$05f,$194,$05f
	dc.w $be07,$fffe,$0e6,[textbpl+[153*44]]&$ffff,$184,$04f,$194,$04f
	dc.w $c707,$fffe,$0e6,[textbpl+[162*44]]&$ffff,$184,$03f,$194,$03f
	dc.w $d007,$fffe,$0e6,[textbpl+[171*44]]&$ffff,$184,$02f,$194,$02f
	dc.w $d907,$fffe,$0e6,[textbpl+[180*44]]&$ffff,$184,$01f,$194,$01f
	dc.w $e207,$fffe,$0e6,[textbpl+[189*44]]&$ffff,$184,$00f,$194,$00f

pt_sistaraden:
	dc.w $e307,$fffe,$180,$001,$102,$0000,$102,$0000
	dc.w $e407,$fffe,$180,$002,$102,$0000,$102,$0000
	dc.w $e507,$fffe,$180,$003,$102,$0000,$102,$0000
	dc.w $e607,$fffe,$180,$004,$102,$0000,$102,$0000
	dc.w $e707,$fffe,$180,$006,$102,$0000,$102,$0000
	dc.w $e807,$fffe,$180,$007,$102,$0000,$102,$0000
	dc.w $e907,$fffe,$180,$009,$102,$0000,$102,$0000
	dc.w $ea07,$fffe,$180,$00a,$102,$0000,$102,$0000
	dc.w $eb07,$fffe,$180,$00c,$102,$0000,$102,$0000
pt_sistaradenend:
	dc.w $ec05,$fffe,$182,$ddf,$180,$ddf,$1a6,$ddf
	dc.w  $100,$1200,$0e0,fillt/$10000,$0e2,fillt&$ffff,$108,8,$10a,8
	dc.w  $092,$0030,$094,$00d8
sc_p2:	dc.w  $0e4,sc_screen2/$10000,$0e6,sc_screen2&$ffff

	dc.w  $14a,$ed00,$152,$ed00,$15a,$ed00,$162,$ed00
	dc.w  $16a,$ed00
tr0:	dc.w  $124,gr_spr5/$10000,$126,gr_spr5&$ffff
tr1:	dc.w  $128,gr_spr1/$10000,$12a,gr_spr1&$ffff
tr2:	dc.w  $12c,gr_spr2/$10000,$12e,gr_spr2&$ffff
tr3:	dc.w  $130,gr_spr3/$10000,$132,gr_spr3&$ffff
tr4:	dc.w  $134,gr_spr4/$10000,$136,gr_spr4&$ffff

	dc.w $ed07,$fffe,$180,$ccf
	dc.w  $0e0,dummy/$10000,$0e2,dummy&$ffff

	dc.w  $182,$000		;outlinecol

	dc.w $ee07,$fffe,$100,$a200
sc_p1:	dc.w  $0e0,sc_screen1/$10000,$0e2,sc_screen1&$ffff,$180,$bbf

sc_sid:	dc.w  $102,$0000
	dc.w $ef07,$fffe,$180,$aae,		$184,$f22
	dc.w $f007,$fffe,			$184,$f33
	dc.w $f107,$fffe,			$184,$f44
	dc.w $f207,$fffe,			$184,$f55
	dc.w $f307,$fffe,			$184,$f66
sc_p11:	dc.w $f407,$fffe,$0e2,[sc_screen1+[6*96]]&$ffff,$184,$f77
	dc.w $f507,$fffe,			$184,$f88
sc_p12:	dc.w $f607,$fffe,$0e6,[sc_screen2+[8*96]]&$ffff,$184,$f99
	dc.w $f707,$fffe,			$184,$faa
	dc.w $f807,$fffe,			$184,$fbb
	dc.w $f907,$fffe,			$184,$fcc
	dc.w $fa07,$fffe,			$184,$fdd
	dc.w $fb07,$fffe,			$184,$fee
	dc.w $fc07,$fffe,			$184,$fff
	dc.w $fd07,$fffe,$180,$99d
	dc.w $fe07,$fffe,$180,$88c,$100,$1200,$102,$0000
	dc.w  $0e0,dummy/$10000,$0e2,dummy&$ffff,$108,-44

	dc.w $ff07,$fffe,$0180,$77b
TrainCopPoi:
	dc.w $084,NormCopCont/$10000,$086,NormCopCont&$ffff
	dc.w $08a,$0000


NormCopCont:
dc.w $ffe1,$fffe,$1a6,$66b,$1aa,$339,$1ac,$549,$1b2,$459,$1b4,$438,$180,$00c
dc.w $0107,$fffe,$180,$00a,$1a6,$55c
dc.w $0207,$fffe,$180,$009,$1a6,$44d
dc.w $0307,$fffe,$180,$007,$1a6,$33e
dc.w $0407,$fffe,$180,$006,$1aa,$444,$1ac,$544,$1b2,$454,$1b4,$436
dc.w $0507,$fffe,$180,$004
dc.w $0607,$fffe,$180,$003
	dc.w  $0e0,barnbpl/$10000,$0e2,barnbpl&$ffff,$108,0,	$182,$888
				dc.w $0707,$fffe,$180,$002,$182,$999
				dc.w $0807,$fffe,$180,$000,$182,$aaa
dc.w $0907,$fffe,$1aa,$444,$1ac,$544,$1b2,$454,$1b4,$436,$182,$aba
					dc.w $0a07,$fffe,$182,$aca
dc.w $0b07,$fffe,$1aa,$435,$1ac,$544,$1b2,$454,$1b4,$446,$182,$ada
					dc.w $0c07,$fffe,$182,$aea
dc.w $0d07,$fffe,$1aa,$426,$1ac,$354,$1b2,$454,$1b4,$346,$182,$afa

dc.w $0f07,$fffe,$1aa,$444,$1ac,$554,$1b2,$524,$1b4,$533,$182,$888
					dc.w $1007,$fffe,$182,$999
dc.w $1107,$fffe,$1aa,$544,$1ac,$454,$1b2,$229,$1b4,$553,$182,$aaa
					dc.w $1207,$fffe,$182,$abb
dc.w $1307,$fffe,$1aa,$454,$1ac,$247,$1b2,$363,$1b4,$560,$182,$acc
					dc.w $1407,$fffe,$182,$add
dc.w $1507,$fffe,$1aa,$455,$1ac,$534,$1b2,$523,$1b4,$034,$182,$aee
					dc.w $1607,$fffe,$182,$aff

dc.w $1707,$fffe,$1aa,$554,$1ac,$543,$1b2,$611,$1b4,$244
					dc.w $1807,$fffe,$182,$888
dc.w $1907,$fffe,$1aa,$554,$1ac,$436,$1b2,$545,$1b4,$440,$182,$999
					dc.w $1a07,$fffe,$182,$aaa
dc.w $1b07,$fffe,$1aa,$555,$1ac,$554,$1b2,$564,$1b4,$576,$182,$bab
					dc.w $1c07,$fffe,$182,$cac
dc.w $1d07,$fffe,$1aa,$546,$1ac,$264,$1b2,$464,$1b4,$822,$182,$dad
					dc.w $1e07,$fffe,$182,$eae
dc.w $1f07,$fffe,$1aa,$465,$1ac,$564,$1b2,$328,$1b4,$525,$182,$faf

dc.w $2107,$fffe,$1aa,$565,$1ac,$464,$1b2,$527,$1b4,$664,$182,$888
					dc.w $2207,$fffe,$182,$999
dc.w $2307,$fffe,$1aa,$557,$1ac,$347,$1b2,$763,$1b4,$518,$182,$aaa
					dc.w $2407,$fffe,$182,$bba
dc.w $2507,$fffe,$1aa,$755,$1ac,$824,$1b2,$862,$1b4,$449,$182,$cca
					dc.w $2607,$fffe,$182,$dda
dc.w $2707,$fffe,$1aa,$656,$1ac,$842,$1b2,$684,$1b4,$386,$182,$eea
					dc.w $2807,$fffe,$182,$ffa

dc.w $2907,$fffe,$1aa,$765,$1ac,$438,$1b2,$557,$1b4,$666,$0108,-44
dc.w $2b07,$fffe,$1aa,$676,$1ac,$874,$1b2,$568,$1b4,$776
dc.w $2d07,$fffe,$1aa,$399,$1ac,$639,$1b2,$4a7,$1b4,$852
dc.w $2f07,$fffe,$1aa,$44c,$1ac,$884,$1b2,$777,$1b4,$375
dc.w $3107,$fffe,$1aa,$a45,$1ac,$2a4,$1b2,$779,$1b4,$354
dc.w $3307,$fffe,$1aa,$b60,$1ac,$793,$1b2,$44c,$1b4,$568
dc.w $3507,$fffe,$1aa,$18e,$1ac,$888,$1b2,$953,$1b4,$32a
dc.l -2

TrainCopCont:
dc.w $0e0,dummy/$10000,$0e2,dummy&$ffff,$100,$1200,$108,-44
dc.w $1a6,$dd4,$1aa,$dd4,$1b2,$99f
dc.w $ffe1,$fffe,$0007,$fffe,$180,$20f
dc.w $0107,$fffe,$180,$20e
dc.w $0207,$fffe,$180,$20d
dc.w $0307,$fffe,$180,$20c

dc.w $0407,$fffe,$180,$20b
dc.w $0507,$fffe,$180,$20a
dc.w $0607,$fffe,$180,$209
dc.w $0707,$fffe,$180,$208
dc.w $0807,$fffe,$180,$00b
dc.w $0907,$fffe,$180,$00b
dc.w $0a07,$fffe,$180,$00b
dc.w $0a07,$fffe,$180,$00a
dc.w $0c07,$fffe,$180,$009
dc.w $1007,$fffe,$180,$008
dc.w $1407,$fffe,$180,$007
dc.w $1807,$fffe,$180,$006,$1b2,$fa6
dc.w $1c07,$fffe,$180,$005
dc.w $2007,$fffe,$180,$004

dc.w $2c07,$fffe,$180,$104
dc.w $2d07,$fffe,$180,$204
dc.w $2e07,$fffe,$180,$304
dc.w $2f07,$fffe,$180,$404
dc.w $3007,$fffe,$180,$504
dc.w $3107,$fffe,$180,$603
dc.w $3207,$fffe,$180,$702
dc.w $3307,$fffe,$180,$801
dc.w $3407,$fffe,$180,$c00
dc.w $3507,$fffe,$180,$a00
dc.w $3607,$fffe,$180,$800
dc.w $3707,$fffe,$180,$600
dc.w $3807,$fffe,$180,$400
dc.l -2


	dc.b ' Musicdisktrackerloadsystem by Mahoney December 1990'
	dc.b ' Dedicated to Josefin Mandorsson & Elin Stoltz. '

mt_end:	clr.w	$dff0a8
	clr.w	$dff0b8
	clr.w	$dff0c8
	clr.w	$dff0d8
	move.w	#$f,$dff096
	rts

L658:	dc.w	0	;curr instr
L695:	dc.l	0	;speedcounter
L642:	dc.l	0	;speed
L693:	dc.l	0	;songpos
L692:	dc.l	0	;pattpos
L701:	dc.w	0	;dmacon
L49_2:	dc.w	0	;vol0
L49_3:	dc.w	0	;vol1
L49_4:	dc.w	0	;vol2
L49_5:	dc.w	0	;vol3
L681:	dc.w	0	;pattbrk


Proggyextra:
	tst.l	mt_data
	beq	ot_rts
	tst.w	TuneInMemory
	beq	ot_rts
	cmp.w	#2,stoppauseplaymode
	bne	ot_rts

	LEA	L592,A6
	LEA	$DFF0A0,A5
	bsr	ProgHandler
	bsr	OtherComs
	LEA	L593,A6
	LEA	$DFF0B0,A5
	bsr	ProgHandler
	bsr	OtherComs
	LEA	L594,A6
	LEA	$DFF0C0,A5
	bsr	ProgHandler
	bsr	OtherComs
	LEA	L595,A6
	LEA	$DFF0D0,A5
	bsr	ProgHandler
	bsr	OtherComs
ot_rts:	rts

OtherComs:
	MOVE.W	$2(A6),D0
	AND.W	#$FFF,D0
	BEQ.s	ot_rts
	move.w	(a6),d0
	and.w	#$fff,d0
	beq.s	gooth
	tst.l	L695
	beq.s	ot_rts
gooth:	MOVE.B	$2(A6),D0
	AND.B	#$F,D0
	CMP.B	#1,D0
	BEQ	L577_7
	CMP.B	#2,D0
	BEQ	L577_9
	CMP.B	#3,D0
	BEQ	MYPORT
	CMP.B	#4,D0
	BEQ	VIB
	CMP.B	#5,D0
	BEQ	MYPORTVOLSLIDE
	CMP.B	#6,D0
	BEQ	VIBVOLSLIDE
	move.w	2(a6),d2
	and.w	#$fff,d2
	beq.s	.no
	tst.b	d0
	beq	ot_rts
	cmp.b	#7,d0
	beq	ot_rts
.no:	MOVE.L	D0,-(A7)
	move.w	$10(A6),D0
	BSR	PERCALC
	MOVE.L	(A7)+,D0
	CMP.B	#$A,D0
	Beq	L577_3
	rts



mt_pattchcou:	dc.w	0
mt_pattvchcou:	dc.w	0

PattJmpClr:
	clr.w	L592+$18
	clr.w	L593+$18
	clr.w	L594+$18
	clr.w	L595+$18
	rts

bu_forraselcou:	dc.w	0
bu_nastaselcou:	dc.w	0

bu_nastapattmus:
	cmp.w	#1,bu_leftcou
	beq.s	bu_npo
	rts
bu_nastapatt:
	subq.w	#1,mt_pattchcou
	bpl.w	prts
	move.w	#$1000,mt_pattchcou
bu_npo:
	lea	menu1+[$25*44]+8,a0
	lea	menu2+[$25*44]+8,a1
	move.b	#%00000110,-1(a0)
	move.b	#%11111001,-1(a1)
	move.b	#%01100000,(a0)
	move.b	#%10011111,(a1)
	move.b	#%00000011,-1+[1*44](a0)
	move.b	#%11111100,-1+[1*44](a1)
	move.b	#%00110000,1*44(a0)
	move.b	#%11001111,1*44(a1)
	move.b	#%00000001,-1+[2*44](a0)
	move.b	#%11111110,-1+[2*44](a1)
	move.b	#%10011000,2*44(a0)
	move.b	#%01100111,2*44(a1)
	move.b	#%11001100,3*44(a0)
	move.b	#%00110011,3*44(a1)
	move.b	#%00000001,-1+[4*44](a0)
	move.b	#%11111110,-1+[4*44](a1)
	move.b	#%10011000,4*44(a0)
	move.b	#%01100111,4*44(a1)
	move.b	#%00000011,-1+[5*44](a0)
	move.b	#%11111100,-1+[5*44](a1)
	move.b	#%00110000,5*44(a0)
	move.b	#%11001111,5*44(a1)
	move.b	#%00000110,-1+[6*44](a0)
	move.b	#%11111001,-1+[6*44](a1)
	move.b	#%01100000,6*44(a0)
	move.b	#%10011111,6*44(a1)
	move.w	#$10,bu_nastaselcou

	tst.w	tuneinmemory
	beq	i_rts

	addq.l	#1,L693
	move.l	mt_data,a0
	moveq	#0,d0
	move.b	$3b6(a0),d0
	cmp.l	L693(pc),d0
	bgt.s	.mt_nowrap
	clr.l	L693
	cmp.w	#2,PlayMode
	bne.s	.mt_nowrap
	bsr	bu_NastaLaten
.mt_nowrap:
	move.w	#$f,$dff096
	moveq	#0,d0
	move.w	d0,$dff0a8
	move.w	d0,$dff0b8
	move.w	d0,$dff0c8
	move.w	d0,$dff0d8
	clr.l	L692
	move.l	L693(pc),d0
	lea	PattSpds,a0
	move.b	(a0,d0.w),L642+3
	move.l	L642,L695	
	jsr	SetTuneTimer
	bsr	PattjmpClr
prts:	rts

bu_forrapattmus:
	cmp.w	#1,bu_leftcou
	beq.s	bu_fpo
	rts
bu_forrapatt:
	subq.w	#1,mt_pattvchcou
	bpl.s	prts
	move.w	#$1000,mt_pattvchcou
bu_fpo:
	lea	menu1+[$25*44]+4,a0
	lea	menu2+[$25*44]+4,a1
	move.w	#%0000001100110000,(a0)
	move.w	#%1111110011001111,(a1)
	move.w	#%0000011001100000,1*44(a0)
	move.w	#%1111100110011111,1*44(a1)
	move.w	#%0000110011000000,2*44(a0)
	move.w	#%1111001100111111,2*44(a1)
	move.w	#%0001100110000000,3*44(a0)
	move.w	#%1110011001111111,3*44(a1)
	move.w	#%0000110011000000,4*44(a0)
	move.w	#%1111001100111111,4*44(a1)
	move.w	#%0000011001100000,5*44(a0)
	move.w	#%1111100110011111,5*44(a1)
	move.w	#%0000001100110000,6*44(a0)
	move.w	#%1111110011001111,6*44(a1)
	move.w	#$10,bu_forraselcou

	tst.w	TuneInMemory
	beq	i_rts
	cmp.l	#$80,L692	;mindre an 8 steps fram i patt ->
	bge.s	.mt_novwrap	;go previous pattern
	subq.l	#1,L693
	bpl.s	.mt_novwrap
	clr.l	L693
.mt_novwrap:
	move.w	#$f,$dff096
	moveq	#0,d0
	move.w	d0,$dff0a8
	move.w	d0,$dff0b8
	move.w	d0,$dff0c8
	move.w	d0,$dff0d8
	clr.l	L692
	move.l	L693(pc),d0
	lea	PattSpds,a0
	move.b	(a0,d0.w),L642+3
	move.l	L642,L695	
	jsr	SetTuneTimer
	bsr	PattJmpClr
.prts:	rts


lv6cou:	dc.w	0

NewLv6Int:
	movem.l	d0-d7/a0-a6,-(a7)
	move.b	$bfdd00,d0
	move.b	#$81,$bfdd00	;irq ctrlreg - set irq from timer a
	move.b	#$19,$bfde00	;- start timer a one-shot

	move.w	lv6cou(pc),d0
	and.w	#1,d0
	bne.s	.nodisk

	move.w	stepno(pc),d0
	beq.s	.nodisk
;	btst	#5,$bfe001
;	bne.s	.nodisk

	lea	$bfd100,a0
	moveq	#0,d0
	move.b	floppystatus(pc),d0
	move.b	d0,d1
	bclr	#0,d0		;clear DSKSTEP after setting it...STEP!
	move.b	d0,(a0)		;a0=$bfd100 (CIA-B PRB)
	nop			;wait a little
	nop
	move.b	d1,(a0)		;set DSKSTEP back to 1
;	bclr	#0,$bfd100
;	bset	#0,$bfd100
	subq.w	#1,stepno

.nodisk:cmp.w	#$3,lv6cou
	bge.s	.n6_ex
	bsr	proggyextra

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

stepno:	dc.w	0

MT_YIEAHO:
	move.b	#$81,$bfdd00	;irq ctrlreg - set irq from timer a
	move.b	#$19,$bfde00	;- start timer a - one-shot
	clr.w	lv6cou

mt_music:
	tst.l	mt_data
	beq	i_rts
	tst.w	TuneInMemory
	beq	i_rts

	jsr	TuneTimer

	cmp.w	#2,stoppauseplaymode
	bne	ot_rts

	MOVEM.L	D0-D7/A0-A6,-(A7)
	MOVE.L	mt_data,A0

	ADDQ.L	#1,L695
	MOVE.L	L695,D0
	CMP.L	L642,D0
	BLT.S	L505_4
	CLR.L	L695
	BRA	L505_F

L505_4:
INGETAVSTANG:
	LEA	L592,A6
	LEA	$DFF0A0,A5
	BSR	L577_2
	bsr	ProgHandler
	MOVE.L	$A(A6),(A5)	;POI
	MOVE.W	$E(A6),4(A5)	;REPLEN
	LEA	L593,A6
	LEA	$DFF0B0,A5
	BSR	L577_2
	bsr	ProgHandler
	MOVE.L	$A(A6),(A5)	;POI
	MOVE.W	$E(A6),4(A5)	;REPLEN
	LEA	L594,A6
	LEA	$DFF0C0,A5
	BSR	L577_2
	bsr	ProgHandler
	MOVE.L	$A(A6),(A5)	;POI
	MOVE.W	$E(A6),4(A5)	;REPLEN
	LEA	L595,A6
	LEA	$DFF0D0,A5
	BSR	L577_2
	bsr	ProgHandler
	MOVE.L	$A(A6),(A5)	;POI
	MOVE.W	$E(A6),4(A5)	;REPLEN
	BRA	L505_U

L505_8:	move.l	A0,-(A7)
	MOVE.L	L695,D0
	DIVS	#3,D0
	SWAP	D0
	TST.W	D0
	BEQ.S	L505_B
	CMP.W	#2,D0
	BEQ.S	L505_A

L505_9:	MOVEQ	#0,D0
	MOVE.B	$3(A6),D0
	LSR.B	#$4,D0
	BRA.S	L505_C
L505_A:	MOVEQ	#0,D0
	MOVE.B	$3(A6),D0
	AND.B	#$F,D0
	BRA.S	L505_C
L505_B:	MOVE.W	$10(A6),D2
	BRA.S	L505E3
L505_C:	ASL.W	#1,D0
	MOVEQ	#0,D2
	MOVE.W	$10(A6),D2
	AND.W	#$3FFF,D2
	lsr.w	#2,d2

	LEA	L602,A0
	MOVEQ	#[L603-L602]/2,D7
L505_D:	CMP.W	(A0)+,D2
	BGE.S	L505_E
	DBF	D7,L505_D
	MOVE.L	(A7)+,A0
	RTS
L505_E:	MOVE.W	-2(A0,D0.W),D2
	asl.w	#2,d2
L505E3:	MOVE.W	D2,D0
	BSR	PERCALC
	move.l	(A7)+,A0
	RTS



L505_F:	MOVE.L	mt_data,A0
	MOVE.L	A0,A3
	MOVE.L	A0,A2
	ADD.L	#$C,A3
	ADD.L	#$3B8,A2
	ADD.L	#$43C,A0

	MOVEQ	#0,D1
	MOVE.L	L693,D0
	MOVE.B	(A2,D0.L),D1
	LSL.L	#8,D1
	LSL.L	#2,D1
	ADD.L	L692,D1

	CLR.W	L701
	LEA	$DFF0A0,	A5
	LEA	L592,		A6
	LEA	L49_2(PC),	A2
	BSR.S	L505_J
	ADDQ.L	#4,D1
	LEA	$DFF0B0,	A5
	LEA	L593,		A6
	LEA	L49_3(PC),	A2
	BSR.S	L505_J
	ADDQ.L	#4,D1
	LEA	$DFF0C0,	A5
	LEA	L594,		A6
	LEA	L49_4(PC),	A2
	BSR.S	L505_J
	ADDQ.L	#4,D1
	LEA	$DFF0D0,	A5
	LEA	L595,		A6
	LEA	L49_5(PC),	A2
	BSR.S	L505_J
	BRA	L505_M

L505_J:	MOVE.L	(A0,D1.L),(A6)
	MOVEQ	#0,D2
	MOVE.B	2(A6),D2
	LSR.B	#4,D2
	MOVE.B	(A6),D0
	AND.B	#$F0,D0
	OR.B	D0,D2

	TST.B	D2
	BEQ	L505_L
	MOVEQ	#0,D3
	MOVE.L	D2,D4
	LEA	L698,A1
	LSL.L	#2,D2
	MULU	#$1E,D4
	MOVE.L	$0(A1,D2.L),$04(A6)	;instrmemstart
	MOVE.B	-$16+$18(A3,D4.L),$1E(A6)	;CURRSTAMM

	clr.b	$1c(a6)	;prog on/off
	CMP.L	#'Mupp',-$16(a3,d4.l)
	bne.s	noprgo
	move.l	a0,-(a7)
	move.b	#1,$1c(a6)	;prog on
	move.l	mt_data,a0
	lea	$43c(a0),a0
;	moveq	#0,d2
;	move.b	-$16+$4(a3,d4.l),d2	;pattno
;	mulu	#$400,d2
;	lea	(a0,d2.l),a0
;	move.l	a0,4(a6)	;proginstr data-start
	move.l	4(a6),a0
	moveq	#0,d2
	MOVE.B	$780*2(A0),$12(A6);volu
	AND.B	#$7F,$12(A6)
	move.b	$700*2(a0),d2
	mulu	#$20,d2
	lea	(a0,d2.w),a0
	move.l	a0,$a(a6)	;loopstartmempoi = startmempoi
	moveq	#0,d2
	move.B	$3(a3,d4.l),d2
	asl.w	#2,d2
	cmp.w	#$100,d2
	bne.s	okok
	move.w	#$ff,d2
okok:	move.b	d2,$13(a6)	;volume
	move.b	-$16+$5(a3,d4.l),d2
	asl.b	#2,d2
	move.b	d2,8(a6)	;dataloopstart
	move.b	-$16+$6(a3,d4.l),d2
	asl.w	#2,d2
	addq.w	#3,d2
	move.b	d2,9(a6)	;dataloopend
	move.w	#$10,$e(a6)	;looplen
	move.l	(a7)+,a0
	MOVE.W	$12(A6),(A2)
	AND.W	#$FF,(A2)
	BRA.S	L505_LQ
noprgo:

	MOVE.W	$0(A3,D4.L),$08(A6)
	MOVE.W	$2(A3,D4.L),d3
	AND.W	#$FF,D3
	asl.w	#2,d3
	cmp.w	#$ff,d3
	ble.s	hertig
	move.w	#$ff,d3
hertig:	move.w	d3,$12(A6)
	move.b	#$40,$12(a6)
	MOVE.W	$4(A3,D4.L),D3
	TST.W	D3
	BEQ.S	L505_K
	MOVE.L	$4(A6),D2
	ASL.W	#1,D3
	ADD.L	D3,D2
	MOVE.L	D2,$A(A6)	;LOOPSTARTPOI
	MOVE.W	$4(A3,D4.L),D0	;REPEAT
	ADD.W	$6(A3,D4.L),D0	;+REPLEN
	MOVE.W	D0,$8(A6)	;STARTLENGTH
	MOVE.W	$6(A3,D4.L),$E(A6);LOOPLENGTH
	MOVE.W	$12(A6),(A2)
	AND.W	#$FF,(A2)
	BRA.S	L505_LQ
L505_K:	move.L	#DUMMYSOUND,D2
	MOVE.L	d2,$A(A6)		;NOLOOP STARTPOI
	MOVE.W	$6(A3,D4.L),$E(A6)
	MOVE.W	$12(A6),(A2)
	AND.W	#$FF,(A2)
L505_LQ:

L505_L:	MOVE.W	(A6),D0
	AND.W	#$FFF,D0
	BEQ	L505_L2
	 TST.W	8(A6)
	 BEQ.S	STOPSOUNDET
	MOVE.B	2(A6),D0
	AND.B	#$F,D0
	 CMP.B	#5,D0
	 BEQ.S	MYPI
	CMP.B	#$3,D0
	BNE.S	JUP
MYPI:	BSR	SETMYPORT
	BRA	L577_F

STOPSOUNDET:
	MOVE.W	$14(A6),D0
	MOVE.W	D0,$DFF096
	BRA	EFTERSTOPSUND

JUP:	MOVE.W	(A6),d0
	and.w	#$fff,d0
	asl.w	#2,d0
	move.w	d0,$10(A6)
	MOVE.W	$14(A6),$DFF096
	CLR.B	$1B(A6)
	clr.b	$1d(a6)	;proglj-datacou

	tst.b	$1c(a6)	;prog on/off
	beq.s	normalljudstart
	move.l	$a(a6),(a5)	;loopstartpoi
	move.w	$e(a6),$4(a5)
	bra.s	onormalljudstart
normalljudstart:
	MOVE.L	$4(A6),(A5)
	MOVE.W	$8(A6),$4(A5)
onormalljudstart:
	MOVE.W	$10(A6),D0
	AND.W	#$3FFF,D0
	BSR	PERCALC

	MOVE.W	$14(A6),D0	;DMASET
	OR.W	D0,L701

EFTERSTOPSUND:
L505_L2:BRA	L577_F


ProgHandler:	;a6=L592
		;a5=$dff0a0
	tst.b	$1c(a6)		;on/off
	beq.s	norvolum
	movem.l	d0-d1/a0-a2,-(a7)
	moveq	#0,d0
	move.b	$1d(a6),d0	;datacou
	move.l	$4(a6),a0	;datastart
	lea	$700*2(a0),a1
	lea	$100(a1),a2
	move.b	(a2,d0.w),d1
	and.w	#$7f,d1
	move.b	d1,$12(a6)	;progvolume
	move.b	(a1,d0.w),d1
	mulu	#$20,d1
	lea	(a0,d1.w),a1
	move.l	a1,$a(a6)	;loopstartmempoi

	moveq	#0,d0
	moveq	#0,d1
	move.b	$1d(a6),d0
	move.b	$9(a6),d1
	addq.w	#1,d0
	cmp.w	d1,d0	;dataloopend
	ble.s	norestartofdata
	move.b	$8(a6),d0	;dataloopstart
norestartofdata:
	move.b	d0,$1d(a6)
	movem.l	(a7)+,d0-d1/a0-a2
norvolum:
	MOVEQ	#0,D0
	MOVE.B	$13(A6),D0
	MOVEQ	#0,D3
	MOVE.B	$12(A6),D3
	MULU	D3,D0
	LSR.W	#$8,D0
	MOVE.W	D0,$8(A5)	;VOLUME
	rts



L505_M:	MOVE.W	#$190,D0	;$1F4
L505_N:	DBF	D0,L505_N

	LEA	L595,A6
	LEA	$DFF0D0,A5
	BSR	ProgHandler
	LEA	L594,A6
	LEA	$DFF0c0,A5
	BSR	ProgHandler
	LEA	L593,A6
	LEA	$DFF0b0,A5
	BSR	ProgHandler
	LEA	L592,A6
	LEA	$DFF0a0,A5
	BSR	ProgHandler

	MOVE.W	L701,D0
	OR.W	#$8000,D0
	MOVE.W	D0,$DFF096

	MOVE.W	#$190,D0
L505_N2:DBF	D0,L505_N2
	LEA	L595,A6
	LEA	$DFF0D0,A5
	MOVE.L	$A(A6),(A5)	;POI
	MOVE.W	$E(A6),4(A5)	;REPLEN
	LEA	L594,A6
	LEA	$DFF0c0,A5
	MOVE.L	$A(A6),(A5)	;POI
	MOVE.W	$E(A6),4(A5)	;REPLEN
	LEA	L593,A6
	LEA	$DFF0b0,A5
	MOVE.L	$A(A6),(A5)	;POI
	MOVE.W	$E(A6),4(A5)	;REPLEN
	LEA	L592,A6
	LEA	$DFF0a0,A5
	MOVE.L	$A(A6),(A5)	;POI
	MOVE.W	$E(A6),4(A5)	;REPLEN

L505_R:
L505_HA:ADD.L	#$10,L692
	CMP.L	#$400,L692
	BNE.S	L505_U
HAHA:	CLR.L	L692
	CLR.W	L681
	ADDQ.L	#1,L693
	AND.L	#$7F,L693
	MOVE.L	mt_data,A0
	MOVEQ	#0,D0
	move.b	$3b6(a0),d0
	MOVE.L	L693,D1
	CMP.L	D0,D1
	BNE.S	L505_U
	MOVEQ	#0,D0
	MOVE.B	$3B7(A0),D0
	MOVE.L	D0,L693
	jsr	SetTuneTimer
	cmp.w	#2,PlayMode
	bne.s	L505_U
	bsr	bu_NastaLaten
L505_U:	TST.W	L681
	BNE.S	HAHA
L505_V:	MOVEM.L	(A7)+,D0-D7/A0-A6
	RTS




SETMYPORT:
	MOVE.W	(A6),D2
	AND.W	#$FFF,D2
	asl.w	#2,d2
	MOVE.W	D2,$18(A6)
	MOVE.W	$10(A6),D0
	CLR.B	$16(A6)
	CMP.W	D0,D2
	BEQ.S	CLRPORT
	BGE.S	M_RTS
	MOVE.B	#1,$16(A6)
m_RTS:	RTS

CLRPORT:CLR.W	$18(A6)
	RTS

MYPORT:	MOVE.B	$3(A6),D0
	BEQ.S	MYSLIDE
	MOVE.B	D0,$17(A6)
	CLR.B	$3(A6)
MYSLIDE:TST.W	$18(A6)
	BEQ.s	M_RTS
	MOVEQ	#0,D0
	MOVE.B	$17(A6),D0
	TST.B	$16(A6)
	BNE.S	MYSUB
	ADD.W	D0,$10(A6)
	MOVE.W	$18(A6),D0
	CMP.W	$10(A6),D0
	BGT.S	MYOK
	MOVE.W	$18(A6),$10(A6)
	CLR.W	$18(A6)
MYOK:	MOVE.W	$10(A6),D0
	BSR	PERCALC
	RTS

MYSUB:	SUB.W	D0,$10(A6)
	MOVE.W	$18(A6),D0
	CMP.W	$10(A6),D0
	BLT.S	MYOK
	MOVE.W	$18(A6),$10(A6)
	CLR.W	$18(A6)
	MOVE.W	$10(A6),D0
	BSR	PERCALC
	RTS

VIB:	moveq	#0,d0
	MOVE.B	$3(A6),D0
	BEQ.S	VIBRATO
	MOVE.B	D0,$1A(A6)

VIBRATO:MOVE.B	$1B(A6),D0
	LEA	SIN(PC),A4
	LSR.W	#$2,D0
	AND.W	#$1F,D0
	MOVEQ	#0,D2
	MOVE.B	(A4,D0.W),D2
	MOVE.B	$1A(A6),D0
	AND.W	#$F,D0
	MULU	D0,D2
	 LSR.L	#$5,D2	;#$7
	MOVE.W	$10(A6),D0
	TST.B	$1B(A6)
	BMI.S	VIBMIN
	ADD.W	D2,D0
	BRA.S	VIB2
VIBMIN:	SUB.W	D2,D0
VIB2:	BSR	PERCALC
	MOVE.B	$1A(A6),D0
	LSR.W	#$4,D0
	AND.W	#$F,D0
	ADD.B	D0,$1B(A6)
	RTS

SIN:	DC.B $00,$18,$31,$4A,$61,$78,$8D,$A1,$B4,$C5,$D4,$E0,$EB,$F4,$FA,$FD
	DC.B $FF,$FD,$FA,$F4,$EB,$E0,$D4,$C5,$B4,$A1,$8D,$78,$61,$4A,$31,$18

MegaArps:
	dc.b 0,3,7,12,15,12,7,3,0,3,7,12,15,12,7,3
	dc.b 0,4,7,12,16,12,7,4,0,4,7,12,16,12,7,4
	dc.b 0,3,8,12,15,12,8,3,0,3,8,12,15,12,8,3
	dc.b 0,4,8,12,16,12,8,4,0,4,8,12,16,12,8,4
	dc.b 0,5,8,12,17,12,8,5,0,5,8,12,17,12,8,5
	dc.b 0,5,9,12,17,12,9,5,0,5,9,12,17,12,9,5
	dc.b 12,0,7,0,3,0,7,0,12,0,7,0,3,0,7,0
	dc.b 12,0,7,0,4,0,7,0,12,0,7,0,4,0,7,0

	dc.b 0,3,7,3,7,12,7,12,15,12,7,12,7,3,7,3
	dc.b 0,4,7,4,7,12,7,12,16,12,7,12,7,4,7,4
	dc.b 31,27,24,19,15,12,7,3,0,3,7,12,15,19,24,27
	dc.b 31,28,24,19,16,12,7,4,0,4,7,12,16,19,24,28
	dc.b 0,12,0,12,0,12,0,12,0,12,0,12,0,12,0,12
	dc.b 0,12,24,12,0,12,24,12,0,12,24,12,0,12,24,12
	dc.b 0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3
	dc.b 0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4

MegaArp:
	move.l	a0,-(a7)
	MOVEQ	#0,D0
	MOVE.B	$1b(A6),D0
	addq.b	#1,$1b(a6)
	AND.B	#$F,D0
	moveq	#0,d2
	lea	MegaArps(pc),a0
	move.b	3(a6),d2
	and.w	#$f,d2	;16 olika MegaArps
	asl.w	#$4,d2	;mulu	#$10
	add.w	d0,d2
	moveq	#0,d0
	move.b	(a0,d2.w),d0
	add.w	d0,d0

	MOVEQ	#0,D2
	MOVE.W	$10(A6),D2
	lsr.w	#2,d2
	AND.W	#$FFF,D2
	LEA	L602,A0
	MOVEQ	#[L603-L602]/2,D7
MegaAlo:CMP.W	(A0)+,D2
	BGE.S	MegaFo
	DBF	D7,MegaAlo
	RTS
MegaFo:	lea	-2(a0,d0.w),a0
MegaAgain:
	cmp.l	#PeriodSlutt,a0
	blt.s	MegaOk
	sub.l	#12*2,a0
	bra.s	MegaAgain
MegaOk:
	move.w	(a0),D0
	asl.w	#2,d0
	BSR	PERCALC
	move.l	(a7)+,a0
	RTS

PERCALC:
	MOVEM.L	D1-D2,-(A7)
	MOVE.W	D0,D2
	MOVE.B	$1E(A6),D1
	EXT.W	D1
	MULS	D1,D2
	asr.l	#$8,d2
	ADD.W	D2,D0
	lsr.w	#2,d0
	MOVE.W	D0,6(A5)	;SETPERIOD
	MOVEM.L	(A7)+,D1-D2
	RTS
PERCALCA4:
	MOVEM.L	D1-D2,-(A7)
	MOVE.W	D0,D2
	MOVE.B	$1E(A4),D1
	EXT.W	D1
	MULS	D1,D2
	asr.w	#$8,d2
	ADD.W	D2,D0
	lsr.w	#2,d0
	MOVE.W	D0,6(A5)	;SETPERIOD
	MOVEM.L	(A7)+,D1-D2
	RTS

NEJDU:	MOVE.W	$10(A6),D0
	BSR	PERCALC
	RTS

L577_2:	MOVE.W	$2(A6),D0
	AND.W	#$FFF,D0
	BEQ	NEJDU
	MOVE.B	$2(A6),D0
	AND.B	#$F,D0
	BEQ	L505_8
	CMP.B	#1,D0
	BEQ	L577_7
	CMP.B	#2,D0
	BEQ	L577_9
	CMP.B	#3,D0
	BEQ	MYPORT
	CMP.B	#4,D0
	BEQ	VIB
	CMP.B	#5,D0
	BEQ	MYPORTVOLSLIDE
	CMP.B	#6,D0
	BEQ	VIBVOLSLIDE
	cmp.b	#7,d0
	beq	MegaArp
	MOVE.L	D0,-(A7)
	move.w	$10(A6),D0
	BSR	PERCALC
	MOVE.L	(A7)+,D0
	CMP.B	#$A,D0
	BNE	M_RTS

L577_3:	move.l	d1,-(a7)
	MOVEQ	#0,D0
	MOVE.B	$3(A6),D0
	LSR.B	#$4,D0
	TST.B	D0
	BEQ.S	L577_5
	moveq	#0,d1
	move.b	$13(a6),d1
	ADD.w	D0,d1
	CMP.w	#$ff,d1
	Ble.S	L577_4
	MOVE.w	#$ff,d1
L577_4:	move.b	d1,$13(a6)
	move.l	(a7)+,d1
	RTS

L577_5:	MOVEQ	#0,D0
	MOVE.B	$3(A6),D0
	AND.B	#$F,D0
	moveq	#0,d1
	move.b	$13(a6),d1
	SUB.w	D0,d1
	BPL.S	L577_6
	CLR.w	D1
L577_6:	move.b	d1,$13(a6)
	move.l	(a7)+,d1
	RTS

VIBVOLSLIDE:
	 BSR	VIBRATO
	 BRA.S	L577_3

MYPORTVOLSLIDE:
	 BSR	MYSLIDE
	 BRA.S	L577_3

L577_7:	MOVEQ	#0,D0
	MOVE.B	$3(A6),D0
	SUB.W	D0,$10(A6)
	MOVE.W	$10(A6),D0
	CMP.W	#$71*4,D0
	BPL.S	L577_8
	MOVE.W	#$71*4,$10(A6)
L577_8:	MOVE.W	$10(A6),D0
	BSR	PERCALC
	RTS

L577_9:	CLR.W	D0
	MOVE.B	$3(A6),D0
	ADD.W	D0,$10(A6)
	MOVE.W	$10(A6),D0
	CMP.W	#$358*4,D0
	BMI.S	L577_A
	MOVE.W	#$358*4,$10(A6)
L577_A:	MOVE.W	$10(A6),D0
	BSR	PERCALC
	RTS

L577_F:	MOVE.B	$2(A6),D0
	AND.B	#$F,D0
	CMP.B	#$D,D0
	BEQ.S	L577_I
	CMP.B	#$B,D0
	BEQ.S	L577_J
	CMP.B	#$C,D0
	BEQ.S	L577_K
	CMP.B	#$F,D0
	BEQ.L	L577_M
	MOVE.W	(A6),D2
	AND.W	#$FFF,D2
	BEQ	L577_2
	RTS

L577_I:	MOVE.W	#1,L681
	RTS

L577_J:	MOVE.B	$3(A6),D0
	MOVE.W	#1,L681
	SUBQ.B	#1,D0
	MOVE.B	D0,L693+3
L577_J2:RTS

L577_K:	MOVEQ	#0,D0
	MOVE.B	$3(A6),D0
	ASL.W	#$2,D0
	CMP.W	#$ff,D0
	BLE.S	L577_L
	MOVE.W	#$FF,D0
L577_L:	MOVE.B	D0,$1(A2)
	MOVE.B	D0,$13(A6)
	RTS

L577_M:	CMP.B	#$1F,$3(A6)
	BLS.S	L577_N
	MOVE.B	#$1F,$3(A6)
L577_N:	MOVEQ	#0,D0
	MOVE.B	$3(A6),D0
	BNE.S	NOTT1
	MOVEQ	#1,D0
NOTT1:	MOVE.L	D0,L642
	CLR.L	L695
arts:	RTS

L592:	blk.b	20,0
	dc.W	1
	blk.b	6,0
	DC.B	0,0,0,0
L593:	blk.b	20,0
	dc.W	2
	blk.b	6,0
	DC.B	0,0,0,0
L594:	blk.b	20,0
	dc.W	4
	blk.b	6,0
	DC.B	0,0,0,0
L595:	blk.b	20,0
	dc.W	8
	BLK.B	6,0
	DC.B	0,0,0,0

L602:	dc.W	$0358,$0328,$02fa,$02d0,$02a6,$0280
	dc.W	$025c,$023a,$021a,$01fc,$01e0,$01c5
	dc.W	$01ac,$0194,$017d,$0168,$0153,$0140
	dc.W	$012e,$011d,$010d,$00fe,$00f0,$00e2
	dc.W	$00d6,$00ca,$00be,$00b4,$00aa,$00a0
	dc.W	$0097,$008f,$0087,$007f,$0078,$0071
PeriodSlutt:
DummySound:
	dc.W	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
L603:

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

floppystatus:	dc.b	0
motorstatus:	dc.b	0
Current_drive:	dc.b	0
		dc.b	0
tracknum0:	dc.w	-1	;byta ej plats pa dessa df0:
		dc.w	-1	;----------''---------- df1:
		dc.w	0
		dc.w	-1	;----------''---------- df2:
		dc.w	0
		dc.w	0
		dc.w	0
		dc.w	-1	;----------''---------- df3:

track:		dc.w	0	;starttrack



Load_length:	dc.l	0
Load_diskpos:	dc.l	0
Load_Dest:	dc.l	$50000
Drive:	dc.b	%0010
Seconddrive:	dc.b	%10000001	;df0: is normal


Loader:	move.l	Load_length(pc),d6
	beq	arts

	lea	$dff000,a6
	move.w	#$8210,$96(a6)	;diskdma on!
	move.b	Drive(pc),d0	;set right bit for drive 0,1,2 or 3
	and.b	#$7f,d0
	bsr.l	select_drive	;select drive from which you want to read
	bsr.l	motor_on	;drivemotor on


Init_Read:
	clr.w	$24(a6)		;DSKLEN->forbid diskdma and writing
	move.w	#$4489,$7e(a6)	;set standard SYNC
	move.w	#$7f00,$9e(a6)	;clear ADKCON
	move.w	#$9500,$9e(a6)	;set required bits
	move.w	#$0002,$9c(a6)	;clear DSKBLK bit

Load_tracks:
	move.l	Load_length(pc),d6
	beq	arts
	addq.l	#1,d6
	move.l	Load_diskpos(pc),d5
	move.l	Load_dest(pc),a1

	divu	#$1600,d5
	move.w	d5,track
	lea	Decodedtrack(pc),a0
	swap	d5
	and.l	#$ffff,d5
	lea	(a0,d5.l),a0
	move.l	d5,d4
	move.w	#$1600,d5
	sub.w	d4,d5		;d5-transferlen now
				;d6-total length kvar
				;d7-errorcounter err3ggr i rad -> err
				;a0-sourcepoi
				;a1-destpoi
load_weiteroklesen:
	moveq	#0,d7

load_weiterlesen:
	movem.l	d5-d7/a0-a1,-(a7)
	move.w	track(pc),d0	;move head to starttrack
	bsr	head_pos
	moveq	#-1,d0
	btst	#2,$bfe001	;check if disk in drive
	beq.s	Lojerr		;NoDiskInDrive -> error

	bsr.l	read_track	;read track+decode track
Lojerr:	movem.l	(a7)+,d5-d7/a0-a1

	tst.l	d0
	beq.s	load_ok
	addq.w	#1,d7
	cmp.w	#3,d7
	beq.s	load_error
	bra.s	Load_weiterlesen


load_move:
	move.b	(a0)+,(a1)+
load_ok:subq.l	#1,d6		;d6-total length kvar
	bmi.s	Endload
	dbf	d5,load_move	;d5-length kvar av uppkodat track

	addq.w	#1,track	;nasta track
	addq.l	#1,d6
	move.w	#$1600,d5	;las hela tracket
	lea	Decodedtrack(pc),a0
	bra.s	Load_weiteroklesen


EndLoad:moveq	#0,d0
	rts
load_error:
	moveq	#-1,d0
	rts


step:	lea	$bfd100,a0
	moveq	#0,d0
	move.b	floppystatus(pc),d0
	move.b	d0,d1
	bclr	#0,d0		;clear DSKSTEP after setting it...STEP!

	move.b	d0,(a0)		;a0=$bfd100 (CIA-B PRB)
	nop			;wait a little
	nop
	move.b	d1,(a0)		;set DSKSTEP back to 1

				;waits ca. 1/100 sec.
waitlop:clr.w	framecou
.w:	cmp.w	#1,framecou
	blt.s	.w
	rts

;	move.b	#$00,$bfde00	;clear CRA
;	move.b	#$7f,$bfdd00	;clear ICR
;	move.b	#$00,$bfd400	;timer a -low
;	move.b	#$20,$bfd500	;timer a -high (wait-value=$2000)
;	move.b	#$09,$bfde00	;set oneshot/start
;wait_timer:
;	btst	#0,$bfdd00	;test ta-bit/that clears ICR
;	beq.s	wait_timer
;	rts

Wait_ready:
	btst	#5,$bfe001	;wait for DRIVEREADY
	bne.s	Wait_ready	;it's useless here, because the wait-
	rts			;loop is long enough, but......

Select_Drive:
	move.b	d0,Current_drive
	lea	floppystatus(pc),a0
	lea	motorstatus(pc),a1
	moveq	#-1,d1		;$ffffffff -> d1
	lsl.w	#3,d0		;shift selectbit to right position
	eor.b	d0,d1		;selectbit must be zero
	move.b	d1,(a0)		;save byte ->floppystatus.b
	eori.b	#$80,d1		;clear DSKMOTOR-bit
	move.b	d1,(a1)		;save byte ->motorstatus.b
	rts

Motor_On:
	move.b	#$7f,$bfd100	;Bits 0-6 HIGH/Bit 7 LOW
	nop
	nop
	move.b	motorstatus(pc),d0
	move.b	d0,$bfd100	;DSKMOTOR and DSKSELx LOW
;	bsr.l	Wait_Ready
	move.l	d0,-(a7)
	move.w	#$7000,d0
.l:	dbf	d0,.l
	move.l	(a7)+,d0
	rts

Motor_Off:
	move.b	#$ff,$bfd100	;Bits 0-7 HIGH
	nop
	nop
	move.b	motorstatus(pc),d0
	ori.b	#$80,d0		;DSKMOTOR HIGH DSKSELx LOW
	move.b	d0,$bfd100
	move.l	d0,-(a7)
	move.w	#$5000,d0
.l:	dbf	d0,.l
	move.l	(a7)+,d0
	rts

;This rut moves the r/w-head to a track with the number stored in d0.

Head_Pos:
	lea	$bfd100,a0
	tst.w	d0
	beq	Move_zero

	moveq	#0,d1
	move.b	current_drive(pc),d1
	add.w	d1,d1
	lea	Tracknum0-2(pc),a5
	lea	(a5,d1.w),a5
	move.w	(a5),d2		;current track no: om=$ffff-init head
	bpl.s	ok_drv_is_initialized

	movem.l	d0-d7/a0-a6,-(a7)
	bsr	Move_zero
	movem.l	(a7)+,d0-d7/a0-a6
	clr.w	d2

ok_drv_is_initialized:
	move.w	d0,d3
	moveq	#0,d1
	move.b	Floppystatus(pc),d1
	bset	#2,d1			;select head 0 (lower side)
	btst	#0,d3			;track number even ?
	beq.s	Down_Right
	bclr	#2,d1			;no, select head 1 (upper side)
Down_Right:
	move.b	d1,Floppystatus
	move.b	d1,(a0)
	move.w	d3,(a5)			;save new track-number
	lsr.w	#1,d2			;d2=current cylinder
	lsr.w	#1,d3			;d3=new cylinder
	sub.w	d3,d2			;make difference
	beq.s	Head_end
	bmi.s	Seek_in			;diff. negativ=> step in
	bra.s	Seek_out		;diff. positiv=> step out

Seek_in:
	bclr	#1,d1			;step in
	move.b	d1,Floppystatus
	neg.w	d2			;make number positive
	bra.s	Step_Ok
Seek_out:
	bset	#1,d1			;step out
	move.b	d1,Floppystatus
;	bra.w	Step_Ok
;HeadStep:
Step_Ok:
	move.w	d2,stepno
waitstep:
	tst.w	stepno
	bne.s	waitstep
	move.l	d0,-(a7)
	move.w	#2000,d0
.h:	dbf	d0,.h
	move.l	(a7)+,d0
Head_end:
	rts

Move_zero:				;move head to track zero
	lea	$bfd100,a0
	move.b	Floppystatus(pc),d1
	bset	#2,d1
	bset	#1,d1
	move.b	d1,Floppystatus

	moveq	#0,d0
	move.b	current_drive(pc),d0
	add.w	d0,d0
	lea	Tracknum0-2(pc),a5
	lea	(a5,d0.w),a5
	clr.w	(a5)		;current track number

Headzero:
	btst	#4,$bfe001	;test if zero
	beq.s	zero1
	bsr	Step
	bra.s	Headzero
zero1:
	bclr	#1,Floppystatus
	bsr	Step
	bset	#1,Floppystatus
	bsr	Step
	bra.s	Head_end

;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­

Read_Track:
	clr.w	$24(a6)		;DSKLEN->forbid diskdma
	lea	TrackShit(pc),a0
	move.l	a0,$20(a6)	;set DSKPTH and DSKPTL
	move.w	#$9a00,$24(a6)	;enable diskdma and set amount of
	move.w	#$9a00,$24(a6)	;words+2 to transfer.
	move.w	#$0002,$9c(a6)
	nop
	nop

Wait_Dma:
	move.w	$1e(a6),d3
	and.w	#$2,d3		;DSKBLK=0 ?
	beq.s   Wait_Dma	;yeah=> wait
	clr.w	$24(a6)		;forbid writing
	move.w  #$0002,$9c(a6)	;clear DSKBLK


	lea	DecodedTrack(pc),a0	;pointer to decodebuffer
	lea	TrackShit(pc),a1	;pointer to MFMbuffer
	moveq	#11-1,d5		;decode 11 blocks (-1 coz dbf)
	move.l	#$55555555,d3		;filter for tactbits

decode_all_blocks:
	cmp.w	#$4489,(a1)+		;1st sync-word found ?
	bne.s	decode_all_blocks	;no=> go on searching

sync_found:
	cmp.w	#$4489,(a1)	;2. sync-word found ?
	bne.s	syncs_ok	;no=> all syncs skipped
	addq.w	#2,a1		;yes=>
	bra.s	sync_found	;search for remaining syncs

syncs_ok:			;decode infoblock
	move.l	(a1)+,d0	;odd bits
	move.l	(a1)+,d1	;even bits
	and.l	d3,d0
	and.l	d3,d1
	add.l	d0,d0
	or.l	d1,d0

	swap	d0
	and.w	#$ff00,d0	;mask format-sign (must be $ff)
	cmp.w	#$ff00,d0	;right value?
	bne.s	Loerror		;no==>ERROR!
	swap	d0

	and.w	#$ff00,d0	;mask sector number*256
	add.w	d0,d0		;d0=d0*2 (=sector number*512)
	move.l	a0,a2		;address of decodebuffer ->a2
	adda.w	d0,a2		;calc. correct destination

	adda.w	#40,a1		;address of checksum ->a1
	move.l	(a1)+,d4	;decode checksum
	move.l	(a1)+,d1
	and.l	d3,d4
	and.l	d3,d1
	add.l	d4,d4
	or.l	d1,d4		;store checksum ->d4

	moveq	#128-1,d6	;decode 128*2 longs to 512 bytes
	moveq	#0,d2		;clear datachecksum

decodeblock:			;decode datablock
	move.l	512(a1),d1	;even bits
	move.l	(a1)+,d0	;odd bits

	eor.l	d0,d2		;calc checksum
	eor.l	d1,d2		;dito

	and.l	d3,d0		;decode longword
	and.l	d3,d1
	add.l	d0,d0
	or.l	d1,d0
	move.l	d0,(a2)+	;store longword in buffer
	dbf	d6,decodeblock	;decode next longword

	and.l	d3,d2		;remove tactbits
	cmp.l	d4,d2		;checksum correct ?
	bne.s	Loerror		;no=>ERROR!
	adda.w	#512,a1		;reach next block
	dbf	d5,decode_all_blocks
	moveq	#0,d0
	rts

Loerror:moveq	#-1,d0
	rts

TrackShit:	blk.l	$3400/4,0
DecodedTrack:	blk.l	$1600/4,0

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

;TimeDecruncher - av Mahoney Juni -90
CrunchShitPoi:	dc.l	$60000
TimeDest:	dc.l	$70000

ss:;	lea	$70000,a0
;	move.w	#$c000/8,d0
;hej:	move.l	#'Jose',(a0)+
;	move.l	#'fin!',(a0)+
;	dbf	d0,hej
Decrunch:
	move.l	CrunchShitPoi(pc),a0
	move.l	(a0)+,d0
	eor.l	#"Elin",d0
	add.l	d0,a0
	move.l	TimeDest(pc),a1
	move.l	-(a0),a2
	add.l	a1,a2
	tst.l	-(a0)
	move.l	-(a0),d0
	moveq	#$10,d4
	moveq	#2,d5
	moveq	#3,d6
	moveq	#1,d7
	lea	7.w,a4

Z03a:	;move.w	d0,$dff182
	moveq	#3,d1
	bsr	Z132
	tst.w	d2
	beq.s	Z0a2
	cmp.w	a4,d2	;a4=#7
	bne.s	Z078
	lsr.l	#1,d0
	bne.s	Z05c
	 move.l	-(a0),d0
	 move	d4,ccr
	 roxr.l	#1,d0
Z05c:	bcc.s	Z070
	moveq	#10,d1
	bsr	Z132
	tst.w	d2
	bne.s	Z078
	moveq	#$12,d1
	bsr	Z132
	bra.s	Z078

Z070:	moveq	#4,d1
	bsr	Z132
	addq.w	#7,d2
Z078:	subq.w	#1,d2
Z07a:	moveq	#7,d1
Z07c:	lsr.l	#1,d0
	beq.s	Z08e
	roxl.l	#1,d3
	dbra	d1,Z07c
	move.b	d3,-(a2)
	dbra	d2,Z07a
	bra.s	Z0a2

Z08e:	move.l	-(a0),d0
	move	d4,ccr
	roxr.l	#1,d0
	roxl.l	#1,d3
	dbra	d1,Z07c
	move.b	d3,-(a2)
	dbra	d2,Z07a
Z0a2:	cmp.l	a2,a1
	bge.s	Z122
	moveq	#2,d1
	bsr.s	Z132
	moveq	#2,d3
	moveq	#8,d1
	tst.w	d2
	beq.s	Z110
	moveq	#4,d3
	cmp.w	d5,d2	;d5=#2
	beq.s	Z0fa
	moveq	#3,d3
	cmp.w	d7,d2	;d7=#1
	beq.s	Z0ec
	moveq	#2,d1
	bsr.s	Z132
	cmp.w	d6,d2	;d6=#3
	beq.s	Z0e4
	cmp.w	d5,d2	;d5=#2
	beq.s	Z0da
	addq.w	#5,d2
	move.w	d2,d3
	bra.s	Z0fa

Z0da:	moveq	#2,d1
	bsr.s	Z132
	addq.w	#7,d2
	move.w	d2,d3
	bra.s	Z0fa

Z0e4:	moveq	#8,d1
	bsr.s	Z132
	move.w	d2,d3
	bra.s	Z0fa

Z0ec:	moveq	#8,d1
	lsr.l	#1,d0
	bne.s	Z0f4
	 move.l	-(a0),d0
	 move	d4,ccr
	 roxr.l	#1,d0
Z0f4:	bcs.s	Z110
	moveq	#14,d1
	bra.s	Z110

Z0fa:	moveq	#$10,d1
	lsr.l	#1,d0
	bne.s	Z102
	 move.l	-(a0),d0
	 move	d4,ccr
	 roxr.l	#1,d0
Z102:	bcc.s	Z110
	moveq	#8,d1
	lsr.l	#1,d0
	bne.s	Z10c
	 move.l	-(a0),d0
	 move	d4,ccr
	 roxr.l	#1,d0
Z10c:	bcs.s	Z110
	moveq	#12,d1
Z110:	bsr.s	Z132
	subq.w	#1,d3
Z114:	move.b	-1(a2,d2.l),-(a2)
	dbra	d3,Z114
	cmp.l	a2,a1
	blt	Z03a
Z122:	rts

Z132:	subq.w	#1,d1
	moveq	#0,d2
Z136:	lsr.l	#1,d0
	beq.s	Z142
	roxl.l	#1,d2
	dbra	d1,Z136
	rts
Z142:	move.l	-(a0),d0
	move	d4,ccr
	roxr.l	#1,d0
	roxl.l	#1,d2
	dbra	d1,Z136
	rts

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

Init_drives:
	lea	DriveOns(pc),a3
	moveq	#2,d2
	move.b	#$10,d3

lo:	not.b	d3
	lea	$bfd100.l,a0
	move.b	#$7f,d0
	move.b	d0,(a0)
	move.b	#$ff,(a0)
	move.b	d3,(a0)
	move.b	#$ff,(a0)
	moveq	#$1f,d1
	moveq	#0,d0

.lop:	lsl.l	#1,d0
	move.b	d3,(a0)
	btst	#5,$bfe001.l
	beq.s	.hej
	bset	#$0,d0
.hej:	move.b	#$ff,(a0)
	dbf	d1,.lop
	not.b	d3


	not.l	d0
	move.l	d0,(a3)+
	lsl.b	#1,d3
	dbf	d2,lo

	cmp.l	#$ffffffff,driveons+8
	bne.s	.no3
	move.b	#%10001000,seconddrive	;df3:
.no3:	cmp.l	#$ffffffff,driveons+4
	bne.s	.no2
	move.b	#%10000100,seconddrive	;df2:
.no2:	cmp.l	#$ffffffff,driveons
	bne.s	.no1
	move.b	#%10000010,seconddrive	;df1:
.no1:
	move.l	#-1,tracknum0
	move.l	#-1,tracknum0+4
	rts
		;     df1:,df2:,df3:
driveons:	dc.l	0,0,0


clearreq:
	movem.l	d0/a0,-(a7)
	lea	menu1+[$33*44]+2,a0
	moveq	#$68+8-$33-1,d7

	tst.w	tuneinmemory
	beq.s	.k
	moveq	#$68-$33-1,d7	;inte cleara tunetimer

.k:	and.l	#$f0000000,(a0)
	clr.l	4(a0)
	clr.w	8(a0)
	and.b	#$0f,10(a0)
	or.l	#$0fffffff,menu2-menu1(a0)
	move.l	#$ffffffff,4+menu2-menu1(a0)
	move.w	#$ffff,8+menu2-menu1(a0)
	or.b	#$f0,10+menu2-menu1(a0)
	lea	44(a0),a0
	dbf	d7,.k
	movem.l	(a7)+,d0/a0
	rts

printloadtext:
	bsr	clearreq

	lea	menu1+[$44*44]+2,a0
	moveq	#$5c-$44-1,d7
.k:	or.l	#$00ffffff,(a0)
	move.l	#$ffffffff,4(a0)
	move.w	#$ffff,8(a0)
;	and.b	#$1f,10(a0)
	or.l	#$07ffffff,menu2-menu1(a0)
	move.l	#$ffffffff,4+menu2-menu1(a0)
	move.w	#$ffff,8+menu2-menu1(a0)
	or.b	#$e0,10+menu2-menu1(a0)
	lea	44(a0),a0
	dbf	d7,.k
	lea	.loadtext1(pc),a0
	jmp	print1

.loadtext1:
	dc.b $ff,$80,$3c,$46,'please wait'
	dc.b $ff,$80,$3c,$50,'- loading -',0
	even

NewScrollMessage:
	move.l	.scrpoi(pc),a0
	jsr	PrintScrolly
	tst.b	(a0)
	bpl.s	.lo
	lea	.scrloadtext(pc),a0
.lo:	move.l	a0,.scrpoi
	rts

.scrpoi:	dc.l	.scrloadtext

.scrloadtext:
 dc.b 16,17,18," Welcome to His Master's Noise - Musicdisk 5 programmed by"
 dc.b " Mahoney & Kaktus. Enjoy it! ",16,17,18,0
 dc.b "Mahoney & Kaktus send their best wishes to all creatures on this planet!",0
 dc.b "This musicdisk is a product of Mahoney & Kaktus - NorthStar & HallonSoft!",0
 dc.b "Thanks must go to all persons involved in this 20 months-project, thank you!",0
 dc.b 15," This musicdisk is dedicated to Helene, my girlfriend."
 dc.b " I love you ... / ",27,28,29,30,31,' ',15,0
 dc.b "This is the last demo you'll ever see from Mahoney & Kaktus. Enjoy it"
 dc.b " while you can!",0
 dc.b 25,26," Polhems Getar f}rgyller tillvaron med sin existens! ",25,26,0
 dc.b 'Why not type "train" on your keyboard, and try out our bad taste!',0
 dc.b "There are even more key-codes, all hidden everywhere in this musicdisk.",0
 dc.b "White-tailed gnus are mainly smaller than average gnus.",0
 dc.b "Some 100 years ago, the white-tailed gnu was probably the most common"
 dc.b " of the hoofed animals in the south of Africa.",0
 dc.b "At the end of the 16th century, man started a wild hunt of gnus.",0
 dc.b "A white-tailed gnu is in Latin: Connochaepes Gnou.",0
 dc.b 'The normal gnus are called "Connochaepes Taurinus" in Latin',0
 dc.b "A normal gnu with a white beard is called Connochaepes Taurinus"
 dc.b " Albojubatus.",0
 dc.b "The spreading of the gnus is show in the map on page 51.",0
 dc.b "Now all this gnu-crap is finished, hope you've learned something important!",0
 dc.b "Soon will some technical stuff about this musicdisk come up here ...",0
 dc.b "The source-code of this musicdisk is something like 280 kilobytes"
 dc.b " of memory!",0
 dc.b "Every tune takes about 5 kilobytes on the disk, including the"
 dc.b " scrolltext of about 2kb.",0
 dc.b "When decrunched and calculated, the tune takes 224kb of memory.",0
 dc.b "Replay goes 4 times per frame, included is programmed waveforms,"
 dc.b " and loads of special commandos.",0
 dc.b "The loading routine calculates chords (I made it before Exolon!),"
 dc.b " mixes, detunes, reverses, distorts, cuts ...",0
 dc.b "... zeroes, copies, transposes, programmed waveforms, all with"
 dc.b " pure 32-bit technology.",0
 dc.b "21 musicians have taken part of the composing, making 101 tunes.",0
 dc.b "I now have 50 workdisks for this musicdisk, everything backupped.",0
 dc.b "One and a half year ago, I started the programming of a special"
 dc.b " Noisetracker-version.",0
 dc.b "It all ended up in this, and this is really the end of my programming"
 dc.b " on Amiga.",0
 dc.b "The equipment I've used for the production: 150 disks, one Amiga 500"
 dc.b " with 1mb of ram ...",0
 dc.b "... no hard-drive, one sampler, one toothbrush, a monitor, a girlfriend ...",0
 dc.b "... lots of nice phone-calls, lots of nice letters, lots of nice"
 dc.b " sleepless nights ...",0
 dc.b "... no Coke, no shit-shit, no dr. Alban, loads of instrumental music ...",0
 dc.b "But: If I knew what this was going to be a year ago, I would not"
 dc.b " have started this!",0
 dc.b "This is our style of a demo, you might recognise it. Many have tried"
 dc.b " to copy it, but failed.",0
 dc.b "This is the original: Wierd, ugly, funny, crowded, everything moving,"
 dc.b " always a new key-code. I like it!",0
 dc.b "I doesn't look good, but still much funnier than 345 vector-balls"
 dc.b " in 1 frame.",0
 dc.b "So, I can understand you won't have the patience to do a demo like this"
 dc.b ", but please be original.",0
 dc.b "I still have seen too many filled-vectors these day. Go big or go home."
 dc.b " Does the size matter?",0
 dc.b "Now the ideas will be put in the first place, not a vector-cube!",0
 dc.b 25,26,"  This is just another useless message, you don't have to read"
 dc.b " it if you don't want to.  ",25,26,0
 dc.b "This is the last message here, now it's up to you: Will we have peace"
 dc.b " on earth some day?",0
 dc.b -1

calctext1:
	dc.b $ff,$80,$3c,$4b,'calculating',0
	even

PrintCalcText:
	lea	menu1+[$44*44]+2,a0
	moveq	#$5c-$44-1,d7

.k:	or.l	#$00ffffff,(a0)
	move.l	#$ffffffff,4(a0)
	move.w	#$ffff,8(a0)
;	and.b	#$1f,10(a0)
	or.l	#$07ffffff,menu2-menu1(a0)
	move.l	#$ffffffff,4+menu2-menu1(a0)
	move.w	#$ffff,8+menu2-menu1(a0)
	or.b	#$e0,10+menu2-menu1(a0)
	lea	44(a0),a0
	dbf	d7,.k
	lea	calctext1(pc),a0
	jmp	print1

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

loaddisk1:
	clr.w	FastmemFlag
	tst.w	TuneInMemory
	bne.s	.e
	bsr	printloadtext
.e:	clr.b	LoadTuneCurrDrv

	move.b	#%0001,drive
.errorloop2:
	move.l	TypeOFastMem(pc),load_dest
	move.l	#$5c000,load_diskpos
	move.l	#$100,load_length
	bsr	laddafilen

	tst.l	d0
	beq	.mat_ok			;nu ar det kalas
	bmi	mt_nodisk1		;skiten pajade
	bra.s	.errorloop2		;ladda igen
.Mat_ok:

	move.b	#%0001,drive
.err2:
	movem.l	d0-d7/a0-a6,-(a7)
	tst.w	TuneInMemory
	bne.s	.lek
	bsr	printloadtext
	bra.s	.ee
.lek:	jsr	reprintTuneText
.ee:	movem.l	(a7)+,d0-d7/a0-a6
	moveq	#0,d0

	move.l	TypeOFastMem(pc),load_dest
	move.l	#$5c000,load_diskpos
	move.l	#$7ffc0,load_length
	bsr	laddafilen

	tst.l	d0
	beq	.at_ok			;nu ar det kalas
	bmi	mt_nodisk1		;skiten pajade
	bra.s	.err2			;ladda igen
.at_ok:
	move.w	#1,FastMemFlag
	bsr	Motor_off
	tst.w	TuneInMemory
	bne.s	.h
	jsr	printnotune
.h:	clr.w	actkey
	clr.w	loadwholedisk1
	jmp	PrintPrefsFastMem

mt_nodisk1:
	move.w	#2,FastMemFlag
	move.l	#$00000001,Fa_1TuneNo	;clr fasttunenos
	clr.w	Fa_2TuneNO
	bsr	motor_off
	tst.w	TuneInMemory
	bne.s	.h
	jsr	printnotune
	bra.s	.y
.h:	jsr	reprinttunetext
.y:	clr.w	actkey
	clr.w	loadwholedisk1
	jmp	PrintPrefsFastMem

TuneDiskStarts:
 dc.l $154b8,$15b4c,$175bc,$18738,$1b694,$1e990,$20acc,$227d4,$235e8,$26058
 dc.l $26d58,$27c1c,$286e8,$29c30,$2a808,$2b670,$2be68,$2d7a4,$2fe00,$311c4
 dc.l $320c0,$33148,$362fc,$36b2c,$37440,$37934,$387e0,$38b8c,$3bbf4,$3cc64
 dc.l $3d9c8,$3f840,$418f0,$42c50,$43b9c,$4480c,$494f4,$4aad4,$4b89c,$4c7a8
 dc.l $4d094,$52c34,$5427c,$55fe8,$56cb0,$5a8cc,$5ba4c,$5c2b4,$5d308,$5e13c
 dc.l $5fa24,$60454,$60d58,$63d40,$64d64,$660b8,$6682c,$689e4,$69c34,$6bcc0
 dc.l $719d4,$732e0,$74608,$759e4,$78fec,$7b178,$7c484,$7d628,$7e414,$7ebd4
 dc.l $7f86c,$8029c,$817bc,$82ae0,$83a8c,$84c14,$85bd8,$868b0,$885f4,$898e4
 dc.l $8c010,$8d0d8,$8df44,$8ef88,$957ac,$9627c,$9acfc,$9c864,$9daf8,$9e42c
 dc.l $9f428,$a116c,$a1ad0,$a25e4,$a2d00,$a3410,$a3fc0,$a7eac,$d0810,$d1cc8
 dc.l $d3498,$d5690

LoadNoSwap:	dc.b	0
TuneToLoad:	dc.b	0
Blinkaload:	dc.b	0
		dc.b	0
Fatuneinmempoi:	dc.l	0
Base:	dc.l	$c0

depacktune:
	moveq	#0,d0
	move.b	TuneToLoad(pc),d0
	cmp.w	TuneInMemory,d0
	beq	WaitReallyEnd

	cmp.w	#2,FastMemFlag
	bne.s	.noFast


	cmp.w	Fa_1TuneNo,d0
	beq	TuneFinished
	cmp.w	Fa_2TuneNo,d0
	beq	TuneFinished

	tst.w	Fa_1TuneNo+2
	bne	.Shift2

.Shift1:lea	Fa_1TuneNo,a5
	move.l	TypeOFastMem(pc),a6
	lea	$c0(a6),a6
	bra.s	.move
.Shift2:lea	Fa_2TuneNo,a5
	move.l	TypeOFastMem(pc),a6
	add.l	#$400c0,a6

.move:	move.l	a5,FaTuneInMemPoi
	clr.w	(a5)
	move.l	a6,Base
	bra.w	.LoadInFast



.NoFast:clr.l	mt_data
	clr.w	tuneinmemory
	move.w	#$f,$dff096
	moveq	#0,d0
	move.w	d0,$dff0a8
	move.w	d0,$dff0b8
	move.w	d0,$dff0c8
	move.w	d0,$dff0d8
	lea	menu1+[$25*44]+11,a0	;stopbutton
	lea	menu2+[$25*44]+11,a1
	move.b	#%11111000,1*44(a0)
	move.b	#%00000111,1*44(a1)
	move.b	#%11111000,2*44(a0)
	move.b	#%00000111,2*44(a1)
	move.b	#%11111000,3*44(a0)
	move.b	#%00000111,3*44(a1)
	move.b	#%11111000,4*44(a0)
	move.b	#%00000111,4*44(a1)
	move.b	#%11111000,5*44(a0)
	move.b	#%00000111,5*44(a1)

	move.l	#Fa_0TuneNo,FaTuneInMemPoi
	move.l	#$c0,Base

.loadInFast:
	tst.w	TuneInMemory
	bne.s	.ok
	bsr	printloadtext
	bsr	NewScrollMessage

.ok:	clr.b	LoadTuneCurrDrv

	moveq	#0,d0
	move.b	TuneToLoad(pc),d0
	subq.b	#1,d0
	asl.w	#$2,d0
	lea	TuneDiskStarts(pc),a3
	move.b	seconddrive(pc),drive

	move.l	(a3,d0.w),d1
	move.l	4(a3,d0.w),d2

	sub.l	d1,d2
	add.l	#32,d2		;laddaren missar sista byten ibland!
	bra.s	.re

.mat_errorloop2:
	movem.l	d0-d7/a0-a6,-(a7)
	jsr	reprinttunetext
	movem.l	(a7)+,d0-d7/a0-a6
.re:
	move.l	Base(pc),d0	;packedtune
	add.l	#$80,d0
	move.l	d0,load_dest
	move.l	d1,load_diskpos
	move.l	d2,load_length

	bsr	laddafilen

	tst.l	d0
	beq	mat_ok			;nu ar det kalas
	bmi	mt_packerr		;skiten pajade
	bra.s	.mat_errorloop2		;ladda igen


Mat_ok:	move.l	Base(pc),d0	;packedtune
	add.l	#$80,d0
	move.l	d0,CrunchShitPoi
	add.l	#$1000,d0	;tunedatadest
	move.l	d0,TimeDest
	bsr	decrunch

	move.l	Base(pc),a0	;tunedatadesttune
	lea	$1080(a0),a0
	lea	$c00(a0),a0
	lea	$3e(a0),a1
	move.l	Base(pc),a6	;lea	L698+4,a6
	lea	4(a6),a6

	moveq	#$1e,d7
mt_ilo:	move.l	#dummysound,d0
	moveq	#0,d1
	move.w	(a0)+,d1
	beq.s	mt_i2lo
	move.l	a1,d0
	add.l	d1,a1	;oka a1 for externljud
mt_i2lo:
	move.l	d0,(a6)+
	dbf	d7,mt_ilo

	move.l	Base(pc),a0
	move.l	a1,(a0)		;mt_data	;songdatastart

	bset	#$01,$bfe001	;filter off

	move.l	Base(pc),a0		;=mt_data
	move.l	(a0),a0
	lea	$3b8(a0),a1
	moveq	#$7f,d0
	moveq	#0,d2
	moveq	#0,d1
mt_lop2:move.b	(a1)+,d1
	cmp.b	d2,d1
	ble.s	mt_lop
	move.l	d1,d2
mt_lop:	dbf	d0,mt_lop2
	addq.b	#1,d2

	asl.l	#8,d2
	asl.l	#2,d2

	lea	4(a1,d2.l),a2	;a2=endofsongdata->ladda instr

	moveq	#127,d6		;instrno att ladda
mt_instrnoloop:
	move.l	Base(pc),a0
	move.l	(a0),a0
	lea	$14(a0),a0
	move.l	Base(pc),a1	;lea L698+4,a1
	lea	4(a1),a1
	moveq	#$1e,d7
	move.w	d6,InstrCount
mt_loadinstr:
	cmp.w	#'El',(a0)
	bne.L	mt_notthisone

	moveq	#0,d0
	move.b	2(a0),d0
	beq	mt_notthisone
	cmp.b	d0,d6
	bne	mt_notthisone
	subq.b	#1,d0
	asl.w	#$2,d0
	lea	InstrumentDiskPosses(pc),a3
	move.b	#%0001,drive
	move.l	(a3,d0.w),d1
	bmi.L	mt_wrongdisk
	move.l	4(a3,d0.w),d2
	bpl.L	mt_thisdisk

mt_wrongdisk:
	lea	InstrumentDisk2Posses-[109*4](pc),a3
	move.l	(a3,d0.w),d1
	move.l	4(a3,d0.w),d2
	move.b	seconddrive(pc),drive
	bra.s	conny

mt_thisdisk:
	cmp.w	#1,FastMemFlag
	bne.s	conny
	bsr	Motor_off
	add.l	TypeOFastMem(pc),d1
	sub.l	#$5c000,d1
;	add.l	#$c00000-$5c000,d1
	movem.l	d7/a0-a3,-(a7)
	move.l	d1,CrunchShitPoi
	bra.s	gowithoutload

conny:	sub.l	d1,d2
	add.l	#32,d2		;laddaren missar sista byten ibland!
	bra.s	.re

.mt_errorloop2:
	movem.l	d0-d7/a0-a6,-(a7)
	jsr	reprinttunetext
	movem.l	(a7)+,d0-d7/a0-a6
.re:
	move.l	Base(pc),d0	;crunchedinstrument
	add.l	#$34000,d0
	move.l	d0,load_dest
	move.l	d1,load_diskpos
	move.l	d2,load_length

	bsr	laddafilen

	tst.l	d0
	beq	mt_okmedcruncher	;nu ar det kalas
	bmi	mt_packerr		;skiten pajade
	bra.s	.mt_errorloop2		;ladda igen


mt_okmedcruncher:
	movem.l	d7/a0-a3,-(a7)
	move.l	Base(pc),d0	;CrunchedInstrument
	add.l	#$34000,d0
	move.l	d0,CrunchShitPoi
gowithoutload:
	move.l	a2,TimeDest
	bsr	Decrunch
	movem.l	(a7)+,d7/a0-a3

	move.l	a2,(a1)
	moveq	#0,d0
	move.w	$16(a0),d0
	add.w	d0,d0
	add.l	d0,a2

mt_notthisone:
	lea	$1e(a0),a0
	tst.l	(a1)+
	move.w	InstrCount(pc),d6
	dbf	d7,mt_loadinstr

	subq.w	#1,d6
	bne	mt_instrnoloop

exitload:
	bsr	motor_off

	move.l	a2,AllocMemPoi
	tst.w	TuneInMemory
	bne.s	.r
	bsr	PrintCalcText
.r:	bsr	Commandorutin

	move.l	Fatuneinmempoi(pc),a0
	moveq	#0,d0
	move.b	TuneToLoad(pc),d0
	move.w	d0,(a0)

TuneFinished:
	moveq	#0,d0
	move.b	TuneToLoad(pc),d0
	cmp.w	#2,FastMemFlag
	bne	ReallyEnd
	tst.b	LoadNoSwap
	bne	NoSwap

	move.w	TuneInMemory,-(a7)
	clr.w	TuneInMemory
	lea	FastSwapMessage(pc),a0
	jsr	PrintScrolly

	move.w	(a7)+,d7
	moveq	#0,d0
	move.b	TuneToLoad(pc),d0
	cmp.w	Fa_2TuneNo,d0
	beq.s	.shift2
	cmp.w	Fa_1TuneNo,d0
	beq.s	.shift1
	bra	ReallyEnd

.Shift1:move.w	d7,Fa_1TuneNo
	move.l	TypeOFastMem(pc),a6
	lea	$c0(a6),a6
	move.w	#1,Fa_1TuneNo+2
	bra.s	.move
.Shift2:move.w	d7,Fa_2TuneNo
	move.l	TypeOFastMem(pc),a6
	add.l	#$400c0,a6
	clr.w	Fa_1TuneNo+2

.move:	move.w	#$f,$dff096
	moveq	#0,d0
	move.w	d0,$dff0a8
	move.w	d0,$dff0b8
	move.w	d0,$dff0c8
	move.w	d0,$dff0d8
	move.l	a6,a0
	lea	$c0.w,a1
	move.w	#[$39000/$10]-1,d7
.l:	move.l	(a0),d0
	move.l	(a1),(a0)+
	move.l	d0,(a1)+
	move.l	(a0),d0
	move.l	(a1),(a0)+
	move.l	d0,(a1)+
	move.l	(a0),d0
	move.l	(a1),(a0)+
	move.l	d0,(a1)+
	move.l	(a0),d0
	move.l	(a1),(a0)+
	move.l	d0,(a1)+
	dbf	d7,.l

	lea	mt_data,a0
	moveq	#$1f,d7
.k:	and.l	#$3ffff,(a0)+
	dbf	d7,.k

ReallyEnd:
	move.l	#6,L642	;speed
	moveq	#0,d0
	move.l	d0,L695	;speedcou
	move.l	d0,L693	;songpos
	move.l	d0,L692	;pattpos
	move.w	d0,$dff0a8
	move.w	d0,$dff0b8
	move.w	d0,$dff0c8
	move.w	d0,$dff0d8
	move.w	#$f,$dff096
	move.b	#0,tsek1go
	move.b	#0,tmin1go
	move.b	#0,tmin2go
	move.l	#$30003000,tminut1
	move.l	#$30003000,tsekund1
	move.b	d0,L592+$1c	;progljud off
	move.b	d0,L593+$1c
	move.b	d0,L594+$1c
	move.b	d0,L595+$1c
	clr.w	ttim1
	jsr	tunetext_init
	move.l	tunedatadest,sc_poi
	move.w	#40,sc_wait

	moveq	#0,d0
	move.b	tunetoload,d0
	move.w	d0,tuneinmemory
	move.w	#1,sc_onoff
	rts

NoSwapp:eor.w	#1,Fa_1TuneNo+2
NoSwap:	tst.w	TuneInMemory
	bne.s	.h
	jsr	PrintNoTune
.h:	clr.b	LoadNoSwap
	eor.w	#1,Fa_1TuneNo+2
	rts

WaitReallyEnd:
	tst.b	LoadNoSwap
	bne	NoSwapp
	clr.w	TuneInMemory
	move.w	#$f,$dff096
	moveq	#0,d0
	move.w	d0,$dff0a8
	move.w	d0,$dff0b8
	move.w	d0,$dff0c8
	move.w	d0,$dff0d8
	lea	.SameTxt(pc),a0
	jsr	PrintScrolly
	move.w	#$bada,d7
.k:	nop
	dbf	d7,.k
	move.w	#$bada,d7
.a:	nop
	dbf	d7,.a
	bra	ReallyEnd

.SameTxt:
 dc.b "Was it really that good that it's worth listening to once more?",0

mt_packerr:
	clr.w	actkey
	bsr	motor_off

	cmp.w	#2,FastMemFlag
	beq.s	.fast
	clr.w	tuneinmemory
	clr.l	mt_data
	jmp	printnotune

.Fast:	move.l	FaTuneInMemPoi(pc),a0
	clr.w	(a0)
	moveq	#0,d0
	cmp.l	#Fa_1TuneNo,a0
	beq.s	.e
	moveq	#1,d0
.e:	move.w	d0,Fa_1TuneNo+2
	jmp	RePrintTunetext

InstrCount:	dc.w	0
AllocMemPoi:	dc.l	0
FastMemFlag:	dc.w	0	;0=nothing, 1=whole disk 1, 2=3 tunes
TypeOFastMem:	dc.l	0

FastSwapMessage:
 dc.b 25,26,"  This is just another useless message, you don't have to read"
 dc.b " it if you don't want to.  ",25,26,0
 even

InstrumentDiskPosses:
	dc.l $5c000,$5ce60,$5d338,$5d8b4,$5dec0,$5e4b0,$5ef78,$5fea0,$60fa8
	dc.l $62454,$62528,$632fc,$642ac,$650c4,$660c0,$6687c,$671fc,$67868
	dc.l $69928,$6e35c,$6f7d0,$70ac4,$72fd0,$756c0,$770b4,$77cb0,$78f08
	dc.l $7ab5c,$7bc08,$7cf20,$7d914,$7f3c8,$7f874,$8011c,$80b10,$81ef0
	dc.l $8299c,$83674,$84f00,$859a8,$86868,$8814c,$8ab1c,$8dc0c,$8ebd8
	dc.l $8ef84,$90144,$906ec,$913ec,$93250,$94900,$954a0,$96ad4,$97868
	dc.l $97e84,$98570,$987d8,$99b14,$9b394,$9cd20,$9e790,$9fe5c,$a1f38
	dc.l $a228c,$a2978,$a356c,$a4b6c,$a7680,$a81dc,$a9f2c,$aab50,$ab0d4
	dc.l $ad1a0,$afa44,$b2f0c,$b65a0,$b759c,$b941c,$bb28c,$bc490,$bde74
	dc.l $be2d0,$bed8c,$c116c,$c2e24,$c4218,$c44b8,$c4910,$c55d0,$c6dd0
	dc.l $c7044,$c7a20,$c83bc,$c9334,$c965c,$caaa8,$cc7e4,$ce658,$d0368
	dc.l $d08e0,$d2844,$d3924,$d4624,$d4e98,$d5a6c,$d762c,$d87c8,$d8bc0
	dc.l $dabfc,$dbfb0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
	dc.l -1,-1,-1,-1,-1,-1,-1,-1

;Kalle har fatt en cykelpump i julklapp!

InstrumentDisk2Posses:
	DC.L	$02c00,$065f8,$07658,$07988,$08790,$08aa8,$0b788,$0c640,$0c784
	DC.L	$0c998,$0d330,$0e57c,$0f6e0,$10684,$11678,$12948,$13484,$14a2c
	DC.L	$154b8,$154b8


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

LoadChkDrv:	dc.l	0

laddafilen:
	move.l	Load_dest(pc),LoadChkDrv
	movem.l	d1/d2/d3/d7/a0-a3,-(a7)
	lea	$dff000,a6

	move.l	Load_length(pc),d6
	beq	Slipp_ladda_do
	move.w	#$8210,$96(a6)	;diskdma on!

	move.b	Drive(pc),d0
	cmp.b	LoadTuneCurrDrv,d0
	beq.s	Slipp_byta_drv

	bsr	Motor_off
	move.b	Drive(pc),d0	;set right bit for drive 0,1,2 or 3
	move.b	d0,LoadTuneCurrDrv
	and.b	#$7f,d0
	bsr	select_drive	;select drive from which you want to read
	moveq	#0,d1
	move.b	current_drive(pc),d1
	add.w	d1,d1
	lea	Tracknum0-2(pc),a5
	lea	(a5,d1.w),a5
	move.w	(a5),d0		;current track no: om=$ffff-init head
	bpl.s	.norm
	moveq	#4,d0
.norm:	eor.w	#2,d0
	bsr	head_pos

	btst	#2,$bfe001
	bne	.dontgodiskreq
	movem.l	(a7)+,d1-d3/d7/a0-a3
	bra.s	diskreq
.dontgodiskreq:
	bsr	motor_on	;drivemotor on
	bsr	waitlop		;sakerhetsatgard

Slipp_byta_drv:
	bsr	Init_read
Slipp_ladda_do:
	movem.l	(a7)+,d1-d3/d7/a0-a3
	tst.l	d0
	bne.L	mt_error

	move.l	LoadChkDrv(pc),a4
	move.w	(a4),d0
	eor.w	#"El",d0
	cmp.w	#$2,d0
	bgt.s	diskreq

	move.l	d1,-(a7)
	move.l	Load_length(pc),d0	;kolla crunchlen <-> loadlen
	cmp.l	#$7ffc0,d0	;load whole disk 1
	beq.s	.ok
	cmp.l	#$100,d0
	beq.s	.ok
	sub.l	#32+4,d0
	move.l	(a4),d1
	eor.l	#'Elin',d1
	cmp.l	d0,d1
	bne.s	.dis
.ok:	moveq	#0,d0	;=load ok
	move.l	(a7)+,d1
	rts

.dis:	move.l	(a7)+,d1

			;requester 'insert disk # into drive #'
diskreq:
	lea	loaderstackend(pc),a4
	movem.l	d1-d3/d7/a0-a3,-(a4)

	bsr	motor_off

	move.b	#'1',d0	;disk 1
	tst.b	drive
	bpl.s	.k
	move.b	#'2',d0
.k:	move.b	d0,reqdisk
	moveq	#0,d1
	move.b	drive(pc),d1
	and.b	#$7f,d1
	lea	sntext(pc),a0
	move.b	(a0,d1.w),d1
	move.b	d1,reqdrive

	bsr	clearreq

	moveq	#$39,d0
	moveq	#$46,d1
	moveq	#$51,d2
	moveq	#$61,d3
	tst.w	tuneinmemory
	beq.s	.tt
	moveq	#$39,d0
	moveq	#$44,d1
	moveq	#$4e,d2
	moveq	#$5c,d3

.tt:	move.b	d0,reqtext1+3
	move.b	d1,reqtext2+3
	move.b	d2,reqtext1+13
	move.b	d3,reqdrive+5

	lea	reqtext1(pc),a0
	jsr	print1
	lea	reqtext2(pc),a0
	jsr	print3
	lea	loaderstack(pc),a4
	movem.l	(a4)+,d1-d3/d7/a0-a3
	clr.w	actkey

.a:	cmp.w	#$45,actKey
	beq	.err
	btst	#2,$bfe001
	bne.s	.a
	clr.w	framecou

.b:	cmp.w	#120,framecou		;2.5 sek mellan klick
	bge.s	.tryagain
	cmp.w	#$45,actKey
	beq	.err
	bra.s	.b

.tryagain:
	moveq	#0,d1
	move.b	current_drive(pc),d1
	add.w	d1,d1
	lea	Tracknum0-2(pc),a5
	lea	(a5,d1.w),a5
	move.w	(a5),d0		;current track no: om=$ffff-init head
	bpl.s	.norm
	moveq	#4,d0
.norm:	eor.w	#2,d0
	bsr	head_pos

	clr.w	framecou
	btst	#2,$bfe001
	beq.s	.b

	bsr	printloadtext

	bsr	motor_on
	lea	loaderstack(pc),a4
	movem.l	(a4)+,d1-d3/d7/a0-a3
	moveq	#1,d0		;d0=1 go load again
	rts

.err:	clr.w	actKey		;=escape tryckt
	lea	loaderstack(pc),a4
	movem.l	(a4)+,d1-d3/d7/a0-a3
	moveq	#-1,d0		;fucked up
	rts

mt_error:			;=load error
	moveq	#-1,d0
	clr.w	actKey
	rts


loaderstack:	blk.l	8,0
loaderstackend:
framecou:	dc.w	0
LoadTuneCurrDrv:	dc.b	0
			dc.b	0

sntext:	dc.b ' 01 2   3',0
Reqtext1:
	dc.b $ff,$80,$3c,$39,'insert'
	dc.b $ff,$80,$3c,$51,'into df'
reqdrive:	dc.b '0:'
	dc.b $ff,$80,$3c,$61,'esc to cancel',0

reqtext2:dc.b $ff,$80,$3c,$46,'HMN disk '
reqdisk:	dc.b '1',0
	even

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

LoadFadeOut:
	move.l	d1,-(a7)
	BSR	GETMEMORY
	move.l	(a7)+,d1
	MOVE.L	SAMPLEBUFFER(PC),A0
	ADD.L	D1,A0
	move.l	SampleBufferLen(PC),d7
	SUB.L	D1,D7
	MOVE.L	#$FFFFF,D6
	DIVU	D7,D6
	EXT.L	D6
	ASL.L	#8,D6
	ASL.L	#3,D6
	MOVE.L	#$7FFF0000,D5
	BRA.S	SFO_LOP
SFO_LO:	MOVE.B	(A0),D0
	EXT.W	D0
	SWAP	D5
	MULS	D5,D0
	ASR.L	#8,D0
	ASR.L	#7,D0
	MOVE.B	D0,(A0)+
	SWAP	D5
SFO_LOP:SUB.L	D6,D5
	DBF	D7,SFO_LO
	rts

LoadFadeIn:
	move.l	d1,-(a7)
	bsr	GetMemory
	move.l	(a7)+,d1
	MOVE.L	SAMPLEBUFFER(PC),A0
	MOVE.L	D1,D7
	MOVE.L	#$FFFFF,D6
	DIVU	D7,D6
	EXT.L	D6
	ASL.L	#8,D6
	ASL.L	#3,D6
	MOVEQ	#0,D5
	BRA.S	SFI_LOP
SFI_LO:	MOVE.B	(A0),D0
	EXT.W	D0
	SWAP	D5
	MULS	D5,D0
	ASR.L	#8,D0
	ASR.L	#7,D0
	MOVE.B	D0,(A0)+
	SWAP	D5
SFI_LOP:ADD.L	D6,D5
	DBF	D7,SFI_LO
	rts


FILTTT:	BSR	GETMEMORY
	move.l	SampleBuffer,a0
	move.l	a0,a1
	add.l	SampleBufferLen,a1
	move.l	a1,d0
	sub.l	a0,d0
	subq.l	#$2,d0
	moveq	#$03,d7
	move.b	(a0)+,d1
	ext.w	d1
E2112:	subq.l	#1,d0
	bmi.s	FILTINR
	move.b	$1(a0),d3
	ext.w	d3
	add.w	d1,d3
	move.b	(a0),d2
	ext.w	d2
	add.w	d2,d3
	ext.l	d3
	divs	d7,d3
	move.b	d3,(a0)+
	move.w	d2,d1
	bra.s	E2112
FILTINR:rts


Reva:	bsr	getmemory
	move.l	SampleBuffer(PC),a0
	move.l	a0,a1
	add.l	SampleBufferLen(PC),a1
	move.l	a1,d0
	sub.l	a0,d0
	lsr.l	#1,d0
R_Loop:	move.b	(a0),d1
	move.b	-(a1),d2
	move.b	d1,(a1)
	move.b	d2,(a0)+
	subq.l	#1,d0
	bne.s	R_Loop
	rts


ChangeVo:
	BSR	GETMEMORY
	move.l	SampleBuffer(PC),a0
	MOVE.l	SampleBufferLen(PC),D7
	MOVE.W	#$FF80,A3
	MOVE.W	#$007F,A4
	BRA.S	SCHLOPPA
SCHLOPPI:
	move.b	(a0),d0
	EXT.W	D0
	MULS	D5,D0
	ASL.L	#4,D0
	SWAP	D0
	CMP.W	A3,D0	;$FF80
	BGE.S	OK_NQ
	MOVE.W	A3,D0
OK_NQ:	CMP.W	A4,D0	;$7F
	BLE.S	OK_PQ
	MOVE.W	A4,D0
OK_PQ:	MOVE.B	D0,(A0)+
SCHLOPPA:
	dbf	d7,SCHLOPPI
	rts

octie:	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	octFROM(PC),D1
	MOVE.B	octTO(PC),D2
	MULU	#$1E,D1
	MULU	#$1E,D2
	move.l	Base(pc),a0
	move.l	(a0),a0
	LEA	-$A(A0,D2.W),A1
	LEA	-$A(A0,D1.W),A0

	MOVEQ	#0,D0
	MOVE.W	$16(A0),D0
	MOVE.L	D0,D7
	bsr	AllocMem

	moveq	#0,d1
	move.b	octto(pc),d1
	Asl.w	#2,d1
	move.l	Base(pc),a4
	LEA	(A4,D1.W),A4
	move.l	d0,(a4)

	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	octFROM(PC),D1
	MOVE.B	octTO(PC),D2
	ASL.W	#2,D1
	ASL.W	#2,D2
	move.l	Base(pc),a0
	MOVE.L	(A0,D1.W),A1
	MOVE.L	(A0,D2.W),A2

	move.l	a1,a0
	move.l	a2,a1
	AND.L	#$7FFE,D7
	SUBQ.L	#1,D7
MEDELOCT:
	MOVE.B	(A0)+,D0
	EXT.W	D0
	MOVE.B	(A0)+,D1
	EXT.W	D1
	ADD.W	D1,D0
	ASR.W	#1,D0
	MOVE.B	D0,(A1)+
	DBF	D7,MEDELOCT
	rts
octfrom:	dc.b	0
octto:		dc.b	0

AllocMem:
	neg.l	d0
	and.l	#$fffffffe,d0
	neg.l	d0
	move.l	AllocMemPoi(pc),d1
	add.l	d0,AllocMemPoi
	move.l	d1,d0
	rts


OCTDIE:	MOVEQ	#0,D0
	MOVE.B	OCTFROM(PC),D0
	MOVE.W	D0,L658
	BSR	GETMEMORY
	MOVE.L	SAMPLEBUFFERLEN(PC),D7
	ASL.L	#1,D7
	CMP.L	#$FFFE,D7
	BLE.S	IPOW
	MOVE.L	#$FFFE,D7
IPOW:	MOVE.L	D7,D0
	bsr	AllocMem

	moveq	#0,d1
	move.b	octto(pc),d1
	Asl.w	#2,d1
	move.l	Base(pc),a4
	LEA	(A4,D1.W),A4
	move.l	d0,(a4)
	MOVE.L	SAMPLEBUFFER(PC),A0
	MOVE.L	D0,A1
	LSR.L	#1,D7
	SUBQ.L	#2,D7
OCTDOO:	MOVE.B	(A0)+,D0
	MOVE.B	D0,(A1)+
	EXT.W	D0
	MOVE.B	(A0),D1
	EXT.W	D1
	ADD.W	D0,D1
	LSR.W	#1,D1
	MOVE.B	D1,(A1)+
	DBF	D7,OCTDOO
	MOVE.B	(A0),D0
	MOVE.B	D0,(A1)+
	EXT.W	D0
	LSR.W	#1,D0
	MOVE.B	D0,(A1)+
	rts

ZeroLength:	dc.w	0



AkoPeriods:	dc.w	12,15,19
AkoLength:	dc.w	0
AkoDest:	dc.b	$02
		dc.b	0

AkoProdukter:
	bsr	GetMemory
	MOVEQ	#0,D2
	MOVE.w	L658,D1
	move.b	akkoDest(pc),d2
	MULU	#$1E,D1
	MULU	#$1E,D2
	move.l	Base(pc),a0
	move.l	(a0),a0
	LEA	-$A(A0,D2.W),A1
	LEA	-$A(A0,D1.W),A0

	MOVEQ	#0,D0
	MOVE.W	$16(A1),D0
	add.w	d0,d0
	MOVE.L	D0,D7
	bsr	AllocMem

	moveq	#0,d1
	move.b	AkkoDest(pc),d1
	Asl.w	#2,d1
	move.l	Base(pc),a4
	move.l	d0,(a4,d1.w)

	MOVE.L	D0,AkoDestPoi
	move.l	d7,AkoDestLen

	MOVE.W	L658,D1
	asl.w	#2,d1
	move.l	(a4,d1.w),AkoSourcePoi
	MOVE.w	L658,D1
	MULU	#$1E,D1
	move.l	Base(pc),a0
	move.l	(a0),a0
	LEA	-$A(A0,D1.W),A0
	moveq	#0,d0
	move.w	$16(a0),d0
	add.w	d0,d0
	move.l	d0,AkoSourceLen
	tst.w	$1a(a0)
	bne.s	LoopAko
	bsr	CalcAko
	rts


AkoLoopLength:	dc.l	0

LoopAko:move.w	$1a(a0),a3
	add.w	$1c(a0),a3
	add.w	a3,a3
	moveq	#0,d0
	move.w	$1c(a0),d0
	add.w	d0,d0
	swap	d0
	move.l	d0,AkoLoopLength

	move.l	AkosourcePoi(pc),a0
	move.l	AkodestPoi(pc),a1
	lea	workspace(pc),a2
	move.w	#$7fff,d3
	lea	CalcValues(pc),a6
	move.w	AkkoPeriods(pc),d0
	asl.w	#2,d0
	move.l	(a6,d0.w),a4
	move.w	AkkoPeriods+2(pc),d0
	asl.w	#2,d0
	move.l	(a6,d0.w),a5
	move.w	AkkoPeriods+4(pc),d0
	asl.w	#2,d0
	move.l	(a6,d0.w),a6

	cmp.l	a4,a5
	bge.s	cal3hy
	exg	a4,a5
cal3hy:	cmp.l	a5,a6
	bge.s	cal3he
	exg	a5,a6
cal3he:	cmp.l	a4,a5
	bge.s	cal3hi
	exg	a4,a5
cal3hi:
	move.l	Akodestlen(PC),D7
	moveq	#0,d4
	moveq	#0,d5
	moveq	#0,d6
	subq.l	#1,d7

CalcGnu:move.l	d4,d0
	swap	d0
	cmp.w	a3,d0
	bcs.s	NoAkoL	;blt-u
	sub.l	AkoLoopLength(pc),d4
	move.l	d4,d0
	swap	d0
NoAkoL:	move.b	(a0,d0.w),d1
	move.b	1(a0,d0.w),d2
	ext.w	d1
	ext.w	d2
	swap	d0
	lsr.w	#1,d0
	muls	d0,d2
	eor.w	d3,d0	;#$7fff
	muls	d0,d1
	add.l	d1,d2
	move.l	d2,(a2)+

	move.l	d5,d0
	swap	d0
	cmp.w	a3,d0
	bcs.s	NoAkoL2	;blt-u
	sub.l	AkoLoopLength(pc),d5
	move.l	d5,d0
	swap	d0
NoAkoL2:move.b	(a0,d0.w),d1
	move.b	1(a0,d0.w),d2
	ext.w	d1
	ext.w	d2
	swap	d0
	lsr.w	#1,d0
	muls	d0,d2
	eor.w	d3,d0	;#$7fff
	muls	d0,d1
	add.l	d1,d2
	move.l	d2,(a2)+

	move.l	d6,d0
	swap	d0
	cmp.w	a3,d0
	bcs.s	NoAkoL3	;blt-u
	sub.l	AkoLoopLength(pc),d6
	move.l	d6,d0
	swap	d0
NoAkoL3:move.b	(a0,d0.w),d1
	move.b	1(a0,d0.w),d2
	ext.w	d1
	ext.w	d2
	swap	d0
	lsr.w	#1,d0
	muls	d0,d2
	eor.w	#$7fff,d0
	muls	d0,d1
	add.l	d1,d2

	move.l	-(a2),d1
	move.l	-(a2),d0
	add.l	d0,d0
	add.l	d1,d1
	add.l	d2,d2
	add.l	d0,d1
	add.l	d1,d2
	swap	d2
	ext.l	d2
	divs	#3,d2
	move.b	d2,(a1)+
	add.l	a4,d4
	add.l	a5,d5
	add.l	a6,d6
	dbf	d7,CalcGnu
	rts

AkoSourcePoi:	dc.l	$50000
AkoDestPoi:	dc.l	$60000
Akosourcelen:	dc.l	0
Akodestlen:	dc.l	0
AkkoPeriods:	dc.w	0,0,0
AkkoDest:	dc.b	0
		dc.b	0
CalcValues:
	dc.l	32768,34716,36781,38968,41285,43740		;c-1
	dc.l	46341,49097,52016,55109,58386,61858
	dc.l	65536,69433,73562,77936,82570,87480		;c-2
	dc.l	92682,98193,104032,110218,116772,123715
	dc.l	131072,138866,147123,155872,165140,174960	;c-3
	dc.l	185364,196386,208064,220436,233544,247431
workspace:	dc.l	0,0,0

CalcAko:move.l	AkosourcePoi(pc),a0
	move.l	AkodestPoi(pc),a1
	lea	workspace(pc),a2
	move.w	#$7fff,d3
	lea	CalcValues(pc),a3
	move.w	AkkoPeriods(pc),d0
	asl.w	#2,d0
	move.l	(a3,d0.w),a4
	move.w	AkkoPeriods+2(pc),d0
	asl.w	#2,d0
	move.l	(a3,d0.w),a5
	move.w	AkkoPeriods+4(pc),d0
	asl.w	#2,d0
	move.l	(a3,d0.w),a6
	move.l	Akosourcelen(pc),a3
	subq.l	#1,a3

	cmp.l	a4,a5
	bge.s	cal2hy
	exg	a4,a5
cal2hy:	cmp.l	a5,a6
	bge.s	cal2he
	exg	a5,a6
cal2he:	cmp.l	a4,a5
	bge.s	cal2hi
	exg	a4,a5
cal2hi:
	move.l	Akodestlen(PC),D7
	moveq	#0,d4
	moveq	#0,d5
	moveq	#0,d6
	subq.l	#1,d7

CalcLo:	move.l	d4,d0
	swap	d0
	move.b	(a0,d0.w),d1
	move.b	1(a0,d0.w),d2
	ext.w	d1
	ext.w	d2
	swap	d0
	lsr.w	#1,d0
	muls	d0,d2
	eor.w	d3,d0	;#$7fff
	muls	d0,d1
	add.l	d1,d2
	move.l	d2,(a2)+

	move.l	d5,d0
	swap	d0
	move.b	(a0,d0.w),d1
	move.b	1(a0,d0.w),d2
	ext.w	d1
	ext.w	d2
	swap	d0
	lsr.w	#1,d0
	muls	d0,d2
	eor.w	d3,d0	;#$7fff
	muls	d0,d1
	add.l	d1,d2
	move.l	d2,(a2)+

	move.l	d6,d0
	swap	d0
	cmp.w	a3,d0
	bcc.s	calc2left	;bge-u
	move.b	(a0,d0.w),d1
	move.b	1(a0,d0.w),d2
	ext.w	d1
	ext.w	d2
	swap	d0
	lsr.w	#1,d0
	muls	d0,d2
	eor.w	d3,d0	;#$7fff
	muls	d0,d1
	add.l	d1,d2

	move.l	-(a2),d1
	move.l	-(a2),d0
	add.l	d0,d0
	add.l	d1,d1
	add.l	d2,d2
	add.l	d0,d1
	add.l	d1,d2
	swap	d2
	ext.l	d2
	divs	#3,d2
	move.b	d2,(a1)+
	add.l	a4,d4
	add.l	a5,d5
	add.l	a6,d6
	dbf	d7,CalcLo
	rts

Calc2left:
	move.l	-(a2),d2
	move.l	-(a2),a2
	bra.s	Calc2lef

Calc2Lo:move.l	d4,d0
	swap	d0
	move.b	(a0,d0.w),d1
	move.b	1(a0,d0.w),d2
	ext.w	d1
	ext.w	d2
	swap	d0
	lsr.w	#1,d0
	muls	d0,d2
	eor.w	d3,d0	;#$7fff
	muls	d0,d1
	add.l	d1,d2
	move.l	d2,a2

	move.l	d5,d0
	swap	d0
	cmp.w	a3,d0
	bcc.s	calc1left	;bge-u

	move.b	(a0,d0.w),d1
	move.b	1(a0,d0.w),d2
	ext.w	d1
	ext.w	d2
	swap	d0
	lsr.w	#1,d0
	muls	d0,d2
	eor.w	d3,d0	;#$7fff
	muls	d0,d1
	add.l	d1,d2
Calc2lef:
	add.l	a2,a2
	add.l	d2,d2
	add.l	a2,d2
	swap	d2
	ext.l	d2
	divs	#3,d2
	move.b	d2,(a1)+
	add.l	a4,d4
	add.l	a5,d5
	dbf	d7,Calc2Lo
	rts

calc1left:
	move.l	a2,d2
	bra.s	calc1lef
Calc1Lo:move.l	d4,d0
	swap	d0
	cmp.w	a3,d0
	bcc.s	calc0left	;bge-u
	move.b	(a0,d0.w),d1
	move.b	1(a0,d0.w),d2
	ext.w	d1
	ext.w	d2
	swap	d0
	lsr.w	#1,d0
	muls	d0,d2
	eor.w	d3,d0	;#$7fff
	muls	d0,d1
	add.l	d1,d2
Calc1lef:
	add.l	d2,d2
	swap	d2
	ext.l	d2
	divs	#3,d2
	move.b	d2,(a1)+
	add.l	a4,d4
	dbf	d7,Calc1Lo
	rts

Calc0left:
	moveq	#0,d0
Calc0:	move.b	d0,(a1)+
	dbf	d7,Calc0
	rts


Copparoxid:
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	COFROM(PC),D1
	MOVE.B	COTO(PC),D2
	MULU	#$1E,D1
	MULU	#$1E,D2
	move.l	Base(pc),a0
	move.l	(a0),a0
	LEA	-$A(A0,D2.W),A2
	LEA	-$A(A0,D1.W),A0

	MOVEQ	#0,D0
	MOVE.W	$16(A2),D0
	ASL.W	#$1,D0
	BEQ.S	COPNULL
	MOVE.L	D0,D7
	bsr	AllocMem
	moveq	#0,d2
	move.b	coto(pc),d2
	asl.w	#$2,d2
	move.l	Base(pc),a4
	move.l	d0,(a4,d2.w)

COPNULL:MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	COFROM(PC),D1
	MOVE.B	COTO(PC),D2
	ASL.W	#2,D1
	ASL.W	#2,D2
	move.l	Base(pc),a0
	MOVE.L	(A0,D1.W),A1
	MOVE.L	(A0,D2.W),A2
	LSR.W	#1,D7
	BRA.S	COPMOVEIT
COLONISTUGA:	MOVE.W	(A1)+,(A2)+
COPMOVEIT:	DBF	D7,COLONISTUGA
	rts


COPPOS:	DC.W	0
COPPOSSES:
	DC.W	$D4,5,$DC,6,$104,11,$10C,12

cofrom:	dc.b	0
coto:	dc.b	0
COPFROM:DC.B	$01
COPTO:	DC.B	$02


CuttaLeft:
	and.l	#$fffe,d1
	move.l	d1,CutLeftOffset
	MOVEQ	#0,D2
	MOVE.B	COTO(PC),D2
	MULU	#$1E,D2
	move.l	Base(pc),a0
	move.l	(a0),a0
	LEA	-$A(A0,D2.W),A2
	MOVEQ	#0,D0
	MOVE.W	$16(A2),D0
	ASL.W	#$1,D0
	MOVE.L	D0,D7
	bsr	AllocMem
	moveq	#0,d2
	move.b	coto(pc),d2
	asl.w	#$2,d2
	move.l	Base(pc),a4
	move.l	d0,(a4,d2.w)
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	COFROM(PC),D1
	MOVE.B	COTO(PC),D2
	ASL.W	#2,D1
	ASL.W	#2,D2
	move.l	Base(pc),a0
	MOVE.L	(A0,D1.W),A1
	MOVE.L	(A0,D2.W),A2
	add.l	CutLeftOffset(pc),a1
	LSR.W	#1,D7
	BRA.S	COPLMOVEIT
COLLONISTUGA:	MOVE.W	(A1)+,(A2)+
COPLMOVEIT:	DBF	D7,COLLONISTUGA
	rts

CutLeftOffset:	dc.l	0


CuttaRight:
	and.l	#$fffe,d1
	move.l	d1,CutLeftOffset
	MOVEQ	#0,D2
	MOVE.B	COTO(PC),D2
	MULU	#$1E,D2
	move.l	Base(pc),a0
	move.l	(a0),a0
	LEA	-$A(A0,D2.W),A2
	MOVEQ	#0,D0
	MOVE.W	$16(A2),D0
	ASL.W	#$1,D0
	MOVE.L	D0,D7
	bsr	AllocMem
	moveq	#0,d2
	move.b	coto(pc),d2
	asl.w	#$2,d2
	move.l	Base(pc),a4
	move.l	d0,(a4,d2.w)
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	COFROM(PC),D1
	MOVE.B	COTO(PC),D2
	ASL.W	#2,D1
	ASL.W	#2,D2
	move.l	Base(pc),a0
	MOVE.L	(A0,D1.W),A1
	MOVE.L	(A0,D2.W),A2
	LSR.W	#1,D7
	BRA.S	COPRMOVEIT
CoOLLONISTUGA:	MOVE.W	(A1)+,(A2)+
COPRMOVEIT:	DBF	D7,CoOLLONISTUGA
	rts



CuttaBoth:
	and.l	#$fffe,d1
	and.l	#$fffe,d2
	move.l	d1,CutLeftOffset
	move.l	d2,CutBrightOffset
	MOVEQ	#0,D2
	MOVE.B	COTO(PC),D2
	MULU	#$1E,D2
	move.l	Base(pc),a0
	move.l	(a0),a0
	LEA	-$A(A0,D2.W),A2
	MOVEQ	#0,D0
	MOVE.W	$16(A2),D0
	ASL.W	#$1,D0
	MOVE.L	D0,D7
	bsr	AllocMem
	moveq	#0,d2
	move.b	coto(pc),d2
	asl.w	#$2,d2
	move.l	Base(pc),a4
	move.l	d0,(a4,d2.w)
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	COFROM(PC),D1
	MOVE.B	COTO(PC),D2
	ASL.W	#2,D1
	ASL.W	#2,D2
	move.l	Base(pc),a0
	MOVE.L	(A0,D1.W),A1
	MOVE.L	(A0,D2.W),A2
	add.l	CutLeftOffset(pc),a1
	LSR.W	#1,D7
	BRA.S	CzPLMOVEIT
CzLLONISTUGA:	MOVE.W	(A1)+,(A2)+
CzPLMOVEIT:	DBF	D7,CzLLONISTUGA
i_rts:	rts
CutBrightOffset:	dc.l	0


INTERPOLCALCULATOR:
	move.l	Base(pc),a0
	move.l	(a0),a0
	lea	$43c(a0),a1
	MOVE.W	L658,D0
	MULU	#$1E,D0
	lea	-10(a0,d0.w),a0
	cmp.l	#'Mupp',(a0)
	bne	i_rts

	moveq	#0,d0
	move.b	4(a0),d0
	mulu	#$400,d0
	lea	(a1,d0.l),a1

	move.l	AllocMemPoi,a2
	add.l	#$1000,AllocMemPoi
	move.w	L658,d0
	asl.w	#2,d0
	move.l	Base(pc),a5
	move.l	a2,(a5,d0.w)

	move.l	a1,a3
	move.l	a2,a4
	moveq	#27,d7

kowalo:	move.l	(a3)+,(a4)+	;kopiera wave
	move.l	(a3)+,(a4)+
	move.l	(a3)+,(a4)+
	move.l	(a3)+,(a4)+
	move.l	(a3)+,(a4)+
	move.l	(a3)+,(a4)+
	move.l	(a3)+,(a4)+
	move.l	(a3)+,(a4)+
	clr.l	(a4)+		;nolla wave
	clr.l	(a4)+
	clr.l	(a4)+
	clr.l	(a4)+
	clr.l	(a4)+
	clr.l	(a4)+
	clr.l	(a4)+
	clr.l	(a4)+

	clr.l	(a4)+		;nolla wave
	clr.l	(a4)+
	clr.l	(a4)+
	clr.l	(a4)+
	clr.l	(a4)+
	clr.l	(a4)+
	clr.l	(a4)+
	clr.l	(a4)+

	clr.l	(a4)+		;nolla wave
	clr.l	(a4)+
	clr.l	(a4)+
	clr.l	(a4)+
	clr.l	(a4)+
	clr.l	(a4)+
	clr.l	(a4)+
	clr.l	(a4)+
	dbf	d7,kowalo

	lea	$380(a1),a3
	lea	$700*2(a2),a4
	moveq	#$3e,d7
inpowano:
	move.b	(a3)+,d0
	add.w	d0,d0
	add.w	d0,d0
	move.b	d0,(a4)+

	move.b	(a3),d1
	add.w	d1,d1
	add.w	d1,d1
	add.w	d0,d1
	add.w	d0,d1
	add.w	d0,d1
	lsr.w	#2,d1
	move.b	d1,(a4)+	;interpullad waveno

	move.b	(a3),d1
	add.w	d1,d1
	add.w	d1,d1
	add.w	d0,d1
	lsr.w	#1,d1
	move.b	d1,(a4)+	;interpullad waveno

	move.b	(a3),d1
	add.w	d1,d1
	add.w	d1,d1
	add.w	d1,d0
	add.w	d1,d0
	add.w	d1,d0
	lsr.w	#2,d0
	move.b	d0,(a4)+	;interpullad waveno

	dbf	d7,inpowano
	move.b	(a3)+,d0
	add.w	d0,d0
	move.b	d0,(a4)+
	move.b	d0,(a4)+	;sista skall ej interpoleras
	move.b	d0,(a4)+	;sista skall ej interpoleras
	move.b	d0,(a4)+	;sista skall ej interpoleras

	lea	$3c0(a1),a3
	lea	$780*2(a2),a4
	moveq	#$3e,d7
inpowono:
	move.b	(a3)+,d0
	move.b	d0,(a4)+
	and.w	#$7f,d0

	move.b	(a3),d1
	and.w	#$7f,d1
	add.w	d0,d1
	add.w	d0,d1
	add.w	d0,d1
	lsr.w	#2,d1
	move.b	d1,(a4)+	;interpullad volume+defwave=off

	move.b	(a3),d1
	and.w	#$7f,d1
	add.w	d0,d1
	lsr.w	#1,d1
	move.b	d1,(a4)+	;interpullad volume+defwave=off

	move.b	(a3),d1
	and.w	#$7f,d1
	add.w	d1,d0
	add.w	d1,d0
	add.w	d1,d0
	lsr.w	#2,d0
	move.b	d0,(a4)+	;interpullad volume+defwave=off
	dbf	d7,inpowono
	move.b	(a3)+,d0
	move.b	d0,(a4)+
	move.b	d0,(a4)+	;sista skall ej interpoleras,off
	move.b	d0,(a4)+	;sista skall ej interpoleras,off
	move.b	d0,(a4)+	;sista skall ej interpoleras,off


	move.l	a2,a1
	lea	$780*2(a1),a5
	lea	[$780+54]*2(a1),a6
interlo:move.l	a5,a4	;a4=inter-from source
	tst.b	(a5)+
intoo:	tst.b	(a5)+
	bpl.s	intoo
	tst.b	-(a5)
	move.l	a5,a3	;a3=inter-to source

	move.l	a3,d0
	sub.l	a4,d0
	move.l	d0,d3	;d3=att divsa med
	subq.l	#1,d0	;d0=antal interpols

	move.l	a4,d1
	sub.l	a1,d1	;d1=startinterpolwave i byte
	sub.l	#$780*2,d1
	move.l	a3,d2
	sub.l	a1,d2	;d2=destint i byte
	sub.l	#$780*2,d2

	mulu	#$20,d1
	mulu	#$20,d2
	lea	(a1,d1.w),a2	;start
	lea	(a1,d2.w),a3	;end

	moveq	#$1f,d7
theloop:move.w	d0,d6

	moveq	#0,d1
	move.b	(a2)+,d1
	ext.w	d1
	ext.l	d1
	move.b	(a3)+,d2
	ext.w	d2
	ext.l	d2
	sub.l	d1,d2
	asl.L	#$6,d2
	divs	d3,d2	;interpols+1
	asl.L	#$8,d2
	ASL.L	#$2,D2
	AND.L	#$FFFF,D1
	swap	d1
	lea	$1f(a2),a4
	bra.s	zelopp
zeloop:	add.l	d2,d1
	swap	d1
	move.b	d1,(a4)
	swap	d1
	lea	$20(a4),a4
zelopp:	dbf	d6,zeloop
	dbf	d7,theloop

	cmp.l	a5,a6
	bgt	interlo
	rts


JetteMixer:
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	MIXFR(PC),D1
	MOVE.B	MIXFR2(PC),D2
	MULU	#$1E,D1
	MULU	#$1E,D2
	move.l	Base(pc),a0
	move.l	(a0),a0
	LEA	-$A(A0,D2.W),A1
	LEA	-$A(A0,D1.W),A0

	MOVEQ	#0,D0
	MOVE.W	$16(A0),D0
	CMP.W	$16(A1),D0
	BGE.S	MIXSE
	MOVE.W	$16(A1),D0
MIXSE:
	ASL.W	#$1,D0
;	BEQ.S	MIXNULL
	MOVE.L	D0,D7
	bsr	AllocMem
	move.l	d0,MIXALLOCP
	move.l	D7,MIXALLOCL

	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	MIXFR(PC),D1
	MOVE.B	MIXFR2(PC),D2
	MOVE.W	D1,D3
	MOVE.W	D2,D4
	ASL.W	#2,D1
	ASL.W	#2,D2
	move.l	Base(pc),a0
	MOVE.L	(A0,D1.W),A1
	MOVE.L	(A0,D2.W),A2

	MULU	#$1E,D3
	MULU	#$1E,D4
	move.l	Base(pc),a0
	move.l	(a0),a0
	MOVE.W	-$A+$16(A0,D3.W),D1
	MOVE.W	-$A+$16(A0,D4.W),D2
	move.b	MixFrom1Vol(pc),d5
	move.b	MixFrom2Vol(pc),d6
	AND.W	#$FF,D5
	AND.W	#$FF,D6

	CMP.W	D1,D2
	BLE.S	MIXNOEX
	EXG	A1,A2
	EXG	D1,D2
	EXG	D5,D6
MIXNOEX:
	ASL.W	#1,D1
	ASL.W	#1,D2
	MOVEM.L	D1/D2/D5/D6/A1/A2,-(A7)
	MOVEQ	#0,D0
	BRA.S	MICLOOP1S
MICLOOP1L:
	MOVE.B	(A1)+,D3
	MOVE.B	(A2)+,D4
	EXT.W	D3
	EXT.W	D4
	MULS	D5,D3
	MULS	D6,D4
	ADD.L	D3,D4
	TST.W	D4
	BPL.S	NIMI
	NOT.W	D4
NIMI:	CMP.W	D4,D0
	BGE.S	NOMI
	MOVE.W	D4,D0
NOMI:	SUBQ.W	#1,D1
MICLOOP1S:DBF	D2,MICLOOP1L
	BRA.S	MICLOOP2S
MICLOOP2L:
	MOVE.B	(A1)+,D3
	EXT.W	D3
	MULS	D5,D3
	TST.W	D3
	BPL.S	NIMI2
	NOT.W	D3
NIMI2:	CMP.W	D3,D0
	BGE.S	MICLOOP2S
	MOVE.W	D3,D0
MICLOOP2S:
	DBF	D1,MICLOOP2L
	MOVEM.L	(A7)+,D1/D2/D5/D6/A1/A2

	ADDQ.W	#1,D0
	ASR.W	#7,D0
	ADDQ.W	#1,D0
	EXT.L	D0

	MOVE.L	D0,-(A7)

	MOVE.L	MIXALLOCP,A0
	BRA.S	MIXLOOP1S
MIXLOOP1L:
	MOVE.B	(A1)+,D3
	MOVE.B	(A2)+,D4
	EXT.W	D3
	EXT.W	D4
	MULS	D5,D3
	MULS	D6,D4
	ADD.L	D3,D4
	DIVS	D0,D4
	MOVE.B	D4,(A0)+
	SUBQ.W	#1,D1
MIXLOOP1S:DBF	D2,MIXLOOP1L
	BRA.S	MIXLOOP2S
MIXLOOP2L:
	MOVE.B	(A1)+,D3
	EXT.W	D3
	MULS	D5,D3
	DIVS	D0,D3
	MOVE.B	D3,(A0)+
MIXLOOP2S:
	DBF	D1,MIXLOOP2L

	MOVEQ	#0,D1
	MOVE.B	MIXToo(PC),D1
	MOVE.W	D1,D2
	MULU	#$1E,D1
	ASL.W	#2,D2
	move.l	Base(pc),a0
	move.l	(a0),a0
	LEA	-$A(A0,D1.W),A0
	move.l	Base(pc),a1
	LEA	(A1,D2.W),A1
	MOVE.L	MIXALLOCP,(A1)
	MOVE.L	MIXALLOCL,D0
	LSR.W	#1,D0
	MOVE.W	D0,$16(A0)

	MOVE.L	(A7)+,D0
	BRA.W	MIXCANCEL
MIXCANCEL:
	rts

MIXFROM:DC.B	$01
MIXFROM2:DC.B	$02
MIXTO:	DC.B	$03
	even
MIXALLOCP:	DC.L	0
MIXALLOCL:	DC.L	0

MixFr:	dc.b	0
MixFr2:	dc.b	0
MixToo:	dc.b	0
MixFrom1Vol:	dc.b	0
MixFrom2Vol:	dc.b	0
		dc.b	0


SZeroNow:
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	COFROM(PC),D1
	MOVE.B	COTO(PC),D2
	MULU	#$1E,D1
	MULU	#$1E,D2
	move.l	Base(pc),a0
	move.l	(a0),a0
	LEA	-$A(A0,D2.W),A2
	LEA	-$A(A0,D1.W),A0

	MOVEQ	#0,D0
	MOVE.W	$16(A2),D0
	ASL.W	#$1,D0
	MOVE.L	D0,D7
	bsr	AllocMem
	moveq	#0,d2
	move.b	coto(pc),d2
	asl.w	#$2,d2
	move.l	Base(pc),a4
	move.l	d0,(a4,d2.w)
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	COFROM(PC),D1
	MOVE.B	COTO(PC),D2
	ASL.W	#2,D1
	ASL.W	#2,D2
	move.l	Base(pc),a0
	MOVE.L	(A0,D1.W),A1
	MOVE.L	(A0,D2.W),A2
	move.w	ZeroLength(pc),d6
	subq.w	#1,d6
ZopMo:	clr.b	(a2)+
	subq.w	#1,d7
	dbf	d6,ZopMo
	bra.s	Zommo
Zotte:	MOVE.b	(A1)+,(A2)+
Zommo:	DBF	D7,Zotte
	rts



SZcopNow:
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	COFROM(PC),D1
	MOVE.B	COTO(PC),D2
	MULU	#$1E,D1
	MULU	#$1E,D2
	move.l	Base(pc),a0
	move.l	(a0),a0
	LEA	-$A(A0,D2.W),A2
	LEA	-$A(A0,D1.W),A0

	MOVEQ	#0,D0
	MOVE.W	$16(A2),D0
	ASL.W	#$1,D0
	MOVE.L	D0,D7
	bsr	AllocMem
	moveq	#0,d2
	move.b	coto(pc),d2
	asl.w	#$2,d2
	move.l	Base(pc),a4
	move.l	d0,(a4,d2.w)
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	COFROM(PC),D1
	MOVE.B	COTO(PC),D2
	ASL.W	#2,D1
	ASL.W	#2,D2
	move.l	Base(pc),a0
	MOVE.L	(A0,D1.W),A1
	MOVE.L	(A0,D2.W),A2
	move.l	a1,a3
	move.w	ZeroLength(pc),d6
	subq.w	#1,d6
ZlopMo:	move.b	(a3)+,(a2)+
	subq.w	#1,d7
	dbf	d6,ZlopMo
	bra.s	Zlommo
Zlotte:	MOVE.b	(A1)+,(A2)+
Zlommo:	DBF	D7,Zlotte
	rts


SampleBuffer:	dc.l	0
SampleBufferLen:dc.l	0


GETMEMORY:
	MOVE.W	L658,D0
	ASL.W	#$2,D0
	move.l	Base(pc),a0
	MOVE.L	(A0,D0.W),D0
	move.l	D0,SampleBuffer
	MOVE.W	L658,D0
	MULU	#$1E,D0
	move.l	Base(pc),a4
	move.l	(a4),a4
	MOVEQ	#0,D1
	MOVE.W	12(A4,D0.W),D1
	ASL.L	#1,D1
	MOVE.L	D1,SAMPLEBUFFERLEN
	MOVEQ	#0,D0
	RTS

*************************************
*************************************

Commandorutin:
	moveq	#1,d0
	mulu	#$1e,d0
	move.l	Base(pc),a0	;mt_data
	move.l	(a0),a0
	lea	-$a(a0,d0.w),a0
	moveq	#1,d7

commandoloop:
	movem.l	d7/a0,-(a7)

	cmp.l	#'Mupp',(a0)
	bne.s	krolla
	movem.l	d0-d7/a0-a6,-(a7)
	move.w	d7,L658
	bsr	interpolcalculator
	movem.l	(a7)+,d0-d7/a0-a6
	bra	nokroom

Krolla:	bsr	KollaEl
nokroom:
	movem.l	(a7)+,d7/a0
	lea	$1e(a0),a0
	addq.w	#1,d7
	cmp.w	#$20,d7
	bne.s	commandoloop
nocommando:
	rts


kollaEl:cmp.w	#'El',(a0)
	bne.s	nocommando
	move.l	a0,a1
	lea	3(a1),a1

comloop2:
	move.b	(a1)+,d0
	beq	nocommando
	move.w	d7,L658

	cmp.b	#'A',d0
	bne.s	noFadeOut
	moveq	#0,d1
	move.b	(a1)+,d1
	asl.w	#8,d1
	or.b	(a1)+,d1
	movem.l	d7/a1,-(a7)	;save ljudno + pos i instr-data
	bsr	LoadFadeOut
	movem.l	(a7)+,d7/a1
	bra.s	comloop2
NoFadeOut:
	cmp.b	#'B',d0
	bne.s	noFadeIn
	moveq	#0,d1
	move.b	(a1)+,d1
	asl.w	#8,d1
	or.b	(a1)+,d1
	movem.l	d7/a1,-(a7)	;save ljudno + pos i instr-data
	bsr	LoadFadeIn
	movem.l	(a7)+,d7/a1
	bra.s	comloop2
NoFadeIn:
	cmp.b	#'C',d0
	bne.s	NoFilte
	movem.l	d7/a1,-(a7)
	bsr	FiltTT
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoFilte:
	cmp.b	#'D',d0
	bne.s	NoReva
	movem.l	d7/a1,-(a7)
	bsr	Reva
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoReva:
	cmp.b	#'E',d0
	bne.s	noChangeVo
	moveq	#0,d5
	move.b	(a1)+,d5
	asl.w	#8,d5
	or.b	(a1)+,d5
	movem.l	d7/a1,-(a7)
	bsr	ChangeVo
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoChangeVo:
	cmp.b	#'F',d0
	bne.s	noOctUp
	moveq	#0,d5
	move.b	(a1)+,octfrom
	move.b	d7,octto
	movem.l	d7/a1,-(a7)
	bsr	Octie
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoOctUp:
	cmp.b	#'G',d0
	bne.s	noOctDown
	moveq	#0,d5
	move.b	(a1)+,octfrom
	move.b	d7,octto
	movem.l	d7/a1,-(a7)
	bsr	Octdie
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoOctDown:
	cmp.b	#'H',d0
	bne.s	noAkoMaker
	moveq	#0,d5
	move.b	(a1)+,d5
	move.w	d5,L658
	move.b	(a1)+,d5
	move.w	d5,AkkoPeriods
	move.b	(a1)+,d5
	move.w	d5,AkkoPeriods+2
	move.b	(a1)+,d5
	move.w	d5,AkkoPeriods+4
	move.b	d7,AkkoDest
	movem.l	d7/a1,-(a7)
	bsr	AkoProdukter
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoAkoMaker:
	cmp.b	#'I',d0
	bne.s	noCoppy
	move.b	(a1)+,cofrom
	move.b	d7,coto
	movem.l	d7/a1,-(a7)
	bsr	CopparOxid
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoCoppy:
	cmp.b	#'J',d0
	bne.s	noCutLeft
	move.b	(a1)+,cofrom
	move.b	d7,coto
	moveq	#0,d1
	move.b	(a1)+,d1
	asl.w	#8,d1
	move.b	(a1)+,d1
	movem.l	d7/a1,-(a7)
	bsr	CuttaLeft
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoCutLeft:
	cmp.b	#'K',d0
	bne.s	noCutRight
	move.b	(a1)+,cofrom
	move.b	d7,coto
	moveq	#0,d1
	move.b	(a1)+,d1
	asl.w	#8,d1
	move.b	(a1)+,d1
	movem.l	d7/a1,-(a7)
	bsr	CuttaRight
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoCutRight:
	cmp.b	#'L',d0
	bne.s	noCutBoth
	move.b	(a1)+,cofrom
	move.b	d7,coto
	moveq	#0,d1
	move.b	(a1)+,d1
	asl.w	#8,d1
	move.b	(a1)+,d1
	moveq	#0,d2
	move.b	(a1)+,d2
	asl.w	#8,d2
	move.b	(a1)+,d2
	movem.l	d7/a1,-(a7)
	bsr	CuttaBoth
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoCutBoth:
	cmp.b	#'M',d0
	bne.s	noMix
	move.b	d7,MixToo
	move.b	(a1)+,MixFr
	move.b	(a1)+,MixFrom1Vol
	move.b	(a1)+,MixFr2
	move.b	(a1)+,MixFrom2Vol
	movem.l	d7/a1,-(a7)
	bsr	JetteMixer
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoMix:	cmp.b	#'N',d0
	bne.s	noTZero
	move.b	d7,CoTo
	move.b	(a1)+,CoFrom
	move.b	(a1)+,ZeroLength
	move.b	(a1)+,ZeroLength+1
	movem.l	d7/a1,-(a7)
	bsr	SZeroNow
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoTZero:
	cmp.b	#'O',d0
	bne.s	noTZcop
	move.b	d7,CoTo
	move.b	(a1)+,CoFrom
	move.b	(a1)+,ZeroLength
	move.b	(a1)+,ZeroLength+1
	movem.l	d7/a1,-(a7)
	bsr	SZcopNow
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoTZcop:
	rts




Svenska:
dc.b 0,"Fixar vi det h|r,",0
dc.b "s{ har vi sommaren r|ddad.",0,0

dc.b 0,"Ju b|ttre en m|nniska |r,",0
dc.b "desto mindre vet hon om det.",0,0

dc.b 0,"Livet |r inte de dagar som g{tt,",0
dc.b "utan de dagar man minns.",0,0

dc.b 0,"Stark |r den",0
dc.b "som kan le {t sin svaghet.",0,0

dc.b 0,"Den som alltid vet b|st",0
dc.b "l|r sig aldrig n{got.",0,0

dc.b 0,"M{nga skulle }ppet visa sin feghet",0
dc.b "om de bara v{gade.",0,0

dc.b 0,"Jag |r inte schizofren,",0
dc.b "men jag har r|tt kul ihop.",0,0

dc.b 0,"Den som skvallrar f}r dig",0
dc.b "skvallrar ocks{ om dig.",0,0

dc.b 0,"L}gnaren beh}ver gott minne",0,0,0

dc.b "Det finns ett mycket litet ord,",0
dc.b "ej ofta anv|nt p{ v{r jord,",0
dc.b "Det lindrar sm|rta, stillar gr{t,",0
dc.b "det lilla ordet |r f}rl{t.",0

dc.b 0,"Lite f}r sent |r ocks{ f}r sent.",0,0,0

dc.b 0,"Ett d}dsfall |r en tragedi,",0
dc.b "en miljon d}dsfall |r statistik.",0,0

dc.b 0,"En v|n |r en som vet allt om dig",0
dc.b "och |nd{ tycker om dig.",0,0

dc.b 0,"En g{ng trodde jag att jag hade fel,",0
dc.b "men det var ett misstag.",0,0

dc.b 0,"Helvetet: att vara ensam.",0
dc.b "Himmelriket: att kunna vara det.",0,0

dc.b "Tiderna f}r|ndras:",0
dc.b "Jesus bar sitt tunga och tarvliga kors p{ ryggen.",0
dc.b "Hans l|rjungar b|r sitt l|tta och eleganta",0
dc.b "guldkors p{ magen.",0

dc.b 0,"- Vilket underbart m{nsken, Herbert!",0
dc.b "- Jag vet. Jag skall bara r}ka f|rdigt f}rst.",0,0

dc.b "Nej, jag ska inte, ska inte svara i telefon.",0
dc.b "Jag vet att det inte |r du.",0
dc.b "N|r jag |nd{ svarar,",0
dc.b "|r det lik f}rbannat inte du.",0

dc.b 0,"All makt {t skogen!",0,0,0

dc.b 0,"Jag vill leva.",0
dc.b "- inte }verleva.",0,0

dc.b 0,19," K|rleken krossas av smulor i s|ngen. ",19,0,0,0

dc.b 0,"Smulor krossas av k|rlek i s|ngen.",0,0
dc.b 15," Lycka till Peter & Paula i ert smulkrossande ",15,0

dc.b 0,"Mahoney & Kaktus: - Oljud med stil.",0,0,19,0

dc.b 0,"Jag visste inte vad lycka var f}rr|n jag gift mig,",0
dc.b "och d{ var det redan f}rsent.",0,0

dc.b 0,"Om jag vore miljon|r, s{ bodde jag inte h|r.",0,0,0

dc.b 0,"- Blir du aldrig tr}tt p{ att inte g}ra n{gonting?",0
dc.b "- Jo, men d{ vilar jag mej.",0,0

dc.b 0,20,21,"   G}r aldrig ingenting.   ",20,21,0,0,0

dc.b 0,"Dagens visdomsord fr{n Gluemaster:",0
dc.b "Det h|nder ingenting om man inte g}r n{gonting.",0,0

dc.b 0,"Det enda vettiga Kaktus hade att komma med:",0
dc.b 13,"   Den e' bl{{{h!   ",13,0,0

dc.b 0,"Alla m|nniskor |r ensamma,",0
dc.b "men en del har s{ mycket folk omkring sig,",0
dc.b "att de aldrig hinner m|rka det.",0

dc.b 0,"De hade bara en sak gemensamt.",0
dc.b "De hatade varandra.",0,0

dc.b 0,"Kommentar av Ron/SOS:",0
dc.b "God jul och goda negerbullar.",0,0

dc.b 0,"Om du vill ha en ankdamm p{ bilden,",0
dc.b "f{r du spr|nga dit den sj|lv.",0,0

dc.b 0,"Kaktus med en finurlig min:",0,"Kasta en vattenkran till |lgarna,",0
dc.b "och inse att glass i hissen inte |r s{ dumt |nd{.",0

dc.b 0,"Neumans standard:",0
dc.b "Smaga Diskomusig, dookted!",0,0

dc.b 0,"Sandl{dan rules:",0
dc.b "Sk}ldpaddan kommer med vete i gryningen.",0,0

dc.b 0,14," Tysk br}llopsnatt: ",14,0
dc.b "an, auf, hinter, in, neben, ueber, unter, vor, zwischen",0,0

dc.b "Klistra endast }verdelen",0
dc.b "av denna etikett p{ f}rs|ndelsen",0
dc.b "och fyll i bl 2013.05,",0
dc.b "tulldeklaration som bifogas f}rs|ndelsen.",0

dc.b "Jag banka en arab i dag,",0
dc.b "araben b}rja bl}da.",0
dc.b "Fast lika glad f}r det |r jag,",0
dc.b "f}r araber skall man d}da",0

dc.b 0,"R}r inte blodstopparen i on}dan!",0
dc.b "Avsedd f}r allvarliga skador.",0,0

dc.b "Den h|r patiensen l|r ha uppfunnits",0
dc.b "av n{gon student i gamla Heidelberg.",0
dc.b "Man f}rst{r att den kunde vara en",0
dc.b "angen|m avkoppling mellan studierna.",0

dc.b 0,"B}rja dagen med en n|ringsm|ssigt riktig frukost.",0
dc.b "Kalcium, Fosfor och D-vitamin f}r benstomme och t|nder.",0,0

dc.b 0,"Det |r ditt intresse och din goda vilja",0
dc.b "som tillsammans med r|tt studieteknik",0
dc.b "ger dig b|ttre studieresultat.",0

dc.b 0,"G{ ej in i tv|ttrum och simhall med ytterskor.",0,0,0

dc.b 0,"Varf}r g}ra det idag, n|r man",0
dc.b "kan skjuta upp det till imorgon?",0,0

dc.b 0,"En bra melodi t{l vilken behandling som helst.",0,0,0

dc.b 0,"F}dd fri, skattad till d}ds.",0,0,0

dc.b 0,"- Ska du ut och t|lta?",0
dc.b "- Nej, det |r min tr}ja.",0,0

dc.b 0,"- Har du startat en skrotfirma?",0
dc.b "- Nej, det |r min tandst|llning.",0,0

dc.b 0,"En kl|mmig tub.",0,0,0

dc.b 0,"Huka er grabbar,",0
dc.b "skymningen faller!",0,0

dc.b 0,"Man m{ste ha olika {sikter f}r att komma }verens.",0,0,0

dc.b 0,"Svartsjuka |r det roliga man tror de har haft.",0,0,0

dc.b 0,"Sanningen |r den b|sta l}gnen, ingen tror p{ den.",0,0,0

dc.b 0,"Stora |lgar flyger |nnu h}gre.",0,0,0

dc.b 0,"Muta din parkeringsvakt:",0
dc.b "- Lappleasing!",0,0

dc.b 0,"Klockringningen utgick p{ {rets No-bellfest.",0,0,0

dc.b 0,"St}d Sverige,",0
dc.b "bojkotta u-hj|lpen.",0,0

dc.b 0,"Sl|ng kameran i v|ggen.",0,0,0

dc.b 0,"G{ och bada.",0,0,0

dc.b 0,"En teknist varar l|ngre.",0,0,0

dc.b 0,"Th{str}m sucks.",0,0,0

dc.b 0,"Vi f}ljer inte str}mmen, vi leder den.",0,0,0

dc.b 0,"Inifr{n fabriken h}rs gnissel och skrammel,",0
dc.b "lille Nisse har fastnat och kl|ms i en mangel.",0,0

dc.b 0,"Johan gillade inte Olles dikt,",0
dc.b "Olle blev hackad i femton skikt.",0,0

dc.b 0,"Sm{ golfklubbor f}r lilleputtar.",0,0,0

dc.b 0,"Visst |r det dyrt att leva,",0
dc.b "men begravningar |r inte s{ billiga dom heller.",0,0

dc.b $ff



Engelska:
dc.b 0,"If you miss your cat,",0
dc.b "look under my tires.",0,0

dc.b 0,"A good cat,",0
dc.b "is a dead cat.",0,0

dc.b 0,"Do whatever you like,",0
dc.b "but not here.",0,0

dc.b 0,"We're not dead,",0
dc.b "we're just ignoring you.",0,0

dc.b 0,"If you like this demo, tell your friends.",0
dc.b "If you don't like your friends, tell us.",0,0

dc.b 0,"Everything is under control,",0
dc.b "but what is that good for?",0,0

dc.b 0,"If all children had obeyed their parents,",0
dc.b "we would still live in the stoneage.",0,0

dc.b 0,"If you're not a part of the solution,",0
dc.b "you're a part of the problem.",0,0

dc.b 0,"The best part of life isn't electric.",0,0,0

dc.b 0,"Carry on gnoming.",0,0,0

dc.b 0,"These stickers are detachable.",0
dc.b "See reverse side for instructions.",0,0

dc.b 0,"Replace cup after use.",0,0,0

dc.b "Recommended for daily use for",0
dc.b "Singers, Speakers, Teachers,",0
dc.b "Clergymen etc. for clearing dry,",0
dc.b "parched or tickling throats.",0

dc.b 0,"Programmers do it in $Hex.",0,0,0

dc.b 0,"The Optimist believes we live",0
dc.b "in the best of all possible worlds.",0
dc.b "The Pessimist fears this is true.",0

dc.b 0,"After things have gone from bad to worse,",0
dc.b "the cycle will repeat itself.",0,0

dc.b "Practical rule:",0
dc.b "Measure with a micrometer.",0
dc.b "Mark with a chalk.",0
dc.b "Cut with an axe.",0

dc.b 0,"You can't fix it if it ain't broke.",0,0,0

dc.b 0,"If you hit two keys on the typewriter,",0
dc.b "the one you don't want hits the paper.",0,0

dc.b "The one time in the day",0
dc.b "that you lean back and relax,",0
dc.b "is the one time the Boss",0
dc.b "walks through the office.",0

dc.b "School rules:",0
dc.b "1. If it's green or it wriggles, it's biology.",0
dc.b "2. If it stinks, it's chemistry.",0
dc.b "3. If it doesn't work, it's physics.",0

dc.b 0,"A computer program does what you tell it to do,",0
dc.b "not what you want it to do.",0,0

dc.b 0,"Everybody lies;",0
dc.b "but it doesn't manner,",0
dc.b "since nobody listens.",0

dc.b 0,"Government corruption is always",0
dc.b "reported in the past tense.",0,0

dc.b "An expert is one who knows",0
dc.b "more and more about less and less",0
dc.b "until he knows absolutely",0
dc.b "everything about nothing.",0

dc.b 0,"Anything is possible,",0
dc.b "if you don't know what you're talking about.",0,0

dc.b 0,"80% of the final exam will be",0
dc.b "based on the one lecture you missed",0
dc.b "about the one book you didn't read.",0

dc.b "1. The more general the title of a course,",0
dc.b "the less you'll learn from it.",0
dc.b "2. The more specific a title is,",0
dc.b "the less you will be able to apply it later.",0

dc.b "School knowledge #2:",0
dc.b "A drug is that substance which,",0
dc.b "when injected into a rat,",0
dc.b "will produce a scientific report.",0

dc.b 0,"Fools rush in - and get the best seats.",0,0,0

dc.b 0,"Nothing is ever so bad it can't get worse.",0,0,0

dc.b 0,"When the need arises,",0
dc.b "any tool or object closest to you becomes a hammer.",0,0

dc.b 0,"If you lived here, you'd be home by now.",0,0,0

dc.b 0,"Type 'love' on the keyboard to read a lovepoem!",0,0,0

dc.b 0,"If the shoe fits, it's ugly.",0,0,0

dc.b 0,'If an item is advertised as "under $50"',0
dc.b "you can bet it's not $19.95.",0,0

dc.b 0,"Washing machines only break down during the wash cycle.",0,0,0

dc.b 0,"If it's clean, it isn't laundry.",0,0,0

dc.b 0,"An unbreakable toy is useful for breaking other toys.",0,0,0

dc.b "Carpe Diem:",0
dc.b "How long a minute is",0
dc.b "depends on which side",0
dc.b "of the bathroom door you're on.",0

dc.b 0,"The probability of meeting someone you know",0
dc.b "increases when you are with someone you",0
dc.b "don't want to be seen with.",0

dc.b 0,"If you help a friend in need,",0
dc.b "he is sure to remember you",0
dc.b "- the next time he's in need.",0

dc.b "Anything good in life is either",0
dc.b "illegal,",0
dc.b "immoral",0
dc.b "or fattening.",0

dc.b 0,"To err is human,",0
dc.b "to blame it on someone else is even more human.",0,0

dc.b "Don't worry about what other",0
dc.b "people are thinking about you.",0
dc.b "They're too busy worrying over",0
dc.b "what you are thinking about them.",0

dc.b "If several things that could",0
dc.b "have gone wrong have not gone wrong,",0
dc.b "it would have been ultimately beneficial",0
dc.b "for them to have gone wrong.",0

dc.b 0,"The rules of the game have changed:",0
dc.b "- Go big or go home -",0,0



dc.b 0,"Dieser Aufkleber kann ersetzt werden.",0
dc.b "Gebrauchsanleitung siehe Rueckseite.",0,0

dc.b 0,"Toiletten im uebergang, Parkhaus 1, 3. Etage.",0,0,0



dc.b 0,"Les etiquettes auto-collantes sont detachables.",0
dc.b "Voir au dos le mode d'emploi.",0,0
;Les étiquettes auto-collantes sont détachables. Voir au dos le mode d'emploi.

dc.b 0,"Ne touchez jamais la bande magnetique avec les doigts.",0,0,0
;Ne touchez jamais la bande magnétique avec les doigts.

dc.b 0,"OMNIA VINCIT AMOR.",0,0,0

dc.b $ff




InstrText:
dc.b " ",-1
dc.b "Instructions:",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "This is a musicdisk. If you got that,",-1
dc.b "then there isn't much more to explain.",-1
dc.b " ",-1
dc.b "Ok, seriously: Anything worth klicking",-1
dc.b "is there to be examined. If you don't",-1
dc.b "dare to try things out yourself, you're",-1
dc.b "a coward! But I take no responsability",-1
dc.b "of whatever damages this musicdisk might",-1
dc.b "do to your computer or yourself.",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Simple instructions:",-1
dc.b " ",-1
dc.b "Press a tune, and listen to it.",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Complex instructions:",-1
dc.b " ",-1
dc.b "0001011011011. Got it?",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Fastmem and extra drives:",-1
dc.b " (1mb chipmem too!)",-1
dc.b " ",-1
dc.b "This musicdisk can be run on an Amiga",-1
dc.b "without any kind of extra devices, but",-1
dc.b "having an extra drive or some extra",-1
dc.b "fastmem is not bad at all.",-1
dc.b " ",-1
dc.b "In the preferences menu, you can",-1
dc.b "choose between a couple of different",-1
dc.b "modes of using your memory.",-1
dc.b "If you haven't got any memory at",-1
dc.b "$c00000, nor at $80000, skip this",-1
dc.b "chapter.",-1
dc.b " ",-1
dc.b "When you boot up, there will be",-1
dc.b "a sign marking that you have",-1
dc.b "'three tunes in memory', which",-1
dc.b "means you can load tunes into",-1
dc.b "fastmem while still listening",-1
dc.b "to the one left in chipmem.",-1
dc.b " ",-1
dc.b "This is really wonderful while",-1
dc.b "using the LongPlay-mode, because",-1
dc.b "there will be just a pause of some",-1
dc.b "five seconds while changing tune.",-1
dc.b " ",-1
dc.b "If you use normal play-mode, and",-1
dc.b "want to load a tune into fastmem",-1
dc.b "without playing it directly, load",-1
dc.b "it with the right mousebutton, and",-1
dc.b "you can switch to it later with the",-1
dc.b "left mousebutton.",-1
dc.b " ",-1
dc.b "Tunes currently in memory will be",-1
dc.b "marked in white colour, the one",-1
dc.b "in chipmem will flash.",-1
dc.b " ",-1
dc.b "To swap between already loaded",-1
dc.b "tunes, press keys 1, 2 and 3,",-1
dc.b "this only in '3-tune-mode'.",-1
dc.b " ",-1
dc.b " ",-1
dc.b "The second option in the prefs-",-1
dc.b "menu is the 'load whole disk 1'.",-1
dc.b "If you only have one drive, you",-1
dc.b "will very soon go crazy changing",-1
dc.b "disks all the time.",-1
dc.b " ",-1
dc.b "By choosing this option, you",-1
dc.b "will be asked to insert disk one",-1
dc.b "into your drive, after loading",-1
dc.b "you won't have to use that disk",-1
dc.b "anymore.",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "The menubuttons:",-1
dc.b " ",-1
dc.b "Look at the menu beside.",-1
dc.b "Is there really a reason of explaining",-1
dc.b "them?",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "The Keyboard:",-1
dc.b " ",-1
dc.b "esc=tunes menu, here you choose tunes.",-1
dc.b "f1=these instructions.",-1
dc.b "f2=greetings to absolutely everything!",-1
dc.b "f3=addresses to all musicians.",-1
dc.b "f4=preferences.",-1
dc.b "f5=what about that future of ours?",-1
dc.b " ",-1
dc.b "1, 2, and 3 = swap between already",-1
dc.b "    loaded tunes. (Extra mem req.)",-1
dc.b " ",-1
dc.b " ",-1
dc.b "With space you toggle play/pause, just",-1
dc.b "as pressing the ",4,"button, and with",-1
dc.b "the tab-key you toggle play/long-play.",-1
dc.b " ",-1
dc.b " ",-1
dc.b "The mousepointer can be moved with the",-1
dc.b "keyboard using one of the 'alt'-keys",-1
dc.b "and a suitable cursorkey.",-1
dc.b "Instead of pressing left button, try",-1
dc.b "pressing alt+the left amiga-key.",-1
dc.b "To press right button with the keys,",-1
dc.b "press any alt-key+right amiga key.",-1
dc.b " ",-1
dc.b " ",-1
dc.b "The tunelist, and all other lists too,",-1
dc.b "can be moved with cursor up/down alone,",-1
dc.b "and also by pressing the ",9,10,11,12," buttons.",-1
dc.b " ",-1
dc.b "To jump one pattern forward/backward,",-1
dc.b "press shift+cursor right/left, or",-1
dc.b "press the ",5,6," and the ",2,3," buttons.",-1
dc.b "To load the next/last tune, press",-1
dc.b "ctrl+cursor right/left,",-1
dc.b "or press ",1," and ",7,".",-1
dc.b " ",-1
dc.b " ",-1
dc.b "Anytime: Press help-key to get help!",-1
dc.b " ",-1
dc.b " ",-1
dc.b "Then, at last, you have got all the",-1
dc.b "keycodes hidden... some lovely day",-1
dc.b "you will find another one!!!",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Credits:                          ",19,-1
dc.b "Gnu-facts by Acro/Rebels.",-1
dc.b "Bug-testing by Panda in Paradise.",-1
dc.b "Scrolls by a bunch of my friends.",-1
dc.b "Digitizing by Monopoly in Paradise.",-1
dc.b "Great fun with parties in Lomma.",-1
dc.b "Loadingpicture by Uno/Scoopex.",-1
dc.b "Lemming ripped by Ziphoid & Twins.",-1
dc.b "Music by: Duke Ellington, Guts, Maggot,",-1
dc.b "  Candyman, H.I.V., Monopoly, Nizze,",-1
dc.b "  Ziphoid, Flex, Donald, Watchman, Tsaca,",-1
dc.b "  Yogi, Zeb, Mantronix, Neuman, Karsten",-1
dc.b "  Obarski, Xerxes, Gluemaster, Panda",-1
dc.b "  and Mahoney.",-1
dc.b "Reset-part-music by Gluemaster.",-1
dc.b "All other coding by Mahoney & Kaktus.",-1
dc.b "Lovepicture held by Petra Bergquist.",-1
dc.b "Great love by Helene.",-1
dc.b "Alla-barn stories by everybody, most",-1
dc.b "  of them was made on a bus-trip to",-1
dc.b "  Austria (going Skiing!).",-1
dc.b "Worrying by Foetus.",-1
dc.b "No thanks to modemtraders screaming",-1
dc.b "  at me to get this from me first,",-1
dc.b "  to get upload-credits.",-1
dc.b "Life given to me from my parents.",-1
dc.b "Assembler by Promax. (I love it!)",-1
dc.b "Great support by all members in",-1
dc.b "  Paradise (Defcon one and Defiers!).",-1
dc.b "Instruments sampled by Mahoney, Glue-",-1
dc.b "  master, Uncle Tom, Ziphoid, Chris",-1
dc.b "  Korte, Romeo Knight, No limits and",-1
dc.b "  Maniacs of Noise.",-1
dc.b "Warm valley sampled by Mahoney.",-1
dc.b "Ideas by Mahoney & Kaktus.",-1
dc.b "Disk support by Ziphoid. (Thanks for the",-1
dc.b "  50 maxell-disks you gave me ...)",-1
dc.b "TuneCruncher by Mahoney.",-1
dc.b "Great friendship and support by Anders,",-1
dc.b "  Guts, Pjeter, Stellan, Ulrika,",-1
dc.b "  Angela, Jenny, Robert, Fyhn, Heidie,",-1
dc.b "  Helene, Josefin, Dea, Mia G., Sofie,",-1
dc.b "  Per, Anna-Carin, Lena, Flex, Jimmy,",-1
dc.b "  Patrik Schwetlowskilaininen (haha!),",-1
dc.b "  Ziphoid, Maria, Susanne, Elin, Polhems",-1
dc.b "  Getar, Xerxes, Cato, Linda, Paula,",-1
dc.b "  Jenny, Ann, Lotta, Jonas and",-1
dc.b "  all the rest of my wonderful friends ..",-1
dc.b "Software used:",-1
dc.b "  AsmOne v1.01 by Promax (Love it!),",-1
dc.b "  DeluxePaint 3 (Hate it!),",-1
dc.b "  HMN-NoiseTracker (Love it!),",-1
dc.b "  Disk-salv (Hate it!),",-1
dc.b "  IffMaster by Arcane (Love it!),",-1
dc.b "  Hallonboot, digiview, lemmings,",-1
dc.b "  Monkey Islands (yeah!), turbo-",-1
dc.b "  backup, MasterSeka and MacWrite 2.",-1
dc.b "Spreading by you.",-1
dc.b "Great fun at the ECES.",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b 0



GreetsText:
dc.b " ",-1
dc.b "Greetingsarna till His Masters Noise.",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Computerfreaks:",-1
dc.b " ",-1
dc.b "Alastor: still dustman, great?",-1
dc.b "Acro: the master of the gnus!",-1
dc.b "Artbeat: I'll call you some day,",-1
dc.b "    maybe we can do something",-1
dc.b "    together!",-1
dc.b "Atom: go USA or go home!",-1
dc.b "Awcy: sure looking good, go for it!",-1
dc.b "Azatoth: wonderful demos you've",-1
dc.b "    made, something more than",-1
dc.b '    "Yeah! I made a vectorcube!"',-1
dc.b "Azlon: jag har inga p{sar under",-1
dc.b "    }gonen, jag har Ica-kassar!",-1
dc.b "Bacchus: strula runt som en get.",-1
dc.b "Big A: det gamla betygssystemet |r",-1
dc.b "    avskaffat!",-1
dc.b "Big Mac: burger get & Mcg}k",-1
dc.b "Bl{ toppluva: getar mer |n det smakar!",-1
dc.b "Boerni: life never stops, does it?",-1
dc.b "Boubi: Polhems Getar flyger h}gre!",-1
dc.b "Bug: rufen Sie bitte anticimex an!",-1
dc.b "Candyman: utom Peter som |r tv{ meter!",-1
dc.b "Celebrandbil: heard you spoke with my",-1
dc.b "    brother, digging Lunds University.",-1
dc.b "Chris Korte: army's over now, get alive!",-1
dc.b "Chrysanthemum: MeGAklOpPinG forever?",-1
dc.b "Coq Rogue: go for Nyk}ping.",-1
dc.b "Crab: solemn souls lost in a desert?",-1
dc.b "Dagger: eeeh?",-1
dc.b "Danko: sure nice works you've made,",-1
dc.b "    the good old 64 isn't dead yet!",-1
dc.b "Dragon: grr! who's afraid of the dragon?",-1
dc.b "Exolon: nice work with Startrekker,",-1
dc.b "    but is it worth it? check out my",-1
dc.b "    'smaksak'-tracker with some four",-1
dc.b "    extra calculated voices, beat that!",-1
dc.b "Fangoria: the scaring magazine, uuuh!",-1
dc.b "Firefox: where's the fire, totally gone?",-1
dc.b "Flex: ...som blev }verk}rd av en BMX!!!",-1
dc.b "Foetus: hello daddy!",-1
dc.b "Friday: totally muted situation.",-1
dc.b "The Germ: little nasty fella.",-1
dc.b "Gluemaster: fuck PC, go life!",-1
dc.b "Godbrain: not much sense here.",-1
dc.b "Gommolassmot v3.0: eh? that's me!",-1
dc.b "Grums: what happened with our buttons?",-1
dc.b "Gr|vskopa: not bad at all, 2000 points!",-1
dc.b "Gully: I LOVE long letters!",-1
dc.b "Guts: getarna g}kar i hallonskogen.",-1
dc.b "Heffakloppen: fucking negerbullar.",-1
dc.b "Iceman: cool as hell.",-1
dc.b "Injun: long ago, in another dimention.",-1
dc.b "Ironlord: I want that tune!",-1
dc.b "Jazze: BPM, my bottom!",-1
dc.b "Jesper Kyd: lovely day, dig this...",-1
dc.b "Jonny: send me MORE, handsome!",-1
dc.b "Kaktus: why France when there is",-1
dc.b "    Eskilstuna???",-1
dc.b "Larsson: you ought to be a salesman!",-1
dc.b "Maggot: Polhems Getar grisar vidare!",-1
dc.b "Mantronix: more than lovely!",-1
dc.b "Martin Pedersen: just mentioned.",-1
dc.b "Mega: eeeeh, killen flippar!",-1
dc.b "Mikael Balle: drawelliwellwell.",-1
dc.b "Mike: out of memory, dear fella.",-1
dc.b "Monopoly: friday nights are yours!",-1
dc.b "Moppe: you and Spike, strange relations!",-1
dc.b "Mr. Mac: Tore |r pervers",-1
dc.b "Mr. Perfect: Danish dynamite!",-1
dc.b "Myggtasken: Hall{ja, jae Myggtasken!",-1
dc.b "Neuman: Polhemskolan rules the world!",-1
dc.b "Niall Mc Gowan: Rainbowfully yours!",-1
dc.b "Nizze: piano as a pet? why not?",-1
dc.b "Oberheim: it's real cult!",-1
dc.b "Odie: some day, another year!",-1
dc.b "Omega: Bart Simpson. Wierd!",-1
dc.b "Panda: gulleplutt!",-1
dc.b "Panther: hej i Lappland!",-1
dc.b "Parrot: hi Clark Kent!",-1
dc.b "Pecc: Pascal stinks!",-1
dc.b "Photon: how's life in the deep, deep,",-1
dc.b "    forest?",-1
dc.b "Piq: far away in time...",-1
dc.b "Poseidon: we build a world of music!",-1
dc.b "Prodigy: I escaped V|rnhemsskolan, phew!!",-1
dc.b "Raistlin: show me France some day!",-1
dc.b "RedHead: $$$ makes the world go around.",-1
dc.b "Rick: come on and play some volleyball",-1
dc.b "    with us, it's really great!",-1
dc.b "Ron: Kriiistianstad!! (l|ses med",-1
dc.b "    smaaul|nsk dialekt!)",-1
dc.b "Sal: same message as above!",-1
dc.b "Shogun: triangular music, wonderful!",-1
dc.b "Sil: How's life in Norrland?",-1
dc.b "Sine: coding is a hobby, not a life!",-1
dc.b "Sir Gawain: Hyltebruk rulez...",-1
dc.b "Slimer: German showtime!",-1
dc.b "Spexhane: keep cool, Polhem shines!",-1
dc.b "Spike: va faen h|nde me Bandits l{tar?",-1
dc.b "Sputnik: who are you? Don't remember???",-1
dc.b "Teeme: great grafix from the land of",-1
dc.b "    the thousand seas.",-1
dc.b "Torben Larsen: shoot'em-down!",-1
dc.b "The Unicorn: it's finally ready!",-1
dc.b "Tip: life is playing in V|xj}!",-1
dc.b "Ucka: thanx for Ahlgrens bilar!",-1
dc.b "Uno: thanks for the picture,",-1
dc.b "    I really love it, what about",-1
dc.b "    the dancing flower???",-1
dc.b "Virre: Eskilstuna concert-hall would",-1
dc.b "    be a great place to have a disco in!",-1
dc.b "Watchman: you've got it now, pal!",-1
dc.b "Wiz: Polhemskolan rules!",-1
dc.b "Xerxes: Polhems Getar har roligare!",-1
dc.b "Yabba: that hp-calculator belongs",-1
dc.b "    to the trashcan! Nice with your",-1
dc.b "    real-time calculated vectors",-1
dc.b "    on the good old 64! In 3 frames!",-1
dc.b "Yogi: Polhemskolan rules!",-1
dc.b "Ziphoid: I promised you the longest",-1
dc.b "    greeting, and here it is:",-1
dc.b "    Have a great night, and give",-1
dc.b "    Maria a big wet kiss from me,",-1
dc.b "    but do not forget to protect",-1
dc.b "    yourself, use a haklapp!!!!!",-1
dc.b "Zizyphus: H|lsingborgningar p{ dej!",-1
dc.b "Zymox: ... last but not least!",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Computergroups:",-1
dc.b " ",-1
dc.b "Ackerlight software, Agile, AlphaFlight,",-1
dc.b "Altair,",-1
dc.b "Barricade software,",-1
dc.b "Celtic, Clones, Complex, CCS,",-1
dc.b "Defcon One, Defiers, Dexion,",-1
dc.b "Fairlight, Fist!,",-1
dc.b "Horizon,",-1
dc.b "Kefrens,",-1
dc.b "Level one & the dream team, The Link,",-1
dc.b "The Lost Boys (ST),",-1
dc.b "Maffia, MeGAkLoPParNa, Megalamers,",-1
dc.b "Metallians, Mute 101,",-1
dc.b "NorthStar,",-1
dc.b "Paradise,",-1
dc.b "Paradox,",-1
dc.b "Phenomena,",-1
dc.b "Rawhead, Razor 1911, Rebels,",-1
dc.b "Red Sector Inc.,",-1
dc.b "Sandl{dan, Spr|ngd Anka,",-1
dc.b "Silents, Software of Sweden, Sphinx,",-1
dc.b "Swampions, Sync (ST),",-1
dc.b "Tommyknockers, Triad,",-1
dc.b "Voice, Vortex 42 and",-1
dc.b "Xakk.",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Great friends & foes:",-1
dc.b " ",-1
dc.b "Anna Bengtsson:",-1
dc.b "  what happened to that red hair you",-1
dc.b "  promised me last postcard?",-1
dc.b "Anders Berkeman:",-1
dc.b "  my life is here! see you this summer!",-1
dc.b "Anders Fyhn:",-1
dc.b "  summerhacking smells good!",-1
dc.b "Anders Hoh:",-1
dc.b "  Angela is candy, you know that!",-1
dc.b "Anders Lundahl:",-1
dc.b "  I owe you 300 skr, remember?",-1
dc.b "Anders Nilsson-Stig:",-1
dc.b "  thank you for moral support...",-1
dc.b "Andrea Holmgren:",-1
dc.b "  hi sweetheart!",-1
dc.b "Angela Andersson:",-1
dc.b "  Anders is candy, eat him!",-1
dc.b "Annika Johansson:",-1
dc.b "  no, I don't have to mention you!",-1
dc.b "Annika Sanden:",-1
dc.b "  greet JC from me, when you can!",-1
dc.b "  (He isn't born yet! it's true!)",-1
dc.b "Cina S}rell:",-1
dc.b "  I missed your birthday, sob sob!",-1
dc.b "Cribban Dan{s:",-1
dc.b "  addicted to swimming?",-1
dc.b "Ebbe:",-1
dc.b "  the poor old dentist, summerpal?",-1
dc.b "Elin Stoltz:",-1
dc.b "  st{ p{ dej, annars g}r n{gon annan det",-1
dc.b "Erik Persson:",-1
dc.b "  congratulations, an iq over 160",-1
dc.b "  is nothing to play around with!",-1
dc.b "Fredrik Hansson:",-1
dc.b "  see you some day this summer!",-1
dc.b "Fredrik Tufvesson:",-1
dc.b "  dear ol' brother o mine, how do you",-1
dc.b "  survive me?",-1
dc.b "Hans Ekdahl:",-1
dc.b "  I can jump higher than you, my hands",-1
dc.b "  above the net will stop you!",-1
dc.b "Heidie Larsson:",-1
dc.b "  han |r inte din bror!",-1
dc.b "Helene Everlund:",-1
dc.b "  you are my future!",-1
dc.b "H{kan Hansson:",-1
dc.b "  hi hoe, continue!",-1
dc.b "Jenny Andersson:",-1
dc.b "  am I wierd? I hope not!",-1
dc.b "Jenny Arnesson:",-1
dc.b "  parents are there to help you, or?",-1
dc.b "Jenny Sandberg:",-1
dc.b "  how's it going with your krasse?",-1
dc.b "Jenny Sv|rd:",-1
dc.b "  next Thursday we'll make those",-1
dc.b "  photographs, I love it!",-1
dc.b "Jeppe Johansson:",-1
dc.b "  the studio here in Staffanstorp",-1
dc.b "  all looks good. wonderful seeing",-1
dc.b "  something like that here, good luck",-1
dc.b "  this summer with 'Mortal Memories!'",-1
dc.b "Jessi Larsson:",-1
dc.b "  I wanna meet you when you get home!",-1
dc.b "  life in California don't last forever!",-1
dc.b "Jime Johansson:",-1
dc.b "  hi classmate!",-1
dc.b "Jimmy Larsson:",-1
dc.b "  l{ng som en f}ljetong",-1
dc.b "Joakim Falck:",-1
dc.b "  so, you plan to digitize some",-1
dc.b "  old automobiles, call me and you'll",-1
dc.b "  get some ancient music to it!",-1
dc.b "Johan Kettisen:",-1
dc.b "  thanx for my Amiga!",-1
dc.b "John Carehag:",-1
dc.b "  greet Maria from me!",-1
dc.b "Jonas Eklund:",-1
dc.b "  We sure had some great fun when",-1
dc.b "  school went out at 'Chrougen'!",-1
dc.b "Josefin Mandorsson:",-1
dc.b "  I've been thinking about you!",-1
dc.b "Karin Berkeman:",-1
dc.b "  sekreteraren i aktiespararnas",-1
dc.b "  ungdomsf}renings lokalavdelning",-1
dc.b "  i Helsingborg, hmmmm?",-1
dc.b "Lars Tufvesson:",-1
dc.b "  2nd brother of mine!",-1
dc.b "Lena Claesson:",-1
dc.b "  see you at school, lovely!",-1
dc.b "  play the piano for me some day!",-1
dc.b "Lena Svensson:",-1
dc.b "  come and play some volleyball",-1
dc.b "  again, Mattias was there last week,",-1
dc.b "  bring Tomas too, he'll enjoy it!",-1
dc.b "Maria M.: Hi there, John is not",-1
dc.b "  completely wrong, is he???",-1
dc.b "Marika M.:",-1
dc.b "  you owe me 30kr, grr!",-1
dc.b "Marcus Nelson:",-1
dc.b "  Clark Kent strikes back!",-1
dc.b "Mats Ekstrand:",-1
dc.b "  kiss Malin from me, she's worth it!",-1
dc.b "Mattias Fondell:",-1
dc.b "  yeah, go for the army!",-1
dc.b "Matti Pettersson:",-1
dc.b "  swimming your life away?",-1
dc.b "Mi Holmstrand:",-1
dc.b "  so, you're a star model? that's",-1
dc.b "  wonderful, see you at the movies!",-1
dc.b "Mia Grundstr}m:",-1
dc.b "  don't be shy, you can do better",-1
dc.b "  than that!",-1
dc.b "Nicklas Larsson:",-1
dc.b "  burned your 8th Amiga?",-1
dc.b "Ola Eriksson:",-1
dc.b "  27 days to muck!",-1
dc.b "Paula Kjellstr}m:",-1
dc.b "  this is something beautiful,",-1
dc.b "  Peter below sends his love!",-1
dc.b "Peter Sanden:",-1
dc.b "  this is too something wonderful,",-1
dc.b "  Paula yours, go and get her!",-1
dc.b "Petra Persson:",-1
dc.b "  nice!",-1
dc.b "Pontus S|ld}d:",-1
dc.b "  who the hell is Christin?",-1
dc.b "  give me her number as she wanted!",-1
dc.b "  and the next time, put on enough",-1
dc.b "  stamps on your postcards!",-1
dc.b "Rickard Nilsson:",-1
dc.b "  Spyken looks like a toyhouse!",-1
dc.b "Sebastian Stebe:",-1
dc.b "  how's your synthpaper going,",-1
dc.b "  1500 papers every month, that's good!",-1
dc.b "Stefan Zivkovic:",-1
dc.b "  Polhems Getar f}rgyller tillvaron",-1
dc.b "  med sin existens!",-1
dc.b "Stellan Bilen:",-1
dc.b "  alla barn var glada,",-1
dc.b "  utom Hanna som d|cka av en stekpanna!",-1
dc.b "Ulrika S}rell:",-1
dc.b "  you'll get your serious talk soon!",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Famous persons worth mentioning.",-1
dc.b " ",-1
dc.b "A. Rinkey, Al Jaffe, Astrid Lindgren,",-1
dc.b "Carl Bildt, Charlie Chaplin,",-1
dc.b "Dave Berg, Don Martin,",-1
dc.b "F. Huddleston,",-1
dc.b "Hans Alfredson, His Majesty the King:",-1
dc.b "Carl-Gustav Bernadotte,",-1
dc.b "J.R.R. Tolkien,",-1
dc.b "Larry Siegel, Lasse [berg,",-1
dc.b "Richard Fuchs,",-1
dc.b "Stellan Sundahl,",-1
dc.b "Tage Danielsson and",-1
dc.b "Walt Disney.",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "What about some companies?",-1
dc.b " ",-1
dc.b "Formec Milj},",-1
dc.b "Imagitec Design,",-1
dc.b "Klimabolaget AB,",-1
dc.b "Psygnosis,",-1
dc.b "Sierra, Swedisc and Sydsvenskan.",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Out of cathegory error?",-1
dc.b " ",-1
dc.b "City SAF radio 102.6 FM Stereo,",-1
dc.b "Moderaterna,",-1
dc.b "Radio AF 95.0 FM Stereo,",-1
dc.b "Radio P4 99.1 FM Stereo,",-1
dc.b "Reader's digest and",-1
dc.b "Top Gun!",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Musicians who like us: (haha)",-1
dc.b " ",-1
dc.b "Bug,",-1
dc.b "Chris Huelsbeck, Chris Korte, Codex,",-1
dc.b "Coq Rogue,",-1
dc.b "David Whittaker, Dr. Awesome,",-1
dc.b "Firefox, Fix, Fred Hahn,",-1
dc.b "Gluemaster, Godbrain,",-1
dc.b "Jazze, Jesper Kyd,",-1
dc.b "Karsten Obarski,",-1
dc.b "Maniacs of Noise, Mantronix,",-1
dc.b "Martin Galway, Monopoly, Moppe,",-1
dc.b "Neuman,",-1
dc.b "Oberheim, Odie,",-1
dc.b "Panda, Paul van der Valk,",-1
dc.b "Rob Hubbard,",-1
dc.b "SCS,",-1
dc.b "Tip, Tomas Lopatic,",-1
dc.b "Uncle Tom,",-1
dc.b "Watchman,",-1
dc.b "Zeb, Ziphoid and Zymox.",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "REAL musicians we would like to be:",-1
dc.b " ",-1
dc.b "ABBA, Adolphson & Falk,",-1
dc.b "The Art Of Noise,",-1
dc.b "Beethoven,",-1
dc.b "Camouflage, Chopin, Cornelis Vreeswijk,",-1
dc.b "Depeche Mode, Di Leva,",-1
dc.b "Erasure,",-1
dc.b "Georg Riedel, Grieg, Gyllene Tider,",-1
dc.b "Harold Faltermeyer,",-1
dc.b "Hansson de Wolfe United,",-1
dc.b "Howard Jones,",-1
dc.b "Intermission,",-1
dc.b "Jakob Hellman, Jan Hammer,",-1
dc.b "Jean-Michel Jarre, Jimmy Sommerville,",-1
dc.b "Johan Ekelund,",-1
dc.b "Kim Wilde, KLF, Kraftwerk,",-1
dc.b "Mauro Scocco, Mikael Wiehe,",-1
dc.b "Mortal Memories,",-1
dc.b "Paul Hardcastle, Paul Young,",-1
dc.b "Pet Shop Boys, Peter LeMarc,",-1
dc.b "Propaganda,",-1
dc.b "Ratata, Roxette,",-1
dc.b "Seal,",-1
dc.b "Tchaikovsky, Tears for Fears,",-1
dc.b "Vangelis, Vivaldi,",-1
dc.b "Yazoo and Yello.",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Not to be forgotten: Things!",-1
dc.b " ",-1
dc.b "Casio fx-115M scientific calculator,",-1
dc.b "JVC PC-30,",-1
dc.b "the 0.3mm leads to my pen,",-1
dc.b "Philips CM 8833 personal monitor and",-1
dc.b "Tac-2 (rebuilt, ofcoz!).",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Our favourite cathegory: Animals!",-1
dc.b " ",-1
dc.b "All Cows,",-1
dc.b "My (non-existing) Dog,",-1
dc.b "Getar, Gnuer, Grasshoppers and G}kar.",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Yep! It's time for places:",-1
dc.b " ",-1
dc.b "The Beach-church in Lomma, My bed,",-1
dc.b "Br{h}gsbadet in Staffanstorp,",-1
dc.b "Bus 123 to K|vlinge,",-1
dc.b "The Buses in Malm},",-1
dc.b "Chrougen in Lund,",-1
dc.b "Kaktus' summerhouse,",-1
dc.b "Helene's place,",-1
dc.b "Mahoney's summerhouse,",-1
dc.b "Panda's summerhouse,",-1
dc.b "Polhemskolan in Lund,",-1
dc.b "P{gat{get till St{ngby,",-1
dc.b "Sodom NightClub and",-1
dc.b "Spyken.",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Type your favourite pervert word,",-1
dc.b "and you'll get a night you'll",-1
dc.b "never forget!",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b 0

tunelist:
dc.b " ",-1
dc.b "Aase's death",		0,"01:25 Mahoney",-1
dc.b "Abridge",			0,"04:25 Mahoney",-1
dc.b "After midnight",		0,"02:45 Panda",-1
dc.b "Akrobat",			0,"03:09 Gluemaster",-1
dc.b "All times high",		0,"02:44 Xerxes",-1
dc.b "Allergitestad",		0,"03:00 Mahoney",-1
dc.b "Amegas",			0,"04:21 Obarski",-1
dc.b "Antikaries",		0,"03:19 Panda",-1
dc.b "Aqua minerale",		0,"01:44 Xerxes",-1
dc.b "Be with Glue",		0,"00:38 Gluemaster",-1
dc.b "Be with Mahoney",		0,"01:09 Mahoney",-1
dc.b "Be with Panda",		0,"00:32 Panda",-1
dc.b "Broken nails",		0,"03:59 Panda",-1
dc.b "Brynolf",			0,"01:15 Panda",-1
dc.b "Captain Starshine",	0,"04:17 Neuman",-1
dc.b "Cecilia Lind",		0,"01:29 Mahoney",-1
dc.b "Chip",			0,"03:09 Gluemaster",-1
dc.b "Crystal symphony",	0,"02:33 Mantronix",-1
dc.b "C.u.t",			0,"02:01 Zeb",-1
dc.b "Cyan sounds of Zeb",	0,"02:02 Zeb",-1
dc.b "Cyber Siriusnetic",	0,"02:24 Yogi",-1
dc.b "Darkness",		0,"03:11 Tsaca",-1
dc.b "Digital master",		0,"01:47 Watchman",-1
dc.b "Digital touch",		0,"01:39 Watchman",-1
dc.b "Digital vision",		0,"01:01 Watchman",-1
dc.b "Eargasm",			0,"03:01 Panda",-1
dc.b "Ekorren",			0,"00:20 Gluemaster",-1
dc.b "Ett stycke husmusik",	0,"02:18 Xerxes",-1
dc.b "Flight of Grud",		0,"03:46 Mahoney",-1
dc.b "Fludent 0.25mg",		0,"01:52 Donald",-1
dc.b "Gaffeltruck",		0,"03:40 Mahoney",-1
dc.b "Gn|llspik",		0,"02:59 Flex",-1
dc.b "Gommoplask",		0,"02:02 Mahoney",-1
dc.b "Grannens hund",		0,"02:02 Donald",-1
dc.b "Greensleeves",		0,"02:18 Gluemaster",-1
dc.b "Heroplop",		0,"04:48 Mahoney",-1
dc.b "H}stvisa",		0,"02:35 Mahoney",-1
dc.b "Ikke advanced",		0,"01:01 Ziphoid",-1
dc.b "It's real",		0,"01:24 Xerxes",-1
dc.b "I'm a hedgehog",		0,"01:09 Gluemaster",-1
dc.b "Jobbig",			0,"03:18 Mahoney",-1
dc.b "Just a game",		0,"03:40 Mahoney",-1
dc.b "Kindermedley",		0,"04:25 Mahoney",-1
dc.b "Late night walk",		0,"02:00 Nizze",-1
dc.b "Lepeltheme",		0,"04:36 Obarski",-1
dc.b "Let's cultivate",		0,"01:38 Gluemaster",-1
dc.b "Lonely",			0,"02:06 Monopoly",-1
dc.b "Look around",		0,"03:10 Mahoney",-1
dc.b "Look at Hubert",		0,"03:02 Mahoney",-1
dc.b "Me done this too",	0,"03:27 Mahoney",-1
dc.b "Moonlight shadow",	0,"01:10 Panda",-1
dc.b "Moorfogging",		0,"01:23 Nizze",-1
dc.b "Muppenkorva",		0,"01:52 Gluemaster",-1
dc.b "New story",		0,"02:11 Tsaca",-1
dc.b "Nittaku",			0,"02:33 Donald",-1
dc.b "Nostalgia heaven",	0,"01:32 Zeb",-1
dc.b "Not used",		0,"02:22 Gluemaster",-1
dc.b "Opaque glasses",		0,"01:20 Gluemaster",-1
dc.b "Operating",		0,"02:33 Mantronix",-1
dc.b "Peggy go home",		0,"03:00 Mahoney",-1
dc.b "Pilsner",			0,"02:04 Gluemaster",-1
dc.b "Poet's rhyme",		0,"03:12 Ziphoid",-1
dc.b "Prislapp",		0,"01:43 Gluemaster",-1
dc.b "Questioff",		0,"02:07 Mahoney",-1
dc.b "Rallyemaster",		0,"05:07 Obarski",-1
dc.b "Regn och rusk",		0,"01:47 Mahoney",-1
dc.b "Rektum",			0,"02:41 Donald",-1
dc.b "Rotinom",			0,"02:38 Nizze",-1
dc.b "Run like an egyptian",	0,"01:03 Zeb",-1
dc.b "Russian-vodka",		0,"02:02 Gluemaster",-1
dc.b "Sailor's hornpipe",	0,"00:36 Panda",-1
dc.b "Schampoo",		0,"03:34 Mahoney",-1
dc.b "She's my light",		0,"03:32 Panda",-1
dc.b "Skreckeksempel",		0,"03:13 Mahoney",-1
dc.b "Slabba",			0,"04:15 Mahoney",-1
dc.b "Slaughter",		0,"01:53 Gluemaster",-1
dc.b "Sleepwalk",		0,"04:51 Obarski",-1
dc.b "Sleeze doner",		0,"03:24 Neuman",-1
dc.b "Slow swagger",		0,"04:04 Yogi",-1
dc.b "Surpraiz",		0,"02:00 Gluemaster",-1
dc.b "Sylte baertyttetoy",	0,"02:52 Zeb",-1
dc.b "The funny farm",		0,"02:01 Neuman",-1
dc.b "The happy hunt",		0,"03:10 Panda",-1
dc.b "The Russian bear",	0,"02:04 Ziphoid",-1
dc.b "Trip on a Monday",	0,"01:02 Zeb",-1
dc.b "Trubbel",			0,"03:02 Mahoney",-1
dc.b "Try to memorise",		0,"02:30 Zeb",-1
dc.b "Tune in minorum",		0,"03:25 Yogi",-1
dc.b "Ussr",			0,"01:54 Nizze",-1
dc.b "Victorium palace",	0,"02:14 Zeb",-1
dc.b "Wafflehour",		0,"02:47 Mahoney+flex",-1
dc.b "Wafflehour 1st",		0,"00:56 Nizze",-1
dc.b "Wafflehour 2nd",		0,"00:46 H.I.V.",-1
dc.b "Wafflehour 3rd",		0,"00:38 Candyman",-1
dc.b "Wafflehour 5th",		0,"00:38 Maggot",-1
dc.b "Wafflehour 6th",		0,"00:39 Guts",-1
dc.b "Wait for Andy",		0,"02:33 Mahoney",-1
dc.b "Warm valley",		0,"00:30 Duke",-1
dc.b "Wings of glory",		0,"02:08 Ziphoid",-1
dc.b "Wishes to you all",	0,"03:10 Gluemaster",-1
dc.b "Xtra2mat",		0,"02:16 Mahoney",-1
dc.b 0
even

AddrText:
dc.b " ",-1
dc.b "The staff of His Master's Noise.",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b " Here is a list of those people you",-1
dc.b "might want to get in touch with. This is",-1
dc.b "a list of responsability. None of us are",-1
dc.b "interested in swapping, got that?",-1
dc.b " ",-1
dc.b "Alphabetically ordered a-z.",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "(Candyman/Paradise)",-1
dc.b "Peter Tufvesson",-1
dc.b "Tingbackav. 12",-1
dc.b "s-23030 OXIE",-1
dc.b "Sweden",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Donald of the Remedy crew:",-1
dc.b " Hej.",-1
dc.b " ",-1
dc.b "(Donald/Remedy crew)",-1
dc.b "P|r Danielsson",-1
dc.b "S:t J}rgens v. 17",-1
dc.b "s-29600 [HUS",-1
dc.b "Sweden",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Flex in Paradise:",-1
dc.b " For anything...  (almost!)",-1
dc.b " ",-1
dc.b "(Flex/Paradise)",-1
dc.b "Mikael Caleres",-1
dc.b "Sunnanv. 21",-1
dc.b "s-22226 LUND",-1
dc.b "Sweden",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Gluemaster of NorthStar:",-1
dc.b " Stora |lgar flyger |nnu h}gre.",-1
dc.b " ",-1
dc.b "(Gluemaster/NorthStar)",-1
dc.b "Lars Malmborg",-1
dc.b "Sl|tt|ngsg. 29b",-1
dc.b "s-23400 LOMMA",-1
dc.b "Sweden",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Guts in Paradise:",-1
dc.b " Send me empty disks, because that is",-1
dc.b " exactly what i'm running short of.",-1
dc.b " ",-1
dc.b "(Guts/Paradise)",-1
dc.b "Stefan Zivkovic",-1
dc.b "N|mndemansv. 2",-1
dc.b "s-22378 LUND",-1
dc.b "Sweden",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "(H.I.V./Paradise)",-1
dc.b "Ola M{rtensson",-1
dc.b "[ldermansv. 26",-1
dc.b "s-23030 OXIE",-1
dc.b "Sweden",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "(Kaktus/NorthStar)",-1
dc.b "Anders Berkeman",-1
dc.b "Box 16014",-1
dc.b "s-25016 R[[",-1
dc.b "Sweden",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "(Maggot/Target)",-1
dc.b "Mattias Johansson",-1
dc.b "K|mn|rsv. 3b:221",-1
dc.b "s-22246 LUND",-1
dc.b "Sweden",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Mahoney of NorthStar:",-1
dc.b " If you want to swap illegal games",-1
dc.b " (0% answer, guaranteed!), drop me a",-1
dc.b " letter (I LOVE long letters!)",-1
dc.b " (Hi Gully & Jonny!) at this address:",-1
dc.b " ",-1
dc.b "(Mahoney/NorthStar)",-1
dc.b "Per Tufvesson",-1
dc.b "Tunnbindarev. 9",-1
dc.b "s-24535 STAFFANSTORP",-1
dc.b "Sweden",-1
dc.b " ",-1
dc.b " p.s. I'm NOT interested in any",-1
dc.b "   letters describing the scene",-1
dc.b "   in Africa, nor anything else",-1
dc.b "   just containing information",-1
dc.b "   from the computerworld.",-1
dc.b "    That's your world, NOT mine!",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "(Mantronix/Razor 1911)",-1
dc.b "Martin Wall",-1
dc.b "Handskmakareg. 4a",-1
dc.b "s-29154 KRISTIANSTAD",-1
dc.b "Sweden",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "(Monopoly/Paradise)",-1
dc.b "Robert Nilsson",-1
dc.b "Baldersv. 5c",-1
dc.b "s-23700 BJ\RRED",-1
dc.b "Sweden",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Neuman of Megalamers:",-1
dc.b " MEGALAMERS funk your dada.",-1
dc.b " ",-1
dc.b "(Neuman/Megalamers)",-1
dc.b "Finn Nyman",-1
dc.b "Dom|ngatan 15",-1
dc.b "s-24232 H]RBY",-1
dc.b "Sweden",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "(Nizze/Paradise)",-1
dc.b "Anders Nilsson-Stig",-1
dc.b "Ryttm|starev. 10",-1
dc.b "s-23700 BJ\RRED",-1
dc.b "Sweden",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Panda in Paradise:",-1
dc.b " I have not enough time for swapping,",-1
dc.b " but if you for any other reason want",-1
dc.b " to contact me, please do!!!",-1
dc.b " ",-1
dc.b "(Panda/Paradise)",-1
dc.b "Peter Sanden",-1
dc.b "Box 64",-1
dc.b "s-24521 STAFFANSTORP",-1
dc.b "Sweden",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Tsaca of Amaze:",-1
dc.b " Contact me for song-swapping with the",-1
dc.b " following address:",-1
dc.b " ",-1
dc.b "(Tsaca/Amaze)",-1
dc.b "Atte Pulli",-1
dc.b "Majoitusmestarinkatu 1 e 39",-1
dc.b "sf-20350 TURKU",-1
dc.b "Finland",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Watchman of Complex:",-1
dc.b " Hello everybody! If you think you need",-1
dc.b " some Watchman of Complex-like music",-1
dc.b " for your software-house game, demo,",-1
dc.b " musicdisk, party or birthday then",-1
dc.b " just throw me a line or two at this",-1
dc.b " address:",-1
dc.b " ",-1
dc.b "(Watchman/Complex)",-1
dc.b "Markku M|ki",-1
dc.b "Kurikantie 19",-1
dc.b "sf-61300 KURIKKA",-1
dc.b "Finland",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "(Xerxes/Voice)",-1
dc.b "Per Swantesson",-1
dc.b "Karl XI-gatan. 3a",-1
dc.b "s-22220 LUND",-1
dc.b "Sweden",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Yogi of Megalamers:",-1
dc.b " MEGALAMERS smagar dada-discon.",-1
dc.b " ",-1
dc.b "(Yogi/Megalamers)",-1
dc.b "J}rgen Nilsson",-1
dc.b "Beckasinv. 14",-1
dc.b "s-24232 H]RBY",-1
dc.b "Sweden",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "(Zeb/Panoramic Designs)",-1
dc.b "Sebastian Bjoernerud",-1
dc.b "7870 Grong",-1
dc.b "Norway",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Ziphoid of Razor 1911:",-1
dc.b " Det |r lugnt.",-1
dc.b " ",-1
dc.b "(Ziphoid/Razor 1911)",-1
dc.b "John Carehag",-1
dc.b "]stra {sgatan 11 1tr ",-1
dc.b "s-63225 ESKILSTUNA",-1
dc.b "Sweden",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b 0






FutureText:
dc.b " ",-1
dc.b "Now what about that future?",-1
dc.b "==================================",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b " Is there really a future in this",-1
dc.b "world? Is there any reason why we've",-1
dc.b "done this for you, all for free?",-1
dc.b "You know, don't you? These hours and",-1
dc.b "hours consumed by this stupid Amiga,",-1
dc.b "are they really worth it?",-1
dc.b " ",-1
dc.b " We've only got one answer, and that is:",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b "        ... that is:",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b "           Nope!",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b " ",-1
dc.b " This is the very, VERY, last thing you",-1
dc.b "will see from us. From now and on, our",-1
dc.b "lives come in the first place, above all",-1
dc.b "this shitty programming we've been doing",-1
dc.b "for the last ten years.",-1
dc.b " ",-1
dc.b " So, this text should be some kind of",-1
dc.b "sad partingstory, but we do not look",-1
dc.b "at it as a sad thing to do. We always",-1
dc.b "wanted to do something nobody else",-1
dc.b "dared to do, and the most astonishing",-1
dc.b "thing is that we think we managed!",-1
dc.b " ",-1
dc.b " I do not normally use dirty language,",-1
dc.b "but in this case I have to. This",-1
dc.b "fucking musicdisk has taken me over 20",-1
dc.b "months to complete, and is it really",-1
dc.b "worth it? No, No, No, No, not at all!",-1
dc.b "But it's all my fault, I started it,",-1
dc.b "I had to finish it, and it would have",-1
dc.b "been finished long ago if it wasn't for",-1
dc.b "one simple rule: It must work!",-1
dc.b " ",-1
dc.b " If it doesn't work on your computer,",-1
dc.b "DON'T TELL ME!!! I don't want to know.",-1
dc.b "The last eight months I've spent",-1
dc.b "correcting bugs and including new",-1
dc.b "bugs. I can't really understand why I",-1
dc.b "didn't follow a good friends hint:",-1
dc.b "To create a basic-program that",-1
dc.b "randomizes some 100kb of memory,",-1
dc.b "and then checks if the randomized",-1
dc.b "numbers would turn up to be a",-1
dc.b "musicdisk by Mahoney & Kaktus.",-1
dc.b "Ok, the possibility that 100000",-1
dc.b "randomised bytes would be a",-1
dc.b "working musicdisk isn't very",-1
dc.b "big, but it would still be a much",-1
dc.b "more comfortable way of doing this",-1
dc.b "musicdisk. Some day I will try it out!",-1
dc.b " ",-1
dc.b "Anyway, the summer is soon over,",-1
dc.b "and whenever the sun was shining,",-1
dc.b "you couldn't find me in front of a",-1
dc.b "computer. That is the main reason",-1
dc.b "for this little delay of about",-1
dc.b "a year. The original release-date",-1
dc.b "was October 1990. I think I failed!",-1
dc.b " ",-1
dc.b "What happens to Mahoney & Kaktus?",-1
dc.b "Well, do you know? I don't ...",-1
dc.b "I (Mahoney) have recently taken over",-1
dc.b "the school-magazine at our school,",-1
dc.b "Polhemskolan in Lund, together with",-1
dc.b "a couple of friends (Guts & Flex in",-1
dc.b "Paradise, Larsson, Pjeter, Erik and",-1
dc.b "Boubi/Target) and we have also started",-1
dc.b "a club of humor. That is my future.",-1
dc.b " ",-1
dc.b "Kaktus has been working at a local",-1
dc.b "food-store moving bananas and apples,",-1
dc.b "and has all together an all too",-1
dc.b "exciting life, thereby forgetting",-1
dc.b "a lot of other things, for instance",-1
dc.b "his little computer. Those few days",-1
dc.b "he discovers it in his cupboard he",-1
dc.b "spends making mathemagic. Not much",-1
dc.b "to be done there!",-1
dc.b " ",-1
dc.b "So, the less I type here, the",-1
dc.b "faster this disk will be released.",-1
dc.b "If you want to check out what",-1
dc.b "mathemagic is, watch the reset-part",-1
dc.b "of this musicdisk.",-1
dc.b " ",-1
dc.b "Thank you for watching, hope you",-1
dc.b "like what you see, because we sure do!",-1
dc.b " ",-1
dc.b "Have a noise day!",-1
dc.b "/Mahoney & Kaktus",-1
dc.b "         the 30th of September 1991.",-1
dc.b " ",-1
dc.b "=============================================",-1
dc.b 0

Prefs:
dc.b " ",-1
dc.b "Preferences:",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "Mouse friction:",-1
dc.b "Mouse wallfric:",-1
dc.b "Mouse x-sense:",-1
dc.b "Mouse y-sense:",-1
dc.b "Time to fall:",-1
dc.b "Fall gravity:",-1
dc.b "Cursor-sense:",-1
dc.b " ",-1
dc.b "The funnyline below:",-1
dc.b "   English proverbs",-1
dc.b "   Swedish proverbs",-1
dc.b "   Swedish 'alla barn'-stories",-1
dc.b " ",-1
dc.b "Extramem used for:",-1
dc.b "   nothing",-1
dc.b "   whole disk 1",-1
dc.b "   three tunes in memory",-1
dc.b 0

LoveText:
dc.b " ",-1
dc.b "Love is a special way of feeling...",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b " ... it is the safe way we feel when",-1
dc.b "we sit on our mother's lap with her",-1
dc.b "arms around us tight and close. ",-1
dc.b " ",-1
dc.b " It is the good way we feel when we",-1
dc.b "talk to someone and they want to",-1
dc.b "listen and don't tell us to go away",-1
dc.b "and be quiet.",-1
dc.b " ",-1
dc.b " It is the happy way we feel when we",-1
dc.b "save a bird that has been hurt...",-1
dc.b " ",-1
dc.b " or feed a lost cat ...",-1
dc.b " ",-1
dc.b " or calm a frightened colt.",-1
dc.b " ",-1
dc.b " Love is found in unexpected places...",-1
dc.b "It is there in the quiet moment when",-1
dc.b "we first discover a beautiful thing...",-1
dc.b "when we watch a bird soar high against",-1
dc.b "a pale blue sky...",-1
dc.b " ",-1
dc.b " when we see a lovely flower",-1
dc.b " that no one else has noticed...",-1
dc.b " ",-1
dc.b " when we find a place",-1
dc.b " that shelters us and is",-1
dc.b " all our very own.",-1
dc.b " ",-1
dc.b " Love starts in little ways...",-1
dc.b "It may begin the day we first share",-1
dc.b "our thoughts with someone else...",-1
dc.b " ",-1
dc.b " or help someone who needs us...",-1
dc.b " ",-1
dc.b " Or, sometimes, it begins because,",-1
dc.b "even without words, we understand how",-1
dc.b "someone feels.",-1
dc.b " ",-1
dc.b " Love comes quietly...",-1
dc.b "but you know when it is there,",-1
dc.b "because, suddenly...",-1
dc.b "you are not alone any more...",-1
dc.b "and there is no sadness inside you.",-1
dc.b " ",-1
dc.b " Love is a happy feeling that stays",-1
dc.b "inside your heart",-1
dc.b "for the rest of your life.",-1
dc.b " ",-1
dc.b "============================================",-1
dc.b " ",-1
dc.b "If you haven't noticed it yet,",-1
dc.b "I LOVE HELENE, she means more to",-1
dc.b "me than any computer in the world",-1
dc.b "will ever do. Love is life,",-1
dc.b "computers aren't.",-1
dc.b 0
even

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

fillt:	blk.b	$180,-1

pl_list:;xpos,xspd,ypos,yspd,8*oldpos,8*oldbit
blk.w	dots*4,0
blk.w	dots*2*8,0

	blk.b	48*2*2
sc_screen1:	blk.b	17*96
sc_screen2:	blk.b	17*96
	blk.b	48*2*2

Sv_spr:	blk.l	$f04/4,0

gr_spr1dat:	blk.l	28,0
gr_spr3dat:	blk.l	28,0
gr_spr2dat:	blk.l	28,0
gr_spr4dat:	blk.l	28,0

		dc.w	0,0,0,0
tunepois:	blk.w	MaxAntalRaderITexter+5,0

dummy:	blk.b	$180,0

Rend:

if rend>SfontR
	fail
endc

