The Official Way to Software Reboot an Amiga

      The Official Way to Software Reboot an Amiga - Bryce Nesbitt

* Copyright 1988 Commodore-Amiga, Inc.

*  

* Executables based on this information may be used in software

* for Commodore Amiga computers.  All other rights reserved.

* This information is provided "as is"; no warranties are made.  All 

* use is at your own risk. No liability or responsibility is assumed.



A number of Amiga programmers have had the need to reboot the machine

from within a program.  Since no official guidelines have ever been

published, programmers have used various creative methods.


Unfortunately rebooting the machine is very tricky, and most attempts

have been flawed.  The RESET instruction, for example, unconfigures

all memory; after RESET there is no place to run user code!

Most reboot code will break whenever the memory or CPU configuration

is changed.  Other reset code will not work properly on the Amiga 1000.

A special sequence of operations is required to work with all the possible

memory and processor options available for the Amiga.


What follows is the one-and-only official supported way to reboot an Amiga

under software control.




****************************************************************************

*

*   NAME

*       ColdReboot - reboot the Amiga

*

*   SYNOPSIS

*       ColdReboot()

*

*       void ColdReboot(void);

*

*   FUNCTION

*       Reboot the machine.  All external memory and peripherals will be

*       RESET, and the machine will start its power up diagnostics.

*

*       The MagicResetCode must be used exactly as specified here.

*       The MagicResetCode must be longword aligned.  Failure to

*       duplicate the code EXACTLY will result in improper operation

*       under certain system configurations.

*

*   RESULT

*       This function never returns.

*

****************************************************************************

                XDEF    _ColdReboot


                XREF    _LVOSupervisor


_ColdReboot:

                move.l  4,a6                    ;Get a pointer to ExecBase

                lea.l   MagicResetCode(pc),a5   ;Location of code to RUN

                jsr     _LVOSupervisor(a6)      ;RUN code in Supervisor mode

        ;[NOTE: The jsr is required even though Supervisor never returns.]


;-------------- MagicResetCode ---------DO NOT CHANGE-----------------------

                CNOP    0,4     ;IMPORTANT!  Longword align!  Do not change!

MagicResetCode:

                lea.l   2,a0    ;Point to JMP instruction at start of ROM

                RESET           ;all RAM goes away now!

                jmp     (a0)    ;Rely on prefetch to execute this instruction

;---------------------------------------DO NOT CHANGE----------------------- 


                END




Comments

Popular posts from this blog

BOTTOM LIVE script

Evidence supporting quantum information processing in animals

ARMIES OF CHAOS