Post Reply 
A ROM emulator for the 71B
11-06-2020, 08:52 PM (This post was last modified: 11-07-2020 06:34 PM by mfleming.)
Post: #1
A ROM emulator for the 71B
I thought some may be interested in a lockdown project I've been working the past four months or so. It is a PIC18 microcontroller-based ROM emulator for the 71B that can store multiple ROM images and serve up one image at a given time. In its present form the emulator resembles Diego's Clonix line of modules for the HP-41, except for the current single ROM at a time limitation. Here are a few images of the development setup and current board.

[Image: uc?export=view&id=1vikGt_9ipS_Ys...8amW9QeQuB]

I started this project because I wanted to try some of the available 71B ROMs, including J-F's new Math ROM. The problem of course is that most of the original ROM modules (when you can find them) often cost more than the 71B itself. A quick check of the specs for the PIC convinced me that it might work as a software emulator of a ROM module. It was quite a challenge to meet the timing requirements while at the same time figuring out just how the 71B bus works.

The reason you see rechargeable batteries is because the recommended maximum operating voltage of the PIC controller is 5.5 Volts, with an absolute maximum rating of 6.5 Volts. When used with the higher voltage alkaline batteries, the processor lifetime would likely be shortened. Four Eneloops keep things well within recommended operating conditions.

Power consumption is fairly reasonable, drawing about 3.8 mA when operating. The controller does switch to Sleep mode 2-1/2 minutes after the 71B is turned off, drawing less than a micro Amp of current.

I currently have the ROM images of the Circuit Analysis Pac, J-F's Math2B, Finance Pac, Text Editor, and Ampi Statistics Pac loaded in flash. Plugging and unplugging ROMs is done via a POKE command as shown below. I've run through the many examples in the Math and Finance manuals to make sure all is working correctly.

I believe there is sufficient timing slack to also support a hard configured ROM in addition to a soft ROM. Then the Forth and HP-41 Translator ROMs would also be available. Right now, flash is updated by a PICkit 3 programmer in much the same way as one of Diego's modules.

[Image: uc?export=view&id=1zr94SVkPXb-Vk...esD9VH9jq_]

I'm still something of an HP-71B newbie, but I know there is a large repository of LEX files maintained by Joe Horn. If someone could point me to documentation on making your own ROM image (and some favorite LEX files of your own!), I'd love to add a custom ROM to what I have now.

I must thank Diego Diaz for his Clonix module line for inspiration, J-F Garnier for answering questions on the 71B behavior, and especially Tony "teenix" Nixon for answering questions on PIC assembly programming. This has been quite a fun project and it now gives me plenty of motivation to learn the 71B in greater depth and detail!

~Mark

Edit: Add J-F for well deserved credit.

Remember kids, "In a democracy, you get the government you deserve."
Find all posts by this user
Quote this message in a reply
11-06-2020, 09:16 PM (This post was last modified: 11-06-2020 10:57 PM by Massimo Gnerucci.)
Post: #2
RE: A ROM emulator for the 71B
Now, that's interesting!!

Well done Mark.

Let me know if you'll ever sell one of them.

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
11-06-2020, 09:58 PM (This post was last modified: 11-06-2020 10:02 PM by rprosperi.)
Post: #3
RE: A ROM emulator for the 71B
I want one when they're ready!!

The following assumes you want to make ROM images in the same format as are used with emu71/DOS and emu71/WIN, and not true EPROM images as would be used to burn a classic EPROM chip as used with the HHP chip carrier that mounts in the Card Reader port.

To make your image, the basic steps are:

A. Assemble the contents
B. Prepare the image (to write the checksum and 'chain' the BASIC programs)
C. Copy the image to the PC to load into the ROM emulator

A. Assemble the image

1. Create an IRAM of the same size as the ROM image you want (e.g. FREE PORT(2)). Note that for a 64KB image you CANNOT use 2 x 32k ports, as found in most RAM modules, you would need an HHP 96k RAM module, modified to create a genuine single 64k IRAM.

2. Copy the files that you want in the ROM image into the target IRAM.

3. Purge all other copies of any of the LEX files you will be putting in ROM and run commands from the LEX files and the BASIC programs to verify and ensure access, versions, etc.

B. Prepare the image

Use the PTGENC$() command from the CMT EPROM tools to calculate and write the port checkum and also chain all BASIC files (verify GOTOs are legal, etc.). This is done with the target port as follows: PTGENC$(':port(2)')

C. Copy the image to the PC to load into the ROM emulator

Copy the image to your PC using a BASIC program to send the stream of bytes to ILPer (or pyILPER) as explained in the emu71/Win manual from Christoph Gissielink, quoted verbatim here:

