[comp.sys.mac.programmer] A Few Technical Questions

chaffee@uvm-gen.UUCP (Alex D. Chaffee) (10/16/88)

(1) 

For the past several months I've been programming with LS C, with
liberal use of MacsBug.  Many of my system bombs are easily recovered
from by using ES (Exit-To-Shell) or EA (Exit-To-Application).  Many of
them are totally beyond recovery. Occasionally, I will exit from
Macsbug and everything will run fine -- except that the mouse and
keyboard have become disconnected.  Is there a trap I can execute from
Macsbug that will reinitialize the Desktop Bus, so that I don't have
to reboot?

(2)

If I take the time to select "Shut Down" from the Finder, the next
time I boot my hard disk (an internal HD20SC - in my Mac SE with1 MB
RAM) it takes maybe a second to display the "Welcome to Macintosh"
dialog.  If I don't select Shut Down, the drive is active for more
than a minute - I've got a very full hard disk - before it continues.
I'd like to know, first of all, what the HD thinks it's doing during
this interminable pause; second, exactly what "Shut Down" does (I've
seen DAs that park the heads on a SCSI drive, so I presume that Shut
Down does not park); third, if there's anything I can do to fix it --
if there's no general fix, maybe there's some way I can access the
Shut Down code from Macsbug after an unrecoverable crash... (I can
hear you all thinking, "Fat chance..!")

(3)

Is there any way to get SelectDialog to return me the part code of the
control that was just pressed in a modeless dialog?  I've got a dialog
with scroll bars whose elevators work fine, but the arrows and grey
area remain blind to the world...  I caught the tail end of the Dialog
discussion on this board, so I presume that Dialogs don't like
Controls very much.  It doesn't hurt to ask, though -- right?

Thanks in advance,

Alex Chaffee
chaffee@uvm-gen.uvm.edu

mystone@caen.engin.umich.edu (Dean Yu) (10/17/88)

In article <940@uvm-gen.UUCP>, chaffee@uvm-gen.UUCP (Alex D. Chaffee) writes:
> 
> (1) 
> 
> For the past several months I've been programming with LS C, with
> liberal use of MacsBug.  Many of my system bombs are easily recovered
> from by using ES (Exit-To-Shell) or EA (Exit-To-Application).  Many of
> them are totally beyond recovery. Occasionally, I will exit from
> Macsbug and everything will run fine -- except that the mouse and
> keyboard have become disconnected.  Is there a trap I can execute from
> Macsbug that will reinitialize the Desktop Bus, so that I don't have
> to reboot?

  If you have the ADB keyboard and mouse, disconnecting them then reconnecting
them will defrost them, since they self-initialize when they get
connected.  If you're running on anything less than an SE, you should
probably get the mouse defroster FKEY from SUMEX.  

> (2)
> 
> If I take the time to select "Shut Down" from the Finder, the next
> time I boot my hard disk (an internal HD20SC - in my Mac SE with1 MB
> RAM) it takes maybe a second to display the "Welcome to Macintosh"
> dialog.  If I don't select Shut Down, the drive is active for more
> than a minute - I've got a very full hard disk - before it continues.
> I'd like to know, first of all, what the HD thinks it's doing during
> this interminable pause; second, exactly what "Shut Down" does (I've
> seen DAs that park the heads on a SCSI drive, so I presume that Shut
> Down does not park); third, if there's anything I can do to fix it --
> if there's no general fix, maybe there's some way I can access the
> Shut Down code from Macsbug after an unrecoverable crash... (I can
> hear you all thinking, "Fat chance..!")

  What's happening here is that when you shut down, if you're not parking
