The Museum of HP Calculators

HP Forum Archive 18

[ Return to Index | Top of Index ]

Discoverd interesting feature in HP-71B BASIC
Message #1 Posted by Namir on 21 Dec 2008, 9:58 a.m.

Hello All,

I have been playing with the HP-71B computer by writing BASIC programs for various algorithms. I took a peek at the User's Library Math pac (on the museum DVD) to look at numerical integration methods. I noticed that the numerical integration program used the BASIC function VAL to evaluate expressions entered by the program users!! In typical BASIC interpreters, the VAL function merely converts a string constant or the contents of a string variable into numbers.

The HP-71B VAL function does much more! It interprets the string-type argument and evaluates it, like the HP-48/49/50 EVAL function!! This means that you can write programs that work with dynamic functions (ones that the user enters at run time) instead of functions hard-coded in the program itself.

I am curious if you were aware of this feature or not??? Am I the last person on earth to learn of the special interpreter ability of the VAl function?

Are there any other HP-71B BASIC functions on steroids (meaning they do more than the same functions on other BASIC interpreters)?

Namir

Edited: 21 Dec 2008, 10:06 a.m.

      
Re: Discoverd interesting feature in HP-71B BASIC
Message #2 Posted by Garth Wilson on 21 Dec 2008, 11:03 a.m.,
in response to message #1 by Namir

I was aware of it but I'm not sure I never used that particular one except in a spreadsheet program I didn't write. After using HP-71 BASIC for a couple of years, I had to use HP BASIC 5.1 on an HP-9000 series 68000-based computer and was very disappointed. HP-71 BASIC was far better in almost every way. It seemed the Colorado group could have stood to learn a few things from the Corvalis group and from the third parties that helped made HP-71 BASIC so outstanding.

Edited: 21 Dec 2008, 11:04 a.m.

            
Re: Discoverd interesting feature in HP-71B BASIC
Message #3 Posted by Namir on 21 Dec 2008, 12:10 p.m.,
in response to message #2 by Garth Wilson

Garth,

Allowing the VAL function to tap into the underlying BASIC interpreter offers the programmers and users a lot of flexibility. Working with dynamic expressions enhances the HP-71B BASIC programs. For example you can use the VAL function with regression programs that can accept user-defined transformations for the data. Using this feature makes regression programs far more flexible.

Namir

      
Re: Discoverd interesting feature in HP-71B BASIC
Message #4 Posted by Katie Wasserman on 21 Dec 2008, 12:29 p.m.,
in response to message #1 by Namir

Not to diminish the HP-71B, it's a great calculator/computer but there have been many implementations of BASIC that have EVAL-type functions, often called VAL. Even some of the simpler BASIC implementations include this, like the one in the Sinclair ZX-81.

            
Re: Discoverd interesting feature in HP-71B BASIC
Message #5 Posted by Maximilian Hohmann on 21 Dec 2008, 1:04 p.m.,
in response to message #4 by Katie Wasserman

Hello!

Quote:
... like the one in the Sinclair ZX-81.

Yes, but then the ZX-81 was a very special machine designed by a true genius. And several years before the HP-71B! I still have a chess program that fits inside the original 1kB RAM, together with just enough video memory (there was only one RAM chip in the ZX-81 used for everything!) to display the chessboard.

Greetings, Max

            
Re: Discoverd interesting feature in HP-71B BASIC
Message #6 Posted by Namir on 21 Dec 2008, 2:26 p.m.,
in response to message #4 by Katie Wasserman

I never had, seen first hand, or used the Sinclair ZX-81. I do agree that it was deigned by one smart cookie!

On The PC, I used the CHAIN MERGE trick with GW-BASIC and BASICA. I would take the user's defined function, transform that input into BASIC statements, write these statements to a temporary file, and then apply the CHAIN MERGE statement. The original user's input becomes BASIC statements on the fly. No need to stop the program, edit lines,, and restart.

Namir

      
Re: Discoverd interesting feature in HP-71B BASIC
Message #7 Posted by George Bailey (Bedford Falls) on 21 Dec 2008, 1:18 p.m.,
in response to message #1 by Namir

Also the Casio FX-850P/880P has a function called VALF that does the same trick.

These two and the 71B - all very fine machines!

            
Re: Discoverd interesting feature in HP-71B BASIC
Message #8 Posted by Namir on 21 Dec 2008, 2:18 p.m.,
in response to message #7 by George Bailey (Bedford Falls)

George,

I know the Casio 850/880 library of programs do accept user-defined functions. I was not aware of teh VALF function than can evaluate expressions in BASIC programs for these Casio machines.

Thanks! I can add these machines to my list.

Namir

            
Re: Discoverd interesting feature in HP-71B BASIC
Message #9 Posted by Dusan Zivkovic on 22 Dec 2008, 5:24 p.m.,
in response to message #7 by George Bailey (Bedford Falls)

Sharp PC-E500 (plastic thing with rubbery keys, pretty powerful, get one if you don't have it yet) - EVAL function is undocumented, but works really well both in the built-in software library (where I first stumbled upon it), and user programs.

      
Re: Discoverd interesting feature in HP-71B BASIC
Message #10 Posted by J-F Garnier on 23 Dec 2008, 10:37 a.m.,
in response to message #1 by Namir

The HP-71B Basic has also the possibility to use a variable as the target of GOTO, GOSUB and CALL statements for kind of indirect jump/call. Regular Basic had only the ON ... GOTO/GOSUB which was very limited.

With VAL, you can choose an expression to be evaluated at runtime; with this GOSUB/CALL feature, you can choose the name of a subroutine or subprogram to be executed.

Trivial example:

10 A$="KK"
20 X=2 @ CALL A$(X)
30 DISP X
40 END
50 !
70 SUB KK(X)
80 X=X+2
90 END SUB

J-F

Edited: 23 Dec 2008, 10:38 a.m.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall