HP Forums

Full Version: HP35s - problematic INPUT(I) and INPUT(J)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Trying to port a simple (cannot be simpler) BASIC program to "the buggy little beast", such as:

INPUT N
DIM A(N)
FOR I=1 TO N
INPUT A(I)
NEXT I
END

I have faced the situation that the INPUT(I) does not work correctly in a HP35s program. It gives INVALID (I) regardless of the fact that the I points to an existing indirect variable.

The following example describes this situation:

LBL Z
10
STO I
STO (I)
VIEW I
PSE
VIEW (I) // Survives this step, showing (37) 10
PSE
INPUT (I) // Message: INVALID(I)
RTN

When I execute VIEW (I) directly from the keyboard after the program crashes, the program responds with:

(10) 10

which seems to be correct.

Maybe, I missing something here. If not, this may be very serious. Why (37) instead of (10)? Why INVALID(I) and crash for INPUT(I), when VIEW(I) does not cause crash.

The same happens if I is replaced by J in the routine-the response changes into INVALID(J).

Within the Forum I could not trace out if this situation has already been described elsewhere, simply because since HP35s arrived the amount of the posts in the Forum became enormous for me to follow properly as I used to.

To Katie: If this proves to be another bug (though I remember a similar problem with INPUT(I) already described), I feel that I will be ready to teach the beast how to dive in the Adriatic (I am beginning to hate the BLB). Yet another proof that I am not a better person than you.

Edited: 27 Aug 2007, 2:40 p.m. after one or more responses were posted

Nenad, you cannot INPUT (I) to positive values for I, only negative 1 through negative 26 (registers A-Z). The documentation in the manual is in error. INPUT (I) if I=-4 is fine.

Replace INPUT (I) with something like this:

RCL I
R/S
STO(I)

within your loop. This will prompt with the value of I into which the next keyed number will be stored.

The (37) being displayed instead of (10) is a quirk of the remapping of the indirect registers from starting at 0 and the A through Z going to negative numbers. Relatively harmless, but a quirk nonetheless.

INPUT (I) does not work with the numbered indirect registers. Only -1 through -26.

Gene

Replacing the INPUT(I) with something similar to that what Gene suggested was my first thought, but I was rather disappointed that such a simple request cannot be done in a straightforward way. I also couldn't figure out the easiest way to keep the prompt stating "which I" is to be input.

Thank you both, Don and Gene.

I've added this to the bug list.

Even more intereting is that the error only appears if the PSE instruction is included. Leave it out and the program stops and works properly. I.e.

LBL Z
10
STO I
STO (I)
VIEW I

- Pauli

Pauli,

I do not have this behavior in my '2361. Both versions, with and without PSE, work just fine. Maybe a Reset is necessary :-)

Miguel

Maybe I am misunderstanding the problem, but I think the problem is in the INPUT (I). Your code does not have that.

Two issues here, one is with the INPUT (I) itself, the other with the VIEW (I).

When you do a VIEW (I) in a program followed by a pause, the prompt shown by VIEW is off by 27 units.

Where it should show "(10)=", it actually shows "(37)=".

It is off by 27.

Not having a good day.

That snip of code now does appear to work correctly, but I have seen the value for (I) be off by 27 units.

As I say, I'm having a bad day.

Now I see: It is VIEW (I), not VIEW I in Pauli's example.

Sorry.

Sorry guys, I got the program wrong:

LBL Z
10
STO I
STO (I)
VIEW (I)

That is the last line has brackets around the I.

- Pauli