[comp.sys.mac.misc] Using the Programmer's Switch

glf@sppy00.UUCP (Hill) (12/18/90)

On occasion, while playing with new INITs etc or for whatever reason,
my Plus will lock up.  So, I reach for the big restart button on the
side.  You know, one of the two on the side of the machine.  What I'd
like to know is how to use the OTHER button.  

I know that pushing it gets me the window with a > in the upper left
corner and I know that there's SOMETHING I can type there to make the
finder or some other application active, but I don't know what that
something is.

I don't have any debuggers or any such toys, so if it isn't built in,
I can't use it (unless I can ftp it).  Anyone have a list of things I
can do from this window?

Thanks,
    -=< Greg >=-
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Greg Feldman-Hill  {seismo|cbosgd}!osu-cis!sppy00!glf  -OR-  gfh@rsch.oclc.org
OCLC - Online Computer Library Center ...  Dublin, Ohio      
    "If winning is not important, then Commander, why keep score?" -- Worf

aslakson@cs.umn.edu (Brian Aslakson) (12/18/90)

glf@sppy00.UUCP (Hill) writes about the programmer's switch:
>I know that pushing it gets me the window with a > in the upper left
>corner and I know that there's SOMETHING I can type there to make the
>finder or some other application active, but I don't know what that
>something is.

>I don't have any debuggers or any such toys, so if it isn't built in,
>I can't use it (unless I can ftp it).  Anyone have a list of things I
>can do from this window?

I'd like to see a list too, but for now I can add this (which I just
found today):
	SM 0 A9F4<return>
	G 0<return>
Which is supposed to get you back to the app so that you can save before
restarting.


Sometimes I can get back to the finder with just:
	G<return>

A9F4 is a trap, and G 0 means start executing at memory location 0, I believe.

If you have an SE, try:
	G 41D89A


Brian
-- 
.signature: No such file or directory

swansond@cube05.csus.edu (Dennis Swanson) (12/19/90)

In article <1990Dec18.052752.8420@cs.umn.edu> aslakson@cs.umn.edu (Brian Aslakson) writes:
>glf@sppy00.UUCP (Hill) writes about the programmer's switch:
>>I know that pushing it gets me the window with a > in the upper left
>>corner and I know that there's SOMETHING I can type there to make the
>>finder or some other application active, but I don't know what that
>>something is.
>
>>I don't have any debuggers or any such toys, so if it isn't built in,
>>I can't use it (unless I can ftp it).  Anyone have a list of things I
>>can do from this window?
>
>I'd like to see a list too, but for now I can add this (which I just
>found today):
>	SM 0 A9F4<return>
>	G 0<return>
>Which is supposed to get you back to the app so that you can save before
>restarting.
>
>
>Sometimes I can get back to the finder with just:
>	G<return>
>
>A9F4 is a trap, and G 0 means start executing at memory location 0, I believe.
>
>If you have an SE, try:
>	G 41D89A
>
>
>Brian
>-- 
>.signature: No such file or directory

The only other one I know of is G FINDER. I think just plain G will take you
back to the app. I'd also like to see a list of handy/fun things to type into
this window, and/or the subset of macsbug commands the built-in supports. Any-
one out there in the know?

	Den

|    Dennis M. Swanson     |           INTERNET: swansond@csus.edu            |
| Computer Science Student |        UUCP: ...!uunet!csus.edu!swansond         |
| Macintosh Lab Assistant  | University Computing and Communications Services |
| "Harness the Macpower!"  |     California State University, Sacramento      |

dwal@ellis.uchicago.edu (David Walton) (12/19/90)

In article <1990Dec18.164136.14761@csus.edu> swansond@cube05.csus.edu (Dennis Swanson) writes:
[Assorted questions and info about the ROM Debugger deleted]

>I'd also like to see a list of handy/fun things to type into
>this window, and/or the subset of macsbug commands the built-in supports. Any-
>one out there in the know?

