[net.micro.mac] Macho 128K ROMs

darin@ut-dillo.UUCP (Darin Adler) (04/11/86)

<>

I recently posted an INIT resource (that I foolishly named "NoQuiche") and
its source code to net.sources.mac.  The following are some ramblings about
it.  These are not all in comprehensible English; even those who Hertzfeld
called the "Inside Mac crowd" might find it confusing.

------
QUICHE

NoQuiche installs patches for a number of ROM routines.  It doesn't do much,
but what it does has far-reaching effects.

---------------
DRAW VS. UPDATE

NoQuiche replaces calls to DrawDialog and DrawControls with calls to
UpdtDialog and UpdtControl.

The new ROM supplies some nice routines called UpdateDialog and
UpdateControls.  These routines are like the old DrawDialog and DrawControls
calls except that they only draw the items within a specific region.  They
are much faster for complex lists of items.

My first reaction upon seeing these routines was:  "Great, now ResEdit will
be faster!"  ResEdit uses the Dialog Manager heavily for TMPL-style resource
editors and they are quite slow to draw.  I hoped that Gene Pope had made
a check of the ROM version and used the new, faster routines when they were
available.  When I found that this was not yet the case (I hope that it
will, eventually), I decided that I would have to try it myself, to see if
there really would be a gain in speed.  This was the original reason for
writing NoQuiche.

All calls to DrawDialog while NoQuiche is installed are replaced with calls
to UpdateDialog with the region equal to the visRgn of the current port.
Similarly, calls to DrawControls are replaced with calls to UpdateControls.
For normal use of these routines, this should not be a problem, but in some
obscure cases (recording of pictures, perhaps) some difficulties might
arise.

------------
FONT SCALING

NoQuiche disables font scaling by default (each time InitFonts is called).

To understand about what "no font scaling" means, one good place to look is
Andy Hertzfeld's document about the new Font Manager.  For those that do
not have access to that document, and for anyone else that is interested,
the following:

If FScaleDisable is TRUE (the default with "NoQuiche" installed), the only
font scaling that will take place is scaling by powers of two.  Thus 24
point will still be scaled to 12 point, 18 will be scaled to 9, but 24 will
NOT be scaled to 14.  When a font size that is not present is asked for,
the nearest size that can be made is used, and spacing is scaled
appropriately.  That means that if you ask for Athens 12, and you only have
Athens 18, you will get Athens 18, scaled down by a factor of two
(Athens 9?), but it will be spaced as if it were a 12 point version.  Is
this desirable?  I think so.  It gets rid of the ugliest effects of scaling,
but still allows you to position characters precisely.

The best way to understand the above is to put in the "NoQuiche" patch and
try out various font sizes in your favorite editor and other programs.

----------------
ROM RESOURCE MAP

NoQuiche always enables the ROM resource map.

At the MacWorld Expo, in January, I spoke to an engineer from Apple (who
apparently worked on the new Resource Manager).  I asked why the ROM
resources were not always available, like the resources from the System
file.  He told me that 9 of the top 10 programs would not work if the ROM
resource map was present.  Soon afterward, I noticed some embarassing things
about the ROM resources.  For example, the GetCursor call does not search
the ROM resource map, so that, although the CURS 1-4 resources are in ROM,
they are never used by the Mac Plus (until now!).  The CURS resources from
the System file are always loaded!  Looking with Waldemar Horwat (the author
of TMON), another embarrasing bug was found.  The ROM contains a bug that
seems to prevent "supercharged resource files" from ever working (although I
have not verified this).

Enabling the ROM resources in your own program is problematical:  to do it,
you have to set a byte at addresss $B9E (ROMMapInsert).  Unfortunately, this
means that there is no subtle way to enable the ROM resource map because this
address is in the middle of the system heap on a old ROM Mac!  So, to enable
the ROM resources, you have to check which ROM you are under and then set
ROMMapInsert in front of each affected Resource Manager call.

What most people will do with these resources in their own programs is
ignore them.  In most cases, this is fine, since the resources are mostly
"System"-type resources, used directly by the ROM itself.

In addition, the list of the resources in ROM that is in the Macintosh Plus
technical note is inaccurate!  It claims that CDEFs 0-1 are in the ROM --
they are not.  It does not mention the presence of the Chicago FONT in the
ROM, nor of CURS 4 (the watch).

NoQuiche always enables the ROM resource map.  This *should* cause lots of
problems, but I have only seen one so far.  ResEdit has trouble editing
(or removing) resources from the System file that are also present in the
ROM, if NoQuiche is present.

--------------
BUGS BUGS BUGS

NoQuiche causes bugs.  Lots of bugs.  I don't know if it will ever be useful,
except as a novelty.  Currently, it works with most applications I've tried
it with (those that already work on the Mac+), but does not seem to work with
printing code.

Boy, does this flush out bugs.  One bug is particularly nasty.  Once you use
the Font/DA Mover (with or without "NoQuiche") any packages that are
contained only in ROM will NOT be available to the System.  To verify this
for yourself, take the PACK 7 resource out of any System file on a Mac+.
Everything will work fine.  Now open Font/DA Mover and quit back to the
Finder.  If your machine has not crashed already, all you have to do is pull
down the About menu item and you will see a pretty bomb.  (All this with
Font/DA Mover version 3.1, System 3.  (All this with Font/DA Mover 3.1,
System 3.1.1, Finder 5.2).  All these problems because of an innocent-
looking line of assembly code in Font/DA Mover:

	CLR.W	CurMap

------------------
I LIKE THE NEW ROM

Don't get me wrong, I am impressed with the 128K ROM (unlike some other
Mac programmers I know).  I think the engineers at Apple did a good job.
But, it's more fun to complain about the problems than to comment about
what I like.

---------------------------
I HOPE THIS WAS INTERESTING

Well, if you made it this far, I hope you found this interesting.  If you
have any comments, send me mail.


-- 
Darin Adler	...!ut-sally!ut-dillo!darin	darin@dillo.CC.UTEXAS.EDU

"...'cause they don't go for what's in the book and that makes 'em bad..."
								Frank Zappa