41C X-Mem data file editor?
10-21-2020, 02:13 PM
Post: #1
 Dave Britten Senior Member Posts: 1,638 Joined: Dec 2013
41C X-Mem data file editor?
Are there any modules or programs for the 41 that provide a nice interactive data file editor akin to the 41CX text editor? I'm looking for something along the lines of the list editor on the 17BII, 27S, etc. In other words, something that lets you scroll through and view the values in the file, amend, append, insert, or delete registers, and so on.
10-21-2020, 02:38 PM (This post was last modified: 10-21-2020 02:38 PM by Sylvain Cote.)
Post: #2
 Sylvain Cote Senior Member Posts: 1,440 Joined: Dec 2013
RE: 41C X-Mem data file editor?
41CX has ED (Editor) for Extended Memory Text Files.
ZenROM has RAMED (RAM Registers Editor) low level RAM byte editor which does not know anything on how the data is used.
AMC/OSX has RAMED, a more powerful alternative to ZenROM RAMED
10-21-2020, 05:40 PM
Post: #3
 Dave Britten Senior Member Posts: 1,638 Joined: Dec 2013
RE: 41C X-Mem data file editor?
(10-21-2020 02:38 PM)Sylvain Cote Wrote:  41CX has ED (Editor) for Extended Memory Text Files.
ZenROM has RAMED (RAM Registers Editor) low level RAM byte editor which does not know anything on how the data is used.
AMC/OSX has RAMED, a more powerful alternative to ZenROM RAMED

Okay, so nothing really geared toward viewing and editing numeric data files created with CRFLD? I think I could put together something reasonably complete with clever use of PASN, but I don't want to reinvent the wheel if it's already been done.
10-21-2020, 06:14 PM
Post: #4
 hth Senior Member Posts: 394 Joined: Mar 2014
RE: 41C X-Mem data file editor?
I do not think such editor exists on the HP-41 at the moment.

It would be interesting to know more about the use-case. I am not familiar with the existing editors you mention.

One thing that springs in my mind is editing numbers, the HP-41 does not allow for this at the moment. Also the display is a bit limited. I try to wrap my idea around how it may look.
10-21-2020, 07:03 PM
Post: #5
 Dave Britten Senior Member Posts: 1,638 Joined: Dec 2013
RE: 41C X-Mem data file editor?
(10-21-2020 06:14 PM)hth Wrote:  I do not think such editor exists on the HP-41 at the moment.

It would be interesting to know more about the use-case. I am not familiar with the existing editors you mention.

One thing that springs in my mind is editing numbers, the HP-41 does not allow for this at the moment. Also the display is a bit limited. I try to wrap my idea around how it may look.

My use case would be managing a few X-Mem data files where I collect some measurements throughout the day, and may need to quickly review the stored numbers or make corrections later, without a whole lot of manual GETX, SEEKPT, and SAVEX.

I'm thinking the editor could work something like this (very similar to the 17BII):

Put the filename in alpha, then XEQ "EDD" (for EDit Data) to start the editor.

The display would then show 0:XXX, with XXX being the first value in the file, e.g. what you would see if you did 0 SEEKPT, GETX. (Or perhaps I would have the editor start from the current pointer position for the file.)

SST and BST (temporarily assigned to global labels via PASN) could be used to go forward or backward through the file, displaying the item index and value in I:XXX format as you go.

To replace the value of the item currently displayed, type a new value and press ENTER (also assigned to a global label), which would overwrite the value at the current position, and redisplay the item index and value.

Moving "past" the end of the file would show ?:, and entering a value and pressing ENTER would increase the size of the file by 1 register, and append this new value.

CLx (Shift Backspace) would delete the current item by moving all following elements up one position, thus overwriting the current register, and reducing the size of the file by 1.

Some other shifted key (maybe ISG?) would perform an insert operation, increasing the size of the file by 1, moving the current and following items down by 1, and putting a 0 in the inserted space.

RTN would probably jump to the first item, and maybe another key would be assigned to jump to the end of the file for appending new items.

R/S would close the editor, and remove all the temporary user key assignments created by the program.

I don't think this would be terribly difficult to implement. Maybe I'll take a stab at it if nobody knows of an existing data file editor.
10-21-2020, 07:56 PM (This post was last modified: 10-21-2020 08:06 PM by Garth Wilson.)
Post: #6
 Garth Wilson Senior Member Posts: 405 Joined: Dec 2013
RE: 41C X-Mem data file editor?
This is mine, written in the late 1980's. I don't remember why I called it "VV", but it has always been easy for me to remember. Call yours EDD if you like.

