mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
sanyo/mbc200.cpp: Handle boot ROM overlay properly.
This commit is contained in:
parent
d26645c531
commit
7ba0d09fb2
1 changed files with 77 additions and 55 deletions
|
@ -12,7 +12,7 @@ Machine MBC-1200 is identical but sold outside of Japan
|
|||
Floppy = 5.25"
|
||||
MBC1200 has one floppy while MBC1250 has 2. The systems are otherwise identical.
|
||||
|
||||
Keyboard communicates via RS232 to uart at E0,E1. The processor and rom for it
|
||||
Keyboard communicates via RS232 to UART at E0,E1. The processor and ROM for it
|
||||
are undumped / unknown. The input codes are not ascii, so using custom code until
|
||||
the required details become available.
|
||||
|
||||
|
@ -34,14 +34,6 @@ TODO:
|
|||
- UART connections
|
||||
- Any other devices?
|
||||
|
||||
2011-10-31 Skeleton driver.
|
||||
2014-05-18 Made rom get copied into ram, boot code from disk
|
||||
requires that ram is there otherwise you get
|
||||
a MEMORY ERROR. CP/M now loads.
|
||||
|
||||
2016-07-16 Added keyboard and sound.
|
||||
2023-04-13 Floppy drive selection fix
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
|
@ -68,6 +60,7 @@ class mbc200_state : public driver_device
|
|||
public:
|
||||
mbc200_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_boot_view(*this, "boot")
|
||||
, m_palette(*this, "palette")
|
||||
, m_crtc(*this, "crtc")
|
||||
, m_ppi_m(*this, "ppi_m")
|
||||
|
@ -80,13 +73,14 @@ public:
|
|||
, m_floppy(*this, "fdc:%u", 0)
|
||||
{ }
|
||||
|
||||
void mbc200(machine_config &config);
|
||||
void mbc200(machine_config &config) ATTR_COLD;
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
virtual void machine_start() override ATTR_COLD;
|
||||
virtual void machine_reset() override ATTR_COLD;
|
||||
|
||||
private:
|
||||
u8 boot_m1_r(offs_t offset);
|
||||
u8 p2_porta_r();
|
||||
void p1_portc_w(u8 data);
|
||||
void pm_porta_w(u8 data);
|
||||
|
@ -94,17 +88,15 @@ private:
|
|||
u8 keyboard_r(offs_t offset);
|
||||
void kbd_put(u8 data);
|
||||
MC6845_UPDATE_ROW(update_row);
|
||||
|
||||
void main_mem(address_map &map) ATTR_COLD;
|
||||
void main_io(address_map &map) ATTR_COLD;
|
||||
void main_opcodes(address_map &map) ATTR_COLD;
|
||||
void sub_mem(address_map &map) ATTR_COLD;
|
||||
void sub_io(address_map &map) ATTR_COLD;
|
||||
|
||||
memory_view m_boot_view;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
void main_mem(address_map &map);
|
||||
void main_io(address_map &map);
|
||||
void sub_mem(address_map &map);
|
||||
void sub_io(address_map &map);
|
||||
|
||||
u8 m_cpu_m_sound = 0U;
|
||||
u8 m_cpu_s_sound = 0U;
|
||||
u8 m_comm_latch = 0U;
|
||||
u8 m_term_data = 0U;
|
||||
required_device<mc6845_device> m_crtc;
|
||||
required_device<i8255_device> m_ppi_m;
|
||||
required_shared_ptr<u8> m_vram;
|
||||
|
@ -114,14 +106,71 @@ private:
|
|||
required_device<speaker_sound_device> m_speaker;
|
||||
required_device<mb8876_device> m_fdc;
|
||||
required_device_array<floppy_connector, 4> m_floppy;
|
||||
|
||||
u8 m_cpu_m_sound = 0U;
|
||||
u8 m_cpu_s_sound = 0U;
|
||||
u8 m_comm_latch = 0U;
|
||||
u8 m_term_data = 0U;
|
||||
};
|
||||
|
||||
|
||||
void mbc200_state::main_mem(address_map &map)
|
||||
{
|
||||
map(0x0000, 0xffff).ram().share("mainram");
|
||||
map(0x0000, 0xffff).ram().share(m_ram);
|
||||
map(0x0000, 0x7fff).view(m_boot_view);
|
||||
m_boot_view[0](0x0000, 0x0fff).mirror(0x7000).rom().region("maincpu", 0).unmapw();
|
||||
}
|
||||
|
||||
void mbc200_state::main_opcodes(address_map &map)
|
||||
{
|
||||
// set up on reset
|
||||
}
|
||||
|
||||
void mbc200_state::main_io(address_map &map)
|
||||
{
|
||||
map.unmap_value_high();
|
||||
map.global_mask(0xff);
|
||||
|
||||
//map(0xe0, 0xe1).rw("uart1", FUNC(i8251_device::read), FUNC(i8251_device::write));
|
||||
map(0xe0, 0xe1).r(FUNC(mbc200_state::keyboard_r)).nopw();
|
||||
map(0xe4, 0xe7).rw(m_fdc, FUNC(mb8876_device::read), FUNC(mb8876_device::write));
|
||||
map(0xe8, 0xeb).rw(m_ppi_m, FUNC(i8255_device::read), FUNC(i8255_device::write));
|
||||
map(0xec, 0xed).rw("uart2", FUNC(i8251_device::read), FUNC(i8251_device::write));
|
||||
}
|
||||
|
||||
|
||||
void mbc200_state::sub_mem(address_map &map)
|
||||
{
|
||||
map.unmap_value_high();
|
||||
map(0x0000, 0x1fff).rom();
|
||||
map(0x2000, 0x7fff).ram();
|
||||
map(0x8000, 0xffff).ram().share("vram");
|
||||
}
|
||||
|
||||
void mbc200_state::sub_io(address_map &map)
|
||||
{
|
||||
map.unmap_value_high();
|
||||
map.global_mask(0xff);
|
||||
|
||||
map(0x70, 0x73).rw("ppi_1", FUNC(i8255_device::read), FUNC(i8255_device::write));
|
||||
map(0xb0, 0xb0).rw(m_crtc, FUNC(mc6845_device::status_r), FUNC(mc6845_device::address_w));
|
||||
map(0xb1, 0xb1).rw(m_crtc, FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w));
|
||||
map(0xd0, 0xd3).rw("ppi_2", FUNC(i8255_device::read), FUNC(i8255_device::write));
|
||||
}
|
||||
|
||||
|
||||
|
||||
u8 mbc200_state::boot_m1_r(offs_t offset)
|
||||
{
|
||||
if (!machine().side_effects_disabled())
|
||||
{
|
||||
m_boot_view.disable();
|
||||
m_maincpu->space(AS_OPCODES).install_rom(0x0000, 0xffff, &m_ram[0]);
|
||||
}
|
||||
return m_ram[0x8000 | offset];
|
||||
}
|
||||
|
||||
|
||||
void mbc200_state::p1_portc_w(u8 data)
|
||||
{
|
||||
m_cpu_s_sound = BIT(data, 4); // used by beep command in basic
|
||||
|
@ -156,26 +205,6 @@ void mbc200_state::pm_portb_w(u8 data)
|
|||
m_speaker->level_w(m_cpu_m_sound + m_cpu_s_sound);
|
||||
}
|
||||
|
||||
void mbc200_state::main_io(address_map &map)
|
||||
{
|
||||
map.unmap_value_high();
|
||||
map.global_mask(0xff);
|
||||
//map(0xe0, 0xe1).rw("uart1", FUNC(i8251_device::read), FUNC(i8251_device::write));
|
||||
map(0xe0, 0xe1).r(FUNC(mbc200_state::keyboard_r)).nopw();
|
||||
map(0xe4, 0xe7).rw(m_fdc, FUNC(mb8876_device::read), FUNC(mb8876_device::write));
|
||||
map(0xe8, 0xeb).rw(m_ppi_m, FUNC(i8255_device::read), FUNC(i8255_device::write));
|
||||
map(0xec, 0xed).rw("uart2", FUNC(i8251_device::read), FUNC(i8251_device::write));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void mbc200_state::sub_mem(address_map &map)
|
||||
{
|
||||
map.unmap_value_high();
|
||||
map(0x0000, 0x1fff).rom();
|
||||
map(0x2000, 0x7fff).ram();
|
||||
map(0x8000, 0xffff).ram().share("vram");
|
||||
}
|
||||
|
||||
u8 mbc200_state::p2_porta_r()
|
||||
{
|
||||
|
@ -186,16 +215,6 @@ u8 mbc200_state::p2_porta_r()
|
|||
return tmp;
|
||||
}
|
||||
|
||||
void mbc200_state::sub_io(address_map &map)
|
||||
{
|
||||
map.unmap_value_high();
|
||||
map.global_mask(0xff);
|
||||
map(0x70, 0x73).rw("ppi_1", FUNC(i8255_device::read), FUNC(i8255_device::write));
|
||||
map(0xb0, 0xb0).rw(m_crtc, FUNC(mc6845_device::status_r), FUNC(mc6845_device::address_w));
|
||||
map(0xb1, 0xb1).rw(m_crtc, FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w));
|
||||
map(0xd0, 0xd3).rw("ppi_2", FUNC(i8255_device::read), FUNC(i8255_device::write));
|
||||
}
|
||||
|
||||
/* Input ports */
|
||||
static INPUT_PORTS_START( mbc200 )
|
||||
INPUT_PORTS_END
|
||||
|
@ -266,7 +285,9 @@ void mbc200_state::machine_start()
|
|||
|
||||
void mbc200_state::machine_reset()
|
||||
{
|
||||
memcpy(m_ram, m_rom, 0x1000);
|
||||
m_boot_view.select(0);
|
||||
m_maincpu->space(AS_OPCODES).install_rom(0x0000, 0x0fff, 0x7000, &m_rom[0]);
|
||||
m_maincpu->space(AS_OPCODES).install_read_handler(0x8000, 0xffff, emu::rw_delegate(*this, FUNC(mbc200_state::boot_m1_r)));
|
||||
}
|
||||
|
||||
static void mbc200_floppies(device_slot_interface &device)
|
||||
|
@ -316,6 +337,7 @@ void mbc200_state::mbc200(machine_config &config)
|
|||
Z80(config, m_maincpu, 8_MHz_XTAL / 2); // NEC D780C-1
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &mbc200_state::main_mem);
|
||||
m_maincpu->set_addrmap(AS_IO, &mbc200_state::main_io);
|
||||
m_maincpu->set_addrmap(AS_OPCODES, &mbc200_state::main_opcodes);
|
||||
|
||||
z80_device &subcpu(Z80(config, "subcpu", 8_MHz_XTAL / 2)); // NEC D780C-1
|
||||
subcpu.set_addrmap(AS_PROGRAM, &mbc200_state::sub_mem);
|
||||
|
@ -374,7 +396,7 @@ ROM_START( mbc200 )
|
|||
ROM_REGION( 0x1000, "maincpu", 0 )
|
||||
ROM_LOAD( "d2732a.bin", 0x0000, 0x1000, CRC(bf364ce8) SHA1(baa3a20a5b01745a390ef16628dc18f8d682d63b))
|
||||
|
||||
ROM_REGION( 0x3000, "subcpu", ROMREGION_ERASEFF )
|
||||
ROM_REGION( 0x2000, "subcpu", ROMREGION_ERASEFF )
|
||||
ROM_LOAD( "m5l2764.bin", 0x0000, 0x2000, CRC(377300a2) SHA1(8563172f9e7f84330378a8d179f4138be5fda099))
|
||||
ROM_END
|
||||
|
||||
|
|
Loading…
Reference in a new issue