(MESS) msx.c: Implemented some more things in the matsushita switched device. Firmware in fs4500 now seems to work. (nw)

This commit is contained in:
Wilbert Pol 2014-05-18 13:05:42 +00:00
parent 7b7f2f8291
commit bac3e7672f
3 changed files with 113 additions and 13 deletions

View File

@ -22,13 +22,8 @@
** - yis503m: sfg not emulated
** - cpc300: Config for MSX Tutor ON/OFF is not saved
** - expert20: Does not boot
** - fs4500: Firmware not emulated
** - fs4500: Matsuhita switched device not emulated
** - fs4600: Firmware not emulated
** - fs4600: Kanji12 not emulated
** - fs4700: Firmware not emulated
** - fs4700: Matsushita switched device not emulated
** - fs5500: Matsushita switched device not emulated
** - fsa1fm: Firmware not emulated
** - fsa1fm: kanji12 not emulated
** - nms8280, nms8280g: Digitizer functionality not emulated
@ -46,7 +41,6 @@
** - expert3i: IDE not emulated
** - expert3t: Turbo not emulated
** - expertac: Does not boot
** - expertdx: Floppy not emulated
** - fsa1fx: Floppy not emulated
** - fsa1fx: Keeps rebooting into firmware
** - fsa1wsx: Firmware not emulated
@ -3396,7 +3390,7 @@ static MACHINE_CONFIG_DERIVED( fs4500, msx2 )
MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000)
MCFG_MSX_LAYOUT_ROM("ext", 0, 1, 0, 1, "maincpu", 0x8000)
MCFG_MSX_LAYOUT_ROM("font", 0, 2, 0, 1, "maincpu", 0x20000)
MCFG_MSX_LAYOUT_BUNSETSU("buns", 0, 2, 2, 2, "maincpu", 0x24000, "bunsetsu")
MCFG_MSX_LAYOUT_BUNSETSU("buns", 0, 2, 1, 2, "maincpu", 0x24000, "bunsetsu")
MCFG_MSX_LAYOUT_ROM("jush", 0, 3, 1, 2, "maincpu", 0x2c000)
MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0)
MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0)
@ -3408,6 +3402,8 @@ static MACHINE_CONFIG_DERIVED( fs4500, msx2 )
MCFG_MSX_S1985_ADD("s1985")
MCFG_MSX_MATSUSHITA_ADD( "matsushita" )
MCFG_FRAGMENT_ADD( msx2_cartlist )
MACHINE_CONFIG_END
@ -3509,6 +3505,8 @@ static MACHINE_CONFIG_DERIVED( fs4700, msx2 )
MCFG_MSX_S1985_ADD("s1985")
MCFG_MSX_MATSUSHITA_ADD( "matsushita" )
MCFG_FRAGMENT_ADD( msx_mb8877a )
MCFG_FRAGMENT_ADD( msx_1_35_dd_drive )
MCFG_FRAGMENT_ADD( msx2_floplist )
@ -3600,6 +3598,8 @@ static MACHINE_CONFIG_DERIVED( fs5500f1, msx2 )
MCFG_MSX_S1985_ADD("s1985")
MCFG_MSX_MATSUSHITA_ADD( "matsushita" )
MCFG_FRAGMENT_ADD( msx_mb8877a )
MCFG_FRAGMENT_ADD( msx_1_35_dd_drive )
MCFG_FRAGMENT_ADD( msx2_floplist )
@ -3647,6 +3647,8 @@ static MACHINE_CONFIG_DERIVED( fs5500f2, msx2 )
MCFG_MSX_S1985_ADD("s1985")
MCFG_MSX_MATSUSHITA_ADD( "matsushita" )
MCFG_FRAGMENT_ADD( msx_mb8877a )
MCFG_FRAGMENT_ADD( msx_2_35_dd_drive )
MCFG_FRAGMENT_ADD( msx2_floplist )

View File

@ -8,7 +8,12 @@ const device_type MSX_MATSUSHITA = &device_creator<msx_matsushita_device>;
msx_matsushita_device::msx_matsushita_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: msx_switched_device(mconfig, MSX_MATSUSHITA, "Matsushita switched device", tag, owner, clock, "msx_matsushita", __FILE__)
, m_io_config(*this, "CONFIG")
, m_nvram(*this, "nvram")
, m_turbo_out_cb(*this)
, m_address(0)
, m_nibble1(0)
, m_nibble2(0)
, m_pattern(0)
{
}
@ -19,6 +24,17 @@ UINT8 msx_matsushita_device::get_id()
}
static MACHINE_CONFIG_FRAGMENT( matsushita )
MCFG_NVRAM_ADD_0FILL("nvram")
MACHINE_CONFIG_END
machine_config_constructor msx_matsushita_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( matsushita );
}
static INPUT_PORTS_START( matsushita )
PORT_START("CONFIG")
PORT_CONFNAME( 0x80, 0x00, "Firmware switch")
@ -37,21 +53,42 @@ ioport_constructor msx_matsushita_device::device_input_ports() const
void msx_matsushita_device::device_start()
{
msx_switched_device::device_start();
m_turbo_out_cb.resolve_safe();
m_sram.resize(0x800);
m_nvram->set_base((UINT8*)m_sram, 0x000);
}
READ8_MEMBER(msx_matsushita_device::io_read)
{
switch (offset)
{
case 0:
case 0x00:
return ~get_id();
case 1:
case 0x01:
return m_io_config->read();
case 0x03:
{
UINT8 result = (((m_pattern & 0x80) ? m_nibble1 : m_nibble2) << 4) | ((m_pattern & 0x40) ? m_nibble1 : m_nibble2);
m_pattern = (m_pattern << 2) | (m_pattern >> 6);
return result;
}
break;
case 0x09: // Data
if (m_address < m_sram.count())
{
return m_sram[m_address];
}
break;
default:
printf("msx_matsushita: unhandled read from offset %02x\n", offset);
logerror("msx_matsushita: unhandled read from offset %02x\n", offset);
break;
}
@ -59,6 +96,35 @@ READ8_MEMBER(msx_matsushita_device::io_read)
}
/*
03 <- 10
04 <- fe
4x read 04 and store at CC46-CC49
03 <- 10
04 <- ce
4x read 04 and store at CC4A-CC4D
03 <- 10
04 <- fe
4x read 04 and store at CC4E-CC51
03 <- 10
04 <- fc
4x read 04 and store at CC46-CC49
03 <- 10
04 <- cc
4x read 04 and store at CC4A-CC4D
03 <- 10
04 <- fc
4x read 04 and store at CC4E-CC51
*/
WRITE8_MEMBER(msx_matsushita_device::io_write)
{
switch (offset)
@ -70,8 +136,32 @@ WRITE8_MEMBER(msx_matsushita_device::io_write)
m_turbo_out_cb((data & 1) ? ASSERT_LINE : CLEAR_LINE);
break;
case 0x03:
m_nibble1 = data & 0x0f;
m_nibble2 = data >> 4;
break;
case 0x04:
m_pattern = data;
break;
case 0x07: // Address low
m_address = (m_address & 0xff00) | data;
break;
case 0x08: // Address high
m_address = (m_address & 0xff) | (data << 8);
break;
case 0x09: // Data
if (m_address < m_sram.count())
{
m_sram[m_address] = data;
}
break;
default:
printf("msx_matsushita: unhandled write %02x to offset %02x\n", data, offset);
logerror("msx_matsushita: unhandled write %02x to offset %02x\n", data, offset);
break;
}
}

View File

@ -3,6 +3,7 @@
#include "msx_switched.h"
#include "machine/nvram.h"
extern const device_type MSX_MATSUSHITA;
@ -23,6 +24,7 @@ public:
template<class _Object> static devcb_base &set_turbo_callback(device_t &device, _Object object) { return downcast<msx_matsushita_device &>(device).m_turbo_out_cb.set_callback(object); }
virtual void device_start();
virtual machine_config_constructor device_mconfig_additions() const;
virtual ioport_constructor device_input_ports() const;
virtual UINT8 get_id();
@ -31,8 +33,14 @@ public:
virtual DECLARE_WRITE8_MEMBER(io_write);
private:
required_ioport m_io_config;
devcb_write_line m_turbo_out_cb;
required_ioport m_io_config;
required_device<nvram_device> m_nvram;
devcb_write_line m_turbo_out_cb;
UINT16 m_address;
dynamic_buffer m_sram;
UINT8 m_nibble1;
UINT8 m_nibble2;
UINT8 m_pattern;
};
#endif