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



#5

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


#6

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.


#7

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.


#8

Peter; You're the best :-)


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP-41(CL): The easiest way to transfer FOCAL programs from a Linux PC to the HP-41 Geir Isene 13 3,290 12-05-2013, 02:40 AM
Last Post: Hans Brueggemann
  Cannot delete file Les Koller 4 1,220 11-07-2013, 12:17 AM
Last Post: Les Koller
  File Format: hpprgm Thomas Chrapkiewicz 6 1,579 10-30-2013, 09:32 PM
Last Post: Thomas Chrapkiewicz
  HP-Prime File extension Paul D. Fox 6 1,360 10-07-2013, 01:45 AM
Last Post: cyrille de Brébisson
  go71b 'lexs' or 'raws' file format? Christoph Giesselink 2 865 08-21-2013, 02:53 AM
Last Post: Christoph Giesselink
  How do you print a 'data' file on the HP 71B to the HP 2225B thinkjet? Geoff Quickfall 3 1,071 08-18-2013, 04:32 PM
Last Post: Geoff Quickfall
  How to use XnView to create .gro4 file as in OpenFire? arturfeghali 2 868 06-27-2013, 05:57 PM
Last Post: jerome ibanes
  41CL :TROUBLE IN FILE TRANsFER aurelio 22 3,927 06-18-2013, 03:44 PM
Last Post: aurelio
  How to save WP34s programs to a file? Harald 9 2,019 04-26-2013, 01:44 PM
Last Post: Walter B
  [WP 34s] How to get the latest version of file xyz Walter B 3 909 03-17-2013, 05:52 AM
Last Post: Alexander Oestert

Forum Jump: