The Museum of HP Calculators

HP Forum Archive 17

[ Return to Index | Top of Index ]

ISG/DSE behavior
Message #1 Posted by Don Shepherd on 17 July 2007, 3:39 p.m.

This is something that has bugged me for a long time, I believe since I bought my 16C back in the 1980’s. It has to do with the behavior of ISG and DSE. Consider the BASIC loop:

For I = 1 to 4

Next I

This corresponds to setting I to 1.004 (on a 33s and, presumably, 35s) and doing the ISG at the end of the loop. The loop executes exactly 4 times, as you would expect.

Now, consider this BASIC loop:

For I = 4 to 1 step –1

Next I

This corresponds to setting I to 4.000 and doing DSE at the end of the loop. You can’t make it 4.001 (which would be consistent with ISG) else it won’t do the last loop iteration you want.

I think that if DSE had been implemented as “DSL”, then ISG and DSL would be consistent and would work as in BASIC. But since DSL has another meaning these days, oh well.

Am I the only person in the world bothered by this? There are times when I wanted to loop down and have the final loop iteration be index 0, but that is not possible without manipulating the index within the loop, and the whole point of ISG/DSE is to not have to do that, right?

      
Re: ISG/DSE behavior
Message #2 Posted by Howard Owen on 17 July 2007, 4:05 p.m.,
in response to message #1 by Don Shepherd

DSE evolved from the earlier DSZ, decrement and skip if zero. If the loop counter has no fractional part, then DSE's behavior is consistent with DSZ. ISG was always ISG, I believe. So the inconsistency was built in from the beginning. It doesn't bother me any more than any other primitive programming construct in an RPN calc. I actually enjoy those sort of things. 8)

Regards,
Howard

      
Re: ISG/DSE behavior
Message #3 Posted by John Limpert on 17 July 2007, 5:01 p.m.,
in response to message #1 by Don Shepherd

I think the constructs are derived from assembly language on old minicomputers, not high-level languages like BASIC. Skip on condition code is a common instruction on many older systems. See the PDP-8 for an example.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall