START	move.l	$4.w,a6
	cmpi.w	#37,LIB_VERSION(a6)
	bcs.s	quit
	jsr	_LVOForbid(a6)
	move.l	#Patch,d0
	move.w	#_LVOColdReboot,a0
	move.l	a6,a1
	jsr	_LVOSetFunction(a6)
	lea	START-4(pc),a0
	clr.l	(a0)
	jsr	_LVOCacheClearU(a6)
	jsr	_LVOPermit(a6)
quit	moveq	#0,d0
	rts

	dc.b	"$VER: RebootPatch 1.0 (12.3.95) by Martin Berndt",0

	section	PatchCode,CODE_C

Patch	jsr	_LVOCacheClearU(a6)
	moveq	#0,d0
	moveq	#-1,d1
	jsr	_LVOCacheControl(a6)
	jsr	_LVODisable(a6)
	jsr	_LVOSuperState(a6)
	move.w	#$4000,$dff09a
	move.w	AttnFlags(a6),d0
	btst	#AFB_68030,d0
	beq.s	.reboot
	btst	#AFB_68040,d0
	bne.s	.mmu040

	opt	p=68030

	clr.l	-(sp)
	pmove.l	(sp),tc
	pflusha
	addq.w	#4,sp
	bra.s	.reboot

	opt	p=68040

.mmu040	moveq	#0,d0
	movec	d0,tc
	pflusha

	opt	p=68000

.reboot	lea	$1000004,a4
	suba.l	-$18(a4),a4
	move.l	(a4),a4
	subq.w	#2,a4
	bra.s	.reset
	cnop	0,4
.reset	reset
	jmp	(a4)

	end
