home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / PRINTING / HPLASER1.ZIP / HPLASER.DOC
Text File  |  1989-03-20  |  6KB  |  206 lines

  1. I had the opportunity to try the HP LaserJet Printer that the HP salesman left
  2. with me for a few days on the IBM-PC.  I was impressed with the quality of the
  3. output. I connected an RS232 cable to the COM1 port and used the following 
  4. software. "PRINT filename" will queue a file to the laser printer. To print in 
  5. "landscape" orientation, "COPY LAND PRN" before giving the print command (uses 
  6. the ROMAN 8 font cartridge). 
  7.                                        
  8.                         Ted Shapin, Oct. 18. 1984.
  9.  
  10. In AUTOEXEC.BAT, add:
  11.  
  12. mode com1:9600,n,8,1,p   [sets the baud rate and 8-bits]
  13. xonxoff                  [this is a program that does x-on/x-off handshaking]
  14. copy port prn            [this initializes the printer for portrait mode]
  15. - - - - - - - - - -
  16. This is the PORT file:   [replace "#" by an escape character in the next lines]
  17. #&l0O#&l61F              [set portrait orientation, 61 lines/page]
  18. #&a5L#&l6D               [set left margin at 5, 6 lines/inch]
  19.  
  20. This is the LAND file:
  21. #&l1O#(s17H#&l8D#&a20L   [set landscape mode, font pitch to 17, 8 lines/inch
  22.                                 left margin in column 20]
  23.  
  24. - - - - - - - - - - -    [assemble the following file and convert to .COM]
  25.         page    60,132
  26.         title   xonxoff - asynch xon/xoff support
  27.  
  28. ;
  29. ;       XONXOFF - asychronous flow control using XON XOFF 
  30. ;                 (DC1 and DC3 control characters)
  31. ;
  32. ;       this routine replaces the MODE command redirection of
  33. ;       LPT1 to COM1, in addition it handles the XON XOFF flow
  34. ;       control
  35. ;
  36. ;       note: this is a preliminary version, it will be modified
  37. ;             to handle COM1 and COM2 and a Cntrl-break out of XOFF
  38. ;             state
  39.  
  40. ;
  41. ;       Author: Jim Sturtevant
  42. ;               Coherent Software
  43. ;               June 23, 1983
  44. ;               (415) 593-7567
  45. ;
  46. ;       (c) Copyright, 1983, Coherent Software
  47. ;
  48. ;
  49. ;       constant definition
  50. ;
  51. xon             = 17                    ;DC1, control-Q
  52. xoff            = 19                    ;DC3, control-S
  53. com_init_port   = 0                     ;from tech ref page a-20
  54. com_send        = 1                     ;doc for interupt 14h
  55. com_read        = 2
  56. com_status      = 3
  57. com_line        = 0                     ;0 = COM1:, 1 = COM2:
  58.  
  59. com1_lsr        = 3fdh
  60. com1_rbr        = 3f8h
  61.  
  62.  
  63. ;
  64. ;       define necessary segments
  65. ;
  66. stack   segment para stack 'stack'
  67.         db      28h dup ('stack')
  68. stack   ends
  69.  
  70. data    segment para public 'data'
  71. msg     db      'XON/XOFF Enabled$'
  72. data    ends
  73.  
  74.         page
  75. ;
  76. ;       initial code segement
  77. ;
  78. ;               .changes INT 17h to point to this programs
  79. ;                intr procedure
  80. ;               .displays message
  81. ;               .exits and stays resident
  82. ;
  83. code    segment para public 'code'
  84. intload proc    far
  85.         assume  cs:code,ds:data,ss:stack,es:nothing
  86.         push    ds
  87.         mov     ax,data                 ;point to our data segment
  88.         mov     ds,ax
  89.         mov     ax,0                    ;es to point to interupt vec
  90.         mov     es,ax
  91.         mov     word ptr es:5ch,offset intr ;change interup rtn ptr
  92.         mov     ax,cs
  93.         mov     word ptr es:5eh,ax
  94.  
  95.         mov     dx,offset msg
  96.         mov     ah,9
  97.         int     21h                     ;display message (DOS)
  98.  
  99.         pop     ds                      ;set up for exit stay res call
  100.         sub     ax,ax
  101.         pushf
  102.         push    ds
  103.         push    ax
  104.         mov     dx,300h                 ;length of segment to retain
  105.         mov     ax,word ptr es:9eh
  106.         push    ax
  107.         mov     ax,word ptr es:9ch
  108.         push    ax
  109.         ret
  110. intload endp
  111.  
  112.         page
  113. ;
  114. ;       INTR - line printer interupt routine replacement
  115. ;
  116. ;               .this routine checks the COM line for incomming
  117. ;                characters before each character output
  118. ;               .scan for XOFF if received wait for matching XON
  119. ;               .otherwise output character
  120. ;
  121. intr    proc    far
  122.         sti
  123.         push    ds
  124.         push    dx
  125.         push    cx
  126.         push    bx
  127.         push    ax
  128.         or      ah,ah                   ;func = 0 (write character)?
  129.         jnz     irtne                   ;no, exit
  130.         call    chkcom                  ;check for XOFF
  131.         mov     ah,com_send             ;write character function
  132.         mov     dx,com_line             ;com line number
  133.         int     14h                     ;rs232 call
  134.         jmp     irtne
  135.  
  136. irtne:  pop     ax
  137.         mov     ah,90h                  ;return no error status
  138.         pop     bx                      ;See INT 17h for doc on AH
  139.         pop     cx
  140.         pop     dx
  141.         pop     ds
  142.         iret
  143. intr    endp
  144.  
  145. ;
  146. ;       this routine checks to see if there is data avaialable
  147. ;       from the COM line, if so the data is read in and checked
  148. ;       for XOFF. If XOFF another loop is begun to wait for match
  149. ;       ing XON.
  150. ;
  151. chkcom  proc    near
  152.         push    ax
  153.  
  154. chkagain:
  155.         mov     ah,com_status           ;return COM status in AX
  156.         mov     dx,com_line             ;set port #
  157.         int     14h
  158.  
  159.         and     ah,1                    ;data ready?
  160.         jz      chkexit                 ;no, return
  161.  
  162. ;       mov     ah,com_read             ;receive data
  163. ;       int     14h
  164.         mov     dx,com1_rbr
  165.         in      al,dx
  166.  
  167.         cmp     al,xoff                 ;pause output?
  168.         jne     chkagain                ;nope, keep looking
  169.  
  170. ;
  171. ;       we have received an XOFF, loop until XON received
  172. ;
  173. xonloop: mov    ah,com_status           ;return COM status
  174.         mov     dx,com_line
  175.         int     14h
  176.  
  177.         and     ah,1                    ;data available?
  178.         jz      xonloop                 ;no, keep checking
  179.  
  180. ;       mov     ah,com_read             ;yes, read it
  181. ;       int     14h
  182.         mov     dx,com1_rbr
  183.         in      al,dx
  184.  
  185.         cmp     al,xon                  ;did we get an unpause?
  186.         jne     xonloop                 ;nope, keep looking
  187.         jmp     chkagain                ;ok, make check COM line
  188.  
  189. chkexit: pop    ax
  190.         ret
  191. chkcom  endp
  192.  
  193.  
  194. code    ends
  195.         end     intload 
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.