Post Reply 
HP-71 BASIC funny quirks
01-27-2023, 04:21 PM (This post was last modified: 01-28-2023 08:57 AM by J-F Garnier.)
Post: #3
RE: HP-71 BASIC funny quirks
(01-27-2023 02:56 PM)Albert Chan Wrote:  What do you mean a "fix" (with quotation mark), and not a fix?
What is decompiler's initial intent?

I put fix into quotes because it seems to me (looking at the source code of 1BBBB and actual 2CDCC code) that it doesn't fix the problem but just hides it "under the carpet".

The initial intent was very likely to have a constant value embedded in program lines looks exactly as the STD output for the same number. This is how previous machines, such as the HP-75, are doing.
But there was a bug in rev. 1BBBB, that I can explain in these words: the code is combining the exponent of the number and the number of significant digits to check if the number fits in the 12-digit FIX format. The bug is that it wrongly combines a BCD number (the number's exponent) and a binary number (the number of digits). A classic bug when programming on HP processors (Classic, Nut, Saturn). So the test is inefficient and this explains that we can get constants in a FIX-like format and more than 12 digits.

For the curious people out there, the code is in the Expression Decompile module (SD&EXD):

[Image: attachment.php?aid=11713]

The 2CDCC "fix" just replaces the opcode LCHEX 012 by LCHEX 00F at 05EEE.

Quote:Perhaps a stupid question ...

Why do we even need a decompiler, if program already human readable?
Why not just saved the BASIC program, the way we type it in?

Not a stupid question at all.
On the contrary, it is the opportunity for me to elaborate.

The HP BASIC program lines are not directly readable, they are in token form, moreover the numeric expressions are stored in an internal RPN form. This explains why extra parentheses you may type in an expression are not visible when reading back the line, because internally there are no parenthesis stored, they are reconstructed when the line is displayed, and this process was called decompilation by HP, even if it's a combination of detokenisation (for keywords) and RPN-to-algebraic conversion (for internal RPN-coded expressions).

The benefit of the tokens and RPN forms is a more compact and faster executing code.

J-F


Attached File(s) Thumbnail(s)
   
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP-71 BASIC funny quirks - J-F Garnier - 01-27-2023, 08:55 AM
RE: HP-71 BASIC funny quirks - Albert Chan - 01-27-2023, 02:56 PM
RE: HP-71 BASIC funny quirks - J-F Garnier - 01-27-2023 04:21 PM
RE: HP-71 BASIC funny quirks - robve - 01-27-2023, 10:35 PM
RE: HP-71 BASIC funny quirks - robve - 01-28-2023, 02:55 AM
RE: HP-71 BASIC funny quirks - Albert Chan - 01-28-2023, 12:39 PM
RE: HP-71 BASIC funny quirks - J-F Garnier - 01-28-2023, 05:03 PM
RE: HP-71 BASIC funny quirks - brouhaha - 01-28-2023, 04:03 AM
RE: HP-71 BASIC funny quirks - robve - 01-28-2023, 02:51 PM



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