[comp.sys.atari.st] Software Reset

tellabs.canada@canremote.uucp (TELLABS CANADA) (11/19/89)

Required with the utmost urgency is a (C, Modula2 <-preffered) routine
to perform a rather cold reset (re-load auto folder etc.) in pre tos1.4
and tos1.4 machines. I'd be eternally grateful.
 
Roman (at Tellabs Canada)
 
#include<disclaimer.h>
 
Tellabs doesn't know what I'm saying (and its a good thing..)
---
 * Via ProDoor 3.1R 

hcj@lzaz.ATT.COM (HC Johnson) (11/21/89)

In article <89112004371539@masnet.uucp>, tellabs.canada@canremote.uucp (TELLABS CANADA) writes:
> Required with the utmost urgency is a (C, Modula2 <-preffered) routine
> to perform a rather cold reset (re-load auto folder etc.) in pre tos1.4
> and tos1.4 machines. I'd be eternally grateful.
>  


Howard C. Johnson
ATT Bell Labs
att!lzaz!hcj
hcj@lzaz.att.com


Subject: Simple program to reboot an Atari ST
Message-ID: <152@decvax.UUCP>
Date: 20 Sep 87 19:04:56 GMT
Reply-To: minow@decvax.UUCP (Martin Minow)
Distribution: world
Organization: Digital Eq. Corp. - Merrimack NH.
Lines: 40

#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	*/
}

hyc@math.lsa.umich.edu (Howard Chu) (11/22/89)

Just a couple comments on this...

In article <866@lzaz.ATT.COM> hcj@lzaz.ATT.COM (HC Johnson) writes:
%In article <89112004371539@masnet.uucp>, tellabs.canada@canremote.uucp (TELLABS CANADA) writes:
%> Required with the utmost urgency is a (C, Modula2 <-preffered) routine
%> to perform a rather cold reset (re-load auto folder etc.) in pre tos1.4
%> and tos1.4 machines. I'd be eternally grateful.
%>  
%
%
%Howard C. Johnson
%ATT Bell Labs
%att!lzaz!hcj
%hcj@lzaz.att.com
%
%
%Subject: Simple program to reboot an Atari ST
%Message-ID: <152@decvax.UUCP>
%Date: 20 Sep 87 19:04:56 GMT
%Reply-To: minow@decvax.UUCP (Martin Minow)
%Distribution: world
%Organization: Digital Eq. Corp. - Merrimack NH.
%Lines: 40
%
%#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	*/
%}

Lessee if I can get in before kbad does.  }-)  You shouldn't assume that
the ROM lives at 0xFC0000, 'cause it can move around on you.
A better way would have been to declare a pointer to the reset function,
and set that the 0x42a, the resvector system variable. Then jump
thru the pointer.

A question - why doesn't anyone just use the 68000 RESET instruction?
--
 -=- PrayerMail: Send 100Mbits to holyghost@father.son[127.0.0.1]
 and You Too can have a Personal Electronic Relationship with God!

gert@fwi.uva.nl (Gert Poletiek) (11/22/89)

In article <10141@stag.math.lsa.umich.edu> hyc@math.lsa.umich.edu (Howard Chu) writes:
...Stuff deleted...
>
>A question - why doesn't anyone just use the 68000 RESET instruction?
>--
> -=- PrayerMail: Send 100Mbits to holyghost@father.son[127.0.0.1]
> and You Too can have a Personal Electronic Relationship with God!

The reset instruction asserts system reset to all peripheral devices (such as
the mk68901); it does NOT reset the mc68000 itself.
-- 
Gert Poletiek  Dept. of Math. and Computing Science, University of Amsterdam,
               Kruislaan 409, NL-1098 SJ  Amsterdam, The Netherlands
Internet:      gert@fwi.uva.nl                   uucp:          gert@uva.uucp
bitnet:        gert%fwi.uva.nl@mcvax.bitnet