*************************
****  BOOTMENU  III  ****
*************************
* WRITE MENUNR. IN $100 *
*       LOADER II       *
*************************

>extern "dh1:work/charset6",charset,1200

menuan=6
startwait=$8f0f

start:
openlib=-408
closelib=-414
permit=-138
forbid=-132

*** START ***

movem.l	d0-d7/a0-a6,-(a7)
move.l	4,a6
jsr	forbid(a6)
clr.l	d0
move.l	#gfxname,a1
jsr	openlib(a6)
move.l	d0,gfxbase

move.l	d0,a0
move.l	50(a0),oldclist
move.l	#newclist,50(a0)

bsr	init
bsr	printtext
bsr	starinit

move.l	$6c,oldint
move.l	#newint,$6c

mwait:
move.w	$dff00a,altmauspos
bsr	mausabfrage
btst	#6,$bfe001
bne	mwait

*** ENDE ***

move.l	oldint,$6c
nop
nop
move.l	#screen,$dff054
move.l	#$01000000,$dff040
move.l	#-1,$dff044
clr.w	$dff066
move.w	#275*64+23,$dff058
bsr	wblt

move.l	#endtext,textpointer1
move.l	#eetext,textpointer2
move.w	#0,x
move.w	#20,y
bsr	printtext

move.l	4,a6
move.l	gfxbase,a1
jsr	closelib(a6)
jsr	permit(a6)
add.w	#8,addwert			
lsr	#1,addwert
lsr	#1,addwert
lsr	#1,addwert
move.w	addwert,$100
movem.l	(a7)+,d0-d7/a0-a6
rts

*** INIT COPPER , ECT ***

init:
lea	screencop,a0
move.l	#screen,d0
swap	d0
move.w	#$00e4,(a0)+
move.w	d0,(a0)+
swap	d0
move.w	#$00e6,(a0)+
move.w	d0,(a0)+
move.l	#starplane1,d0
swap	d0
move.w	#$00e0,(a0)+
move.w	d0,(a0)+
swap	d0
move.w	#$00e2,(a0)+
move.w	d0,(a0)+
move.l	#starplane2,d0
swap	d0
move.w	#$00e8,(a0)+
move.w	d0,(a0)+
swap	d0
move.w	#$00ea,(a0)+
move.w	d0,(a0)+

lea	menucop,a0
move.w	#startwait,d0
move.l	#menuan,d7
menucoploop:
move.w	d0,(a0)+
move.w	#$fffe,(a0)+
move.w	#$0192,(a0)+
move.w	#$0700,(a0)+
add.w	#$0800,d0
dbra	d7,menucoploop

move.l	#starplane1,$dff054
move.l	#$01000000,$dff040
move.l	#-1,$dff044
clr.w	$dff066
move.w	#275*64+23,$dff058
bsr	wblt
move.l	#starplane2,$dff054
move.l	#$01000000,$dff040
move.l	#-1,$dff044
clr.w	$dff066
move.w	#275*64+23,$dff058
bsr	wblt
move.l	#screen,$dff054
move.l	#$01000000,$dff040
move.l	#-1,$dff044
clr.w	$dff066
move.w	#275*64+23,$dff058
bsr	wblt
rts

*** MAUSROUTINE ***

mausabfrage:

move.b	altmauspos,d0
move.b	$dff00a,d1
sub.b	d1,d0
cmp.b	#-1,d0
beq	oben
cmp.b	#1,d0
beq	unten
rts

oben:
cmp.w	#menuan*8,addwert
beq	end
add.w	#8,addwert
end:
rts

unten:
tst.w	addwert
beq	starti
sub.w	#8,addwert
starti:
rts

zeigemenu:
lea	menucop+6,a0
move.l	#menuan,d7
cloop:
move.w	#$700,(a0)
add.w	#8,a0
dbra	d7,cloop

hier:
move.l	ftw,a1
cmp.w	#$ffff,(a1)
bne	notende
move.l	#ftab,ftw
bra	hier
notende:

lea	menucop+6,a0
add.w	addwert,a0
move.w	(a1),(a0)

tst.w	time
beq	maches
subq.w	#1,time
rts
maches:
addq.l	#2,ftw
move.w	#2,time
rts

