Post Reply 
4K HP 67 Games rom attached for testing
11-06-2016, 08:55 PM (This post was last modified: 11-06-2016 09:12 PM by Dieter.)
Post: #101
RE: 4K HP 67 Games rom attached for testing
(11-06-2016 08:43 PM)Gene Wrote:  Gene: Well, the instructions should say to input a decimal seed between 0 and 1 that is six digits or more long. Anyone who inputs 1 E-20 as a seed deserves to have a bad game. :-)

As long as someone puts in a positive seed 0-1 with six digits it ought to be ok.

Let's play safe here. I just read the comment on the 997-generator in the HP67/97 Standard Pac regarding suitable seeds. It says that seed*1E+7 should not be divisible by 2 or 5. So the 7th digit shoud be 1, 3, 7 or 9. This could be easily implemented:

Code:
LBL "S"
RCL 00
"SEED?"
PROMPT
ABS
FRC
9
*
1
+
E5
*
INT
.7
+
E6
/
STO 00
END

This makes sure the initial seed is > 0,1 and ends with a 7. The subsequent random numbers seem to end with a 1, 3, 7 or 9 as well.
Yes, this might be a good solution so that we can safely use the short and fast 997 algorithm.

(11-06-2016 08:43 PM)Gene Wrote:  In your updated games, are you able to actually insert the proper XROMs into the listings ?

If you want to I can do this. At the moment it's just "XEQ R" and "XEQ S". But this can easily be changed with a simple "search and replace".

Dieter
Find all posts by this user
Quote this message in a reply
11-06-2016, 09:11 PM
Post: #102
RE: 4K HP 67 Games rom attached for testing
If you can, let's put the proper XROM's into the .raw files. That will be what is sent to Angel.

No need in the text files to include the LBL R and LBL S at all.
Find all posts by this user
Quote this message in a reply
11-07-2016, 08:15 PM
Post: #103
RE: 4K HP 67 Games rom attached for testing
(11-06-2016 09:11 PM)Gene Wrote:  If you can, let's put the proper XROM's into the .raw files. That will be what is sent to

The XROM stuff is no problem - I have already updated the listings. But since ancient times man knows: errare humanum est, so please, Gene, double and triple check the result of my efforts.

At the moment there are still a few programs to convert so that they use R00 for the random seed. Especially the SP and ST programs are a bit tricky.

(11-06-2016 09:11 PM)Gene Wrote:  No need in the text files to include the LBL R and LBL S at all.

OK, but let's make sure that both the seed and the RNG routine are as failsafe as possible. If the 997 generator is used the user-provided seed should be modified to make sure it gives good results. I have already suggested a possible way to do so.

Dieter
Find all posts by this user
Quote this message in a reply
11-07-2016, 09:29 PM
Post: #104
RE: 4K HP 67 Games rom attached for testing
Agreed on the RN generator and seed adjustments.

The .raw files are the ones that really need the XROM 23,XX and 23,XY to be inserted to call the RN and seed routines when in rom.

Once the programs have those inserted and are all using the common R00 location, we will be good to send these to Angel. :-)
Find all posts by this user
Quote this message in a reply
11-08-2016, 07:50 PM (This post was last modified: 11-08-2016 07:51 PM by Dieter.)
Post: #105
RE: 4K HP 67 Games rom attached for testing
(11-07-2016 09:29 PM)Gene Wrote:  Once the programs have those inserted and are all using the common R00 location,

...and you spent a few days of thorough testing...

(11-07-2016 09:29 PM)Gene Wrote:  we will be good to send these to Angel. :-)

Most programs now have been converted to R00 use and the common RNG / seed routine. There are three cases left:

F67: So this is "Follow me". Since when is this part of the Games ROM? I think I have never seen it mentioned here before.

SPW: This is two programs combined in one. I really would like to have some sample output that shows how the program is supposed to work.
The example in the Games Pac probably will not help much as the 41 version uses Alpha output.

ST: Same here. What is the origin of this game, and are there some instructions that show how to play this one?
Preferably together with a listing and overview of register usage.

Dieter
Find all posts by this user
Quote this message in a reply
11-08-2016, 08:37 PM
Post: #106
RE: 4K HP 67 Games rom attached for testing
Here's the first posting in the original 67 games rom thread:

First 67FUN thread

Star Trek is one of those listed in the first post with a link to my text listing of the game.

Here's the link to the listing on my old web page: Web page with Simple 2D star trek listing

