HP Forums

Full Version: How to alphabetically sort an alpha XM-file (HP-41)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

What is the best, most efficient way of alphabetically sorting an ascii exended memory file on the HP-41?

Have you tried the SORTFL function of the CCD module?

Good tip. Don't have the CCD (waiting for it). I would however need a routine that doesn't use functions outside a standard HP-41CX (to make my upcomming PDA program usable for most people).

It seems the SORTFL function only sort data registers in XM.

That's right, SORTFL can only deal w/ data files (or matrix files if you've changed its file type previously). ASCII files are trickier in that each record can have multiple "registers" (7-words each), thus the file type change trick won't work in this case.

No substitute to plain old RPN programming in this case, or so it looks.

Best,

ÁM

Excuse my ignorance: Matrix files, what's that?

Geir Isene posted:
"Excuse my ignorance: Matrix files, what's that? "

    They're files created by the Advantage ROM, which can directly create and use matrices stored in extended memory. This way you use no numeric registers at all to store matrices, greatly simplifying most matricial programs.

    In some cases your program can run even using no numeric registers at all (and no 'synthetic' registers M,N, etc., either), this is, even with SIZE 000. See my 62-line, SIZE 000 Nth-degree Polynomial Fit program featured in my Datafile article Long Live the Advantage ROM !

Best regards from V.

Here we go (sorts only ascii files with records of max 24 characters - that's all I need for the "HP-41: The Reminder"-program):

001 *LBL "FLSORT"
002 LBL 01
003 0
004 SEEKPT
005 SF 25
006 GETREC
007 SF 05
008 FC? 25
009 GTO 03
010 SF 25
011 LBL 02
012 ASTO 05
013 GETREC
014 FC? 25
015 GTO 03
016 5
017 ENTER
018 ASTO X
019 X>NN?
020 GTO 02
021 CF 05
022 DELREC
023 RCLPT
024 1
025 -
026 SEEKPT
027 INSREC
028 1
029 +
030 SEEKPT
031 GTO 02
032 LBL 03
033 FC?C 05
034 GTO 01
035 CLA
036 CLST
037 SEEKPT
038 END

Edited: 4 Feb 2006, 3:02 a.m.