-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pitfall II ROM recognitiion #36
Comments
Thanks. The first step of cartridge fingerprinting is based on size. I remember thinking when I was implementing DPC that 10495 was a strange size. I didn't stop long enough to think why. It's an easy enough fix. It'll be in the next binary release of the emulator. If you really need to load the good dump in the meantime, you can force the use of DPC from the command line with
But here's the thing and you might be the man to ask, as far as I can tell a DPC rom dump should only be 10240 bytes. Two regular banks of 4096 bytes and 2048 bytes of the 'static' data only accessible by the DPC chip. What is the extra data? Is it just random noise from the dumping process? |
My understanding is the extra 255 bytes are the RNG sequence generated by DPC. Found some info here: |
Thanks. That's interesting. I'm just reviewing my RNG generator for DPC. I'm using the method described in the patent but I didn't get it quite right the first time. I've changed it so it better matches the patent text, but I don't think it ultimately matters because the numbers will be random in any case. Is it worth the time to use the random data from the dumps to verify that the RNG implementation is correct? If the dumps are not good for this, how else could we verify that it's correct? Moreover, how can we verify that the cartridge actually implements the RNG described in the patent? |
I don't know who made the dump so don't know if it's the actual RNG sequence created by DPC, or an arbitrary RNG sequence they appended in order to get Pitfall II working in emulation. To get the sequence I'd have the cartridge dumper read address $1000 255 times. From the comments in Stella:
extracting the RNG sequence after getting the ROM dump would most likely result in the sequence starting at a different point than if it were read before getting the dump. |
Yes. It would be good to be able to replicate the random number stream exactly but I don't think it's necessary. For games purposes, the sequence effectively starts when the player begins a new game. So even if you only pump the RNG on RNG access (as Stella does according to the comment you've identified) it will be sufficiently random. That comment also prompted me to check how much CPU time the RNG pump consumes, so I did some profiling. So 1% of the emulation time is spent just advancing the RNG. Is it worth limiting the pump in the same way Stella does? I'm not sure. I prefer implementing it as described in supporting documentation as closely as I can. But my constraints are different to the Stella teams I suppose. I don't have to worry about it running on embedded hardware for example. Still it's something to consider especially as we can't know whether the RNG sequence is exactly the same as on hardware. |
Where does this new dump come from? This is from the source of the PC utility:
devkit2.zip The 255 RNG sequence in the known dump is this one:
It contains every number from "00" to "fe" without repetitions. |
It may be useful, I gathered what information I found and posted here, earlier last year to the MAME/MESS forum: https://forums.bannister.org/ubbthreads.php?ubb=showflat&Number=123431 Posting below as well for convenience: "DPC uses a 10K ROM, which is comprised of two 4K banks plus an additional 2K that's used to store graphics data. Selection between the 4K banks is done via standard F8 bank switching, while the 2K is not directly accessible to the 6502." DPC chip patent Abstract: "You can search for the patent on the chip (#4644495) which I think gives a high-level description of the various functions. I didn't find the patent quite as useful as emulator source code when trying to figure out how the DPC worked so I could simulate it in hardware (the Harmony cart is the only cart that can simulate the DPC chip, or at least the only one that has.) The DPC has some features that are not used by Pitfall II. I'm not certain what all of those are. My own breakdown of the various functions is as follows, at least as used in Pitfall II: Read registers: Write registers: There is also a "draw line" function that is not used by Pitfall II. It apparently calculates a value to store in HMOVE to help with drawing lines. I think it may have been originally designed for a vine but that never made it to the game." "Pitfall II for the Atari has a DPC chip which generates RNG tables (that I don't believe exist until it generates them), which it uses to make the eel enemies flicker (I think that's all). Current dumps out there, and what's on the DOM (1 yellow trusted, 1 third party) have the 255 bytes that is the generated RNG data appended to the end of the dump. This is what emulators that know ROMs will identify as Pitfall II as well. It also does something to the music on every scanline, the chip has a few functions, but only RNG tables are added to the dump. The OSCR (which I use to dump) is intentionally not having the RNG table data read as it isn't part of the game ROM, and probably doesn't exist until the chip creates it and should be emulated by emulators like other chips (Super FX etc,) along with the RNG table generation code it runs, rather than packing the game with the resulting tables, though emulators don't typically do this from what I've seen. I understand the Harmony Cart can emulate it, but I'm not sure if it needs RNG data from the ROM to do so. Also without the RNG tables it is 10,240 (a proper 10kb), but the current one is 255 bytes bigger than that." |
I've added a test for the DPC RNG and use the data in the ROM dumps to compare against. In answer to my own question above: Yes, Pitfall2 implements the RNG as it is described in the patent.
Yes, the value 0x80 should be followed by 0x00. Each value in the sequence should only appear once and 0xff is not a part of the sequence. 0xff is an impossible value and can never be mutated into another value using the method described in the patent. So I don't think the "bad" dump is actually bad. If anything the "good" dump is more of a mystery because of the additional 0xfd. We can also say that the terminating byte of 0x0a is unnecessary too. |
Gopher2600 only recognizes and supports the "bad" Pitfall II NTSC ROM dump and not the verified "good" dump:
Good Dump (CRC32 B960C29E).

Bad Dump (CRC32 097CE7AD).

Pitfall_II_Dumps.zip
The text was updated successfully, but these errors were encountered: