Home BIOSBIOS The input/output channels of the BIOSThe input/output channels of the BIOS The system variablesThe system variables

3.3 Hooking into the reset vector

The recipe for hooking your own routines into the reset-vector runs as follows:

Important: A jump back from the installed function via rts is not possible, since no stack has been initialised yet at this time. In practice one could proceed as follows, for instance:

RESMAGIC    equ       $31415926
_resvalid   equ       $426
_resvector  equ       $42a
            .text
install:    move.l    _resvalid,oldvalid
            move.l    #RESMAGIC,resvalid
            move.l    _resvector,oldreset
            move.l    #newreset,_resvector
            rts

            dc.b      "XBRARESV"
oldreset:   dc.l      0

newreset:   move.l    oldreset,_resvector
            move.l    oldvalid,_resvalid
            jmp       (a6)

            .bss
oldvalid:   .ds.l     1

Warning: So that multiple programs may install themselves, a clean de-installation must follow the handling of the function.

See also: System variables   System vectors   XBRA procedure


Home BIOSBIOS The input/output channels of the BIOSThe input/output channels of the BIOS The system variablesThe system variables