home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / progrmng / thinkc32.sit / onexit.c.bin < prev    next >
MacBinary  |  1989-09-14  |  4.0 KB  |  [TEXT/KAHL]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert AMOS Picture Packer (image/amosPicturePacker) ext Supported
1% dexvert Debian floppy split (archive/debianFloppySplit) ext Unsupported
1% dexvert Sound Images sound sample (audio/soundImagesSoundSample) ext Unsupported
1% dexvert DESI-III drawing (image/desiIIIDrawing) ext Unsupported
1% dexvert MS-DOS PMODE extender executable (executable/msdosPMODEExtenderExecutable) ext Unsupported
1% dexvert Alien Trilogytextures (other/alienTrilogyTextures) ext Unsupported
1% dexvert APT cache data (other/aptCacheData) ext Unsupported
1% dexvert CorelTRACE configuration (other/corelTRACEConfiguration) ext Unsupported
1% dexvert Dreamcast Disc (other/dreamcastDisc) ext Unsupported
1% dexvert EST flat binary (other/estFlatBinary) ext Unsupported
1% dexvert Finale Enigma Binary Format (other/finaleEnigmaBinaryFormat) ext Unsupported
1% dexvert Sega Genesis/Megadrive/32x ROM (other/genesisROM) ext Unsupported
1% dexvert Myth: The Fallen Lords game archive (other/mythTheFallenLordsGameArchive) ext Unsupported
1% dexvert Sound Images Sound Driver (other/soundImagesSoundDriver) ext Unsupported
1% dexvert Symantec/Norton Config (other/symantecNortonConfig) ext Unsupported
1% dexvert Vectrex ROM (other/vectrexROM) ext Unsupported
1% dexvert BIS raP encoded format (other/bisraPEncoded) ext Unsupported
1% dexvert Pascal Script binary (other/pascalScriptBinary) ext Unsupported
1% dexvert 7th Level game data archive (other/seventhLevelGameDataArchive) ext Unsupported
1% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Binary Text (image/binaryText) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary, Wed Feb 5 12:01:18 1986, modified Wed Jan 25 06:44:56 1989, creator Think C, type ASCII, 3960 bytes "onexit.c" default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 1 default (weak)
100% lsar MacBinary default
100% gt2 MAC Bilddatei default (weak)
100% unp64ID P64 Guessed entry=$0803, unpacker=$0000%0A (Unknown) default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[KAHL]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 6f 6e 65 78 69 74 | 2e 63 00 00 00 00 00 00 |..onexit|.c......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4b 41 48 | 4c 00 00 00 00 00 00 00 |.TEXTKAH|L.......|
|00000050| 00 00 00 00 00 0f 78 00 | 00 00 00 9a 6d 42 5e a0 |......x.|....mB^.|
|00000060| 03 63 b8 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.c......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000080| 0d 2f 2a 0d 20 2a 20 20 | 6f 6e 65 78 69 74 2e 63 |./*. * |onexit.c|
|00000090| 20 2d 20 43 6f 70 79 72 | 69 67 68 74 20 28 43 29 | - Copyr|ight (C)|
|000000a0| 20 31 39 38 39 20 62 79 | 20 53 79 6d 61 6e 74 65 | 1989 by| Symante|
|000000b0| 63 20 43 6f 72 70 2e 20 | 20 41 6c 6c 20 72 69 67 |c Corp. | All rig|
|000000c0| 68 74 73 20 72 65 73 65 | 72 76 65 64 2e 0d 20 2a |hts rese|rved.. *|
|000000d0| 0d 20 2a 20 20 53 68 75 | 74 64 6f 77 6e 20 72 6f |. * Shu|tdown ro|
|000000e0| 75 74 69 6e 65 73 20 69 | 6e 73 74 61 6c 6c 65 64 |utines i|nstalled|
|000000f0| 20 77 69 74 68 20 22 6f | 6e 65 78 69 74 22 20 61 | with "o|nexit" a|
|00000100| 72 65 20 63 61 6c 6c 65 | 64 20 6f 6e 6c 79 20 6f |re calle|d only o|
|00000110| 6e 20 4e 4f 52 4d 41 4c | 0d 20 2a 20 20 74 65 72 |n NORMAL|. * ter|
|00000120| 6d 69 6e 61 74 69 6f 6e | 2c 20 69 2e 65 2e 20 63 |mination|, i.e. c|
|00000130| 61 6c 6c 69 6e 67 20 22 | 65 78 69 74 22 20 6f 72 |alling "|exit" or|
|00000140| 20 72 65 74 75 72 6e 69 | 6e 67 20 66 72 6f 6d 20 | returni|ng from |
|00000150| 22 6d 61 69 6e 22 2e 0d | 20 2a 0d 20 2a 20 20 53 |"main"..| *. * S|
|00000160| 68 75 74 64 6f 77 6e 20 | 72 6f 75 74 69 6e 65 73 |hutdown |routines|
|00000170| 20 69 6e 73 74 61 6c 6c | 65 64 20 77 69 74 68 20 | install|ed with |
|00000180| 22 5f 6f 6e 65 78 69 74 | 22 20 61 72 65 20 63 61 |"_onexit|" are ca|
|00000190| 6c 6c 65 64 20 6f 6e 20 | 22 45 78 69 74 54 6f 53 |lled on |"ExitToS|
|000001a0| 68 65 6c 6c 22 0d 20 2a | 20 20 61 73 20 77 65 6c |hell". *| as wel|
|000001b0| 6c 20 61 73 20 6f 6e 20 | 6e 6f 72 6d 61 6c 20 74 |l as on |normal t|
|000001c0| 65 72 6d 69 6e 61 74 69 | 6f 6e 2e 0d 20 2a 0d 20 |erminati|on.. *. |
|000001d0| 2a 20 20 57 68 65 6e 20 | 69 6e 69 74 69 61 74 69 |* When |initiati|
|000001e0| 6e 67 20 61 6e 79 20 6f | 74 68 65 72 20 66 6f 72 |ng any o|ther for|
|000001f0| 6d 20 6f 66 20 74 65 72 | 6d 69 6e 61 74 69 6f 6e |m of ter|mination|
|00000200| 20 28 65 2e 67 2e 20 22 | 4c 61 75 6e 63 68 22 29 | (e.g. "|Launch")|
|00000210| 2c 20 74 68 65 0d 20 2a | 20 20 75 73 65 72 20 63 |, the. *| user c|
|00000220| 61 6e 20 63 61 6c 6c 20 | 22 5f 65 78 69 74 69 6e |an call |"_exitin|
|00000230| 67 22 20 74 6f 20 66 6f | 72 63 65 20 73 68 75 74 |g" to fo|rce shut|
|00000240| 64 6f 77 6e 20 72 6f 75 | 74 69 6e 65 73 20 74 6f |down rou|tines to|
|00000250| 20 62 65 20 63 61 6c 6c | 65 64 2e 0d 20 2a 0d 20 | be call|ed.. *. |
|00000260| 2a 2f 0d 0d 23 69 66 6e | 64 65 66 20 5f 4d 61 63 |*/..#ifn|def _Mac|
|00000270| 54 79 70 65 73 5f 0d 23 | 69 6e 63 6c 75 64 65 20 |Types_.#|include |
|00000280| 3c 4d 61 63 48 65 61 64 | 65 72 73 3e 0d 23 65 6e |<MacHead|ers>.#en|
|00000290| 64 69 66 0d 0d 65 78 74 | 65 72 6e 20 6c 6f 6e 67 |dif..ext|ern long|
|000002a0| 20 41 54 72 61 70 48 61 | 6e 64 6c 65 72 20 3a 20 | ATrapHa|ndler : |
|000002b0| 30 78 32 38 3b 0d 0d 74 | 79 70 65 64 65 66 20 76 |0x28;..t|ypedef v|
|000002c0| 6f 69 64 20 28 2a 50 72 | 6f 63 29 28 29 3b 0d 0d |oid (*Pr|oc)();..|
|000002d0| 50 72 6f 63 20 6f 6e 65 | 78 69 74 28 50 72 6f 63 |Proc one|xit(Proc|
|000002e0| 29 3b 0d 50 72 6f 63 20 | 5f 6f 6e 65 78 69 74 28 |);.Proc |_onexit(|
|000002f0| 50 72 6f 63 29 3b 0d 76 | 6f 69 64 20 5f 65 78 69 |Proc);.v|oid _exi|
|00000300| 74 69 6e 67 28 69 6e 74 | 29 3b 0d 76 6f 69 64 20 |ting(int|);.void |
|00000310| 65 78 69 74 28 69 6e 74 | 29 3b 0d 76 6f 69 64 20 |exit(int|);.void |
|00000320| 6e 6f 70 28 76 6f 69 64 | 29 3b 0d 76 6f 69 64 20 |nop(void|);.void |
|00000330| 61 62 6f 72 74 28 76 6f | 69 64 29 3b 0d 0d 23 64 |abort(vo|id);..#d|
|00000340| 65 66 69 6e 65 20 4e 50 | 52 4f 43 53 09 09 33 32 |efine NP|ROCS..32|
|00000350| 0d 0d 73 74 61 74 69 63 | 20 73 74 72 75 63 74 20 |..static| struct |
|00000360| 70 72 6f 63 20 7b 20 50 | 72 6f 63 20 70 72 6f 63 |proc { P|roc proc|
|00000370| 3b 20 69 6e 74 20 61 6c | 77 61 79 73 3b 20 7d 20 |; int al|ways; } |
|00000380| 70 72 6f 63 73 5b 4e 50 | 52 4f 43 53 5d 3b 0d 73 |procs[NP|ROCS];.s|
|00000390| 74 61 74 69 63 20 69 6e | 74 20 6e 65 78 74 20 3d |tatic in|t next =|
|000003a0| 20 30 3b 0d 73 74 61 74 | 69 63 20 50 72 6f 63 20 | 0;.stat|ic Proc |
|000003b0| 6f 6c 64 65 78 69 74 2c | 20 6f 6c 64 45 53 3b 0d |oldexit,| oldES;.|
|000003c0| 73 74 61 74 69 63 20 63 | 68 61 72 20 2a 70 74 72 |static c|har *ptr|
|000003d0| 45 53 3b 0d 0d 73 74 61 | 74 69 63 20 76 6f 69 64 |ES;..sta|tic void|
|000003e0| 20 6e 6f 72 6d 61 6c 5f | 65 78 69 74 28 76 6f 69 | normal_|exit(voi|
|000003f0| 64 29 2c 20 6e 65 77 45 | 53 28 76 6f 69 64 29 3b |d), newE|S(void);|
|00000400| 0d 0d 0d 2f 2a 0d 20 2a | 20 20 65 78 69 74 20 2d |.../*. *| exit -|
|00000410| 20 6e 6f 72 6d 61 6c 20 | 70 72 6f 67 72 61 6d 20 | normal |program |
|00000420| 74 65 72 6d 69 6e 61 74 | 69 6f 6e 0d 20 2a 0d 20 |terminat|ion. *. |
|00000430| 2a 20 20 54 68 65 20 65 | 78 69 74 20 73 74 61 74 |* The e|xit stat|
|00000440| 75 73 20 69 73 20 69 67 | 6e 6f 72 65 64 2e 0d 20 |us is ig|nored.. |
|00000450| 2a 0d 20 2a 2f 0d 0d 76 | 6f 69 64 0d 65 78 69 74 |*. */..v|oid.exit|
|00000460| 28 69 29 0d 7b 0d 09 61 | 73 6d 20 7b 0d 09 09 6d |(i).{..a|sm {...m|
|00000470| 6f 76 65 61 2e 6c 09 30 | 78 36 43 28 61 35 29 2c |ovea.l.0|x6C(a5),|
|00000480| 61 30 0d 09 09 6a 73 72 | 09 09 28 61 30 29 09 09 |a0...jsr|..(a0)..|
|00000490| 09 3b 20 20 63 61 6c 6c | 20 6f 6e 65 78 69 74 20 |.; call| onexit |
|000004a0| 76 65 63 74 6f 72 0d 09 | 09 5f 45 78 69 74 54 6f |vector..|._ExitTo|
|000004b0| 53 68 65 6c 6c 0d 09 7d | 0d 7d 0d 0d 0d 2f 2a 0d |Shell..}|.}.../*.|
|000004c0| 20 2a 20 20 6f 6e 65 78 | 69 74 20 2d 20 69 6e 73 | * onex|it - ins|
|000004d0| 74 61 6c 6c 20 75 73 65 | 72 20 73 68 75 74 64 6f |tall use|r shutdo|
|000004e0| 77 6e 20 72 6f 75 74 69 | 6e 65 0d 20 2a 0d 20 2a |wn routi|ne. *. *|
|000004f0| 2f 0d 0d 50 72 6f 63 0d | 6f 6e 65 78 69 74 28 70 |/..Proc.|onexit(p|
|00000500| 72 6f 63 29 0d 50 72 6f | 63 20 70 72 6f 63 3b 0d |roc).Pro|c proc;.|
|00000510| 7b 0d 09 72 65 67 69 73 | 74 65 72 20 73 74 72 75 |{..regis|ter stru|
|00000520| 63 74 20 70 72 6f 63 20 | 2a 70 3b 0d 09 0d 09 69 |ct proc |*p;....i|
|00000530| 66 20 28 6e 65 78 74 20 | 3d 3d 20 4e 50 52 4f 43 |f (next |== NPROC|
|00000540| 53 29 0d 09 09 72 65 74 | 75 72 6e 28 30 29 3b 0d |S)...ret|urn(0);.|
|00000550| 09 09 0d 09 09 09 2f 2a | 20 20 69 6e 73 74 61 6c |....../*| instal|
|00000560| 6c 20 70 72 6f 63 20 69 | 6e 20 74 61 62 6c 65 20 |l proc i|n table |
|00000570| 20 2a 2f 0d 09 09 09 0d | 09 70 20 3d 20 26 70 72 | */.....|.p = &pr|
|00000580| 6f 63 73 5b 6e 65 78 74 | 2b 2b 5d 3b 0d 09 70 2d |ocs[next|++];..p-|
|00000590| 3e 70 72 6f 63 20 3d 20 | 70 72 6f 63 3b 0d 2f 2a |>proc = |proc;./*|
|000005a0| 09 70 2d 3e 61 6c 77 61 | 79 73 20 3d 20 30 3b 09 |.p->alwa|ys = 0;.|
|000005b0| 2a 2f 0d 09 69 66 20 28 | 21 6f 6c 64 65 78 69 74 |*/..if (|!oldexit|
|000005c0| 29 20 7b 0d 09 09 70 72 | 6f 63 20 3d 20 6e 6f 72 |) {...pr|oc = nor|
|000005d0| 6d 61 6c 5f 65 78 69 74 | 3b 0d 09 09 0d 09 09 09 |mal_exit|;.......|
|000005e0| 2f 2a 20 20 69 6e 73 74 | 61 6c 6c 20 6f 6e 65 78 |/* inst|all onex|
|000005f0| 69 74 20 76 65 63 74 6f | 72 20 20 2a 2f 0d 09 09 |it vecto|r */...|
|00000600| 09 0d 09 09 61 73 6d 20 | 7b 0d 09 09 09 6d 6f 76 |....asm |{....mov|
|00000610| 65 2e 6c 09 30 78 36 43 | 28 61 35 29 2c 6f 6c 64 |e.l.0x6C|(a5),old|
|00000620| 65 78 69 74 0d 09 09 09 | 6d 6f 76 65 2e 6c 09 70 |exit....|move.l.p|
|00000630| 72 6f 63 2c 30 78 36 43 | 28 61 35 29 0d 09 09 7d |roc,0x6C|(a5)...}|
|00000640| 0d 09 7d 0d 09 72 65 74 | 75 72 6e 28 70 2d 3e 70 |..}..ret|urn(p->p|
|00000650| 72 6f 63 29 3b 0d 7d 0d | 0d 0d 2f 2a 0d 20 2a 20 |roc);.}.|../*. * |
|00000660| 20 6e 6f 72 6d 61 6c 5f | 65 78 69 74 20 2d 20 6f | normal_|exit - o|
|00000670| 6e 65 78 69 74 20 76 65 | 63 74 6f 72 0d 20 2a 0d |nexit ve|ctor. *.|
|00000680| 20 2a 2f 0d 0d 73 74 61 | 74 69 63 20 76 6f 69 64 | */..sta|tic void|
|00000690| 0d 6e 6f 72 6d 61 6c 5f | 65 78 69 74 28 29 0d 7b |.normal_|exit().{|
|000006a0| 0d 09 5f 65 78 69 74 69 | 6e 67 28 31 29 3b 0d 7d |.._exiti|ng(1);.}|
|000006b0| 0d 0d 0d 2f 2a 0d 20 2a | 20 20 5f 6f 6e 65 78 69 |.../*. *| _onexi|
|000006c0| 74 20 2d 20 69 6e 73 74 | 61 6c 6c 20 61 20 63 72 |t - inst|all a cr|
|000006d0| 69 74 69 63 61 6c 20 73 | 68 75 74 64 6f 77 6e 20 |itical s|hutdown |
|000006e0| 72 6f 75 74 69 6e 65 0d | 20 2a 0d 20 2a 20 20 52 |routine.| *. * R|
|000006f0| 6f 75 74 69 6e 65 73 20 | 69 6e 73 74 61 6c 6c 65 |outines |installe|
|00000700| 64 20 77 69 74 68 20 22 | 5f 6f 6e 65 78 69 74 22 |d with "|_onexit"|
|00000710| 20 61 72 65 20 63 61 6c | 6c 65 64 20 65 76 65 6e | are cal|led even|
|00000720| 20 69 66 20 74 68 65 20 | 70 72 6f 67 72 61 6d 20 | if the |program |
|00000730| 64 6f 65 73 0d 20 2a 20 | 20 6e 6f 74 20 74 65 72 |does. * | not ter|
|00000740| 6d 69 6e 61 74 65 20 6e | 6f 72 6d 61 6c 6c 79 2c |minate n|ormally,|
|00000750| 20 70 72 6f 76 69 64 65 | 64 20 6f 6e 6c 79 20 74 | provide|d only t|
|00000760| 68 61 74 20 22 45 78 69 | 74 54 6f 53 68 65 6c 6c |hat "Exi|tToShell|
|00000770| 22 20 69 73 20 63 61 6c | 6c 65 64 2e 0d 20 2a 0d |" is cal|led.. *.|
|00000780| 20 2a 2f 0d 0d 50 72 6f | 63 0d 5f 6f 6e 65 78 69 | */..Pro|c._onexi|
|00000790| 74 28 70 72 6f 63 29 0d | 50 72 6f 63 20 70 72 6f |t(proc).|Proc pro|
|000007a0| 63 3b 0d 7b 0d 09 72 65 | 67 69 73 74 65 72 20 73 |c;.{..re|gister s|
|000007b0| 74 72 75 63 74 20 70 72 | 6f 63 20 2a 70 3b 0d 09 |truct pr|oc *p;..|
|000007c0| 0d 09 69 66 20 28 6e 65 | 78 74 20 3d 3d 20 4e 50 |..if (ne|xt == NP|
|000007d0| 52 4f 43 53 29 0d 09 09 | 72 65 74 75 72 6e 28 30 |ROCS)...|return(0|
|000007e0| 29 3b 0d 09 09 0d 09 09 | 09 2f 2a 20 20 69 6e 73 |);......|./* ins|
|000007f0| 74 61 6c 6c 20 70 72 6f | 63 20 69 6e 20 74 61 62 |tall pro|c in tab|
|00000800| 6c 65 20 20 2a 2f 0d 09 | 09 09 0d 09 70 20 3d 20 |le */..|....p = |
|00000810| 26 70 72 6f 63 73 5b 6e | 65 78 74 2b 2b 5d 3b 0d |&procs[n|ext++];.|
|00000820| 09 70 2d 3e 70 72 6f 63 | 20 3d 20 70 72 6f 63 3b |.p->proc| = proc;|
|00000830| 0d 09 70 2d 3e 61 6c 77 | 61 79 73 20 3d 20 31 3b |..p->alw|ays = 1;|
|00000840| 0d 09 69 66 20 28 21 6f | 6c 64 45 53 29 20 7b 0d |..if (!o|ldES) {.|
|00000850| 09 09 70 72 6f 63 20 3d | 20 6e 65 77 45 53 3b 0d |..proc =| newES;.|
|00000860| 09 09 0d 09 09 09 2f 2a | 20 20 73 61 76 65 20 6f |....../*| save o|
|00000870| 72 69 67 69 6e 61 6c 20 | 45 78 69 74 54 6f 53 68 |riginal |ExitToSh|
|00000880| 65 6c 6c 20 20 2a 2f 0d | 09 09 09 0d 09 09 61 73 |ell */.|......as|
|00000890| 6d 20 7b 0d 09 09 09 6d | 6f 76 65 2e 77 09 23 30 |m {....m|ove.w.#0|
|000008a0| 78 41 39 46 34 2c 64 30 | 09 09 3b 20 20 5f 45 78 |xA9F4,d0|..; _Ex|
|000008b0| 69 74 54 6f 53 68 65 6c | 6c 0d 09 09 09 5f 47 65 |itToShel|l...._Ge|
|000008c0| 74 54 72 61 70 41 64 64 | 72 65 73 73 0d 09 09 09 |tTrapAdd|ress....|
|000008d0| 6d 6f 76 65 2e 6c 09 61 | 30 2c 6f 6c 64 45 53 0d |move.l.a|0,oldES.|
|000008e0| 09 09 7d 0d 09 09 0d 09 | 09 09 2f 2a 20 20 28 36 |..}.....|../* (6|
|000008f0| 34 4b 20 52 4f 4d 20 6f | 6e 6c 79 29 20 61 6c 6c |4K ROM o|nly) all|
|00000900| 6f 63 61 74 65 20 69 6e | 74 65 72 63 65 70 74 20 |ocate in|tercept |
|00000910| 69 6e 20 73 79 73 68 65 | 61 70 20 20 2a 2f 0d 09 |in syshe|ap */..|
|00000920| 09 0d 09 09 61 73 6d 20 | 7b 0d 09 09 09 6d 6f 76 |....asm |{....mov|
|00000930| 65 61 2e 6c 09 70 72 6f | 63 2c 61 30 0d 09 09 09 |ea.l.pro|c,a0....|
|00000940| 74 73 74 2e 77 09 52 4f | 4d 38 35 0d 09 09 09 62 |tst.w.RO|M85....b|
|00000950| 70 6c 2e 73 09 40 31 0d | 09 09 09 6d 6f 76 65 71 |pl.s.@1.|...moveq|
|00000960| 09 23 36 2c 64 30 0d 09 | 09 09 5f 4e 65 77 50 74 |.#6,d0..|.._NewPt|
|00000970| 72 20 20 53 59 53 0d 09 | 09 09 6d 6f 76 65 2e 6c |r SYS..|..move.l|
|00000980| 09 61 30 2c 70 74 72 45 | 53 0d 09 09 09 6d 6f 76 |.a0,ptrE|S....mov|
|00000990| 65 2e 77 09 23 30 78 34 | 45 46 39 2c 28 61 30 29 |e.w.#0x4|EF9,(a0)|
|000009a0| 09 3b 20 20 4a 4d 50 20 | 61 62 73 2e 4c 0d 09 09 |.; JMP |abs.L...|
|000009b0| 09 6d 6f 76 65 2e 6c 09 | 70 72 6f 63 2c 32 28 61 |.move.l.|proc,2(a|
|000009c0| 30 29 0d 40 31 09 09 7d | 0d 0d 09 09 09 2f 2a 20 |0).@1..}|...../* |
|000009d0| 20 69 6e 73 74 61 6c 6c | 20 45 78 69 74 54 6f 53 | install| ExitToS|
|000009e0| 68 65 6c 6c 20 69 6e 74 | 65 72 63 65 70 74 20 20 |hell int|ercept |
|000009f0| 2a 2f 0d 09 09 0d 09 09 | 61 73 6d 20 7b 0d 09 09 |*/......|asm {...|
|00000a00| 09 6d 6f 76 65 2e 77 09 | 23 30 78 41 39 46 34 2c |.move.w.|#0xA9F4,|
|00000a10| 64 30 09 09 3b 20 20 5f | 45 78 69 74 54 6f 53 68 |d0..; _|ExitToSh|
|00000a20| 65 6c 6c 0d 09 09 09 5f | 53 65 74 54 72 61 70 41 |ell...._|SetTrapA|
|00000a30| 64 64 72 65 73 73 0d 09 | 09 7d 0d 09 7d 0d 09 72 |ddress..|.}..}..r|
|00000a40| 65 74 75 72 6e 28 70 2d | 3e 70 72 6f 63 29 3b 0d |eturn(p-|>proc);.|
|00000a50| 7d 0d 0d 0d 2f 2a 0d 20 | 2a 20 20 6e 65 77 45 53 |}.../*. |* newES|
|00000a60| 20 2d 20 45 78 69 74 54 | 6f 53 68 65 6c 6c 20 69 | - ExitT|oShell i|
|00000a70| 6e 74 65 72 63 65 70 74 | 0d 20 2a 0d 20 2a 2f 0d |ntercept|. *. */.|
|00000a80| 0d 73 74 61 74 69 63 20 | 76 6f 69 64 0d 6e 65 77 |.static |void.new|
|00000a90| 45 53 28 29 0d 7b 0d 09 | 5f 65 78 69 74 69 6e 67 |ES().{..|_exiting|
|00000aa0| 28 30 29 3b 0d 09 45 78 | 69 74 54 6f 53 68 65 6c |(0);..Ex|itToShel|
|00000ab0| 6c 28 29 3b 0d 7d 0d 0d | 0d 2f 2a 0d 20 2a 20 20 |l();.}..|./*. * |
|00000ac0| 5f 65 78 69 74 69 6e 67 | 20 2d 20 70 65 72 66 6f |_exiting| - perfo|
|00000ad0| 72 6d 20 73 68 75 74 64 | 6f 77 6e 20 61 63 74 69 |rm shutd|own acti|
|00000ae0| 76 69 74 79 0d 20 2a 0d | 20 2a 20 20 54 68 65 20 |vity. *.| * The |
|00000af0| 61 72 67 75 6d 65 6e 74 | 20 63 6f 6e 74 72 6f 6c |argument| control|
|00000b00| 73 20 77 68 69 63 68 20 | 73 68 75 74 64 6f 77 6e |s which |shutdown|
|00000b10| 20 72 6f 75 74 69 6e 65 | 73 20 73 68 6f 75 6c 64 | routine|s should|
|00000b20| 20 62 65 20 63 61 6c 6c | 65 64 3a 0d 20 2a 0d 20 | be call|ed:. *. |
|00000b30| 2a 09 09 5f 65 78 69 74 | 69 6e 67 28 31 29 09 09 |*.._exit|ing(1)..|
|00000b40| 63 61 6c 6c 20 61 6c 6c | 20 69 6e 73 74 61 6c 6c |call all| install|
|00000b50| 65 64 20 73 68 75 74 64 | 6f 77 6e 20 72 6f 75 74 |ed shutd|own rout|
|00000b60| 69 6e 65 73 0d 20 2a 09 | 09 5f 65 78 69 74 69 6e |ines. *.|._exitin|
|00000b70| 67 28 30 29 09 09 63 61 | 6c 6c 20 6f 6e 6c 79 20 |g(0)..ca|ll only |
|00000b80| 72 6f 75 74 69 6e 65 73 | 20 69 6e 73 74 61 6c 6c |routines| install|
|00000b90| 65 64 20 77 69 74 68 20 | 22 5f 6f 6e 65 78 69 74 |ed with |"_onexit|
|00000ba0| 22 0d 20 2a 0d 20 2a 2f | 0d 0d 76 6f 69 64 0d 5f |". *. */|..void._|
|00000bb0| 65 78 69 74 69 6e 67 28 | 6e 6f 72 6d 61 6c 6c 79 |exiting(|normally|
|00000bc0| 29 0d 7b 0d 09 72 65 67 | 69 73 74 65 72 20 73 74 |).{..reg|ister st|
|00000bd0| 72 75 63 74 20 70 72 6f | 63 20 2a 70 3b 0d 09 50 |ruct pro|c *p;..P|
|00000be0| 72 6f 63 20 70 72 6f 63 | 3b 0d 09 69 6e 74 20 69 |roc proc|;..int i|
|00000bf0| 3b 0d 09 0d 09 53 65 74 | 55 70 41 35 28 29 3b 0d |;....Set|UpA5();.|
|00000c00| 09 70 20 3d 20 26 70 72 | 6f 63 73 5b 4e 50 52 4f |.p = &pr|ocs[NPRO|
|00000c10| 43 53 5d 3b 0d 09 66 6f | 72 20 28 69 20 3d 20 4e |CS];..fo|r (i = N|
|00000c20| 50 52 4f 43 53 3b 20 69 | 2d 2d 3b 20 29 20 7b 0d |PROCS; i|--; ) {.|
|00000c30| 09 09 69 66 20 28 70 72 | 6f 63 20 3d 20 28 2d 2d |..if (pr|oc = (--|
|00000c40| 70 29 2d 3e 70 72 6f 63 | 29 20 7b 0d 09 09 09 70 |p)->proc|) {....p|
|00000c50| 2d 3e 70 72 6f 63 20 3d | 20 30 3b 0d 09 09 09 69 |->proc =| 0;....i|
|00000c60| 66 20 28 6e 6f 72 6d 61 | 6c 6c 79 20 7c 7c 20 70 |f (norma|lly || p|
|00000c70| 2d 3e 61 6c 77 61 79 73 | 29 0d 09 09 09 09 28 2a |->always|).....(*|
|00000c80| 70 72 6f 63 29 28 29 3b | 0d 09 09 7d 0d 09 7d 0d |proc)();|...}..}.|
|00000c90| 09 0d 09 09 2f 2a 20 20 | 64 65 61 6c 6c 6f 63 61 |..../* |dealloca|
|00000ca0| 74 65 20 45 78 69 74 54 | 6f 53 68 65 6c 6c 20 69 |te ExitT|oShell i|
|00000cb0| 6e 74 65 72 63 65 70 74 | 20 20 2a 2f 0d 09 09 0d |ntercept| */....|
|00000cc0| 09 61 73 6d 20 7b 0d 09 | 09 6d 6f 76 65 2e 6c 09 |.asm {..|.move.l.|
|00000cd0| 70 74 72 45 53 2c 64 30 | 0d 09 09 62 65 71 2e 73 |ptrES,d0|...beq.s|
|00000ce0| 09 40 31 0d 09 09 6d 6f | 76 65 61 2e 6c 09 64 30 |.@1...mo|vea.l.d0|
|00000cf0| 2c 61 30 0d 09 09 5f 44 | 69 73 70 6f 73 50 74 72 |,a0..._D|isposPtr|
|00000d00| 0d 09 09 63 6c 72 2e 6c | 09 70 74 72 45 53 0d 40 |...clr.l|.ptrES.@|
|00000d10| 31 09 7d 0d 0d 09 09 2f | 2a 20 20 72 65 6d 6f 76 |1.}..../|* remov|
|00000d20| 65 20 45 78 69 74 54 6f | 53 68 65 6c 6c 20 69 6e |e ExitTo|Shell in|
|00000d30| 74 65 72 63 65 70 74 20 | 20 2a 2f 0d 09 09 0d 09 |tercept | */.....|
|00000d40| 61 73 6d 20 7b 0d 09 09 | 6d 6f 76 65 2e 6c 09 6f |asm {...|move.l.o|
|00000d50| 6c 64 45 53 2c 64 30 0d | 09 09 62 65 71 2e 73 09 |ldES,d0.|..beq.s.|
|00000d60| 40 32 0d 09 09 6d 6f 76 | 65 61 2e 6c 09 64 30 2c |@2...mov|ea.l.d0,|
|00000d70| 61 30 0d 09 09 6d 6f 76 | 65 2e 77 09 23 30 78 41 |a0...mov|e.w.#0xA|
|00000d80| 39 46 34 2c 64 30 0d 09 | 09 5f 53 65 74 54 72 61 |9F4,d0..|._SetTra|
|00000d90| 70 41 64 64 72 65 73 73 | 0d 09 09 63 6c 72 2e 6c |pAddress|...clr.l|
|00000da0| 09 6f 6c 64 45 53 0d 40 | 32 09 7d 0d 0d 09 09 2f |.oldES.@|2.}..../|
|00000db0| 2a 20 20 63 61 6c 6c 20 | 6f 72 69 67 69 6e 61 6c |* call |original|
|00000dc0| 20 65 78 69 74 20 70 72 | 6f 63 20 20 2a 2f 0d 0d | exit pr|oc */..|
|00000dd0| 09 61 73 6d 20 7b 0d 09 | 09 6d 6f 76 65 61 2e 6c |.asm {..|.movea.l|
|00000de0| 09 30 78 36 43 28 61 35 | 29 2c 61 30 0d 09 09 6d |.0x6C(a5|),a0...m|
|00000df0| 6f 76 65 2e 6c 09 6f 6c | 64 65 78 69 74 2c 64 30 |ove.l.ol|dexit,d0|
|00000e00| 0d 09 09 62 65 71 2e 73 | 09 40 33 0d 09 09 6d 6f |...beq.s|.@3...mo|
|00000e10| 76 65 61 2e 6c 09 64 30 | 2c 61 30 0d 40 33 09 09 |vea.l.d0|,a0.@3..|
|00000e20| 6a 73 72 09 09 28 61 30 | 29 0d 09 7d 0d 09 6f 6c |jsr..(a0|)..}..ol|
|00000e30| 64 65 78 69 74 20 3d 20 | 6e 6f 70 3b 0d 09 52 65 |dexit = |nop;..Re|
|00000e40| 73 74 6f 72 65 41 35 28 | 29 3b 0d 7d 0d 0d 0d 2f |storeA5(|);.}.../|
|00000e50| 2a 0d 20 2a 20 20 6e 6f | 70 20 2d 20 64 6f 20 6e |*. * no|p - do n|
|00000e60| 6f 74 68 69 6e 67 0d 20 | 2a 0d 20 2a 2f 0d 0d 73 |othing. |*. */..s|
|00000e70| 74 61 74 69 63 20 76 6f | 69 64 0d 6e 6f 70 28 29 |tatic vo|id.nop()|
|00000e80| 0d 7b 0d 7d 0d 0d 0d 2f | 2a 0d 20 2a 20 20 61 62 |.{.}.../|*. * ab|
|00000e90| 6f 72 74 20 2d 20 61 62 | 6f 72 74 20 65 78 65 63 |ort - ab|ort exec|
|00000ea0| 75 74 69 6f 6e 0d 20 2a | 0d 20 2a 20 20 41 20 64 |ution. *|. * A d|
|00000eb0| 65 62 75 67 67 65 72 20 | 74 72 61 70 20 69 73 20 |ebugger |trap is |
|00000ec0| 69 73 73 75 65 64 20 69 | 66 20 69 74 20 6c 6f 6f |issued i|f it loo|
|00000ed0| 6b 73 20 6c 69 6b 65 20 | 61 20 64 65 62 75 67 67 |ks like |a debugg|
|00000ee0| 65 72 20 69 73 20 69 6e | 73 74 61 6c 6c 65 64 2e |er is in|stalled.|
|00000ef0| 0d 20 2a 0d 20 2a 2f 0d | 0d 76 6f 69 64 0d 61 62 |. *. */.|.void.ab|
|00000f00| 6f 72 74 28 29 0d 7b 0d | 09 69 66 20 28 47 65 74 |ort().{.|.if (Get|
|00000f10| 54 72 61 70 41 64 64 72 | 65 73 73 28 30 78 41 30 |TrapAddr|ess(0xA0|
|00000f20| 35 35 29 20 3d 3d 20 47 | 65 74 54 72 61 70 41 64 |55) == G|etTrapAd|
|00000f30| 64 72 65 73 73 28 30 78 | 41 38 39 46 29 29 20 7b |dress(0x|A89F)) {|
|00000f40| 0d 09 09 69 66 20 28 28 | 41 54 72 61 70 48 61 6e |...if ((|ATrapHan|
|00000f50| 64 6c 65 72 20 26 20 4c | 6f 33 42 79 74 65 73 29 |dler & L|o3Bytes)|
|00000f60| 20 3c 20 28 28 6c 6f 6e | 67 29 20 52 4f 4d 42 61 | < ((lon|g) ROMBa|
|00000f70| 73 65 20 26 20 4c 6f 33 | 42 79 74 65 73 29 29 0d |se & Lo3|Bytes)).|
|00000f80| 09 09 09 44 65 62 75 67 | 67 65 72 28 29 3b 0d 09 |...Debug|ger();..|
|00000f90| 7d 0d 09 65 6c 73 65 20 | 7b 0d 09 09 69 66 20 28 |}..else |{...if (|
|00000fa0| 53 74 72 69 70 41 64 64 | 72 65 73 73 28 41 54 72 |StripAdd|ress(ATr|
|00000fb0| 61 70 48 61 6e 64 6c 65 | 72 29 20 3c 20 53 74 72 |apHandle|r) < Str|
|00000fc0| 69 70 41 64 64 72 65 73 | 73 28 52 4f 4d 42 61 73 |ipAddres|s(ROMBas|
|00000fd0| 65 29 29 0d 09 09 09 44 | 65 62 75 67 67 65 72 28 |e))....D|ebugger(|
|00000fe0| 29 3b 0d 09 7d 0d 09 45 | 78 69 74 54 6f 53 68 65 |);..}..E|xitToShe|
|00000ff0| 6c 6c 28 29 3b 0d 7d 0d | 00 00 00 00 00 00 00 00 |ll();.}.|........|
+--------+-------------------------+-------------------------+--------+--------+