future models of the ST, even if the graphics hardware
changes significantly. A good example of this is that software
using line A routines automatically benefits from the blitter
hardware in the Mega ST line, since the blitter ROMs use
that hardware to implement the line A routines.
The line A routines operate by taking advantage of a fea
ture of the 68000 microprocessor's exception handling. No
valid computer instruction (opcode) on the 68000 starts with
the binary digits 1010 (or the ASCII character A in hexadeci
mal notation). Therefore, when the processor encounters an
instruction that starts with that number, it triggers the Op
code 1010 Emulation exception. The processor is thrown into
Supervisor mode and program execution is routed through
exception vector 10, meaning that the processor starts execut
ing the program whose address is stored at location 40 ($28).
On the ST, this exception vector points to the line A handler,
which routes execution to the proper graphics primitive.
After the line A function is performed, program execution re
sumes at the instruction immediately following the line A op
code.
A IK section of RAM is set aside on the ST for the stor
age of graphics-related variables. Whenever you need to pass
information to one of the line A routines, such as where to
draw a line or what color to make the line, store that infor
mation directly in the line A variable table (see Appendix H
for a complete description of line A variables). Information
stored in the table generally remains intact from call to call,
which means that you don't have to store it in the table
again when you know it's already there. Note, however, that
GEM calls use the same variable table, so if you call GEM
routines between calls to line A, you may find that some of
the variables have changed in value.
When all of the information you need for a line A opera
tion is stored in the variable table, call the desired line A rou
tine by placing its opcode in your machine language pro
gram. Since there are no official opcode mnemonics for these
instructions, code them in the form
dc.w $A00x
where x is the opcode number from $0 to $F. For example, to
call function 0, the line A initialization function, you would
use the instruction
136
CHAPTER 7