HP-25/SR-56 Identical Conditionals
10-14-2021, 04:18 PM
Post: #12
 Dave Britten Senior Member Posts: 2,168 Joined: Dec 2013
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.
 « Next Oldest | Next Newest »

 Messages In This Thread HP-25/SR-56 Identical Conditionals - Matt Agajanian - 10-11-2021, 10:43 PM RE: HP-25/SR-56 Identical Conditionals. - Gene - 10-12-2021, 12:44 AM RE: HP-25/SR-56 Identical Conditionals. - Dave Britten - 10-12-2021, 01:52 PM RE: HP-25/SR-56 Identical Conditionals. - Gene - 10-12-2021, 03:05 PM RE: HP-25/SR-56 Identical Conditionals. - Valentin Albillo - 10-12-2021, 04:29 PM RE: HP-25/SR-56 Identical Conditionals. - Matt Agajanian - 10-12-2021, 06:20 PM RE: HP-25/SR-56 Identical Conditionals. - Valentin Albillo - 10-14-2021, 01:16 AM RE: HP-25/SR-56 Identical Conditionals. - Dave Britten - 10-14-2021, 11:38 AM RE: HP-25/SR-56 Identical Conditionals. - Valentin Albillo - 10-14-2021, 12:38 PM RE: HP-25/SR-56 Identical Conditionals - Dave Britten - 10-14-2021 04:18 PM RE: HP-25/SR-56 Identical Conditionals - Valentin Albillo - 10-14-2021, 04:49 PM RE: HP-25/SR-56 Identical Conditionals - Dave Britten - 10-14-2021, 05:00 PM RE: HP-25/SR-56 Identical Conditionals - Valentin Albillo - 10-14-2021, 06:02 PM RE: HP-25/SR-56 Identical Conditionals - Dave Britten - 10-14-2021, 07:51 PM RE: HP-25/SR-56 Identical Conditionals - Valentin Albillo - 10-14-2021, 09:33 PM RE: HP-25/SR-56 Identical Conditionals - Dave Britten - 10-14-2021, 09:36 PM RE: HP-25/SR-56 Identical Conditionals. - Matt Agajanian - 10-12-2021, 06:13 PM RE: HP-25/SR-56 Identical Conditionals. - Gene - 10-12-2021, 05:54 PM

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