minow@decvax.UUCP (Martin Minow) (09/20/87)
#if 0
This illustrates how to emulate the white button (warmstart) or
power-switch on an Atari. It *should* be compatible with the new roms.
Normally, you would add the guts to an existing program.
Martin Minow
decvax!minow
#endif
/*
* Reboot an Atari ST. This program is in the public-domain.
* Martin Minow, Arlington MA 02174, USA.
*/
#include <osbind.h>
#include <linea.h>
#define OS_memvalid (*((long *) 0x420L))
#define OS_memval2 (*((long *) 0x43AL))
#define OS_resvalid (*((long *) 0x426L))
#define OS_restart (*((int(*)()) 0xFC0000L))
main()
{
int hardboot;
long oldstack;
hidemouse();
Cconws("\033EX or x to hardboot, anything else to softboot: ");
hardboot = Cconin() & 0xFF;
oldstack = Super(0L); /* Get into super mode */
if (hardboot == 'X'
|| hardboot == 'x') {
OS_memvalid = 0L; /* Invalidate the OS */
OS_memval2 = 0L; /* "up and running" */
OS_resvalid = 0L; /* flags. */
}
OS_restart(); /* Imitate system reset */
Super(oldstack); /* We never get here */
}