Post Reply 
The Ultimate Wand ... ;)
10-09-2023, 01:35 PM (This post was last modified: 10-09-2023 01:56 PM by ThomasF.)
Post: #1
The Ultimate Wand ... ;)
Hi all,

I have now proven and tested my thesis that the Raspberry Pico (see other threads about it) can be used to emulate - not only ROM modules and RAM - but also other hardware.

My goals with this was to emulate the Wand (82153A) since I wanted an easy way to enter programs into the calculator from a PC without going through HP-IL, cassette drives, or creating modules.
The card reader or the Wand are easy to use and a great way to enter programs into the calculator.

As described in other threads, the Pico attaches to the HP41 just as a module and can listen to and send signals on the different buses.
What differs the Pico from other MLDL or Clonix devices, is that we can also e.g. toggle the FI signal, which is used to signal from external hardware (ie cardreader or Wand) into the calculator.

With the program I have used in the Pico, I can e.g.:
  • Emulate modules and QRAM
    Modules can be flashed into the Pico and be "plugged" into the calculator as any normal module.
    Any page can also be marked as QRAM, so normal MLDL functionality can be used
  • Drive ISA
    Not only used for addresses or instruction, but also pull ISA to turn the calculator on if needed (as when pressing the button on the Wand)
  • Drive FI
    This is used by e.g. the Wand to indicate that the Wand is active, or when the Wand data-buffer contains data for the calculator to read.
As of now, I'm just using a simple terminal program to interface the Pico, from the PC, but the handling is very easy.

To plug any module into the Pico, a ROM-file is needed (same format as modules are shared online).
The module is then "plugged" into the calculator with the following command:

Code:
$ ../flash.sh ZENROM.ROM 10

This flashes (in ~1 second) the ZENROM module into page 10 (0xA) - upper page in port 2, that's it ... !
And all pages from 0x4 to 0xF are available for ROM's (but I have not implemented any bankswitching yet).

But as mentioned, my goal was to emulate the Wand, and by flashing the Wand ROM into the Pico, and emulating the buffer and pulling the FI-line, I can now "scan" any barcode into the calculator!

To realize this, I have added a separate flash-page (page 16 (0x10) - can contain up to 4K of data) in the Pico to contain barcode data (for any HP82153A compatible barcode), and to "scan" a program I use the following steps, in this case I try the large "CASTLE" program (https://www.hpmuseum.org/software/41castle.htm):

(Note that I have modified and added a "binary" printer ('/e') to the HP41UC tools, which just saves the barcode in a binary format, and that the program can be in any hp41uc tool compatible format.)

Code:
# Convert the text-file to raw format using the hp41uc tool (can be skipped if RAW is available):
$ ~/tools/hp41uc/hp41uc /n /t=castle.txt /r
# Convert the RAW HP41 program to binary barcode data:
$ ~/tools/hp41uc/hp41uc /r=castle /e
# Flash the "barcode" data into the Pico flash memory (page 16)
$ ../flash.sh castle.bin 16
Loading into Flash: [==============================]  100%
Verifying Flash:    [==============================]  100%
  OK
#Thats it!

Then I just type 'w' in the terminal to start the Wand emulation - "scanning" the barcode data - moving it into the emulated Wand buffer and start playing with the ISA and FI to get the calculator to read the data from the wand into RAM.

A short video showing when the 160 lines of "barcodes" are scanned into the HP41 can be seen here: Scanning 160 barcodes
Note that the calculator is powered off and is started by the Pico - just as if the Wand button was pressed!

Yes, I know, it is not optimal - the HP gets very slow before being "packed" - and also the ping-sound after every scan is a bit annoying (my plan is to update the Wand-ROM to remove the "ok" beep, that will also make it a bit faster) ... but how long would it take to manually scan 160 barcodes with a real Wand - or transfer the original Focal program into the calculator? Wink

Next step would be to replace the terminal with an application where I can select which file or any barcode to download into the Pico - just point and click!

And with clever programming - a new module could be made, which directly talks to the PC or a filesystem on the Pico to directly inject any data into RAM or XMem, using the options that the Pico offers with access to the PC.

So yes - I think I have achieved at least my goal and proved what can be done with the Pico - knowing that there are some other interesting projects going on with similar emulations of hardware!

Cheers,
Thomas

[35/45/55/65/67/97/80 21/25/29C 31E/32E/33E|C/34C/38E 41C|CV|CX 71B 10C/11C/12C/15C|CE/16C 32S|SII/42S 28C|S 48GX/49G/50G 35S 41X]
Find all posts by this user
Quote this message in a reply
10-10-2023, 02:10 PM
Post: #2
RE: The Ultimate Wand ... ;)
Very cool !
I love hardware hacking.

Excellent work!

-J
Find all posts by this user
Quote this message in a reply
10-10-2023, 02:34 PM
Post: #3
RE: The Ultimate Wand ... ;)
(10-10-2023 02:10 PM)John Garza (3665) Wrote:  Very cool !
I love hardware hacking.

Excellent work!

-J

Thanks John!

All credits should go to Andrew who opened the Pandora box that contained the Pico! Wink

With almost "real time" disassembler trace, it was really a piece of cake to understand how the Wand works when reading program barcodes, and just a bit harder to implement the drivers towards FI to "talk" to the HP41.

Extending the Pico to a Pico W would enable Wireless transmission of programs from a PC (if the Pico was to be powered by a LiPo).
Or simulating the cardreader (emulating the insertion of a card) could be used to send programs in the other way ...
There is also two FI flags that are not used by the system today, so with some clever MCode programming anything is doable, why not a "smart" USB-cable that provides file sharing capabilities with drag and drop to RAM and X-Memory...

Too much to do, with too little time ... Wink

Cheers,
Thomas

[35/45/55/65/67/97/80 21/25/29C 31E/32E/33E|C/34C/38E 41C|CV|CX 71B 10C/11C/12C/15C|CE/16C 32S|SII/42S 28C|S 48GX/49G/50G 35S 41X]
Find all posts by this user
Quote this message in a reply
Post Reply 




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