The Museum of HP Calculators

HP Forum Archive 17

[ Return to Index | Top of Index ]

HP35s - problematic INPUT(I) and INPUT(J)
Message #1 Posted by Nenad (Croatia) on 27 Aug 2007, 11:58 a.m.

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

      
Re: HP35s - problematic INPUT(I) and INPUT(J)
Message #2 Posted by Don Shepherd on 27 Aug 2007, 12:13 p.m.,
in response to message #1 by Nenad (Croatia)

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.

      
Re: HP35s - problematic INPUT(I) and INPUT(J)
Message #3 Posted by Gene Wright on 27 Aug 2007, 1:11 p.m.,
in response to message #1 by Nenad (Croatia)

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

            
Re: HP35s - problematic INPUT(I) and INPUT(J)
Message #4 Posted by Nenad (Croatia) on 27 Aug 2007, 2:47 p.m.,
in response to message #3 by Gene Wright

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.

      
Re: HP35s - problematic INPUT(I) and INPUT(J)
Message #5 Posted by Paul Dale on 27 Aug 2007, 4:41 p.m.,
in response to message #1 by Nenad (Croatia)

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

            
Re: HP35s - problematic INPUT(I) and INPUT(J)
Message #6 Posted by Miguel Toro on 28 Aug 2007, 3:07 p.m.,
in response to message #5 by Paul Dale

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

                  
Re: HP35s - problematic INPUT(I) and INPUT(J)
Message #7 Posted by Miguel Toro on 28 Aug 2007, 4:03 p.m.,
in response to message #6 by Miguel Toro

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

Sorry.

            
Re: HP35s - problematic INPUT(I) and INPUT(J)
Message #8 Posted by Don Shepherd on 28 Aug 2007, 3:25 p.m.,
in response to message #5 by Paul Dale

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

                  
Re: HP35s - problematic INPUT(I) and INPUT(J)
Message #9 Posted by Gene Wright on 28 Aug 2007, 3:56 p.m.,
in response to message #8 by Don Shepherd

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.

                        
Re: HP35s - problematic INPUT(I) and INPUT(J)
Message #10 Posted by Gene Wright on 28 Aug 2007, 3:59 p.m.,
in response to message #9 by Gene Wright

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.

            
Re: HP35s - problematic INPUT(I) and INPUT(J)
Message #11 Posted by Paul Dale on 28 Aug 2007, 4:15 p.m.,
in response to message #5 by Paul Dale

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


[ Return to Index | Top of Index ]

Go back to the main exhibit hall