Code:
3. ROM Images

You need ROM images. The necessary ROM images are copyrighted by
Hewlett Packard and I have no license to distribute them.
Please don't ask me, I will not send you mine.

This is a ROM dump program from Jean-François Garnier reading the
HP-71B ROM content and sending the data to a HP-IL printer device.
In this case I prefer using his PIL-Box with ILPer for capturing the data
in the ILPer Printer area.

10 DIM A$[64]
20 A=HTD("0") ! start address of ROM to transfer
30 FOR I=0 TO 64*32-1 ! length of ROM (here for 64Kb)
40 A$=PEEK$(DTH$(A+I*64),64)
50 OUTPUT :1 ;A$
60 NEXT I

The output format is a memory dump file like used by Derek S. Nickel's 
Voyager program. With the program Dmp2rom.exe from the file tool package
the memory dump file can be converted to the necessary ROM file format.

If you made the ROM dump, you may also modify the program above to
read the HP-IL ROM module content.

10 DIM A$[64]
20 A=IP(HTD(ADDR$("HPILROM"))/256)*256 ! start address of HPIL ROM to transfer
30 FOR I=0 TO 16*32-1 ! length of ROM (here for 16Kb)
40 A$=PEEK$(DTH$(A+I*64),64)
50 OUTPUT :1 ;A$
60 NEXT I

ROM images are valid in a packed (even address lower nibble, odd address higher nibble)
or unpacked (one nibble per byte with even address first) form. Files in the packed form 
have the same format like the files used in Emu71 for DOS from Jean-François Garnier.
They can be validated with the TITANCHK.EXE command line utility. TITANCHK.EXE 
is part of the Emu71 installation package or binary distribution or can be downloaded
separately here. To do that, start a Command Prompt while running Windows,
and type:

    Titanchk <image-file>

where <image-file> is the ROM image you want to test. As result you will get a report
of the Checksum check.

The results of the copy go to the printer window in ILPer; once completed, copy the program output to a text file, to then convert to the binary image you will load.

Here's a link to the file tool package for converting the text output to the binary format file:

http://hp.giesselink.com/Pcuti/FILETOOL.ZIP

It can sound onorous, but it's really pretty straightforward.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
11-06-2020, 10:57 PM
Post: #4
RE: A ROM emulator for the 71B
Thanks Bob! I assume I can walk through your instructions on emu71/WIN and build a test image to try out. If not, I'm in trouble since I only have a single 4K RAM module!

I'm tweaking the code structure to make it easier to specify what ROM images are loaded in flash and how they are enumerated on power-up. Hopefully then just one simple file to edit to specify what images are loaded and where, then build and flash. Programmers can be had for $13~16 USD on eBay or elsewhere.

Anyone have a problem with just a bare board? Dan "twoweims" Simpson has a nice enclosure for the EPROM carrier. I could trim the PCB down a bit to fit the case dimensions for those who want the option for something nicer looking than a big hole in the front of their 71 Smile

Remember kids, "In a democracy, you get the government you deserve."
Find all posts by this user
Quote this message in a reply
11-06-2020, 10:58 PM (This post was last modified: 11-06-2020 11:01 PM by Dave Frederickson.)
Post: #5
RE: A ROM emulator for the 71B
(11-06-2020 09:58 PM)rprosperi Wrote:  B. Prepare the image

Use the PTGENC$() command from the CMT EPROM tools to calculate and write the port checkum and also chain all BASIC files (verify GOTOs are legal, etc.). This is done with the target port as follows: PTGENC$(':port(2)')

Not quite.

ROM images have one checksum per 16k, as in TITANCHK, while EPROM images have one checksum per image. The PTGENC$ command, above, comes from the CMT Tools package for burning EPROMS.

Instead one should use ROMCOPY, described by Dave Conklin of Firmware Specialists as "a lex file that computes and places checksums in ROM images."

Dave

Edit: As discussed in other threads, the "EPROM image" will work. It will, however, fail a ROM diagnostic.
Find all posts by this user
Quote this message in a reply
11-07-2020, 12:45 AM
Post: #6
RE: A ROM emulator for the 71B
wonderful stuff Mark, especially for those of us who can't get hold of an FRAM71 Smile

I'll certainly buy one if/when you're making some, please. thanks!

Cambridge, UK
41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47
Casio, Rockwell 18R
Find all posts by this user
Quote this message in a reply
11-07-2020, 01:52 AM (This post was last modified: 11-07-2020 02:01 AM by twoweims.)
Post: #7
RE: A ROM emulator for the 71B
(11-06-2020 10:57 PM)mfleming Wrote:  Thanks Bob! I assume I can walk through your instructions on emu71/WIN and build a test image to try out. If not, I'm in trouble since I only have a single 4K RAM module!

