[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: firstname.lastname@example.org(Darryn Kozak)
- Subject: Re: register-trap
- From: email@example.com
- Date: Fri, 28 Aug 1992 01:38:03 -0700
- Cc: firstname.lastname@example.org
> I have some questions regarding the definition of fsopen below.
> 1. How do you know what registers to use for arg's?
> 2. How do you know what registers to use for the selector?
> 3. How do you know what registers to use for return values?
In the case of this trap (_HFSDispatch), as near as I can tell from New
Inside Macintosh: Files, you "just know". But...this is a very common
pattern: A0 containing a pointer to a parameter block, a selector (when
used) in D0, and D0 being set to an error code result. (The older Inside
Macs were a little more explicit. If you have to construct one of these
and don't "know", copy another one.
> 4. Which routine will be called: OpenDF, PBHOpenDF or
> PBOpenDF? (and why?)
PBHOpenDF. OpenDF doesn't exist. (That is, OpenDF is a creature of
higher-level languages, which take their parameters, stuff them into a
(surprise) parameter block, and make the PB... call (and then do the right
thing with the return value, which sometimes is to stash it somewhere, and
sometimes is simply to return it (by moving it onto the stack in Pascal,
and perhaps, but not here, moving it to a different register in C).
But...there is no OpenDF routine in the ROM to call. NIM: Files makes no
mention of PBOpenDF, by the way (consistent with the rest NIM: Files, which
doesn't cover MFS volumes). Afterthought: it seems to me that the
difference between PBHOpenDF and PBOpenDF, if there is a difference, is
flagged in the "other bit" (10 or 9) of the trap word. Don't bet the farm
on that one.
> 5. Why is only one arg. (pb) supplied when OpenDF takes 3,
> PBOpenDF takes 2, and PBHOpenDF takes 2.
The asynch parameter (a boolean) is an oddity, which gets stuffed into
one of the bits of the trap code (bit 9 or 10...I'd have to check). Why
the Mac team did this one this way back in the early 1980s, I've never
really known. It's "magic". Some other parameters are treated like this,
too (eg, the case sensitive and diacritical sensitive flags in the
EqualString utility call).
> 6. What is the error code -50? (I assume it means the trap call
> is not available.)
error code -50 is "paramater error". I'm not sure under what conditions,
if any, this trip will produce it.
> 7. Is this stuff documented somewhere?
New Inside Macintosh: Files will become the standard reference. For now,
IM-VI will do until you get the new book (you NEED the new series of
books...many of the Tech Notes are being absorbed into them and will be
discontinued as Tech Notes). IM-V or IV can be helpful in some areas like
which register is used for what.
John W. Baxter email@example.com My incorrect opinions are my
own...someone else probably supplied my one correct opinion.
I'd really rather be sailing.