Post Reply 
HP-41 ExFunctions SEEKPT and SEEKPTA
04-27-2015, 03:54 PM
Post: #1
HP-41 ExFunctions SEEKPT and SEEKPTA
I don't fully understand how SEEKPT and SEEKPTA works in a program. I've got a program that works sometimes, but often it doesn't. My 41CV has an Extended Functions/Memory module and I have an HP-IL printer attached.

The most used program on my 41 requires a structured data file in Extended Memory. To check that file I wrote the following program to produce a print out:

01 LBL "XDATA"
02 SF 21
03 STO 01
04 LBL 01
05 FIX 0
06 RCL 01
07 INT
08 ACX
09 " : "
10 ACA
11 SEEKPT
12 GETX
13 FIX 3
14 ACX
15 PRBUF
16 ISG 01
17 GTO 01
18 END

I place the name of the data file in the Alpha register and the starting and ending registers along with the increment in X (s.eeeii) and sometimes the program will print the following:
59.06301
XEQ "XDATA"
59 : 163.288
60 : 168.990
61 : 174.850
62 : 180.749
63 : 186.623
(the data file is a lot larger but this serves for illustration)

But days later, running the program again, I got the error message "FL TYPE ERR". I tried changing line 11 to SEEKPTA but still got the error. The program halted on line 11, at this point the Alpha register contains " : ".

I rewrote the program a little so as not use the " : " separator thinking that since it was replacing the data file name in the Alpha register the calculator was now searching for a data file named " : ". I got it to work, but the format of the printout above is easier to read - and it worked at one time! (And it worked again yesterday after recovering from a MEMORY LOST.)

So I don't understand fully how to use these functions.

The manual is a little cryptic on how SEEKPT is used, at first I thought it was used for data files only. On re-reading it seems instead that it uses an assumed "working file", while SEEKPTA makes the named file the working file. I can't figure out how one would know the working file without specifying it in the Alpha register.

Can someone enlighten me?

Steve
In order of appearance: HP 41CV, CMT-MCGPS, HP 41CX, DM 41, DM 42
Find all posts by this user
Quote this message in a reply
04-27-2015, 06:52 PM (This post was last modified: 04-27-2015 07:07 PM by Dieter.)
Post: #2
RE: HP-41 ExFunctions SEEKPT and SEEKPTA
(04-27-2015 03:54 PM)4ster Wrote:  I don't fully understand how SEEKPT and SEEKPTA works in a program.

They work the same as in run mode.

(04-27-2015 03:54 PM)4ster Wrote:  I've got a program that works sometimes, but often it doesn't. My 41CV has an Extended Functions/Memory module and I have an HP-IL printer attached.
...
I place the name of the data file in the Alpha register

...but the program does not do anything with that file name.

You are using SEEKPT to place the file pointer to a specific position of the current working file. Not the file you entered in Alpha – that file name is completeley ignored and there is not a single command in your program that makes the calculator access that particular file. It's always the file that happens to be the current working file. So it's no wonder you get a FL TYPE ERR.

There also is no need to set the pointer to the next value in every loop. GETX reads a value from a X-Memory data file and automatically advances the pointer to the next one. So GETX GETX GETX will read three consecutive values.

You may try this one:

Code:
01 LBL "XDATA"
02 SF 21
03 SEEKPTA  // Set pointer to record# in file specified in Alpha
04 LBL 01   // This way it becomes the working file
05 FIX 0
06 INT      // now record# moves to LastX
07 ACX
08 " : "
09 ACA
10 GETX     // get next value from file
11 FIX 3
12 ACX
13 PRBUF
14 LastX    // recall pointer from LastX
15 ISG X
16 GTO 01
17 END

Cave – this is completely untested code, and I have no printer for my 41.

The basic idea is this: SEEKPTA (or RCLPTA) makes the file specified in Alpha the working file. All following operations then can be done with SEEKPT (or RCLPT). Until you want to access another file which then again is made the working file by another SEEKPTA or RCLPTA.

Dieter
Find all posts by this user
Quote this message in a reply
04-28-2015, 03:20 AM (This post was last modified: 04-28-2015 02:22 PM by 4ster.)
Post: #3
RE: HP-41 ExFunctions SEEKPT and SEEKPTA
Thanks for taking the time to write the improved listing with comments, it helps a lot.

Edit: I edited my program to your listing and it works on my IL printer, thanks again.

Steve
In order of appearance: HP 41CV, CMT-MCGPS, HP 41CX, DM 41, DM 42
Find all posts by this user
Quote this message in a reply
Post Reply 




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