(MESS) channelf: added older multicart revision (the one with the bankswitch

we were emulating) and added support for the bankswitch mechanism used
by the final revision. nw.

(some work is still needed before promoting the two carts to working state)
This commit is contained in:
Fabio Priuli 2014-10-13 04:35:25 +00:00
parent ccd29c3447
commit 088936a672
6 changed files with 97 additions and 23 deletions

View File

@ -530,8 +530,8 @@
</software>
<software name="multicrt">
<description>Channel F Multi-Cart</description>
<software name="multicrt" supported="partial">
<description>Channel F Multi-Cart (Final)</description>
<year>2004</year>
<publisher>&lt;homebrew&gt;</publisher>
<part name="cart" interface="channelf_cart">
@ -542,5 +542,17 @@
</part>
</software>
<software name="multicrto" cloneof="multicrt" supported="partial">
<description>Channel F Multi-Cart (Older)</description>
<year>2004</year>
<publisher>&lt;homebrew&gt;</publisher>
<part name="cart" interface="channelf_cart">
<feature name="slot" value="multi_old" />
<dataarea name="rom" size="262144">
<rom name="multigame older.bin" size="262144" crc="ad4ebe3f" sha1="6064489fd4ba0b95fa4effcd8ee971751504c63f" offset="0" />
</dataarea>
</part>
</software>
</softwarelist>

View File

@ -25,7 +25,8 @@ const device_type CHANF_ROM_STD = &device_creator<chanf_rom_device>;
const device_type CHANF_ROM_MAZE = &device_creator<chanf_maze_device>;
const device_type CHANF_ROM_HANGMAN = &device_creator<chanf_hangman_device>;
const device_type CHANF_ROM_CHESS = &device_creator<chanf_chess_device>;
const device_type CHANF_ROM_MULTI = &device_creator<chanf_multi_device>;
const device_type CHANF_ROM_MULTI_OLD = &device_creator<chanf_multi_old_device>;
const device_type CHANF_ROM_MULTI_FINAL = &device_creator<chanf_multi_final_device>;
chanf_rom_device::chanf_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
@ -55,8 +56,13 @@ chanf_chess_device::chanf_chess_device(const machine_config &mconfig, const char
{
}
chanf_multi_device::chanf_multi_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: chanf_rom_device(mconfig, CHANF_ROM_MULTI, "Channel F Multigame Cart", tag, owner, clock, "chanf_multi", __FILE__)
chanf_multi_old_device::chanf_multi_old_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: chanf_rom_device(mconfig, CHANF_ROM_MULTI_OLD, "Channel F Multigame (Earlier Version) Cart", tag, owner, clock, "chanf_multi_old", __FILE__)
{
}
chanf_multi_final_device::chanf_multi_final_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: chanf_rom_device(mconfig, CHANF_ROM_MULTI_FINAL, "Channel F Multigame (Final Version) Cart", tag, owner, clock, "chanf_multi_fin", __FILE__)
{
}
@ -109,17 +115,30 @@ void chanf_hangman_device::device_reset()
}
void chanf_multi_device::device_start()
void chanf_multi_old_device::device_start()
{
save_item(NAME(m_base_bank));
}
void chanf_multi_device::device_reset()
void chanf_multi_old_device::device_reset()
{
m_base_bank = 0;
}
void chanf_multi_final_device::device_start()
{
save_item(NAME(m_base_bank));
save_item(NAME(m_half_bank));
}
void chanf_multi_final_device::device_reset()
{
m_base_bank = 0;
m_half_bank = 0;
}
/*-------------------------------------------------
mapper specific handlers
-------------------------------------------------*/
@ -191,16 +210,32 @@ void chanf_rom_device::common_write_3853(UINT32 offset, UINT8 data)
m_ram[offset] = data;
}
READ8_MEMBER(chanf_multi_device::read_rom)
READ8_MEMBER(chanf_multi_old_device::read_rom)
{
if (offset < 0x2000)
return m_rom[offset + (m_base_bank * 0x2000)];
return m_rom[offset + m_base_bank * 0x2000];
else
return 0xff;
}
WRITE8_MEMBER(chanf_multi_device::write_bank)
WRITE8_MEMBER(chanf_multi_old_device::write_bank)
{
m_base_bank = data;
//printf("0x%x\n", data);
m_base_bank = data & 0x1f;
}
READ8_MEMBER(chanf_multi_final_device::read_rom)
{
if (offset < 0x2000)
return m_rom[offset + (m_base_bank * 0x2000) + (m_half_bank * 0x1000)];
else
return 0xff;
}
WRITE8_MEMBER(chanf_multi_final_device::write_bank)
{
//printf("0x%x\n", data);
m_base_bank = data & 0x1f;
m_half_bank = BIT(data, 5);
}

