A webserver running on a HP-41 and HPIL patch for nonpareil



#12

Hi all,

I were looking for a HP-41 emulator that provided good support for HPIL and unfortunately, I found none that fitted my needs. (I need some HPIL debugging output, you'll understand why in the next paragraph.)
So, I've been working for a few days on a patch for nonpareil (Eric Smith's microcode simulator). As Eric's program is free software under the GPL license, I could modify the code and so did I. My patch implements HPIL for a HP-41 emulated by nonpareil. It also provides support for a few HPIL devices, namely the HP82162 printer, the HP82163 and HP92198 video interfaces, and the HP82164 HPIL/RS232 interface. The patch also adds a few minor features for nonpareil (such as autoloading files on startup). You'll find more details there:

http://pagesperso-orange.fr/kdntl/hp41/nonpareil-patch-doc.html


I needed an emulator that could provide HPIL debugging tools because I had a project about programming a web server with minimal TCP/IP stack on a HP-41. I already wrote a FOCAL implementation of such a webserver. It's called WWWD and you can download it there:

http://pagesperso-orange.fr/kdntl/hp41/

You can already ping your HP-41 as you do with any host on Internet. You can also request a web page from your HP-41.

Well, this version is just a preview. It is slow. The emulated HP-41 takes approximately 155 seconds to answer a ICMP echo request (a so-called "ping" request). An HTTP request takes several long minutes, I can't even remember how many exactly.

I am planning to write a MCODE version of WWWD. Hopefully, it could answer a ping or an HTTP request in less than say 5 or 10 seconds.

Hope you enjoy,

Khanh-Dang


#13

Great project Khaan-Dang, I thought about the project once (for about 2 minutes or so...) thinking it would be really cool to hook up the 41 to the internet.

Doug Wilder wrote some pretty wicked MCODE stuff with HP-IL so he might be a good source for chatting about this project. Or just studying his code (all the MCODE source listings are on TOS) might help.

Anyway, looking forward to hearing more about it and then trying it!

Cheers

Peter


#14

Glad you like it!

By the way, since I discovered the HP-41 and HP-IL world, I have been wondering about a few questions. I couldn't find a clear answer, although I had read all the specification documents and all the manuals I could have found; and unfortunately, I haven't got the corresponding hardware so I cannot even try to reverse-engineer it.

What does the so-called printer switch located on the HP-IL module exactly and how does it works? Is it connected to a CPU line or something?

Say I have a HP-41 with the HP-IL module and the video interface device (HP82163) on the HP-IL. In my emulation code, the HP-41 doesn't detect the HP82163 is actually not a printer. It acts instead as if the HP82163 is a thermal printer. The question is: is that behavior expected? (Actually, this question remains for any other HPIL devices other than the HP82163.)

Well, I know I could answer the latest question by decompiling the HP-IL and Printer2E ROMs, but I've found no decompiler* that could decompile the SELP opcodes correctly. Not that I am that lazy to decompile the ROM by myself, but if anyone has a kind of VASM listing of the HP-IL ROM, things would be a lot easier, I guess.

PeterP, I haven't found on TOS the HP-IL MCODE stuff by Doug Wilder you are talking about. Could you please give me some more precise references?

Cheers,

Khanh-Dang

Edit:
*: I wrote compiler instead of decompiler.


Edited: 1 Feb 2009, 4:49 a.m. after one or more responses were posted


#15

>What does the so-called printer switch located on the HP-IL module
>exactly and how does it works? Is it connected to a CPU line or
>something?

The switch is to deactivate the HPIL Printer ROM because there was a thermal printer with direct connect to the HP41 witch embed a printer ROM too.

And you don't want 2 ROMs with same functions (same XROMs) in your 41.

Patrice


#16

OK.

I think I've just found how this printer switch works.

When the printer switch is enable, the HPIL Printer ROM is at page 6. Thus, you can use all its commands as expected. This printer also defines some interrupt vectors: both the so-called "Pause loop" interrupt vector and the "I/O service" interrupt vector are defined to the same subroutine. I'm not sure when these interrupt vectors are precisely executed by the system. They may check for a HPIL printer or so.

Now, the interesting part is when the printer switch is disable. This forces the HPIL Printer ROM to be at page 4. Page 4 is normally reserved for the service ROMS. ROMs at page 4 can take over the system. (See "ZENROM manual", page 97) I guess ROMs at page 4 have no FAT table and their first executable word is directly at address 000 of the ROM. Now, what happens when the Printer ROM is at page 4?

