Post Reply 
Bug in the HP-41 with R/S and stack lift
10-31-2020, 06:03 PM (This post was last modified: 10-31-2020 06:05 PM by hth.)
Post: #10
RE: Bug in the HP-41 with R/S and stack lift
I think that normally you want stack lift to be enabled when pressing R/S, as it allows two identical numbers to be entered on the stack like:

Code:

42
ENTER
RUN

You expect this to be two numbers when starting the program and it should be allowed for the program to push a number the first thing it does without disrupting your two entered values. That is consistent with any built in function like PLUS.

The manual is not the law, it merely documents the behavior of the implementation.

What is a bug (in my view) is that it does something wrong, unintentional by design or possibly something weird you would never expect.

I still think it is a bug, but it is by design and not really fixable as it would break other desired behavor. The cure would hurt more than the problem.

It is true that you seldom have stack lift disabled in a running program. Only CLX and ENTER do it and they are not so common in programs unless you are a newbie.

How I found it? Well, I did not manage to trip it by accident. I was debugging a replacement for the R/S key (for the Boost module) and single stepped the whole thing in VS Code and stepped into the NWGOOS (new goose, LoL) and noticed that it ends with a jump to NFRPU (normal function return, set push flag) like most functions. It just clicked in my head, what happens if a program looks like this and I stop and restart it at the "wrong point"? It took about 10 tries using a trivial (made for the purpose) program to trip the unexpected behavior.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Bug in the HP-41 with R/S and stack lift - hth - 10-31-2020 06:03 PM



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