This document describes the features added to nonpareil-0.79 by Eric Smith (see http://nonpareil.brouhaha.com/) by the the HP-IL and autoloading patch.
$ tar -xfz nonpareil-0.79.tar.gz
$ bunzip2 nonpareil-wholepatch-2009xxxx.diff.bz2
$ patch -p0 < nonpareil-wholepatch-2009xxxx.diff
$ cd nonpareil-0.79 && scons && sudo scons install
Notes:
'SConsEnvironment' object has no attribute 'Clone',
please update your scons to an earlier version.
Note that nonpareil also supports the Helios printer which currently provides better emulation (for the "Print" and "Advance" keys are correctly implemented).
hpil.mod). Get it and copy it
in $HOME/.nonpareil/.
$HOME/.nonpareil/41CV.nal:
MOD hpil.mod HPIL hpil.conf
$HOME/.nonpareil/hpil.conf:
printer mode=trace double debug
$ nonpareil 41cvYou can see the HPIL frames displayed on the standard output.
Put in your .nal file (order is important):
MOD hpil.mod HPIL hpil.conf MOD 82143a.mod # this line must be after hpil.mod's one
In your hpil.conf file:
set printer_switch 0
The set printer_switch 0 command is for disabling the printer switch
located on the HPIL module.
Nonpareil reads a .nal file at startup and execute commands in this
file. This file can ask nonpareil to load MOD1 files, set up external HPIL
peripheral (HP-41 only), load a user code file (HP-41 only), or write some
given hexcode in any RAM location.
The full file path is $HOME/.nonpareil/XXXX.nal, where XXXX stands
for the emulated platform. For example, if you run nonpareil with the 41cv
KML file, nonpareil will read the $HOME/.nonpareil/41CV.nal file.
The recognized commands follow, where <foo> stands for a required
parameter. When this parameter is a filename, the corresponding file is
searched in the following order: the current directory, then the user
nonpareil directory usually $HOME/.nonpareil/, then the default
nonpareil directory, e.g. /usr/local/lib/nonpareil/. You can't use
spaces in filenames.
BIN <bin_file> (only implemented for HP-41)DAT <dat_file> (only implemented for HP-41)HPIL <configuration_file> (HP-41 only)MEM41.DAT <mem41.dat_file> (HP-41 only, not yet implemented)MEMLOST <number_of_user_registers> (only implemented for HP-41)MOD <mod_file> (HP-41 only)RAM <address> <value>0x (if so, the digits are interpreted as hexadecimal digits).
REG <number> <value> (implemented for HP-41 only)STO and
RCL. Number and values are in decimal form, unless you prepend them with
0x (if so, the digits are interpreted as hexadecimal digits).
XMEM41.DAT <xmem41.dat_file> (HP-41 only, not yet implemented)hpil.mod and
copy it into your $HOME/.nonpareil/ directory.
$HOME/.nonpareil/41CV.nal (or
$HOME/.nonpareil/41CX.nal, depending on the model you want to emulate):
MOD hpil.modOf course, change the file name accordingly.
$HOME/.nonpareil/hpil.conf.
You have to add the following line in your $HOME/.nonpareil/41CV.nal:
HPIL hpil.conf
$HOME/.nonpareil/hpil.conf file. Each line adds a HPIL
peripheral, accordingly to the specified name. For example, consider the
following file:
# This is a comment serial tty=/dev/ttypa # This is another comment dumb debug printer mode=trace printer double debug videoThe first word of each line is the peripheral's name. Other words are considered as optional arguments (some are mandatory, though, depending on the peripheral). Please read the next section for a more detailed description of supported peripherals. You can add several peripherals of the same type. In the example above, two HPIL printers are set up on the loop.
The list of emulated peripherals follow. (Alphabetical order)
This peripheral emulates the HP9114B device (Disc Drive). Device accessory ID is 16.
Actually, HP9114B was said to have commands which are copatible with he
HP82161 cassette drive, so the disc and tape implementations are the
same, except that discs hold 2464 records whereas cassettes only hold 512.
Options:
debugfile=<full path to LIF image file>disc.img.
This peripheral just retransmits the HPIL incoming frames. For debugging purposes, you can add errors in retransmitted frames.
Options:
debugdelay=<nb_of_microseconds>0.
forget=<percentage>0.
noise=<percentage>0.
spurious=<percentage>0.
You don't want to use this peripheral. It acts as an powered-off peripheral and discards any received frame.
Options:
debugThis peripheral emulates the HP82182A device (HPIL thermal printer). Device accessory ID is 32. It uses the same graphical interface than the helios printer implemented in nonpareil. The format character is not implemented. The keys don't work yet.
Options:
debugmode=<mode>manual, normal and
trace). Default is manual.
doubleThis peripheral emulates the HP82164A device (HP-IL/RS-232-C Interface). Device accessory ID is 66. Lots of advanced features are not yet supported.
Options:
debugtty=<ttyname>/dev/ttyS0 for a real RS232
serial port. You can also use pseudo-terminals like /dev/ttya0.
This peripheral emulates the HP82161A device (Digital Cassette Drive). Device accessory ID is 16.
This has not been extensively tested. I may have misinterpreted the Owner's Manual which is quite confusing about some important details.
Options:
debugfile=<full path to LIF image file>cassette.img.
This is not really a peripheral but rather a tranceiver. All incoming HPIL frames are retransmitted using the TCP/IP protocol, while all incoming TCP/IP data is forwarded to the HPIL. This is useful if you want to write your own HPIL device emulation code without modyfing nonpareil's code. You code should connect to nonpareil through a TCP socket, it could then receive and send data via the socket. The format is simple: each HPIL frame shall be a two-bytes data, the first byte (network order), more precisely its first 3 bits, is the HPIL header; the second byte is the HPIL data itself.
This pseudo-peripheral can work either as a client (it connects to a server) or as a server (it waits for a connection from a client).
Until the TCP connextion is established, all HPIL frames are discarded.
Options:
debuglistenhost=<address>127.0.0.1.
port=<port_number>4141.
wait=<seconds>0.
This peripheral emulates the HP82163 device (HPIL video interface) or the HP92198 device (HP-IL 80-column video interface).
All escaped sequences of HP82163 should work. Some escaped sequences of HP92198 are not yet implemented.
Note: The HP82163 Owner's Manual says HP82163 doesn't answer to the SST (Send Status) request. I believe it is wrong, and nonpareil actually answers 0x80 followed by 0x00.
Options:
80zoomx=<n>2.
zoomy=<n>2.
If you know about C programming, you should read the source code if the documentation is not clear enough. "Use the source, Luke!"
For convenience, the ChangeLog of the patch is reproduced here:
2009-07-14 Khanh-Dang Nguyen Thu Lam <kdntl@yahoo.fr> * hpil_io_pilbox.c: Hopefully working version. 2009-07-13 Khanh-Dang Nguyen Thu Lam <kdntl@yahoo.fr> * hpil_io.c, hpil_io_misc.c: times(NULL) was non-standard. 2009-07-12 Khanh-Dang Nguyen Thu Lam <kdntl@yahoo.fr> * hpil_io_pilbox.c: Added initial support for pilbox. 2009-03-19 Khanh-Dang Nguyen Thu Lam <kdntl@yahoo.fr> * digit_ops.c: Avoided two-digit results in do_add() and do_sub(). 2009-03-15 Khanh-Dang Nguyen Thu Lam <kdntl@yahoo.fr> * coconut_usercode.c: Fixed two bugs that prevented some programs to load properly. * dis_nut.c: Debug output now shows whether the proc is in hexa or decimal mode. 2009-03-08 Khanh-Dang Nguyen Thu Lam <kdntl@yahoo.fr> * dis_nut.c: Corrected "? rcr" to "rcr" 2009-03-06 Khanh-Dang Nguyen Thu Lam <kdntl@yahoo.fr> * coconut_usercode.c: Minor fixes. 2009-02-28 Khanh-Dang Nguyen Thu Lam <kdntl@yahoo.fr> * hpil_io_video.c: Corrected minor bug and commented out unused function. 2009-02-24 Khanh-Dang Nguyen Thu Lam <kdntl@yahoo.fr> * dis_nut.c: Corrected wrong "? s=0". 2009-02-10 Khanh-Dang Nguyen Thu Lam <kdntl@yahoo.fr> * hpil_io_tape.c: - "disc" simulation should now work - Can now use smaller LIF image - Cleaned code * hpil_io_printer.c: Clear the right-justify flag at end-of-line. 2009-02-08 Khanh-Dang Nguyen Thu Lam <kdntl@yahoo.fr> * proc.c: Changed the jiffy length so that HPIL simulation is not slowed down. * hpil_io_tape.c: Added initial support for HP82161A Digital Cassette drive and HP9114B Disc Drive * hpil.c: Fixed bug: the selpf read opcode shall clear the entire C register, instead of just setting the first two nibbles. * hpil_io_printer.c: Improved compatibility with the real printer. * fonts.h, fonts.c, helios.c, hpil_io_printer.c, hpil_io_video.c: - Used the new fonts.c implementation. - Fixed the down arrow character. * hpil_io_video.c: Used better font display for HP92198. 2009-02-02 Khanh-Dang Nguyen Thu Lam <kdntl@yahoo.fr> * hpil_io_video.c: - Fixed bug: the "ESC % m n" escape sequence didn't work as expected - Removed all the compatibility mode stuff. We don't follow the HP82163 Owners's Manual anymore: the HP82163 now answers to SST and sends 0x80 followed by 0x00. - Set the character size to 8x12 for HP82163 (font is still 5x8). - Set realist cursor blinking rate (as seen on video by Egan Ford). * autoload.c, coconut_usercode.c: - Implemented the REG and RAM autoloading commands. - BIN and DAT commands can now load programs not END-terminated. - Fixed bug: DAT files didn't load. - Handled errors properly and added debugging output. * util.h, util.c, csim.c: Renamed strlcpy() and strlncpy() to x_strlcpy() and x_strlncpy() because MacOS/X already has a strlcpy() which conflicts with ours (reported by Egan Ford). * about.c: Updated credits and copyright notice. Rewrote the dialog using GtkAboutDialog. * proc_nut.c: Corrected wrong error message. 2009-02-01 Khanh-Dang Nguyen Thu Lam <kdntl@yahoo.fr> * hpil.c: Implemented the printer switch. The user can disable it with "set printer_switch 0" in his HPIL configuration file. * hpil.c, hpil_io.c: Corrected default HPIL configuration when no configuration file is specified or when one is specified but no peripheral is declared. * hpil_io_printer.c: Added comments. 2009-01-31 Khanh-Dang Nguyen Thu Lam <kdntl@yahoo.fr> * csim.h (csim_t): - Added autolad_fn member in csim_t. This is the full path to the autoloading instructions file. * proc_int.h (processor_dispatch_t): - Added next_page callback. This function shall find the next available page. - Added install_additional_chip callback. - Added hpil_receive callback. * proc.h (chip_type_t): - Added CHIP_HPIL. * proc_nut.h (nut_reg_t): - Added c_to_hpil_fcn callback which implements the HPIL=C opcode. - Added hpil_receive_fcn callback which receives a HPIL frame. * csim.c, proc.c, autoload.c, autoload.h, coconut_usercode.c, coconut_usercode.h: - Implemented autoloading files at startup. - Opening a status file with declared additional chips is now supported. This uses the new install_additional_chip callback. - Implemented loading MOD1 at non-fixed page. This uses the new next_page callback. - Implemented loading a user code binary into coconut. - Renamed set_default_state_path to set_default_fn because the default path now also applies to the autoloading file. * csim.c, proc.c, proc.h, proc_nut.c, hpil.c, hpil.h, hpil_io.c, hpil_io.h, hpil_io_misc.c, hpil_io_misc.h, hpil_io_dumb.c, hpil_io_printer.c, hpil_io_serial.c, hpil_io_tcp.c, hpil_io_video.c: - Added nearly exhaustive HPIL support for coconut. - Added support for the null, dumb, HP82162A, HP82164A, tcp, HP82163A and HP92198 HPIL peripherals. - Each peripheral runs in its own thread and may need to use gdk_threads_enter() and gdk_threads_leave(). gdk_threads_init() was added in csim.c. - In proc.c: - enum sim_cmd_t now has CMD_HPIL_FRAME_RECEIVED. - sim_get_cmd_q() is implemented. The last peripheral on the loop needs to use the simulator's command queue to send the CMD_HPIL_FRAME_RECEIVED message. - struct sim_thread_vars_t now has the hpil_free_q member. This queue hold preallocated messages. That way, the thread which sends a CMD_HPIL_FRAME_RECEIVED message doesn't have to allocate memory, preventing performance loss. * printer.c, printer.h, printer_chargen.c, helios.c, helios.h: - The printer.c file is now strictly independant of helios.c. helios_chargen.c was renamed to printer_chargen.c Functions in printer.c are now used in both helios.c and hpil_io_printer.c. - Fix the glyphs "1" and upper "J". - Added Roman8 font (disabled by default). * helios.c, phineas.c: Added a check to prevent the chip to be inited twice. This could happen when nonpareil first loads a status file in which a chip is declared, and then autoloads a MOD file which require the same chip. * debugger_gui.c: - Used monospace font for registers fields. - Added a hardcoded (ugly) requisite size. * proc_nut.c (nut_read_ram): - Fixed bug (nut_read_ram returned wrong values). * csim.c, csim.h: - Used G_DIR_SEPARATOR_S instead of "/". - Defined the NONPAREIL_DIRNAME macro and set it accordingly. * SConscript: - Added compilation of new files - Used _env.Clone instead of the deprecated _env.Copy.