Post Reply 
4K HP 67 Games rom attached for testing
10-27-2016, 12:30 PM (This post was last modified: 10-27-2016 01:09 PM by Dieter.)
Post: #15
RE: 4K HP 67 Games rom attached for testing
(10-26-2016 10:37 PM)Gene Wrote:  Note: The G2636 program has a couple of steps that are tough for me to think through how to translate. They show in steps 38-45:

RCL 01
33
X<=Y?
7ISZ
7
-
X<=y?
7ISZ

So if the first X<=Y? instruction is true, it wants to add 1 to memory register 25 and skip if the contents are equal to zero.

My confusion is that the HP 41 equivalent is ISG. Increment and skip if GREATER than zero.

Although it is true that ISZ skips if register I is zero after the increment, I have never seen this used in a real-world HP67/97 program. And it's the same here: the I-register is never zero, and ISZ is used as a simple increment function, like in all other programs I've seen yet. And that's what you also said:

Quote:In this circumstance, the HP 67 would skip the next step ONLY if memory 25 were 0, which it is not. So the HP 67 code is merely adding 1 to register 25.

Right. So on an HP41 you can try this:

Code:
RCL 01
33
X<=Y?
ISG 25
LBL 10   ; NOP-dummy 
7
-
X<=Y?
ISG 25
LBL 10   ; NOP-dummy

You should be able to use a lower register number instead of 25 since the program uses only registers 0...5 and then A, B, E and I. Turn the latter four into 6, 7, 8 and 9 and you're done. This way the ISZ becomes ISG 09.

At LBL 2 (step 075 of the original program) register I is set to 0.5. Unlike the 67/97, the HP41 ISG and DSE commands use the fractional part to control the loop counter's increment and final value. But this does not harm here since the increment is still interpreted as 1 and the final value against which the counter is checked is set to 500. I do not think that this value is ever reached: within the program the counter is set to 0.5 or 1 and then incremented by 1. After all this value is the amount the player wins, and that's something between 0 and 2 $.

(10-26-2016 10:37 PM)Gene Wrote:  On the HP 41 not using the card reader translator function, it would add 1 to memory 25 and then almost certainly skip the next step if register 25 held 5, 10 or 15 as its value.

?!? Why should ISG kip if the register is 5, 10 or 15?

(10-26-2016 10:37 PM)Gene Wrote:  The alternative of 1 ST+25 isn't good here since it disturbs the stack.

As far as I can see there is always as least one stack level left.
So ln really desperate cases you could do this:

Code:
RCL 01
33
X<=Y?
XEQ 99
7
-
X<=Y?
XEQ 99
...
LBL 99      LBL 99
1           SIGN
ST+ 25      ST+ 25
*           X<> L
RTN         RTN

The second LBL 99 version is more elegant but requires x>=0.

And finally here's a completely different approach. The mentioned program part adds 1 to register I if R1 is at least 26, and it adds 2 if it is 33 or more. Here my favorite solution would be this:

Code:
RCL 01
19
-
7
/
INT
X>0?
ST+ 25

Or, even better, rewrite the complete evaluation routine from step 038 to 062 of the original program. That's a clean solution that can be done without any ISZs. Maybe I'll try this later today or at the weekend.

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: 4K HP 67 Games rom attached for testing - Dieter - 10-27-2016 12:30 PM
HP-67 AOS program to debug - Gene - 10-30-2016, 02:11 AM



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