[comp.unix.aux] Access to the Toolbox and Other Hardware Under A/UX

eberard@ajpo.sei.cmu.edu (Edward Berard) (10/24/88)

It has been mentioned that either "one has no access to the toolbox
under A/UX", or that "access to the toolbox under A/UX is different
that it is under the original Mac OS." I need some answers to the
following questions:

	1. The term "toolbox", as I understand it, refers only to a
	   specific part of the ROM in the Mac II, _not_to_all_the_
	   hardware_on_the_Mac_II. Is this correct? In any event, I am
	   concerned with gaining access to the entirety of the Mac
	   II's hardware. Please help me with my terminology.

	2. "No access to the toolbox" or "different access to the
	   toolbox" can be taken to mean any number of things. For
	   example, it could mean that no one has yet written the
	   necessary "glue routines" to bind C and Pascal routines to
	   the toolbox, or it could mean that there is no access to
	   any of the Mac II's hardware under any language due to some
	   implementation bug. I was informed by one source that this
	   bug would be fixed in version 1.1 of A/UX. If this is so,
	   when will version 1.1 be released, and does it fix this
	   bug?

	3. It occurs to me that complete access to the toolbox and
	   other hardware will involve more than just simple bindings.
	   What differences should one expect?

Thank you for any time and consideration.

				-- Ed Berard
				   (301) 695-6960

paul@unisoft.UUCP (n) (10/25/88)

In article <376@ajpo.sei.cmu.edu> eberard@ajpo.sei.cmu.edu (Edward Berard) writes:
>It has been mentioned that either "one has no access to the toolbox
>under A/UX", or that "access to the toolbox under A/UX is different
>that it is under the original Mac OS." I need some answers to the
>following questions:
>
>	1. The term "toolbox", as I understand it, refers only to a
>	   specific part of the ROM in the Mac II, _not_to_all_the_
>	   hardware_on_the_Mac_II. Is this correct? In any event, I am
>	   concerned with gaining access to the entirety of the Mac
>	   II's hardware. Please help me with my terminology.

	Correct, 'toolbox' applications under A/UX run in user mode.
	If you want to access the hardware you have two choices:

		- for a program that doesn't need access to interrupt
		  hardware you can run a normal program as root and
 		  use the phys() system call (a Unix call rather than 
		  a toolbox call) to map the hardware into you processes
		  address space, then you can just poke at it. This works
		  well for things like frame buffers etc

		- anything else needs a 'traditional' unix driver written
		  for it.

	I believe that Apple have said that programs that access the 
	hardware directly may not run on future versions of the MacOS
	(and obviously hardware)

>	2. "No access to the toolbox" or "different access to the
>	   toolbox" can be taken to mean any number of things. For
>	   example, it could mean that no one has yet written the
>	   necessary "glue routines" to bind C and Pascal routines to
>	   the toolbox, or it could mean that there is no access to
>	   any of the Mac II's hardware under any language due to some
>	   implementation bug. I was informed by one source that this
>	   bug would be fixed in version 1.1 of A/UX. If this is so,
>	   when will version 1.1 be released, and does it fix this
>	   bug?

	You can write an A/UX toolbox Application 2 ways:

		- in the MacOS world, then cart the application over whole
		  and use the 'launch' command to run it

		- using the glue that they provide, this way you can actually
		  mix Unix and toolbox calls in the same application

>	3. It occurs to me that complete access to the toolbox and
>	   other hardware will involve more than just simple bindings.
>	   What differences should one expect?

	Some toolbox calls are not implemented under A/UX 1.0, more are
	said to be implemented in the forthcoming 1.1 (in fact PixelPaint
	runs unmodified). Things that seem to be missing have mainly to do
	with real-time sorts of things like sound etc


		Paul
-- 
Paul Campbell, UniSoft Corp. 6121 Hollis, Emeryville, Ca ..ucbvax!unisoft!paul  
Nothing here represents the opinions of UniSoft or its employees (except me)

	"Where was George?" - Nudge, nudge say no more

dwb@Apple.COM (David W. Berry) (10/25/88)

In article <376@ajpo.sei.cmu.edu> eberard@ajpo.sei.cmu.edu (Edward Berard) writes:
>It has been mentioned that either "one has no access to the toolbox
>under A/UX", or that "access to the toolbox under A/UX is different
>that it is under the original Mac OS." I need some answers to the
>following questions:
>
>	1. The term "toolbox", as I understand it, refers only to a
>	   specific part of the ROM in the Mac II, _not_to_all_the_
>	   hardware_on_the_Mac_II. Is this correct? In any event, I am
>	   concerned with gaining access to the entirety of the Mac
>	   II's hardware. Please help me with my terminology.
	When speaking of the Macintosh Toolbox, one is referring to
the large set of routines in the ROM which present the user with
what has come to be known as the macintosh look and feel.  There
are routines to display and control windows and Scrollbars and
other gadgets.  The vast majority of the Macintosh toolbox is available
under A/UX.  With Release 1.0 the notable exceptions are the Color
Manager, and the Print Manager.  As a matter of fact, a growing
number of Macintosh applications will run under A/UX by simply
copying them off of the vendor's distribution floppy into the
UNIX file system.
	In addition to being able to run Macintosh binaries, users
are able to compile and run A/UX specific binaries that also have
full access to the toolbox.
	Being UNIX the user is protected from the hardware.  (Or is that
the hardware is protected from the user, I can never remember)  Since the
phys system call is implemented you could still get to it, but your
taking your systems life in your hands...
>
>	2. "No access to the toolbox" or "different access to the
>	   toolbox" can be taken to mean any number of things. For
>	   example, it could mean that no one has yet written the
>	   necessary "glue routines" to bind C and Pascal routines to
>	   the toolbox, or it could mean that there is no access to
>	   any of the Mac II's hardware under any language due to some
>	   implementation bug. I was informed by one source that this
>	   bug would be fixed in version 1.1 of A/UX. If this is so,
>	   when will version 1.1 be released, and does it fix this
>	   bug?
	Well, the restriction on being able to directly access the
hardware will be here awhile.  Note that this is really a restriction
carried over from the UNIX world, not a bug.  Allowing users arbitrary
access to the hardware on a multiuser machine is a security hole
about the size of manhattan.  In the future managers which allow limited
access to the hardware in controlled manners will be implemented.
These managers already exist under the Mac OS (Serial Manager, SCSI 
anager, etc.)  and have always been the only sanctioned way of accessing
the hardware.
	The glue routines are there for the portions of the toolbox
that are supported.  Release 1.0 has the MPW 2.0 bindings (with
automatic string conversion)  Release 1.1 will have the MPW 3.0
bindings which don't have automatic string conversions in the
properly cased calls but does have string conversion for all
lower-case versions of the names.
>
>	3. It occurs to me that complete access to the toolbox and
>	   other hardware will involve more than just simple bindings.
>	   What differences should one expect?
	I guess it all boils down to what do you mean by complete
access to the hardware?  If you want to go out and directly fiddle
with the VIA, forget it.  You shouldn't even do that under the Mac OS.
If you just want to be able to use the color monitors, serial,
etc.  no problem, the routines are all in place.

>
>Thank you for any time and consideration.
>
>				-- Ed Berard
>				   (301) 695-6960




Opinions:  MINE, ALL MINE! (greedy evil chuckle)

David W. Berry
apple!dwb@sun.com	dwb@apple.com	973-5168@408.MaBell