	auto ?left\=\jCode

; ^^^^^^^^^^^^^^^^^^^^^^^^ the above gets done after assembly "\" = return
; only works as executable not direct in ASM
; but atleast not crashes any more in ASM


start	cmp.b	#'e',(a0)
	beq	testit
	cmp.b	#'E',(a0)
	bne.s	install

testit	lea	code(pc),a0
	lea	$7e400,a1
	move	#$ff,d0
cpintro	move.l	(a0)+,(a1)+
	dbf	d0,cpintro
	jmp	$7e400

flag	dc.w	1
******************************************************************
install	move.b	(a0),drive
	sub.b	#'0',(a0)
	move.b	(a0),unit

	tst.b	unit
	blt	failN
	cmp.b	#4,unit
	blt	nfail

failN	clr	flag

nfail	movem.l	d0-d7/a0-a6,-(a7)
	move.l	4.w,a6
	tst	flag
	beq.s	notal
	move.l	#$400,d0		;length
	move.l	#$10002,d1		;type public
	jsr	-198(a6)		;alloc mem
	move.l	d0,bootptr

	moveq	#$19,d7
	tst.l	d0
	beq	bye
	lea	boot(pc),a0
	move.l	d0,a1
	move.l	d0,a2
	moveq	#0,d1
	move	#$ff,d2
startcalc
	move.l	(a0)+,d0
	cmp	#$4afc,d0
	beq.s	cleararea
	add.l	d0,d1
	bcc.s	notcalc
	addq.l	#1,d1
notcalc	move.l	d0,(a1)+
	subq	#1,d2
	bra.s	startcalc
cleararea
	clr.l	(a1)+
	dbf	d2,cleararea
	not.l	d1
	move.l	d1,4(a2)		;make check sum

notal	lea	doslibrary(pc),a1
	jsr	-408(a6)
	move.l	a6,a3
	move.l	d0,a6
	jsr	-60(a6)			;output
	tst.l	d0
	beq	bye
	move.l	d0,d1

	lea	text2(pc),a0		;insert text
	move.l	#text2len,d3
	tst	flag
	bne.s	ins
		lea	text1(pc),a0	;Usage test
		move.l	#text1len,d3
ins	move.l	a0,d2
	jsr	-48(a6)			;write
	tst	flag
	beq	bye

	jsr	-54(a6)			;input
	move.l	d0,d1
	subq	#4,sp
	move.l	sp,d2
	moveq	#1,d3
	jsr	-42(a6)			;read
	addq	#4,sp
	exg	a6,a3
	sub	#$52,sp
	move.l	sp,a5
	clr.l	10(a5)
	lea	$30(a5),a4
	move.l	a4,14(a5)
	lea	10(a4),a4
	clr.l	(a4)+
	clr.b	(a4)+
	moveq	#-1,d0
	jsr	-$14a(a6)		;alloc signal (exec)
	move.b	d0,(a4)+
	sub.l	a1,a1
	jsr	-$126(a6)		;find task
	move.l	d0,(a4)+
	move.l	a4,(a4)
	addq.l	#4,(a4)
	clr.l	4(a4)
	move.l	a4,8(a4)
	move.l	a5,a1
	lea	trackdisk(pc),a0
	moveq	#0,d0
	move.b	unit(pc),d0
	moveq	#0,d1
	jsr	-444(a6)		;open device
	moveq	#10,d7
	tst.l	d0
	bne.s	faildevice

	move.l	a5,a1
	move	#3,28(a1)		;write command
	move.l	#$400,36(a1)		;length to write
	move.l	a2,40(a1)
	clr.l	44(a1)
	jsr	-456(a6)		;DoIo
	move.l	d0,d7
	move.l	a5,a1
	move	#4,$1c(a1)		;update disk
	jsr	-456(a6)
	move.l	a5,a1
	move	#9,$1c(a1)		;stop disk
	clr.l	$24(a1)
	jsr	-456(a6)
	move.l	a5,a1
	jsr	-450(a6)		;close device

