PRINT_SWEEP specification

## HP 720 SCP protocol Following is the probable specification for the SCP protocol on 720 printers. Thanks to Jim Peterson and Ben Boule for much of this information.
Bytes | Description
2 | Command specifier
2 | Packet length (N)
1 | Priority
1 | Blank (always zero)
2 | Command reference number
4 | Number of channel 0 bytes this packet processes
4 | Always (00 02 00 00) - version number?
N-16 | Data, including parameters to this command
Several of the commands are described below: CS=0x186, CR=1 (INIT_COM ?) This is some sort of initialization command. It probably initializes the communications channel, since it is always the first packet sent by the windows driver. It's data consists of 8 bytes that I have only seen as:
      00 00 01 F4 01 00 00 00
CS=0x18F, CR=2 (INIT_DATA ?) This is another initialization command. It is sent once at the beginning of each file printed, after the INIT_COM packet. It is preceded by a 4-byte VLink packet sent to channel 0. This suggests that it somehow initializes the data channel of the printer (thus our temporary name). This packet typically contains the values: `DE AD BE EF`. The data portion of this command usually contains the following 8 bytes:
      DE AD BE EF 02 00 00 00
CS=0x183, CR=1 (INIT_PAGE ?) This command is sent each time before a page is loaded. It appears to set some parameters for the page, possibly the minimum and maximum horizontal positions for each of the four pens (?). The only data I have seen it contain is the following:
      28 2D 00 41 2D 32 00 46  2D 32 00 46 2D 32 00 46
CS=0x181, CR=1 (HANDLE_MEDIA) This is the command that handles loading and ejecting of pages.
1 | 1=load, 2=eject
1 | ?? usually 0x01
2 | usually 0x12C0 (4800 decimal), perhaps the horizontal position to place the print-head while loading/ejecting the page. 4800 corresponds to 8" from the left.
CS=0x180, CR=1 (PRINT_SWEEP) This is the print sweep command. It causes the print head to print a sweep of data (which has previously been sent over channel 0). The PRINT_SWEEP command controls the print head while printing data on a page. It can take on two forms, one when printing with the black nozzles, and one when printing with the color nozzles. The black form is described in the most detail here, since it is what I have devoted the most attention to. Following is the format of the first 48 bytes of data for this command:
Bytes | Description
1 | always 0x00
1 | 1 = compressed, 0 = not compressed
1 | 2 = left-to-right, 1 = right-to-left
1 | 1 = black, 0xE = CMY colors
4 | Compressed size of data
8 | Typically 0
4 | Signed number representing vertical position
2 | Usually 0x8CA0 (36000 decimal)
2 | Horizontal position for left margin in dots
2 | Horizontal position for right margin in dots
2 | 0x5DC0 (24000) for econo/normal, 0x4650 (18000) for best quality
2 | Usually 0x12C0 (4800)
2 | Usually 0x0100 - has something to do with horizontal placement
1 | If 0, this is the last sweep on the page; the next 12 bytes are ignored. Otherwise, this field predicts the print head direction for the next PRINT_SWEEP command
1 | Prediction of number of colors in next PRINT_SWEEP (0x01 or 0x0E)
4 | Vertical position of next sweep
2 | Horizontal position for left margin in next sweep
2 | Horizontal position for right margin in next sweep
2 | Predicts the third-to-last word (2-byte value) of the next sweep packet - 0x5DC0
2 | Usually 0x12C0 - predicts the second-to-last word of the next sweep packet
1 | 0x08
1 | Number of 16-byte rows to follow this header. This is 2 for black and 6 for CMY.
Following this header are sets of 16-byte rows to describe how to handle the nozzles. The odd nozzles are described by the first row, and the even nozzles are described by the second row.
Bytes | Description
2 | DPI (dots per inch) - 300 or 600
2 | Half of the total number of pins used
2 | Number of unused pins + 1
2 | First pin to start printing with, typically 1
2 | Half of the total number of pins used
2 | Left margin in dots. For black printing, this is always 0x02 greater for the odd pins (first set) than the even pins
2 | Right margin in dots.
1 | Some sort of delay before this set of nozzles starts firing. For black, odd nozzle is 07, even is 00. For color, the first set of nozzles is 04, the next set is 06, and the last set is 00
1 | 0