>|    Dennis M. Swanson     |           INTERNET: swansond@csus.edu           |

Herewith, an explanation of the ROM debugger commands, shamelessly cut-and-
pasted from Tech Note #38.  (It's a bit long, yes, but not so much so that
I thought it would be harmful to post it in its entirety.)


=======================================================================

The debugger in ROM (not present on the Macintosh 128, Macintosh 512,
or Macintosh XL) recognizes the following commands:

PC [expr]   (program counter)

Typing PC on a line by itself displays the program counter. Typing PC 50000 sets the program counter to $50000.

SM [address [number(s)]]   (set memory)

Typing SM on a line by itself displays the next 96 bytes of memory.
Typing SM 50000 will display memory starting at $50000. Typing SM
50000 4849 2054 6865 7265 2120 will set memory starting at $50000 to
$4849I Subsequently hitting Return will increment the display a
screen at a time.

DM [address]   (display memory)

Typing DM on a line by itself displays the next 96 bytes of memory.
Typing DM 50000 will display memory at $50000. Subsequently hitting
Return will increment the display a screen at a time.

SR [expr]   (status register)

Typing SR on a line by itself displays the status register. Typing SR
2004 sets the status register to $2004.

TD   (total display)

Displays memory at the RmagicS location $3FFC80, which contains
the current values of the registers. The registers are displayed in
the following order: D0-D7, A0-A7, PC, SR.

G [address]  (go)

Executes instructions starting at address. If G is typed on a line by
itself, execution begins at the address indicated by the program
counter.

NOTE: If you want to exit to the shell, you just need to type: SM 0 A9F4,
then G 0

NOTE: If you crash into the debugger and the system hangs, try turning off
your modem.


================================================

Some folks have already mentioned how to exit to the Finder (either
'SM 0 A9F4', 'G 0' or 'G Finder' will work).  You should probably
restart using the Finder's Restart command after doing this, because
the System will most likely be in an uncertain (read unstable) state.
You can also (sometimes, depending on how nasty your crashes were)
restart the machine from the ROM debugger by entering

	SM 0 3F3C 0002 A895
	G 0

You can shut down the machine completely by substiting '0001' for
'0002'.  (Thanks to earlier incarnations of the THINK Pascal manual
for that tip.)
--
David Walton            Internet: dwal@midway.uchicago.edu
University of Chicago   {  Any opinions found herein are mine, not  }
Computing Organizations {  those of my employers (or anybody else). }

ingemar@isy.liu.se (Ingemar Ragnemalm) (12/19/90)

aslakson@cs.umn.edu (Brian Aslakson) writes:

>glf@sppy00.UUCP (Hill) writes about the programmer's switch:
>>I know that pushing it gets me the window with a > in the upper left
>>corner and I know that there's SOMETHING I can type there to make the
>>finder or some other application active, but I don't know what that
>>something is.

>>I don't have any debuggers or any such toys, so if it isn't built in,
>>I can't use it (unless I can ftp it).  Anyone have a list of things I
>>can do from this window?

>I'd like to see a list too, but for now I can add this (which I just
>found today):
>	SM 0 A9F4<return>
>	G 0<return>
>Which is supposed to get you back to the app so that you can save before
>restarting.

>Sometimes I can get back to the finder with just:
>	G<return>

>A9F4 is a trap, and G 0 means start executing at memory location 0, I believe.

At MacPlus and SE, I use the A9F4 trick all the time, but why doesn't this
seem to work on a Mac II?

Also, CrashSaver, the nice little INIT that makes the interrupt button
return you to Finder (great emergency exit from home-developed programs!)
doesn't seem to work with MacII. Is there a good substitute?
(I think it is my *right* to kill a process if I want to. If a program
hangs and I know what I'm doing, I don't want to reboot the machine.)

