HP35s meaning of indirect address 0/hp32sii keyboard



#25

Hi Forum,

proud owner of the new 35s since a few days, I'm a bit puzzled by the indirect variables 0-800. I came accross the VIEW(I)/VIEW(J) bug, but that was already described earlier in

the 48g forum

I'd also like to apologize if this has been brought up before, but I could not find it back in the forum. It seems that some editing took place, e.g.

for this message.

Now, I wrote the little program to delete all indirect variables

Length=30, CHKSM=EE33

C001 LBL C
C002 0.800
C003 STO I
C004 0
C005 STO (I)
C006 ISG I
C007 GTO C004
C008 RTN

to obey the point 2. on page 14-24 of the manual. However, after runnung the program, the number of variables is still > 700 according to the MEM menu, and only after saying

0
STO I
STO (I)

(which takes .5 seconds or so) the memory used by indirect variables
is gone. (memo to HP: in the HP35Sii, there should be a CLR INDIRECT or so in the MEM menu.)

So, is there a special meaning for (0)?

On another point: I bought the 35s, which appeard at the right moment, as a replacement for my 32Sii, whose keys started to fail. I took it apart following

these instructions

an will glue in a little slice of rubber to make the case press against the board.

On that occasion, I noticed that the 32S can also display messages using equations and flag 10. Was this a documented feature?

Thanks for reading this up to here,

yours sincerely, Peter.


#26

I made that point (about clearing indirect registers) before, but the post seems to disappeared... Assuming we've got 50 in reg 50 that makes MEM to report 51 indirect regs. As you've noticed those can be cleared and memory reclaimed at once only if you did store 0 in reg 0 *after* doing so for the rest of them ???


This works:

U001 LBL U
U002 50
U003 STO I
U004 CLSTK
U005 STO(I)
U006 DSE I
U007 GTO U005
U008 STO I
U009 STO(I)
U010 RTN

Cheers,

Reth

#27

Quote:
I made that point (about clearing indirect registers) before, but the post seems to disappeared...

It will show up again. Meanwhile, Google cache has it, or most of it:

http://64.233.169.104/search?q=cache:c6RWHlRT3awJ:www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/forum.cgi%3Fread%3D120509+site:hpmuseum.org+Reth+%2B+%22INPUT+(I)+bug%22&hl=en&ct=clnk&cd=2

Regards,

Gerson.


#28

Thanks Gerson, now I saw it there.
Cheers,
Reth

#29

p 1-5 CLVARx to clear indirect bank.


#30

I've missed that, thanks; MEM still reports 1 indirect register available - the *0* one :) so - back to
0
STO I
STO(I)
Cheers,
Reth



and also CLVARx does not work in a program... so - back to the above :)

Edited: 18 Aug 2007, 5:46 p.m.


#31

Yes, CLVARx clears the indirect registers GREATER than the number given to it as an argument.

So, give it a 0 and it clears 1 and up.

It is mentioned on page two of the indirect register learning module found here:

Indirect register learning module for the 35s


#32

Thanks, Gene, but that's not the point; The point is (given we have 50 in reg 50) - after :

Q001 LBL Q
Q002 0.05
Q003 STO I
Q004 CLSTK
Q005 STO(I)
Q006 ISG I
Q007 GTO Q005
Q008 RTN
MEM reports 50 regs and :

49
STO I
RCL (I)
doesn't give an error messsage

Regards,
Reth

Edited: 18 Aug 2007, 6:30 p.m.


#33

To be fair, having the calculator report 50 registers makes complete sense.

When you store a value in to a register, the indirect register memory block is essentially a contiguous array of values.

If you stored a value in register 50, the calc allocates a block of memory up to and including 50. That's why you don't get an error for accessing register 49 -- it's already there (I dunno if you would get an error for 51, I've not played with a 35s).

Otherwise it would have to keep track of not just stored values, but "dirty" values, which would simply consume yet more memory, and access would be even slower than it may be now.

If the calculator kept track of individual registers, it would need to track their number and their location in memory. If you wanted to fetch the value, the calculator would then have to look up the list of "used" registers for the register you wanted, and look up it's actuall address, and finally the value. That's a lot of looking up!

Instead, HP traded memory for speed, being conscious of the fact that most folks would be doing most of their register dancing at the lower limits (who uses register number 743 in normal work anyway?), and that they'd most likely use contiguous blocks of registers (since they're easily leveraged as arrays).

This technique simply gives better performance, a reasonable trade off, and makes overall memory management much easier.


#34

You've missed the point - 0 has been stored in all indirect registers and still the system reports their existence. Storing 0 in I and 0 in (I) fixes it, system reports 0 indirect registers.


#35

Hmm. Yes, I had seen the point you were making. I was just commenting on the CLVARx portion. :-)

Try this...do the loop counting down rather than up and see if that does it differently.


#36

I did, just look a few posts up; Looping down lives 1 register intact - reg 0; Looping up leaves all 50; In both cases if you don't store 0 in I and then indirectly 0 in (I) *at the end of the process* you don't get the expected 0 indirect regs. That makes me and the original poster to think about "special" meaning of the 0 register, features, bugs, misprints etc, etc, etc... :)

cheers,


reth

#37

Thanks! And thank you for not posting RTFM!

Cheers, Peter.

