(MESS) msx.c: Added support for the MSX-JE firmwares in the Sony HB-F1XDJ and HB-F1XV machines. (nw)

This commit is contained in:
Wilbert Pol 2014-05-16 20:54:14 +00:00
parent d00cca158c
commit 0c70b32092
6 changed files with 244 additions and 4 deletions

2
.gitattributes vendored
View File

@ -1014,6 +1014,8 @@ src/emu/bus/msx_slot/rom.c svneol=native#text/plain
src/emu/bus/msx_slot/rom.h svneol=native#text/plain
src/emu/bus/msx_slot/slot.c svneol=native#text/plain
src/emu/bus/msx_slot/slot.h svneol=native#text/plain
src/emu/bus/msx_slot/sony08.c svneol=native#text/plain
src/emu/bus/msx_slot/sony08.h svneol=native#text/plain
src/emu/bus/nes/2a03pur.c svneol=native#text/plain
src/emu/bus/nes/2a03pur.h svneol=native#text/plain
src/emu/bus/nes/act53.c svneol=native#text/plain

View File

@ -404,6 +404,7 @@ BUSOBJS += $(BUSOBJ)/msx_slot/rom.o
BUSOBJS += $(BUSOBJ)/msx_slot/ram.o
BUSOBJS += $(BUSOBJ)/msx_slot/ram_mm.o
BUSOBJS += $(BUSOBJ)/msx_slot/slot.o
BUSOBJS += $(BUSOBJ)/msx_slot/sony08.o
OBJDIRS += $(BUSOBJ)/msx_cart
BUSOBJS += $(BUSOBJ)/msx_cart/ascii.o
BUSOBJS += $(BUSOBJ)/msx_cart/cartridge.o

View File

@ -0,0 +1,189 @@
/*
Emulation of the firmware mapper as found in Sony HB-F1XDJ and HB-F1XV machines.
*/
#include "emu.h"
#include "sony08.h"
const device_type MSX_SLOT_SONY08 = &device_creator<msx_slot_sony08_device>;
msx_slot_sony08_device::msx_slot_sony08_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, MSX_SLOT_SONY08, "MSX Internal SONY08", tag, owner, clock, "msx_slot_sony08", __FILE__)
, msx_internal_slot_interface()
, m_nvram(*this, "nvram")
, m_region(NULL)
, m_region_offset(0)
, m_rom(NULL)
{
for (int i = 0; i < 8; i++)
{
m_selected_bank[i] = 0;
m_bank_base[i] = NULL;
}
memset(m_sram, 0, sizeof(m_sram));
}
static MACHINE_CONFIG_FRAGMENT( sony08 )
MCFG_NVRAM_ADD_0FILL("nvram")
MACHINE_CONFIG_END
machine_config_constructor msx_slot_sony08_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( sony08 );
}
void msx_slot_sony08_device::set_rom_start(device_t &device, const char *region, UINT32 offset)
{
msx_slot_sony08_device &dev = downcast<msx_slot_sony08_device &>(device);
dev.m_region = region;
dev.m_region_offset = offset;
}
void msx_slot_sony08_device::device_start()
{
assert(m_region != NULL );
memory_region *m_rom_region = owner()->memregion(m_region);
// Sanity checks
if (m_rom_region == NULL )
{
fatalerror("Rom slot '%s': Unable to find memory region '%s'\n", tag(), m_region);
}
if (m_rom_region->bytes() < m_region_offset + 0x100000)
{
fatalerror("Memory region '%s' is too small for the SONY08 firmware\n", m_region);
}
m_rom = m_rom_region->base() + m_region_offset;
m_nvram->set_base(m_sram, 0x4000);
save_item(NAME(m_selected_bank));
machine().save().register_postload(save_prepost_delegate(FUNC(msx_slot_sony08_device::restore_banks), this));
restore_banks();
}
void msx_slot_sony08_device::map_bank(int bank)
{
if (bank < 2)
{
return;
}
// Special banks
if (bank == 6 || bank == 7)
{
m_bank_base[bank] = m_rom + 0x80000 + (m_selected_bank[bank] * 0x800);
return;
}
m_bank_base[bank] = m_rom + ((m_selected_bank[bank] * 0x2000) & 0xFFFFF);
if (bank == 2)
{
if (m_selected_bank[bank] & 0x80)
{
m_bank_base[0] = m_sram;
m_bank_base[1] = m_sram + 0x2000;
}
else
{
m_bank_base[0] = NULL;
m_bank_base[1] = NULL;
}
}
}
void msx_slot_sony08_device::restore_banks()
{
for (int i = 0; i < 8; i++)
{
map_bank(i);
}
}
READ8_MEMBER(msx_slot_sony08_device::read)
{
if (offset >= 0xc000)
{
return 0xFF;
}
if ((offset & 0xf000) == 0x7000 && (m_selected_bank[3] & 0x80))
{
return m_bank_base[6 + ((offset >> 11) & 0x01)][offset & 0x7ff];
}
const UINT8 *mem = m_bank_base[offset >> 13];
if (mem)
{
return mem[offset & 0x1fff];
}
return 0xFF;
}
WRITE8_MEMBER(msx_slot_sony08_device::write)
{
if (offset < 0x4000)
{
if (m_bank_base[0] != NULL)
{
m_sram[offset & 0x3fff] = data;
return;
}
}
switch (offset)
{
case 0x4FFF:
m_selected_bank[2] = data;
map_bank(2);
break;
case 0x6FFF: // 6000-7FFF
m_selected_bank[3] = data;
map_bank(3);
break;
case 0x77FF:
m_selected_bank[6] = data;
map_bank(6);
break;
case 0x7FFF:
m_selected_bank[7] = data;
map_bank(7);
break;
case 0x8FFF:
m_selected_bank[4] = data;
map_bank(4);
break;
case 0xAFFF:
m_selected_bank[5] = data;
map_bank(5);
break;
default:
logerror("Unhandled write %02x to %04x\n", data, offset);
break;
}
}