Here is the first bytes of this ROM (remember ROM bytes are 10-bit). Interpretation follows.

000:  01D
001: 01B
002: 007
003: 1BB

When the ROM is at page 6 (printer switch is on), the ROM is considered as a normal ROM, with a FAT table. So, these first bytes shall be interpreted as:

000:  01D     ; XROM 29 (This is the ROM ID)
001: 01B ; FCNS 27 (There is 27 commands in this ROM)
002: 0071BB ; DEFP4K 7BB (This is the first "command" of the ROM
; it points to the "-PRINTER 2E" message)

When the ROM is at page 4 (printer switch is off), the bytes remain the same, but they are to be interpreted as executable code:

000:  01D01B  ; GOLC 0607
003: 007 ; GOC +0
004: 1BB ; GONC +55 403A
...
03A: 3E0 ; RTN
As the carry is not set when these bytes are executed, they basically do a RTN. So, I guess, when the system do a GSUB 4000 (question: when does this happen?), nothing happens.


I am not really sure about all I've just written but it seems to me quite convincing.


#17

Yes, your analysis is basically correct. The beginning of the FAT of the HP-IL printer ROM is very carefully crafted to do a return when addressed at page 4.

AFAICT, the reason for this is that the original 4Kx10 ROM chips used in the 41 family had inputs that could change bits 13 and 14 of their address, but no input that would disable them entirely. Moving the ROM between 6000 (required for printer ROMs) and 4000 is a clever hack that avoided needing to change the design of the ROM chip.

#18

when the system do a GSUB 4000 (question: when does this happen?)

In mainframe ROM at address 0180 =LSWKUP (Light-Sleep Wake-Up):

0180 001 =LSWKUP GSUBNC 4000
0181 100 *
#19

Quote:
http://pagesperso-orange.fr/kdntl/hp41/nonpareil-patch-doc.html

Fantastic! After updating scons on my Mac it built just fine. The emulated video interfaces, serial, and tcp are welcome additions. If you can manage it, can you add 9114B emulation as well (to an image on the disk of course). Tony Duell's lifutils for Linux may help.

Thanks!


#20

Adding emulation code for a peripheral is not so hard. The only difficulties I had to face up to the fact the documentation is very poor.

I've just taken a look to the 9114B manuals, and there is even not a word about HP-IL operation! The difficult part will be to reverse-engineer the HPIL ROM. But now that nonpareil can act as a HPIL sniffer thanks to its debugging output, things are easier, I hope.

#21

Holy cow! This is great stuff. Just what we need for the HP-41's 30th birthday this summer: A birthday web page running off a 41.


#22

He he.

I've just discovered the HP-41 world two weeks ago, or so, because I've read a topic in this forum about HP-41's 30th birthday. Then I thought it could be a nice idea to bring TCP/IP on the HP-41. I was quite surprised nobody had done it before.

Well, I still have a few month left to write the finish the MCODE version of WWWD :-)


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP-41(CL): The easiest way to transfer FOCAL programs from a Linux PC to the HP-41 Geir Isene 13 1,915 12-05-2013, 02:40 AM
Last Post: Hans Brueggemann
  Nonpareil Rom files davorin 2 479 09-20-2013, 06:20 PM
Last Post: Didier Lachieze
  WP_34S: Patch for wp34s_lib.pl Marcel Samek 0 272 07-05-2013, 12:49 PM
Last Post: Marcel Samek
  Patch for wp34s assembler Marcel Samek 0 273 06-26-2013, 05:35 PM
Last Post: Marcel Samek
  Fun things found by running strings on the 39gII emulator bhtooefr 11 1,292 05-16-2013, 12:40 AM
Last Post: Mic
  Nonpareil + HP10C Mike (Stgt) 0 323 05-13-2013, 04:58 AM
Last Post: Mike (Stgt)
  HHC 2013 Website up and running Joe Horn 4 639 05-05-2013, 07:17 PM
Last Post: bhtooefr
  Running 33S and 35S emulators in Win 8 Ed Look 12 1,228 12-07-2012, 03:24 PM
Last Post: Ed Look
  Original DM-15CC batch capacitor patch Neil Hamilton (Ottawa) 2 441 07-19-2012, 08:26 PM
Last Post: Gerson W. Barbosa
  HP75D with HPIL Karel Kupka 2 434 07-13-2012, 02:57 AM
Last Post: Karel Kupka

Forum Jump: