Raw files for these HP 67 program listings ?
|
09-06-2016, 10:48 PM
Post: #41
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
(09-05-2016 04:26 PM)RobertM Wrote: I'm going to take a swing at the One Armed Bandit next. It's a holiday today, so I may not get to it until tomorrow. Here's my attempt at this program. It includes a lot of streamlining which makes the program more compact, it also uses less registers: In the original program registers A to E hold some constants that are only used once (!) in the program, reg. A is even not used at all. So instead of a RCL the constants have been inserted directly into the code. Also registers 3 and 5 remained unused, so I replaced reg. E with R05 (R03 still is not used). This way the 41 program is shorter and requires significantly less registers than the original 67 version. The attached zip file contains a listing (.TXT) and a .RAW file. Maybe someone can do some tests and compare this version with the original one. If you find errors, please report here. Dieter OABANDIT.zip (Size: 1.17 KB / Downloads: 5) |
|||
09-06-2016, 10:59 PM
(This post was last modified: 09-06-2016 11:37 PM by Dieter.)
Post: #42
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
(09-06-2016 10:35 PM)RobertM Wrote: 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. Great. Please see my post that I seem to have written while you wrote yours. ;-) (09-06-2016 10:35 PM)RobertM Wrote: Love to! I've included my fully commented version in the zip. Hmmm... I do not see any zip file. ?!? (09-06-2016 10:35 PM)RobertM Wrote: Love to see what you did the same/differently. I did some similar changes and added some others (e.g. removing register A...E completely since the are only called once). But you seem to have analyzed the code more thoroughly so that even a bugfix was applied. Maybe we can make an optimized version from the two individual ones. ;-) (09-06-2016 10:35 PM)RobertM Wrote: Here is a list of my changes for the "OB" version: This can be reduced to SIZE 010, or even 009 if in my version R9 is replaced with the last unused register 03. (09-06-2016 10:35 PM)RobertM Wrote: - fixed bug: original program left out a multiply at line 68 (otherwise not holding I knew there was something wrong but I didn't know what. #-) EDIT: I see you now added the zip file. Let me add these remarks on OB_commented.txt: - The init routine at LBL e sets the constants 0.11, 111 and 123. On the other hand at LBL 9 where these constants are used the comment says 0.111 and 0.123. ?!? BTW the "1000" in R10 is never recalled, so it can be removed completely. - The CF 3 at LBL D resets flag 3 simply because it has been set automatically when the user entered the payment (flag 3 on the 67 does the same as flag 22 on the 41, it's the data entry flag). - Clearing all flags on startup at LBL"OB" is fine, but not required since the init routine at LBL e already does this: it calls LBL b which clears all flags. Dieter |
|||
09-07-2016, 04:11 AM
Post: #43
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
(09-06-2016 10:59 PM)Dieter Wrote: I did some similar changes and added some others (e.g. removing register A...E completely since the are only called once). But you seem to have analyzed the code more thoroughly so that even a bugfix was applied.Great idea! See below... Quote:- The init routine at LBL e sets the constants 0.11, 111 and 123. On the other hand at LBL 9 where these constants are used the comment says 0.111 and 0.123. ?!?Bad comments. Typos with extra heavy on the '.' key. Quote:BTW the "1000" in R10 is never recalled, so it can be removed completely.Had that in the back of my mind, but forgot to do anything about it. Good idea. Quote:- The CF 3 at LBL D resets flag 3 simply because it has been set automatically when the user entered the payment (flag 3 on the 67 does the same as flag 22 on the 41, it's the data entry flag).Thanks, I'd forgotten that. Which means that the CF 03 can be removed, because on the 41, it doesn't get set with data entry (and it isn't being tested, so don't need to change it to a flag 22 test). Quote:- Clearing all flags on startup at LBL"OB" is fine, but not required since the init routine at LBL e already does this: it calls LBL b which clears all flags.Nice catch. Didn't notice. So I've incorporated an "optimized" version of your comments/changes and mine. I moved the "constants" what were only being used once from register to direct in the program. I changed the constant 100 to use R05 instead of R10, and I moved R09 into R03, so now SIZE 009 is all that is required. Also, incorporated all of your other suggestions and things I noticed from your code (*4 instead of /.25, etc.). I think I captured everything. Enclosed in this OB.zip is the optimized version (.RAW, .txt, and _commented.txt). This version requires only 9 registers, and is down to 260 bytes, but still "feels" the same. Thanks for all the help. Let me know if you see something else. |
|||
09-07-2016, 05:16 AM
Post: #44
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
(09-07-2016 04:11 AM)RobertM Wrote: Enclosed in this OB.zip is the optimized version (.RAW, .txt, and _commented.txt). Got it, will try to squeeze it in the module but it's looking very full... "To live or die by your own sword one must first learn to wield it aptly." |
|||
09-07-2016, 01:54 PM
(This post was last modified: 09-07-2016 02:09 PM by Dieter.)
Post: #45
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
(09-07-2016 05:16 AM)Ángel Martin Wrote: Got it, will try to squeeze it in the module but it's looking very full... Here is a shorter version with some improvements and maybe even a bugfix: - I think there is a bug in the original program: if there are any holds the user can pull the lever even if there are no no more pulls available. This is tested right *after* checking for holds, while the test should be *before* this. I changed this in the attached version. If this is not the way the program is supposed to work, please correct. - XEQ b is called only once by the init routine so LBL b can be placed there and requires no separate call. - R05 (=100) is recalled three times. Replacing this with R04^2 saves two bytes in the init routine and requires three more bytes in the code. At the same time it frees up another register for the cost of just one single byte. This way registers 6...8 move down to 5...7 and SIZE 008 is sufficient. - The only jump to LBL 03 is done after testing flag 0, so the following CF 00 can be omitted by replacing the flag test with FS?C 00. - The test for holds can be done more efficiently and faster. The current version tests for a hold on a particular digit, and if true it jumps to a forward label, and finally jumps back to test the next digit. This is slow (especially on the 67 without compiled GTOs) and can be improved. For the third digit even a simple inverse flag test (FC?C) can be used, without any jumps at all. BTW this is also possible on the 67/97, here two consecutive F? 3 are the same as a FC?C 03 on the 41. - This frees up several labels, so that LBL a can be replaced with the (shorter) LBL 09. CAT 1 on V41 says we're down to 240 Bytes. Now it's your turn again, Robert. ;-) BTW Ángel: what about a text file with the complete listings so far in the new 67 Games ROM? I think there is *much* room for improvement and more effective, byte-saving code. Dieter Edit: sorry, forgot the attachment... #-) OAB.zip (Size: 1.06 KB / Downloads: 2) |
|||
09-07-2016, 02:22 PM
Post: #46
|
|||
|
|||
RE: Raw files for these HP 67 program listings ? | |||
09-07-2016, 02:29 PM
Post: #47
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
(09-07-2016 01:54 PM)Dieter Wrote: BTW Ángel: what about a text file with the complete listings so far in the new 67 Games ROM? I think there is *much* room for improvement and more effective, byte-saving code. I'll give you something better: the Excel-based "blueprint", which includes the macro to compile into a ROM file so you can take control ... "To live or die by your own sword one must first learn to wield it aptly." |
|||
09-07-2016, 02:41 PM
Post: #48
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
Step 155 RTN can be deleted.
Steps 39-48 could be this: LBL c SF 01 SF 02 LBL C SF 00 SF 03 RTN |
|||
09-07-2016, 04:44 PM
Post: #49
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
This is fun! It feels like I'm reading successive issues of PPC Journal in 1983, without the month-long delay between 'better versions'.
--Bob Prosperi |
|||
09-07-2016, 06:51 PM
(This post was last modified: 09-07-2016 08:43 PM by Dieter.)
Post: #50
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
(09-07-2016 02:22 PM)RobertM Wrote: [ ...240 bytes... ] Don't give up, join the party. ;-) I now got it down to 206 bytes in 135 steps. The program essentially has two routines that generate a three digit number. One at the beginning and another one at LBL 03 that checks for holds. This can be combined into one single routine. I also wondered why the counter in R00 is decremented only if no holds are active. I am not sure if this is a bug or a feature, but the attached version now decrements the counter in both cases. Also the random number generator was modifed. Gene's suggestions were implemented as well. Robert et al., would you try this and check for bugs and unexpected results? Dieter OAB2.zip (Size: 983 bytes / Downloads: 5) |
|||
09-07-2016, 07:24 PM
Post: #51
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
Looks like it runs ok to me. As with all these games, I'm so tempted to add some sort of alpha labels to the outputs displayed, but byte count, byte count... :-)
|
|||
09-07-2016, 08:38 PM
Post: #52
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
(09-07-2016 07:24 PM)Gene Wrote: As with all these games, I'm so tempted to add some sort of alpha labels to the outputs displayed, Gene, remember your own words: (08-31-2016 04:08 PM)Gene Wrote: Dieter, I don't disagree, but some of the "fun" is actually leaving them the way they were. Regarding size issues... (09-07-2016 07:24 PM)Gene Wrote: ...but byte count, byte count... :-) ... I'd say we can be much more effective than the original programs. Consider the last example: from 187 steps and 15 data registers we're now down to 135 steps and merely 8 registers. So the byte count is not much of an issue. But... remember your own words. ;-) Dieter |
|||
09-07-2016, 08:42 PM
(This post was last modified: 09-07-2016 08:43 PM by Dieter.)
Post: #53
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
(09-07-2016 02:29 PM)Ángel Martin Wrote: I'll give you something better: the Excel-based "blueprint", which includes the macro to compile into a ROM file so you can take control ... Great – but what is this? For me everything is fine as long as it does not require more than some Excel/VBA skills and HP41 user code experience. :-) You should post this "blueprint" here in the forum so that more users can work with it. See what we did with the one-arm-bandit program in a joint effort. ;-) Dieter |
|||
09-07-2016, 09:29 PM
(This post was last modified: 09-07-2016 09:30 PM by Gene.)
Post: #54
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
I think we should work through the code for these as was done with the One Arm Bandit.
The code for the programs to be included is essentially from the HP 41 library on the museum site here. The listings for the HP67/97 games pac and games solution books (there were two) are available here on the site. Eight of the .raw files from the existing HP67 games rom are in this .zip file. More are coming. The code is from the rom image Angel posted here. zip of raw games Let's pick one and start optimizing. 1) Remove card reader functions where possible. 2) Save registers with program steps where possible. 3) Avoid CLRG if it makes sense. 4) Save bytes 5) Maybe... add limited alpha but watch the byte count Angel, are you ok if we save some space and go through this over the next week or so ? |
|||
09-07-2016, 09:56 PM
(This post was last modified: 09-08-2016 12:47 AM by Gene.)
Post: #55
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
Star Trek
Code: 01 LBL "ST" Golf Code: 01 LBL "GOLF67" Game of 26/36 Code: 01 LBL "G2636" Follow me (from mag card pack) Code: 01 LBL "FLLW67" Chuck a luck Code: 01 LBL "CHKLCK" Battleship Code: 01 LBL "BTLSHP" Blackjack HP67 Code: 01 LBL "BJCK67" Artillery HP67 Code: 01 LBL "ARTL67" Space War 67 (Card A) - Card B which follows should really be combined with this Card A Code: 01 LBL "SPW67A" Space War Card B Code: 01 LBL "SPW67B" Lander Code: 01 LBL "LAND67" Rocket 67 - another lander Code: 01 LBL "RCTK67" Slot Machine (another) Code: 01 LBL "SLMC67" Tic Tac Toe Code: 01 LBL "TTT67" Wari Code: 01 LBL "WARI67" Another Blackjack Code: 01 LBL "BJ" |
|||
09-07-2016, 11:40 PM
Post: #56
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
Question: do you want to allow synthetics? Can save some bytes here and there.
|
|||
09-07-2016, 11:45 PM
Post: #57
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
Lol. Synthetics in an HP 67 program.
Sure. I just want to make sure they will run on any HP 41. |
|||
09-07-2016, 11:51 PM
Post: #58
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
Agreed ... I meant 41 synthetics.
|
|||
09-08-2016, 06:23 AM
Post: #59
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
(09-07-2016 09:56 PM)Gene Wrote: Lander OK, here it is (was done in 10 minutes). Used HP41 SIGN function instead of a flag, moved registers 6...9 down to 1...4, replaced XROM-functions (DSP0 and DSP4) with FIX 0/4, some minor adjustments. Dieter LANDER.zip (Size: 754 bytes / Downloads: 4) |
|||
09-08-2016, 07:28 AM
(This post was last modified: 09-08-2016 07:30 AM by Ángel Martin.)
Post: #60
|
|||
|
|||
RE: Raw files for these HP 67 program listings ?
(09-07-2016 09:29 PM)Gene Wrote: Angel, are you ok if we save some space and go through this over the next week or so ? Hey, I'm game for countless re-doings of the ROM image, what a lot of fun! ;-) Sure Gene, never a problem... (09-07-2016 08:42 PM)Dieter Wrote: You should post this "blueprint" here in the forum so that more users can work with it. See what we did with the one-arm-bandit program in a joint effort. ;-) Will love to but it seems I'm out of "allowed" space in the forum and the system won't let me to... so you guys send me your email addresses for a copy of the file. "To live or die by your own sword one must first learn to wield it aptly." |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)