View File

@ -84,13 +84,13 @@ public:
};
// ======================> chanf_multi_device
// ======================> chanf_multi_old_device
class chanf_multi_device : public chanf_rom_device
class chanf_multi_old_device : public chanf_rom_device
{
public:
// construction/destruction
chanf_multi_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
chanf_multi_old_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// device-level overrides
virtual void device_start();
@ -107,13 +107,36 @@ private:
};
// ======================> chanf_multi_final_device
class chanf_multi_final_device : public chanf_rom_device
{
public:
// construction/destruction
chanf_multi_final_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// device-level overrides
virtual void device_start();
virtual void device_reset();
// reading and writing
virtual DECLARE_READ8_MEMBER(read_rom);
virtual DECLARE_READ8_MEMBER(read_ram) { return common_read_3853(offset); }
virtual DECLARE_WRITE8_MEMBER(write_ram) { common_write_3853(offset, data); }
virtual DECLARE_WRITE8_MEMBER(write_bank);
private:
int m_base_bank, m_half_bank;
};
// device type definition
extern const device_type CHANF_ROM_STD;
extern const device_type CHANF_ROM_MAZE;
extern const device_type CHANF_ROM_HANGMAN;
extern const device_type CHANF_ROM_CHESS;
extern const device_type CHANF_ROM_MULTI;
extern const device_type CHANF_ROM_MULTI_OLD;
extern const device_type CHANF_ROM_MULTI_FINAL;
#endif

View File

@ -124,11 +124,12 @@ struct chanf_slot
// Here, we take the feature attribute from .xml (i.e. the PCB name) and we assign a unique ID to it
static const chanf_slot slot_list[] =
{
{ CF_STD, "std" },
{ CF_MAZE, "maze" },
{ CF_HANGMAN, "hangman" },
{ CF_CHESS, "chess" },
{ CF_MULTI, "multi" }
{ CF_STD, "std" },
{ CF_MAZE, "maze" },
{ CF_HANGMAN, "hangman" },
{ CF_CHESS, "chess" },
{ CF_MULTI_OLD,"multi_old" },
{ CF_MULTI, "multi" }
};
static int chanf_get_pcb_id(const char *slot)
@ -175,9 +176,9 @@ bool channelf_cart_slot_device::call_load()
// we default to "chess" slot because some homebrew programs have been written to run
// on PCBs with RAM at $2000-$2800 as Saba Schach!
if (len == 0x40000)
m_type = CF_MULTI;
m_type = CF_MULTI; // TODO1: differentiate multicart final and earlier from fullpath
else
m_type = CF_CHESS; // is there any way to detect Maze and Hangman from fullpath?
m_type = CF_CHESS; // TODO2: is there any way to detect Maze and Hangman from fullpath?
m_cart->ram_alloc(0x800);
}

View File

@ -13,6 +13,7 @@ enum
CF_MAZE,
CF_HANGMAN,
CF_CHESS,
CF_MULTI_OLD,
CF_MULTI
};

View File

@ -173,6 +173,7 @@ void channelf_state::machine_start()
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2800, 0x2fff, read8_delegate(FUNC(channelf_cart_slot_device::read_ram),(channelf_cart_slot_device*)m_cart), write8_delegate(FUNC(channelf_cart_slot_device::write_ram),(channelf_cart_slot_device*)m_cart));
break;
case CF_MULTI:
case CF_MULTI_OLD:
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2800, 0x2fff, read8_delegate(FUNC(channelf_cart_slot_device::read_ram),(channelf_cart_slot_device*)m_cart), write8_delegate(FUNC(channelf_cart_slot_device::write_ram),(channelf_cart_slot_device*)m_cart));
m_maincpu->space(AS_PROGRAM).install_write_handler(0x3000, 0x3fff, write8_delegate(FUNC(channelf_cart_slot_device::write_bank),(channelf_cart_slot_device*)m_cart));
break;
@ -187,7 +188,8 @@ static SLOT_INTERFACE_START(cf_cart)
SLOT_INTERFACE_INTERNAL("maze", CHANF_ROM_MAZE)
SLOT_INTERFACE_INTERNAL("hangman", CHANF_ROM_HANGMAN)
SLOT_INTERFACE_INTERNAL("chess", CHANF_ROM_CHESS)
SLOT_INTERFACE_INTERNAL("multi", CHANF_ROM_MULTI)
SLOT_INTERFACE_INTERNAL("multi_old",CHANF_ROM_MULTI_OLD)
SLOT_INTERFACE_INTERNAL("multi", CHANF_ROM_MULTI_FINAL)
SLOT_INTERFACE_END