(08-06-2017 05:40 AM)Joe Horn Wrote: (08-05-2017 11:07 PM)Geir Isene Wrote: I'm interested in this one:

HP-65

(a) Lampman Split Logic. More of an unintended feature than a bug; it allows three-way branching by splitting the shift away from shifted functions. Discovered by and named after Dean Lampman.

How does that work?

An example is worth a thousand words. Here's a "split logic" three-way branch:

1. 0

2. g X<>Y

3. GTO

4. g X≠Y

5. g X>Y

6. 3

7. 2

8. 1

This routine is equivalent to the following pseudo-code:

IF X>Y THEN GTO 3

IF X<Y THEN GTO 1

IF X=Y THEN GTO 2

Remember, the HP-65 skips TWO steps if the test is false.

What "Lampman Split Logic" does is insert one or more logical comparisons between a command prefix (e.g. GTO or STO) and its argument. It worked for all the commands (except RTN and SST) on rows 2 and 3 of the HP-65 keyboard. It therefore allowed not only short three-way branching, but also short three-way storing, and any number of combinations of functions (e.g. perform a SIN or COS depending on the result of a test) with minimal program steps.

The original write-up can be found in 65 Notes, V2 N1 P7-8 (January 1975).

I understand the cases where X>Y and X<Y but how does X=Y work? The way I see it, the execution would be step 1, 2, then, since g X<>Y is false, step 5 is next then, since g X>Y is false, step 8 is next just putting a 1 in the display and not going anywhere. What have I misunderstood?