HP50g ram and working dir.
08-16-2017, 01:55 PM
Post: #1
 pier4r Senior Member Posts: 2,067 Joined: Nov 2014
HP50g ram and working dir.

Then I realized that in the hp50g port0 is the HOME directory, but there is another ram port, port1 (IRAM 127Kb).

As far as I know, with firmware 2.15, if one does some computation, the memory in port 0 is used. Would it be possible to have, as working ram directory, port1 ? So one can mess around there, then move the results either in home/port2 (I find port3 mostly usable for backups at the moment, still very valuable).

Wikis are great, Contribute :)
08-16-2017, 09:57 PM
Post: #2
 Claudio L. Senior Member Posts: 1,723 Joined: Dec 2013
RE: HP50g ram and working dir.
(08-16-2017 01:55 PM)pier4r Wrote:  So I was reading the interesting thread about FRAM cards (nice piece of technology).

Then I realized that in the hp50g port0 is the HOME directory, but there is another ram port, port1 (IRAM 127Kb).

As far as I know, with firmware 2.15, if one does some computation, the memory in port 0 is used. Would it be possible to have, as working ram directory, port1 ? So one can mess around there, then move the results either in home/port2 (I find port3 mostly usable for backups at the moment, still very valuable).

The old Saturn processor had only 20 bits addresses, and it counted in nibbles, not bytes so it could only address 2^19 = 512 kbytes of memory. Part of that address space was taken by the ROM, leaving only 256 kbytes maximum RAM addressable directly. Anything beyond that has to be temporarily mapped in banks (these are the ports).
So the extra RAM was assigned to Port1 because the 50g already maxed out the addressing capacity of the Saturn, it can't be used directly for directories and variables because is not contiguous to the main memory, and has to be mapped in/out all the time, but you are free to STO/RCL/PURGE objects in it. You are not allowed to create a directory structure in port memory, though, all your variables will be at the root so is not the best choice for organization.
08-17-2017, 07:16 AM
Post: #3
 pier4r Senior Member Posts: 2,067 Joined: Nov 2014
RE: HP50g ram and working dir.
Claudio, thanks for the great explanation. I couldn't expect that it was another limit of the Saturn emulation.

Wikis are great, Contribute :)
08-18-2017, 08:11 PM (This post was last modified: 08-18-2017 08:12 PM by pier4r.)
Post: #4
 pier4r Senior Member Posts: 2,067 Joined: Nov 2014
RE: HP50g ram and working dir.
Even if Claudio told me that directories cannot be saved in port 1 (nor port 2 as far as I know) I remember that the second 50g that I bought for the newRPL had directories in port2.

Indeed I just copied, with the filer, a directory from HOME to port 2 or port1, and it worked. (I can even navigate through its structure)

Now. If the filer can do it, while am I not able to do it with STO?

Like:

{ DIR } RCL
"testDir"
1 @or 2
\->TAG
STO

I get an error

how can I trigger what the built in filer does? Should I always do it manually?

Wikis are great, Contribute :)
08-18-2017, 08:52 PM
Post: #5
 Software49g Junior Member Posts: 46 Joined: Mar 2014
RE: HP50g ram and working dir.
Hello,

if you want to store a directory in Port0/1/2 (remember Port3 is not a port) simply put the dir on level 1 and then store it.

Example:

1: DIR
TEST 99
END

This is a very simple dir and a directory is an object as everything else (Prologue 02A96).

Then simply do :1:YouNameIt and press [STO] and your dir is in Port1

> If the filer can do it
The Filer can do it, as it "browses" through the object.
If you want to do this, than simply write a piece of software that can step through/show/browse a directory object - it is this simple as everything in RPL is an object :-)

A simple quote from "Introduction to Saturn Assembly Language" (available on hpcalc.org):

