psycho Posted April 21, 2009 Share Posted April 21, 2009 I am implementing Centipede in an FPGA and I am having a problem. I have looked for the exact RNG algo. for 2 days now but I can't find it. It would seem that when Centipede runs, if the RNG does not produce proper results, it resets. I get the thing to go into attract mode sometimes but not very often. I am pulling my hair out. Also, it seems as though the color ram is based off the RNG??? This is a learning exorcise. I have never worked with a 6502 or anything Atari before. But, I think once I get this problem straitened out, I should be on my way. Anyone have the *exact* RNG algo? Thanks, psycho Quote Link to comment Share on other sites More sharing options...
DanBoris Posted April 22, 2009 Share Posted April 22, 2009 The random number generator in the Pokey is actually driven off the polynomial counters that are used to add noise to the sound. You can take a look a the source code for the MAME emulator, I am pretty sure the algorithm it uses is accurate. You can find the source here http://mamedev.org/source/src/emu/sound/index.html in the Pokey.c file. Dan Quote Link to comment Share on other sites More sharing options...
Rybags Posted April 22, 2009 Share Posted April 22, 2009 So far as accuracy goes, the random sequence should also be different if AUDCTL specifies 9-bit instead of 17-bit poly counter for AUDF type $8x noise. Quote Link to comment Share on other sites More sharing options...
psycho Posted April 22, 2009 Author Share Posted April 22, 2009 I swiped the one from mame. It seems to boot OK but I still have a few issues with the colors. I will keep working on it and hopefully I can figure it all out. Thanks, Kevin Quote Link to comment Share on other sites More sharing options...
Rybags Posted April 22, 2009 Share Posted April 22, 2009 I find it kinda weird that the game would rely on a certain sequence of random numbers to be produced. The sequence occurs AFAIK, at whatever clock speed Pokey is running at, so in most applications (paired with 6502s), it's very hard to read the same sequence twice, if you consider the usual fact that stuff like screen DMA, interrupts and refresh steals are occurring. But, you might also consider the fact that maybe they have some sort of clever self-test that verifies the Pokey is OK by checking some random numbers, or (long-shot) maybe they verify that a genuine Pokey is in use as a measure to prevent bootleggers. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.