<< Compilers
>> AmigaBasic
Many printers come with a manual that explains which Esc sequence causes
which action on the printer. But there happen weird things when you try
to send these sequences to your printer, either it does nothing, or it
does something completely different. There is a reason, the Amiga
printer drivers. These drivers are made in a way that they only understand
a certain set of ANSI Esc sequences
, not the special ones
defined (differently) by the various printer manufacturers. The purpose
is that every application on the Amiga just uses this one standard set
of control sequences and this way doesn't need to know which printer is
actually connected. The printer driver then translates these standard
sequences into the special sequences a certain printer understands.
A list of the available ANSI Esc sequences is found in the current
Workbench manuals (or older AmigaDOS manuals). Now if you want to issue
a control sequence to the printer that's not available as an ANSI
command, you have two possibilities to achieve this:
- Bypass the printer driver (that would unsuccessfully try to interpret
the sequence) and send your output only during this sequence to
`PAR:' (or `SER:', respectively). For this you have to close and
open printer output channels very often which is rather tedious, and
you have to know where (`PAR:' or `SER:') your printer is connected.
- Use a special ANSI sequence, made exactly for this case:
`Esc[<n>"<x>'
where `<n>' is the decimally typed number of bytes in the string
`<x>', which actually contains your special printer sequence. This ANSI
sequence tells the printer driver to not interpret or translate
the next `<n>' bytes.
But both methods have one big disadvantage when used in an application
program: You lose the printer independency! If you stick to ANSI sequen-
ces, you can output to any printer on earth, as long as there is an
Amiga printer driver for it. If you start to use special control sequences,
your program will be tied to this single printer model and will not be
usefull for any other (or you would have to provide some dozen new
printer drivers for your application).
Dr. Peter Kittel, peterk@cbmger.de.so.commodore.com
<< Compilers
>> AmigaBasic