the heads, it's at least moving them closer to the boot blocks.  If you just
restart, it leaves the heads where they wre when you restarted, so it has to
seek all over the platters for the boot blocks.  And considering the speed of
an HD20, even an SC...  (Sorry, I couldn't resist!  ;)  )  
  If you REALLY wanted to shutdown from MacsBug, I suppose you could...
Find the trap for _ShutDown (I cant' remember what it is, off hand.) and
do a hex modify and put in the trap for that, then Go to the address that
you put the trap in.  That SHOULD work.  I don't know if MacsBug is doing
something, or if there's a reason why you can't shut down from MacsBug, so
try this at your own risk!

> (3)
> 
  I haven't had to deal with the Dialog Manager too much in my ravings, so
I'll pass the torch on this one.

______________________________________________________________________________
Dean Yu                            |  E-mail:    mystone@caen.engin.umich.edu
University of Michigan             |  Real-mail: Dean Yu
Computer Aided Engineering Network |             2413 Kelsey House
===================================|             600 E Madison
"These are MY opinions." (My       |             Ann Arbor, MI 48109
 employer doesn't want them.       |==========================================
 Actually, they don't really care  |
 what I think.  But President      |   This space intentionally left blank.
 Duderstadt does...)               |
------------------------------------------------------------------------------

lsr@Apple.COM (Larry Rosenstein) (10/17/88)

In article <3f185fcb.129dc@blue.engin.umich.edu> mystone@caen.engin.umich.edu (Dean Yu) writes:
>
>  What's happening here is that when you shut down, if you're not parking
>the heads, it's at least moving them closer to the boot blocks.  If you just
>restart, it leaves the heads where they wre when you restarted, so it has to
>seek all over the platters for the boot blocks.  And considering the speed of

This is not true.  It has nothing to do with head position.

If you don't use the Finder ShutDown command, the File Manager does some
basic checks on the disk the next time it is mounted.  If you do use
ShutDown, then the File Manager sets a flag on the disk indicating that it
was shut down normally.

Macsbug 6.0 has the RS command that attempts to do a Restart. 

		 Larry Rosenstein,  Object Specialist
 Apple Computer, Inc.  20525 Mariani Ave, MS 46-B  Cupertino, CA 95014
	    AppleLink:Rosenstein1    domain:lsr@Apple.COM
		UUCP:{sun,voder,nsc,decwrl}!apple!lsr

dorourke@polyslo.CalPoly.EDU (David M. O'Rourke) (10/18/88)

In article <3f185fcb.129dc@blue.engin.umich.edu> mystone@caen.engin.umich.edu (Dean Yu) writes:
>  What's happening here is that when you shut down, if you're not parking
>the heads, it's at least moving them closer to the boot blocks.  If you just
>restart, it leaves the heads where they wre when you restarted, so it has to
>seek all over the platters for the boot blocks.

  Two things.  By definition the Boot Blocks are locatated on track 1 (0?), so
I don't know too many HD's that have to "seek all over the platters" to find
track one.  I believe the reason that the HD's seek all over the platters when
you don't choose shut down is because the Mac's filing system maintains a
"shutdown" bit or something to indicate if the drive was closed out properly.
If this "shutdown" bit isn't set properly then the drive assumes that there
might have been some files left open, so it scans the disk looking for
inconsistancies in the file structure that it can rectify.  This if for when
the power goes out while your still in an application, ect...

  Or course I might be wrong :-)  Anyone from Apple care to clear this up??
-- 
David M. O'Rourke                                  dorourke@polyslo.calpoly.edu

"If it doesn't do Windows, then it's not a computer!!!"
Disclaimer: I don't represent the school.  All opinions are mine!

alexis@ccnysci.UUCP (Alexis Rosen) (10/21/88)

In article <3f185fcb.129dc@blue.engin.umich.edu> mystone@caen.engin.umich.edu
(Dean Yu) writes:
>In article <940@uvm-gen.UUCP>, chaffee@uvm-gen.UUCP (Alex D. Chaffee) writes:
>> (2)
>> If I take the time to select "Shut Down" from the Finder, the next
>> time I boot my hard disk (an internal HD20SC - in my Mac SE with1 MB
>> RAM) it takes maybe a second to display the "Welcome to Macintosh"
>> dialog.  If I don't select Shut Down, the drive is active for more
>> than a minute - I've got a very full hard disk - before it continues.
>> I'd like to know, first of all, what the HD thinks it's doing during
>> this interminable pause; second, exactly what "Shut Down" does [...]

>  What's happening here is that when you shut down, if you're not parking
>the heads, it's at least moving them closer to the boot blocks.  If you just
>restart, it leaves the heads where they wre when you restarted, so it has to
>seek all over the platters for the boot blocks.  And considering the speed of
>an HD20, even an SC...  (Sorry, I couldn't resist!  ;)  )  


You can't be serious! Even the SC's access time is measured in milliseconds.

In fact, ShutDown calls UnMountVol, which writes some sort of status bit to the
drive before it closes everything down. When the volume is first mounted (or
sometime around then, I don't remember exactly) a dirty bit is set. When it is
unmounted (or put offline, maybe?) the dirty bit is cleared. This bit may or
may not be associated with the catalog and extents files. I just looked in IM
and couldn't find anything on this, so I assume I read it in some tech note.

----
Alexis Rosen                       alexis@dasys1.UUCP  or  alexis@ccnysci.UUCP
Writing from                       {allegra,philabs,cmcl2}!phri\
The Big Electric Cat                                       uunet!dasys1!alexis
Public UNIX                           {portal,well,sun}!hoptoad/