The recipe for hooking your own routines into the reset-vector runs as follows:
Set the system variable resvalid to the value 0x31415926, as therwise resvector will be completely ignored by the BIOS ignore.
Write the address of your own function in the resvector vector.
Jump back from the function via jmp(a6).
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