•  Back 
  •  BIOS 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  %About 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The ATARI Compendium
Author      : Scott Sanders / JAY Software
Version     : 1.25 (20/6/2003)
Subject     : Documentation
Nodes       : 1117
Index Size  : 32614
HCP-Version : 6
Compiled on : Atari
@charset    : UTF-8
@lang       : en
@default    : 
@help       : %About
@options    : +g -i -t4 +y +z
@width      : 100
View Ref-File
                               BIOS  Vectors


Reset Vector

Shortly after a warm boot the OS will jump to the address contained in
the system variable resvector ($42A) if the value in the system variable
resvalid ($426) contains the magic number $31415926. The OS will supply
a return address to this code segment in register A6 but the subroutine
must not utilize the stack as neither stack pointer will be valid.
If your process needs to do cleanup in the event of a warm reset (see
"Placing a Cookie" earlier in this chapter) the following code installs
a user routine to accomplish this.

    _resvalid       equ     $426
    _resvector      equ     $42A
    RESMAGIC        equ     $31415926

                    .text

    installres:
                    move.l  _resvalid,oldvalid
                    move.l  _resvector,oldvector
                    move.l  #myresvec,_resvector
                    move.l  #RESMAGIC,_resvalid
                    rts
    myresvec:
                    *
                    * Insert user code here
                    *
                    move.l  oldvector,_resvector
                    move.l  oldvalid,_resvalid
                    jmp     (a6)

                    .bss

    oldvector:      ds.l        1
    oldvalid:       ds.l        1

                    .end

System Bell Vector

As of TOS 1.06, the OS jumps through the address contained in the system
variable bell_hook ($5AC) to ring the system bell. It is possible for
a custom routine to hook into this vector to alter the bell sound. The
user routine may modify registers D0-D2/A0-A2 and may chain to the old
bell handler if desired. It is also safe to make BIOS and XBIOS calls
following the procedure for calling from an interrupt (when not running
under MultiTOS). The routine should either jump to the old handler or
execute an RTS statement.

System Keyclick Vector

Similar to the system bell vector, another vector is called each time
a keyclick sound is generated. This vector is stored in system variable
kcl_hook ($5B0) and is entered with the keycode (not the ASCII code) of
the key struck in the low byte of D0. Registers D1-D2/A0-A2 may be
modified, however, all other registers including D0 must be maintained.
The replacement handler may either chain to a new handler or RTS.

Deferred Vertical Blank Handlers

Applications may install custom routines which are called during every
vertical blank (approx. 50-72 times per second). The OS performs several
operations during the vertical blank as follows:

   ∙ The system variable _frclock is incremented.

   ∙ The system variable vblsem is tested. If 0, the vertical blank handler
     exits immediately.

   ∙ All registers are saved.

   ∙ The system variable _vbclock is incremented.

   ∙ If the system is currently in a high resolution video mode and a
     low-resolution monitor is detected, the video resolution is adjusted
     and the vector found at system variable swv_vec is called.

   ∙ The text cursor blink routine is called.

   ∙ If a new palette has been selected since the last vertical blank, it is
     loaded.

   ∙ If a new screen base address has been selected since the last vertical
     blank, it is selected.

   ∙ Each of the "deferred" vertical blank routine handlers is called.

   ∙ If the system variable prt_cnt is greater than -1, the vector at system
     variable scr_dump is called.

   ∙ Saved registers are restored and processing continues.

To install a routine to be called as a "deferred" vertical blank handler,
you must inspect the list of handler vectors at vblqueue for a NULL slot,
replace it with your vector and initialize the next slot to NULL. The
system variable nvbls indicates the number of slots pointed to by vblqueue.
If the vertical blank handler list is filled, you may allocate a new area,
copy the old list of handlers with your handler, and update the pointer
vblqueue and nvbls.