kkim@uiucdcsb.UUCP (06/10/87)
I would like to intercept calls to an Operating System or Toolbox routine (specifically, GetNextEvent) and do some pre- or post-processing of my own. GetTrapAddress and SetTrapAddress seem useful to do it. 1. Does anybody have any sample code (in Pascal or C) demonstrating the usage of GetTrapAddress and SetTrapAddress? 2. I also have one question. It is said that Since the trap dispatch table can address locations within a range of only 64K bytes from the beginning of the system heap, the routine you install should be in the system heap. How can I put my own version in the system heap? Please e-mail to me. I will post a summary if there is enough interest. Thanks in advance. Kyongsok KIM Dept. of Computer Science; Univ. of Illinois at Urbana-Champaign arpanet/csnet: kkim@a.cs.uiuc.edu usenet/uucp : {seismo, pur-ee, ihnp4}!uiucdcs!kkim
han@apple.UUCP (06/11/87)
In article <164500036@uiucdcsb>, kkim@uiucdcsb.cs.uiuc.edu writes: > > I would like to intercept calls to an Operating System or > Toolbox routine (specifically, GetNextEvent) and do some pre- or > post-processing of my own. GetTrapAddress and SetTrapAddress > seem useful to do it. Actually, there is a hook for GetNextEvent which may be used (although the use of low memory globals that are not documented in Inside Macintosh is discouraged). There was an article about it in MacTutor last year or so. I believe the global is JGNEFilter or something like that. You might want to look up that issue. > ... > > 2. I also have one question. It is said that > > Since the trap dispatch table can address locations within a > range of only 64K bytes from the beginning of the system heap, > the routine you install should be in the system heap. > > How can I put my own version in the system heap? > Traps patches, when done, should be placed in the Application Heap according to current doctrine. This is to maintain compatability with future operating system considerations. ===================================================================== Byron Han | UUCP: {sun,voder,nsc,mtxinu,dual}!apple!han Apple Computer, Inc. | CSNET: han@apple.csnet 20525 Mariani Ave, | ATTNet: 408-973-6450 Cupertino, CA 95014 | GENIE: BYRONHAN APPLELINK: HAN1 MS 27Y | CSERVE: 72167,1664 ===================================================================== All opinions and statements do not necessarily represent those of my employer, Apple Computer Inc. =====================================================================
olson@endor.harvard.edu (Eric Olson) (06/11/87)
In article <986@apple.UUCP> han@apple.UUCP (Byron Han) writes: >Traps patches, when done, should be placed in the Application Heap according >to current doctrine. This is to maintain compatability with future operating >system considerations. > Note that in order to maintain compatibility with 64K ROMs (for which the jump table can only reach 64K into memory), a jump to the patch should be installed in the System Heap, and the TrapAddress set to that jump. On 128K ROMs (and, presumably, SE and Mac II ROMs), the jump table is able to reference anywhere in memory. Be sure to deinstall your patch before ExitToShell, otherwise, the trap will point to the jump (in System Heap), which will point to garbage. -Eric Eric K. Olson olson@harvard.harvard.edu harvard!olson "If the War were fought today, most Americans doubt that we could defeat the new Japan. Its atom bombs would be cleaner than ours and come equipped with "How Did You Like Our Product" postcards that would drop from the sky and ask questions like "Where did you hear about us?" and "How many in your family died?" -John Dvorak
kkim@uiucdcsb.UUCP (06/11/87)
> /* Written 6:37 pm Jun 10, 1987 by han@apple.UUCP */ > > 2. I also have one question. It is said that > > > > Since the trap dispatch table can address locations within a > > range of only 64K bytes from the beginning of the system heap, > > the routine you install should be in the system heap. > > > > How can I put my own version in the system heap? > > > Traps patches, when done, should be placed in the Application Heap according > to current doctrine. This is to maintain compatability with future operating > system considerations. Do you mean the LIMIT that the trap dispatch table can address locations within a range of only 64K bytes from the beginning of the system heap has been LIFTED, and that the format of the trap dispatch table has been changed. Kyongsok KIM Dept. of Computer Science; Univ. of Illinois at Urbana-Champaign arpanet/csnet: kkim@a.cs.uiuc.edu usenet/uucp : {seismo, pur-ee, ihnp4}!uiucdcs!kkim
han@apple.UUCP (06/14/87)
In article <164500037@uiucdcsb>, kkim@uiucdcsb.cs.uiuc.edu writes: > > > /* Written 6:37 pm Jun 10, 1987 by han@apple.UUCP */ > > > > How can I put my own version in the system heap? > > > > > > Traps patches, when done, should be placed in the Application Heap according > > to current doctrine ... to maintain compatability with future operating > > system considerations. > > Do you mean the LIMIT that the trap dispatch table can address > locations within a range of only 64K bytes from the beginning of the > system heap has been LIFTED, and that the format of the trap dispatch > table has been changed. > My understanding is that to maintain compatability with 64K ROM machines, one needs to make sure that the patch is in the first 64K of memory. According to Larry Rosenstein, in an internal mail communication with me, "If you want your program to run on a 64K ROM machine you have to put a jump vector in the System Heap to ensure that the patch falls within 64K of the start of RAM." Otherwise, if 64K ROM compatability, one should place patches in the current application heap, NOT in the system heap. This has changed recently so please be aware of it. You may break in the future if you do not. Please remember - going patch crazy is uncool and the Apple Thought Police will get itchy. One should also try to maintain compatability with old ROM's as long as it is practical. But we are also still working with an evolving machine, so things are changing. ===================================================================== Byron Han | UUCP: {sun,voder,nsc,mtxinu,dual}!apple!han Apple Computer, Inc. | CSNET: han@apple.csnet 20525 Mariani Ave, | ATTNet: 408-973-6450 Cupertino, CA 95014 | GENIE: BYRONHAN APPLELINK: HAN1 MS 27Y | CSERVE: 72167,1664 ===================================================================== All opinions and statements do not necessarily represent those of my employer, Apple Computer Inc. =====================================================================
lsr@apple.UUCP (06/15/87)
In article <164500037@uiucdcsb> kkim@uiucdcsb.cs.uiuc.edu writes: > > Do you mean the LIMIT that the trap dispatch table can address >locations within a range of only 64K bytes from the beginning of the >system heap has been LIFTED, and that the format of the trap dispatch >table has been changed. On the 128K ROMs or later, the trap table contains a full address pointing to the trap routine. Therefore the trap routine can be anywhere in memory. On the older ROMs, the table contained a 16 bit offset from the start of RAM or ROM; the address of a trap had to be within 64 of the start of RAM or ROM. The change in the trap table is discussed in Inside Macintosh volume 4. -- Larry Rosenstein Object Specialist Apple Computer AppleLink: Rosenstein1 UUCP: {sun, voder, nsc, mtxinu, dual}!apple!lsr CSNET: lsr@Apple.com