newint:
movem.l	d0-d7/a0-a6,-(a7)
bsr	starsmove
bsr	zeigemenu
scroll:
lea	screen+[248*46]+20,a0
bsr	wblt
move.l	a0,$dff050
sub.l	#2,a0
move.l	a0,$dff054
move.w	#0,$dff064
move.w	#0,$dff066
move.w	#$ffff,$dff044
move.w	#$ffff,$dff046
move.w	#$e9f0,$dff040
clr.w	$dff042
move.w	#10*64+24,$dff058

*--Ein paar Scroller warten ...

sub.w 	#1,scrollcount2
bne 	raus2
move.w 	#4,scrollcount2

*--Zeichenposition aus Fontgrafik ermitteln

schrift2:
move.l	zeiger2,a0
cmp.b	#' ',(a0)
bne	noss
move.l	#space,a2
bra	bbb
noss:
moveq	#0,d0
move.b	(a0),d0
bne	okay2
move.l	#text2,zeiger2
bra	schrift2

okay2:
lsl.l	#2,d0
lea	offset2,a1
add.l	d0,a1
move.l	(a1),d1
move.l	#charset,a2
add.l	d1,a2
sub.l	#4920,a2

bbb:
lea	screen+[249*46]+20,a0
bsr	wblt
move.l	a2,$dff050
move.l	a0,$dff054
move.w	#38,$dff064
move.w	#46,$dff066
move.w	#$ff00,$dff044
move.w	#$ff00,$dff046
move.w	#$9f0,$dff040
clr.w	$dff042
move.w	#6*64+1,$dff058
add.l	#1,zeiger2
raus2:
movem.l	(a7)+,d0-d7/a0-a6
dc.w	$4ef9
oldint:	dc.l	0

wblt:
btst	#14,$dff002
bne	wblt
rts

*** STARS *** 

starinit:
move.w  #$0075,D3
lea     starmovement1,A0
schreiben:			; Sternwerte in
bsr.l   CALC1			; 
move.w  D0,(A0)+		;
bsr.l   CALC1			;
move.w  D0,(A0)+		; in starmovement1 speichern	
bsr.l   CALC1			;		
andi.w  #511,D0			;	
move.w  D0,(A0)+		;
dbf     D3,schreiben
rts
CALC1:
move.w  $dff006,D0
lea     VHPOSR_speicher,A3
muls    (A3),D0
addi.w  #585,D0
ext.l   D0
lea     VHPOSR_speicher,A3
move.w  D0,(A3)
rts

CALC2:
suba.l  #$00000006,A4
bsr.l   CALC1
move.w  D0,(A4)+
bsr.l   CALC1
move.w  D0,(A4)+
move.w  #600,(A4)+
bra.l   R2_ende

starsmove:
lea	starmovement1,A4
move.w  #$0075,D3
lea	starmovement2,A5
ROUTINE2:
move.w  (A4)+,D4
move.w  (A4)+,D5
move.w  (A4),D6
subi.w  #$0004,(A4)+
tst.w   D6
ble.l   CALC2
ext.l   D4
divs    D6,D4
addi.w  #184,D4			;x-mittelpunkt
ext.l   D5
divs    D6,D5
addi.w  #138,D5			;y-mittlepunkt112
tst.w   D4			;x-min
blt.l   CALC2
cmp.w   #44,D5			;y-min
blt.l   CALC2
cmpi.w  #368,D4			;x-max
bgt.l   CALC2
cmpi.w  #242,D5			;y-max
bgt.l   CALC2
move.w  (A5),D0
move.w  D4,(A5)+
move.w  (A5),D1
move.w  D5,(A5)+
bsr.l   star_clear
move.w  D4,D0
move.w  D5,D1
mulu    #46,D1			;50 bytes bitplane
move.w  D0,D2
asr.w   #3,D2
add.w   D2,D1
asl.w   #3,D2
sub.w   D0,D2
subq.b  #1,D2
cmpi.w  #336,D6
bgt.s   sprung1
cmpi.w  #268,D6
bgt.s   sprung2
bra.s   sprung3
sprung1:
move.l  #starplane1,A1
adda.l  D1,A1
bset    D2,(A1)
bra.s   R2_ende
sprung2:
move.l  #starplane2,A1
adda.l  D1,A1
bset    D2,(A1)
bra.s   R2_ende
sprung3:
move.l  #starplane1,A1
adda.l  D1,A1
bset    D2,(A1)
move.l  #starplane2,A1
adda.l  D1,A1
bset    D2,(A1)
R2_ende:
dbf     D3,ROUTINE2
rts

