HP Forums
33S: new programming strategy - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: 33S: new programming strategy (/thread-57015.html)

33S: new programming strategy - kc - 05-15-2004

For all of us who have learned programming, be it computer or calculator programming, the two most important keys to writing good programs are (1) to maximize program running speed; and (2) to minimize program space. With the introduction of HP 33S, a totally new strategy comes up where nobody have never meet: to minimize the use of label while not worrying too much about program space. For instance, in the past, when you want to write a program to loop several times, you'd write something like:
Lbl L
1.07 STO Z
Lbl M
Xeq A
Gto M

And now, you'd rather save one label by writing something like:
Lbl L
Xeq A
Xeq A
Xeq A
Xeq A
(Of course, whether it should be changed depends on how many times it loops and how long is the program code in between the loop)

When I got the HP32SII, I looked at the manual, and found out that most example programs in the manual already occupied most of the memory. Now I've acquired the 33S, and look at the manual, and found out most of the programs use up a lot of labels! So limitations are still there, though they are different.
I wonder if there would come up in this forum, or new books about techniques that could minimize the use of labels for programming 33S.


My take on why calc programs use lots of labels (slighty OT) - Cameron Paine - 05-15-2004

This doesn't apply to the 33s per se.

For many of us HLL programmers, the most succinct and unambiguous expression of an algorithm is in the HLL with which we are most conversant. Sometimes this is laziness; oftentimes it's because we've solved that class of problem before and we know that our coded solution works. (As an aside, cut and paste remains the dominant method of code reuse IMO).

If you attempt to hand-convert an algorithm expressed in a HLL to low-level code for an assembler, you will find that you end up with a *lot* of labels. I encounter this often as I go from Java or C++ to H8 ASM. So, to optimise for memory footprint, you *have* to re-implement the algorithm for the target platform (calculator, ucontroller or PIC).

Perhaps the writers who created the 33s examples simply re-implemented them from existing HLL code.


HLL - high-level language

Re: 33S: new programming strategy - bill platt - 05-15-2004

Some have definitely already though about this, and their ideas have been posted here on this forum (some stuff at comp.sys.hp48 too but more here!)

Go to the latest archives, and search for 33s and you will find many threads.



Also search in the current forum, and you will find more.


One idea is to use equations as space-holder labels for programs that are being "stored" but not actively run. The can describe what follows. Of course The line-numbering is strange when you do this----but it can work---thoug hyou really need a little notebook to keep track (which the 33s slipcase is great for carrying with the calc--along with a pencil!).

There are definitely at least one post which directly discusses how to turn subroutines into one program.

Good luck in your search!



Re: 33S: new programming strategy - bill platt - 05-15-2004