home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / m68k / 1335 < prev    next >
Encoding:
Internet Message Format  |  1992-11-08  |  2.4 KB

  1. Path: sparky!uunet!snorkelwacker.mit.edu!tamsun.tamu.edu!mtecv2!academ01!al158305
  2. From: al158305@academ01.mty.itesm.mx (Gustavo Cordova Avila)
  3. Newsgroups: comp.sys.m68k
  4. Subject: Re: arbitrary entry points
  5. Message-ID: <al158305.721060111@academ01>
  6. Date: 6 Nov 92 14:28:31 GMT
  7. References: <1992Oct26.192527.14411@jato.jpl.nasa.gov> <552@muller.loria.fr>
  8. Sender: usenet@mtecv2.mty.itesm.mx
  9. Distribution: comp.sys.m68k
  10. Lines: 61
  11. Nntp-Posting-Host: academ01.mty.itesm.mx
  12.  
  13. eker@loria.crin.fr (Steven Eker) writes:
  14.  
  15. >In article <1992Oct26.192527.14411@jato.jpl.nasa.gov>, jdickson@jato.jpl.nasa.gov (Jeff Dickson) writes:
  16. >|> 
  17. >|>     If I say something like:
  18. >|> 
  19. >|>         lea SomeRoutine,a1
  20. >|>         move.l a1,4(a0)
  21. >|>         jsr 4(a0)
  22. >|> 
  23. >|>         ....where a0 is the base of a 'n' longword array
  24. >|> 
  25. >|>     my computer goes belly up. No problem to jump to static entry
  26. >|>     points, but how to arrange arbitrary entry points?
  27. >|> 
  28. >|>     thanks, jeff
  29.  
  30.    Hmmm... this sounds quite reminiscent to how we call shared run-time
  31. libraries in AmigaDOS. It's something like:
  32.  
  33.     LIBNAME:    db   "reqtools.library",0
  34.  
  35.     OPENLIB:    lea  LIBNAME(pc),a0
  36.             move a6,$04
  37.             call _LVOOpenLibrary(a6)
  38.  
  39.     ; The routine at _LVOOpenLIbrary(a6) returns a pointer to
  40.     ; the requested library in a1 (I think). If the library isn't 
  41.     ; in memory at the time, Exec.library (the kernel) tries to 
  42.     ; load it from disk, from a special assignment called "Libs:".
  43.  
  44.     ; Ah! BTW, Exec is also a library, and it's base pointer
  45.     ; is at location $04. Just move $04's contents and call
  46.     ; the needed routine with it's offset added to a6. A6 needs
  47.     ; to be valid during any library call, hence it's the LibBasePtr.
  48.  
  49.     ; To call the needed routine from the library (reqtools), say,
  50.     ; like opening a nice 3d-ish file or font requester, just do
  51.     ; something like:
  52.  
  53.     OPENREQ:    move d0,data    <--- no need to be specific
  54.             move a1,a6
  55.             call _LVOOpenFileReq
  56.  
  57.     ; and you're cooking :)
  58.  
  59.  
  60.    This really helps a lot, since there's also system routines (exec) to
  61. patch existing libraries, so, say, you don't want that ugly file requester,
  62. just make yours resident in memory, and trap any calls to the old one and
  63. use your own. Easy!
  64.    Besides, since you never call absolute addresses, things don't get
  65. outdated by new library versions.
  66.  
  67. hey! it's just my opinion. :)
  68.  
  69. -Gus
  70. --
  71. Gustavo Cordova Avila        | Majoring in Computer Engineering
  72. al158305@academ01.mty.itesm.mx    | "...I came from the Desert!!" (Sonora)
  73. al158305@[131.178.4.10]        | RangerElf @ IRC (usually in #amiga)
  74.