(MESS) msx.c: Added harry fox mapper (nw)

This commit is contained in:
Wilbert Pol 2014-06-02 19:22:54 +00:00
parent 9694dc6f94
commit 519dfaece7
6 changed files with 118 additions and 2 deletions

2
.gitattributes vendored
View File

@ -999,6 +999,8 @@ src/emu/bus/msx_cart/crossblaim.c svneol=native#text/plain
src/emu/bus/msx_cart/crossblaim.h svneol=native#text/plain
src/emu/bus/msx_cart/fmpac.c svneol=native#text/plain
src/emu/bus/msx_cart/fmpac.h svneol=native#text/plain
src/emu/bus/msx_cart/hfox.c svneol=native#text/plain
src/emu/bus/msx_cart/hfox.h svneol=native#text/plain
src/emu/bus/msx_cart/konami.c svneol=native#text/plain
src/emu/bus/msx_cart/konami.h svneol=native#text/plain
src/emu/bus/msx_cart/korean.c svneol=native#text/plain

View File

@ -6535,13 +6535,13 @@ kept for now until finding out what those bytes affect...
</part>
</software>
<software name="hfox2" cloneof="hfox" supported="no">
<software name="hfox2" cloneof="hfox">
<description>Hurry Fox - Yuki no Maou hen (Jpn)</description>
<year>1985</year>
<publisher>MicroCabin</publisher>
<info name="alt_title" value="は~りぃふぉっくす雪の魔王編" />
<part name="cart" interface="msx_cart">
<feature name="slot" value="ascii16" />
<feature name="slot" value="hfox" />
<feature name="mapper" value="M60002-0125SP-16" />
<dataarea name="rom" size="65536">
<rom name="harryfox yki no maoh (japan).rom" size="65536" crc="c7fe3ee1" sha1="3626b5dd3188ec2a16e102d05c79f8f242fbd892" offset="0" />

View File

@ -411,6 +411,7 @@ BUSOBJS += $(BUSOBJ)/msx_cart/ascii.o
BUSOBJS += $(BUSOBJ)/msx_cart/cartridge.o
BUSOBJS += $(BUSOBJ)/msx_cart/crossblaim.o
BUSOBJS += $(BUSOBJ)/msx_cart/fmpac.o
BUSOBJS += $(BUSOBJ)/msx_cart/hfox.o
BUSOBJS += $(BUSOBJ)/msx_cart/konami.o
BUSOBJS += $(BUSOBJ)/msx_cart/korean.o
BUSOBJS += $(BUSOBJ)/msx_cart/majutsushi.o

View File

@ -4,6 +4,7 @@
#include "ascii.h"
#include "crossblaim.h"
#include "fmpac.h"
#include "hfox.h"
#include "konami.h"
#include "korean.h"
#include "majutsushi.h"
@ -42,6 +43,7 @@ SLOT_INTERFACE_START(msx_cart)
SLOT_INTERFACE_INTERNAL("msxaud_fsca1", MSX_CART_MSX_AUDIO_FSCA1)
SLOT_INTERFACE_INTERNAL("msxaud_nms1205", MSX_CART_MSX_AUDIO_NMS1205)
SLOT_INTERFACE_INTERNAL("super_swangi", MSX_CART_SUPER_SWANGI)
SLOT_INTERFACE_INTERNAL("hfox", MSX_CART_HFOX)
SLOT_INTERFACE_END

View File

@ -0,0 +1,78 @@
#include "emu.h"
#include "hfox.h"
const device_type MSX_CART_HFOX = &device_creator<msx_cart_hfox>;
msx_cart_hfox::msx_cart_hfox(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, MSX_CART_HFOX, "MSX Cartridge - Harry Fox", tag, owner, clock, "msx_cart_hfox", __FILE__)
, msx_cart_interface(mconfig, *this)
{
m_selected_bank[0] = m_selected_bank[1] = 0;
m_bank_base[0] = m_bank_base[1] = NULL;
}
void msx_cart_hfox::device_start()
{
save_item(NAME(m_selected_bank));
machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_hfox::restore_banks), this));
}
void msx_cart_hfox::restore_banks()
{
m_bank_base[0] = get_rom_base() + ((m_selected_bank[0] & 0x01) * 0x8000);
m_bank_base[1] = get_rom_base() + ((m_selected_bank[1] & 0x01) * 0x8000) + 0x4000;
}
void msx_cart_hfox::device_reset()
{
m_selected_bank[0] = m_selected_bank[1] = 0;
}
void msx_cart_hfox::initialize_cartridge()
{
if (get_rom_size() < 0x10000)
{
fatalerror("rtype: Invalid ROM size\n");
}
restore_banks();
}
READ8_MEMBER(msx_cart_hfox::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
return m_bank_base[offset >> 15][offset & 0x3fff];
}
return 0xff;
}
WRITE8_MEMBER(msx_cart_hfox::write_cart)
{
switch (offset)
{
case 0x6000:
m_selected_bank[0] = data;
restore_banks();
break;
case 0x7000:
m_selected_bank[1] = data;
restore_banks();
break;
default:
printf("msx_cart_hfox: unhandled write %02x to %04x\n", data, offset);
break;
}
}

View File

@ -0,0 +1,33 @@
#ifndef __MSX_CART_HFOX_H
#define __MSX_CART_HFOX_H
#include "bus/msx_cart/cartridge.h"
extern const device_type MSX_CART_HFOX;
class msx_cart_hfox : public device_t
, public msx_cart_interface
{
public:
msx_cart_hfox(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// device-level overrides
virtual void device_start();
virtual void device_reset();
virtual void initialize_cartridge();
virtual DECLARE_READ8_MEMBER(read_cart);
virtual DECLARE_WRITE8_MEMBER(write_cart);
void restore_banks();
private:
UINT8 m_selected_bank[2];
UINT8 *m_bank_base[2];
};
#endif