[net.micro.mac] How to

chi@wlbr.UUCP (Isaacs) (03/29/85)

    The following tiny piece of code is an addition to the System file that
will cause the resume key on the system bomb box to be enabled if the current
application doesn't support it.  The resume function will attempt to exit to
the finder.  This actually works in a suprisingly large number of cases.  It's
very handy to have this if you're using a ram disk.

    To install:
    
    1)  Convert the binhex (2.1) file resume.hcx to resume, a file containg
	a single resource of type INIT, id=3.
    2)  Use RMover or the Resource Editor to put it in any desired System files
        The id can be changed, but should be the next available number above
        the previously existing INITs.  The resource must be set for system heap
        and locked.
    3)  When you boot a system containing this resource it will be loaded into
        the system heap where it will attempt to help you resume.
        
    Caveats:
    
    1)  There are a fair number of bombs that trash the system so heavily that
        it cannot get back to the finder.
    2)  This does use a (very) small amount of your system heap space.
    3)  It is theoretically possible that the attempt to resume will cause major
        trauma to your disks that would not have occured if you had simply
	rebooted the system, although we haven't seen this in our months of use.
        
;
; resume.s
;
;     This function is intended to be stored as a resource in systems.
; As a type INIT, this will be executed when the system is booted.  The
; code in this resource is executed at three different times, when the
; system is booted, when the trap function InitDialog is called, and
; when resume is selected from the system bomb box.
;     The resume selection will return the user to the shell if that's
; possible.
;     Note that INIT resources must start with a branch to the install
; code to work correctly.
;
; January 1985 by Richard C. Zulch @ Computer Advantage
;

    macro   _SetTrapAddress
            dc.w    $a047
    endm

    macro   _GetTrapAddress
            dc.w    $a146
    endm

    macro   _ExitToShell
            dc.w    $a9f4
    endm

InitDialogs equ     $17b



start       bra     install      ;entry point at sys startup time

intrinit    tst.l   4(a7)        ;entry point when InitDialog is called
            bne     ii10         ;don't do anything if applic supports resume

            lea     exit(PC),a0
            move.l  a0,4(a7)
ii10        move.l  initaddr(PC),-(a7)
            rts

exit        _ExitToShell         ;entry point when "Resume" pressed

initaddr    ds.l    1

install     move    #InitDialogs,d0
            _GetTrapAddress
            lea     initaddr(PC),a1
            move.l  a0,(a1)
            lea     intrinit(PC),a0
            move    #InitDialogs,d0
            _SetTrapAddress
            rts
---


(This file must be converted with BinHex.Hex)
#$0000
***COMPRESSED
***RESOURCE FORK
(    0    $\    /    #D@(" @($IU;'D@,30L(#$Y
(#@T#7H-"B@D6DT@(TDN3D V3C _2U\B)%M-(5PH1#L_
($=$-$I765DB6"HC*#P@(" @)0T**"9<)C]$)2XW1%E5
(#)*5UE3)C@D/T-=0"%"6$U>/%$S05M:35X_(48M12I-
( T**"]'3#(G2U\N0EH_,TI4("Y$6DT@6"DN3D!(3B97
(% @-C]++#P@.$LP+T=4#0HH)%I:(%PA(DL_1T G0E=:
("(D0B<R+#TN-T1953]$)2XW1%E5*29765DE*DT-"B@O
($=$*T!(+$%0(" @(#5/(4=9(3-%62X]-$I-7CQ11B$G
(    #A@   >2J\ !&8   I!^@ ,+T@ !"\Z  9.=:GT
(      P/ %[H49#^O_T(HA!^O_6,#P!>Z!'3G4   $ 
(    3P    \    .0 !' @ /@   !P ,@  24Y)5   
%0 *  ,  %       1P<!E)E<W5M90
***END OF DATA
***CRC:764B