[comp.sys.amiga.programmer] Query: How to destroy WB and Kickstart?

ia0i+@andrew.cmu.edu (Indu Tara Agarwal) (04/02/91)

I know this may sound odd, especially since it concerns a game.  But I've
noticed some behavior that intrigues me; specifically:

1) I bought a "boot-up" game called Batman from Data East.
2) I own an A1000, so the problem/behavior may only occur on these machines
  (requiring to boot with Kickstart)
3) You boot up with the game, no problem.
4) When you give the Amiga the 3-finger reset/salute, the workbench picture
does NOT reappear.  Apparently the game does SOMETHING to the OS.

My question is this:  what specific things/events are being sabotaged
(probably) so that you have to TURN OFF the machine and restart with Kickstart?
If this is peculiar to A1000 machines, I'd like to know why/how/etc. as well.

Thanks in advance...

P.S. If any of this seems vague, it's because I want it that way.  I'd like
to get as many different explanations as possible.  Also, upon resetting the
Amiga, if no disk is inserted, the disk drive just spins incessantly.

ecarroll@maths.tcd.ie (Eddy Carroll) (04/02/91)

In article <0by0qu_00WB68MaWZ5@andrew.cmu.edu> ia0i+@andrew.cmu.edu
(Indu Tara Agarwal) writes:
> [ Trying to reset out of Batman on the A1000 hangs the system badly. ]
>
>My question is this:  what specific things/events are being sabotaged
>(probably) so that you have to TURN OFF the machine and restart with Kickstart?

When the Amiga is booting, one of the first things it does is to see if
ExecBase is intact. If so, then it can assume that certain system lists are
already in place and can, for example, mount things like RAD: and various
other programs that survive warm boots (like AddMemForever and Guardian).
If ExecBase isn't intact, then no assumptions are made about the system at
all and everything in the system is created afresh. This is the situation when
you power on.

The integrity checks for ExecBase are fairly simple. One of the checks for
example checks a certain word in where ExecBase seems to be (according to
location $4). If this word is not the two's complement of the real ExecBase
address, then it is assumed ExecBase is garbage. There are a few other similar
checks made as well. When you reboot after a crash and find that RAD: has
vanished, it means that ExecBase failed the integrity check and a cold start
was performed.

Now, if a game throws out the OS and starts writing all over memory, it is
possible for it to leave ExecBase intact but mess up some of the lists that
Exec assumes are okay. When this happens, Exec will try to do a warm boot but
will run into trouble when it comes across the corrupt list. This will usually
lead to a GURU or straight into a reboot, whereupon exactly the same thin
happens again, ad infinitum...

Another possible source of startup crash might be if $4 contained an odd
address; when the boot code tried to access the elements in ExecBase, an
address error would occur on the 68000. However, the boot code may guard
against this (I can't check since I'm not at my Amiga).

The way for programmers to avoid the problem is to either zap location 4 or
(better) zap the complement word in ExecBase that I mentioned above. (This is
better because it doesn't kill the system immediately, it just forces a cold
boot the next time you reset). This zapping should be done at the start of
the game, to allow a safe reset out at any time.

Quite a few early Amiga arcade games used to have this reset problem, and it
was incredibly annoying. It wouldn't have been so bad if they were crummy
games, but some of them were great games apart from that. I don't know how
many of the current crop of games suffer from this, but I would hope it's a
much smaller number.

Eddy
-- 
Eddy Carroll           ----* Genuine MUD Wizard  | "You haven't lived until
ADSPnet:  cbmuk!cbmuka!quartz!ecarroll           |    you've died in MUD!"
Internet: ecarroll@maths.tcd.ie                  |   -- Richard Bartle

darren@cbmvax.commodore.com (Darren Greenwald) (04/03/91)

In article <0by0qu_00WB68MaWZ5@andrew.cmu.edu> ia0i+@andrew.cmu.edu (Indu Tara Agarwal) writes:
>I know this may sound odd, especially since it concerns a game.  But I've
>noticed some behavior that intrigues me; specifically:
>
>1) I bought a "boot-up" game called Batman from Data East.
>2) I own an A1000, so the problem/behavior may only occur on these machines
>3) You boot up with the game, no problem.
>4) When you give the Amiga the 3-finger reset/salute, the workbench picture
>does NOT reappear.  Apparently the game does SOMETHING to the OS.
>

The may have used the Write Control Store memory?

rhialto@cs.kun.nl (Olaf'Rhialto'Seibert) (04/06/91)

In article <1991Apr2.154016.26566@maths.tcd.ie> ecarroll@maths.tcd.ie (Eddy Carroll) writes:
>In article <0by0qu_00WB68MaWZ5@andrew.cmu.edu> ia0i+@andrew.cmu.edu
>(Indu Tara Agarwal) writes:
>> [ Trying to reset out of Batman on the A1000 hangs the system badly. ]
>>
>>My question is this:  what specific things/events are being sabotaged
>>(probably) so that you have to TURN OFF the machine and restart with Kickstart?
>
>When the Amiga is booting, one of the first things it does is to see if
>ExecBase is intact.

Actually, on a 1000, the first thing that happens is that the BOOT ROM
kicks in at adress 0. It checks first if an intact KickStart is
present, and if not loads it from a KickStart disk. Then it enters
KickStart and does the things you describe.

An interesting thing is, that on entry to the KickStart, the WCS is
write-protected, and at the same time the boot ROM is made invisible.
It will never come back unless you also write-enable the WCS. This can
be done most conveniently by jumping to the RESET instruction just
before the initial KS entry point, which in its turn is indicated in
the second longword in the KS (or somewhere around there). The
interesting thing is that the boot ROM structure is the same as the KS
structure so that on 500s and 2000s the KS could (and does?) work as
boot ROM.

For further info, use a disassembler to look at your boot ROM (at
$f8_0000).

--
Olaf 'Rhialto' Seibert                               rhialto@cs.kun.nl
How can you be so stupid if you're identical to me? -Robert Silverberg