Simulating HP-IPL/OS

HP-IPL/OS is an Interpreted Programing Language and Operating System for HP 21xx-series minicomputers. It was created in 2001 (thereabouts) to provide something to run on these interesting machines. The main HP-IPL/OS page is at: http://www.infionline.net/~wtnewton/oldcomp/hp2100/

This page documents the process of setting up a HP-IPL/OS magtape system using the SimH HP2100 simulator program, then using it to make a disk version which can be used as an operating system for storing and running other HP-IPL/OS builds and HP software in general. The process described here can be applied to real hardware and provide the same benefit as it does under simulation - eliminate the need to have to transfer individual files every time a build is made or a new option is needed, instead just load it from magtape.


Getting Started

The following files are needed to set up a HP-IPL/OS simulation as described by these docs:

Source code, docs and Windows binaries for all SimH simulators are located on the SimH web site at: http://simh.trailing-edge.com/

Linux and Windows versions of the term-modified HP2100 binaries I use are located at: http://www.infionline.net/~wtnewton/oldcomp/hp2100mod.html

SimH simulator scripts contain commands for configuring devices, attaching files and running an ABS binary or booting a disk. On my system I use the extension ".sim" to denote these scripts but if using the other SimH simulators (PDP11 PDP8 etc etc) a more specific extension such as ".hp2100" to differentiate. Regardless, to permit right-clicking and running the scripts associate them to the hp2100.exe program under Windows. Under Linux I associate them to the hp2100sim script, in the main HP-IPL/OS archive in the /simscr/bashscripts directory. While at it, add an association to your favorite plain-text editor to permit editing the scripts. Associations are optional but make things easier, other options are opening a command shell (dos prompt), cd'ing to where the files are and entering: hp2100 filename.ext (substitute the actual name of the simulator script), or creating a batch script to run a specific script. For example a Windows batch to run the hposmt.sim script presented later would go something like:

@echo off
hp2100 hposmt.sim

The main archive contains other notes concerning simulation like Linux terminals etc. There are many ways to do it but most are various ways of running hp2100 in a terminal (dos) window with the sim script name as the first parameter. The other way is run hp2100 then enter: do scriptname

If using this stuff under Linux, keep in mind that the source files must be in CRLF format, if edited using Linux editors be sure to run Unix2Dos or a similar utility to make sure. LF-only line ends will not work. Also, the Make_MT utility is a plain dos program, to run it you need a dos emulator with a suitable dos installed (I use DosEmu and FreeDos), or use a Windows system to create the magtape file.


To make a magtape file do the following...

Make a directory in the Dos/Windows environment and copy the Make_MT.exe file there, along with the *.ipl files from the ipl directory of the main archive. Some files are useful only for making builds for machines with less memory, there's no point in including the 8kextra, oct14, oct34 smallcre and smallconfig IPL files on the magtape. You might want to also copy certain *.txt files there too, in particular the summary.txt file. Files added to the magtape must be less than 64Kbytes, otherwise they must be broken up into sections - when doing that be aware that magtape files have an appended space if an odd byte size, so check the sizes of the chunks to make sure they're even, if not add a space at the end of a line where it won't cause problems if the files are extracted and recombined.

Save the following batch file, named say "zz_make.bat"...

@echo off
:: this batch file creates a SimH-HP2100 magtape file using
:: the make_mt.exe utility, edit path and file masks as needed.
echo zz_ipl.tap > zz_files.lst
dir /on /b *.txt >> zz_files.lst
dir /on /b *.ipl >> zz_files.lst
dir /on /b *.hpa >> zz_files.lst
dir /on /b *.asm >> zz_files.lst
echo. >> zz_files.lst
make_mt.exe < zz_files.lst
echo MagTape IPL file updated...
dir zz_ipl.tap

If editing in Linux, make sure it's converted to CRLF line ends using unix2dos etc, or edit it within the Dos or Windows environment.

Change to the directory where these files were placed, running Dos or Windows, and run zz_make.bat - it should print a bunch of "adding file" messages and eventually say "updated" with a dir listing of the new zz_ipl.tap file (if ran by double-clicking the batch under XP it just closes when done).

To set up the magtape simulation do the following...

Make a work directory somewhere and copy the hposmt.abs file from the abs directory of the main archive to the work directory. To avoid scripting errors the directory name and the names of all parent directories should not contain spaces.

Create the following script and save as something like "hposmt.sim" (or whatever extension is used to denote scripts to run with hp2100)...

set cpu 21MX
set cpu 256K
set ptr disabled
set ptp disabled
set lpt disabled
set clk dev=10
set tty dev=11
set ptr dev=12
set ptp dev=13
set ptr enabled
set ptp enabled
;uncomment to enable lowercase input...
;set tty0 7B
set tty1 7B
;for magtape...
set msc dev=14
set msc enabled
attach msc tape0.tap
;for 7900...
set dpc dev=16
set dpc enabled
attach dpc disk0.dsk
;for 7906...
;set ds 7906
;set ds dev=16
;set ds enabled
;attach ds 7906dsk0.dsk
;uncomment next line to boot 7906 disk
;boot -r ds
;uncomment next line to boot 7900 disk
;boot -r dpc
;for loading abs files...
load hposmt.abs
run 2

This script also attaches a 7900 disk file named "disk0.dsk" so that when a 7900 disk build is made using files from the magtape there will be a disk present to load it onto. If you'd rather set up a larger 7906 disk instead, comment the 7900 lines and uncomment the 7906 lines. This script can be copied to other script files and edited for different purposes, once the disk has been set up and bootable you'll need a varient to boot the disk, with the load/run lines at the end commented and the appropriate boot line uncommented.

Note... the stock magtape build has an autostarting !BACI driver but the HP2100 simulator has no BACI. This has never been a problem and very handy for real hardware, but if it causes a problem for future sim versions (like locking up) do this... control-E to halt, enter d s 177777, enter run 2, enter RENAME !BACI BACI, control-E to halt, enter d s 0, enter run 2, then proceed with creating the magtape etc. When 177777 is in the switch register HP-IPL/OS does not run autostart words.

The output of the Make_MT utility can be mounted and accessed directly by the sim (by SimH v3.7-2 at least), and is more compact because it doesn't have gap data in between the records, but I recommend making the first file on the magtape a bootable system and importing the zz_ipl.tap file. This provides a convenient way to get back to the base system (just enter 1 MTBOOT at the ? prompt), and ensures there won't be future simulation problems due to the gap-less tape format.

Copy the zz_ipl.tap file to the work directory, copy the mtbackup.ipl file from the ipl directory of the main archine to the work directory.

"Run" the hposmt.sim script, HP-IPL/OS should boot and create an empty tape0.tap file.

Enter MTGEN and press V to create a new volume. The magtape "build" (a configured self-contained binary) will be copied to the magtape as a single-record bootable binary file. FYI: binary systems are recorded as a single record so that standard magtape bootrom code can load it, whereas other files are stored as a 32 word record containing a file "name" for display purposes and how big the file is to permit easy DMA-ing into memory without having to parse it one word at a time. The second record of the magtape file contains the file itself, see the mtextra.ipl file for details of this made-up scheme. If you attempt to MTSHOW a system binary or a non-existent magtape file HP-IPL/OS will lock up, press control-E and enter run 2 to recover if this happens.

