Path: utzoo!mnetor!uunet!husc6!bloom-beacon!mit-eddie!ll-xn!ames!pasteur!ucbvax!DBNUAMA1.BITNET!VBRANDT
From: VBRANDT@DBNUAMA1.BITNET
Newsgroups: comp.sys.atari.st
Subject: Fix for ETERNAL to work on Mega STs
Message-ID: <8805101853.AA24225@ucbvax.Berkeley.EDU>
Date: 10 May 88 18:53:55 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The Internet
Lines: 60
X-Unparsable-Date: Tue, 10 May 88 18:01:18 SET



I recently posted an enquiry to this newsgroup concerning my problems running
Turtle and TurboDOS om my Mega ST 4. As an aside, I mentioned that I was able
to fix ETERNAL to run with 4 MB.

Several (in fact, two ;-) people emailed me asking what the fix for ETERNAL
was. Since this might be interesting for other people also, I decided to post
it here. Please do not hesitate to correct me if I'm wrong. Here's my view of
what happens:

One of the few differences in hardware between the 'regular ST' and the 'Mega'
is the behavior of the system when a non-existant memory location is read.
Remember that the ST 'MMU' can handle up to 4 MB RAM. Trying to read a non-
existing memory location that is below 4 MB merely returned garbage data (I
think it was a constant but I don't remember which) on the 'old' ST. Doing this
on a Mega gives you a bus error (two bombs).

The system variable '_phystop' points to the first non-existant memory location
(on a 1040 ST, to $10000 = 1 MB). This value is decreased by ETERNAL to protect
the RAM disk area. The RAM disk effectively pretends to 'just not be there'.
Therefore, after installing ETERNAL,  _phystop points to the first word of the
RAM disk area. This word is the start of the RAM disk BPB and contains $200
(sector length in bytes).

When starting ETERNAL, the program determines if it is already installed by
simply reading the first non-existant memory word and checking if that turns
out to be $200. If it doesn't, ETERNAL installs itself. If it does, ETERNAL
just tweaks the three hard disk vectors to point to the RAM disk driver which
it assumes to be there.

On a Mega ST, the attempt to determine if ETERNAL is resident results in --
you guessed it -- a bus error. What I've done is to check if _phystop is
exactly 4 MB -- ETERNAL can't be installed then, right ?   This makes my
version of ETERNAL work with the old STs and with a Mega 4. I'm not sure what
to do about a Mega 2. Checking for exactly 2 MB won't do: suppose you have
a resident utility using up exactly 2 MB on a Mega 4. What should ETERNAL do
in that case ?

I've also changed the installation procedure:  my configuration utility now
modifies the executable directly, thus eliminating the need for a separate
read-in of the data file ("\AUTO\RAMDISK.DAT") and speeding up the boot process
a little. A possible solution would be to add an option to the configuration
program allowing Mega users to specify their memory size (2 or 4 MB) that
_phystop is checked against.

Other improvements I'm planning to add are:

   - displaying a message stating drive identifer and disk size, and whether
     it's a first-time installation or a restart
   - setting up a complete boot sector so that disk editors, unerase utilities
     and the like have a better chance to work on the RAM disk
   - incorporating the resident driver into the boot sector, thus saving the
     grand total of 512 bytes (wow!)

If anyone's interested in my ETERNAL, email me. If there are enough people
who want it, I'll post it (the improvements will take a while yet ;-).

Bitnet:  VBRANDT@DBNUAMA1                              Volker A. Brandt
UUCP:    ...!unido!DBNUAMA1.bitnet!vbrandt (?)         Angewandte Mathematik
ARPAnet: VBRANDT%DBNUAMA1@CUNYVM.CUNY.EDU (?)          (Bonn, West Germany)