EasyManua.ls Logo

Atari ST series - Page 182

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 A
move.w #'X', (sp) * push character value on stack
move.w #2, (sp) * push console device number on stack
move.w #3, (sp) * push BIOS command number on stack
trap #13 * call BIOS handler
addq.l #6,sp * pop parameters (6 bytes) off stack
Calling the BIOS routines from C is much simpler. Most
C compilers come with a library routine called bios(), which
stacks the parameters and executes the TRAP #13 instruc
tion. For example, the sample call illustrated above could be
accomplished in C by the single statement
bios(3,2,'X');
Since it's easier to remember a command name than a
command number, most C compilers include a header file
called OSBIND.H that defines macros for all of the BIOS
functions. For example, the macro definition for BIOS com
mand 3 is
#define Bconout(a,b) bios(3,a,b)
Therefore, after you #include OSBINDS.H in your pro
gram, you can call the sample function like this:
Bconout(2,'X');
To use BIOS functions in your C programs, you must
#include OSBIND.H if you use the macros, and you must
link your program with the library that contains the bios()
function.
174

Related product manuals