Due to the way different platforms work, if zz_make.bat was run under FreeDos the filenames will be in upper-case and the zz_ipl.tap will have a lower-case name, if it was run under Windows the filenames will be in lower-case and the tape file will have an upper-case name. This doesn't matter, but if running the import process under Linux attach ptr to the correctly cased zz_ipl.tap filename.

Press control-E to halt the simulator and enter: attach ptr mtbackup.ipl   then enter: c   to continue. The HP-IPL/OS ? prompt won't show (it was already printed when control-E was pressed to halt), if you want to see it press enter again. Enter LOAD to load the mtbackup.ipl file that was just attached to ptr. After it loads and the ? prompt appears, press control-E to halt again and enter attach ptr zz_ipl.tap then enter c to continue, enter MTRESTORE and select A to add files. Let it do its thing. When done you can test-boot the magtape by entering: 1 MTBOOT


Using the magtape system (and a bit about HP-IPL/OS)

The MTDIR command lists the magtape directory. The names are just for comment purposes, all files are referenced by their file numbers which normally is expressed in octal. Decimal and binary number modes can be used when needed (like when importing a file and you know the decimal size) but always operate the system in OCTAL mode to avoid bigtime mistakes... memory locations, values and other things in the docs are always given in octal. To show a text file enter: file# MTSHOW (for example for say File 000011 SOMENAME.IPL enter 11 MTSHOW).

IPL files are simply text files containing HP-IPL/OS commands with CONSOLE at the end of the file to terminate redirection from the file and display the ? prompt, aka the console. The effect is the same as if the text were typed directly into the console. Most commands in a typical IPL file define variables and "words" (a HP-IPL/OS program unit with a name), but often direct commands are also given to print information, set variables, make clusters of words appear as a single word or whatever else needs doing in the course of loading the IPL file.

You can't simply load IPL files from magtape at random like they were programs on a menu, there are many dependencies and you'd soon overflow and crash the system. Rather, the magtape with its IPL files is a repository of word packages that can be imported into HP-IPL/OS, which has a "dictionary" of words which itself works something like a magtape in memory - you can add to it, but to remove a word from the dictionary requires removing everything after it. Once words are loaded they can be used from the HP-IPL/OS prompt or in other programs. That's why IPL files often have to be loaded in specific orders, they reference words defined by other IPL files. Words come in two main types, high-level words which are defined as constants and strings and previously defined variables and words, and low-level words which are created from machine code. The WORDS command lists all words in the dictionary (as the machine sees them), and two important bits of data - EOD (end of dictionary), and free space left in the dictionary. Word names are stored as the first 4 characters plus length, WORDS displays x fillers for don't care characters.

For high-level DEFINE words, you just have to make sure the other words it needs are already loaded, and there's room left in the dictionary. The dependencies are usually listed in the IPL file containing the "package" of words but not always, if something isn't found it'll tell you. Low-level CREATE words have an additional constraint - they generally cannot cross a 1KW memory boundary. This isn't a fancy automatically relocating magical system, you have to arrange the load order so a 1KW boundary is not crossed. It's not that hard, simply do WORDS before the load and check the EOD value, and avoid loading things with CREATE words if "too close" to a page boundary (52000 54000 etc). How close is too close depends on the size of the machine code segment(s), and where it appears in the IPL file. Often I just try it to see if it goes, if not load something else first. If a load fails, check the IPL file text (MTSHOW) to see what the name of the first word or variable is, then FORGET WORDNAME (substituting the name of the first word or variable) so that the entire package will be removed, and try a different load order.

Many of the things on the magtape (assuming you copied all IPL files to it) are already present in the magtape build but are very helpful to read for additional documentation. The buildinfo.txt file in the main archive lists the IPL's that are already loaded into the magtape build. The INTERNAL.IPL file is always loaded since it's part of the kernel. A few things have no dependencies besides what's already in the magtape build, for example the MAZE.IPL package. To run MAZE, do MTDIR and note the file number, then enter file# MTLOAD to load it. Once loaded, start the game by entering MAZE. Once loaded into the dictionary it doesn't have to be reloaded, just enter MAZE again.

A more complex example is in LIFE.IPL, this demo requires SCREEN.IPL (or HPSCREEN.IPL) which requires DOUBLE.IPL, and optionally can use TTYSCAN.IPL to stop on keypress (otherwise requires a switch register bit be set to stop generation, under sim that means halting to enter say d s 1). So, DOUBLE has to be loaded before SCREEN, which has to be loaded before LIFE, and TTYSCAN can be loaded anywhere before or after LIFE (which calls the ttyscan/ttyset words in a way that avoids having to place it before the calling word as usually is the case), but if loaded before SCREEN the built-in TTYDEMO "test" word won't load (not a bad thing unless you want it). Thus there are 4 ways to load these particular packages, assuming that's all you're loading. DOUBLE and TTYSCAN contain machine-code words so these may produce page errors and require juggling around, and this is where a very useful technique comes into play: other packages. Usually builds have many things that need loading, so if memory is hostile to a package, just load one of the other desired things to push it past the boundary. In the builds to follow this won't be as much of a problem, since the things LIFE needs are needed by other things and will already be there. This sounds more complicated than it really is, in practice I try an order, if that doesn't work I reboot or FORGET and try something else (rebooting such as 1 MTBOOT is safer, then you know you are starting from a good build that hasn't been damaged by a typo or something). Fortunately, and this is the main point, once you get things the way you want you can save it somewhere (magtape, a binary ABS file on the PC, eventually disk), and not have to repeat the steps again, instead just load the new build.

Hint... do a MTDIR and copy the output to a text file so it can be referred to without always having to do MTDIR to obtain file numbers. The following load order will provide the 1DCA, LIFE and MAZE programs:  DOUBLE.IPL, TTYSCAN.IPL, SCREEN.IPL, 1DCA.IPL, LIFE.IPL and MAZE.IPL.

If trying to run LIFE or other screen-enabled programs under Windows XP/2000/NT there's another issue to contend with... no terminal support in the "dos box" so the output is garbage. Linux doesn't have this problem (just its own problems like no terminal at all unless you run it in one but they tend to have different command lines and work differently making things harder to document). Under Windows to actually see LIFE running, control-E to halt and enter "set telnet 23" without the quotes, then run a telnet client such as Hyperterminal - make and save a telnet configuration set to CR line ends before doing this so you can just double-click the setup file. The hposmt.sim script or a copy of it can be edited to do this when starting the simulation. One advantage of using telnet (besides being able to run things like LIFE) is halting the sim to enter commands no longer messes up the screen. The disadvantage is you have to juggle two windows.

Assuming you've made something you want to keep, to save the build as an ABS file on the PC press control-E to halt the sim, enter attach ptp mybuild.abs (or whatever) then enter c then enter SYSALL to "punch" the file. Halt again and enter exit to close the sim, or detach ptp if you want to do more. The resulting ABS file can be loaded via a customized sim script, or loaded from the sim prompt, enter load mybuild.abs then enter run 2 to start. I don't recommend saving builds to magtape as a matter of course, you can use MTGEN but cruft builds up with no way to delete in-between saves (just DLTF to delete the last magtape file), and if you inadvertently press V instead of F you'll erase the whole magtape. If you use MTGEN, make frequent backups of the tape0.tap file.

