diff options
| author | 2022-04-23 04:15:40 -0800 | |
|---|---|---|
| committer | 2022-04-23 08:15:40 -0400 | |
| commit | 9fbaa3862ae030d28d76046d1b3757d29fd4135d (patch) | |
| tree | 6238b0398749fa98c59ce6d5c7cce5112260213c /src | |
| parent | 564c57f1681955b49ab8b06796c5073cc25ed193 (diff) | |
bus/nes: Corrected NOCASH_NOCHR homebrew board emulation. (#9611)
Diffstat (limited to 'src')
| -rw-r--r-- | src/devices/bus/nes/jaleco.cpp | 1 | ||||
| -rw-r--r-- | src/devices/bus/nes/nxrom.cpp | 59 | ||||
| -rw-r--r-- | src/devices/bus/nes/nxrom.h | 15 | ||||
| -rw-r--r-- | src/devices/bus/nes/pt554.h | 1 |
4 files changed, 49 insertions, 27 deletions
diff --git a/src/devices/bus/nes/jaleco.cpp b/src/devices/bus/nes/jaleco.cpp index ca8a9c2733e..44c6a0209a7 100644 --- a/src/devices/bus/nes/jaleco.cpp +++ b/src/devices/bus/nes/jaleco.cpp @@ -21,7 +21,6 @@ #include "emu.h" #include "jaleco.h" -#include "sound/samples.h" #include "speaker.h" diff --git a/src/devices/bus/nes/nxrom.cpp b/src/devices/bus/nes/nxrom.cpp index da0e9a12e07..e5b4f85c82f 100644 --- a/src/devices/bus/nes/nxrom.cpp +++ b/src/devices/bus/nes/nxrom.cpp @@ -30,8 +30,6 @@ #include "emu.h" #include "nxrom.h" -#include "sound/samples.h" - #ifdef NES_PCB_DEBUG #define VERBOSE 1 #else @@ -202,6 +200,19 @@ void nes_un1rom_device::pcb_reset() chr8(0, m_chr_source); } +void nes_nochr_device::pcb_reset() +{ + prg32(0); + + switch (m_mirroring) + { + case PPU_MIRROR_VERT: m_ciram_a10 = 10; break; + case PPU_MIRROR_HORZ: m_ciram_a10 = 11; break; + case PPU_MIRROR_LOW: m_ciram_a10 = 12; break; + case PPU_MIRROR_HIGH: m_ciram_a10 = 13; break; + } +} + /*------------------------------------------------- mapper specific handlers @@ -488,33 +499,39 @@ void nes_un1rom_device::write_h(offs_t offset, uint8_t data) NoCash NOCHR board emulation - This is an homebrew PCB design on a single chip - (+possibly CIC) which uses the NTRAM as CHRRAM! + This is a homebrew PCB design on a single chip + (+optional CIC) which uses the NTRAM as CHRRAM! + One of PPU A10-A13 is tied directly to CIRAM A10, + meaning the 16K PPU address space (save for the + palette RAM at 0x3f00-0x3fff) appears as the first + 1K page of CIRAM 1, 2, 4, or 8 times followed by + the second 1K page of CIRAM 1, 2, 4, or 8 times, + and then mirrored as many times as necessary. iNES: mapper 218 - In MESS: Supported. + In MAME: Supported. -------------------------------------------------*/ -void nes_nochr_device::chr_w(offs_t offset, uint8_t data) +void nes_nochr_device::chr_w(offs_t offset, u8 data) { - int mirr = get_mirroring(); - if (mirr == PPU_MIRROR_HIGH) - m_ciram[(offset & 0x3ff) + 0x000] = data; - else if (mirr == PPU_MIRROR_LOW) - m_ciram[(offset & 0x3ff) + 0x400] = data; - else - m_ciram[offset & 0x7ff] = data; // not sure here, since there is no software to test... + offset = (offset & 0x3ff) | BIT(offset, m_ciram_a10) << 10; + m_ciram[offset] = data; } -uint8_t nes_nochr_device::chr_r(offs_t offset) +u8 nes_nochr_device::chr_r(offs_t offset) { - int mirr = get_mirroring(); - if (mirr == PPU_MIRROR_HIGH) - return m_ciram[(offset & 0x3ff) + 0x000]; - else if (mirr == PPU_MIRROR_LOW) - return m_ciram[(offset & 0x3ff) + 0x400]; - else - return m_ciram[offset & 0x7ff]; // not sure here, since there is no software to test... + offset = (offset & 0x3ff) | BIT(offset, m_ciram_a10) << 10; + return m_ciram[offset]; +} + +void nes_nochr_device::nt_w(offs_t offset, u8 data) +{ + chr_w(offset + 0x2000, data); +} + +u8 nes_nochr_device::nt_r(offs_t offset) +{ + return chr_r(offset + 0x2000); } diff --git a/src/devices/bus/nes/nxrom.h b/src/devices/bus/nes/nxrom.h index 7150c9657b0..7dedbdb0cad 100644 --- a/src/devices/bus/nes/nxrom.h +++ b/src/devices/bus/nes/nxrom.h @@ -6,7 +6,6 @@ #pragma once #include "nes_slot.h" -#include "sound/samples.h" // ======================> nes_nrom_device @@ -176,12 +175,18 @@ class nes_nochr_device : public nes_nrom_device { public: // construction/destruction - nes_nochr_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + nes_nochr_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - virtual uint8_t chr_r(offs_t offset) override; - virtual void chr_w(offs_t offset, uint8_t data) override; -}; + virtual u8 chr_r(offs_t offset) override; + virtual void chr_w(offs_t offset, u8 data) override; + virtual u8 nt_r(offs_t offset) override; + virtual void nt_w(offs_t offset, u8 data) override; + + virtual void pcb_reset() override; +private: + u8 m_ciram_a10; +}; // device type definition diff --git a/src/devices/bus/nes/pt554.h b/src/devices/bus/nes/pt554.h index 5bf39bb2c8f..51c2bdd9af3 100644 --- a/src/devices/bus/nes/pt554.h +++ b/src/devices/bus/nes/pt554.h @@ -6,6 +6,7 @@ #pragma once #include "nxrom.h" +#include "sound/samples.h" // ======================> nes_bandai_pt554_device |
