Topic : TOS - The Operating System Author : Version : tos.hyp (December 19, 2008) Subject : Programmieren/Atari Nodes : 3010 Index Size : 93790 HCP-Version : 5 Compiled on : Atari @charset : atarist @lang : @default : Title @help : @options : +g -i -s +x +zz -t4 @width : 70 View Ref-File3.3 Hooking into the reset vector TOS 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