Enter HELP for a brief summary of magtape commands but when you start making builds you'll probably want to FORGET HELP to save memory. Hopefully I've explained the basics of magtape operation sufficiently enough to get started, study readme.txt and summary.txt for lots more information. HP-IPL/OS is a versatile system but it's kinda like operating machine code from a console and will go south if you type a command that does damage (possibly at a later time when you need the code that got trashed), it makes no attempt to stop you from overwriting something critical since for all it knows you know what your doing, then if it tried to block "dangerous" operations you'd no longer be in control. Application programs have more error checking, but at the ? prompt you can really muck things up if you PUT the wrong value into the wrong location, just be careful, do WORDS before and after loading IPL files to manage the dictionary, and if you break it don't worry, you (usually) only broke what was loaded in memory (unless doing funny stuff with the magtape or disk), just halt and exit and try again.


Setting up a disk system

The procedure for setting up a disk system is essentially to make a copy of the hposmt.sim script so it can be edited for the new configuration, using a boot extension utility to add code to the platters so the disk platters can be booted using standard boot-rom code, create a disk build by MTLOADing in the required IPL files from magtape, copying the build to the default removeable platter disk boot area using the DGEN command, using XINIT and MKVOL to initialize the platter, and repeat the last two steps after changing to the fixed platter to set up a default system there as well (later it can be customized).

Setting up a disk system on real hardware can be similar as the one described here but is by no means the only way to do it, for magtape-less systems perhaps start with hposdms.abs or hpos7906.abs rather than hposmt.abs (or the hpiplos1.abs kernel to really start over), and IPL files have to be LOADed by attaching to PTR - magtape makes it a bit easier but isn't required except to follow these specific steps. For the IDE drive system there are no "platters", just a drive, so only one XINIT/MKVOL step is needed to initialize the first volume. How many volumes and files to XINIT to depends on the capacity of the IDE drive, most can probably handle the maximum compliment of 100 (octal) volumes, 100 (octal) files in the last volume, for a total of 4096 (decimal) files. That works out to 256 megabytes maximum storage capability and takes a bit more than that on disk. The sim commands translate into real hardware operations as follows...

load filename = attach file to PTR then press Preset, IBL, Preset, Run
run [address] = select P register, Clear and set to address, Store, Preset, Run
halt, attach ptr file, c = no need to halt, just attach file to PTR
d 0-77777 0 = turn machine off and back on again
d s 1600 = select S register, Clear and make 001600, Store.

Now on to setting up a disk simulation. If you haven't already done so, decide whether you want a 7900 disk or a 7906 disk (or both but not at the same time - it's possible but complicated and not much point). The 7900 can store up to 36 files (44 octal) on each of the two platters, where as 7906 can store up to 150 files (3 volumes with 26 octal files in the last volume) on each of the two platters. The hposmt.sim script given previously attaches a 7900 disk unless edited so I'll document that one first, if you want a 7906 disk skip ahead but scan over the notes for unrepeated information.

