Skip to content

Commit

Permalink
trs/mc10.cpp: simplify mcx128 instanciation
Browse files Browse the repository at this point in the history
  • Loading branch information
Mokona committed Jul 9, 2024
1 parent 2ec19a6 commit c43cbf1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 46 deletions.
2 changes: 1 addition & 1 deletion src/devices/bus/mc10/mc10_cart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ void mc10_cart_add_basic_devices(device_slot_interface &device)
void alice_cart_add_basic_devices(device_slot_interface &device)
{
// basic devices
device.option_add("alice128", ALICE_PAK_MCX128);
device.option_add("mcx128", MC10_PAK_MCX128);
device.option_add("pak", MC10_PAK);
device.option_add("ram", MC10_PAK_RAM);
device.option_add("multi", ALICE_MULTIPORTS_EXT);
Expand Down
65 changes: 21 additions & 44 deletions src/devices/bus/mc10/mcx128.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@

namespace {

ROM_START(mc10_mcx128)
ROM_START(mcx128)
ROM_REGION(0x4000, "eprom", ROMREGION_ERASE00)
ROM_LOAD("mcx128bas.rom", 0x0000, 0x4000, CRC(11202e4b) SHA1(36c30d0f198a1bffee88ef29d92f2401447a91f4))
ROM_END
ROM_DEFAULT_BIOS("mc10_mcx128")

ROM_START(alice_mcx128)
ROM_REGION(0x4000, "eprom", ROMREGION_ERASE00)
ROM_LOAD("alice128bas.rom", 0x0000, 0x4000, CRC(a737544a) SHA1(c8fd92705fc42deb6a0ffac6274e27fd61ecd4cc))
ROM_SYSTEM_BIOS(0, "mc10_mcx128", "Darren Atkinson's MCX-128 cartridge")
ROMX_LOAD("mcx128bas.rom", 0x0000, 0x4000, CRC(11202e4b) SHA1(36c30d0f198a1bffee88ef29d92f2401447a91f4), ROM_BIOS(0))

ROM_SYSTEM_BIOS(1, "alice_mcx128", "Darren Atkinson's MCX-128 cartridge for Alice")
ROMX_LOAD("alice128bas.rom", 0x0000, 0x4000, CRC(a737544a) SHA1(c8fd92705fc42deb6a0ffac6274e27fd61ecd4cc), ROM_BIOS(1))
ROM_END

//**************************************************************************
Expand All @@ -70,17 +71,11 @@ class mc10_pak_mcx128_device :
mc10_pak_mcx128_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);

protected:
// construction/destruction
mc10_pak_mcx128_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);

// device_t implementation
virtual void device_start() override;
virtual void device_reset() override;

virtual const tiny_rom_entry *device_rom_region() const override
{
return ROM_NAME(mc10_mcx128);
}
virtual const tiny_rom_entry *device_rom_region() const override;

u8 control_register_read(offs_t offset);
void control_register_write(offs_t offset, u8 data);
Expand Down Expand Up @@ -113,19 +108,25 @@ class mc10_pak_mcx128_device :
//-------------------------------------------------

mc10_pak_mcx128_device::mc10_pak_mcx128_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
:mc10_pak_mcx128_device(mconfig, MC10_PAK_MCX128, tag, owner, clock)
{
}

mc10_pak_mcx128_device::mc10_pak_mcx128_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, type, tag, owner, clock)
: device_t(mconfig, MC10_PAK_MCX128, tag, owner, clock)
, device_mc10cart_interface(mconfig, *this)
, m_share(*this, "ext_ram", 1024*128, ENDIANNESS_BIG)
, m_view(*this, "mcx_view")
, m_bank(*this, "bank%u", 0U)
{
const char *driver_name = mconfig.gamedrv().name;
if (strcmp(driver_name, "alice") == 0)
set_default_bios_tag("alice_mcx128");
else
set_default_bios_tag("mc10_mcx128");
}

const tiny_rom_entry * mc10_pak_mcx128_device::device_rom_region() const
{
return ROM_NAME(mcx128);
}


void mc10_pak_mcx128_device::view_map0(address_map &map)
{
map(0x0004, 0x0007).bankrw("bank0");
Expand Down Expand Up @@ -338,30 +339,6 @@ void mc10_pak_mcx128_device::update_banks()
LOG("view select: %d, bank cr: %d\n", (bank1 << 2) | (rom_map_cr & 0x03), ram_bank_cr & 0x03 );
}

class alice_pak_mcx128_device : public mc10_pak_mcx128_device
{
public:
// construction/destruction
alice_pak_mcx128_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);

protected:
// device-level overrides
virtual const tiny_rom_entry *device_rom_region() const override
{
return ROM_NAME(alice_mcx128);
}
};

//-------------------------------------------------
// mc10_pak_device - constructor
//-------------------------------------------------

alice_pak_mcx128_device::alice_pak_mcx128_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: mc10_pak_mcx128_device(mconfig, ALICE_PAK_MCX128, tag, owner, clock)
{
}

} // anonymous namespace

DEFINE_DEVICE_TYPE_PRIVATE(MC10_PAK_MCX128, device_mc10cart_interface, mc10_pak_mcx128_device, "mc10_mcx128", "Darren Atkinson's MCX-128 cartridge")
DEFINE_DEVICE_TYPE_PRIVATE(ALICE_PAK_MCX128, device_mc10cart_interface, alice_pak_mcx128_device, "alice_mcx128", "Darren Atkinson's MCX-128 cartridge (Alice ROM)")
DEFINE_DEVICE_TYPE_PRIVATE(MC10_PAK_MCX128, device_mc10cart_interface, mc10_pak_mcx128_device, "mcx128", "Darren Atkinson's MCX-128 cartridge")
1 change: 0 additions & 1 deletion src/devices/bus/mc10/mcx128.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

// device type definition
DECLARE_DEVICE_TYPE(MC10_PAK_MCX128, device_mc10cart_interface)
DECLARE_DEVICE_TYPE(ALICE_PAK_MCX128, device_mc10cart_interface)

#endif // MAME_BUS_MC10_MC10_MCX128_H

0 comments on commit c43cbf1

Please sign in to comment.