home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!snorkelwacker.mit.edu!tamsun.tamu.edu!mtecv2!academ01!al158305
- From: al158305@academ01.mty.itesm.mx (Gustavo Cordova Avila)
- Newsgroups: comp.sys.m68k
- Subject: Re: arbitrary entry points
- Message-ID: <al158305.721060111@academ01>
- Date: 6 Nov 92 14:28:31 GMT
- References: <1992Oct26.192527.14411@jato.jpl.nasa.gov> <552@muller.loria.fr>
- Sender: usenet@mtecv2.mty.itesm.mx
- Distribution: comp.sys.m68k
- Lines: 61
- Nntp-Posting-Host: academ01.mty.itesm.mx
-
- eker@loria.crin.fr (Steven Eker) writes:
-
- >In article <1992Oct26.192527.14411@jato.jpl.nasa.gov>, jdickson@jato.jpl.nasa.gov (Jeff Dickson) writes:
- >|>
- >|> If I say something like:
- >|>
- >|> lea SomeRoutine,a1
- >|> move.l a1,4(a0)
- >|> jsr 4(a0)
- >|>
- >|> ....where a0 is the base of a 'n' longword array
- >|>
- >|> my computer goes belly up. No problem to jump to static entry
- >|> points, but how to arrange arbitrary entry points?
- >|>
- >|> thanks, jeff
-
- Hmmm... this sounds quite reminiscent to how we call shared run-time
- libraries in AmigaDOS. It's something like:
-
- LIBNAME: db "reqtools.library",0
-
- OPENLIB: lea LIBNAME(pc),a0
- move a6,$04
- call _LVOOpenLibrary(a6)
-
- ; The routine at _LVOOpenLIbrary(a6) returns a pointer to
- ; the requested library in a1 (I think). If the library isn't
- ; in memory at the time, Exec.library (the kernel) tries to
- ; load it from disk, from a special assignment called "Libs:".
-
- ; Ah! BTW, Exec is also a library, and it's base pointer
- ; is at location $04. Just move $04's contents and call
- ; the needed routine with it's offset added to a6. A6 needs
- ; to be valid during any library call, hence it's the LibBasePtr.
-
- ; To call the needed routine from the library (reqtools), say,
- ; like opening a nice 3d-ish file or font requester, just do
- ; something like:
-
- OPENREQ: move d0,data <--- no need to be specific
- move a1,a6
- call _LVOOpenFileReq
-
- ; and you're cooking :)
-
-
- This really helps a lot, since there's also system routines (exec) to
- patch existing libraries, so, say, you don't want that ugly file requester,
- just make yours resident in memory, and trap any calls to the old one and
- use your own. Easy!
- Besides, since you never call absolute addresses, things don't get
- outdated by new library versions.
-
- hey! it's just my opinion. :)
-
- -Gus
- --
- Gustavo Cordova Avila | Majoring in Computer Engineering
- al158305@academ01.mty.itesm.mx | "...I came from the Desert!!" (Sonora)
- al158305@[131.178.4.10] | RangerElf @ IRC (usually in #amiga)
-