The Museum of HP Calculators

HP Forum Archive 16

[ Return to Index | Top of Index ]

HP 33S programming
Message #1 Posted by Antonio Maschio (Italy) on 6 Apr 2006, 5:31 a.m.

Hi everybody.

Don't you find rather silly that HP 33S has more than 30kb of memory and only 26 unduplicable labels?

I used to duplicate labels with my HP 11C, since the program searched forward for the label and, though there were only 16 of them (0÷9 + A÷F), memory was the real limit.

Now, it seems that HP designers have pulled the cover, leaving the other side naked: huge memory (who can fill all that bytes?) and poor programming practice. Add you cannot (as far as I know) operate a GTO directed to a specific line (a thing old calculators could do, backward and foreward). Do you know any workaround for this?

Regards.

-- Antonio

      
Re: HP 33S programming
Message #2 Posted by bill platt on 6 Apr 2006, 8:47 a.m.,
in response to message #1 by Antonio Maschio (Italy)

Quote:
Don't you find rather silly that HP 33S has more than 30kb of memory and only 26 unduplicable labels

No, I don't. I see the 33s as a SLEP (service life extension program) for the 32sii concept. The extra memory (equiv to more like 7kb of 32sii) vastly improves the use of the keystroke model. Whereas on the 32sii you would frequently have to discard routines, on the 33s you don't have to.

Regarding repeated labels, this is, again, not a limitation brought on by the 33s; it is also there in the 32s, and so is the GTO line number limitation.

There was a conscious change going from voyager to pioneer, implementing labels rather than line numbers. Labels are more foolproof and easier to proofread.

I see line number GTO as a "poor programming practice" not the other way around. Line number GTO is a sloppy way to program, don't you think?

Regards,

Bill

Edited: 6 Apr 2006, 8:47 a.m.

            
Re: HP 33S programming
Message #3 Posted by Antonio Maschio (Italy) on 6 Apr 2006, 9:09 a.m.,
in response to message #2 by bill platt

Quote:

I see line number GTO as a "poor programming practice" not the other way around. Line number GTO is a sloppy way to program, don't you think?


Yes, I do, but only if more than 26 GTO/XEQ could be available; if not, why not jumping directly to a well known step, saving at least that label?

Regards

-- Antonio

                  
Re: HP 33S programming
Message #4 Posted by bill platt on 6 Apr 2006, 9:42 a.m.,
in response to message #3 by Antonio Maschio (Italy)

I think you have to get over the obsession with the number of labels. You just have to accept that that is the limitation.

There is no "optimum" ratio between number of available labels and amount of memory. It is a programmable calculator, not a computer.

:-)

      
Re: HP 33S programming
Message #5 Posted by Thomas Okken on 6 Apr 2006, 9:44 a.m.,
in response to message #1 by Antonio Maschio (Italy)

Quote:
Don't you find rather silly that HP 33S has more than 30kb of memory and only 26 unduplicable labels?

I suspect that the original plan was for the 33S to have less RAM, but the larger RAM chips became so inexpensive (or, the smaller RAM chips became so hard to get) that they went with the large memory size instead.
Upgrading the 33S programming model to take advantage of the extra space was not deemed worthwhile. Maybe someone in the boardroom muttered "HP-42S" under their breath and everyone else took the hint.

- Thomas

            
Re: HP 33S programming
Message #6 Posted by Wayne Brown on 6 Apr 2006, 12:55 p.m.,
in response to message #5 by Thomas Okken

Quote:
Maybe someone in the boardroom muttered "HP-42S" under their breath and everyone else took the hint.

I doubt anyone in the boardroom would know what an HP-42S is, much less anything about its capabilities.

      
Re: HP 33S programming
Message #7 Posted by Vieira, L. C. (Brazil) on 6 Apr 2006, 1:56 p.m.,
in response to message #1 by Antonio Maschio (Italy)

Hi, A. Maschio;

indeed, the LBL A to Z limitation is something we have to deal with... I do not like it, but in many cases, such limitations lead us to try finding other ways.

Last year, one thread brought this issue up and I suggested one possible workaround. If the program you are writing deals with math expressions and you have to conditionally evaluate one expression having two possibilities you could use the following sequence:

.....
F0001 LBL F start of program section
F0002 X=0?   (or any other conditional)
F0003 GTO G
.....        program steps with 1st. expression
             (when X not equal zero)
Fxxxx GTO H
G0001 LBL G
.....        program steps with 2nd. expression
             (when X equals zero)
H0001 LBL H
.....        remmaining, common part of the program
My suggestion is based on the HP33S ability to handle algebraic expressions as program steps. In this case, we may have an equivalent to the above steps as follows:
.....
F0001 LBL F  start of program section
F0002 CF 0   (explainned below)
F0003 X=0?   (the same conditional)
F0004 SF 0   (explainned below)
F0005 FC? 0  (explainned below)
F0006 1st. expression, algebraic notation  (when X not equal zero)
F0007 FS? 0  (explainned below)
F0008 2nd. expression, algebraic notation  (when X equals zero)
F0009        remaining, common part of the program
This way, labels G and H are not used and the program keeps functionality. The reason why flag 0 is used here is because the algebraic expressions in a program step return their final value when the related program step is executed. This is the same as if you press the [=] key at the end of the keystrokes used to evalualte the expression. So, if the first expression is evaluated, the value in the X-register you need to compare to zero in order to avoid the second expression to be evaluated too will not be there. Then we need to 'signal' if the conditional 'X=0?' returns true or false, and this is done in steps F0002 to F0004.

