machine/nes.cpp: Accomodate games that don't initialize RAM. (#8986)

Software list items promoted to working (nes.xml)
---------------------------------------
Minna no Taabou no Nakayoshi Daisakusen (Japan) [kmg]
This commit is contained in:
0kmg 2021-12-15 08:06:00 -09:00 committed by GitHub
parent ead54b041b
commit a5acda1a60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 5 deletions

View File

@ -25164,14 +25164,13 @@ license:CC0
</part>
</software>
<!-- FIXME: This game works, but it depends on RAM at byte 0x11 being non-zero at power-up -->
<software name="minnatab" supported="no">
<description>Minna no Taabou no Nakayoshi Daisakusen (Jpn)</description>
<software name="minnatab">
<description>Minna no Taabou no Nakayoshi Daisakusen (Japan)</description>
<year>1991</year>
<publisher>Character Soft</publisher>
<info name="serial" value="CTS-9N"/>
<info name="release" value="19911122"/>
<info name="alt_title" value="みんなのた坊のなかよし大作戦"/>
<info name="alt_title" value="みんなのた坊のなかよし大作戦"/>
<part name="cart" interface="nes_cart">
<feature name="slot" value="cnrom" />
<feature name="pcb" value="HVC-CNROM" />

View File

@ -27,7 +27,7 @@ void nes_state::nes_vh_sprite_dma_w(address_space &space, uint8_t data)
void nes_state::nes_map(address_map &map)
{
map(0x0000, 0x07ff).ram().mirror(0x1800); // RAM
map(0x0000, 0x07ff).ram().mirror(0x1800).share("mainram"); // RAM
map(0x2000, 0x3fff).rw(m_ppu, FUNC(ppu2c0x_device::read), FUNC(ppu2c0x_device::write)); // PPU registers
map(0x4014, 0x4014).w(FUNC(nes_state::nes_vh_sprite_dma_w)); // stupid address space hole
map(0x4016, 0x4016).rw(FUNC(nes_state::nes_in0_r), FUNC(nes_state::nes_in0_w)); // IN0 - input port 1

View File

@ -72,6 +72,7 @@ class nes_state : public nes_base_state
public:
nes_state(const machine_config &mconfig, device_type type, const char *tag) :
nes_base_state(mconfig, type, tag),
m_mainram(*this, "mainram"),
m_ppu(*this, "ppu"),
m_screen(*this, "screen"),
m_exp(*this, "exp"),
@ -125,6 +126,7 @@ private:
uint8_t *m_vram;
std::unique_ptr<uint8_t[]> m_ciram; //PPU nametable RAM - external to PPU!
required_shared_ptr<uint8_t> m_mainram;
required_device<ppu2c0x_device> m_ppu;
required_device<screen_device> m_screen;

View File

@ -43,6 +43,15 @@ void nes_state::machine_start()
{
address_space &space = m_maincpu->space(AS_PROGRAM);
// Fill main RAM with an arbitrary pattern (alternating 0x00/0xff) for software that depends on its contents at boot up (tsk tsk!)
// The fill value is a compromise since certain games malfunction with zero-filled memory, others with one-filled memory
// Examples: Minna no Taabou won't boot with all 0x00, Sachen's Dancing Block won't boot with all 0xff, Terminator 2 skips its copyright screen with all 0x00
for (int i = 0; i < 0x800; i += 2)
{
m_mainram[i] = 0x00;
m_mainram[i + 1] = 0xff;
}
// CIRAM (Character Internal RAM)
// NES has 2KB of internal RAM which can be used to fill the 4x1KB banks of PPU RAM at $2000-$2fff
// Line A10 is exposed to the carts, so that games can change CIRAM mapping in PPU (we emulate this with the set_nt_mirroring