Part V: Objects
55 Objects overview
Objects are an essential part of the HP 48 and 49. Everything put on the stack is an object, and they’re all encoded the same
way: they start with a 5-nibble prologue that identifies the object, and then the object follows in what is called the “body” of
the object. The object is, in a way, a shell, and data is put inside of it.
What is the prologue? It’s not only something to identify the object, but in fact it also contains the address of a code routine
that is used to execute the object. So the prologue not only identifies something but also executes it.
Some objects, when evaluated, just put themselves on the stack, like strings. If you [EVAL] a string, it remains on the stack.
But, if you put a global name onto the stack and [EVAL] it, the contents of the variable that corresponds to the global name is
put on the stack. The global name’s prologue was evaluated, and it pushed the variable’s contents onto the stack.
We are now going to study each object type of the HP 48 and 49, so this is a rather long part.

HTH,
Andreas

http://www.software49g.gmxhome.de
08-18-2017, 09:36 PM (This post was last modified: 08-18-2017 09:36 PM by pier4r.)
Post: #6
 pier4r Senior Member Posts: 2,067 Joined: Nov 2014
RE: HP50g ram and working dir.
Thanks Andreas. I identified my error.

"name"
1 \->TAG
STO

does not work (but works for the SD card)

'name'
1 \->TAG
STO

works

I am not sure why 'name' is needed for port1 (or 2 or 0) while port 3 (SD) accepts "name" in double quotes. Maybe due to the different way port 0,1,2 get handled compared to port 3. Well, TIL (Today I learned)

Wikis are great, Contribute :)
08-18-2017, 10:49 PM
Post: #7
 Claudio L. Senior Member Posts: 1,723 Joined: Dec 2013
RE: HP50g ram and working dir.
(08-18-2017 08:11 PM)pier4r Wrote:  Even if Claudio told me that directories cannot be saved in port 1 (nor port 2 as far as I know) I remember that the second 50g that I bought for the newRPL had directories in port2.

Just semantics... I said you cannot create a directory structure, not that you can't store directories. As Andreas mentioned, directories are objects and can be stored, but it's a "blob" and cannot be traversed, you can't access individual variables within them.
The filer does some visual stunts for you... it detects that the blob is a directory object, and scans into it "manually", giving the illusion that you can traverse it, but for all other commands it's still a big blob of data.
08-19-2017, 06:20 AM
Post: #8
 pier4r Senior Member Posts: 2,067 Joined: Nov 2014
RE: HP50g ram and working dir.
(08-18-2017 10:49 PM)Claudio L. Wrote:  Just semantics... I said you cannot create a directory structure, not that you can't store directories. As Andreas mentioned, directories are objects and can be stored, but it's a "blob" and cannot be traversed, you can't access individual variables within them.
The filer does some visual stunts for you... it detects that the blob is a directory object, and scans into it "manually", giving the illusion that you can traverse it, but for all other commands it's still a big blob of data.

Ah, good to know then. My bad. I thought I could do what the filer does.

Wikis are great, Contribute :)
08-19-2017, 06:51 AM
Post: #9
 Joe Horn Senior Member Posts: 1,709 Joined: Dec 2013
RE: HP50g ram and working dir.
(08-18-2017 10:49 PM)Claudio L. Wrote:
(08-18-2017 08:11 PM)pier4r Wrote:  Even if Claudio told me that directories cannot be saved in port 1 (nor port 2 as far as I know) I remember that the second 50g that I bought for the newRPL had directories in port2.

Just semantics... I said you cannot create a directory structure, not that you can't store directories. As Andreas mentioned, directories are objects and can be stored, but it's a "blob" and cannot be traversed, you can't access individual variables within them.
The filer does some visual stunts for you... it detects that the blob is a directory object, and scans into it "manually", giving the illusion that you can traverse it, but for all other commands it's still a big blob of data.

Yes and no. YES, new variables cannot be created (saved) into directories in ports 1 or 2, and YES, already-existing variables in directories in ports 1 or 2 cannot be purged individually, but NO, it IS possible to RECALL (or evaluate) already-existing variables individually from directories in ports 1 or 2, by specifying them with "port tagged paths". For example, if VAR2 is a variable in a directory called VAR1 which is saved in Port 2, then :2:{VAR2 VAR1} RCL will recall it from that directory. Instead of RCL you can also use EVAL, which is helpful if VAR2 is a program and you want to run it without recalling that entire directory to main memory.