I'm tweaking the code structure to make it easier to specify what ROM images are loaded in flash and how they are enumerated on power-up. Hopefully then just one simple file to edit to specify what images are loaded and where, then build and flash. Programmers can be had for $13~16 USD on eBay or elsewhere.

Anyone have a problem with just a bare board? Dan "twoweims" Simpson has a nice enclosure for the EPROM carrier. I could trim the PCB down a bit to fit the case dimensions for those who want the option for something nicer looking than a big hole in the front of their 71 Smile

I could probably modify the case to fit if I had a sample...
Modify the existing holder with a slot on top for access to the programming header then add a flexible cap to seal the hole during normal use.


I would also like to buy one if/when they are available.
Visit this user's website Find all posts by this user
Quote this message in a reply
11-07-2020, 03:35 AM
Post: #8
RE: A ROM emulator for the 71B
No need for modification to the enclosure. The current PCB fits the card reader well, leaving a slight offset all around to avoid contact with the sides of the well. I would only need to bring the PCB edges in by roughly the thickness of the enclosure walls to fit, along with a notch to extend the connector portion from the enclosure. To connect the programmer, all that would be needed is to remove the back cover and lift off the back of the enclosure.

(11-07-2020 12:45 AM)cdmackay Wrote:  wonderful stuff Mark, especially for those of us who can't get hold of an FRAM71 Smile

Yeah, this project is sort of for all of us who came a few decades late to the HP-71B party Smile I didn't even have a 71 when the FRAM71 was on offer . . . .

~Mark

Remember kids, "In a democracy, you get the government you deserve."
Find all posts by this user
Quote this message in a reply
11-07-2020, 04:06 AM
Post: #9
RE: A ROM emulator for the 71B
Dave really likes checksums being correct... even if no one has a diag module to see if the checksum is correct. Passing a diag test seems to be the ONLY reason these checksums were created, as the OS ignores them. But chaining the BASIC programs is an important step, if you will be including any of those in the ROM image (and which will run from the ROM). But he is right, I just didn't want to muddy the picture.

Another simple technique Paul Berger found is to use ROMCOPY twice, once from IRAM->Disk File and then from the same Disk File->IRAM, which will clear the IRAM signature in the final image and place checksums properly, so the OS understands the image is ROM and not IRAM. This will also chain (also called 'compile' in the ROMCOPY docs) the BASIC programs.

Both work, the former is quicker and easier.

You can (and should) walk thru the ROM creation process, using a 4K image with several small LEX files, just to work through the process.

I think it would be better in the case, if that can be accommodated without changes to the board, but that's certainly a persnickety personal preference. The hole for the header and a cap makes it neat, tidy and tight (sorry, I taught Scout knots for too many years).

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
11-07-2020, 10:27 AM (This post was last modified: 11-07-2020 10:43 AM by J-F Garnier.)
Post: #10
RE: A ROM emulator for the 71B
First, my sincere congratulations to Mark for this achievement!

For someone who is "an HP-71B newbie" , this is really outstanding.
It is true that the HP-71 system is very well documented.

Matter of fact, Mark contacted me some time ago to discuss some aspects of the HP-71 system, the funny thing is that I was also investigating on a similar PIC-based ROM emulator, and we recognized that we selected the same PIC MCU!
But Mark did it first so all the credit must go to him !

J-F
Visit this user's website Find all posts by this user
Quote this message in a reply
11-07-2020, 03:49 PM
Post: #11
RE: A ROM emulator for the 71B
Good description of what to do to create a ROM image - i have archived this thread in my favorite links for 71B.

I was not aware of the challenge with the 64k EPROM (have 3 of those as CMT Front port) - underlined below - I can't recall having seen how to modify the HHP 96k into one 64k and one 32k, fixed.

Need to get that done before I start filling the 64k Space - they are nearly ready to go get burned.

Do you or someone on this forum mind giving me a hint?

(11-06-2020 09:58 PM)rprosperi Wrote:  I want one when they're ready!!

The following assumes you want to make ROM images in the same format as are used with emu71/DOS and emu71/WIN, and not true EPROM images as would be used to burn a classic EPROM chip as used with the HHP chip carrier that mounts in the Card Reader port.

To make your image, the basic steps are:

A. Assemble the contents
B. Prepare the image (to write the checksum and 'chain' the BASIC programs)
C. Copy the image to the PC to load into the ROM emulator

A. Assemble the image

1. Create an IRAM of the same size as the ROM image you want (e.g. FREE PORT(2)). Note that for a 64KB image you CANNOT use 2 x 32k ports, as found in most RAM modules, you would need an HHP 96k RAM module, modified to create a genuine single 64k IRAM.

2. Copy the files that you want in the ROM image into the target IRAM.

3. Purge all other copies of any of the LEX files you will be putting in ROM and run commands from the LEX files and the BASIC programs to verify and ensure access, versions, etc.

B. Prepare the image

Use the PTGENC$() command from the CMT EPROM tools to calculate and write the port checkum and also chain all BASIC files (verify GOTOs are legal, etc.). This is done with the target port as follows: PTGENC$(':port(2)')

C. Copy the image to the PC to load into the ROM emulator

Copy the image to your PC using a BASIC program to send the stream of bytes to ILPer (or pyILPER) as explained in the emu71/Win manual from Christoph Gissielink, quoted verbatim here:

Code:
3. ROM Images

You need ROM images. The necessary ROM images are copyrighted by
Hewlett Packard and I have no license to distribute them.
Please don't ask me, I will not send you mine.

This is a ROM dump program from Jean-François Garnier reading the
HP-71B ROM content and sending the data to a HP-IL printer device.
In this case I prefer using his PIL-Box with ILPer for capturing the data
in the ILPer Printer area.

10 DIM A$[64]
20 A=HTD("0") ! start address of ROM to transfer
30 FOR I=0 TO 64*32-1 ! length of ROM (here for 64Kb)
40 A$=PEEK$(DTH$(A+I*64),64)
50 OUTPUT :1 ;A$
60 NEXT I

The output format is a memory dump file like used by Derek S. Nickel's 
Voyager program. With the program Dmp2rom.exe from the file tool package
the memory dump file can be converted to the necessary ROM file format.

If you made the ROM dump, you may also modify the program above to
read the HP-IL ROM module content.

10 DIM A$[64]
20 A=IP(HTD(ADDR$("HPILROM"))/256)*256 ! start address of HPIL ROM to transfer
30 FOR I=0 TO 16*32-1 ! length of ROM (here for 16Kb)
40 A$=PEEK$(DTH$(A+I*64),64)
50 OUTPUT :1 ;A$
60 NEXT I

ROM images are valid in a packed (even address lower nibble, odd address higher nibble)
or unpacked (one nibble per byte with even address first) form. Files in the packed form 
have the same format like the files used in Emu71 for DOS from Jean-François Garnier.
They can be validated with the TITANCHK.EXE command line utility. TITANCHK.EXE 
is part of the Emu71 installation package or binary distribution or can be downloaded
separately here. To do that, start a Command Prompt while running Windows,
and type:

    Titanchk <image-file>

where <image-file> is the ROM image you want to test. As result you will get a report
of the Checksum check.

The results of the copy go to the printer window in ILPer; once completed, copy the program output to a text file, to then convert to the binary image you will load.

Here's a link to the file tool package for converting the text output to the binary format file:

http://hp.giesselink.com/Pcuti/FILETOOL.ZIP

It can sound onorous, but it's really pretty straightforward.
Find all posts by this user
Quote this message in a reply
11-07-2020, 03:52 PM
Post: #12
RE: A ROM emulator for the 71B
Mark,

this is SO cool!

Please add me to the list if you make some for sale, I'm one of your customers.

KimH

(11-06-2020 10:57 PM)mfleming Wrote:  Thanks Bob! I assume I can walk through your instructions on emu71/WIN and build a test image to try out. If not, I'm in trouble since I only have a single 4K RAM module!

I'm tweaking the code structure to make it easier to specify what ROM images are loaded in flash and how they are enumerated on power-up. Hopefully then just one simple file to edit to specify what images are loaded and where, then build and flash. Programmers can be had for $13~16 USD on eBay or elsewhere.

Anyone have a problem with just a bare board? Dan "twoweims" Simpson has a nice enclosure for the EPROM carrier. I could trim the PCB down a bit to fit the case dimensions for those who want the option for something nicer looking than a big hole in the front of their 71 Smile
Find all posts by this user
Quote this message in a reply
11-07-2020, 04:07 PM
Post: #13
RE: A ROM emulator for the 71B
(11-07-2020 03:49 PM)KimH Wrote:  I was not aware of the challenge with the 64k EPROM (have 3 of those as CMT Front port) - underlined below - I can't recall having seen how to modify the HHP 96k into one 64k and one 32k, fixed.

Need to get that done before I start filling the 64k Space - they are nearly ready to go get burned.

Do you or someone on this forum mind giving me a hint?

