Post Reply 
HP-41 Infinity - a Tulip4041 teaser ...
09-26-2024, 07:51 AM (This post was last modified: 09-26-2024 08:45 AM by ThomasF.)
Post: #1
HP-41 Infinity - a Tulip4041 teaser ...
Hi all,

As you know, I have been playing a bit with the Pico and the HP41, and I know some of you are looking forward to the Tulip4041 board that Meindert is developing.

(For the moment I'm using my own Tiny41 board with a Pico2 which is compatible with the coming TULIP4041 board.)

As a small teaser, I'd like to share a small program I made that shows some of the potential with the Pico board that opens up for a totally new programming experience for the HP41!

First of all, I made use of the flash available in the Pico, in the standard Pico2 there is 4MB of flash (with 16MB versions available).
I used about 1.6MB to flash some 41 modules I had available - all in all 136 for the moment (16MB flash would allow for more than 1000 different modules!).
I can flash either ROM-files or MOD-files - MOD files includes names, description and more.
I also added a very simple file system with a FAT, so that each module is easy accessible.

From the command line interface (on the PC) of my Tiny41 board I can now:
  • List the current modules plugged in
Code:
Loaded modules
/------+------+------+-----+------------------+
| Page | Port | XROM | RAM | Name             | Banks
+------+------+------+-----+------------------+
|  #4  | Srv  |      |     |                  |
|  #5  | Tmr  |      |     |                  |
|  #6  | Prt  |  1D  |     | IRPrinter1-1B    | IRPrinter2-3B
|  #7  | HPIL |      |     |                  |
|  #8  | 1 Lo |  0A  |     | PPCL             |
|  #9  | 1 Hi |  14  |     | PPCU             |
|  #A  | 2 Lo |  00  | Yes | RAM8K-1          |
|  #B  | 2 Hi |  00  | Yes | RAM8K-2          |
|  #C  | 3 Lo |  05  |     | Zenrom-3B        |
|  #D  | 3 Hi |  1F  |     | TF-ROM           |
|  #E  | 4 Lo |      |     |                  |
|  #F  | 4 Hi |      |     |                  |
+------+------+------+-----+------------------/
  • List all installed modules (with names and type)
Code:
Installed modules
|   1 | TF-ROM           | ROM | 00094000 | 
|   2 | MMEPROM          | MOD | 00096000 | MM EPROM
|   3 | PROTOCODER2      | MOD | 00098000 | ProtoCODER2
|   4 | CCD-OSX          | MOD | 0009A000 | CCD OS/X Module
|   5 | ES-MLDL-X11      | MOD | 0009C000 | ERAMCO MLDL Operating System XROM 11
...
| 134 | ASSEMBLER4       | MOD | 00205000 | Assembler 4
| 135 | RAM16K           |+RAM | 00207000 | 16K RAM for MLDL
| 136 | HEP-2MEM         |+RAM | 0020D000 | HEPAX Memory Module 16K
  • Plug/unplug any module given its page
  • And also select any installed module and plug it in any port on the fly
All this without the obvious need to reflash the device - so any module is only some keystrokes away!

To take this one step further, I made a small MCode routine that takes a module name in alpha and a page number in X-register and directly plugs the module in the specified page/port!

Say that you always have the PPC ROM in port 1 and some other modules at hands, but need a program that uses a special module for something, then this little program is just an example of what you could do:

Code:
01 LBL "TEST"
02 "MATH"
03 8
04 PLUGM        # Plug in the MATH ROM in port 1 (page 8)
05 "STAT"
06 9
07 PLUGM        # Plug in the STAT ROM in port 1 (page 9)
08 "PLOTTER"
09 10
10 PLUGM        # Plug in the PLOTTER ROM in port 2 (10+11)
11 12.23
12 PI
13 XROM "LOGZ"
... do some math and stat and plot the result
... using the PLOTTER module
62 "SURVEY"
63 8
64 PLUGM        # Plug in the surveying module port 1
... do some surveying and plot the result
79 "PPC"
80 8
81 PLUGM        # Restore the PPC ROM port 1 (page 8+9)
82 XROM "T1"    # Call PPC ROM beep - done for now!
83 END

So now I have "unlimited" access to any module within the same HP41 program!

Note that care still has to be taken about XROM mismatching - that troubles might arise if two modules with same XROM ID is plugged in at the same time!

Below is the complete MCode program (part of my own TF-ROM module) that sends the module name and wanted page number to the Tiny41.
The routine will fail if module not found or the page is not allowed.
Any other module in the same page will be unplugged.
Also note that if the MOD file header specifies a hardcoded page (like for the printer ROM), then that page will be used - and any extra pages or banks will also be loaded.

Not included here is the code needed on the Tiny41, but when Tulip4041 is released this will be available for anyone to use.

Hope this shows some of the potential of the Pico boards together with the HP41! Smile

EDIT: Corrected a typo (port 2 is page 10+11)

Cheers,
Thomas

Code:
                .NAME    "PLUGM"
[PLUGM]         ?NCXQREL [CX_10]        Get and check port number (4-F)
                C=A     S&X             Value returned in A
                SELPF   8               Select Tiny41
                #000                    Reset command
                #009                    Write page number to the Tiny41

; Send content of alpha register to Tiny41                
                C=0     ALL
                R=      0
                LD@R    8               C(X) = Reg 8
                LD@R    2               C(S) = Reg byte counter (R8 = 3 bytes)
                A=C     ALL             A = 2 0000000000 008
                R=      0
                LD@R    5               C(X) = Reg 5
                LD@R    6               C(S) = Reg byte counter (R5 = 7 bytes)
                C<>B    ALL             B = 6 0000000000 005
                READ    8   ;(P)            Get reg 8
                RCR     6               1st alpha reg byte to C(0-1)
                R=      1
[SNDA1]         RCR     12              Next byte to C(0-1)
                ?R=     1               Still looking for 1st character
                JNC     [SNDA2]         No ...
                ?C#0    R<              Yes, C(0:1) = 1st character?
                JNC     [SNDA3]         No
                R=      0               Yes, set ptr == 0
                ; Now C(0:1) is character to send
[SNDA2]         SELPF   8               Select Tiny41
                #005                    Write character to Tiny41
                A=A+1   M               Count the character
[SNDA3]         A=A-1   MS              Done with reg yet?
                JNC     [SNDA1]         No, get next character
                A=B     MS              Yes, A(S) register byte counter
                A=A-1   S&X             Get next reg address
                C=A     S&X             Copy address to C
                RAMSLCT
                READDATA                Read next alpha register
                ?A<B    S&X             More regs to check?
                JNC     [SNDA1]         Yes
; Now both page number and module name is sent to the Tiny41
; Execute the command to find the module and plug it in!
                SELPF   8               Select Tiny41
                #00D                    Execute command!
; Since this will take a short time to locate and copy the file,
; we need to wait until the busy flag is low again ...
                LDIS&X  010             Time out delay
[WAIT]          ?FI=    0               Busy?
                JNC     [DONE]          No, check result
                C=C-1   S&X
                JNC     [WAIT]          Try again ...
                SELPF   8               Timeout - Tiny not ready?
                #001                    Reset command
                JNC     [ERR]           Report error!

[DONE]          SELPF   8               Select Tiny41
                #03A                    Read return value
                #001
                C=C-1   S&X             Check if value is 0 (OK)
                ?CRTN                   Ok, just return!
                ?NCGO   [ERRNE]         No, so ROM is not found!

; Get the page number from X-register and validate it (4<=X<=15)
[CX_10]         ?NCXQREL [ACKX]         Get page number in binary
                A=C     S&X
                LDIS&X  004
                ?A<C    S&X
                JC      [ERR]           If less than 4 return error
                LDIS&X  011
                ?A<C    S&X
                ?CRTN                   If less then 16 return ok
[ERR]           ?NCGO   [ERRDE]         Report DATA ERROR

; Get a integer from X-reg and convert to binary in C
[ACKX]          READ    3(X)            Get the page number from X-reg
                C=C-1   MS
                C=C-1   MS
                ?CGO   [ERRAD]          Error if alpha numeric
                A=C     S&X             Copy exponent to A.X
                C=0     MS              Take absolute value
                C=0     S&X             Initialize to 0
                ?C#0    M               Handles zero unnormal #s
                ?NCRTN
                ?A#0    XS              Negative exponent?
                ?CRTN                   Yes, return 0
                RCR     12              Move first digit to C.0
                A=A-1   S&X             Was exponent 0?
                JC      [GOTIT]         Yes
                RCR     13              Rotate next digit in
                A=A-1   S&X             Was exponent 1?
                JC      [GOTIT]         Yes
                RCR     13              Rotate 3rd digit in
                A=A-1   S&X             Was exponent 1?
                ?NCGO   [ERRDE]         No, number to large
[GOTIT]         ?NCGO   [GOTINT]        Convert BCD to binary and return

[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-26-2024, 09:00 AM
Post: #2
RE: HP-41 Infinity - a Tulip4041 teaser ...
Wow!  Great things just keep coming for the 41.

http://WilsonMinesCo.com  (Lots of HP-41 links at the bottom of the links page, at http://wilsonminesco.com/links.html#hp41 )
Visit this user's website Find all posts by this user
Quote this message in a reply
09-26-2024, 12:12 PM
Post: #3
RE: HP-41 Infinity - a Tulip4041 teaser ...
Indeed WOW, this is truly amazing, the ability to load (and presumably unload) modules at will during runtime, from a FOCAL program. It boggles the mind of any 41 programmer.

Your comments imply this can be used on TULIP41 once that is available, but how would such a program be installed/loaded and the flash loaded with the images? Would this require a re-flashing of the TULIP41?

Sylvain just presented TULIP41 at HHC 2024 and the 41 fans were chattering about the new possibilities. Never mind 40, even 2-3 years ago, who could imagine such things would be possible on a 41??

Thanks for this eye-opening post Thomas, keep it coming....

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
09-26-2024, 01:11 PM
Post: #4
RE: HP-41 Infinity - a Tulip4041 teaser ...
(09-26-2024 12:12 PM)rprosperi Wrote:  Your comments imply this can be used on TULIP41 once that is available, but how would such a program be installed/loaded and the flash loaded with the images? Would this require a re-flashing of the TULIP41?

Hi Bob!

I'm constantly in contact with Meindert and we follow each others development of the Pico code.
As of now we have no fixed plan how the file system will look like, but plans are to merge my module handling with his Tulip code.

For now I have created a simple tool that flashes every module I have listed in a configuration file.
It simply creates the FAT and flashes it together with the module images without touching the main firmware of the board.
So if I want to add some modules, I just add them to the configuration file, run the tool and flash the board again (again, no need to update the main Pico application).
And since I use the name of the module for lookup, the order of the modules have no impact (I can remove or add modules as much as I want to).

The configuration just lists all modules and looks like this:
Code:
# List of all modules to install in the flash
# ROM files are followed by the name of the module
../ROM/tf-rom.rom  TF-ROM
../MOD/MMEPROM.MOD
../MOD/PROTOCODER2.MOD
../MOD/CCD-OSX.MOD
...

Now, this could be done by any user of the board (only the flash-tool, a PC and USB cable needed), but once flashed, all modules are available (without the need to recompile, change or flash the Tulip code).

Also remember that this is still under development, so I hope this will be integrated in the final version - the first version of the Tulip board is a development board, and should be used as such.
It is not a final product but comes with the basic firmware to start developing.
Later on we might have a real file system on the board, so adding a new module might be done by just dropping the file on the Tulip board Wink

Again, this works fine - as described in the post - on my board, and my main purpose was - as you just said - to be an eye-opener of what could be done with this board.
And I hope that we see many other ideas pop into life when more people starts to play with the possibilities it can offer!

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-26-2024, 04:00 PM
Post: #5
RE: HP-41 Infinity - a Tulip4041 teaser ...
What Thomas now did with the module handling is absolutely amazing, and Thomas and I are looking to integrate our code. We both have a slightly different approach and Thomas has the leading edge of implementing features while I am focusing on getting hardware out to other users with a solid software base that can then be expanded.
Features like Thomas has described will certainly come to the TULIP4041, not only to the final module version, but also to the development version that is now being shipped.

Regards, Meindert
Find all posts by this user
Quote this message in a reply
09-26-2024, 05:27 PM (This post was last modified: 09-26-2024 05:30 PM by Sylvain Cote.)
Post: #6
RE: HP-41 Infinity - a Tulip4041 teaser ...
(09-26-2024 12:12 PM)rprosperi Wrote:  Indeed WOW, this is truly amazing, the ability to load (and presumably unload) modules at will during runtime, from a FOCAL program. It boggles the mind of any 41 programmer.
Not to diminished the great work being done here, but for the record, 41CL Extreme ROM (YFNX) had this functionality for years (PPLUG).

Mapping ZENROM to Page 10
Code:
LBL "MZPA"
"ZENR A"
PPLUG
END

Unmapping a ROM from Page 10
Code:
LBL "UPA"
"EMPT A"
PPLUG
END

Sylvain Côté
Find all posts by this user
Quote this message in a reply
09-26-2024, 05:51 PM
Post: #7
RE: HP-41 Infinity - a Tulip4041 teaser ...
(09-26-2024 05:27 PM)Sylvain Cote Wrote:  
(09-26-2024 12:12 PM)rprosperi Wrote:  Indeed WOW, this is truly amazing, the ability to load (and presumably unload) modules at will during runtime, from a FOCAL program. It boggles the mind of any 41 programmer.
Not to diminished the great work being done here, but for the record, 41CL Extreme ROM (YFNX) had this functionality for years (PPLUG).

Indeed, but regardless how much we love the CL, this will bring that capability to any unconverted C/CV/CX

Juan
Find all posts by this user
Quote this message in a reply
09-27-2024, 09:13 AM
Post: #8
RE: HP-41 Infinity - a Tulip4041 teaser ...
Nice.
What could be a "customer journey"?
a) I buy an HP41C on eBay (nothing except this part); the cheapest hardware available
b) I connect a tulip to my HP41 (a fully system I could buy anywhere)
c) I make the setup on the HP41 (4x memory modules, X-Function modules, ROM whatever in a port). > the setup is kept accross any taking out of the HP41 and any reconnect into CV or CX would gives errors because X-function was there in the CX etc.
d) in case of a tulip malfunction on another HP41 (a CV, a CX), a re-setup can be made on a PC or in the new CV/CX machine
This "journey" is a possibility of an user type (persona "lazy dude").
Or everything is still in the study phase and the target use behaviour has still to be defined?

HP71B 4TH/ASM/Multimod, HP41CV/X/Y & Nov64d, PILBOX, HP-IL 821.62A & 64A & 66A, Deb11 64b-PC & PI2 3 4 w/ ILPER, VIDEO80, V41 & EMU71, DM41X
Find all posts by this user
Quote this message in a reply
09-27-2024, 10:35 AM
Post: #9
RE: HP-41 Infinity - a Tulip4041 teaser ...
(09-27-2024 09:13 AM)floppy Wrote:  Nice.
What could be a "customer journey"?
a) I buy an HP41C on eBay (nothing except this part); the cheapest hardware available
b) I connect a tulip to my HP41 (a fully system I could buy anywhere)
c) I make the setup on the HP41 (4x memory modules, X-Function modules, ROM whatever in a port). > the setup is kept accross any taking out of the HP41 and any reconnect into CV or CX would gives errors because X-function was there in the CX etc.
d) in case of a tulip malfunction on another HP41 (a CV, a CX), a re-setup can be made on a PC or in the new CV/CX machine
This "journey" is a possibility of an user type (persona "lazy dude").
Or everything is still in the study phase and the target use behaviour has still to be defined?

Yes, the Tulip board and software is still in early developing phase and how the final "system" will look like or behave is not yet defined.
  • The main purpose of the board is to emulate hardware not previously possible, e.g. it will include the IR module and HP-IL (over USB). The Wand has also to some extend been emulated in the software.
  • Support for modules is also proven to work, both ROM's and RAM (both normal and X-Memory), and backup of e.g. X-Memory in flash works.
  • But there are still questions unsolved, e.g. moving from one calculator to another.
    How should RAM be copied? E.g. the main RAM resides in the calculator and is not directly accessible from the Tulip board - it needs a "module" with code that can take a backup of RAM and save it, and in a new calculator a restore function must be called.
  • Some setup can be done automatically - e.g. finding the amount of memory, type of calculator, modules plugged in etc. but nothing that has been implemented so far.
  • I have several boards and moving the setup from one to another works (using a PC), and I'm using both a C, CV and CX with them (but I don't move RAM between the devices, yet).
When more people starts to test and develop on the Tulip development board, I think most of these questions would be discussed and solved to create something very useful for anyone with a HP41 system - and I think that simplicity and robustness must be a key goal - you should not need to be a developer to use the Tulip when we get 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
09-28-2024, 09:07 AM
Post: #10
RE: HP-41 Infinity - a Tulip4041 teaser ...
About the question for copying RAM in the HP41, there is a potential solution already on my list of things to have, and that is to implement Expanded Memory as currently supported in the HP41CL and in the upcoming MAXX module.
This allows to easily create a full copy of the HP41's main memory (including Extended Memory) and swap it with another machine. The mechanism to access this memory is well described in the HP41CL documentation and requires the use of a new instruction (a NOP to the NUT processor), and this is simple to implement in the TULIP firmware. Requires a special ROM of course, but the collection of ROM images for the 41CL contains some examples.

Problem is that there are many ideas and almost everything is possible with the TULIP platform, and as Thomas said, anything that goes out to users should be robust and easy to use.

I must add that as far a I am concerned we are already beyond the study phase. Both Thomas, Andrew and I have proven that we can control every aspect that any HP41 plug-in module can provide, including sending IR frames to a printer. Even implementing a real HP-IL loop is not entirely out of question anymore, based on the experiences of the HP-IL module emulation. In some cases additional hardware may be required.

Sources are available and anyone can build their own TULIP variation. Obviously we would want anyone to share what they are doing so this can be built in the main TULIP firmware. Keep in mind that a firmware upgrade is extremely easy and quick to do and adding functionality with new versions is done in a few minutes.

Regards, Meindert
Find all posts by this user
Quote this message in a reply
Post Reply 




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