#38

I have question about indirect variables. I read manual, but I little confused. It say it variable that not defined beforehand. Is this like temp variable in programming that only there when program run and gone after. Or is this like not declaring a variable? Then further in manual it say is useful for controlling loops. So is it like array?

I guess I just not understand what I and J be. Can someone give me simple explanation and why I might use it.


#39

Vincze, refer to the link in Gene's post in this thread. You really need to be looking at those training modules since he has already done the work of explaining these topics to those who do not understand them.


#40

Thank you my friend, I will do.

#41

Ok, I read Gene's article, but now I more confused. On page two of Gene's article, it say

Quote:
This becomes very useful is when you need to work with a lot of numbers, often within programs, or or when you may not be able to know in advance where the number you wish to use is stored.

How you not know where to store value? When I write program, I create variables that I name, and I store value there. How someone not know where to store value if you declare variables. I think I missing very fundamental point of this, so please excuse me being ignorant.


#42

Google "indirect addressing"


#43

Okay, I say fervent prayer to Saint Google and see what he have to say.


#44

Okay, I understand now. It basically an indirection array. That make sense to me now. Not sure when I would use on calculator, but, it nice to have.


#45

Vincze,

You might enjoy reading about programming on the HP-41C. There was a link not long aog here to a complete HTML facsimilie of the manual.

The 41 makes large use of "indirection" as it is known. It is useful for more than just getting to the "extra" registers.

Best regards,

Bill


#46

My friend Bill, thank you for that suggestion. Yes, I do remember that link, and I shall see if I can track it down and look into that. It would be nice to conceptualize why I might use indirection on calculator. In programming I have used many times, but I just can't grasp why I would use on calculator.


#47

Hi Vincze,


Quote:
It would be nice to conceptualize why I might use indirection on calculator. In programming I have used many times, but I just can't grasp why I would use on calculator.


Indirection is great to use to pass a parameter of several memory locations to a subroutine.

For example:

Several years ago, I was writing a program to calculate the psychometric properties of air. I had several subroutines that would be called for each of the air streams - Outside Air, Room Air and Mixed Air. Instead of trying to pass all the variables on the stack, I would pass only the single index value. For example, 10 for Outside air, 20 for Room Air and 30 for Mixed air.

For each of the air streams, the parametes were stored in sequential memory locations - R11-15, R21-25, and R31-35. The subroutine would then use the index variable to extract and work on the respective air stream. The results could be stored in R16-19, R26-29, R36-39.

A similar method was then used to printout the results - a single subroutine that used the index to determine which air stream to print.

It worked great. Unfortunatelly, I got sidetracked about halfway through the project and never finished the program. Still want to get back to it one of these days.

Bill


#48

Hi Vince,

another use of the indirect variables is to use it as a parameter stack when recursively calling a subroutine. (Like a higher language does for you in the background.) As an example, see

Towers of Hanoi on the HP32s

(I apologise for this self-promotion)

which shifts around the towers of Hanoi using a recursive prescription:

void move (int n, int source, int target) {
if (1 == n) {
std::cout << "Move disk from " << source << " to " << " target
<< std::endl;
return;
move (n-1, source, 6-target-source);
move (1, source, target);
move (n-1, 6-target-source, target);
}

Or, maybe a bit simpler: Factorials: n! = n * (n-1)!

[pre]
int factorial (int n) {

if (n <= 1) // we're done and know the answer
return 1;

return n * factorial (n - 1);
}

Of course, these are more academic examples, in real life things might be done differently.

Other (more down to earth application) could be a chi-square test

(wiki article here)

where you use the indirect variables to represent a histogram with a previously unknown number of bins.

Cheers, Peter.


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP35s Program Four Slings Lift Calculation Jean-Marc Biram (Australia) 2 437 12-16-2013, 07:21 PM
Last Post: Jean-Marc Biram (Australia)
  HP35s Calculator Max Rope Tension Program Jean-Marc Biram (Australia) 10 817 12-12-2013, 12:03 AM
Last Post: Jean-Marc Biram (Australia)
  New website address for Meindert Kuipers' MLDL2000? Garth Wilson 2 269 08-11-2013, 01:43 PM
Last Post: Meindert Kuipers
  HP41 Functions Address Table (F.A.T.) Antoine M. Couëtte 6 438 07-21-2013, 02:48 AM
Last Post: Antoine M. Couëtte
  WP34s indirect addressing of alphanumeric labels Eduardo Duenez 4 390 06-06-2013, 08:29 PM
Last Post: Eduardo Duenez
  Trouble entering a HP35s program line Arno 2 291 04-05-2013, 06:28 PM
Last Post: Arno
  HP35s scientific calculator GREG W THOMAS 4 385 03-22-2013, 06:49 AM
Last Post: Thomas Radtke
  Cheap hp32sii in bad condition on sale on Taobao Waon Shinyoe (China) 1 239 03-01-2013, 08:35 PM
Last Post: Raymond Del Tondo
  HP35s "MEMORY CLEAR" flashes Mark Paris 1 249 08-31-2012, 07:35 PM
Last Post: Bart (UK)
  HP32SII takes 120 to process a command Bruce Larrabee 2 246 08-25-2012, 05:42 AM
Last Post: Bruce Larrabee

Forum Jump: