FCEUX Default Memory Values and Rom for Reading Values.

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

CLChambers00
Posts: 78
Joined: Wed Jul 19, 2017 10:23 am

FCEUX Default Memory Values and Rom for Reading Values.

Post by CLChambers00 » Wed Jul 19, 2017 10:32 am

I am trying to find someone who is capable of creating a rom, for use with a flash cart, that would read the default memory values of an NES, since these can vary with Front Loaders. Of course I am assuming to use it on an NES that has reliable memory. I say Front Loaders because it is my understanding that all Top Loaders use a repeating pattern of 00 00 00 00 FF FF FF FF, setting values to 0 or 255 every four addresses, such as the FCEUX emulator does.

I am also interested in finding someone who can write a lua script for me that would set the default memory values in FCEUX to anything I would like so that I can set the emulator to what I find on the memory testing rom. This way I can actually TAS out variations for input manipulation with games that do not have initialized memory that would actually work with my system. I would be willing to pay money for someone to create both of these for me, let me know if you or someone else you know are capable and in need of some extra cash.

Additionally, I am curious to know if flash carts such as Everdrive or Powerpak utilize the default values of the NES it is used with or if these flash carts populate these addresses with their own default values?

Any thoughts or ideas are also appreciated since I am too new to this field to know exactly how I should be asking these questions.

lidnariq
Posts: 8768
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: FCEUX Default Memory Values and Rom for Reading Values.

Post by lidnariq » Wed Jul 19, 2017 10:47 am

The default memory state is
#1 - a function of the specific manufacturer/part number/manufacturing run of RAM ICs used in the console
#2 - somewhat random anyway.

For example, the Sharp-manufactured LH5116s (made late 1988) in my NES power up with mostly FF, but there are many locations in memory that don't.
Last edited by lidnariq on Wed Jul 19, 2017 10:54 am, edited 1 time in total.

tepples
Posts: 21748
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: FCEUX Default Memory Values and Rom for Reading Values.

Post by tepples » Wed Jul 19, 2017 10:51 am

I think the idea of this project is to characterize common properties of "the specific manufacturer/part number/manufacturing run of RAM ICs used in the console", including any pattern tendencies and how much entropy there is. This way, a tool-assisted speedrunner can determine whether inconsistent behavior when attempting to console-verify a movie is due to unspecified values that a game reads before the first write to a given location.

The PowerPak and EverDrive menus absolutely do overwrite RAM with the menu code. This means a test would have to run on a single-game cartridge. And in order to view both the 2K CPU memory and the 2K nametable memory, it'd need to have at least 2K or so of its own RAM to receive data copied from the first nametable and beginning of CPU memory so that the displayer can display it. This can be WRAM at $6000 or CHR RAM at $0000.

So which board did you want it for? A CHR RAM board, such as UNROM, ANROM/AOROM, or SGROM/SNROM? Or a CHR ROM board with WRAM, such as SKROM, TSROM/TKROM, or JSROM/BTR? Boards without any RAM, such as NROM, CNROM, SLROM, and TLROM, are out of the question.

An alternative that can get away without the 4K of its own memory is something like TapeDump, which beeps out the initial contents of memory without needing video display.

lidnariq
Posts: 8768
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: FCEUX Default Memory Values and Rom for Reading Values.

Post by lidnariq » Wed Jul 19, 2017 11:01 am

My point is that there are no reliable common properties. There are groups of different RAMs used on different consoles, and we already know that they sometimes completely contradict each other.

The last time this came up I linked to this article about RAM randomness.

We don't have to re-sample things. We can take advantage of observing the sets of games that fail to initialize memory and already rely on the hardware powering up with mostly FF, or mostly 00.

The only possible correct options are:
* Bake the required default RAM state into your ROM database
* Let the user choose on a game-by-game basis



Anyway, I've actually already written a program that will dump the 4 KiB RAM on a NES using the controller port to transmit RS232 at 230400 baud. It requires that you have extra hardware to receive the results, though.
Last edited by lidnariq on Wed Jul 19, 2017 11:12 am, edited 1 time in total.

User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Re: FCEUX Default Memory Values and Rom for Reading Values.

Post by thefox » Wed Jul 19, 2017 11:09 am

As far as ROMs for this, there's one at viewtopic.php?f=22&t=11520.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi

CLChambers00
Posts: 78
Joined: Wed Jul 19, 2017 10:23 am

Re: FCEUX Default Memory Values and Rom for Reading Values.

Post by CLChambers00 » Wed Jul 19, 2017 12:29 pm

Since I use an Everdrive, is there a way to determine the values that the Everdrive is using? If I can find this out then all I would need is a lua script to get FCEUX to use those default values.

CLChambers00
Posts: 78
Joined: Wed Jul 19, 2017 10:23 am

Re: FCEUX Default Memory Values and Rom for Reading Values.

Post by CLChambers00 » Wed Jul 19, 2017 12:30 pm

I will check out this rom shortly, thanks for posting the link.

CLChambers00
Posts: 78
Joined: Wed Jul 19, 2017 10:23 am

Re: FCEUX Default Memory Values and Rom for Reading Values.

Post by CLChambers00 » Wed Jul 19, 2017 5:58 pm

I think that the Rom worked great, most of the memory addresses are set to zero. Someone had mentioned that a Lua Script could be used to get FCEUX to set the default values to FF FF FF FF FF FF FF FF instead of 00 00 00 00 FF FF FF FF etc. Does anyone have a link to a Lua Script that I could use with FCEUX to set the default values to 00 00 00 00 00 00 00 00 , ect???

User avatar
rainwarrior
Posts: 7668
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: FCEUX Default Memory Values and Rom for Reading Values.

Post by rainwarrior » Wed Jul 19, 2017 6:24 pm

I also wrote a ROM to test this: viewtopic.php?t=13334

It's not particularly useful on PowerPak or Everdrive though, because they can't do power-on tests. Tou need to put it on its own cart.

There's no consistent startup state for a lot of machines though. Any given bit on mine might power up as either 0 or 1. There's maybe some tendencies but that's about it.

The latest interim build of FCEUX does now have 4 options now for power-on RAM state: 00 / FF pattern (default), all 00, all FF, random. You can use the hex editor to load or save any other pattern you wish, I suppose.

CLChambers00
Posts: 78
Joined: Wed Jul 19, 2017 10:23 am

Re: FCEUX Default Memory Values and Rom for Reading Values.

Post by CLChambers00 » Wed Jul 19, 2017 7:08 pm

Most excellent! Where in FCEUX will I find these settings for different RAM states?

User avatar
rainwarrior
Posts: 7668
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: FCEUX Default Memory Values and Rom for Reading Values.

Post by rainwarrior » Wed Jul 19, 2017 7:17 pm

CLChambers00 wrote:Most excellent! Where in FCEUX will I find these settings for different RAM states?
Get an interim build of FCEUX. You can find one at the FCEUX download page (the third option, "up-to-date"):
http://www.fceux.com/web/download.html

It's under Config > RAM Init

CLChambers00
Posts: 78
Joined: Wed Jul 19, 2017 10:23 am

Re: FCEUX Default Memory Values and Rom for Reading Values.

Post by CLChambers00 » Wed Jul 19, 2017 7:20 pm

Very Nice! Found it! Going to grind out some research with it. Thanks everyone! You all contributed to my growing knowledge and tools in this regard. Cheer! :D

CLChambers00
Posts: 78
Joined: Wed Jul 19, 2017 10:23 am

Re: FCEUX Default Memory Values and Rom for Reading Values.

Post by CLChambers00 » Wed Jul 19, 2017 7:38 pm

I set the values to all zero, but there must be more changed by the Everdrive because even though the ram viewer rom shows most values set to zero there must be more that the everdrive is doing that makes it not exactly the same as setting FCEUX to all zeros setting. Hmm, still wondering what else I might be able to try.

User avatar
rainwarrior
Posts: 7668
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: FCEUX Default Memory Values and Rom for Reading Values.

Post by rainwarrior » Wed Jul 19, 2017 7:47 pm

From what I recall of the Everdrive / PowerPak they end up overwriting a lot of (all?) the power-on state of RAM, and don't make any attempt to initialize it to a consistent value or anything before launching a ROM, so the actual values they start up with is probably highly dependent on various things like what files were in the same folder as the ROM you launched, etc.

CLChambers00
Posts: 78
Joined: Wed Jul 19, 2017 10:23 am

Re: FCEUX Default Memory Values and Rom for Reading Values.

Post by CLChambers00 » Thu Jul 20, 2017 2:14 am

I don't think that the FCEUX option to set it to all FF or any other variation works correctly, it appears to work for a few frames but then changes back to the same values gives me every time. When I set it to all FF, load the rom, and open tas editor, I should be getting the same results as Bizhawk, however, this is not the case. Maybe I am using the setting wrong or it does not work as intended. If this option does not work I would need a lua script. I see "memory.writebyte(0x1000,9)" is an example of how to rewrite one value but how would one write this to include all SET variables such that 'The BizHawk default memory can be simulated in the FCEUX Lua script by entering 0xFF for all the SET variables.'

Post Reply