
_LVODoIO		=	-456
_LVOFindResident	=	-96

READ			=	2
MOTOR			=	9

bootblock:	dc.b	"DOS",0			;DOS marker (we are bootable)
		dc.l	0			;Bootblock checksum store
		dc.l	880			;Rootblock marker (unused)

codestart:	movem.l a0-a6/d0-d7,-(sp)	;preserve regs (IMPORTANT!)

*-------------- read blocks from disk into memory..

		move.l	4.w,a6
		move.w	#READ,28(a1)		;read command
baz_length1	move.l	#10*512,36(a1)		;length in blocks (variable)
baz_start1	move.l	#$40000,40(a1)		;load to segment adr (variable)
		move.l	#2*512,44(a1)		;prog always at block 2 onwards
		jsr	_LVODoIO(a6)		;load it

		move.w	#$83f0,$dff096		;turn dma back on..

		move.w	#MOTOR,28(a1)		;turn off drive motor
		clr.l	36(a1)
		jsr	_LVODoIO(a6)

baz_execute1	jsr	$40000			;execute our code 
		movem.l (sp)+,a0-a6/d0-d7	;get old values back

		lea 	DOSLib(pc),a1		;enter the CLI as normal
		jsr	_LVOFindResident(a6)
		tst.l	d0
		beq.s	boot_error

		movea.l	d0,a0
		movea.l 22(a0),a0
		moveq	#0,d0
		rts

boot_error	moveq	#-1,d0		;Whoops, there seems to be a problem!
		rts			;Signal error and return

DOSLib:		dc.b	"dos.library",0
		even
		ds.b	1024