star_clear:
mulu    #46,D1
move.w  D0,D2
asr.w   #3,D2
add.w   D2,D1
asl.w   #3,D2
sub.w   D0,D2
subq.b  #1,D2
move.l  #starplane1,A1
adda.l  D1,A1
bclr    D2,(A1)
move.l  #starplane2,A1
adda.l  D1,A1
bclr    D2,(A1)
rts

*** PRINTROUTINE ***

printtext:
move.l	textpointer1,d1
move.l	textpointer2,d7
sub.l	d1,d7
subq.l	#1,d7
move.l	textpointer1,a3
schrift:
cmp.b	#' ',(a3)
bne	nospace
move.l	#space,a2
addq.l	#1,a3
bra	blitit
nospace:
cmp.b	#0,(a3)
bne	no0
addq.w	#8,y
move.w	#32,x
addq.l	#1,a3
bra	noblit
no0:
cmp.b	#1,(a3)
bne	no1
move.w	#55,y
move.w	#32,x
addq.l	#1,a3
bra	noblit
no1:
moveq	#0,d0
move.b	(a3)+,d0
lsl.l	#2,d0
lea	offset2,a1
add.l	d0,a1
move.l	(a1),d1
move.l	#charset,a2
add.l	d1,a2
sub.l	#4920,a2
blitit:
bsr	blitcalc
addq.w	#8,x
lea	screen,a0
add.w	baddwert,a0
move.l	a2,$dff050
move.l	a0,$dff04c
move.l	a0,$dff054
move.w	#38,$dff064
move.w	#44,$dff066
move.w	#44,$dff062
move.w	#$ff00,$dff044
move.w	#$ff00,$dff046
add.w	#%0000110111111100,vwert
move.w	vwert,$dff040
clr.w	$dff002
move.w	#6*64+1,$dff058
bsr	wblt
noblit:
dbra	d7,schrift
rts

*** BLITCALC ***

blitcalc:
movem.l	d0-d7,-(a7)
move.w	x,d7
move.w	y,d3
move.w	d7,d6		;x retten
move.w	d7,d5
lsr.w	#4,d7		;x in bytes (16/8)
move.w	d7,d6
lsl.w	#4,d6		;ergebnis * 16
sub.w	d6,d5		;x coordinate - ergebnis * 8 	
lsl.w	#1,d7		;x coordinate * 2 , da wortwert
lsl.w	#8,d5		;x verschiebewert in richtiges
lsl.w	#4,d5		;format umwandeln (ab.14 Bit BLTCON0)
mulu	#46,d3		;screenbreite in bytes * y *8
add.w	d3,d7
move.w	d7,baddwert
move.w	d5,vwert
movem.l	(a7)+,d0-d7
rts

x:		dc.w	32
y:		dc.w	20
baddwert:	dc.w	0
vwert:		dc.w	0
text:		
dc '                omega',0
dc '         is proud to present',0
dc '  BBB omega demo collection no.1 AAA ',1,0,0,0,0,0,0,0
dc "          turrican sounddemo",0
dc '             first  intro',0
dc '             white screen',0
dc '              sine  demo',0
dc '              sine intro',0
dc '             updown intro',0
dc "         traitors first intro",0,0,0
dc '       menu coded by  game over' 
textende:
even

*--Offsettabbelle fuer Font 'Charset4..' (kl.6Punkt Font)
offset2:	
blk.l	32,0
dc.l	5800,5880,0,0,0,0,0,0,5892,5894,5890,5896,5908,5898,5910,0
dc.l	5560,5562,5564,5566,5568,5570,5572,5574,5576,5578
dc.l	0,5906,0,5900,0,0,0
dc.l	5882,5884,5886,5888,5902,5904
blk.l	26,0
dc.l	4920,4922,4924,4926,4928,4930,4932,4934,4936,4938
dc.l	4940,4942,4944,4946,4948,4950,4952,4954,4956,4958
dc.l	5240,5242,5244,5246,5248,5250
*-A:Pfeil links B:Pf.rechts C:Pf.runter D:Pf.hoch
*-E:' F:"  

