home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Unsorted BBS Collection
/
thegreatunsorted.tar
/
thegreatunsorted
/
programming
/
misc_programming
/
int17.spc
< prev
next >
Wrap
Text File
|
1990-01-04
|
6KB
|
162 lines
the Specification of Printer I/O (INT 17h)
------------------------------------------
function:
ah = 0h Printer character
ah = 1h Initialize printer port
ah = 2h Read the printer status into ah
ah = 3h - 0ffh reserved
input:
ah - function number
dx - device number (0 - 2)
if invalid then output ah = 29h
output:
ah - status
bit 0 = 1 -- timeout
bit 1 -- not used
bit 2 -- not used
bit 3 = 1 -- I/O error
bit 4 = 1 -- printer selected
bit 5 = 1 -- out of paper
bit 6 = 1 -- acknowledge
bit 7 = 1 -- not busy
note:
error status:
ah = 008h -- off line
ah = 088h -- printer power off
ah = 030h -- cable not connected with printer
ah = 030h -- out of paper
reference BIOS data area:
printer port address
008h -- word -- first port address of printer
00ah -- word -- second port address of printer
00ch -- word -- third port address of printer
printer timeout data
078h -- byte -- first printer timeout counter
079h -- byte -- second printer timeout counter
07ah -- byte -- third printer timeout counter
note:
First priority port is 03bch
Second priority port is 0378h
third priority port is 0278h
case: 1 2 3 4 5 6 7 8
address 40:08h -- 03bch 03bch 03bch 03bch 0378h 0378h 0278h X
40:0ah -- 0378h 0378h 0278h X 0278h X X X
40:0ch -- 0278h X X X X X X X
port defined:
line printer interface via Intel 8255 with
control signals on base i/o address +2
status signals on base i/o address +1
data signals at base i/o address
port 07ch -- System register
bit 7-3 -- reserved
bit 2 -- adapter local power control
0 = power off
1 = power on
bit 1 -- reserved
bit 0 -- 0 = secondary
1 = primary
port 278h-27fh -- parallel printer port 2
port 378h-37fh -- parallel printer port 1
port 3bch-3bfh -- parallel printer port 0
controll:
bit 7 -- not used
bit 6 -- not used
bit 5 -- not used
bit 4 -- +IRQ enable (interrupt on -ACK true to false)
bit 3 -- +SLCT IN (true for printer select)
bit 2 -- -INIT (minimum 50 microsecond true to false pulse)
bit 1 -- +AUTO FEED(true makes printer line feed after carriage return)
bit 0 -- +SRTOBE (1/2 microsecond minimum false to true pulse)
status:
bit 7 -- -BUSY (true indicates printer may not accept data)
bit 6 -- -ACK (false indicates printer ready to accept another byte)
bit 5 -- +PE (true indicateds paper out conditions)
bit 4 -- +SLCT (true means printer selected)
bit 3 -- -ERROR (false means error condition detected)
bit 2 -- INT_STA (if intterrupt enable,'acknowledge' will set this bit)
bit 1 -- not used
bit 0 -- not used
note:
ACK - acknowledge
INIT - initialize
PE - paper end
SLCT - select
INT_STA - interrupt status
programming:
initialize:
check printer number (0 - 3)
get timeout value
get base port address for requested printer number
check calling function number (0 - 2)
output command:
ah -- printer status
Note:
1. This interrupt provide printer interface.
PRINT CHARACTER
input:
ah = 0
al = character
dx = device number
output:
ah = printer status
programming:
test busy
if timeout then set timeout flag
else strobe the printer
read status
Note:
1. If printer busy then call Printer Device Busy function (INT 15h, AX=90FEh)
2. The time-out value is looked up in the ROM BIOS data area and
multiplied by 1 second.
3. It must be delay within 2 to 5 microseconds to strobe the printer.
INITIALIZE PRINTER PORT
input:
ah = 1
dx = device number
output:
ah = printer status
programming:
reset the bit2 of printer control port
50 microseconds at least then set on.
read printer status.
Note:
1. It must be delay at least 50 microseconds to initialize printer.
READ THE PRINTER STATUS INTO AH
input:
ah = 2
dx = device number
output:
ah = printer status
programming:
read from printer status port
clear bit 2-0 (unused)
inverse bit 6 -- acknowledge
bit 3 -- i/o error
AH = 3H - 0FFH RESERVED
input:
ah = 3h - 0ffh
output:
none (ax is changed)