	SECTION	RipKickROM,CODE
*
	INCLUDE	"exec/types.i"
	INCLUDE	"exec/exec.i"
	INCLUDE	"libraries/dos.i"
*
	xref	_AbsExecBase		exec.library base address
	xref	_LVOOpenLibrary		exec.library	subroutine
	xref	_LVOCloseLibrary	exec.library	subroutine
	xref	_LVOOpen		dos.library	subroutine
	xref	_LVOClose		dos.library	subroutine
	xref	_LVOWrite		dos.library	subroutine
*
	movea.l	_AbsExecBase,a6		Move exec.library address
	cmpi.l	#2,d0			Check for Entered Filename
	blt.s	useit			None entered, goto useit
	move.b	#0,-1(a0,d0.L)		else, overlay '0a'x with '00'x
	move.l	a0,d4			 and save Filename address
	bra.s	OpenLib			goto OpenLib
useit	lea	FName,a0		Load address of Default Filename
	move.l	a0,d4			 and save it
OpenLib	lea	Dname,a1		Load dos.library
	moveq.l	#0,d0			 version 0
	jsr	_LVOOpenLibrary(a6)	 and open it
	movea.l	d0,a6			Move dos.library address
	move.l	d4,d1			Move address of Filename
	move.l	#MODE_NEWFILE,d2	Mode = OUTPUT
	jsr	_LVOOpen(a6)		Open file
	tst.l	d0			test open
	beq.s	ClosLib			Bad open, goto ClosLib
	move.l	d0,d4			Save File pointer in d4
	move.l	d0,d1			Move File pointer to d1
	move.l	#$f80000,d2		Move KickROM address to d2
	move.l	#524288,d3		Move 512K to d3
	jsr	_LVOWrite(a6)		Write file
	move.l	d4,d1			Move File pointer to d1
	jsr	_LVOClose(a6)		Close file
ClosLib	move.l	a6,a1			Load dos.library address
	movea.l	_AbsExecBase,a6		Load exec.library address
	jmp	_LVOCloseLibrary(a6)	Jump to CloseLibrary
*					CloseLibrary will return to System
FName	dc.b	"RAM:KickStart.ROM",0
Dname	dc.b	"dos.library",0
Version	dc.b	"$VER: RipKickROM 2.1 (4.11.95)",0
	end