View File

@ -0,0 +1,45 @@
#ifndef __MSX_SLOT_SONY08_H
#define __MSX_SLOT_SONY08_H
#include "slot.h"
#include "machine/nvram.h"
extern const device_type MSX_SLOT_SONY08;
#define MCFG_MSX_SLOT_SONY08_ADD(_tag, _startpage, _numpages, _region, _offset) \
MCFG_MSX_INTERNAL_SLOT_ADD(_tag, MSX_SLOT_SONY08, _startpage, _numpages) \
msx_slot_sony08_device::set_rom_start(*device, _region, _offset);
class msx_slot_sony08_device : public device_t,
public msx_internal_slot_interface
{
public:
msx_slot_sony08_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// static configuration helpers
static void set_rom_start(device_t &device, const char *region, UINT32 offset);
virtual void device_start();
virtual machine_config_constructor device_mconfig_additions() const;
virtual DECLARE_READ8_MEMBER(read);
virtual DECLARE_WRITE8_MEMBER(write);
void restore_banks();
private:
required_device<nvram_device> m_nvram;
const char *m_region;
UINT32 m_region_offset;
const UINT8 *m_rom;
UINT8 m_selected_bank[8];
const UINT8 *m_bank_base[8];
UINT8 m_sram[0x4000];
void map_bank(int bank);
};
#endif

View File

@ -58,8 +58,6 @@
** - fsa1wxa: Floppy not emulated
** - phc70fd: Floppy not emulated
** - phc70fd2: Floppy not emulated
** - hbf1xdj: Firmware not emulated
** - hbf1xv: Firmare not emulated
** - hbf9sp: Firmware not working, can't get into basic
** - fsa1gt: Add Turbo-R support
** - fsa1st: Add Turbo-R support
@ -5588,7 +5586,7 @@ static MACHINE_CONFIG_DERIVED( hbf1xdj, msx2p )
// S-1985 MSX Engine
MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000)
/* MCFG_MSX_LAYOUT_("firm", 0, 3, 1, 4, SONY08, 0x100000, 0x30000) */ /* Sony 08KB MSX-JE Mapper must be emulated */
MCFG_MSX_LAYOUT_SONY08("firm", 0, 3, 0, 4, "maincpu", 0x30000)
MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0)
MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0)
MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */
@ -5635,7 +5633,7 @@ static MACHINE_CONFIG_DERIVED( hbf1xv, msx2p )
// S-1985 MSX Engine
MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000)
/* MCFG_MSX_LAYOUT_("firm", 0, 3, 1, 4, SONY08, 0x100000, 0x30000) */ /* Sony 08KB MSX-JE Mapper must be emulated */
MCFG_MSX_LAYOUT_SONY08("firm", 0, 3, 0, 4, "maincpu", 0x30000)
MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0)
MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0)
MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 0, 0x10000) /* 64KB Mapper RAM */

View File

@ -39,6 +39,7 @@
#include "bus/msx_slot/bunsetsu.h"
#include "bus/msx_slot/fs4600.h"
#include "bus/msx_slot/panasonic08.h"
#include "bus/msx_slot/sony08.h"
#define TC8521_TAG "rtc"
@ -86,6 +87,10 @@
MCFG_MSX_SLOT_PANASONIC08_ADD(_tag, _page, _numpages, _region, _offset) \
msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device);
#define MCFG_MSX_LAYOUT_SONY08(_tag, _prim, _sec, _page, _numpages, _region, _offset) \
MCFG_MSX_SLOT_SONY08_ADD(_tag, _page, _numpages, _region, _offset) \
msx_state::install_slot_pages(*owner, _prim, _sec, _page, _numpages, device);
class msx_state : public driver_device
{