Note... if you want disk builds to be bootable when there is no disk present (like running as-is on a 21MX CPU) the 7906 version might be better (and is also a bit smaller), the 7900 driver does a drive ping and will hang if booted with no disk present (but it's easy enough to fix... RENAME !7900 7900 before doing a SYSALL to PTP). Better yet, before turning a disk version into a stand-alone version FORGET >IDE to remove all the disk stuff, 2 RUN to make sure console drivers etc get unhooked then MTLOAD whatever else is needed.


Setting up a 7900 disk system

Copy the 7900bext.abs file from the abs directory of the main archive to the work directory.

Copy the hposmt.sim file to another file, hpos7900.sim would be a descriptive name. Make sure the lines for the 7900 disk are enabled (except for the boot line) and the lines for the 7906 disk are commented out. Leave the part that loads hposmt.abs and runs from 2 in place for now to boot the magtape build.

"Run" the hpos7900.sim script. HP-IPL/OS isn't needed for the next step, press control-E to halt and enter d 0-77777 0 at the sim prompt to clear main memory (optional but makes the disk image neater). Enter load 7900bext.abs to load the boot extension utility. Enter d s 1600 to put 1600 in the switch register, the lower slot number of the disk interface needs to be in bits 6-11, so if configuring a system with a different slot configuration modify accordingly. Enter run 2012 to run the utility, it should halt with code 102077 (code 77 for short). Now do the fixed platter, enter d s 101600 then enter run 2012, should halt with code 77. The screen should look like... (the initial halt P contents may vary)

HP-IPL/OS MT 1.3
?
Simulation stopped, P: 02220 (SFS 11)
sim> d 0-77777 0
sim> load 7900bext.abs
sim> d s 1600
sim> run 2012

HALT instruction 102077, P: 02407 (XOR 62)
sim> d s 101600
sim> run 2012

HALT instruction 102077, P: 02407 (XOR 62)
sim>

Now enter exit to exit the simulation. Caution! doesn't matter here but as good a time as any to mention, always halt to the simulator prompt and enter exit to exit the simulation to ensure that any buffered disk writes are actually written to the disk. Try to avoid simply closing the window. Usually HP-IPL/OS isn't bothered if you forget, but that's only because it tends to write more data than actually in a file then updates the directory block. In my testing if the window is closed the last 128 words are not written, which can cause problems with an almost full directory, and is instant corruption to other operating systems like TSB that update in 128-word chunks and write to disk even if you didn't write anything. HP-IPL/OS doesn't do that so if you haven't written anything and the urge strikes you can just click the X in the corner of the window, but if anything has been written, at least halt or XDIR first (in my testing reads cause the write buffer to be written).

Now to build the boot systems. The described default removeable platter boot system will have common dependencies like double and floating point math, ttyscan for things that use it, HP terminal compatible screen control words, the core disk words and 7900 driver, XDOS and its utilities, a short driver that makes the console input stream ignore line-feed characters, a disk menu for running stuff, and alternate memory and code-saving utilities. These things are in the following IPL files: double, float, floatext, ttyscan, hpscreen, disk, 7900, xdos, xutils, nolf, dmenu, altutil, and fcam. It just so happens if the HELP word from the magtape build is removed this order works file without page errors (I don't know what happens if HELP is left in place.. but if you want it it should be moved to the end of the dictionary to make it easier to remove, follow the extra steps). So...

"Run" the hpos7900.sim script. From the MTDIR listing write down the file numbers for the required IPL files (or open a copy of the MTDIR output in a text editor for reference).

If you want to keep the HELP word, enter "HELP" 2 STASH to save it to a memory block.

Enter FORGET HELP and press Y to remove the HELP word.

For each of the following files enter file# MTLOAD to load into the dictionary...

DOUBLE.IPL - 32-bit math words
FLOAT.IPL - core floating point math words
FLOATEXT.IPL - more floating point math words
TTYSCAN.IPL - detects keystrokes (don't worry about COLO NOT FOUND)
HPSCREEN.IPL - HP/Ansi-compatible screen control words
DISK.IPL - core disk access words
7900.IPL - driver for the 7900 disk drive
Enter 2 RUN to restart
XDOS.IPL - simple disk operating system
XUTILS.IPL - import/export/repair utilities
NOLF.IPL - makes HP-IPL/OS ignore line feed characters
DMENU.IPL - autostarting disk menu
ALTUTIL.IPL - utilities for manipulating alternate memory
FCAM.IPL - utilities for saving alternate memory or disk files to ABS files

Important... after loading 7900.IPL enter 2 RUN to restart the system so that the driver will hook itself to the disk words, then load the rest of the IPL files. It's better to do this after loading the driver since further down is an autostarting menu that might freak if run on an uninitialized disk (doesn't bother it here but still it's best to restart after loading a driver to avoid forgetting to later, and if performing these steps on real hardware, the disk might contain random data which could cause problems if DMENU or other disk read commands were allowed to run before running XINIT).

If the HELP word was previously saved to block 2, enter 2 FETCH to get it back. You might want to load DHELP.IPL from magtape as well but it's a memory hog and will likely have to be forgotten before loading anything else of significant size. Personally I don't like having pure-text help words like that loaded all the time under sim, more efficient to run them once and copy their output to a text file if you need the information.

Unless using my modified HP2100 binaries which support HP screen codes, enter TERMINAL to make the HP screen words default to standard ANSI output.

Enter VERSION then press Y and give the build a name, I called it: HP-IPL/OS 7900S 1.3

Enter DGEN to write the boot system to disk.

Enter XINIT to "format" the disk, enter 1 for the number of volumes and 44 for the number of files in the last volume.

Enter "LIB" MKVOL to create the volume and enable files to be stored. The chosen name is for compatibility with the default SFS library system's LIB word, which is coded to use the file LIBRARY in volume LIB on drive 0 (removeable platter). Otherwise the volume could be named anything, or renamed later using a RENVOL command.

For backup and to later transform into other builds, enter 1 CHPL to change to the fixed platter and enter DGEN to write the boot system, run XINIT (enter 1 then 44) to format, and say "FIXED" MKVOL to create a volume for the fixed platter. Enter 0 CHPL to return to the removeable platter and enter 2 RUN to restart, since there are no files yet it should say "Nothing to do" and drop to the ? prompt.

Press control-E and enter exit to close the simulation.

Edit the hpos7900.sim file to comment out the load and run lines at the end, and uncomment the line that boots the 7900 disk, now "running" the hpos7900.sim script with hp2100 should boot the removeable disk platter and the build that was saved to it. The dictionary should look something like this...

HP-IPL/OS 7900S 1.3
? WORDS
DO +DO INDEx +LOOx >STEx IFNZ IFZ IF<0 ENDIx ELSE UNTIx WHILx CASE = < > <=
>= <> DEFAxxx ENDCxxx EXECxxx WBOOx AND OR XOR ADD SUB INC DEC NOT 2CPL DUP
DROP OVER ROT SWAP GET PUT PNUM CRLF DECIxxx OCTAx BINAxx RADIx SP>S SB>S
XP>S XB>S YP>S YB>S ZP>S ZB>S END EOD DEFIxx DMPS S>SR SR>S PCHR PWRD CHRIx
S>X X>S S>Y Y>S S>Z Z>S MUL ASL ASR ROL ROR DIV RUN X>>Y X>>Z Y>>X Z>>X
$PRIxx $SWAx $CPY $DUP $DROx $LEN $ADR $XTExx $PUT $GET $CRExxx $STR $HEAx
$APPxxx $TAIx $IN $CAT $VAL <>COx >PTP <PTR MSPAxxx MSBOxx MSBIx MSWOxx
MSWIx MS$Oxx MS$Ix MSCRxx >MS <MS MS_Sxxx MS_Rxxxxxx CONSxxx #0 #1 @TL @TB1
@TB2 @ANVxx @ENSxx @CLH @LITxxxx @STRxxx @RTSxx @DIC @USR @BLK @END @DIPxx
RND TOKEx SDIC !IRQ -IRQ +AUTx -AUTx INBLxxx OUTBxxxx GETIx SETIx GETOx
SETOx $DEFxxx HEADxxx WORDx ADDCxxx ADDHxxxxx ADDHxxxxxx FIXLxxxx ADDMxxxx
VARIxxxx CONSxxxx ALLOxxxx ZEROxxxxx BPUT BGET $EQUxx $SLIxx $TRIx ABSOxx
PTZExx MARKxxx SETCxx GLOBxx DUMP PDEF EXPLxxx FORGxx ERASx FETCx STASx
HIDExxxx RENAxx DELExx UNDExxxx WHERxxx LOAD OE OE? SYSAxx CREAxx PRESxx
VERSxxx !BACx MSBAxx <BACx >BACx BACIxxx TTYCxx MKWOxx ENDWxxx CFGE !DMS
-DMS SDMA UDMA UJUMx SJUMx SPAGx C>ACxxx A>CCxxx USPAxx DMSTxxxx UPTR
MSUSxx ABSLxxx GOUSxx GOSYxxxx ALTSxxx ?DMS CONFxx !SDC MTINxx MTRExx
MTWRxxx GAP GAPMxxx FS1R BS1R FS1F BS1F RWLP RWOL MTSTxxxx MTBOxx MTWAxx
?MTExxxx EOF RECOxxx FILEx MTSCxx MTGEx IDREx MTDIx DLTF MTSExx MMTIx
MTSAxx MTLOxx MS2Mx MT2Mx B2MT MT2B MTSHxx D2MT DADD D2CPx EMUL EDIV DSWAx
$DVAx $DSTx FIX FLT FP+ FP- FP* FP/ DFLT DFIX PWR1x $>FP FP>$ FSGN FSQR
TTYSxxx TTYGxx TTYPx TERMxxxx ESC POS CLS COLOx -COLxx >IDE <IDE W-1K R-1K
SBLA LDFB DRV CHDRx DBOOx DGEN ?DRV CHPL !790x WKBUx XCV 16Pax ChkSxx MKVOx
Findxxxxx DELVxx RENVxx CHVOx LSVOx VolIxxx DirIxxx GetVxx GetFxxx PutFxxx
$VOL ZAM AM2F F2AM XSAVx XLOAx XSHOx XDIR XREN XDEL MS2F F2MS ABS2x
VRECxxxx XRECxxxx XINIx !NOLx _DM _RC CONSxxx DMENx !DM HLT ALTRxx RUNAxx
PTHExxxx AAOUx ALTAxx ALTDxxx CLRHxxx ALTHxxx _FLG _XFR _LNZ _CNT _MCZ FCAM
?MSOxx _PAD _CBD _TRA AM2Axx APUT AGET F2ABx
EOD=052221 FREE=007556

There's enough memory left to load some things, but later on when using this build to derive other disk builds the extra utilities can be removed by entering FORGET VRECOVER and pressing Y to confirm. Important... enter 2 RUN after doing this to disable the !NOLF driver that was also just removed, otherwise the system will crash when that code gets overwritten. After doing this FREE=16042 and EOD=43735, or just before a page boundary so you'd have to load something high-level or DEFINE a small filler word before loading a CREATE word into this configuration. Alternatively all of the X utilities can be removed by entering FORGET MS2F then 2 RUN, this leaves 16623 octal words free and puts EOD at 43154. There are many possible ways to configure other disk-enabled systems from here.

Setting up a 7906 disk system

The procedure is pretty much the same as for the 7900 except that the 7906.IPL driver and the 7906bext.abs boot extension files are used.

Copy the 7906bext.abs file from the abs directory of the main archive to the work directory.

Copy the hposmt.sim file to another file named hpos7906.sim or similar. Edit hpos7906.sim and comment out the 7900 lines and uncomment the 7906 lines (except for the boot line). Leave the load hposmt.abs and run 2 lines in place for now.

"Run" the hpos7906.sim script, it should create an empty 7906dsk0.dsk file and boot the magtape build but that isn't needed yet. Press control-E to halt, enter d 0-77777 0 to clear memory, enter load 7906bext.abs, enter d s 1600, enter run 2012. It should halt with code 44. Enter d s 101600, enter run 2012. It should halt with code 44. The screen should look something like this...

HP-IPL/OS MT 1.3
?
Simulation stopped, P: 02220 (SFS 11)
sim> d 0-77777 0
sim> load 7906bext.abs
sim> d s 1600
sim> run 2012

HALT instruction 102044, P: 02352 (JMP 2351)
sim> d s 101600
sim> run 2012

HALT instruction 102044, P: 02352 (JMP 2351)
sim>

Enter exit to exit the sim.

"Run" the hpos7906.sim script again. Do MTDIR and make note of the file numbers for the required IPL files (copy the output to a text file for reference, write on paper, etc).

Enter "HELP" 2 STASH if you want to keep the HELP word.

Enter FORGET HELP and press Y to remove the HELP word.

Enter file# MTLOAD for each of the following files...

DOUBLE.IPL - 32-bit math words
FLOAT.IPL - core floating point math words
FLOATEXT.IPL - more floating point math words
TTYSCAN.IPL - detects keystrokes (don't worry about COLO NOT FOUND)
HPSCREEN.IPL - HP/Ansi-compatible screen control words
DISK.IPL - core disk access words
7906.IPL - driver for the 7906 disk drive
Enter 2 RUN to restart
XDOS.IPL - simple disk operating system
XUTILS.IPL - import/export/repair utilities
NOLF.IPL - makes HP-IPL/OS ignore line feed characters
DMENU.IPL - autostarting disk menu
ALTUTIL.IPL - utilities for manipulating alternate memory
FCAM.IPL - utilities for saving alternate memory or disk files to ABS files

Important... enter 2 RUN after loading 7906.IPL to make sure the driver installs properly.

If the HELP word was previously saved to block 2, enter 2 FETCH to get it back.

Enter TERMINAL to default the screen words to ANSI.

Enter VERSION, press Y, and give it a name. I called it: HP-IPL/OS 7906S 1.3

Enter DGEN to save the disk build to the default removeable platter boot area.

Enter XINIT then enter 3 then 26 to initialize the removeable platter.

Enter "LIB" MKVOL to make a default volume.

Enter 1 CHPL to change to the fixed platter, enter DGEN, enter XINIT then 3 then 26, and enter (say) "FIXED" MKVOL to put a system on the fixed platter. Later on additional volumes with different names can be added to both platters.

Press control-E to halt and exit the simulation.

Edit the hpos7906.sim script, comment out the load hposmt.abs and run 2 lines and uncomment the 7906 boot line. Now "running" the hpos7906.sim script should boot the removeable platter of the 7906 disk and respond with "Nothing to do". The dictionary should look something like this...

HP-IPL/OS 7906S 1.3
? WORDS
DO +DO INDEx +LOOx >STEx IFNZ IFZ IF<0 ENDIx ELSE UNTIx WHILx CASE = < > <=
>= <> DEFAxxx ENDCxxx EXECxxx WBOOx AND OR XOR ADD SUB INC DEC NOT 2CPL DUP
DROP OVER ROT SWAP GET PUT PNUM CRLF DECIxxx OCTAx BINAxx RADIx SP>S SB>S
XP>S XB>S YP>S YB>S ZP>S ZB>S END EOD DEFIxx DMPS S>SR SR>S PCHR PWRD CHRIx
S>X X>S S>Y Y>S S>Z Z>S MUL ASL ASR ROL ROR DIV RUN X>>Y X>>Z Y>>X Z>>X
$PRIxx $SWAx $CPY $DUP $DROx $LEN $ADR $XTExx $PUT $GET $CRExxx $STR $HEAx
$APPxxx $TAIx $IN $CAT $VAL <>COx >PTP <PTR MSPAxxx MSBOxx MSBIx MSWOxx
MSWIx MS$Oxx MS$Ix MSCRxx >MS <MS MS_Sxxx MS_Rxxxxxx CONSxxx #0 #1 @TL @TB1
@TB2 @ANVxx @ENSxx @CLH @LITxxxx @STRxxx @RTSxx @DIC @USR @BLK @END @DIPxx
RND TOKEx SDIC !IRQ -IRQ +AUTx -AUTx INBLxxx OUTBxxxx GETIx SETIx GETOx
SETOx $DEFxxx HEADxxx WORDx ADDCxxx ADDHxxxxx ADDHxxxxxx FIXLxxxx ADDMxxxx
VARIxxxx CONSxxxx ALLOxxxx ZEROxxxxx BPUT BGET $EQUxx $SLIxx $TRIx ABSOxx
PTZExx MARKxxx SETCxx GLOBxx DUMP PDEF EXPLxxx FORGxx ERASx FETCx STASx
HIDExxxx RENAxx DELExx UNDExxxx WHERxxx LOAD OE OE? SYSAxx CREAxx PRESxx
VERSxxx !BACx MSBAxx <BACx >BACx BACIxxx TTYCxx MKWOxx ENDWxxx CFGE !DMS
-DMS SDMA UDMA UJUMx SJUMx SPAGx C>ACxxx A>CCxxx USPAxx DMSTxxxx UPTR
MSUSxx ABSLxxx GOUSxx GOSYxxxx ALTSxxx ?DMS CONFxx !SDC MTINxx MTRExx
MTWRxxx GAP GAPMxxx FS1R BS1R FS1F BS1F RWLP RWOL MTSTxxxx MTBOxx MTWAxx
?MTExxxx EOF RECOxxx FILEx MTSCxx MTGEx IDREx MTDIx DLTF MTSExx MMTIx
MTSAxx MTLOxx MS2Mx MT2Mx B2MT MT2B MTSHxx D2MT DADD D2CPx EMUL EDIV DSWAx
$DVAx $DSTx FIX FLT FP+ FP- FP* FP/ DFLT DFIX PWR1x $>FP FP>$ FSGN FSQR
TTYSxxx TTYGxx TTYPx TERMxxxx ESC POS CLS COLOx -COLxx >IDE <IDE W-1K R-1K
SBLA LDFB DRV CHDRx DBOOx DGEN ?DRV CHPL !790x WKBUx XCV 16Pax ChkSxx MKVOx
Findxxxxx DELVxx RENVxx CHVOx LSVOx VolIxxx DirIxxx GetVxx GetFxxx PutFxxx
$VOL ZAM AM2F F2AM XSAVx XLOAx XSHOx XDIR XREN XDEL MS2F F2MS ABS2x
VRECxxxx XRECxxxx XINIx !NOLx _DM _RC CONSxxx DMENx !DM HLT ALTRxx RUNAxx
PTHExxxx AAOUx ALTAxx ALTDxxx CLRHxxx ALTHxxx _FLG _XFR _LNZ _CNT _MCZ FCAM
?MSOxx _PAD _CBD _TRA AM2Axx APUT AGET F2ABx
EOD=052125 FREE=007652

Later on for more memory for making other things from this build the utilities can be removed by entering FORGET MS2F (Y to confirm) followed by 2 RUN to deactivate the !NOLF driver that was also just removed (or else), this leaves 16017 octal words free and puts EOD at 43060.


About HP-IPL/OS disk systems

The Simple File System (SFS) permits up to 64 volumes containing up to 64 files each on each logical disk. Drives with fixed and removeable platters are treated as two disks. Each file is allocated 32KW on disk regardless of how much data the file actually contains. In addition to the file space each logical drive has 31KW reserved to place the boot system, 6KW for a boot extension for drives that need it (IDE doesn't, 790x and most other drives do), 1KW for the volume index and a 1KW directory block for each volume. Data in the volume index specifies where the directory blocks are and data in the directory blocks specify where the files are so the system is quite flexible regarding where on disk the files are actually placed. Not so flexible if you need a file bigger than 64Kbytes or waste space on bunches of little files but overall I think it's a fine system - easy to code, no such thing as fragmentation, and makes it more difficult to corrupt the disk because files are placed in predictable locations.

The XDOS.IPL file implements the physical layout of SFS and provides words for common operations like saving, loading, viewing, renaming and deleting files and requires 64KW of memory. SFS.IPL implements the advanced file-handling aspects of SFS like reading and writing up to four files at once with separate pointers for each file, this requires up to 192KW of memory. SFS.IPL isn't needed for simple applications that treat files as singular objects but is easily added to provide support for more complex apps such as a line editor. XDOS-based utilities in XUTILS.IPL and FCAM.IPL (requires ALTUTIL.IPL) permit importing and exporting text and ABS files, these are loaded in the 7900 and 7906 builds described in the previous section but can easily be removed to make more dictionary room for things that don't need to have the utilities on board. One of the main ways to achieve build efficiency is to only load things that are needed and not load things that aren't so having the dos stuff scattered about in separate files is not a problem, rather it permits builds to be crafted that meet the required needs without including stuff that isn't needed leaving more room for applications.

The following are some of the operations are available from XDOS builds with the utilities in place...

XDIR - lists disk directory
"FILENAME" XSAVE - saves the current HP-IPL/OS build to a file
"FILENAME" XLOAD - if a binary loads and runs it (run 77000 to exit), if text loads into the console
"FILENAME" XSHOW - shows the contents of a file
"FILENAME" XDEL - deletes a file after confirming (XRECOVER to undelete, F2AM/AM2F to fix size)
"FILENAME" "NEWNAME" XREN - renames a file
"FILENAME" F2AM - copies a file to alternate memory
"FILENAME" [size] AM2F - copies alt.mem to a file (size=174000 for normal binaries, loc 2/3=run link)
1 CHPL - changes to fixed platter, 0 CHPL - changes to removeable platter
LSVOL - lists volume directory
"VOLNAME" MKVOL - creates a new empty volume
"VOLNAME" CHVOL - changes to a volume
"VOLNAME" "NEWNAME" - RENVOL - renames a volume
"VOLNAME" DELVOL - deletes a volume (VRECOVER if by mistake)
ABSLOAD - loads an ABS file from MS in (default PTR) into alternate memory
LOAD - loads an IPL file from MS in (default PTR) into console/dictionary
DBOOT - boots the disk, DGEN - saves current system to the boot area
[address] AGET PNUM - prints contents of alternate memory location
[address] [value] APUT - changes contents of alternate memory location
[from] [to] ALTDUMP - displays a range of alternate memory locations
"FILENAME" ABS2F - imports an ABS file from MS in (default PTR, attach first)
"FILENAME" F2ABS - exports a binary to an ABS file on MS out (default PTP, prompts to attach)
DECIMAL [decimal size] OCTAL "FILENAME" MS2F - copies MS in (PTR, attach first) to a file
"FILENAME" F2MS - copies a file to MS out (PTP, attach first)
HLT - just halts, useful to drop to the sim prompt to attach/detach files, c to continue
CLRHALT - halts with memory (mostly) clear, useful for whatever, run 77000 to exit
RUNABS - loads and runs ABS binary from papertape, prompts to halt for cable swap
HLT RUNABS - easier way to run binaries under sim, at halt attach ptr file.abs, c, press N

The disk menu lists files which begin with "@ ", "# " and "$ " to represent binary, text and run-and-forget IPL files. For run and forget IPL's the name after "$ " must be the same as the name of the word that runs the thing, which must be the first word in the IPL, see DMENU.IPL comments. When importing text or other files to be treated as a regular file using MS2F you have to know the file's size, this can be determined from a directory listing when at the sim prompt, for Windows enter ! dir filename.ext, for Linux enter ! ls -la filename.ext, attach ptr file, c and enter DECIMAL [size from the dir listing] OCTAL "FILENAME" MS2F to copy that many bytes from PTR to the disk file. A hassle but I don't know of any other way to do it without size effects like not allowing 0's (often binaries are copied in as regular files so that wouldn't work) or invoking the watchdog to detect the hangup (that has issues as well, like getting a variable number of zeros appended to the file depending on sim settings). The only bulletproof way to copy from PTR is tell it how much to copy. Fortunately importing ABS binaries to HP-IPL/OS binaries is fairly easy, just halt, attach ptr file.abs, c, then enter "FILENAME" ABS2F. To make imported binaries show up on the disk menu, name as "@ FILENAME", for text name as "# FILENAME".

The HP Games page has a couple of ABS binaries, instructions for configuring a 28KW version of papertape BASIC and a couple of BASIC programs to load, ABS2F prompts to patch BASIC to add the run address and make exit back to HP-IPL/OS when BYE is entered. After importing the configured BASIC binary from the disk menu you can select the halt option, attach ptr program.txt, run 77000 (if the sim prompt isn't used to load stuff then just c works), run BASIC from the menu and enter PTA to load. After loading enter BYE and use the menu option to save the basic program to a file (it adds the @ automatically).

To make new builds from the described XDOS/utility build, FORGET VRECOVER (or FORGET MS2F to remove all of the utilities) followed by 2 RUN (to unhook the !NOLF code, not needed unless drivers like that are present but doesn't hurt), then MTDIR, file# MTLOAD the options you want, VERSION and give it a descriptive name, then "FILENAME" XSAVE to save the new build to disk. Precede the filename with "@" to make it show up on the disk menu. If the file exists you have to XDEL it first.

If you do a lot of saving to the same file you might want to type in this DXSAVE word in the build you're working on to prompt to delete if the file exists...

DEFINE DXSAVE
$DUP XDEL CRLF XSAVE END

A "fun" build can be made by booting the XDOS/utility build, if the menu is showing press 1 for the prompt and enter FORGET MS2F then enter 2 RUN then load the following from magtape...

1DCA.IPL
LIFE.IPL
MAZE.IPL
GAMES.IPL

That's pretty much all of the "fun" stuff. Some of it's kinda goofy, back years ago we were happy just to get a program to run... CARPET was written to visualize the randomness of the RND word which isn't exactly random but never "fixed" it, real life isn't exactly random either so it kind of works out (and helps to "beat" ESPGAME just a bit). LAUTO and 1DCA are both 4-state line automata generators, 1DCA came later and illustrates the speed difference between machine code and IPL. Need a machine-coded LIFE.

To keep this build, VERSION and give it a name (optional but good practice to identify different builds), then save to disk by entering...
"@ HP-IPL/OS FUN" XSAVE
...or whatever you want to call it.


Programming using HP-IPL/OS

There are many ways to program under HP-IPL/OS. "Real" HP-IPL/OS programmers use DEFINE CREATE EXPLAIN DUMP GET PUT and OE to make, examine and modify words directly, but this is a tad extreme even for me except for short words and the simplest of modifications. It's much easier to write the IPL code using a PC editor with CONSOLE at the end of the file (make sure it's saved with CRLF line ends if editing under Linux), halt and attach it to ptr, continue and LOAD it in. Or to do it entirely under HP-IPL/OS use the editing words in EDIT.IPL to make a file (if you can handle it) then XLOAD the code. Programming in IPL isn't for everyone, one one hand it's very simple - pretty much just constants, strings and words (variables and constants are also words) - on the other hand what the all those words do can get pretty complicated. Especially considering whenever something needs doing that it can't already do more words get written to do it. I can't even keep track of what they all do (and I wrote most of them) but that's why there's a summary.txt file and IPL files have comments.

When we originally made HP-IPL/OS, the main function was to be able to do something with old HP mini's even (as often is the case) if just a CPU and a PTR emulator... if the lights flash and scopes draw stuff and the terminal prints stuff and accepts commands then that's a whole lot better than turning it on and doing basically nothing. At the time about all I had (that I could figure out) was OCTAPUS, 8K BASIC and the HPASM cross assembler. So HP-IPL/OS came about, and besides being a way to "do stuff", provided a means to access and test most of the machine and hardware connected to it. Since then I've been able to play around with other software systems including RTE-IVB, Access, TSB-E and now SIO/BCS which is probably the most useful to me since it makes binaries I can run on my machine. All thanks to the efforts of others who preserved the old software and documentation in archives past and present, worked through and documented procedures, or just threw me a bone. Without these folks IPL and machine code would likely still be the only way I could program an HP 21xx machine.

HP-IPL/OS has been and is very helpful for exploring these other systems.. it's pretty tough trying to decipher another OS' disk structure using a hex editor on the disk file image but with IPL I could easily write a dump program to see just what was where, or more usefully fix an unslept TSB-E system or twiddle bits to patch its backspace character and make the SLEEP command return to HP-IPL/OS, from which it was launched. The old Interex archive was full of "FST" archives which normally would take a full RTE install to decode, not available so to get at the software I wrote an IPL utility to decode the untarred files (sort of, works for the older stuff but not for the RTE 6 files.. if I cared enough I could probably hack it to work there too). I found the files to generate a custom BCS linker but not the one that prepares the SIO driver, just an already prepared one. Not a problem, wrote an IPL program to patch the prepared driver for HP-IPL/OS' default slots. Found that it was tedious having to load the SIO driver before loading tools, having to keep up with all the compiler binaries, having to clear memory before loading the BCS linker, plus having to remember what to do (and repeating for every program change cycle), yea I know they had it pretty tough in the old days and that's part of the old-comp experience but now I just want to make new stuff (IPL and BASIC are ok but interpreters can never achive the speed a compiler can no matter how good they are). So I made a set of IPL words that let me keep the assembler, FORTRAN and Algol compilers and BCS linker in disk files and print usage instructions so I don't have to do as much tedious stuff.

Probably the easiest way to get into HP programming using HP-IPL/OS as the OS is set up a 28KW version of papertape BASIC (instructions are in the ptbasic.txt file) and import it to a disk file. When the disk menu detects BASIC in alternate memory (left there after using BYE) it displays an option to save it as a binary (either to re-enter or autorun), making it really easy to enter, save and run BASIC programs.


Making an SFS programming build

This is useful if you want to write file-processing software, use the line-editing package, use the SIO/BCS tools, use the library package, or some other application requiring streaming access to one or more files (as opposed to merely running binaries and transfering files into and out of alternate memory or papertape). Here's how I made my SFS build (same procedure works for 7900 and 7906 versions)...

Start with the XDOS system with utilities
FORGET VRECOVER [Y]
2 RUN
2 ALLOCATE
Load the following with MTLOAD...
  ALTUTIL.IPL
  FCAM.IPL
  SFS.IPL
  EDIT.IPL if you want the line editing words
  SIOBCS.IPL if you want the SIO/BCS programming words
VERSION [Y, SFS 790xS/E/P 1.3 to remind me it has edit and programming words]
"@ SFS PROG" XSAVE

Instructions for patching the SIO driver and making a 31KW BCS linker/loader are in the bcs31k_log.txt file (you don't have to use the demo build described in the text if you've made a disk build as described, it has the same commands). Comments in the SIOBCS.IPL file explain how to import the tools to disk files so that the ASMB, FOR1, FOR2, ALGOL and LINK words can run them. The following "lib" script is handy when using the BCS linker from LINK...

attach ptr bcslib.rel
d s 140004
c
c
detach ptp
run 77000

... once all the program relocateables have been loaded just enter: do lib

When using FORTRAN to compile subs and the main program from one source file it produces a multi-part relocateable (same for multi-part assembly sources), during the link process after attaching the relocateable and output files an extra c (continue) is needed (without changing attachments) for each extra subroutine or function.

Operating the assembler, compilers etc from HP-IPL/OS disk files makes the process somewhat easier than running the tools manually and would be a reasonable way to do it on real hardware to avoid having to keep track of paper-tape-emulation media for at least some of the files. However for more intense program development under simulation where dozens of edit compile test cycles may be needed, a better way to do it is MKBCS.IPL [not in the main archive yet, attach to PTR and LOAD]. The MKBCS program prompts for names and types of all the required source files, the number of modules in each source file, then outputs a custom stand-alone hp2100 script that carries out all the steps in one action. Once the script is made HP-IPL/OS is not required to develop the app, just edit the app's source, right-click the build script (assuming sim scripts associated with the hp2100 sim) and test the resulting ABS binary.

If you use the line editing words, you might want to consider adding EHELP.. copy the following to ehelp.ipl, halt and attach ptr ehelp.ipl, c, then LOAD...

OCTAL DEFINE EHELP
CRLF "Editing words..." $PRINT CRLF
42 PCHR "file" $PRINT 42 PCHR
" FOPEN - open specified file, create if not found" $PRINT CRLF
"PCL - print current line" $PRINT CRLF
"NL PL - next line, previous line" $PRINT CRLF
"[-]count MCL - move current line by specified #lines" $PRINT CRLF
"BF EF - beginning of file, end of file" $PRINT CRLF
"DCL - delete current line" $PRINT CRLF
"CHOP - delete current line and rest of file" $PRINT CRLF
"APPEND - append text at end of file" $PRINT CRLF
"INSERT - insert lines at current line" $PRINT CRLF
"LS - list 10 lines from current line" $PRINT CRLF
"LI - list 10 lines and increment current line" $PRINT CRLF
"LIST - list entire file, current line not changed" $PRINT CRLF
"FCLOSE - close file, writing changes" $PRINT CRLF
"When appending and inserting lines, end entry by entering" $PRINT CRLF
"an empty line. Enter at least one space to add blank lines." $PRINT CRLF
END
CONSOLE

It's a pretty whacky editor. When using it to write code to compile, after FCLOSE the file can be exported to the PC disk by entering HLT "FILENAME" F2MS, at the halt attach ptp sourcefile.ext then c to continue. [there's a full-screen editor now, it has quirks but is much easier than one line at a time]

There's still lots more to document (and learn!), but all for now.


Temporary Stuff...

10/30/07 - Investigating the speed difference between BASIC and FORTRAN... under sim 'set throttle 1800k' causes the BASIC "OTH" to take roughly 1 second to make a move, I need to 'set throttle 100k' to make the FORTRAN "REVERSI" take about 1 second, implying that it's 18x faster. Sure seems like more than that on real hardware, but either way it's not really a fair comparison since REVERSI uses real integer variables whereas OTH has to use floating point for its "integers". For a somewhat more realistic comparison I wrote a crude benchmark which loops 10,000 times doing 5 floating point additions in BASIC, FORTRAN and IPL...

100  PRINT "START"
110 LET A=0
115 LET B=1.00000E-03
120 FOR I=1 TO 100
130 FOR J=1 TO 100
140 LET A=A+B
141 LET A=A+B
142 LET A=A+B
143 LET A=A+B
144 LET A=A+B
150 NEXT J
160 NEXT I
170 PRINT A
180 END

FTN,B,L,A
PROGRAM BENCH
WRITE(1,100)
100 FORMAT("START")
A=0
B=1.00000E-03
DO 110 I = 1,100
DO 110 J = 1,100
A=A+B
A=A+B
A=A+B
A=A+B
A=A+B
110 CONTINUE
WRITE(1,120)A
120 FORMAT(F5.5)
STOP
END
END$

OCTAL DEFINE BENCH
"START" $PRINT CRLF
"1.00000E-03" $>FP
101 SWAP PUT ;put multiplier in locs 100,101
100 SWAP PUT ;to avoid excessive stack manipulation
"0" $>FP
#1 144 +DO
#1 144 +DO
100 GET 101 GET FP+
100 GET 101 GET FP+
100 GET 101 GET FP+
100 GET 101 GET FP+
100 GET 101 GET FP+
+LOOP
+LOOP
FP>$ $PRINT CRLF
END
CONSOLE

With throttle set to 1800k (SimH v3.7-2, other versions may vary) the BASIC version completes in about 26 seconds, the FORTRAN version completes in about 10 seconds and the HP-IPL/OS version takes about 8 seconds (interesting... :-). At some point I need to repeat these tests using real hardware, if anything to help calibrate the throttle setting - for that matter I need to compile hp2100 v3.7-3 - one of the fixes was a bug in the throttle option which might change things. [it didn't]

11/1/07 - I had a chance to run these benchmarks on my HP2113E and the BASIC version took about 64 seconds to complete, the FORTRAN and IPL versions both took about 22 seconds. Looks like 'set throttle 800k' is a more realistic setting but it probably varies depending on the code, my 21MX sure does seem faster than what I get with that setting when running integer-based code.

11/3/07 - The Reversi program is now on the Reversi for HP FORTRAN page.

1/25/08 - More benchmark stuff inspired by a thread on the simh mailing list in which people were getting a significant performance boost from the vax simulator by changing the optimize level when compiling. Sure enough works for the HP2100 sim too, was able to get about 40% better performance when running flat out (no throttle) by using gcc 4.0.3 with the -O9 setting. Here's the bench code...

HP-IPL/OS MT6I 1.4
[tbg.ipl was added for timing the tests]
? EXPLAIN LOOPS
OCTAL DEFINE LOOPx  ;ENSEC=046367
"START: " $PRIxx PTIMx CRLF #0 077777 +DO #0 000077 +DO
+LOOx +LOOx "END:   " $PRIxx PTIMx CRLF END

? EXPLAIN FPLOOPS
OCTAL DEFINE FPLOxxx  ;ENSEC=046433
"START: " $PRIxx PTIMx CRLF #0 077777 +DO #0 000007 +DO
000003 FLT 000002 FLT 000005 FLT FP/ FP* DROP DROP +LOOx
+LOOx "END  : " $PRIxx PTIMx CRLF END

? EXPLAIN ALTLOOPS
OCTAL DEFINE ALTLxxxx  ;ENSEC=046514
"START: " $PRIxx PTIMx CRLF #0 017777 +DO ALTSxxx +LOOx
"END  : " $PRIxx PTIMx CRLF END

LOOPS simply does 2,097,152 empty loops. FPLOOPS does 262,144 loops calculating (2/5)*3. ALTLOOPS does 8,192 loops of a word that copies 31KW to alternate memory (among things). The tests were run on a 1.4mhz generic AMD PC using SimH 3.7.3 HP2100 binaries compiled with gcc 3.4.6 and gcc 4.0.3 with optimize levels -O2 and -O9. Also ran the tests on my HP2113 "E" CPU and 4.0.3 -O9 version, and under the HP2100 simulator (the 4.0.3 -O9 version but that shouldn't matter) with throttle set to 1000K.

Results...

CPU version   LOOPS         FPLOOPS       ALTLOOPS
HP2113E       332.5         288.9         621.6
Th=1000K      293.6 (113%)  239.9 (120%)  101.8 (611%)
3.4.6 -O2      20.9 (1591%)  17.6 (1641%)  28.6 (2173%)
3.4.6 -O9      16.0 (2078%)  13.5 (2140%)  23.0 (2703%)
4.0.3 -O2      22.1 (1505%)  18.4 (1570%)  30.6 (2031%)
4.0.3 -O9      14.7 (2262%)  12.5 (2311%)  23.4 (2656%)

Numbers in parenthesis are the speed relative to a HP2113E.
The following are relative to the 3.4.6 -O2 build to isolate just the compiler differences...

Build       LOOPS    FPLOOPS   ALTLOOPS
3.4.6 -O9   131%     130%      124%
4.0.3 -O2    95%      96%       93%
4.0.3 -O9   142%     141%      122%

Based on this and the previous test, looks like a throttle setting of about 850K would emulate the speed of a real HP 2113 for "normal" code but it depends on the mix. Maybe it's the lack of whirring fans that makes it seem so slow when the sim is set that way...








Main text last modified January 25, 2008
Terry Newton (wtnewton@infionline.net)