Post Reply 
An assortment of 71B questions
04-12-2021, 02:14 PM
Post: #1
An assortment of 71B questions
I've been using my 71B for a few weeks now, and have a handful of questions that I haven't been able to stumble across answers to. In no particular order...

1. Most other pocket computers - e.g. Sharp and Casio - will redisplay the program line you've just entered upon pressing the enter key. This is nice for visually and mentally anchoring yourself, so you know what line number to use next, etc. The 71B just clears the display and shows the prompt. Is there a simple way to make it show the line that was just entered?

2. Are there any LEX files that broaden the capability of user-defined functions? Maybe expanding the allowed names or letting you call them from anywhere?

3. Sharp and Casio computers typically have separate "run" and "program" modes, where run mode can be used as a calculator or for running programs, and entering programs requires switching to program mode. This prevents you from accidentally deleting/modifying a program line if you enter a calculation that somehow gets misinterpreted as a program line (the simple example would be just typing a number and pressing END LINE). Is it possible to make the 71B treat everything as an immediate execution statement to prevent unwanted program line entry? I know there's the CALC mode, but you can't run programs from here.

4. Does anything particularly bad happen if multiple LEX files with the same keyword are loaded? For example, KEYWAIT.LEX and the Finance ROM both provide the KEYWAIT$ function.

More to come later as I'm reminded of them. Smile
Visit this user's website Find all posts by this user
Quote this message in a reply
04-12-2021, 03:41 PM (This post was last modified: 04-12-2021 03:46 PM by Sylvain Cote.)
Post: #2
RE: An assortment of 71B questions
(04-12-2021 02:14 PM)Dave Britten Wrote:  Is there a simple way to make it show the line that was just entered?
FETCH [ENDLINE] or [f] [B] [ENDLINE]

(04-12-2021 02:14 PM)Dave Britten Wrote:  Is it possible to make the 71B treat everything as an immediate execution statement to prevent unwanted program line entry? I know there's the CALC mode, but you can't run programs from here.
Not to my knowledge. You can use SECURE/UNSECURE to prevent modifying your active program.
Find all posts by this user
Quote this message in a reply
04-12-2021, 04:46 PM
Post: #3
RE: An assortment of 71B questions
(04-12-2021 02:14 PM)Dave Britten Wrote:  3. Sharp and Casio computers typically have separate "run" and "program" modes, where run mode can be used as a calculator or for running programs, and entering programs requires switching to program mode. This prevents you from accidentally deleting/modifying a program line if you enter a calculation that somehow gets misinterpreted as a program line (the simple example would be just typing a number and pressing END LINE). Is it possible to make the 71B treat everything as an immediate execution statement to prevent unwanted program line entry? I know there's the CALC mode, but you can't run programs from here.

You can at least define your own functions in Basic and call them from CALC-mode.
The function(s) must be in the current active program ...

Code:
10 DEF FNK(X)=X*X
20 DEF FNI(X)=INTEGRAL(4,5,1E-12,SQR(1 +4*(XA2 + IVARA2))

Enter CALC-mode and use it:

Code:
FNK(5) + --> 25+

I haven't tried FNI() - but I think it should work ... Wink

Cheers,
Thomas

[35/45/55/65/67/97/80 21/25/29C 31E/32E/33E|C/34C/38E 41C|CV|CX 71B 10C/11C/12C/15C|CE/16C 32S|SII/42S 28C|S 48GX/49G/50G 35S 41X]
Find all posts by this user
Quote this message in a reply
04-12-2021, 05:52 PM
Post: #4
RE: An assortment of 71B questions
(04-12-2021 02:14 PM)Dave Britten Wrote:  4. Does anything particularly bad happen if multiple LEX files with the same keyword are loaded? For example, KEYWAIT.LEX and the Finance ROM both provide the KEYWAIT$ function.

The short answer is no, nothing bad happens. But this brings up some questions about LEX files and their "priority".

First, a keyword in a LEX file will override a mainframe keyword by the same name. But what if two LEX files contain the same keyword, which one gets executed?
We know that the HP-IL ROM can't be upgraded by copying the version 1B LEX file to the 71, presumably because the HP-IL ROM is in Port 0.05 and has a higher "priority" than a LEX file in RAM or plug-in ROM. But then why does configuring the JPC ROM in a lower numbered port than a copy of the 1B HP-IL LEX file allow the ROM to be upgraded?
Back to my first question, what if the two LEX files are in MAIN RAM? There's no Port number that can be used to establish "priority", so which one gets executed?

I'm sure the answers are somewhere in the IDS. I just haven't found them, yet.

Dave
Find all posts by this user
Quote this message in a reply
04-12-2021, 06:14 PM
Post: #5
RE: An assortment of 71B questions
(04-12-2021 02:14 PM)Dave Britten Wrote:  1.
...
Is there a simple way to make it show the line that was just entered?

Find all posts by this user
Quote this message in a reply
04-12-2021, 06:30 PM
Post: #6
RE: An assortment of 71B questions
(04-12-2021 06:14 PM)Gerson W. Barbosa Wrote:  
(04-12-2021 02:14 PM)Dave Britten Wrote:  Is there a simple way to make it show the line that was just entered?
Nop, that shows the next line.
Find all posts by this user
Quote this message in a reply
04-12-2021, 06:47 PM
Post: #7
RE: An assortment of 71B questions
(04-12-2021 06:30 PM)Sylvain Cote Wrote:  
(04-12-2021 06:14 PM)Gerson W. Barbosa Wrote:  
Nop, that shows the next line.

But ^ does show the just-entered line...

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
04-12-2021, 06:47 PM
Post: #8
RE: An assortment of 71B questions
Usually I just press Up, Down to review the line I entered, but I didn't know about FETCH with no argument. Maybe I'll set up a user key assignment for that. Was hoping for some kind of trick to automatically echo the parsed/formatted line back to the screen like the cheaper computers do. Wink

And I know about accessing user-defined functions in CALC mode, but you're still limited to a two-character function name, and functions defined in whatever program has been made active with EDIT. Did anybody ever come up with a way around those limitations?
Visit this user's website Find all posts by this user
Quote this message in a reply
04-12-2021, 07:05 PM
Post: #9
RE: An assortment of 71B questions
Further comments on multiple LEX files/keywords...

1. The JPC is a special case (in many ways) in that it actually integrates some of it's messages (and maybe keywords?) with those in the HP-IL ROM, which is why when JPC is installed you will notice that the HP-IL ROM VER$ appears later in sequence than JPC, and possibly other LEX files.

2. LEX keywords are found (to run or to be added into a program when typing that in) in a port-scan, in the normal port number increasing order, so 0.00, then 0.01, then 0.02... then 1.00, then 1.01... then 4.00, then 4.01, etc. Of course this only applies to IRAM or ROM ports.

So a keyword in a LEX file in Port-1 could be considered 'higher priority' than the same keyword in another LEX file in Port-2, that is until you swapped which ports these modules are in, then the 'priority' would change. (Note: So plan well when considering which modules go into which port).

3. Programs don't store the alpha keyword names for commands, they store the XROM ID, almost exactly like the 41 does, which is why when you list a program with an external (LEX file based) keyword when that LEX file is not installed, you will see "XROM mm,nn"" instructions; the LEX file is not available to provide the string for the editor to display the command. The "mm" is the LEX ID, and the "nn" is the token. These are explained in gory detail in the IDS, but a dead simple example can be seen on p.54 of the Forth/Assembler manual.

This can lead to some initially confusing situations, such as:

a. If a LEX is installed with the keyword FUNC1, whose underlying ID is XROM 52,55, and then at some later time there is a different LEX file also using the same LEX ID/Token (52,55) for another command FUNC2, and is installed in a lower port (aka, a 'higher priority' port) when you list (and run!) this program, the command in the newer module would be shown and executed, appearing as if your program code had changed.

b. Similar to the above, if that newer LEX file (or even another) also has a FUNC1, but with a different LEX ID/Token pair, it's hard to find the problem as you can type a=FUNC1(x) at the command line to see that it is indeed there, while your program may be returning a different value for it's (now with a different name) FUNC1.

Note that this is also how mainframe commands are 'replaced' with modified versions in a LEX file; the ports are scanned for LEX ID matches before the OS. This is how the native PEEK and POKE were replaced with versions that could read/write anywhere (e.g. in protected file's address space) thus quickly rendering the OS 'security' measures useless (and it was even easier in Forth! Smile ).

All this is why HP managed the allocation of LEX ID and Token resources, to prevent LEX command name collisions. Developers were asked to submit requests to HP, describing the class of application, types of functions, etc. and HP would act as a clearing-house and master keeper of the records to attempt to ensure such conflicts did not occur, but of course they did.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
04-12-2021, 07:09 PM
Post: #10
RE: An assortment of 71B questions
(04-12-2021 06:30 PM)Sylvain Cote Wrote:  
(04-12-2021 06:14 PM)Gerson W. Barbosa Wrote:  
Nop, that shows the next line.

You’re right. If it’s not the highest number line then the key should follow.
Find all posts by this user
Quote this message in a reply
04-12-2021, 07:10 PM
Post: #11
RE: An assortment of 71B questions
(04-12-2021 06:47 PM)Dave Britten Wrote:  Usually I just press Up, Down to review the line I entered, but I didn't know about FETCH with no argument. Maybe I'll set up a user key assignment for that. Was hoping for some kind of trick to automatically echo the parsed/formatted line back to the screen like the cheaper computers do. Wink

Just pressing [^] should do it, no need to then press [v]. One key should do it, even faster than a KA. Smile

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
04-12-2021, 07:22 PM (This post was last modified: 04-12-2021 07:30 PM by Sylvain Cote.)
Post: #12
RE: An assortment of 71B questions
(04-12-2021 07:10 PM)rprosperi Wrote:  
(04-12-2021 06:47 PM)Dave Britten Wrote:  Usually I just press Up, Down to review the line I entered, but I didn't know about FETCH with no argument. Maybe I'll set up a user key assignment for that. Was hoping for some kind of trick to automatically echo the parsed/formatted line back to the screen like the cheaper computers do. Wink
Just pressing [^] should do it, no need to then press [v]. One key should do it, even faster than a KA. Smile
Nop,
if you are at the first line of the program → [^] will show you that line.
if you are at the last line of the program → [v] will show you that line.
anywhere else in the program → [v] [^] or [^] [v] or [f][B][ENTER] will show you the current line.
Even though it uses 1 more key, I would presume that [f][B][ENTER] will execute faster.
Find all posts by this user
Quote this message in a reply
04-12-2021, 07:54 PM (This post was last modified: 04-12-2021 07:55 PM by rprosperi.)
Post: #13
RE: An assortment of 71B questions
(04-12-2021 07:22 PM)Sylvain Cote Wrote:  
(04-12-2021 07:10 PM)rprosperi Wrote:  Just pressing [^] should do it, no need to then press [v]. One key should do it, even faster than a KA. Smile
Nop,
if you are at the first line of the program → [^] will show you that line.
if you are at the last line of the program → [v] will show you that line.
anywhere else in the program → [v] [^] or [^] [v] or [f][B][ENTER] will show you the current line.
Even though it uses 1 more key, I would presume that [f][B][ENTER] will execute faster.

You got me, indeed [^] [v] is needed, I had duplicate lines (:blush)

For a 2 keystroke assignment, you can do this to avoid the [Enter]

DEF KEY 'FB','FETCH': <=== The trailing colon makes it immediate execute.

Then [f] [b] will fetch the just-entered line. So this is no better than the generally usable [^] [v], but it is universal.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
04-13-2021, 03:20 PM
Post: #14
RE: An assortment of 71B questions
I was tinkering with user-defined functions last night, and it seems you can CALL a SUB from inside a function, but only within the program file that contains the function. So that rules out the possibility of having a program file full of SUBs and putting small wrapper functions in other programs that call those SUBs.

Another quickie: Is there a way to list the commands/keywords/functions in any given LEX file? I faintly recall seeing some way to do that, but can't recall what it was.
Visit this user's website Find all posts by this user
Quote this message in a reply
04-13-2021, 05:16 PM
Post: #15
RE: An assortment of 71B questions
(04-13-2021 03:20 PM)Dave Britten Wrote:  I was tinkering with user-defined functions last night, and it seems you can CALL a SUB from inside a function, but only within the program file that contains the function. So that rules out the possibility of having a program file full of SUBs and putting small wrapper functions in other programs that call those SUBs.

Another quickie: Is there a way to list the commands/keywords/functions in any given LEX file? I faintly recall seeing some way to do that, but can't recall what it was.

#1 - I'm not sure if it's what you're looking for, but look at the MYSUBS program in Joe's Titan File Collection, available here.

#2 - The file HLPLEX is just what you're looking for. There are several commands included, but the simplest and most common form is "HELPF MYLEX" which will display all the keywords (and associated argument types) found in the LEX file MYLEX.

HLPLEX is in the OLDP, but note there is no E in the beginning of the filename HLPLEX.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
04-13-2021, 08:04 PM
Post: #16
RE: An assortment of 71B questions
(04-13-2021 05:16 PM)rprosperi Wrote:  #1 - I'm not sure if it's what you're looking for, but look at the MYSUBS program in Joe's Titan File Collection, available here.

#2 - The file HLPLEX is just what you're looking for. There are several commands included, but the simplest and most common form is "HELPF MYLEX" which will display all the keywords (and associated argument types) found in the LEX file MYLEX.

HLPLEX is in the OLDP, but note there is no E in the beginning of the filename HLPLEX.

MYSUBS is pretty close to what I was thinking of, but I was trying to go a step further and then call those subs from a function defined in another program. But alas, it doesn't have the desired effect. Smile

I'll check out HLPLEX, that sounds like what I was thinking of. Thanks!
Visit this user's website Find all posts by this user
Quote this message in a reply
04-13-2021, 09:06 PM (This post was last modified: 04-13-2021 09:17 PM by Dave Frederickson.)
Post: #17
RE: An assortment of 71B questions
(04-13-2021 03:20 PM)Dave Britten Wrote:  Another quickie: Is there a way to list the commands/keywords/functions in any given LEX file? I faintly recall seeing some way to do that, but can't recall what it was.

A utility to list the contents of a LEX file on a LIF disc image is lexcat71 in the LIFUTILS. Easiest way is to use pyILPER as a front end for LIFUTILS.
Find all posts by this user
Quote this message in a reply
Post Reply 




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