Post Reply 
HP41C with Rp Pico attached
07-06-2023, 06:04 PM
Post: #21
RE: HP41C with Rp Pico attached
(07-06-2023 05:00 PM)ThomasF Wrote:  Thanks, I will do!

I spent some more time on the character handling, and can emulate most of the display now - even the Goose flies around when it should ... Wink

Cheers,
Thomas

Cool!

I have been building my own Pico/HP41 setup yesterday and today. A bit of a struggle with my Windows VS Code development setup but things running smoothly. I have not been able to get the display monitoring running yet. Instead I plan to focus on getting the HP41 bus interfacing running using the PIO.

@Thomas do you plan to share your code?

Regards, Meindert
Find all posts by this user
Quote this message in a reply
07-06-2023, 06:25 PM
Post: #22
RE: HP41C with Rp Pico attached
(07-06-2023 06:04 PM)MeindertKuipers Wrote:  
(07-06-2023 05:00 PM)ThomasF Wrote:  Thanks, I will do!

I spent some more time on the character handling, and can emulate most of the display now - even the Goose flies around when it should ... Wink

Cheers,
Thomas

Cool!

I have been building my own Pico/HP41 setup yesterday and today. A bit of a struggle with my Windows VS Code development setup but things running smoothly. I have not been able to get the display monitoring running yet. Instead I plan to focus on getting the HP41 bus interfacing running using the PIO.

@Thomas do you plan to share your code?

Do you have your PIO code design somewhere? I'd be interested to see it. I think it will be a challenge.

Andrew
Find all posts by this user
Quote this message in a reply
07-06-2023, 06:41 PM
Post: #23
RE: HP41C with Rp Pico attached
(07-06-2023 06:04 PM)MeindertKuipers Wrote:  @Thomas do you plan to share your code?

