Thread Closed 
HP-25/SR-56 Identical Conditionals
10-14-2021, 04:18 PM
Post: #12
RE: HP-25/SR-56 Identical Conditionals
(10-14-2021 12:38 PM)Valentin Albillo Wrote:  
(10-14-2021 11:38 AM)Dave Britten Wrote:  I've had the occasional situation on an HP where it would be nice to decrement a counter and execute the next instruction only if the counter is now zero, but it's not super common. You can usually get around it with a GTO or some test that will always be false, but it's not quite as clean.

Then post a non-contrived example which shows its usefulness and cleanness, please.

V.

I don't have a specific example on the tip of my tongue, but the general pattern usually ends up being something like this on an HP:

Code:

LBL 1 //loop start
...do some things...
DSZ 4 //decrement counter
GTO 0
GTO 9 //exit loop
LBL 0
...do some more things...
GTO 1 //loop end
LBL 9
...post-loop instructions...

i.e. when you need to decrement a counter and break out of the loop when the counter reaches its end, but you need to do this in the middle of the loop body. On a TI you can replace the exit test with something like INV 2nd DSZ 04 9' to break out of the loop when the counter hits 0. Slightly more elegant, but it's a small victory with how much less elegant a lot of programming constructs are on the TI-59/58. Wink
Visit this user's website Find all posts by this user
Thread Closed 


Messages In This Thread
RE: HP-25/SR-56 Identical Conditionals - Dave Britten - 10-14-2021 04:18 PM



User(s) browsing this thread: 1 Guest(s)