Here's a link to the User Library PDF that it was typed up from: Simple 2D Star Trek


Follow me has been in the mix since post 55 of that first thread:
Follow me listed
Yes, I know it *isn't* a game, but nothing quite like it is in the 41 rom world so we are making the splash with it here.



As to Space War, the games pac is the only game (ha) in town. The output of the 67 version of the game is all we have of course. It will have to do.
Find all posts by this user
Quote this message in a reply
11-09-2016, 12:47 AM
Post: #107
RE: 4K HP 67 Games rom attached for testing
(11-08-2016 07:50 PM)Dieter Wrote:  SPW: This is two programs combined in one. I really would like to have some sample output that shows how the program is supposed to work.
The example in the Games Pac probably will not help much as the 41 version uses Alpha output.

If it's the SPW that I contributed, the Alpha output is minimal and the game follows the example from the Games Pac very closely. The only difference is the user keys had to change to make both SW1 and SW2 fit... they are now:
Code:
a        b         c          d         e
STATUS                        DOCK      START
A        B         C          D         E
SRSCAN   LRSCAN    PHASER     TORPEDO   MOVE

Let me know if there is something you guys need help with.

-Robert
Visit this user's website Find all posts by this user
Quote this message in a reply
11-09-2016, 01:42 PM
Post: #108
RE: 4K HP 67 Games rom attached for testing
Dieter wrote: "Most programs now have been converted to R00 use and the common RNG / seed routine."



Gene: Great! Post the .raw files and we will start double checking them! Wonderful!
Find all posts by this user
Quote this message in a reply
11-09-2016, 08:23 PM (This post was last modified: 11-09-2016 08:23 PM by Dieter.)
Post: #109
RE: 4K HP 67 Games rom attached for testing
(11-09-2016 01:42 PM)Gene Wrote:  Gene: Great! Post the .raw files and we will start double checking them! Wonderful!

I just finished (well, at the moment I think so...) the Space War program. There are some modifications that make the code more efficient, also the phaser and torpedo routines now display the number of remaining Alglogs. A CLRGX routine was added at LBL 50.

The attachment includes the listing and a raw file. For testing purposes both the RNG and the seed routine are included, so you can run the raw file directly without any additional routines. That's why this code version has XEQ"S" and XEQ"R" instead of XROM calls. The net program without these XEQs is below 700 bytes.

The seed routine modifies the user input so that the resulting seed is between 0,05... and 0,95... and has seven decimals, the last one being 7. If you want to try the Games Pac example, remove the XEQ"S" at the beginning and replace it with 0,63154897 STO 00. Be sure to use the correct keys (see RobertM's post above).

And now: try this version and see if it works correctly.

BTW I was not able to compile "XROM 32,25" or "XROM 32,26" with hp41uc, so at the moment I can't provide a raw file with these commands. What am I doing wrong?

Dieter


Attached File(s)
.zip  SPW2R_incl_RNG.zip (Size: 2.56 KB / Downloads: 5)
Find all posts by this user
Quote this message in a reply
11-09-2016, 09:01 PM
Post: #110
RE: 4K HP 67 Games rom attached for testing
XROM 23 not 32.

Post the other games when you can. Thank you!
Find all posts by this user
Quote this message in a reply
11-09-2016, 10:32 PM (This post was last modified: 11-09-2016 10:35 PM by Dieter.)
Post: #111
RE: 4K HP 67 Games rom attached for testing
(11-09-2016 09:01 PM)Gene Wrote:  XROM 23 not 32.

#-)
OK, now it works. XROM 23,25 compiles, so this will show up in the raw files.
BTW, with default settings hp41uc decodes the two new XROM commands as ID and INAC. But this can be disabled. ;-)

(11-09-2016 09:01 PM)Gene Wrote:  Post the other games when you can. Thank you!

I think I will post the programs one by one so that problems and errors in individual programs can be easily corrected.

Dieter
Find all posts by this user
Quote this message in a reply
11-10-2016, 09:40 PM
Post: #112
RE: 4K HP 67 Games rom attached for testing
Looks good to me. I'd like to encourage you to post the remaining programs en masse when you can. Time becomes available sometimes in chunks and it would be nice to have them available.

I've asked Robert to do some testing too.

ty
Find all posts by this user
Quote this message in a reply
11-10-2016, 09:50 PM
Post: #113
RE: 4K HP 67 Games rom attached for testing
(11-09-2016 09:01 PM)Gene Wrote:  Post the other games when you can. Thank you!

Status report:

I now have converted most programs so that they use the common RNG and seed routines, and R00 is reserved for these. Some programs that do not use a RNG (e.g. TTT and Chess) were slightly modified so that they do not use R00 either. This does not apply to the AOS program – this would require some major changes.

The remaining programs that I have not touched yet are ST and F67. For the others both text and raw files exist which include XROM 23,25 and XROM 23,26 commands. As an example the Chuck-a-luck program is attached.

Gene, how can you test such a program as long as these XROM functions are not defined anywhere?

Do you think we should stick to the 997 RNG? It requires a careful choice of the initial seed (cf. the report on RNGs you posted), so the seed routine should make sure that the user input is converted to something that makes sense. We could also use the frac(x+pi)^3 generator. According to the mentioned report this is a decent RNG that generates 20000+ values, and it's much less picky with the initial seed.

Dieter


Attached File(s)
.zip  Chuckaluck.zip (Size: 701 bytes / Downloads: 3)
Find all posts by this user
Quote this message in a reply
11-10-2016, 10:31 PM (This post was last modified: 11-10-2016 10:40 PM by Gene.)
Post: #114
RE: 4K HP 67 Games rom attached for testing
Testing? I would test with an XEQ R and XEQ S inserted calling a random number and seed routine in ram. Then, the XROM is put in place for versions to send over for rom creation.

Given the complexity of the S routine to use the 997, I think the 9821 generator is looking better all the time. It passes all the tests, it has been used for 30 years plus, it's not *that* large compared to space used in the S routine, etc. and it works with an input seed of 0.

I know it is overkill per Valentin :-) but it is the one I would really like for us to use.

LBL R
RCL 00
9821
*
.211327
+
FRC
STO 00
END


But I will not pitch a fit if you really want us to use this one. :-)

LBL R
RCL 00
PI
+
3
Y^X
FRC
STO 00
END
Find all posts by this user
Quote this message in a reply
11-11-2016, 07:17 AM (This post was last modified: 11-11-2016 07:44 AM by Dieter.)
Post: #115
RE: 4K HP 67 Games rom attached for testing
(11-10-2016 10:31 PM)Gene Wrote:  Testing? I would test with an XEQ R and XEQ S inserted calling a random number and seed routine in ram. Then, the XROM is put in place for versions to send over for rom creation.

OK then. I think I will post the first package this weekend.

(11-10-2016 10:31 PM)Gene Wrote:  Given the complexity of the S routine to use the 997, I think the 9821 generator is looking better all the time. It passes all the tests, it has been used for 30 years plus, it's not *that* large compared to space used in the S routine, etc. and it works with an input seed of 0.

The only problem is speed. Due to two numeric constants the 9821 generator is slow. It would perform much better if the two parameters were recalled from a register, but this is not an option here. I did a test on V41 with 100 random numbers and it turned out that the 9821 generator required about 70% more time than the 997 and (x+pi)³ versions. This is my only concern.

This may be an issue on the "26" game. Here 130 random numbers are generated. I wonder how this was like on the HP67, here one game – essentially watching 13 ten-digit numbers appear on the display – must have taken 5 to 10 minutes. The 41 is much faster, but still... I have been thinking about changing the 13 numbers into something like 5.

BTW I'd recommend an ABS after RCL 00, just to be sure. This applies to all three RNGs we're talking about here.

On the other hand the "complexity of the S routine" is not much of a problem. It's just a few steps and it's called only once on startup. I think we should not drop the 997 generator because of this seed routine.

(11-10-2016 10:31 PM)Gene Wrote:  But I will not pitch a fit if you really want us to use this one. :-)

LBL R
RCL 00
PI
+
3
Y^X
FRC
STO 00
END

Noone wants to use it that way. Gene, you shouldn't calculate x³ by 3 y^x. Better use something like ENTER x² * or x² LastX *. This even preserves LastX. And on other calculators you can even do x² RCL*L and do it all in one single stack register:

Code:
LBL R
PI
RCL+ 00

RCL* L
FRC
STO 00
END

Dieter
Find all posts by this user
Quote this message in a reply
11-11-2016, 03:19 PM (This post was last modified: 11-11-2016 03:21 PM by Gene.)
Post: #116
RE: 4K HP 67 Games rom attached for testing
Good point on the R routine. Let's go with your PI ^ 3 approach, but RCL + (recall arithmetic) does not work on an HP 41c, cv, or cx, as you say. To preserve the stack, what about this (or something such)?

