
; Boot-O-Matic (BootBlock v1.1) 
; Coded by Nekron...


************************** Library-Funktionen *********************

Execbase=	4
OldopenLib=	-408
CloseLib=	-414
FindResident=	-96

GFXLENGHT=	42*8	;42 * 64 Pixel Gfx.
Debug=	0		;0 For Boot-Installation!

************************** Hauptprogramm *************************
 
	OPT P+
	IFNE	Debug
	SECTION	Boot-test,CODE_C
	ENDC

	IFEQ	Debug
	dc.b	"DOS",0		Kennzeichen
	dc.l	0		Checksumme
	dc.l	$370		Root-Block!
	ENDC
Begin
	movem.l	a0-a6/d0-d7,-(SP)

	IFEQ	Debug
	lea	Beg2(PC),a0		Kopiere Bootblock nach
	lea	$50000,a1		$50000!
	move.w	#Bootend-Beg2,d0
copy
	move.b	(a0)+,(a1)+
	dbf	d0,copy
	jmp	$50000
	ENDC
Beg2
	bsr.s	VCheck			Teste ob Virus?
	bsr.s	Install			Installiere Gfx.
	bsr	Getkey			Lese Tastatur!
	movem.l	(SP)+,a0-a6/d0-d7

	IFEQ	Debug
	lea	DosName(PC),a1
	jsr	FindResident(a6)	Übernommen aus ...
	move.l	d0,a0			... normalem DOS-Bootblock.
	move.l	$16(a0),a0
	clr.l	d0
	ENDC

	rts

VCheck
	clr.w	d0
	move.l	(Execbase).w,a6
	tst.l	42(a6)			Cold-Capture?
	bne.s	virus
	tst.l	46(a6)			Cool-Capture?
	bne.s	virus
	tst.l	546(a6)			Resident?
	bne.s	virus
	tst.l	550(a6)			Kicksum überprüfen!
	bne.s	virus
	rts
virus
	lea	Trapy(PC),a0
	move.l	a0,$0080.w		Virus zerstören!
	trap	#0
Trapy
	clr.l	38(a6)
	jmp	$f80002			Reset(Kick 1.2+1.3)

Install
	lea	$dff000,a6
	lea	Bootend(PC),a0
	move.w	#40*200,d0
insloop1
	clr.b	(a0,d0.w)		Screen löschen
	dbf	d0,insloop1
	lea	Plane+6(PC),a1
	lea	Plane+2(PC),a2
	move.w	a0,(a1)
	move.l	a0,d0			Screen setzen!
	swap	d0
	move.w	d0,(a2)
	lea	PlaneB+6(PC),a1
	lea	PlaneB+2(PC),a2
	adda.w	#40,a0
	move.w	a0,(a1)			Zweite Screen setzen!
	move.l	a0,d0			(Schatteneffekt!)
	swap	d0
	move.w	d0,(a2)
	
	lea	NewCopper(PC),a0
	move.w	#%0000000010100000,$96(a6)
	move.l	a0,$80(a6)			Neue CopperList
	clr.l	$88(a6)
	move.w	#%1000001111000000,$96(a6)

	move.w	#%0000100111110000,$40(a6)
	sf	$42(a6)
	st	$44(a6)
	st	$46(a6)
	lea	MenuGfx(PC),a0			Blitter die ...
	move.l	a0,$50(a6)			Bootblock-Gfx!
	lea	Bootend+40*85+16(PC),a0
	move.l	a0,$54(a6)
	sf	$64(a6)
	move.w	#32,$66(a6)
	move.w	#%0000101010000100,$58(a6)
blwait
	btst	#14,$2(a6)
	bne.s	blwait				Warte auf Blitter!
	rts

Getkey
	clr.b	$bfec01
	clr.l	d0
keywait
	bsr.s	Flash
	move.b	$bfec01,d0
	not.b	d0
	asr.w	#1,d0
	cmpi.b	#$50,d0		Einzelabfragen um später ...
	beq.s	keyok		... Tasten sperren zu können!
	cmpi.b	#$51,d0
	beq.s	keyok
	cmpi.b	#$52,d0
	beq.s	keyok
	cmpi.b	#$53,d0
	beq.s	keyok
	bra.s	keywait
keyok
	move.b	d0,$00c8.w

	lea	GfxName(PC),a1
	move.l	(Execbase).w,a6
	jsr	OldopenLib(a6)
	move.l	d0,a6
	move.l	38(a6),$dff080
	clr.l	$dff088
	move.w	216(a6),d6		Größe des DOS-Windows...	
	move.l	a6,a1
	move.l	(Execbase).w,a6
	jsr	CloseLib(a6)
	cmpi.w	#$00ff,d6		mit 255 Zeilen vergleichen!
	blo	virus

	move.w	#%1000001111111111,$dff096
	rts

Flash
	lea	FlWait(PC),a0
	subi.w	#1,(a0)
	bne.s	flashend
	move.w	#$0dff,(a0)
	lea	Color4+2(PC),a0		Flash-Routine
	lea	Color+6(PC),a2
	lea	Color3+6(PC),a3
	lea	Color2+6(PC),a4
	lea	Table(PC),a1

	move.w	(a1),(a0)
	move.w	(a1),4(a0)
	move.w	(a1),d1		Verschiedene Werte setzen!
	move.w	d1,d0
	not.w	d0
	andi.w	#$f00,d0
	move.w	d0,(a2)
	move.w	d0,(a3)
	not.w	d0
	andi.w	#$f00,d0
	move.w	d0,(a4)
flashloop
	move.w	2(a1),(a1)
	adda.w	#2,a1		Tabelle verschieben
	cmpi.w	#-1,(a1)
	bne.s	flashloop
	move.w	d1,-2(a1)
flashend	
	rts

************************** Gfx-Daten und Tabellen ****************

DosName		dc.b	"dos.library",0
GfxName		dc.b	"graphics.library",0
		EVEN

NewCopper
		dc.w	$008e,$2c81,$0090,$f4c1
		dc.w	$0092,$0038,$0094,$00d0
		dc.w	$0108,$0000,$010a,$0000
		dc.w	$0102,$0020,$0104,$0000
		dc.w	$0100,$2200
Plane		dc.w	$00e0,$0000,$00e2,$0000
PlaneB		dc.w	$00e4,$0000,$00e6,$0000

		dc.w	$0180,$0000,$0184,$0000
Color		dc.w	$780f,$fffe,$0180,$0000
Color2		dc.w	$7d0f,$fffe,$0180,$0000
Color3		dc.w	$af0f,$fffe,$0180,$0000
		dc.w	$b40f,$fffe,$0180,$0000
Color4		dc.w	$0182,$0000,$0186,$0000 	
		dc.w	$0,$b
		EVEN

Table		dc.w	0,$111,$222,$333,$444,$555,$666,$777,$888
		dc.w	$999,$aaa,$bbb,$ccc,$ddd,$eee,$ddd,$ccc
		dc.w	$bbb,$aaa,$999,$888,$777,$666,$555,$444
		dc.w	$333,$222,$111,0,-1
		EVEN

FlWait		dc.w	$0dff
		EVEN

MenuGfx
		dcb.b	GFXLENGHT

DummyTx		dc.b	"  BOOM v1.1   (C)08/90 BY PROTON."
		EVEN

Bootend
		IFNE	Debug
		ds.l	(40*201)/4
		ENDC