It might also need to be pointed out that directories in ports 1 and 2 are very different from directories in Port 3 in the 50g. Directories in ports 1 and 2 are merely backups of main-memory directories, and are shown as "DIR" objects in the browser. But "DIR" objects in Port 3 are NOT backed up directories from main memory (those are shown as "HPDIR" objects), but are rather DOS directories (AKA folders) which can be accessed by any computer with an SD card reader. *Those* kinds of directories CAN be fully accessed directly by the HP 50g (not only by the filer). You can purge, store, overwrite, recall, and execute any object stored in any Port 3 "DIR" directly, individually, without recalling the entire directory to main memory. The paths are specified as port-tagged DOS paths in string form, e.g. :3:"VAR2/VAR1".

Due to a bug in the HP 50g, port-tagged paths don't work with HPDIR objects in port 3. So if you want to access directories in port 3 the way they can be accessed in ports 1 and 2, you should use DOS directories instead, and use port-tagged string paths as shown in the previous paragraph.

Sorry if the above is already well-known, but I see references to this so seldom that I thought it might be a good time to review it.

<0|ɸ|0>
-Joe-
08-19-2017, 09:54 AM
Post: #10
 pier4r Senior Member Posts: 2,067 Joined: Nov 2014
RE: HP50g ram and working dir.
(08-19-2017 06:51 AM)Joe Horn Wrote:  Sorry if the above is already well-known, but I see references to this so seldom that I thought it might be a good time to review it.

Absolutely it was not known by me! Thanks for sharing!

I love when different experts add more and more details over a topic. This forum is often amazing due to this phenomena happening not too seldom.

Wikis are great, Contribute :)
08-20-2017, 10:15 AM (This post was last modified: 08-20-2017 07:28 PM by pier4r.)
Post: #11
 pier4r Senior Member Posts: 2,067 Joined: Nov 2014
RE: HP50g ram and working dir.
context: hp50g, rom 2.15

Ok so I have a directory in port 1. (sorry, I am determined, at least for a while, to use it. Actually in my case it is RAM never used)

I save it with
<DIR object on the stack>
'dirName' 1 \->TAG STO

I can recall elements with
{dirName varName} 1 \->TAG RCL

But how do I list the directory variables?

1 PVARS
returns
{1:dirName}

{1:dirName} PVARS
returns
"nice try" (error)

TVARS and VARS process the current directory (so only port 0 directory)

Any idea? Of course it is likely I am missing some command that is new to me, so I appreciate the enlightenment. Many thanks

Update: my search strings on comp.sys.hp48 did not return anything useful. It seems no one had the need of listing the contents of a directory in port1 or port2 (or he was good enough to do it on his own, without sharing).

Wikis are great, Contribute :)
08-20-2017, 07:29 PM (This post was last modified: 08-20-2017 07:30 PM by pier4r.)
Post: #12
 pier4r Senior Member Posts: 2,067 Joined: Nov 2014
RE: HP50g ram and working dir.
As alternative path I am recalling the directory on the stack (so using port0 at the end), but I cannot explode it.

DIR <contents> END @dir object
OBJ\->

returns an error. Do you know any possible useful directions? (before parsing the object itself)

Wikis are great, Contribute :)
08-20-2017, 08:51 PM
Post: #13
 Joe Horn Senior Member Posts: 1,709 Joined: Dec 2013
RE: HP50g ram and working dir.
(08-20-2017 10:15 AM)pier4r Wrote:  Ok so I have a directory in port 1. I save it with
<DIR object on the stack>
'dirName' 1 \->TAG STO

I can recall elements with
{dirName varName} 1 \->TAG RCL

But how do I list the directory variables?

Short answer: You don't. Port-tagged path access is intended to be used when you already know what's in a directory because you created it. If you need to go exploring, use the Filer.

