The Museum of HP Calculators

HP Forum Archive 19

[ Return to Index | Top of Index ]

HP-41: how to extract name of current XM-file?
Message #1 Posted by Geir Isene on 1 May 2009, 5:47 p.m.

How do I get the name of the current extended memory file (and its type) for use in a program?

      
Re: HP-41: how to extract name of current XM-file?
Message #2 Posted by Dan Grelinger on 1 May 2009, 8:09 p.m.,
in response to message #1 by Geir Isene

There may be an easier way....

The current Extended Memory file is stored in a byte in the first pointer register in XM. That is always in the same absolute address, so you could use a technique that PeterP described a short time ago in this forum to move the curtain appropriately, store the pointer register into an accessbile Extended memory register, and decode the result. Once you have the number of the file, EMDIRX will return it's name.

            
Re: HP-41: how to extract name of current XM-file?
Message #3 Posted by PeterP on 2 May 2009, 1:09 a.m.,
in response to message #2 by Dan Grelinger

for example, the following program will place the name of the current working file in alpha and a 2-letter code into X with regard to its file. It only works on a CX (which is your 'workhorse' IIRC) and assumes the CCD. A second version uses the Sandbox. Both rely on the principle pointed out by Dan - the structure of the absolute register 64, which is the first pointer register of the X/M. (see EFME p181). it is |00|0W|WP|PP|NN|NT|TT|, with WW being the number of the current working file. NNN is the address of top register in the next XM block and TTT is the adress of the top register of the current XM block.

HTH

Cheers

Peter

------------ CCD Version -------------
LBL ‘GCF’
   64.4
   PEEKB
   16
   /
   INT
   64.5
   PEEKB
   RCL Z
   +
   EMDIRX
RTN
-------------------------------------------
------------ Sandbox Version 1 ---------
LBL ‘GCF’
   64
   aNRCL
   CLA
   NNN>HEX
   -6
   AROT
   ASHF
   ATOX
   ATOX
   ATOX
   H>D
   EMDIRX
RTN
-------------------------------------------
------------ Sandbox Version 2 -------------
LBL ‘GCF’
   '@@'  ;text line with 242,64,64, byte 4 of reg 064
   RCLB
   16
   /
   INT
   'P@'   ;textline with 242,80,64, byte 5 of reg 064
   RCLB
   +
   EMDIRX
RTN
-------------------------------------------

Edited: 2 May 2009, 1:37 a.m.

                  
Re: HP-41: how to extract name of current XM-file?
Message #4 Posted by Geir Isene on 4 May 2009, 5:07 p.m.,
in response to message #3 by PeterP

Peter; You're the best :-)


[ Return to Index | Top of Index ]

Go back to the main exhibit hall