Intermec 6100 Reference Guide

Page of 328
SECTION 2
Supporting DOS Applications
PEN*KEY
R
 6100 Computer Programmer’s Reference Guide    2-11
To write to the device, use any appropriate output function that can be directed
to the device (for example, in C programming language, you can use
fprintf()
).
You should install a critical error handler that process errors from the printer.
The printer driver returns only device not ready" errors to DOS for the sake of
compatibility with the standard PRINT program supplied with DOS.  You can
retrieve the extended error by bypassing DOS and calling the driver directly
from the error handler.
Ioctl calls (DOS Function AH = 44h, AL = 02h) are supported by the device drivĆ
er (refer to a DOS technical reference manual for detailed information relating to
this function).  Calls require the handle number of the printer device in register
BX, a data item with the following structure pointed to by DS:DX, and the numĆ
ber of bytes to be read in register CX.
struct ioargs {
far *unsigned char ioctl_cmd;
far *unsigned char ioctl_buf;
};
The following commands may be pointed to by the ioctl_command field for execuĆ
tion by the driver:
ONLINE = 2
STATUS = 3
GET DEVICE FEATURES = 4
SELFTEST = 5
RESET
= 6
GET CURRENT CONFIGURATION =7
XTENDED ERROR = 255
Data is returned to the buffer pointed to by the ioctl_buf, for the number of bytes
specified in register CX when the ioctl call is made.  The first byte of the reĆ
turned data represents any error encountered during the call.  If the call was
successful, this byte is set to zero.  If the call was unsuccessful, this byte repreĆ
sents the extended error.  The format of the rest of the data is described in the
documentation for the printer being communicated with.
Notes
The printer driver must be opened and closed for each report transaction with
the printer if you want to take advantage of the lineĆloss detection features of
NPCP.  Applications should status (ioctl 3) the printer after the last line of a reĆ
port or a series of reports are sent to the printer to ensure that all lines were
printed successfully by the printer.
The printer driver is multitasking.  If the application needs to take full advanĆ
tage of this feature, it must enable time slicing through the appropriate call to
INT 15h  (refer to the 4000API documentation).
If timeĆslicing is not activated, the last line buffered by the driver is not sent to
the printer until the device is closed or an ioctl status call to the printer is made.
You should perform a ioctl status call before all closes to ensure that the driver
print buffer is sent to the printer successfully, since DOS closes to character deĆ
vices do not perform output flushes as part of the close operation.  The driver
flushes the buffer for you upon a close, but no error is returned if the flush is unĆ
successful.
2. DOS 
Applications