And, isn't it possible to get a programmer's switch for LC or IIsi?
My dealer say it isn't. Can the "Pkey INIT" help me out? (I don't have
access to any LC or IIsi to try it on at the moment.) (In case you didn't
know, Pkey is a nice little INIT that turns the start button in the corner
of the keyboard into an interrupt switch.)


--
Ingemar Ragnemalm
Dept. of Electrical Engineering	     ...!uunet!mcvax!enea!rainier!ingemar
                  ..
University of Linkoping, Sweden	     ingemar@isy.liu.se

dwal@ellis.uchicago.edu (David Walton) (12/20/90)

In article <ingemar.661619127@stuart> ingemar@isy.liu.se (Ingemar Ragnemalm) writes:
>
>At MacPlus and SE, I use the A9F4 trick all the time, but why doesn't this
>seem to work on a Mac II?

Whether the _ExitToShell call (trap A9F4) works depends on what kind
of condition the Macintosh is in following a crash.  If something's
gone off and stomped all over the System heap, it may not work.  I've
been generally successful when using the ROM debugger both to return
to the Finder (Exit To Shell) and to Reboot or Shut down.

>[stuff deleted]
>And, isn't it possible to get a programmer's switch for LC or IIsi?
>My dealer say it isn't. Can the "Pkey INIT" help me out? (I don't have
>access to any LC or IIsi to try it on at the moment.) (In case you didn't
>know, Pkey is a nice little INIT that turns the start button in the corner
>of the keyboard into an interrupt switch.)

Your dealer is correct: there's not programmer's switch.  On these
models, the start button is the programmer's switch, in combination
with a set of modifier keys: Command-Control-Power restarts the
machine, and Command-Power generates a non-maskable interrupt.  I
believe that Macsbug version 6.2b1 minimum must be installed for the
NMI to be generated.  Some INITs, I think (perhaps Programmer's Key)
will let you map these sequences to a different combination.

>Ingemar Ragnemalm




--
David Walton            Internet: dwal@midway.uchicago.edu
University of Chicago   {  Any opinions found herein are mine, not  }
Computing Organizations {  those of my employers (or anybody else). }

jimb@silvlis.com (Jim Budler) (12/23/90)

In article <ingemar.661619127@stuart> ingemar@isy.liu.se (Ingemar Ragnemalm) writes:
>Also, CrashSaver, the nice little INIT that makes the interrupt button
>return you to Finder (great emergency exit from home-developed programs!)
>doesn't seem to work with MacII. Is there a good substitute?

I have acquired something called Bomb Shelter, which seems to have the
same function. It works on my MacIIsi, but I don't use it anymore, since
I have a debugger. It was written by Andrew Welch.

>And, isn't it possible to get a programmer's switch for LC or IIsi?
>My dealer say it isn't. Can the "Pkey INIT" help me out? (I don't have
>access to any LC or IIsi to try it on at the moment.) (In case you didn't
>know, Pkey is a nice little INIT that turns the start button in the corner
>of the keyboard into an interrupt switch.)

Two options. Beg borrow or steal a copy of Macsbug 6.2b1 or newer. I have
been advised not to mail it to people. It's on AppleLink, so any dealer
can get it. Whether they will or not is another story.

The other option is ProgrammersKEY. I believe it is a newer version of
the PKey you mentioned. It does work on a MacIIsi.

I will send ProgrammersKEY and/or Bomb Shelter by mail, if requested.
I also have the Think C source for Bomb Shelter as a seperate package
I will send on request.

>
>Ingemar Ragnemalm
>Dept. of Electrical Engineering
>University of Linkoping, Sweden	     ingemar@isy.liu.se

jim
--
     __           __
     /  o         /      Jim Budler      jimb@silvlis.com      |  Proud
    /  /  /\/\   /__    Silvar-Lisco, Inc.  +1.408.991.6115    | MacIIsi
/__/  /  /   /  /__/   703 E. Evelyn Ave. Sunnyvale, Ca. 94086 |  owner