Code:
♦LBL "VV"  "FL _"  AON  PROMPT  AOFF  CLX  SEEKPTA ♦LBL 01  "REG #_"      \ For the # chr with ZENROM in ALPHA mode, do USER shift SIN .  PROMPT        \ To get the _ chr with ZENROM in ALPHA mode, do USER - .  SEEKPT  "STO OR RCL?"  AVIEW ♦LBL 00  GETKEY        \ GETKEY gives 10 seconds.  If no key is pressed, it returns 0,  GTO IND X     \ so this part of the program just repeats to ask again. ♦LBL 33        \ 33 is the key code of the STO key.  "NR _"  PROMPT  SAVEX  "DONE"  PROMPT  GTO 01 ♦LBL 34        \ 34 is the key code of the RCL key.  GETX  VIEW X  RTN  GTO 01  END

10-21-2020, 09:42 PM
Post: #7
 Dave Britten Senior Member Posts: 1,638 Joined: Dec 2013
RE: 41C X-Mem data file editor?
(10-21-2020 07:56 PM)Garth Wilson Wrote:  This is mine, written in the late 1980's. I don't remember why I called it "VV", but it has always been easy for me to remember. Call yours EDD if you like.

Code:
♦LBL "VV"  "FL _"  AON  PROMPT  AOFF  CLX  SEEKPTA ♦LBL 01  "REG #_"      \ For the # chr with ZENROM in ALPHA mode, do USER shift SIN .  PROMPT        \ To get the _ chr with ZENROM in ALPHA mode, do USER - .  SEEKPT  "STO OR RCL?"  AVIEW ♦LBL 00  GETKEY        \ GETKEY gives 10 seconds.  If no key is pressed, it returns 0,  GTO IND X     \ so this part of the program just repeats to ask again. ♦LBL 33        \ 33 is the key code of the STO key.  "NR _"  PROMPT  SAVEX  "DONE"  PROMPT  GTO 01 ♦LBL 34        \ 34 is the key code of the RCL key.  GETX  VIEW X  RTN  GTO 01  END

Thanks, I like the GETKEY idea. Maybe I'll do that instead of all the global labels and PASN stunts. Though it does rule out the intuitive use of Shift-BST to go back a record. Maybe I'll do SST to advance, RCL to go back, and STO to enter a value.
10-22-2020, 01:39 AM
Post: #8
 rprosperi Senior Member Posts: 4,455 Joined: Dec 2013
RE: 41C X-Mem data file editor?
It's interesting that after all these years, this is a rather obvious application that either was never created, or if it was, never got wide enough distribution that any of the still active members here know about it. More than likely, there is something like this buried in the PPC/CHHU Journal issues, but writing this from scratch may be less work than searching through all that.

For navigating (next record, insert/del record, etc.), I suggest you copy the key assignments (or mappings) from ED, as much of that can be the same; no need to invent something new when those keys are documented right on the device. The key difference is data files can have multiple 'fields' per record, rather than single lines of text, so some clever paradigm for moving 'horizontally' is needed. If each field will be replaced (rather than edited) you could use the [USER] and [PRGM] keys the same way these advance through a text file.

--Bob Prosperi
10-22-2020, 12:49 PM
Post: #9
 Dave Britten Senior Member Posts: 1,638 Joined: Dec 2013
RE: 41C X-Mem data file editor?
(10-22-2020 01:39 AM)rprosperi Wrote:  It's interesting that after all these years, this is a rather obvious application that either was never created, or if it was, never got wide enough distribution that any of the still active members here know about it. More than likely, there is something like this buried in the PPC/CHHU Journal issues, but writing this from scratch may be less work than searching through all that.

For navigating (next record, insert/del record, etc.), I suggest you copy the key assignments (or mappings) from ED, as much of that can be the same; no need to invent something new when those keys are documented right on the device. The key difference is data files can have multiple 'fields' per record, rather than single lines of text, so some clever paradigm for moving 'horizontally' is needed. If each field will be replaced (rather than edited) you could use the [USER] and [PRGM] keys the same way these advance through a text file.

That's a good idea regarding the key assignments. I might double up a couple of them by stacking two LBL instructions so that it both mimics the text editor, and also provides more intuitive (in my opinion) bindings for some functions.

I think for the data entry function, I'll have the program temporarily PASN a global label to the R/S key and then halt, so that you can XEQ other programs for calculating the new item, and still press R/S to get back to the data file editor. The only caution would be that the other program can't modify the two storage registers that the editor is using, or open a different file.

