Modified HP2100 Simulator

Many old HP minicomputer programs were designed for matching HP terminals and often don't display correctly on today's VT100 and ANSI consoles. This version of SimH HP2100 has been modified to convert common HP terminal codes into VT100/ANSI codes. In the present version the conversions are applied to the TTY device and the first MUX terminal, further MUX connections are not affected. The MUXL0 device is further modified to interpret an apostrophe followed by a number to mean output that decimal ascii code, provided the sequence is followed by a non-space character or another non-numeric apostrophe. This is to allow any system to output arbitrary characters including terminal escape codes. Exact emulation of an HP terminal based on only an output stream would be difficult because HP attributes are fixed to specific fields whereas VT/ANSI codes are applied to all following characters until changed. Rather than attempt exact conversion or emulate one specific terminal, the modifications were designed to provide workable results with typical games written for HP1000 and HP2000 systems.

This mod was originally done for the TTY channel so that RTE games would operate properly.  Another popular HP OS which also hosts many games is Time-Share Basic/Access, so the HP terminal translations were added to the MUX device as well. Access is difficult to simulate (it's huge, fragile, and requires a tricky resourse-intensive dual CPU setup) but TSB HP2000E is quite usable and can run adapted versions of at least some of the classic games. As of SimH v3.8 the HP2100 simulator can run RTE-6/VM which runs most of my favorite RTE games, even in a non-configured state.

There are other ways to achieve terminal functionality without modifying HP2100, QCTerm works well for most HP-terminal-specific software. However I wanted a "universal" solution that works in host OS consoles (that support ANSI), works with the Telnet clients I've already got to work, works under Windows or Linux, and provides terminal support for TSB-E or any other conversion thing I might want to hack into it in the future. Modifying HP2100 was the easiest way for me to achieve this as the output streams are readily accessible using simple techniques.


Using Apostrophe Terminal Codes

The '-code mod was designed so that terminal codes like PRINT '27"E" can be easily edited to PRINT "'27E" and run under TSB-E with proper effect, while printing things like '123' normally to hopefully avoid disrupting normal output. It is not possible to encode lower-case letters in HP terminal sequences but substituting say '109 for m works fine in ANSI sequences. Presently following a lower-case-encoded ANSI code with an HP code such as PRINT "'27[37;44;1'109'27E" (to clear screen to white on blue) doesn't work, replacing the '27E with the ANSI-equivalent '27[H'27[2J achieves the proper result. Here's a little demo...


The following HP-style codes can be used from TSB-E...

'27A - moves cursor up one line
'27B - moves cursor down one line
'27C - moves cursor to the right
'27D - moves cursor to the left
'27E - clears the screen
'27F - positions cursor at bottom of screen
'27G - positions cursor at beginning of current line
'27H - homes cursor
'27I - outputs a tab character
'27J - clears screen from cursor position (sometimes)
'27K - clears line from cursor position

Others would be possible but TSB-E cannot output lower-case letters.
The following ANSI codes can be used with most consoles...

'27[0J - clear from cursor to end of screen
'27[1J - clear from cursor to beginning of screen
'27[2J - clear entire screen (cursor position not changed)
'27[0K - clear from cursor to end of line
'27[1K - clear from cursor to beginning of line
'27[2K - clear entire line
'27[H - homes the cursor, equivalent to '27[1;1H
'27[H'27[rrB'27[ccC - positions cursor to row rr column cc
'27[rr;ccH - directly positions cursor to row rr column cc (usually)
'27[ccG - moves cursor to column cc (usually)
'27[nnA - moves cursor up nn lines
'27[nnB - moves cursor down nn lines
'27[nnC - moves cursor to the right nn columns
'27[nnD - moves cursor to the left nn columns
'27['115 - saves cursor position (sometimes, follow by non-space char)
'27['117 - restores cursor position (sometimes, follow by non-space char)
'27[xx'109 - set text attribute to xx (follow by non-space char)
xx = 0 - turn off attributes
1 - bold
2 - faint (sometimes)
3 - italic (sometimes)
4 - underlined (sometimes)
5 - blinking
6 - rapidly blinking (sometimes)
7 - reversed
Foreground colors...
30 - black 31 - red 32 - green 33 - yellow
34 - blue 35 - magenta 36 - cyan 37 - white
Use 40-47 to set background color (sometimes)
'27[xx;yy'109 - set multiple attribs at once, separate with ; as in..
'27[32;1'109 - set text color to bright green (follow by non-space char)

Pure VT100 terminals don't support all of these codes, but typically VT100 emulations running under Linux or Windows also respond to ANSI codes as well. The HP-style translations output only VT100-compatible codes so should work with practically all modern Telnet clients however some clients (including the stock WinXP telnet program) have to be set to eliminate the scroll-back buffer.


Mod Status

3/21/09 - Added a zip file containing updated mod sources for SimH HP2100 v3.8-1, no changes to the mod code itself. The currently posted version 3.8-0 binaries work fine for most uses so for now leaving them be. SimH is trivially easy to compile on most Linux systems, just unzip it, copy the mod files into the HP2100 directory, make a BIN directory and in a terminal type "make". I've been using it with Philipp Hatchman's readline mod (at http://hachti.de/simh/ - I'm using the 090312-2 version under the 3.8-1 directory) to provide sim command line editing and recall under Linux, very nice. The Windows compiles have always had basic command line editing but under Linux without the readline mod only backspace works (sometimes... when "swapped" for ascii-8 backspace then have to press Del instead).

7/13/08 - Updated the mod binaries and sources to SimH HP2100 v3.8-0, supports translations output by the TTY1, MUX (port 0) and BACI devices. Sim name set to "HP2100 (modified)". Default is no translations (stock HP2100 behaviour), HP to VT100 translation has to be enabled for each device using SET [device] TRANSLATE, generally in the simulation startup script. Use SET [device] NOTRANSLATE from the sim> prompt to disable once enabled. Use the TTY1 device when enabling TTY translation (subdevice 1 is output).

7/25/07 - Windows version - adapted to v3.7-2. Tested using TTY/telnet with "hposdemo" and MUX/telnet with TSB-E "combo1". As usual, Win XP etc do not support terminal codes in a "dos" window, had to use telnet to get the proper effect.

7/23/07 - Linux version - adapted to v3.7-2 (which supports dual-CPU Access under Linux), only one code change in the MUX mod to add a condition to the print to ensure that other terminals don't drop characters because terminal 0 is in the middle of a sequence. Changed the sim name to "HP 2100 (mod)".

2/10/07 - removed "7 bit output if UC" TTY mod, something different about it now which caused funny-looking returns (double !! character) in the Access console under Windows. XP's console seems to have proper shift-lock behavior and probably not too many need it for Win95 anymore, I used to to simulate roughly real-time performance but now there's the "throttle" setting. I still liked it better when UC still permitted 7-bit output, without it I have to use shift-lock on many more of my sims, and edit a bunch of sim scripts.

[2/11/07] - under Access the "!!" character is ascii 19, not displayed if output is set to UC. Not sure when the change occurred (my UC/7B mod was hiding it) but now simh hp2100 allows setting input (tty0) and output (tty1) masking separately, totally eliminating the previous need for the UC/7B mod... set tty0 uc and set tty1 7b in the sim script does exactly the same thing. One consequence of the new syntax is the old set tty 7b syntax now only sets the input path, leaving output still set to UC. The startup scripts of every hp2100 sim requiring 7-bit output has to be edited but given the increased versatility it's totally worth it.

2/9/07 - merged mods into v3.7-0 source
2/7/07 - restricted to MUX terminal 0 to avoid possible mixups
2/4/07 - initial MUX mods

Versions before '07 modified only the TTY output path.