Post Reply 
Raw files for these HP 67 program listings ?
09-06-2016, 10:35 PM (This post was last modified: 09-06-2016 11:05 PM by RobertM.)
Post: #40
RE: Raw files for these HP 67 program listings ?
(09-05-2016 07:33 PM)Dieter Wrote:  I have been looking at the same program. It has some specialties that should (or even have to) be handled differently on the 41. For instance there is a GTO(i) command, while the I-register holds a –2 (set in the startup routine). This uses the "fast reverse branching" feature of the 67/97 which cannot be duplicated on the 41. On the other hand it does not have to – the GTO(i) jumps to the instruction directly after LBL 2, so a simple GTO 02 works just as well. The whole thing (test and jump back) is not even required at all since it simply tests if the last random number is zero. This could be avoided by directly generating a number between 1 and 9 instead of one between 0 and 9. #-)
I agree with all of your comments here. I removed the use of the I reg, and changed the random number generator to generate between 1 and 9.

Quote:The initialization routine (LBL e) clears all (!) data registers. On a 41 this is not a good idea. As far as I can see clearing only R00 and R02 is sufficient. The registers from A to E hold some constants that are used later. Instead of R20...R24 the HP41 version should use R10...R14.
Agreed. I also found only clearing 00 and 02 were needed, and I left it in the init routine (LBL e) instead of the "preamble". I changed RegA-E into R10-14. Technically, we could shave off a couple more registers, since R03 and R05 aren't used, but I left it as is, so only SIZE 015 is required.

Quote:Maybe we can compare our versions later. ;-)
Love to! I've included my fully commented version in the zip. Love to see what you did the same/differently.

Here are my two versions of One-armed bandit: "OB67" requires SIZE 026 and a card reader. "OB" requires SIZE 015 and no card reader. Both seem to give a similar feel to the 67 version.

Here is a list of my changes for the "OB" version:
Code:

- added preamble
- translated 7xxx calls into 41C calls (no card reader required)
- translated A-E storage registers to 10-14, removed need for I (SIZE 015)
- fixed bug: original program left out a multiply at line 68 (otherwise not holding
   digit 1 when there are other holds will always result in a 1 being the first digit)
- translated rapid reverse branch in LBL 02 to a GTO 02, removed setting and usage of R15
- used a FS?C 01 instead of separate FS? 01, CF 01 to save a byte or two
- changed CLRG in LBL e to clear just 0 STO 02, STO 00
- removed LBL 01 and moved the random number generator directly in LBL 02. Note: reused
   LBL 01 as local forward branch in LBL 09
- changed random number generator to generate between 1-9, instead of looping if 0.
- changed the test logic for winners in LBL 09: once tested for .11 and succeeded
   don't need to test .123 (can't be) so just recall pulls left and return.

For Gene: Note that there appears to be a bug in the original HP67 listing (your listing as well as the one in PPCJ V4N9P13). It is a missing "multiply" around line 68 ... the program recalls a constant 100 but fails to mulitply it by the digit, so rather than multiply the new digit by 100, you just get the number 100. Kindof annoying - you press B and C to HOLD them hoping to regenerate the first digit, but you always get a "1" as the new digit. I have fixed this is both the OB67 and OB versions.

Both of these versions take 285 bytes


Attached File(s)
.zip  OneArmedBandit.zip (Size: 4.84 KB / Downloads: 4)
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Raw files for these HP 67 program listings ? - RobertM - 09-06-2016 10:35 PM



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