Atari ST series Technical Reference Manual page 197

Hide thumbs Also See for ST series:
Table of Contents

Advertisement

Like the BIOS
can be called from user mode. They use registers A0-A2 and
D0-D2 as scratch registers, which means if you're program­
ming in machine language and your program uses these reg­
isters, you must save their contents before making an XBIOS
call and restore them after the XBIOS call terminates. Each of
the XBIOS routines is associated with a command number
and, optionally, command parameters that specify more pre­
cisely what it should do. For example, the XBIOS function to
set one of the hardware color registers has a command num­
ber of 7. It requires two command parameters: One tells the
function which register to set and the other specifies the new
color value (from 0 to 0x777).
To call an XBIOS function from machine language, you
must push the command parameters onto the stack, followed
by the command number, and execute a TRAP #14 state­
ment. The TRAP #14 instruction puts the program into su­
pervisor mode, and begins executing the instructions found
at the address stored in exception vector 46, whose address
is 184 ($B8). This exception vector contains the address of the
XBIOS handler that reads the command number on the top
of the stack, and directs program execution to the appropri­
ate function. When the function terminates, the program re­
turns to user mode, and the results, if any, are returned in
register DO. When an XBIOS function call is completed, the
calling program has the responsibility to adjust the stack in
order to remove the command parameters and command
number.
The following program fragment demonstrates how you
would change the value of color register 0 (the background
color) to yellow ($770) using BIOS command number 7:
move.w
#$770, — (sp)
move.w
# 0 , — (sp)
functions, the XBIOS routines
* push color value on stack
* push color register number on stack
189

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents