home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / misc_programming / int17.spc < prev    next >
Text File  |  1990-01-04  |  6KB  |  162 lines

  1.                the Specification of Printer I/O (INT 17h)
  2.                ------------------------------------------
  3.  
  4. function:
  5.  
  6.         ah = 0h Printer character
  7.         ah = 1h Initialize printer port
  8.         ah = 2h Read the printer status into ah
  9.         ah = 3h - 0ffh reserved
  10. input:
  11.         ah - function number
  12.         dx - device number (0 - 2)
  13.                if invalid then output ah = 29h
  14. output:
  15.         ah - status
  16.                 bit 0 = 1 -- timeout
  17.                 bit 1   --   not used
  18.                 bit 2   --   not used
  19.                 bit 3 = 1 -- I/O error
  20.                 bit 4 = 1 -- printer selected
  21.                 bit 5 = 1 -- out of paper
  22.                 bit 6 = 1 -- acknowledge
  23.                 bit 7 = 1 -- not busy
  24.         note:
  25.                 error status:
  26.                 ah = 008h -- off line
  27.                 ah = 088h -- printer power off
  28.                 ah = 030h -- cable not connected with printer
  29.                 ah = 030h -- out of paper
  30.  
  31.  
  32. reference BIOS data area:
  33.                 printer port address
  34.         008h -- word -- first  port address of printer
  35.         00ah -- word -- second port address of printer
  36.         00ch -- word -- third  port address of printer
  37.                 printer timeout data
  38.         078h -- byte -- first  printer timeout counter
  39.         079h -- byte -- second printer timeout counter
  40.         07ah -- byte -- third  printer timeout counter
  41.  
  42.         note:
  43.         First  priority port is 03bch
  44.         Second priority port is 0378h
  45.         third  priority port is 0278h
  46.         case:                1      2       3     4     5      6     7    8
  47.         address  40:08h -- 03bch  03bch   03bch 03bch 0378h  0378h 0278h  X
  48.                  40:0ah -- 0378h  0378h   0278h   X   0278h    X     X    X
  49.                  40:0ch -- 0278h    X       X     X     X      X     X    X
  50.  
  51. port defined:
  52.         line printer interface via Intel 8255 with
  53.         control signals on base i/o address +2
  54.         status signals on base i/o address +1
  55.         data signals at base i/o address
  56.         port 07ch -- System register
  57.                      bit 7-3 -- reserved
  58.                      bit 2   -- adapter local power control
  59.                                 0 = power off
  60.                                 1 = power on
  61.                      bit 1   -- reserved
  62.                      bit 0   -- 0 = secondary
  63.                                 1 = primary
  64.         port 278h-27fh -- parallel printer port 2
  65.         port 378h-37fh -- parallel printer port 1
  66.         port 3bch-3bfh -- parallel printer port 0
  67.         controll:
  68.     bit 7 -- not used
  69.     bit 6 -- not used
  70.     bit 5 -- not used
  71.     bit 4 -- +IRQ enable (interrupt on -ACK true to false)
  72.     bit 3 -- +SLCT IN  (true for printer select)
  73.     bit 2 -- -INIT     (minimum 50 microsecond true to false pulse)
  74.     bit 1 -- +AUTO FEED(true makes printer line feed after carriage return)
  75.     bit 0 -- +SRTOBE   (1/2 microsecond minimum false to true pulse)
  76.  
  77.         status:
  78.     bit 7 -- -BUSY   (true indicates printer may not accept data)
  79.     bit 6 -- -ACK    (false indicates printer ready to accept another byte)
  80.     bit 5 -- +PE     (true indicateds paper out conditions)
  81.     bit 4 -- +SLCT   (true means printer selected)
  82.     bit 3 -- -ERROR  (false means error condition detected)
  83.     bit 2 -- INT_STA (if intterrupt enable,'acknowledge' will set this bit)
  84.     bit 1 -- not used
  85.     bit 0 -- not used
  86.  
  87.         note:
  88.                 ACK  - acknowledge
  89.                 INIT - initialize
  90.                 PE   - paper end
  91.                 SLCT - select
  92.                 INT_STA - interrupt status
  93. programming:
  94.         initialize:
  95.                 check printer number (0 - 3)
  96.                 get timeout value
  97.                 get base port address for requested printer number
  98.                 check calling function number (0 - 2)
  99.         output command:
  100.                 ah -- printer status
  101. Note:
  102.  1. This interrupt provide printer interface.
  103.  
  104. PRINT CHARACTER
  105.         input:
  106.                 ah = 0
  107.                 al = character
  108.                 dx = device number
  109.         output:
  110.                 ah = printer status
  111.         programming:
  112.                 test busy
  113.                 if timeout then set timeout flag
  114.                 else strobe the printer
  115.                      read status
  116.  
  117. Note:
  118.  1. If printer busy then call Printer Device Busy function (INT 15h, AX=90FEh)
  119.  
  120.  2. The time-out value is looked up in the ROM BIOS data area and
  121.     multiplied by 1 second.
  122.  
  123.  3. It must be delay within 2 to 5 microseconds to strobe the printer.
  124.  
  125.  
  126.  
  127. INITIALIZE PRINTER PORT
  128.         input:
  129.                 ah = 1
  130.                 dx = device number
  131.         output:
  132.                 ah = printer status
  133.         programming:
  134.                 reset the bit2 of printer control port
  135.                 50 microseconds at least then set on.
  136.                 read printer status.
  137.  
  138. Note:
  139.  1. It must be delay at least 50 microseconds to initialize printer.
  140.  
  141.  
  142.  
  143. READ THE PRINTER STATUS INTO AH
  144.         input:
  145.                 ah = 2
  146.                 dx = device number
  147.         output:
  148.                 ah = printer status
  149.         programming:
  150.                 read from printer status port
  151.                 clear bit 2-0 (unused)
  152.                 inverse bit 6 -- acknowledge
  153.                         bit 3 -- i/o error
  154.  
  155.  
  156.  
  157. AH = 3H - 0FFH RESERVED
  158.         input:
  159.                 ah = 3h - 0ffh
  160.         output:
  161.                 none (ax is changed)
  162.