bus/nes: Fixed loading and bank locking for EH8813A boards. (#8666)

New working software list additions (nes.xml)
-----------------------------------
1996 Yīngyǔ CAI 3 in 1 (China) [taizou]
Xiǎoxuéshēng Shùxué CAI (China) [MLX]
This commit is contained in:
0kmg 2021-10-06 18:20:35 -08:00 committed by GitHub
parent 0a1a74b735
commit 670a52740a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 71 additions and 38 deletions

View File

@ -55456,6 +55456,43 @@ preliminary proto for the PAL version, still running on NTSC systems) or the gfx
</part>
</software>
<software name="mathcai">
<description>Xiǎoxuéshēng Shùxué CAI (China)</description>
<year>1996</year>
<publisher>Waixing</publisher>
<info name="serial" value="ES-1037"/>
<info name="alt_title" value="小学生数学 CAI"/>
<part name="cart" interface="nes_cart">
<feature name="slot" value="unl_eh8813a" />
<feature name="pcb" value="UNL-EH8813A" />
<feature name="peripheral" value="subor_keyboard" />
<dataarea name="prg" size="131072">
<rom name="elementary school math cai.prg" size="131072" crc="7b30a397" sha1="7d635ffacb6b947bc9a134aecafe65e968b516ab" status="baddump" />
</dataarea>
<dataarea name="chr" size="131072">
<rom name="elementary school math cai.chr" size="131072" crc="38b9a06a" sha1="d50e50817905ea1ed39cd7b446eb31cfd29658bd" status="baddump" />
</dataarea>
</part>
</software>
<software name="englcai">
<description>1996 Yīngyǔ CAI 3 in 1 (China)</description>
<year>1996</year>
<publisher>Waixing</publisher>
<info name="serial" value="ES-1???"/>
<info name="alt_title" value="1996 英語 CAI 3合1"/>
<part name="cart" interface="nes_cart">
<feature name="slot" value="unl_eh8813a" />
<feature name="pcb" value="UNL-EH8813A" />
<dataarea name="prg" size="262144">
<rom name="1996 english cai 3-in-1.prg" size="262144" crc="e2654b44" sha1="1f5c72a9844bda2c554f384e128761fb1f48c9be" status="baddump" />
</dataarea>
<dataarea name="chr" size="131072">
<rom name="1996 english cai 3-in-1.chr" size="131072" crc="af296124" sha1="51775019b1cbb940fdd82f82020fa419c0080457" status="baddump" />
</dataarea>
</part>
</software>
<software name="zhengbas">
<description>Zheng Ba ShiJi (Chi, Decrypted WXN)</description>
<year>19??</year>

View File

@ -127,8 +127,8 @@ nes_cityfight_device::nes_cityfight_device(const machine_config &mconfig, const
{
}
nes_eh8813a_device::nes_eh8813a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: nes_nrom_device(mconfig, NES_EH8813A, tag, owner, clock), m_dipsetting(0), m_latch(0)
nes_eh8813a_device::nes_eh8813a_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: nes_nrom_device(mconfig, NES_EH8813A, tag, owner, clock), m_jumper(0), m_latch(0), m_reg(0)
{
}
@ -402,20 +402,19 @@ void nes_cityfight_device::pcb_reset()
void nes_eh8813a_device::device_start()
{
common_start();
save_item(NAME(m_dipsetting));
save_item(NAME(m_jumper));
save_item(NAME(m_latch));
save_item(NAME(m_reg));
}
void nes_eh8813a_device::pcb_reset()
{
m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
prg16_89ab(0);
prg16_89ab(m_prg_chunks - 1);
chr8(0, m_chr_source);
set_nt_mirroring(PPU_MIRROR_VERT);
prg32(0);
chr8(0, CHRROM);
m_dipsetting = 0; // no means to adjust cart DIPs - unimplemented
m_jumper = 0;
m_latch = 0;
m_reg = 0;
}
@ -1238,46 +1237,41 @@ void nes_cityfight_device::write_h(offs_t offset, uint8_t data)
UNL-EH8813A
Games: Dr. Mario II
Board is used in multicarts other than this? "BY ES"
in pause menu suggests this may be by Waixing. Title
menus change with DIP settings (currently unimplemented),
but it is unclear if PCB has switch or solder pads or...?
Games: Dr. Mario II, 1996 English CAI 3 in 1,
Elementary School Math CAI
NES 2.0: mapper 519
In MAME: Preliminary supported.
In MAME: Supported.
-------------------------------------------------*/
void nes_eh8813a_device::write_h(offs_t offset, uint8_t data)
void nes_eh8813a_device::write_h(offs_t offset, u8 data)
{
LOG_MMC(("unl_eh8813a write_h, offset: %04x, data: %02x\n", offset, data));
if (BIT(offset, 8))
return;
chr8(data & 0x7f, m_chr_source);
set_nt_mirroring(BIT(data, 7) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
uint8_t bank = offset & 0x3f;
if (BIT(offset, 7))
if (!BIT(m_latch, 8))
{
prg16_89ab(bank);
prg16_cdef(bank);
}
else
prg32(bank >> 1);
m_latch = offset;
m_reg = data;
m_latch = BIT(offset, 6);
u8 bank = m_latch & 0x3f;
u8 mode = !BIT(m_latch, 7);
prg16_89ab(bank & ~mode);
prg16_cdef(bank | mode);
set_nt_mirroring(BIT(m_reg, 7) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
}
chr8((m_reg & 0x7c) | (data & 0x03), CHRROM);
}
uint8_t nes_eh8813a_device::read_h(offs_t offset)
u8 nes_eh8813a_device::read_h(offs_t offset)
{
LOG_MMC(("unl_eh8813a read_h, offset: %04x\n", offset));
if (m_latch)
offset = (offset & 0xfff0) | m_dipsetting;
if (BIT(m_latch, 6))
offset = (offset & ~0x0f) | m_jumper; // TODO: jumper setting that controls which menu appears is 0 for now
return hi_access_rom(offset);
}

View File

@ -349,10 +349,10 @@ class nes_eh8813a_device : public nes_nrom_device
{
public:
// construction/destruction
nes_eh8813a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
nes_eh8813a_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_h(offs_t offset, uint8_t data) override;
virtual u8 read_h(offs_t offset) override;
virtual void write_h(offs_t offset, u8 data) override;
virtual void pcb_reset() override;
@ -361,7 +361,9 @@ protected:
virtual void device_start() override;
private:
uint8_t m_dipsetting, m_latch;
u8 m_jumper;
u16 m_latch;
u8 m_reg;
};