*************************************************
* RESET.a					*
* Perform a hardware reset.			*
* D.M. Balean					*
*						*
* 4-9-92	Using 3rd Edition reset code.	*
*		36 bytes			*
*************************************************

		INCDIR	Devpac:include/

		INCLUDE "exec/types.i"
		INCLUDE "exec/execbase.i"
		INCLUDE	"exec/exec_lib.i"

MAGIC_ROMEND		equ	$01000000	;End of Kickstart ROM
MAGIC_SIZEOFFSET	equ	-$14		;Offset from end to size



*****************************************************************
* Modified from Amiga Harware Manual- 3rd Edition, page 224	*
* Forces a reboot of the system for all Amiga models		*
*****************************************************************

RESET		movea.l	$0004,A6		;Get Exec
		lea.l	.ResetCode(PC),A5	;Location of code
		jsr	_LVOSupervisor(A6)	;Start code (must use JSR)

;Although this has to be a JSR, control never returns here....


		CNOP	0,4			;Must be longword aligned

.ResetCode	lea.l	MAGIC_ROMEND,a0		;End of ROM
		sub.l	MAGIC_SIZEOFFSET(a0),a0	;End - Size = PC
		move.l	4(a0),a0		;Initial PC
		subq.l	#2,a0			;Point to 2nd reset
		RESET				;First RESET
		jmp	(A0)	;Rely on prefetch to execute this instruction

;RESET and JMP must share a longword....

		END