faildevice
	move.b	$3f(a5),d0
	jsr	-336(a6)		;free signal
	add	#$52,sp
	move.l	bootptr(pc),a1
	move.l	#$400,d0
	jsr	-210(a6)		;free mem
bye	movem.l	(a7)+,d0-d7/a0-a6
	moveq	#0,d0
	rts

	even
trackdisk	dc.b 	'trackdisk.device',0,0
doslibrary	dc.b	'dos.library',0
bootptr	dc.l	0
unit	dc.w	0

text1	dc.b	$9b,'33mINSTALLER',$9b,'31m    by Quasar (Nov 1991) --',10
	dc.b	'Usage: BOOT {[e] [#]}',10
	dc.b	'	E.....Execute boot intro.',10
	dc.b	'	#.....Install boot intro in drive DFn:',10
text1len=*-text1

text2	dc.b	' Insert disk to be installed in "DF'
drive	dc.b	'n:"  & press <RETURN> '
text2len=*-text2

	even
**************************************************************************
			;boot block goes here     !!!!

boot:	dc.b	'DOS',0
	dc.l	0,$370


code:	move.l	4.w,a6
	movem.l	d0-d7/a0-a6,-(sp)
	MOVE.L	custom(pc),a5
	bset	#1,$bfe001
	btst	#10,$16(a5)
	beq	exit2

	tst.l	42(a6)
	bne.s	vir

	tst.l	$226(a6)
	beq.s	nov

vir	move	#$f03,color+2

nov	lea	gfxtxt(pc),a1		;open graphics lib
	jsr	-408(a6)
	move.l	d0,a6

	move.l	bitmap(pc),a1
	move	#$5000/4-1,d0
clear	clr.l	(a1)+
	dbf	d0,clear

reinit	move.l	adrs(pc),a0
	moveq	#1,d0			;depth
	move	#320*2,d1		;pixels per line !!!
	move	#256,d2
	jsr	-390(a6)		;init bitmap
	move.l	adrs+4(pc),a1
	move.l	bitmap(pc),-$f8(a1)
	jsr	-198(a6)		;init rastport
	move.l	adrs+4(pc),a1
	move.l	adrs(pc),4(a1)
	moveq	#1,d0
	jsr	-342(a6)		;set a pen

	tst.l	-$f8(a1)
	beq.s	reinit

	lea	text(pc),a5
	moveq	#0,d6
	bsr	typeit
	lea	text(pc),a5
	move	#320,d6
	bsr	typeit

**********************************************
begin	move.l	custom(pc),a5
	move	#$4000,$9a(a5)
	lea	copper(pc),a1
	move.l	a1,$84(a5)
	clr	$8a(a5)
	move	#$83f0,$96(a5)

	lea	$74000,a0		;create sprites
	moveq	#$2b,d0
	moveq	#1,d1
	moveq	#212/2-1,d7
mkspr	move.b	d0,(a0)+
	mulu	#54343,d2
	add	6(a5),d2
	move.b	d2,(a0)+
	addq	#1,d0
	move.b	d0,(a0)+
	addq	#1,d0
	clr.b	(a0)+
	move.l	d1,(a0)+
	dbf	d7,mkspr

	clr.l	$3f0.w

*---------------
main	cmp.b	#-1,6(a5)
	bne.s	main


					;********* scroll text toleft  <==
	lea	114*80+$70002,a0
	move	#$8440,$96(a5)
	move.l	#$e9f00000,$40(a5)	;bltcon0
	move.l  #$ffff0000,$44(a5)	;mask read all
	clr.l	$64(a5)			;source	mod
	move.l	a0,$50(a5)		;source		A
	subq	#2,a0
	move.l	a0,$54(a5)		;Destination	D
	move	#16*64+20,$58(a5)
	move	#$0400,$96(a5)

	lea	$3f0.w,a0		;if at newchar
	tst	(a0)
	beq.s	doscrol
		subq	#1,(a0)
		bra.s	dospr

doscrol	move	#4,(a0)			;***** place new character!! at right>
	cmp	#textend-scroltxt,2(a0)	;if last char
	ble.s	textok
		clr	2(a0)		;   reset cntr