zeiger2:	dc.l	text2
scrollcount2:	dc.w	7
text2:		
dc 'omega is proud to present omega demo collection no.1'
dc '           ****          in this collection you can see five demos coded by game over and one demo coded by traitor !!!    '
dc '    some greetings are flying to * '
dc 'cyborg industies * beastie boys *'
dc ' mogwai * baloo * red sector * torti * digilogic * vip * bug * scoopex *'
dc ' paranomia * budbrain * system z * bounty *'
dc ' asterix * the aliens '
dc '* vector * timelord * cyborg industries'
dc ' * cyborg * alpha flight * energy * defjam * crionics * mirage *'
dc ' thrust * kefrens * defcon1 * vision * vision factory'
dc ' * zoom * quadlite * spreadpoint * megaforce *'
dc ' united forces * the fantastic four * wildcopper * cascade *'
dc ' doc * wizzcat * celtic *'
dc ' fastmem * steel pulse * black monks * promax'
dc ' * gunnar * scout'
dc ' * the link * the abandon *'
dc 'titanics * the new masters *'
dc ' all atari st*upid users * karlsquell * beermacht * mr. gurk *'
dc ' phenomena * north star * freedom force *'
dc 'avengers * the traitors * blowfly * atomic intelligence * atomic team'
dc ' * rebels * dps 2o1o * brainstorm * it....'
dc '                                               '
dc 	0
even

endtext:
dc '               to contact omega',0
dc '               write to',0
dc 'plk 076338e * 4400 muenster * w.germany' 
eetext:
even

altmauspos:	dc.w	0
addwert:	dc.w	0

newclist:
dc.w	$008e,$226b,$0090,$32db,$0092,$0028,$0094,$00d8	;38+d0
dc.w	$0100,$3600,$0102,$0000,$0104,$000,$0096,$0020,$0180,$0000
dc.w	$0108,$0000,$010a,$0000,$0180,$0000,$0182,$0444,$0184,$0888
dc.w	$0186,$0ccc
screencop:	blk.w	12,0
dc.w	$0192,$0700
dc.w	$320f,$fffe,$0180,$0aaa
dc.w	$340f,$fffe,$0180,$0888
dc.w	$4d0f,$fffe,$0180,$0666
dc.w	$4f0f,$fffe,$0180,$0000
menucop:	blk.w	[menuan+1]*4,0
dc.w	$d90f,$fffe,$0192,$0008
dc.w	$da0f,$fffe,$0192,$000a
dc.w	$db0f,$fffe,$0192,$000c
dc.w	$dc0f,$fffe,$0192,$000a
dc.w	$dd0f,$fffe,$0192,$0008

dc.w	$ffdf,$fffe,$080f,$fffe,$0192,$0700
dc.w	$100f,$fffe,$010a,$0002
dc.w	$160f,$fffe,$0180,$0aaa
dc.w	$180f,$fffe,$0180,$0888
dc.w	$210f,$fffe,$0180,$0666
dc.w	$230f,$fffe,$0180,$0000
dc.w	$ffff,$fffe

oldclist:	dc.l	0
gfxbase:	dc.l	0
gfxname:	dc.b	'graphics.library',0
even
space:		blk.b	400,0
charset:	blk.b	1200,0

textpointer1:	dc.l	text
textpointer2:	dc.l	textende

ftw:	dc.l	ftab
ftab:	
dc.w	$200,$300,$400,$500,$600,$700,$800,$900,$a00,$b00,$c00,$d00,$e00
dc.w	$d00,$c00,$b00,$a00,$900,$800,$700,$600,$500,$400,$300,$200
dc.w	$ffff

time:	dc.w	0

screen=time+2
starplane1=screen+13000
starplane2=starplane1+13000
Starmovement1=starplane2+13000
Starmovement2=starmovement1+$800	
VHPOSR_speicher=starmovement2+$800