I'm not sure what you mean by multiple fields per record, though. Aren't data files just a linear set of storage registers akin to a 1-column matrix on the 42S? Or is this some more exotic functionality I have yet to discover?
10-22-2020, 02:41 PM (This post was last modified: 10-22-2020 02:47 PM by Sylvain Cote.)
Post: #10
 Sylvain Cote Senior Member Posts: 1,440 Joined: Dec 2013
RE: 41C X-Mem data file editor?
Here is an alternative way by reusing ED way of doing things.

Example of key mapping
Code:
Key mapping           interaction   description  01 exit              interactive   leave program -01 exit              interactive   leave program  15 +50 records       interactive   go forward  50 records, make it current and show it -15 -50 records       interactive   go backward 50 records, make it current and show it  25 +10 records       interactive   go forward  10 records, make it current and show it show it -25 -10 records       interactive   go backward 10 records, make it current and
Code:
-34 goto record       user entry    stop, enter record number, then R/S, make it current and show it  35 next record       interactive   go forward   1 record, make it current and show it -35 previous record   interactive   go backward  1 record, make it current and show it  41 mantissa          interactive    -41 data entry        user entry    stop, enter new data for current record, then R/S, ask user to confirm update and show it  84 add record after  interactive   add record after current, make it current and show it -84 add record before interactive   add record before current, make it current and show it

Focal code that go with it: (the code use key code as numeric label)
Code:
LBL "XMDE"        // Extended Memory Data Editor "XM DATA EDIT"    // program title AVIEW             // show title PSE               // give user time to see it CLA               // clear alpha AVIEW             // clear screen                   // --------------------------------
Code:
LBL 90            // unshifted key press handling CF 01             // clear shift indicator flag SF 04             // set key scanning active flag CF 05             // clear double shift key trap GETKEY            // wait for key press (10 seconds) CF 04             // clear key scanning active flag SF 25             // forget GTO IND X error
Code:
X<>0?             // has a key been pressed ? GTO IND X         // yes, go to handling label GTO 90            // no key pressed or no key hanling so loop for more unshifted key                   // -------------------------------- LBL 31            // shifted key press handling FS?C 05           // is shift key has been pressed ? GTO 90            // yes, go loop for unshifted key
Code:
SF 01             // set shift indicator flag SF 04             // set key scanning active flag GETKEY            // wait for key press (10 seconds) CF 04             // clear key scanning active flag X=0?              // has a key been pressed ? GTO 31            // no key pressed so loop for more shifted key CHS               // indicate to the receiving label that a shift key has been pressed
Code:
SF 05             // flag to indicate we are processing a shifted key SF 25             // forget GTO IND X error  GTO IND X         // go to handling label CF 05             // shifted key processing finished GTO 90            // no key hanling so loop for more unshifted key                   // -------------------------------- LBL 01            // ON KEY (01) handling GTO 99            // run exit code
Code:
                  // --------------------------------                   // begin - logic template LBL XX            // key handling code, replace XX with keycode value X<0?              // is kep pressed was shifted ? GTO 00            // yes, go to shifted key handler                   // unshifted logic here GTO 90            // go to key press handler
Code:
LBL 00            // shifted key handler                   // shifted logic here GTO 90            // go to key press handler                   // end - logic template                   // -------------------------------- LBL 99            // exit logic CF 01             // clear shift indicator flag
Code:
CF 04             // clear key scanning active flag CF 25             // enable error "EXIT"            // exit message AVIEW             // show message END               // end of program

Flag used
Code:
01 shift indicator flag 04 GETKEY is active, allow user to see when a key press is accepted, for original low speed HP-41s  05 use to detect double shift key press

Sylvain
10-22-2020, 04:07 PM
Post: #11
 Ángel Martin Senior Member Posts: 1,183 Joined: Dec 2013
RE: 41C X-Mem data file editor?
FWIW, there's a Data File Editor in a couple of my modules, it's reproduced below in case it helps.

SF 08 to edit, CF 08 to review.
File Name in ALPHA

Code:
01  LBL "DFED" 02  FLSIZE 03  E 04  - 05  E3 06  / 07  LBL 00 09  SEEKPT 09  GETX 10  X<>Y 11  "D" 12  AINT 13  >"=" 14  X<>Y 15  ARCL X 16  CF 22 17  FC? 08 18  >"?" 19  PROMPT 20  X<>Y 21  FC? 22 22  GTO 01 23  FS? 08 24  GTO 02 25  X<>Y 26  RDN 27  X<>Y 28  SEEKPT 29  X<>Y 30  SAVEX 31  LBL 02 32  X<>Y 33  LBL 01 34  ISG X 35  GTO 00 36  "DONE" 37  AVIEW 38  CLA 39  WORKFL 40  END

