HP Forums
HP-41: how to extract name of current XM-file? - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: HP-41: how to extract name of current XM-file? (/thread-150540.html)



HP-41: how to extract name of current XM-file? - Geir Isene - 05-01-2009

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? - Dan Grelinger - 05-01-2009

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? - PeterP - 05-02-2009

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? - Geir Isene - 05-04-2009

Peter; You're the best :-)