EasyManua.ls Logo

Atari ST series - Page 198

Atari ST series
420 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
APPENDIX B
move.w #7, - (sp) * push XBIOS command number on
stack
trap #14 * call XBIOS handler
addq.l #6,sp * pop parameters (6 bytes) off stack
Calling the XBIOS routines from C is much simpler.
Most C compilers come with a library routine called xbios(),
that stacks the parameters and executes the TRAP #14 in
struction. For example, the sample call illustrated above
could be accomplished in C by the single statement
xbios(7,0,0x770);
Since it's easier to remember a command name than a
command number, most C compilers include a header file
called OSBIND.H.H that defines macros for all of the XBIOS
functions. For example, the macro definition for XBIOS com
mand 7 is:
#define Setcolor (a,b) xbios(7,a,b)
Therefore, after you #include OSBIND.H.H in your pro
gram, you can call the sample function like this:
Setcolor(0,0x777);
The C macro format is the one most commonly found in
discussions of XBIOS routines and sample programs. To use
XBIOS functions in your C programs, you must #include
OSBIND.H if you use the macros, and you must link your
program with the compiler library that contains the xbios()
function.
190

Related product manuals