The HPGL Digitizer/Plotter/Sound (DPS) Project

Why and how

At the time of the HP 9845, computer graphics were mostly defined through vector design. Devices producing raster images like digital cameras (which were not yet invented) were uncommon and scanners were highly expensive. So graphics in general went all the way from digitizing sketches and diagrams over on-screen viewing and editing towards finally plotting the results with flatbed or large format plotters. This was pretty well suited for engineering applications like CAD, and even today flatbed plotters like the HP 7475A are still quite popular, e.g. as cutting plotter.

DPS Project

Consequently, the HP 9845 had a broad support for digitizing and plotting hardware. This included drivers and interfaces for the 9874A digitizer and the 9111A graphics tablet for digitizing input, and for more than ten different plotter types for output. HP also developed vector CRT display controllers like the 1350A/1351A, which could be programmed very similar like a plotter. Digitizer were not only used for capturing coordinates from existing drawings, but also played an important role as human interface, i.e. as hand-eye control device (a role later occupied by computer mice, see the 9845 mouse project for details).

The secret behind the support for such a large number of graphics devices is easily explained. HP early decided to design its own device independent graphics language and simply called it "HP Graphics Language" or just HPGL. This language could be used both as graphics input and output language, and as such could be used both for transferring graphics data from a digitizer to the computer, and for sending it from the computer to a plotter for a hardcopy.

This project now is dedicated for all those, who want to use the graphics input and output features of the HP 9845, but don't own a digitizer or a plotter, or both. Similar to other projects like the HPDrive project, this project aims on providing an emulator running on a standard PC, which can be used from the vintage host via a HP-IB connection. And it uses HPGL for both input and output, thereby simulating several digitizer and plotter types, including the popular 9111A graphics tablet and the 9872A flatbed plotter.

DPS Project 2

Another subject of this project is sound. Yes, real sound. Not the built-in 9845 speaker which is limited to a non-modulated beep, but real sound. Not much known, the HPGL command set included an instruction for generating tones with control of frequency, duration and amplitude, a feature which is at least implemented in the 9111A graphics tablet and the 9874A digitizer. The emulator connects these commands directly to the MIDI device of a standard sound card, enabling the 9845 to play MIDI through the HP-IB on the PC.

Actually, use of this digitizer/plotter/sound (DPS) emulator is not limited to an HP 9845. Due to the widely device-independent nature of HPGL, it should work in principal with many other HPGL capable systems. It has been roughly tested (successfully) both with an HP-86 and an HP9836. However, though the execution of HPGL commands is not a science, the HP-IB part of the emulator is still quite sensitive to the not completely standardized, system dependent use of the HP-IB bus.

Just like with the HPDrive utility for mass storage, an HPGL emulator will of course never really replace the feeling with a real graphics tablet and real plotters with their pens flying across the paper. But it can be quite useful if you like to explore the vector graphics capabilities of the HP 9845 without owning the appropriate input/output devices.

Background: HPGL

It is hard to determine the exact birth date of the HP Graphics Language (HPGL, or HP-GL). Fact is, that the HPGL was one of the first and certainly still is the most important plotter language. Originally designed as part of the development of the 9872A plotter (the grandfather of all HPGL devices) in the early 70's, HPGL is a page description language similar to PCL, Postscript or PDF. Actually, PCL, as also developed by HP for its printers, inherits HPGL as a subset, and many printer drivers are still capable of printing HPGL instructions. Although originally designed as a plotter control language and later extended for digitizing input, HPGL can also be used as an interchange format for vector graphics data. Actually, CAD applications still use HPGL as a basic interchange format. There is no special file meta data required, the HPGL commands can be directly 'printed' into a file instead of sending them to an output device to obtain a valid HPGL data file.

The success of HPGL probably goes back to several aspects. First of all, HPGL is a quite simple and easy to implement format. It uses plain ASCII text with two-letter command mnemonics and optional command parameters, with one command per line. Next, the HP plotters (all supporting HPGL) as primary hardware base were and still are standard. And finally, HPGL, although lean designed, covers almost all requirements for 2D vector graphics, except including raster images. With the development of new devices HPGL was stepwise extended. Finally, with HPGL/2, the original HPGL specification was completely modernized.