If the program performs other sort of operations that cannot be converted into algebraic manipulations and/or expressions, these suggestions may not apply.

Hope this helps.

Cheers.

Luiz (Brazil)

Edited: 6 Apr 2006, 2:01 p.m.

            
Re: HP 33S programming-good ideas!
Message #8 Posted by bill platt on 6 Apr 2006, 2:28 p.m.,
in response to message #7 by Vieira, L. C. (Brazil)

Thanks, Luiz :-)

            
Re: HP 33S programming [flag functions]
Message #9 Posted by Karl Schneider on 7 Apr 2006, 1:53 a.m.,
in response to message #7 by Vieira, L. C. (Brazil)

Hi, Luiz --

Your snippet of code won't quite work exactly as written, because the HP-33S has no "is flag clear? [FC?]" function. Only the HP-41 and HP-42S have six functions -- SF, CF, FS?, FC?, FC?C, FS?C -- the rest, to my knowledge, have only three: SF, CF, FS?.

However, your idea is good, and I had incorporated something very similar in the final version of the the AC Power Transfer program for the HP-32S, HP-32SII, and HP-33S (RPN and ALG modes) in the MoHPC Software Library:

I replaced something like:

S0007  FS? 2 
S0008  GTO T
S0009  INPUT R 
S0010  INPUT X
S0011  INPUT B
S0012  GTO C

T0001 LBL T T0002 XEQ Z T0003 CF 2 T0004 GTO C

C0001 LBL C

with the following:

S0007  FS? 2       
S0008  XEQ Z       
S0009  FS? 2
S0010  GTO C
S0011  INPUT R     
S0012  INPUT X
S0013  INPUT B
S0014  GTO C

C0001 LBL C C0002 CF 2

thereby saving a line and a label. I'm rather proud of that program, and don't mind saying so:

  • It is modular -- each of the four labels serve as bona fide entry points to a specific part of functionality which can be directly accessed by the user.

  • Its input is user-friendly -- each input variable is prompted by INPUT, and the user may alter the entire stack for interactive calculations when the program is paused, without affecting the program's results.

  • It makes generous use of the the four models' complex-number functionality, which is admittedly awkward for interactive calculations, but very nice to have for programming.

  • The four versions I have prepared are optimized for the respective three calculator models, but the HP-32S version is completely portable to the HP-32SII and HP-33S.

I concede that only those in the field of power engineering (or studying it) would have any use for the program. However, some good programing concepts can be found in the code listings.

Cheers,

-- KS

Edited: 7 Apr 2006, 2:23 a.m.

                  
Oops! (was: HP 33S programming [flag functions])
Message #10 Posted by Vieira, Luiz C. (Brazil) on 7 Apr 2006, 4:02 a.m.,
in response to message #9 by Karl Schneider

Hi, Karl;

thank you for your corrections. I completely forgot about that.

In your program (very well written, indeed) you ingeniously explore the HP33S resources. I remember I loaded your load-flow at the time you posted it and it ran smoothly. The kind of program structure I like seeing.

Anyway, you pointed out to another solution in my listing. Since the HP33S has 32KRAM, using a bit more program steps won't hurt, right? So...

...
F0001 LBL F  start of program section
F0002 CF 0
F0003 SF 1  (complementary conditions)
F0004 X=0?  (if X equals zero...)
F0005 SF 0  (then set flag 0)
F0006 FS? 0 (if flag 1 set, i.e., X equals 0...)
F0007 CF 1  (then clear flag 1)
F0008 FS? 1
F0009 1st. expression, algebraic notation  (when X not equal zero)
F0010 FS? 0
F0011 2nd. expression, algebraic notation  (when X equals zero)
F0012        remaining, common part of the program
Yes, I know it is a lot of extra steps, but the two labels are still preserved for future use. And if flags 0 and 1 have only local meanning, they can be used in other structures like this one.

Again, when you have few resources, you need more creativity.

Best regards.

Luiz (Brazil)

Edited: 7 Apr 2006, 4:03 a.m.

                  
Re: HP 33S programming [flag functions]
Message #11 Posted by James M. Prange (Michigan) on 7 Apr 2006, 10:35 p.m.,
in response to message #9 by Karl Schneider

Quote:
Only the HP-41 and HP-42S have six functions -- SF, CF, FS?, FC?, FC?C, FS?C -- the rest, to my knowledge, have only three: SF, CF, FS?.
Although, of course, all of the RPL models have all six of these commands.

Regards,
James


[ Return to Index | Top of Index ]

Go back to the main exhibit hall