[comp.sys.amiga] Taking Over

derek@speedy.WISC.EDU (Derek Zahn) (07/02/87)

A question.  What is the procedure for "taking over the machine" from the
workbench (so the program can be guaranteed all the resources) and then
giving it back when finished?

Thanks.

derek

hadeishi@husc4.HARVARD.EDU (mitsuharu hadeishi) (07/02/87)

In article <3788@spool.WISC.EDU> derek@speedy.WISC.EDU (Derek Zahn) writes:
>A question.  What is the procedure for "taking over the machine" from the
>workbench (so the program can be guaranteed all the resources) and then
>giving it back when finished?

	Well, if you just want to make sure no other program steps on
anything (like screen structures, etc.) while you are modifying them,
then you have to do a Forbid()/Permit() which guarantees that you will
be the only task running.  This does not stop interrupts, however, which
you typically would not want to stop anyway.  These periods should be
SHORT, VERY SHORT, and should be used sparingly.  The only way to
guarantee access to all resources is to hardwire your program to take
over the machine at boot time, because if it is started later some other
task might have taken over some other resources (like the serial port, etc.)
before you started.  What kind of resources do you want to be "guaranteed"?
You realize the Amiga has a resource arbitration scheme so if another
task is using a resource you cannot have access to it?  In that case your
program should simply wait for the resource or die.  I really don't see
much use in taking over the machine unless you are a VERY processor-
intensive game program or something that needs all the sprites, etc.

				-Mitsu

derek@speedy.WISC.EDU (Derek Zahn) (07/03/87)

> What kind of resources do you want to be "guaranteed"?
> You realize the Amiga has a resource arbitration scheme so if another
> task is using a resource you cannot have access to it?  In that case your
> program should simply wait for the resource or die.  I really don't see
> much use in taking over the machine unless you are a VERY processor-
> intensive game program or something that needs all the sprites, etc.

That's it exactly.  A very processor-intensive game program.  I would like to
allow the user to just slip the disk in a drive (while booted in workbench),
play, then exit back to that workbench.  It has always bugged me that graphics
games (Marble Madness, Sinbad, etc) require rebooting.  This make sense?
Does it bother anyone else that you have to reboot if you want to play
Marble Madness for a while?

I hadn't thought of just using a Forbid()/Permit() pair in effect for the
whole duration of the game, and am still not sure that this is sufficient
(I am assuming that resource arbitration will not be a problem -- if some
resource is tied up, the user could easily be asked to kill the offending
program; a similar situation for memory needs).

p, ) t