Longer answer: There's no simple built-in way (like PVARS) to list the variables in a directory stored in a port. You'd have to write a program to do that. Here's a possibly helpful System RPL program that explodes a directory object onto the stack. Recall the directory onto level 1, then run this program, and the directory's contents will be exploded onto the stack, with each variable's contents occupying one stack level and its name on the level below it. A number is left on level 1, indicating how many variables were in the directory.

Code:
::   CK1NoBlame   CK&DISPATCH2   BINT47   ::     BINT0     SWAPOVER     BEGIN     ?ATTNQUIT     NEXTRRPOB     WHILE     ::       DUP       TOTEMPOB       SWAP       RAM-WORDNAME       5ROLL       #1+       5ROLL       5ROLL     ;     REPEAT     DROP     UNCOERCE   ; ;

BYTES: 65.0, #86D2h

<0|ɸ|0>
-Joe-
08-20-2017, 10:23 PM (This post was last modified: 08-20-2017 10:24 PM by pier4r.)
Post: #14
 pier4r Senior Member Posts: 2,067 Joined: Nov 2014
RE: HP50g ram and working dir.
Joe thanks for the direction!

In general I agree with "you created the directory, that cannot be modified, you know what is there". The context, though, is about backups. I backup a directory and then I compare it with the production directory expecting consistency until a certain point (of course the new data point won't be in the backup). For example I may add a variable in the production dir that is not listed in a "old" backup. Therefore I wanted to list the variables within the dir coming from the backup, to check only those variables.

Wikis are great, Contribute :)
08-21-2017, 02:15 AM
Post: #15
 Joe Horn Senior Member Posts: 1,709 Joined: Dec 2013
RE: HP50g ram and working dir.
Here's an idea: An easy way to make the contents of backups listable is by saving VARS into a variable immediately before performing the backup. For example, if you save VARS into 'Vars', and call the backup 'BAKUP' in Port 2, then :2:{BAKUP Vars} RCL will yield the list of BAKUP's contents. If you do this consistently, then all your backups will be listable.

<0|ɸ|0>
-Joe-
08-21-2017, 02:27 AM
Post: #16
 Claudio L. Senior Member Posts: 1,723 Joined: Dec 2013
RE: HP50g ram and working dir.
(08-19-2017 09:54 AM)pier4r Wrote:
(08-19-2017 06:51 AM)Joe Horn Wrote:  Sorry if the above is already well-known, but I see references to this so seldom that I thought it might be a good time to review it.

Absolutely it was not known by me! Thanks for sharing!

I love when different experts add more and more details over a topic. This forum is often amazing due to this phenomena happening not too seldom.

Neither was known to me! I had no idea RCL could access individual variables inside directories in port memory. Still learning new things after all these years...
08-21-2017, 05:56 AM (This post was last modified: 08-21-2017 05:56 AM by pier4r.)
Post: #17
 pier4r Senior Member Posts: 2,067 Joined: Nov 2014
RE: HP50g ram and working dir.
(08-21-2017 02:15 AM)Joe Horn Wrote:  Here's an idea: An easy way to make the contents of backups listable is by saving VARS into a variable immediately before performing the backup. For example, if you save VARS into 'Vars', and call the backup 'BAKUP' in Port 2, then :2:{BAKUP Vars} RCL will yield the list of BAKUP's contents. If you do this consistently, then all your backups will be listable.

You know what? When I read such things I realize how poor I am. instead of trying the ways that are more economical (in this case, effort), I try those that are pointing in one direction and that's it.

It is not bad to learn in that direction, but it is not flexible. Thanks for the tip it is what I am going to do. It sounds reasonable to me.

@Claudio: it is very nice to hear such things from you. If you learn new stuff every now and then on a device that is obvious that you like, it is obvious that the same will be valid for me, 100! times more.

Wikis are great, Contribute :)
08-21-2017, 08:15 AM
Post: #18
 pier4r Senior Member Posts: 2,067 Joined: Nov 2014
