[comp.sys.amiga] Patch for HP_DeskJet Driver

allen@hpfcdj.HP.COM (Allen Norskog) (05/24/89)

This is a description of a patch you can make to the HP_DeskJet
printer driver to give you more consistent results when printing.
The patch changes one byte in the driver so that the printer
driver can give the same defaults as used by the DeskJet printer.

BACKGROUND  

When the DeskJet is powered on, or is reset, it uses a default 
page with 0.5 inch blank space on the top and bottom. With 
8.5 x 11 inch paper, this translates to 3 blank lines at 
the top and 3 blank lines at the bottom, and 60 lines of text
per page.

The Amiga HP_DeskJet driver allows for more lines per page by
sending out an escape sequence to set only 2 blank lines at
the top.  (You can get up to 62 lines on a page by using 
the custom paper size in preferences and specifying 62 
lines.)  However, it appears that the DeskJet can't handle
this switch in the page size for the first page it prints after
a reset/power up.  (The LaserJet could handle it fine.)  Thus,
you generally get one less line on the first page.  To get
around this you can force a blank page to be ejected first
by entering the command:

echo >prt:

Trying to remember to do this is a pain.  Getting different
number of lines per page can be a pain, too. 

The escape sequence that sets up the page size can be easily
found in the printer driver, and can be modified to specify
3 blank lines at the top instead of 2.  You will also need
to set the custom paper size in preferences to 60 lines.

To see the escape sequence, get a hex dump of the driver by 
cd'ing to the printer directory and using type with the opt=h
option.  Like:

cd df0:devs/printers
type hp_deskjet opt=h

You'll find the escape sequence of interest about 3/4 of the
way through.  It is in the lines that look like:

1020: 70307333 74307531 32561B26 6C303032    p0s3t0u12V.&l002
1030: 65303030 46001B26 61303030 6C303030    e000F..&a000l000

The sequence we're interested in is <ESC>&l002e00F
From the manual, you can see that this sets the top margin and
text length.

It's the "2" that we want to change to a "3".  (Change 32 hex to 33 hex.)

MAKING THE CHANGE

Make the change on a copy of the driver.  I recommend that the modified
driver have a new name, so that you can tell the original from the
modified version.  So, make a copy like:

copy hp_deskjet hp_deskjet_m3

Now, we need to edit the driver, but we need a "binary" editor instead
of a text editor.  I have a couple of utilities of my own that I have
used, but for everyone else, I'll describe how it can be done with
NewZap, which is available on a Fred Fish #164.

Call up NewZap and read in hp_deskjet_m3.  Go down 8 pages, and you
should see the string in the right hand window in the middle of the
second line.  Click on the "2" in the right hand window.  Hit "3".
The left hand window will show that the byte was also changed (from 32
to 33 hex).  Hit the save button near the bottom.  You should see your
disk light go on.  Then exit NewZap.  Change your preferences to
point to the new driver, and check that you have a custom page size
of 60 lines.

DISCLAIMER

I've experimented a little with the modified driver, and everything 
seems to work the way I expect.

I do not work for the part of HP that makes the DeskJet.  The information
above is based on information about the escape sequences in the manuals
and from simply trying things out.

Allen Norskog
allen_n@hpfcla.hp.com