textok	move	2(a0),d0
	addq	#1,2(a0)
	lea	scroltxt(pc),a1
	lea	buffer(pc),a5
	move.b	(a1,d0.w),3(a5)
	cmp.b	#'|',3(a5)
	bne.s	skip2
		move	#50,(a0)
		bra.s	dospr
skip2	moveq	#0,d6
	bsr	typeit
	lea	buffer(pc),a5
        move	#320,d6
	bsr	typeit


dospr	move.l	custom(pc),a5		;************ move stars!!
	lea	$74000,a0
	moveq	#218/2/4-1,d7
sprlp	addq.b	#1,1(a0)
	addq.b	#2,9(a0)
	addq.b	#3,17(a0)
	addq.b	#4,25(a0)
	add	#32,a0
	dbf	d7,sprlp

	btst	#6,$bfe001		;if left then exit
	beq.s	exit2
	btst	#10,$16(a5)		;if right then NTSC & exit
	bne	main
*------
exit	move.l	4.w,a6
	clr.l	$222(a6)		;kill resident!!
	clr.l	$226(a6)
	clr.l	$22a(a6)
	clr.l	42(a6)
exit2	move	#$c000,$9a(a5)
	move	#$0200,$100(a5)
	movem.l	(sp)+,d0-d7/a0-a6
	lea	dostxt(pc),a1
	jsr	-96(a6)
	move.l	d0,a0
	move.l	$16(a0),a0
	moveq	#0,d0
	rts
*---------------------------
typeit	move.l	adrs+4(pc),a1	;read rastport
	moveq	#0,d0
	moveq	#0,d1
	move.b	(a5)+,d5
	move.b	(a5)+,d0
	move.b	(a5)+,d1
	move.l	a5,a4
	cmp.b	#-1,d0
	bne.s	notfin		;stop text!!!
		rts
notfin	moveq	#-1,d7
count	addq.l	#1,d7
	cmp.b	(a5)+,d5
	bne.s	count

		lsl	#2,d0
		add	d6,d0
		jsr	-240(a6)	;move x,y
		move.l	adrs+4(pc),a1
		move.l	a4,a0		;set string addr
		move.l	d7,d0		;text length
		jsr	-60(a6)		;text
		subq	#1,a5
	bra.s	typeit

********************************************************************
copper	dc.l	$01002300,$01020001,$01080000,$010a0000
	dc.l	$008e2a81,$009020e1,$00920038,$009400d0
	dc.l	$00e00007,$00e20000,$00e40007,$00e60028
	dc.l	$01200007,$01224000,$01a40fff
color	dc.l	$01800777,$01820000,$01840fff,$0186058b ;main colors
	dc.l	$ffdffffe

	dc.l	$0a01fffe,$01800fff
	dc.l	$0b09fffe,$01800aaa

	dc.l	$0d09fffe,$01860ff0
	dc.l	$1109fffe,$01860fa0
	dc.l	$1409fffe,$01860f70
	dc.l	$1709fffe,$01860d00

	dc.l	$1e09fffe,$01800222
	dc.l	$1f09fffe,$01800777,-2


*-------------      X-4pix steps  Y-in pixels
text	dc.b	-1, 8, 10, '»»»  ASM ONE V1.02+  «««'
	dc.b	-1, 0, 18, '--------------------------------'
	dc.b	-1, 5, 50, 'For all your CODING needs!!'
	dc.b	-1,-1

scroltxt
	dc.b	'BB by QUASAR'
	dc.b	'..  |'
	dc.b	'|Press LMB to cont ...RMB to KILL VIRUS''s |||'
	dc.b	'ADDS:|buy Coke coz its mm mm good!!'
	dc.b	'|A3000 the power you need.'
	dc.b	'|HST modem  faster than light|||'
textend

buffer	dc.b	-1,38*2,120,' ',-1,-1
	even
*-------------
dostxt	dc.b	'dos.library',0
gfxtxt	dc.b	'graphics.library',0,0
bitmap	dc.l	$70000
adrs	dc.l	$75000,$75100
custom	dc.l	$dff000

ed	dc.w	$4afc,$4afc,0,0

x = ed-boot
left = 1024-x