RE: HP50g ram and working dir.
I add here the first working version of my backup comparison, so other like me can use it as example.

Code:
 @possibly using the ListExt of DavidM     \<<       @Plan:       @ given that I make backups of the folder on the SD card, I may, one day,       @ mix the data (like overwriting one variable with the data of another one).       @ This actually already happened and I always realized it (or so I think).       @ What happens when I do not realize it? I will have wrong data for a certain       @ period of time, also in the backups.       @ So the idea is: the user recall a backup on the stack.       @ The backup is the entire life gamification directory.       @ The directory gets saved on those ports rarely used.       @ In particular I realized that port1 sits there unused.       @ See www.hpmuseum.org/forum/thread-8847.html       @ Therefore one can use port1 as storage place for the directory,       @ even overwriting the previous save,       @ and then to report changes. In names, contets and so on.       @ This only for the data though (data saved as lists), for other       @ types I will see.              'LGBP1' "dirNamePort1" DROP       {} "lgbp1Vars" DROP       "" "currVar" DROP       0 "backupListSize" DROP         @it is assumed that all the lists in the backup have the same size.       {} "currVarListProd" DROP       {} "comparisonResultList" DROP       0 "areListEqualBool" DROP       "" "resultStr" DROP       {} "resultList" DROP         @result list in the form { var1-0 var2-5 ... varJ-<FirstMismatchPos> }              \->       @input       stackDirObj       @ on the stack is required the directory object              @local var       dirNamePort1       lgbp1Vars       currVar       backupListSize       currVarListProd       comparisonResultList       areListEqualBool       resultStr       resultList              \<<         @ test if on the stack there is the proper object (a dir blob)         IF           stackDirObj TYPE 15 \=/         THEN           "input agument should be a directory about LIFEG" DOERR           KILL         END                  @purge eventual objects in port1         IFERR           dirNamePort1 1 \->TAG           PURGE         THEN           "dir likely does not exist" DROP                      @drop the commands if last argument is enabled.           IF             -55 FC?           THEN             DROP           END         END                  @ save the directory in port1 , always the same name         stackDirObj         dirNamePort1 1 \->TAG         STO                  @ collect the variables names within the directory in port1         @ using a fixed name "protocols!"         IFERR           dirNamePort1 'allListVars' 2 \->LIST           1 \->TAG            RCL         THEN           IF             -55 FC?           THEN             DROP           END           "Please check if 'allListVars' exists in the backup"           "Otherwise make it manually, or manually compare single lists"           KILL         END         'lgbp1Vars' STO                  @when I do a backup it is assumed that I check the length of the lists         @so all of them should have the same length         dirNamePort1 lgbp1Vars HEAD 2 \->LIST         1 \->TAG RCL         SIZE 'backupListSize' STO                  @ go through the variables collected and, if they are of type list         @ try to find the same name in the "production" directory         @ and compare the contents reporting the results.         1 lgbp1Vars SIZE         FOR ind1           lgbp1Vars ind1 GET 'currVar' STO                      @when I do a backup it is assumed that I check the length of the lists           @so all of them should have the same length. Still, the <production directory>           @may have longer lists because the backup is older, I need to trim those.           { HOME LIFEG } currVar + RCL             @TIL 09:53 21.08.2017 that HOME withing single quotes is generating a syntax error.             @TIL 09:58 21.08.2017 it is not immediately possible to expand a variable within a list             @so it has to be expanded and added later.           1 backupListSize SUB           'currVarListProd' STO                      @now comparison           dirNamePort1 currVar 2 \->LIST 1 \->TAG RCL           currVarListProd           2 \<< == \>>           DOLIST           'comparisonResultList' STO                      IF             comparisonResultList 0 POS 0 ==           THEN             'resultList' 0 currVar \->TAG STO+           ELSE             'resultList'              comparisonResultList 0 POS             currVar \->TAG STO+           END         NEXT                  resultList       \>>     \>>

Wikis are great, Contribute :)
 « Next Oldest | Next Newest »

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