LBL R
PI
ST+ 00
RDN
RCL 00
X^2
ST* L
X<> L
FRC
STO 00
END

On the 2636 game, let's leave it with the 130 RN's as it was intended. Emulators run it just fine and the 41CL runs it fine at 50X.
Find all posts by this user
Quote this message in a reply
11-11-2016, 03:55 PM
Post: #117
RE: 4K HP 67 Games rom attached for testing
Just a thought... For speed purposes, couldn't we use an MCode version of the 9821 RNG ... pretty sure you can mix MCode and User code in the same ROM, and I also think I've seen an MCode version of that RNG hanging around ... Angel probably has a version of it somewhere. It could use R00 directly, or R00 could be RCLd to X first and STOd to R00 later.
Visit this user's website Find all posts by this user
Quote this message in a reply
11-11-2016, 07:10 PM (This post was last modified: 11-11-2016 08:23 PM by Dieter.)
Post: #118
RE: 4K HP 67 Games rom attached for testing
(11-11-2016 03:19 PM)Gene Wrote:  Good point on the R routine. Let's go with your PI ^ 3 approach, ...

FTR: it's not "my" approach. I read the PPC journal RNG article you posted and there the (x+pi)³ generator was considered a good one. So why not use it?

(11-11-2016 03:19 PM)Gene Wrote:  ...but RCL + (recall arithmetic) does not work on an HP 41c, cv, or cx, as you say. To preserve the stack, what about this (or something such)?

LBL R
PI
ST+ 00
RDN
RCL 00
X^2
ST* L
X<> L
FRC
STO 00
END

If you really want to do it only in X I'd prefer it this way:

Code:
LBL R
PI
ST+ 00
X<> 00
X^2
ST* L
X<> L
FRC
STO 00
END

But in our case we should stick to the usual 2-level version. This is the way the RNGs in the original programs work (except one that uses the frac(arctan) method) , and who knows if a change in the stack levels will not mess up something. (OK, I don't think this will happen, but I'd have to check this first). As usual, I would like to add an ABS instruction to make sure the RNG can also handle negative seeds.

(11-11-2016 03:19 PM)Gene Wrote:  On the 2636 game, let's leave it with the 130 RN's as it was intended. Emulators run it just fine and the 41CL runs it fine at 50X.

That's an important point. The one or other program has VIEW or AVIEW commands where the execution time of a real (tm) hardware 41 is used to display messages for a certain time. For instance in 2636: on a regular 41 calculating the 10-digit number takes, say, 8 or 10 seconds. This time is used to display the previous number. If an emulator now runs 50 or 100x as fast...

I have even modified the moon lander's "flashing output" routine at LBL 04 so that – similar to the much slower 67 – the display actually flashes.
At least it does so on a real 41. #-)

Edit:
Instead of a flashing display, what about this 41-specific output?

Code:
123
FIX 0
CF 29
VIEW X
LBL 04
SF 25
0
TAN
/
+
GTO 04

;-)

Dieter
Find all posts by this user
Quote this message in a reply
11-11-2016, 07:12 PM (This post was last modified: 11-11-2016 07:36 PM by Dieter.)
Post: #119
RE: 4K HP 67 Games rom attached for testing
(11-11-2016 03:55 PM)RobertM Wrote:  Just a thought... For speed purposes, couldn't we use an MCode version of the 9821 RNG ... pretty sure you can mix MCode and User code in the same ROM, and I also think I've seen an MCode version of that RNG hanging around ... Angel probably has a version of it somewhere. It could use R00 directly, or R00 could be RCLd to X first and STOd to R00 later.

That's what I also suggested earlier.

Ángel: if implementing a buffer that holds the seed is too complicated, would you say that using R00 with an MCode RNG that does the 9821x+0,211327 thing is a possible option?

Dieter
Find all posts by this user
Quote this message in a reply
11-11-2016, 08:03 PM
Post: #120
RE: 4K HP 67 Games rom attached for testing
(11-10-2016 09:40 PM)Gene Wrote:  Looks good to me. I'd like to encourage you to post the remaining programs en masse when you can. Time becomes available sometimes in chunks and it would be nice to have them available.

OK, Gene: here is the first chunk with 12 programs plus the RNG/seed routines.

Dieter


Attached File(s)
.zip  67_Games_1.zip (Size: 13.19 KB / Downloads: 4)
Find all posts by this user
Quote this message in a reply
Post Reply 




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