Instead of:
A. finding an ultra rare HHP 96k RAM module,
B. modifying it,
you can just use an emulator with a 64K RAM port.

J-F
Visit this user's website Find all posts by this user
Quote this message in a reply
11-07-2020, 04:41 PM (This post was last modified: 11-07-2020 04:47 PM by Dave Frederickson.)
Post: #14
RE: A ROM emulator for the 71B
(11-07-2020 04:06 AM)rprosperi Wrote:  Dave really likes checksums being correct... even if no one has a diag module to see if the checksum is correct.

In step C the ROM dump procedure from the Emu71/Win manual uses TITANCHK to verify the ROM dump.

If you expect this to pass the checksums must be correct.

(11-07-2020 04:07 PM)J-F Garnier Wrote:  Instead of:
A. finding an ultra rare HHP 96k RAM module,
B. modifying it,
you can just use an emulator with a 64K RAM port.

If the 71 has version 1BBBB firmware, a 32k port must be configured before the 64k port. This bug is documented elsewhere on the Forum and in a few documents.


Dave
Find all posts by this user
Quote this message in a reply
11-07-2020, 05:18 PM
Post: #15
RE: A ROM emulator for the 71B
Thanks Jean-François!

(11-07-2020 04:07 PM)J-F Garnier Wrote:  
(11-07-2020 03:49 PM)KimH Wrote:  I was not aware of the challenge with the 64k EPROM (have 3 of those as CMT Front port) - underlined below - I can't recall having seen how to modify the HHP 96k into one 64k and one 32k, fixed.

Need to get that done before I start filling the 64k Space - they are nearly ready to go get burned.

Do you or someone on this forum mind giving me a hint?

Instead of:
A. finding an ultra rare HHP 96k RAM module,
B. modifying it,
you can just use an emulator with a 64K RAM port.

J-F
Find all posts by this user
Quote this message in a reply
11-07-2020, 06:02 PM
Post: #16
RE: A ROM emulator for the 71B
Hi Mark, all,

Thanks for the credit :-)

The 71's bus and timing constrains are way more difficult to handle than those in the HP-41; this design of yours is indeed a nice piece of HW & FW job. Congrats!

Please count on me for one of the first batch units and/or beta testing.

Best wishes and enjoy the weekend.

Diego.

"Do not suppose, check it twice."
Find all posts by this user
Quote this message in a reply
11-07-2020, 07:07 PM
Post: #17
RE: A ROM emulator for the 71B
This has been one of those projects that I do for my own needs (ROMs!) and provide to others with the same interests. I'll first need to insure it will be as easy to use and update as Diego's Clonix series or Tony's Classic CPU board replacements. The easiest approach, for me anyway, would be to just reflash the MCU. That would require some technical expertise, which I'm sure all of you have.

A second approach, which I'm finishing up, would only require a terminal emulator like TeraTerm. A serial monitor would allow changes to configuration and transfer of ROM images. What's missing at the moment though is a bootloader to update the software itself.

The second option would take a good bit more development time, so I'm inclined to go with the first approach and offer the second at a later date. That way I could retain the ability to reflash the device if it were bricked by mistake. There are of course endless variations on those two themes, so I'd be happy to hear any thoughts on packaging things up. Feel free to email me if you have any detailed technical suggestions.

Thanks for your interest!
~Mark

Remember kids, "In a democracy, you get the government you deserve."
Find all posts by this user
Quote this message in a reply
11-07-2020, 07:19 PM
Post: #18
RE: A ROM emulator for the 71B
(11-07-2020 04:07 PM)J-F Garnier Wrote:  Instead of:
A. finding an ultra rare HHP 96k RAM module,
B. modifying it,
you can just use an emulator with a 64K RAM port.

J-F

Indeed, thanks for noting that here J-F! I assumed this was understood, but you are right, it's important to point it out clearly; you know what the they say about what happens when you assume...

Though I have all the emulators regularly discussed here installed and ready to use, I still prefer using real devices for most activities, but I must admit the above suggestion is a whole lot easier (and cheaper!) with an emulator.

I suppose if an emulator will satisfy you, there is no need for this device at all, right? But I guess it's ok to cheat a bit with that shortcut, on the way to making real devices to then play with.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
11-08-2020, 12:07 AM
Post: #19
RE: A ROM emulator for the 71B
This is incredible, thanks for your effort. Hopefully you will offer these for sale.
Find all posts by this user
Quote this message in a reply
11-08-2020, 12:06 PM
Post: #20
RE: A ROM emulator for the 71B
I would like two please! Bare boards, kits or ready to use units are all fine. I don't care as long as I get two Smile
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)