Sure, I could do that, right now it is a a lot of hacking and trying (still on the learning side).
But, as soon as it looks ok and I cleaned up a bit I could share my findings.
(Most is still based on Andrews code, I've added another font and are updating the LCD commands, since only basic functionality is there.)

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
07-07-2023, 11:50 AM
Post: #24
RE: HP41C with Rp Pico attached
(07-06-2023 06:25 PM)blackjetrock Wrote:  Do you have your PIO code design somewhere? I'd be interested to see it. I think it will be a challenge.

Andrew
No useable code yet, just a rough design in an excel sheet. I think it is doable using both PIO blocks. The ISA capture (and timing) takes almost all of one of the PIO blocks, and it looks like I will need to use at least one additonal external GPIO to sync between both blocks, which is useful for debugging anyway.

Regards, Meindert
Find all posts by this user
Quote this message in a reply
07-08-2023, 07:57 PM
Post: #25
RE: HP41C with Rp Pico attached
That’s a really neat project. Being able to mirror the display is handy. I sold my HP-41C for parts as the display developed a big black splodge (but no obvious impact damage), and was partially illegible. I wonder how many this could potentially save.
Find all posts by this user
Quote this message in a reply
07-08-2023, 08:18 PM
Post: #26
RE: HP41C with Rp Pico attached
(07-08-2023 07:57 PM)LEDfan Wrote:  That’s a really neat project. Being able to mirror the display is handy. I sold my HP-41C for parts as the display developed a big black splodge (but no obvious impact damage), and was partially illegible. I wonder how many this could potentially save.

As the code is currently written, it monitors the traffic between the CPU and display controller and displays a copy of what is on the LCD. So, yes, a broken LCD can be replaced by an OLED display (or some other with a few changes to drive it).
If, however, the display controller itself is broken then code would have to be written to fully emulate the display controller and take over the functions that it provides.

The Pico is fully capable of doing this as the HP41C is quite slow, so even if RAM or ROM is broken it should be possible for the Pico to emulate parts on the bus, even the CPU, but that would be a lot of work.

Andrew
Find all posts by this user
Quote this message in a reply
07-13-2023, 07:16 AM
Post: #27
RE: HP41C with Rp Pico attached
Hi again,

Some progress with the Tiny Pico and the 41 display.

I have now managed to emulate the display*, with annunciators and all.
I have not done a bitmap of the annunciators, but shortened the text (US=USER, P=PRGM etc).
During development I had some problems with some display-commands that added garbage to the display, until I realized that some constants (ie from a "LDI CON" instruction) were treated as commands instead of data.
So, I had to add a "disassembler" as well to have correct instruction decoding, so now I can trace the execution in "realtime" too Wink

(* Just noticed that the rightmost punctation is missing in the display ... need to fix that!)

Code:
- DCE:0 ADDR:009F (000237) INST=0266 (1146) PA=01 (001) DATA=0000000224048001 - C=C-1  S&X
- DCE:0 ADDR:00A0 (000240) INST=03EB (1753) PA=01 (001) DATA=0000000224048001 - JC -03 [009D]
- DCE:0 ADDR:009D (000235) INST=03C8 (1710) PA=00 (000) DATA=0000000224048000 - CLRKEY
- DCE:0 ADDR:009E (000236) INST=03CC (1714) PA=00 (000) DATA=0000000224048000 - ?KEY
- DCE:0 ADDR:009F (000237) INST=0266 (1146) PA=00 (000) DATA=0000000224048000 - C=C-1  S&X
- DCE:0 ADDR:00A0 (000240) INST=03EB (1753) PA=00 (000) DATA=0000000224048000 - JC -03 [009D]
- DCE:0 ADDR:00A1 (000241) INST=03E0 (1740) PA=FF (377) DATA=0000000224048FFF - RTN
- DCE:0 ADDR:11D1 (010721) INST=0241 (1101) PA=FF (377) DATA=0000000224048FFF - -->
- DCE:0 ADDR:11D2 (010722) INST=0006 (0006) PA=FF (377) DATA=0000000224048FFF - ?NC GO 0190
- DCE:0 ADDR:0190 (000620) INST=03D9 (1731) PA=FF (377) DATA=0000000224048FFF - -->
- DCE:0 ADDR:0191 (000621) INST=001C (0034) PA=FF (377) DATA=0000000224048FFF - ?NC XQ 07F6
- DCE:0 ADDR:07F6 (003766) INST=0130 (0460) PA=FF (377) DATA=0000000224048FFF - LDI S&X
- DCE:0 ADDR:07F7 (003767) INST=0010 (0020) PA=FF (377) DATA=0000000224048FFF - CON: 3FF (1777)
- DCE:0 ADDR:07F8 (003770) INST=0270 (1160) PA=FF (377) DATA=0000000224048FFF - RAM SLCT (PA=FF)
- DCE:0 ADDR:07F9 (003771) INST=0130 (0460) PA=10 (020) DATA=0000000224048010 - LDI S&X
- DCE:0 ADDR:07FA (003772) INST=00FD (0375) PA=10 (020) DATA=0000000224048010 - CON: 010 (0020)
- DCE:0 ADDR:07FB (003773) INST=03F0 (1760) PA=10 (020) DATA=0000000224048010 - PRPH SLCT (PA=10)
- DCE:0 ADDR:07FC (003774) INST=03E0 (1740) PA=FD (375) DATA=00000002240480FD - RTN
- DCE:1 ADDR:0192 (000622) INST=0060 (0140) PA=FD (375) DATA=00000002240480FD - POWOFF
- DCE:1 ADDR:0193 (000623) INST=0000 (0000) PA=FD (375) DATA=00000002240480FD - NOP

Check the video running a display test program: https://photos.app.goo.gl/iZWLb3JBPBUkazYD9
(Sorry for the frequency problem - the black stripe on the display...)

I have some drivers on the way (thanks Andrew Wink), so next will be to experiment with module emulation as well ...

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
07-13-2023, 09:06 AM
Post: #28
RE: HP41C with Rp Pico attached
(07-13-2023 07:16 AM)ThomasF Wrote:  During development I had some problems with some display-commands that added garbage to the display, until I realized that some constants (ie from a "LDI CON" instruction) were treated as commands instead of data.

Good progress! I am a bit behing with this development, but can sucessfully trace the bus in realtime now. Still working on the PIO design.
To distinguish between command and data you should keep track of the SYNC status during the instruction. If it is high it is the (first word of the) instruction, when low it is data or the second word of an instruction. Your disassembler is impressive!

Regards, Meindert
Find all posts by this user
Quote this message in a reply
07-13-2023, 11:19 AM
Post: #29
RE: HP41C with Rp Pico attached
(07-13-2023 09:06 AM)MeindertKuipers Wrote:  To distinguish between command and data you should keep track of the SYNC status during the instruction. If it is high it is the (first word of the) instruction, when low it is data or the second word of an instruction. Your disassembler is impressive!

Thanks Meindert!

I'll try that - never thought of looking at SYNC, but it is available and maybe a better option than to rely on the disassembler ... 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
07-25-2023, 03:07 PM
Post: #30
RE: HP41C with Rp Pico attached
Some progress ...

By adding a single line driver, I'm now able to drive the ISA line, and adding modules are now working.

Next step would be to add a filesystem to the Pico, so .MOD-files could be stored in flash, and then simply selected.

I also tried to modify the System Rom, and that works fine too ... Wink
Just as a crude test I replaced a single character in one of the error messages:
https://photos.app.goo.gl/RvrCzUUGsKxQWMLG8
Code:

                if( address == 016066 ) {
                    drive_data = 001; // Replace character with an 'A'
                    drive_data_flag = 1;
                } else

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
07-25-2023, 03:13 PM
Post: #31
RE: HP41C with Rp Pico attached
(07-25-2023 03:07 PM)ThomasF Wrote:  Some progress ...

By adding a single line driver, I'm now able to drive the ISA line, and adding modules are now working.

Next step would be to add a filesystem to the Pico, so .MOD-files could be stored in flash, and then simply selected.

I also tried to modify the System Rom, and that works fine too ... Wink
Just as a crude test I replaced a single character in one of the error messages:
https://photos.app.goo.gl/RvrCzUUGsKxQWMLG8
Code:

                if( address == 016066 ) {
                    drive_data = 001; // Replace character with an 'A'
                    drive_data_flag = 1;
                } else

Cheers,
Thomas

You could remove the system ROM and replace it all, using the RP2040 flash to store the new ROM. Then you can rewrite the system ROM entirely if you want to...

Andrew
Find all posts by this user
Quote this message in a reply
07-25-2023, 03:18 PM
Post: #32
RE: HP41C with Rp Pico attached
(07-25-2023 03:13 PM)blackjetrock Wrote:  You could remove the system ROM and replace it all, using the RP2040 flash to store the new ROM. Then you can rewrite the system ROM entirely if you want to...

Andrew

Yes, this was just a crude way to replace a single instruction.
The complete ROM could also be replaced and modified as you say.
This just shows how versatile your idea with the 2040 is!

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
07-25-2023, 03:22 PM
Post: #33
RE: HP41C with Rp Pico attached
(07-25-2023 03:18 PM)ThomasF Wrote:  
(07-25-2023 03:13 PM)blackjetrock Wrote:  You could remove the system ROM and replace it all, using the RP2040 flash to store the new ROM. Then you can rewrite the system ROM entirely if you want to...

Andrew

Yes, this was just a crude way to replace a single instruction.
The complete ROM could also be replaced and modified as you say.
This just shows how versatile your idea with the 2040 is!

Cheers,
Thomas

I think it's probably safe to modify a single bit this way, but forcing the ROM output like this all th e time
is probably too much stress.
Find all posts by this user
Quote this message in a reply
07-26-2023, 10:52 AM
Post: #34
RE: HP41C with Rp Pico attached
Good work Thomas!

I am making some progress as well using the PIO in the RP2040 to handle the low level HP41 interfacing. A bit of a challenge but a first level simple ISA bus tracer is working quite well with some refinements still to be done. There are some complications that needed to be solved and I can hint that handling the PWO transitions is necessary. I can also add that in some cases the exact signal assignment is important. Next is to add handling address and driving ISA for ROM and QROM emulation.

Regards, Meindert
Find all posts by this user
Quote this message in a reply
07-26-2023, 11:45 AM
Post: #35
RE: HP41C with Rp Pico attached
Thanks for the update Meindert!

I'm following your progress on the PIO with interest!

The disassembler works very well now, so I can trace execution (without missing any lines) without any problems.
All is still done in the Pico, but I think I will move the disassembler to a PC application instead so I could add eg. symbols support and add some filtering in the Pico instead (eg support for start and stop addresses).
I noticed that if I load the Pico with that as well, I start to get buffer overruns and start to drop instructions.

I will also try to drive FI as well, that way I could emulate peripherals, ie indicating that there is data available, and then provide data that could be received by the HP41.
I started to look at this, and emulating the Wand (data available flag and data buffer) looks manageable, so that it should be possible to easy send a Focal program over USB, which is then stored directly into the 41 RAM.

This would make it very easy to transfer a program from a PC directly into the 41 without going through eg. a HPIL drive.

Let's see if I can find time for all of this ... 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
08-18-2023, 12:01 PM
Post: #36
RE: HP41C with Rp Pico attached
Just a brief update, I can now succesfully emulate ROMs with my RP2040 setup, using the PIO as the main handler of the HP41 interface. Tested with the HP41CX and 41CL.
Next step is to emulate QRAM, which means that I need to decode the WROM instruction and take bits from the DATA line. I can already monitor DATA so I expect no big issues here. When this is working I will prepare a (software) package for friends here who want to play with this setup as well. Needed are the RP2040 Pico board (and a second Pico for the debugger is recommended) plus a breadboard with level shifters.

Many thanks to Andrew for inspiring this project.

Regards, Meindert
Find all posts by this user
Quote this message in a reply
09-06-2023, 02:51 PM
Post: #37
RE: HP41C with Rp Pico attached
Hello all,

Just published a first working base version of my HP41 RP2040 interface. Purpose is to use this as an example for others to build further code (like display mirroring, detailed bus analyzer, full bankswitching MLDL, HEPAX). This version only acts as a simple HP41 Bus Tracer, that dumps all HP41 cycles to the console. Code at https://github.com/mjakuipers/RP2040-projects

Main features:
- offloads the ARM processors by using the pio for HP41 interfacing
- one ROM page (ML ROM) fixed in Page A
- one (empty) QRAM page fixed in page B with basic MLDL functionality
- decodes and executes the WROM (0x040) instruction in page B
- 3 pio state machines running (sync/isa input, data input and isa output)
- core1 executes the time critical bus interfacing, but very relaxed as the real work is done by the pio
- core0 executes the display (to the USB console)
- there is no user interface
- my hardware setup is the standard PICO board with the PicoProbe
- I use my MLDL2000 interface hardware (I had a spare) for the levelshifters
- my development setup is VS Code under Windows

Further implementation is not for the faint of heart, Please understand:
- only (commented) sources are provided. Please verify the pinout of your setup
- if you change pins, some signals MUST be adjacent (ISA+SYNC, D0_TIME+SYNC_TIME)
- get some basic understanding of the RP2040 pio, interrupts and the development tools for the RP2040
- Hardware connections are identical to Andrews setup, with 3 additional signals used for state machine sync and debug (with a logic analyzer)
- you MUST use the proper level shifters when connection the RP2040 to the HP41 to prevent frying the RP2040 with the HP41 6V signals
- the sources can be used to further develop your application
- in some cases, especially the very first launch, the program may be out of sync with the HP41
- HP41 cycle numbering in the sources start at the end of SYNC, and not at data bit D0
- I am not really a C programmer, some code will look clumsy
- tested with HP41CX and HP41CL
- the trace buffer may overflow, this can be detected by looking at the cycle counter. This will not impact the functionality. The buffer size can be adjusted if you have enough memory

Obviously, there is no warranty as this is still very much a project in progress.

Things to do for the pio implementation:
- testing of the ISA carry output (it is implemented)
- implementation of data output pio state machine
- implementation of FI output pio state machine
- improve the pio coding, I already know some improvements but my first focus is functionality
With the above I think that any existing HP41 peripheral can be emulated. My ultimate goal is to create full emulation of the HP-IL module.

All feedback is welcome of course.

This project is heavily inspired by the work of blackjetrock (Andrew, who started this thread), thanks Andrew!

Regards, Meindert
Find all posts by this user
Quote this message in a reply
09-07-2023, 06:20 AM
Post: #38
RE: HP41C with Rp Pico attached
(09-06-2023 02:51 PM)MeindertKuipers Wrote:  Hello all,

Just published a first working base version of my HP41 RP2040 interface.

Hi Meindert!

Thanks for sharing - looks like you have been very busy ... Wink
(I know I have promised to clean up my code and make it available too ...)

Your implementation of PIOs looks very interesting!

I also started with Andrews code as a base, and have managed to get MLDL emulation, full display mirroring (with 41 font emulation and annunciators) and trace with disassembly in "realtime" (to terminal on PC) up and running.

At the moment I have two ROMs (just now PPC and ZenRom are loaded) and 1 page of RAM for the MLDL (saved in flash to survive reboot and power loss), and I'm looking for a filesystem or tool to be able to replace the ROM/RAM flash image easily from the PC (over USB) without the need to re-flash the Pico.

I build mine using the Tiny2040 (smaller footprint but less gpio's - and 4 components in total (Pico, display, levelshifter and one single driver)), and my next plan is to also include the FI signal (I think I still have two pins available and have to add a second driver) and hope to be able to emulate the wand buffer.
Mainly just because it is fun and educational and secondly to very easily be able to transfer programs from a PC to the calculator.

Hope to find some rainy days to be able to continue the work ... 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
09-07-2023, 12:11 PM
Post: #39
RE: HP41C with Rp Pico attached
(09-07-2023 06:20 AM)ThomasF Wrote:  Thanks for sharing - looks like you have been very busy ... Wink
(I know I have promised to clean up my code and make it available too ...)

Hope to find some rainy days to be able to continue the work ... Wink

Cheers,
Thomas

I am not really hoping for rain, but progress would be nice ...

Whenever possible (without cleanup) having the sources of the disassembler part would be great to add that to my HP41 bus tracer.

And for implementing FI output, only one pin is needed, just the Output Enable to the driver. The driver input can be tied high so you control only the OE whenever you want FI to be high. There is no need driving FI low, it is normally low and this allows other devices driving FI to take their share of the bus.

Regards, Meindert
Find all posts by this user
Quote this message in a reply
09-07-2023, 01:48 PM
Post: #40
RE: HP41C with Rp Pico attached
(09-07-2023 12:11 PM)MeindertKuipers Wrote:  I am not really hoping for rain, but progress would be nice ...

Haha, agree to that ... Wink

Thanks for the tip with FI - yes that is true - I should only need one pin for it!

I'll send you the disassembler - should be no problem - it is fairly standalone.
Hope to get some time during the weekend for that!

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: