Post Reply 
How to create custom 41C modules from keystroke programs?
10-08-2020, 10:49 PM
Post: #21
RE: How to create custom 41C modules from keystroke programs?
(10-08-2020 02:33 PM)Dave Britten Wrote:  [snip]
A few things I need to figure out still:

How do I configure HEPAX RAM size? I see HEPAX M6-4R in A1, M6-5R in B1, and M6-[0-3] occupying 61-64.

Can I have multiple HEPAX RAMs and swap them in and out?

How do I export the HEPAX RAM to a ROM .mod file?

I imagine the DM41X HEPAX functionality will mature and become more convenient to use as time goes on.

The number of RAM pages a HEPAX module allocates is defined in the .mod file format. The existing HEPAX 4H file allocates 2 pages (so, 8k) emulating a "STD HEPAX" module, but this could be changed to allocate 4 pages (so now 16k) and thus emulate an "ADV HEPAX" module. I've no idea if one could have 3 pages... but no real device ever existed so it's untested - I'd stay away from that.

You can indeed have multiple sets of Upper RAM (HEPAX or otherwise) as RAM can be saved and then loaded later, effectively letting you 'swap' among different sets of saved programs.

For exporting HRAM (in a .RAM file) there is no direct way to do that, although it appears Meindert will look into that as a possible feature in the new version of MLDL2K he's working on.

OTOH, you can take the .RAM file (for default HEPAX that is 2 x 4K blocks of 10-bit data) and slice out each page and convert it to the 8-bit format used in .rom files, and then the .rom files can be converted with the current MLDL2K into a .mod file. So... Possible, but not simple.

Sylvain will be addressing these very details in his VHC presentation on Saturday, so be sure to tune in for that presentation.

But none of this is necessary if you just want to load a ton of FOCAL programs into HRAM - they are all 'online' and can be directly executed with no limitations, just like any other FOCAL. And you can 'Save RAM' (from the SETUP Modules menu) to be sure you have a safe backup, or even if you wanted to share the whole group of programs.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
10-08-2020, 10:52 PM
Post: #22
RE: How to create custom 41C modules from keystroke programs?
(10-08-2020 12:50 PM)MeindertKuipers Wrote:  If you have only the DM41X then extracting a RAM page (HEPAX or other) is not so trivial. You can save RAM pages, but this is not in ROM format, and all RAM pages are saved together in one file. So today the M2kM software is not able to read this and convert into a MOD file. Will add this to my list of things to do.
And the HEPAX way is by far the easiest way to create your ROM with FOCAL programs. Just a step is missing to convert to a ROM (or MOD) file on the DM41X. Actually I am not certain if V41 allows to save an individual RAM page, anyone? Probably easiest with virtual IL and one of the utils to save a ROM to tape.

It would be really handy, and save lots of work and skinned knuckles if M2kM were able to do that. Please feel free to reach out for assistance if you need info for that.

Thanks Meindert! And I understand this is not firm, only a 'maybe...'

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
10-09-2020, 05:42 AM (This post was last modified: 10-09-2020 05:53 AM by Ángel Martin.)
Post: #23
RE: How to create custom 41C modules from keystroke programs?
(10-08-2020 10:49 PM)rprosperi Wrote:  The number of RAM pages a HEPAX module allocates is defined in the .mod file format. The existing HEPAX 4H file allocates 2 pages (so, 8k) emulating a "STD HEPAX" module, but this could be changed to allocate 4 pages (so now 16k) and thus emulate an "ADV HEPAX" module. I've no idea if one could have 3 pages... but no real device ever existed so it's untested - I'd stay away from that.

On the CL you can have any number of HEPAX RAM pages as your available memory (and I/O bus locations) allows, proving that the HEPAX file system is configurable well beyond the standard (2-page) and advanced (4-page) configurations (back in the day VM also sold extensions to the HEPAX RAM in modules of 2 extra pages if I remember correctly). The maximum is 8 pages - from page 8 to page F - which still leaves room for the HEPAX ROM and the YFNX ROM of course. The minimum is TWO pages (not one!), due to the self-allocation method used to relocate the HEPAX ROM.

On V41 and the 41DMx Bob's method is the way to achieve it. Of course this means you have the capability to build your own MOD files (which again, is available in the MLDL2k manager). I haven't tried id but there shouldn't be any limitations to configure an odd-number of HEPAX RRAM pages - as long as it is larger than 2.

ÁM
Find all posts by this user
Quote this message in a reply
10-09-2020, 07:43 AM (This post was last modified: 10-09-2020 09:45 AM by Didier Lachieze.)
Post: #24
RE: How to create custom 41C modules from keystroke programs?
Another option using DOS tools from the HP-41 era available on the TOS DVD would be to use a User Code Compiler to create .BIN files from your user code programs (HHP 41UCC or Leo Duran's HP41UC) and then create a ROM with SDS II:

To create a ROM file:
Run 41P on UCC -> .BIN
Run READ41P (SDS II) on .BIN -> .41T
Use BUILD (SDS II) to create ROM file

EDIT: you can find an example of this method of creating a ROM from FOCAL programs here. With SDS II you can make your FOCAL programs private, define how XEQ are handled and specify key assignments.
Find all posts by this user
Quote this message in a reply
10-09-2020, 07:49 AM
Post: #25
RE: How to create custom 41C modules from keystroke programs?
(10-09-2020 07:43 AM)Didier Lachieze Wrote:  Another option using DOS tools from the HP-41 era available on the TOS DVD

The advantage of this solution is that it works on any platform that DOSBox works on.

There are only 10 types of people in this world. Those who understand binary and those who don't.
Find all posts by this user
Quote this message in a reply
10-09-2020, 09:09 AM
Post: #26
RE: How to create custom 41C modules from keystroke programs?
(10-08-2020 10:52 PM)rprosperi Wrote:  
(10-08-2020 12:50 PM)MeindertKuipers Wrote:  If you have only the DM41X then extracting a RAM page (HEPAX or other) is not so trivial. You can save RAM pages, but this is not in ROM format, and all RAM pages are saved together in one file. So today the M2kM software is not able to read this and convert into a MOD file. Will add this to my list of things to do.
And the HEPAX way is by far the easiest way to create your ROM with FOCAL programs. Just a step is missing to convert to a ROM (or MOD) file on the DM41X. Actually I am not certain if V41 allows to save an individual RAM page, anyone? Probably easiest with virtual IL and one of the utils to save a ROM to tape.

It would be really handy, and save lots of work and skinned knuckles if M2kM were able to do that. Please feel free to reach out for assistance if you need info for that.

Thanks Meindert! And I understand this is not firm, only a 'maybe...'

May try something while watching this weekend's conference in the background. Max number of RAM pages is 8, correct? If you can give a hint about how the 10 bits are packed than it may not be too difficult. Will probably read the file and split it in the right number of ROM files for further handling

Regards, Meindert
Find all posts by this user
Quote this message in a reply
10-09-2020, 01:12 PM
Post: #27
RE: How to create custom 41C modules from keystroke programs?
With V41 (Version R9) you may load HEPAX.MOD and use the HEPAX environment to add a bunch of FOCAL programs into the filesystem via HSAVEP. I recommend to keep an untouched copy of HEPAX.MOD since it is modified with these actions.
From there, use MLDL2K to load HEPAX.MOD and extract the RAM page of interest into a ROM file. For use in V41 or DM41X you must create a MOD file of the ROM(s). Use MLDL2K again to create a new MOD and fill in new pages with the extracted ROM files.

The main obstacle I encountered was that the module's name, i.e. first program of the HEPAX filesystem, does not appear on CAT 2. If you list the whole content of the modules in a HP41C/V fashion, then the names of the programs will eventually appear. Nevertheless, you can run a program if you know its name.
A solution for this was to lay hands on the (first) ROM with a hex editor and tinker with the FAT under consideration of the MCODE syntax to produce CAT-2 listable module names. The modified ROM can then be loaded into MLDL2K to create the MOD as described above.

Based on my limited background, this workaround is not too sophisticated, but it only needs V41, MLDL2K (respectively M2kM), and a hex editor in order to accomplish the requested task: 'How to create custom 41C modules from keystroke programs?'.
Find all posts by this user
Quote this message in a reply
10-09-2020, 05:21 PM (This post was last modified: 10-10-2020 10:46 PM by Sylvain Cote.)
Post: #28
RE: How to create custom 41C modules from keystroke programs?
This is my solution for creating a custom FOCAL ROM on a DM41X using RAMBOX32 ROM and MLDL RAM (QROM).

Here are the reference modules: (in MOD format)
Simplified logic for a 4K ROM is:
Code:
{begin}
   {copy RAM-04K.MOD to MYROM01.MOD (or any other name)}
   {map MYROM01 module and note the page number, you will need it after}
   {map RAMBOX32 module}
   {begin rom}
      INITPG    {start building a ROM image in MLDL RAM}
      {begin program loading loop}
         LDPGM  {copy FOCAL program from main memory to MLDL RAM}
      {end program loading loop}
      ENDPG     {save ROM version, calculate checksum and save new checksum in MLDL RAM}
      ENDPG     {finish MLDL RAM writing session}
   {end rom, your FOCAL ROM is now done}
   {unmap RAMBOX32 module}
[end}

Example configuration:
Code:
RAMBOX32.MOD is mapped to page 8 (named "W&W RAMBOX 32"   in Active Modules list)
MYROM01.MOD  is mapped to page 9 (named "4K RAM for MLDL" in Active Modules list)

Sample code 1: (3 lines 11 bytes)
Code:
LBL "SND"
BEEP
END

Sample code 2: (4 lines 18 bytes)
Code:
LBL "DSP"
"MY ROM"
AVIEW
END

Init ROM image:
Code:
"-FOCAL APP1"     // ROM name
14                // XROM ID
9                 // page number
INITPG            // initialize MLDL RAM
CAT 2             // you should see "-FOCAL APP1" appears in the catalog

Load first program in ROM image:
Code:
FRYBT?            // free space available = 4044
"SND"
9
LDPGM             // load "SND" program in MLDL RAM at page 9
FRYBT?            // free space available = 4028  //  4044 - 11 (program) - 5 (probably header, I have to validate this) = 4028 ok
CAT 2             // you should see "-FOCAL APP1" and "SND"
CLP "SND"         // delete  "SND" program from main memory
XEQ "SND"         // execute "SND" program from MLDL RAM, you should hear the BEEP

Load second program in ROM image:
Code:
FRYBT?            // free space available = 4028
"DSP"
9
LDPGM             // load "DSP" program in MLDL RAM at page 9
FRYBT?            // free space available = 4005  //  4028 - 18 (program) - 5 (probably header, I have to validate this) = 4005 ok
CAT 2             // you should see "-FOCAL APP1", "SND" and "DSP"
CLP "DSP"         // delete  "DSP" program from main memory
XEQ "DSP"         // execute "DSP" program from MLDL RAM, you should see "MY ROM"

Close ROM image:
Code:
"FA1A"            // ROM version
9                 // page number
ENDPG             // will fail on first try, but needed to save ROM version, calculate checksum and save new checksum in MLDL RAM
ENDPG             // should succeed on the second try, MLDL RAM is now a ROM image.

Next step is to save the new ROM to the calculator file system.
  1. press [shift] then SETUP
  2. select: 2. Module >
  3. select: 3. Save RAM Pages >
  4. select: <New File>
  5. enter: filename then press [R/S] to save the file
Remember, all RAM pages are saved in one big file.

Next, transfer the file to your computer.
I am still looking at how to convert the binary file to a mod file format.

Sylvain

Edit: adding saving RAM page information

PS: See my comment below.
Find all posts by this user
Quote this message in a reply
10-09-2020, 06:05 PM
Post: #29
RE: How to create custom 41C modules from keystroke programs?
As always, Sylvain comes to the rescue!

I think you should put this into the articles section.
Find all posts by this user
Quote this message in a reply
10-09-2020, 09:13 PM
Post: #30
RE: How to create custom 41C modules from keystroke programs?
Excellent walkthrough! I'll have to see if I can make some time this weekend to experiment.
Visit this user's website Find all posts by this user
Quote this message in a reply
10-09-2020, 09:25 PM (This post was last modified: 10-09-2020 11:57 PM by Sylvain Cote.)
Post: #31
RE: How to create custom 41C modules from keystroke programs?
I just had a talk with Robert and I realized that the DM41X does not update the original MOD file, but as long as the MOD file is loaded the content will not be lost.
It seems that there is a way to save the page to a binary file. (see updated post above)
Since it is a SM custom format, I will need to write a conversion program to create a MOD file out of it.
I will do some experiment then come back later with the steps and the program.
I have a presentation to give tomorrow, so it will take some days before I can finish this.
Sylvain
Find all posts by this user
Quote this message in a reply
10-10-2020, 09:07 PM
Post: #32
RE: How to create custom 41C modules from keystroke programs?
Thanks for the step by step explanation how to make a ROM within DM41X!

(10-09-2020 05:21 PM)Sylvain Cote Wrote:  I am still looking at how to convert the binary file to a mod file format.

I am looking forward at this. Hopefully, not a too difficult task!
Actually, I don't understand why SM decided to produce a proprietary RAM code.
Find all posts by this user
Quote this message in a reply
10-11-2020, 08:56 AM
Post: #33
RE: How to create custom 41C modules from keystroke programs?
The .ram files from DM41X are simply in the binary format that is also inside the .mod files, but in this case the ram/rom contents only. I have a beta of M2kM working that simply splits the .ram file into multiple .rom files, and gives a summary of the contents, see this description (taken from the comments in my source). Format is the same as the .bin format used in Emu41

// BIN - This format is used by Emu41 (J-F Garnier) and HP41EPC (HrastProgrammer).
// Note: HP41EPC uses BIN format but names them .ROM files.
// All bits are packed into 5120 bytes, but several consecutive pages may
// occupy the same file, so the file size could be a multiple of 5120.
// 4 machine words are packed into 5 bytes:
// Byte0 = Word0[7-0]
// Byte1 = Word1[5-0] << 2 | Word0[9-8]
// Byte2 = Word2[3-0] << 4 | Word1[9-6]
// Byte3 = Word3[1-0] << 6 | Word2[9-4]
// Byte4 = Word3[9-2]
// for (i=0;i<5120;i+=5)
// {
// *ptr++=((BIN[i+1]&0x03)<<8) | BIN[i];
// *ptr++=((BIN[i+2]&0x0F)<<6) | ((BIN[i+1]&0xFC)>>2);
// *ptr++=((BIN[i+3]&0x3F)<<4) | ((BIN[i+2]&0xF0)>>4);
// *ptr++=(BIN[i+4]<<2) | ((BIN[i+3]&0xC0)>>6);
// }

Will probably publish the beta later today or tomorrow. Sorry, Windows only and requires the FTDI drivers to be installed. No need to have an MLDL2000 connected though.

Regards, Meindert
Find all posts by this user
Quote this message in a reply
10-11-2020, 10:41 AM
Post: #34
RE: How to create custom 41C modules from keystroke programs?
It is now possible to open .ram files with M2kM. This will create a number of.rom files which can be handled in the MOD File tab to create a MOD file for use in V41, DM41X, MLDL2000 or a .rom file for the 41CL, Clonix/NoVRAM or MLDL2000.

I have a new BETA available for M2kM. Many, many changes under the hood, here are the most important:
- various bugs fixed
- many improvements in the disassembler
- support for DM41X .ram files, these are split into individual .rom files, the first
rom image is opened
- hex dump of ROM images now possible
- can recognize 41CL ROM images using upper bits
- disassembler supports 41CL WCMD instruction, does NOT decode useage of upper bits (yet)
- possibility to list 41CL FLDB .rom files (IMDB file support coming)
- FAT listing supports 41CL CRC
- listing from MLDL2000 supports checksum and CRC (slow), use checkbox upper right

Files can be downloaded here:
My DropBox

This is a BETA! No warranty, so protect your data. Please let me know of any possible improvements, additions or bugs.

Regards, Meindert
Find all posts by this user
Quote this message in a reply
10-11-2020, 12:39 PM
Post: #35
RE: How to create custom 41C modules from keystroke programs?
(10-11-2020 10:41 AM)MeindertKuipers Wrote:  It is now possible to open .ram files with M2kM. This will create a number of.rom files which can be handled in the MOD File tab to create a MOD file for use in V41, DM41X, MLDL2000 or a .rom file for the 41CL, Clonix/NoVRAM or MLDL2000.

[snip]

This is a BETA! No warranty, so protect your data. Please let me know of any possible improvements, additions or bugs.

Wow, that was fast!!

Looking forward to checking this out Meindert, thanks so much for supporting the 41X and for sharing this new version of M2kM.

Will this work on Win-7, I still have this on one of my hobby PCs used for a lot of calculator 'work' for compatibility reasons?

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
10-12-2020, 12:30 PM
Post: #36
RE: How to create custom 41C modules from keystroke programs?
I'm getting on with Hepax pretty well so far, but noticed that when I call a program in Hepax RAM inside a program, it shows up as a generic XROM 11,XX instruction. It runs fine, but makes program editing and debugging a bit cryptic. Is there a workaround for this?

Also, do I need to worry about the XROM numbers changing if I rearrange what's in the Hepax?
Visit this user's website Find all posts by this user
Quote this message in a reply
10-12-2020, 12:44 PM
Post: #37
RE: How to create custom 41C modules from keystroke programs?
(10-12-2020 12:30 PM)Dave Britten Wrote:  I'm getting on with Hepax pretty well so far, but noticed that when I call a program in Hepax RAM inside a program, it shows up as a generic XROM 11,XX instruction. It runs fine, but makes program editing and debugging a bit cryptic. Is there a workaround for this?

Also, do I need to worry about the XROM numbers changing if I rearrange what's in the Hepax?

It shows as XROM programname, it turns to numeric if you unplug the Hepax module.
That's the standard way programs inside ROM modules are shown when the module is not plugged in. Once you put it back in (not another one with the same moduleID...) they revert to XROM programname.

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
10-12-2020, 01:28 PM
Post: #38
RE: How to create custom 41C modules from keystroke programs?
(10-12-2020 12:44 PM)Massimo Gnerucci Wrote:  
(10-12-2020 12:30 PM)Dave Britten Wrote:  I'm getting on with Hepax pretty well so far, but noticed that when I call a program in Hepax RAM inside a program, it shows up as a generic XROM 11,XX instruction. It runs fine, but makes program editing and debugging a bit cryptic. Is there a workaround for this?

Also, do I need to worry about the XROM numbers changing if I rearrange what's in the Hepax?

It shows as XROM programname, it turns to numeric if you unplug the Hepax module.
That's the standard way programs inside ROM modules are shown when the module is not plugged in. Once you put it back in (not another one with the same moduleID...) they revert to XROM programname.

Ohhh, hang on, you are correct, and it's actually a bug in the DM41X multi-line editor. Smile

If I switch to standard display mode (i.e. single line program editing), I see XEQ"ADOW. If I switch to the multi-line editor, it's XROM 11,23. I'll mention this over on the SM forums.
Visit this user's website Find all posts by this user
Quote this message in a reply
10-12-2020, 02:00 PM
Post: #39
RE: How to create custom 41C modules from keystroke programs?
(10-12-2020 01:28 PM)Dave Britten Wrote:  
(10-12-2020 12:44 PM)Massimo Gnerucci Wrote:  It shows as XROM programname, it turns to numeric if you unplug the Hepax module.
That's the standard way programs inside ROM modules are shown when the module is not plugged in. Once you put it back in (not another one with the same moduleID...) they revert to XROM programname.

Ohhh, hang on, you are correct, and it's actually a bug in the DM41X multi-line editor. Smile

If I switch to standard display mode (i.e. single line program editing), I see XEQ"ADOW. If I switch to the multi-line editor, it's XROM 11,23. I'll mention this over on the SM forums.

Oh! You're right.
Good catch.

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
Post Reply 




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