With vintage computers, HPGL plays a key role in control of graphics devices and storage of graphics data. Using HPGL as base technology, operating systems like that of the HP 9845 could implement vector graphics support with a universal, unified approach. Adding another graphics device basically required just adding another HPGL driver for this device. Input and output devices could be simply connected by just using the first as HPGL source and the latter as HPGL sink. Some devices even support direct communication between e.g. a digitizer and a plotting device.

The HP 9845 (as most systems developed by HP) already implements support for a basic set of HPGL commands. Actually, the whole HP 9845 graphics subsystem, including the screen graphics, can work as either input or output device being controlled by commands very similar to HPGL commands. The standard input device is controlled in BASIC by the GRAPHICS INPUT IS, and the standard output device is specified by the PLOTTER IS commands. For example, using PLOTTER IS "GRAPHICS" directs all vector output the the CRT, whereas PLOTTER IS "9872A" generally guides all graphics output to a 9872A plotter connected via HP-IB. Since all 9845 graphics commands (sometimes referred to as 'AGL') can be translated into proper HPGL commands, developing a driver for a 9845 graphics device is a comparably easy task.

The HPGL syntax is extremely basic. HPGL devices are controlled via sending ASCII strings to them, and results are received from HPGL devices as ASCII strings, too. Each control string can hold a (theoretically) arbitrary number of HPGL commands, separated by semicolons. It is recommended to terminate each string with a linefeed character. Whitespace characters and characters which can't be interpreted are generally ignored.

The command syntax consists of a two-byte mnemonic in either upper or lower case designating the requested operation, plus a variable number of comma separated parameters, depending on the command. Once defined, parameters in general can be skipped by leaving the space between two commas empty. In this case, the last specified value for the omitted parameter (either from initial defaults or from a previous command) will be substituted.

There are several documents on HPGL available for download at hpmuseum.net. See this link for several HPGL programming guides and command summaries.

Note:

In addition to the standard HPGL syntax there is a special mechanism implemented in some HP-IB interfaced devices like the 9111A, which provide a specially efficient way of requesting status information, which is called binary transfer. Normally, data is sent from an HPGL device to the host only as reply to a previous HPGL output command. Once a 9111A is addressed by the host via HP-IB as a talker without sending an HPGL command before, it immediately sends a compact binary status summary to the host in six defined bytes, holding the current status word plus the current stylus coordinates.

Sending an HPGL command from an HP 9845 to an HPGL device is quite simple. Just use the OUTPUT command from BASIC to send the HPGL command string to the connected graphics tablet or plotter, for example

OUTPUT 706;"IN"

initializes the device with HP-IB address 6 at select code 7 (the standard select code for the HP-IB interface). If there is a return value expected from an HPGL device, this return value can be read with an appropriate ENTER command. For example, in order to request and read in a digitized point from a 9111A graphics tablet, use

OUTPUT 706;"OD"
ENTER 706;Reply$

And you can check the contents of Reply$ for digitizing data.

There is much software available for handling HPGL files, e.g. for the generation, conversion and output of HPGL data (even open source). A special package should be mentioned here, the hp2xx utility developed by Heinz W. Werntges and Martin Kröker and distributed via GNU/FSF, which can be used to convert HPGL output into many standard bitmap formats, i.e. to plot HPGL files into raster images, which can then be used for any other purpose (printing, editing, whatever). The use of this package is described later on in the section "Working with HPGL Files".

Sound

A special yet mostly unknown feature of the 9111A graphics tablet is the BP command. Although not really part of the "official" HPGL command set, this command followed the common HPGL syntax. It was accompanied by three parameters: frequency, duration and amplitude, and could be used to produce programmed sound output with the built-in beeper. I don't know how many devices actually supported this command, however at least the 9111A graphics tablet and its big brother, the 9874A digitizer both did.

Beep

Primarily intended as some means for supplying feedback for user actions like acknowledgements or errors, the BP command can do much more. The frequency range covers full four octaves, with a value of 0 from the C two octaves below the middle C up to a value of 48 for the C two octaves above the middle C, incrementing with each half tone. The duration parameter has a resolution of one millisecond and covers a range between 1 and 32,767 ms. The amplitude value starts and 0 (silence) and goes up to 5 (loudest tone). Once a parameter was set in one BP command, it will be remembered for the following BP commands if no new value is being assigned.

So for example the command

"BP24,150,4"

produces a middle C tone with a duration of 150 ms and the second loudest amplitude.

The command sequence

"BP12,150,4;BP16;BP19"

produces the "hello" startup tone sequence (C, E, G) and

"BP36,50,3;BP34;BP32;BP30"

produces the standard error tone sequence (C, A#, G#, F#).

Notes Table

The 9111A Graphics Tablet User's Manual gives some hints on how to use the sound feature for audible prompts as feedback to the operator of the graphics board. It was recommended to use short beeps for digitizing actions, ascending tone sequences for indicating inquiries, descending tone sequences for acknowledgements, and a special error tone sequence (see above) for indicating false inputs.

The HPGL Digitizer/Plotter/Sound emulator maps all note information on standard general midi presets, so if you like you can produce high quality "grand piano" music controlled by your HP 9845. You can change the preset in the emulator's Options menu.

Unfortunately (at least as far as I know) there are - except the demos and excercisers - very vew applications which use the sound capabilities of the 9111A graphics tablet. Not even one single HP 9845 game. But feel free to write your own. See the 9845 Game Design Tutorial for some more information.

The HPGL DPS Emulator

Just as the name suggests, the Digitizer/Plotter/Sound (DPS) emulator program provides three emulations in one:

  1. A digitizing device (9111A graphics tablet),
  2. a plotting device (9872A flatbed plotter), and
  3. a sound device (again 9111A graphics tablet).

The digitizing and plotting devices can be customized to respond to the host as any other HPGL device (e.g. a 9874A instead a 9111A, or a 9872B instead a 9872A), however the supported functionality is implemented for the devices mentioned above, which are also used as defaults.

The emulator is a normal windows application with user interface. Yes, graphical user interface, in contrast to most other utilities I normally write as console applications, and when you have a look the application, you'll immediately understand the reason why.

The principle for the 9111A emulation is as follows: The digitizer's stylus is substituted through the PC's mouse pointer, and the digitizer's built-in HP-IB interface is substituted by a GPIB board installed in the PC. And the emulator does all logic in between. Mouse clicks are translated into 'stylus pressed' messages, and beep commands are translated into proper MIDI commands and so on.

All HPGL commands received from the host can be logged into an arbitrary file. Now just change the devices identification into that of a 9872A plotter, and voilà, the device works as 9872A emulator catching all HPGL commands in a file, which can then be printed by the PC's printer or converted ("plotted") into common raster image formats.

GUI

The user interface stays the same, independent what type of HPGL device is configured, it always looks like a 9111A graphics tablet. The user interface has two modes, one with a 9111A skin (looks really realistic) and a smaller platen area, and another without skin with a much larger platen area (better suited for detail work). You can switch any time between those views using the "view->skin" menu entry.

DPS GUI

Emulator View with 9111A Skin

The LEDs shown in the skinned view just operate like the ones of a real 9111A graphics tablet, however when configured as a plotter, plotting activity is shown with the green digitize LED (to see that's something going on).

No Skin

Emulator View without 9111A Skin (Platen only)

The softkey bar below the menu is supplied for convenience and acts just the same as clicking into the softkey boxes on the platen. The keys on the bar even work when the whole platen area is configured for digitizing and softkey boxes are disabled. The softkey bar can be enabled and disabled with the "view->softkey bar" menu entry.

The bottom status bar shows the current tablet coordinates and the stylus status, it can be enabled and disabled with the "view->status bar" menu entry.

Loading Menu Sheets

The menue entry "file->open menu" can be used to load a preconfigured menu sheet on the platen. There are two special menu sheets supplied, one for the 9111A draw program and one for the editor program. Each sheet ist provided both for the skinned view (small sheet) and for the non-skinned view (large sheet).

9111A with draw menu sheet

DPS Emulator (skinned View) with Draw Menu Sheet

You can use these sheets as templates to design your own. The 9111A draw and edit programs are available for many vintage HP platforms, including the HP 9845 and the HP85/86/87. See the hpmuseum software section for 9845 software download (use this link) and the series80.org site for HP85/86/87 software (use this link).

Options

The "options" menu entry shows a configuration dialog to customize the most important options, like

Option Dialog

The binary response is normally switched on, however in case a host is not aware of this feature, wrong use of the GPIB bus may confuse the HPGL device, in which case the binary response should be disabled.

Please note that the 9874A emulation option is added more or less for experimental use, since I personally do not own a 9874A digitizer. In fact, many 9874A specific instructions are not yet supported.

System Requirements and Installation

The HPGL DPS emulator should work under all 32 bit Windows version (Windows 95 and above).

In principle, the emulator should work with most vintage system which can talk to an HPGL device via HP-IB/GPIB. Proper operation has been roughly tested on an HP 9845, an HP-86 and on an HP9836 (aka HP9000 model 236). I'd be glad to receive some feedback from you whether it works on other systems as well.

Both the vintage host and the PC must be equipped with an appropriate IEEE488/GPIB-Interface. At the PC side, currently the NI 488.2 API is supported. Also there is direct support for NI PCI-GPIB with custom TNT4882 driver and AT-GPIB/TNT. Other boards like uPD7210 based boards are still under development.

Depending on the GPIB interface board installed, it may be necessary to install the appropriate driver. Using direct access to ISA boards under Windows 2000/XP/Vista will require the installation of the DlPortIO driver package. Using a NI 488.2 compatible hardware requires the installation of NI's NI488.2 standard drivers. The HPGL DPS emulator also works with my custom TNT4882/TNT5004 driver.

Playing music on the HPGL DPS emulator requires (of course) a MIDI capable sound hardware on the PC.

For Installation, copy the files from the archive into a directory of your choice. The skin and the menu sheet bitmap files should be in the same directory with the executable 9111.exe.

Use as a 9111A Graphics Tablet

When launched, the HPGL DPS emulator is configured as 9111A graphics tablet and can be immediately used as such.

The 9111A was a "low cost" and compact alternative ($1,950) to its heavy and expensive ancestor, the 9874A digitizer ($7,200). It was designed for both digitizing drawings/diagrams and for acting as a mouse-like human interface for cursor control. It was quite popular at the time of the HP 9845 and most graphical applications supported the 9111A as input device. The tablet platen could be configured into two separated areas, the digitizing area and the softkey area. Four LEDs informed about operating conditions, and a programmable beeper could be used to produce audible prompts and even to play music compositions.

9111A

9111A Graphics Tablet with Standard Manual Set

The tablet platen was designed to hold either the drawings for digitizing, or prepared menu sheets for program control (there were transparant overlays which could be used to fixate the sheets on the platen).

All device coordinates could be transformed into world coordinates by the HP 9845 built-in graphics commands. The tablet functionality could be either addressed with those high level commands, or directly programmed in HPGL with the common HP 9845 I/O commands (OUTPUT, ENTER). The standard GPIB device address was set to 6 by default and could be configured to other GPIB addresses.

The tablet can be operated in several, software selectable digitizing modes. See the 9111A Graphics Tablet User's Manual for details.

The mouse pointer position is directly mapped to the device stylus position. Pressing the mouse button is mapped to 'stylus pressed', positioning the mouse pointer within the platen area is mapped to 'stylus is on plate', and leaving the platen is mapped to 'stylus removed'. All BP (beep) commands are directly mapped to appropriate MIDI messages (assuming a sound card is installed).

The user interface can either operate in a skinned mode (looking like a real 9111A, but with a smaller platen) or in a mode without skin ("platen-only") but with a larger digitizing area (use "view->skin" from the application menu bar to switch between both modes).

If required, menu sheets can be loaded in form of bitmaps on the platen via the "file->open menu" entry in the application menu bar. Two special menu sheets for the 9111A draw and editor programs are supplied. Please note that different menu sheets sizes are available depending on whether the emulator is used in skinned or platen-only viewing mode.

9111A Software

The standard 9111A software which is available on most platforms are the 9111A Draw and Editor programs. Draw, as the name suggests, is a standard drawing application which can be used to create, load, modify, plot and save vector images. The Editor program is intended for creating you own menu driven applications, including designing your own menu sheets. There are several examples, e.g. for logic circuit design.

Use as a 9872A Flatbed Plotter

The 9872A flatbed plotter was the grandfather of all HPGL devices and could not only be used as output device, but also the current pen position could be requested by the host using the plotter as some kind of input device. There were several variants available, with different options and pen numbers.

9872C

9872C Eight Pen Plotter

The HPGL DPS emulator can be switched into 9872A mode by selecting '9872A' as emulation device in the options dialog, plus enabling the 'Save HPGL into File' option. The GPIB address will be automatically set to 5 (this is the default for 9872A plotters) and binary response will be disabled.

When sending plot data from the host to the emulator, all HPGL data is transferred into the specified file and can be later either printed or converted into common raster image formats, e.g. with the free hp2xx utility (see "Working with HPGL files" below).

Emulating other Devices

Although the implemented functionality (and with that, the number of supported HPGL commands) is designed for emulating a 9111A graphics tablet or a 9782A plotting device, other HPGL devices can easily be configured by customizing the identification string which is sent as response to the 'ID' (identify) command. Use the 'Identify as' field in the options dialog to configure other devices (of course, the identify response string has to be known for the special device).

Please note that the emulation may or may not work, depending on the HPGL commands which are required for proper operation of a special device.

Working with HPGL Files

Many programs can directly read in or produce HPGL files, especially CAD applications. There are also many utilities available for viewing, editing and printing HPGL files.

I'd in any case recommend the use of the hp2xx program, a small utility from FSF/GNU, which can be used to convert HPGL vector graphics files into common raster image formats.

The basic syntax is

hp2xx -m <mode> -d <dpi> -c <pen colors> <hpgl file>

where

<mode> specifies the target format and is is one of cad, dxf, em, emf, emp, epic, eps, esc2, fig, gpt, hpgl, img, jpg, mf, nc, pbm, pcl, pcx, pac, pic, pdf, png, pre, rgip, svg, tiff

<dpi> is the desired resolution (default 75 dpi)

<pen colors> defines the pen colors as a string (like "1234" for a 4-pen-plotter) with 0 = off, 1 = black, 2 = red, 3 = green, 4 = blue, 5 = cyan, 6 = magenta, 7 = yellow, and

<hp-gl file> denotes the name of the HPGL input file.

A typical conversion from a 9872A to, say, a png file would work with

hp2xx -m png -c 1432 test.gl

Note the color assignments of the 9872A (pen 1 is black, pen 2 is blue, pen 3 is green and pen 4 is blue).

Downloads

Click here for downloading the HPGL DPS emulator:

HPGL DPS emulator 1.0 beta package: 9111a-10beta.zip

This first beta version may still have a couple of bugs. Please use the contact feature to let me know if something doesn't work as expected.

The free DlPortIO driver package can be downloaded here.

The free hp2xx HPGL conversion utility can be downloaded here.

Troubleshooting

Enable the logging option in the options dialog. Try different log levels and examine the produced output for what has gone wrong. If you can't deal with the failure, consult the README in the emulator package for troubleshooting procedures, or use the contact feature of this site to ask for assistance.

More Information

There is much documentation about HPGL and HPGL devices available for download from hpmuseum.net. See this link for general documentation about HPGL, including command summaries and tutorials. Use this link for downloading 9111A demo software for the HP 9845.

Also, there is a special 9111A related page on series80.org, where you can download manual scans and demo software for the HP85/86/87 systems (use this link, download user id is "pdf", password is "iamhuman").

Recommended in any case is the 9111A Graphics Tablet User's Manual (part no. 09111-90000), since it describes most of the features of the 9111A and at the same time those of the emulator. It gives also an introduction into using the 9111A functionality from within a BASIC program. If you need background information about this device have a look at the January 1981 issue of the HP Journal.

The hpmuseum source can be used for downloading information the the HP plotters, and especially about the 9872A model. See this link for the 9872A documentation.