[comp.sys.amiga] Using SetFunction with the dos.library

danbabcock@eklektik.UUCP (/dev/ph1) (04/11/90)

alexander hinds wrote in <16223@snow-white.udel.EDU>:

>        I know this has been discussed before, but I've missed the summary.
>COuld somebody tell me how to setfunction the dos.library?
(remainder of text deleted)

The Commodore autodocs (1.3 edition) for SetFunction have this note:
"SetFunction cannot be used on non-standard libraries like dos.library.
Here you must manually Forbid(), preserve all 6 original bytes, set the
new vector, SumLibrary(), then Permit()"

The problem is that instead of the standard "jmp.l address" used by
most libraries, the dos.library uses

moveq #dispatch_number,d0
bra dispatch_routine ;word displacement

Where dispatch_routine is a routine that loads an address into a4 from
a table indexed by the value in d0, then calls a routine, whose address
is loaded from memory at a constant offset from the dispatch routine,
indirectly via (a5). If you think this is strange, I agree. It's needed
because AmigaDOS is written in BCPL.

-- Dan Babcock / voice (412)-373-1753