diff options
author | 2022-01-25 17:59:21 -0900 | |
---|---|---|
committer | 2022-01-25 21:59:21 -0500 | |
commit | 472785c2c7372ac254d729f5acbecd8f18c75772 (patch) | |
tree | eca085182a3da4a74444d827b0e8bd674df50fc6 /src/devices/bus | |
parent | a5dbadc2e5e7b517d62e7c3f1b506491fbb20228 (diff) |
bus/nes: Fixed 2A03PURITANS board not booting when <1024k. (#9210)
New working software list additions (nes.xml)
-----------------------------------
Famicompo Pico [rainwarrior]
Diffstat (limited to 'src/devices/bus')
-rw-r--r-- | src/devices/bus/nes/2a03pur.cpp | 14 | ||||
-rw-r--r-- | src/devices/bus/nes/2a03pur.h | 8 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/devices/bus/nes/2a03pur.cpp b/src/devices/bus/nes/2a03pur.cpp index ed285bab98a..f2694539752 100644 --- a/src/devices/bus/nes/2a03pur.cpp +++ b/src/devices/bus/nes/2a03pur.cpp @@ -34,7 +34,7 @@ DEFINE_DEVICE_TYPE(NES_2A03PURITANS, nes_2a03pur_device, "nes_2a03pur", "NES Cart 2A03 Puritans Album PCB") -nes_2a03pur_device::nes_2a03pur_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +nes_2a03pur_device::nes_2a03pur_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : nes_nrom_device(mconfig, NES_2A03PURITANS, tag, owner, clock) { } @@ -45,8 +45,8 @@ void nes_2a03pur_device::device_start() { common_start(); save_item(NAME(m_reg)); - memset(m_reg, 0x00, sizeof(m_reg)); - m_reg[7] = 0xff & ((m_prg_chunks << 2) - 1); + std::fill(std::begin(m_reg), std::end(m_reg), 0x00); + m_reg[7] = 0xff; } void nes_2a03pur_device::pcb_reset() @@ -93,17 +93,17 @@ void nes_2a03pur_device::pcb_reset() This has been assigned to iNES mapper 31. -------------------------------------------------*/ -void nes_2a03pur_device::write_l(offs_t offset, uint8_t data) +void nes_2a03pur_device::write_l(offs_t offset, u8 data) { LOG_MMC(("2a03 puritans write_l, offset: %04x, data: %02x\n", offset, data)); offset += 0x100; if (offset >= 0x1000) - m_reg[offset & 7] = data & ((m_prg_chunks << 2) - 1); + m_reg[offset & 7] = data; } -uint8_t nes_2a03pur_device::read_h(offs_t offset) +u8 nes_2a03pur_device::read_h(offs_t offset) { LOG_MMC(("2a03 puritans read_h, offset: %04x\n", offset)); - return m_prg[(m_reg[(offset >> 12) & 7] * 0x1000) + (offset & 0x0fff)]; + return m_prg[((m_reg[BIT(offset, 12, 3)] * 0x1000) + (offset & 0x0fff)) & (m_prg_size - 1)]; } diff --git a/src/devices/bus/nes/2a03pur.h b/src/devices/bus/nes/2a03pur.h index fe7d50d5804..27b4127b5f1 100644 --- a/src/devices/bus/nes/2a03pur.h +++ b/src/devices/bus/nes/2a03pur.h @@ -14,10 +14,10 @@ class nes_2a03pur_device : public nes_nrom_device { public: // construction/destruction - nes_2a03pur_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + nes_2a03pur_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - virtual uint8_t read_h(offs_t offset) override; - virtual void write_l(offs_t offset, uint8_t data) override; + virtual u8 read_h(offs_t offset) override; + virtual void write_l(offs_t offset, u8 data) override; virtual void pcb_reset() override; @@ -26,7 +26,7 @@ protected: virtual void device_start() override; private: - uint8_t m_reg[8]; + u8 m_reg[8]; }; |