Cheers,
ÁM
10-22-2020, 04:33 PM
Post: #12
 Ángel Martin Senior Member Posts: 1,183 Joined: Dec 2013
RE: 41C X-Mem data file editor?
(10-21-2020 06:14 PM)hth Wrote:  One thing that springs in my mind is editing numbers, the HP-41 does not allow for this at the moment. Also the display is a bit limited. I try to wrap my idea around how it may look.

Tell me about it, I had to create one from the scratch for the ^IM<) function in the 41Z (to input the imaginary part of the complex value), a real bear...
10-22-2020, 05:45 PM
Post: #13
 Jake Schwartz Member Posts: 268 Joined: Dec 2013
RE: 41C X-Mem data file editor?
Perhaps utlizing the DM41X might provide at least a multi-line display to reveal more data at one time?

Jake
10-22-2020, 05:46 PM (This post was last modified: 10-22-2020 05:47 PM by rprosperi.)
Post: #14
 rprosperi Senior Member Posts: 4,455 Joined: Dec 2013
RE: 41C X-Mem data file editor?
(10-22-2020 12:49 PM)Dave Britten Wrote:  I'm not sure what you mean by multiple fields per record, though. Aren't data files just a linear set of storage registers akin to a 1-column matrix on the 42S? Or is this some more exotic functionality I have yet to discover?

Sorry, brain fart - I was using the 71B's data files recently, which support this. Not relevant for 41 files and confusing the issue, ignore this.

I should have known Angel would have one of these, though I''m not familiar so it must be in some of his modules I don't regularly use.

Note that the non-std (i.e. not built into 41CX) WORKFL command near the end is included in the 41X.

--Bob Prosperi
10-22-2020, 07:19 PM (This post was last modified: 10-22-2020 07:20 PM by Dave Britten.)
Post: #15
 Dave Britten Senior Member Posts: 1,638 Joined: Dec 2013
RE: 41C X-Mem data file editor?
(10-22-2020 05:46 PM)rprosperi Wrote:
(10-22-2020 12:49 PM)Dave Britten Wrote:  I'm not sure what you mean by multiple fields per record, though. Aren't data files just a linear set of storage registers akin to a 1-column matrix on the 42S? Or is this some more exotic functionality I have yet to discover?

Sorry, brain fart - I was using the 71B's data files recently, which support this. Not relevant for 41 files and confusing the issue, ignore this.

I should have known Angel would have one of these, though I''m not familiar so it must be in some of his modules I don't regularly use.

Note that the non-std (i.e. not built into 41CX) WORKFL command near the end is included in the 41X.

I was suspecting that might have been a 71B thing. Haven't had the privilege of playing with one myself.

WORKFL returns the name of the current working file, right?

Here's a rough draft of my editor so far, in case anybody wants to try it out. There's still plenty of room for code optimization.

To use it, put the name of a data file in alpha, and XEQ "EDD". Note that this uses the AIP function from the Advantage module.

The screen will show something like 0:0.0000, which is the item position (i.e. what you would get from RCLPT), followed by the value of that item.

Keys:

SST - Next item
RCL or Shift + BST - Previous item
STO - Input item
Shift + LBL - Insert item at the current position (new item defaults to 0)
Shift + CLx - Delete item at current position
ON or Backspace - Exit editor

To enter data, either move to the item you wish to replace, or move past the end of the file, where "NEW" is displayed, and press STO. The program will stop, allowing you to enter/calculate a value. Press R/S to save the item's new value.

You can execute any functions or programs here, as long as they don't modify registers 00 or 01, or open a different extended memory file. There is a temporary user key assignment made to R/S so as long as USER mode is on, R/S will continue in EDD regardless of any other programs you've executed (and left the program pointer sitting in). If USER mode gets turned off, R/S will still work as long as the program pointer hasn't been moved from its location in EDD. The temporary key assignment will be removed when the program is resumed.

Inserting and deleting is fairly simple. Just use SST/RCL to move to the item you want to delete, or the position where you want to insert a new record, and press the appropriate key. When deleting, items following the selected item are moved to one position earlier in the file, and the file is shortened by one register. When inserting, the file size will be increased by one register, and the current and all following items will be moved down one position, leaving a 0 in the newly vacated position. You can then press STO to enter a value for the inserted item.

I'll probably add a "total" function that sums up all the items in the file, similar to the 17BII list editor.