From 4c19da9cce30209a013fffa50ccf083c0096d2d1 Mon Sep 17 00:00:00 2001 From: etabeta78 Date: Sat, 25 Oct 2014 08:22:35 +0200 Subject: (MESS) astrocde.c: added support for 256K and 512K carts with bankswitch. [Fabio Priuli] --- hash/astrocde.xml | 347 +++++++++++++++++++++++++++++++++----------- src/emu/bus/astrocde/rom.c | 100 +++++++++++++ src/emu/bus/astrocde/rom.h | 73 ++++++++++ src/emu/bus/astrocde/slot.c | 239 ++++++++++++++++++++++++++++++ src/emu/bus/astrocde/slot.h | 103 +++++++++++++ src/emu/bus/bus.mak | 12 ++ src/mess/drivers/astrocde.c | 17 ++- src/mess/mess.mak | 1 + 8 files changed, 802 insertions(+), 90 deletions(-) create mode 100644 src/emu/bus/astrocde/rom.c create mode 100644 src/emu/bus/astrocde/rom.h create mode 100644 src/emu/bus/astrocde/slot.c create mode 100644 src/emu/bus/astrocde/slot.h diff --git a/hash/astrocde.xml b/hash/astrocde.xml index 0d28334924c..96864c2bf09 100644 --- a/hash/astrocde.xml +++ b/hash/astrocde.xml @@ -5,7 +5,7 @@ 280 Zzzap / Dodgem 1978 - Bally Mfg. Corp. + Bally @@ -28,7 +28,7 @@ ADS System Monitor (Prototype) 19?? - Larry Hanson + <unknown> @@ -39,7 +39,7 @@ Amazing Maze / Tic-Tac-Toe 1979 - Bally Mfg. Corp. + Bally @@ -50,7 +50,7 @@ Artillery Duel 1982 - Astrocade Inc. + Astrocade @@ -58,6 +58,39 @@ + + Artillery Duel (Prototype 19820523) + 1982 + Astrocade + + + + + + + + + Artillery Duel (Prototype Alt) + 1982 + Astrocade + + + + + + + + + Artillery Duel (Prototype Alt 2) + 1982 + Astrocade + + + + + + + Artillery Duel / O-Jello @@ -73,7 +106,7 @@ Astro Battle 1979 - Bally Mfg. Corp. + Bally @@ -85,7 +118,7 @@ Bally BASIC 1978 - Bally Mfg. Corp. + Bally @@ -97,7 +130,7 @@ Bally BASIC (Astrovision) 1981 - Astrovision Inc. + Astrovision @@ -108,7 +141,7 @@ Bally BASIC Demo 1978 - Bally Mfg. Corp. + Bally @@ -142,9 +175,9 @@ Bally Color BASIC (Prototype) - + 19?? - Larry Hanson and Bally Mfg. Corp. + Bally @@ -155,7 +188,7 @@ Bally Pin 1979 - Bally Mfg. Corp. + Bally @@ -178,7 +211,7 @@ BioRhythm 1981 - Astrovision Inc. + Astrovision @@ -189,7 +222,7 @@ Black Jack / Acey Deucey / Poker 1979 - Bally Mfg. Corp. + Bally @@ -197,7 +230,19 @@ - + + Blue RAM BASIC 1.0 (Prototype) + + 1980 + Perkins Engineering + + + + + + + + Blue RAM BASIC 1.0 1980 @@ -209,7 +254,7 @@ - + Blue RAM BASIC 1.1 1981 @@ -247,7 +292,7 @@ Bowling (Prototype) 198? - Astrocade Inc. + Astrocade @@ -258,7 +303,7 @@ Brickyard / Clowns 1978 - Bally Mfg. Corp. + Bally @@ -292,7 +337,7 @@ Checkers (Prototype) 19?? - Bally Mfg. Corp. + Bally @@ -339,7 +384,7 @@ Coloring Book (Prototype) 198? - Astrocade Inc. + Astrocade @@ -349,9 +394,9 @@ Conan The Barbarian! - + 1985 - Astrocade Inc. and Dave Carson Software + Astrocade and Dave Carson Software @@ -362,7 +407,7 @@ Conan The Barbarian! (Prototype) 1982 - Astrocade Inc. + Astrocade @@ -385,7 +430,7 @@ Cosmic Raiders 1983 - Astrocade Inc. + Astrocade @@ -396,7 +441,7 @@ Cosmic Raiders (Proto, Alt) 198? - Astrocade Inc. + Astrocade @@ -407,7 +452,7 @@ Cosmic Raiders (Proto, Alt 2) 198? - Astrocade Inc. + Astrocade @@ -419,7 +464,7 @@ Cosmic Raiders (Proto v3.5) 198? - Astrocade Inc. + Astrocade @@ -430,7 +475,7 @@ Cosmic Raiders (Proto v3.6) 198? - Astrocade Inc. + Astrocade @@ -438,10 +483,21 @@ + + Crazy Climber + 2011 + Riff Raff Games + + + + + + + Dealer Demo 1978 - Bally Mfg. Corp. + Bally @@ -452,7 +508,7 @@ Dogpatch 1980 - Bally Mfg. Corp. + Bally @@ -472,7 +528,7 @@ - Fawn Dungeon (Prototype) + Fawn Dungeon (Prototype, first version) 1981 Barry McCleave @@ -484,7 +540,7 @@ - Fawn Dungeon (Prototype, Alt) + Fawn Dungeon (Prototype, second version) 1981 Barry McCleave @@ -510,7 +566,7 @@ Football 1978 - Bally Mfg. Corp. + Bally @@ -519,7 +575,7 @@ - Fun With Vectors - Ziggy (JX label) (Prototype) + Fun With Vectors - Ziggy (Prototype JX label) 1985 Richard Degler @@ -531,7 +587,7 @@ - Fun With Vectors - Ziggy (MO label) (Prototype) + Fun With Vectors - Ziggy (Prototype MO label) 1985 Richard Degler @@ -545,7 +601,7 @@ Galactic Invasion 1981 - Astrovision Inc. + Astrovision @@ -556,7 +612,7 @@ Galaxian 1981 - Astrovision Inc. + Astrovision @@ -564,10 +620,43 @@ + + Golddigger, Goldrush (Prototype, 19840811)) + 1984 + Dave Carson and Ken Lill + + + + + + + + + Golddigger, Goldrush (Prototype Alt) + 198? + Dave Carson and Ken Lill + + + + + + + + + Golddigger, Goldrush (Prototype Alt 2) + 198? + Dave Carson and Ken Lill + + + + + + + Grand Prix 1981 - Astrovision Inc. + Astrovision @@ -636,7 +725,7 @@ Letter Match / Spell 'n Score / Crosswords 1978 - Bally Mfg. Corp. + Bally @@ -678,6 +767,17 @@ + + Mazeman (Prototype) + 1984 + Dave Carson Software + + + + + + + Missile Attack @@ -703,9 +803,9 @@ Muncher - + 1983 - Astrocade Inc., Phillip Harris, and Alternative Engineering + Astrocade, Phillip Harris, and Alternative Engineering @@ -715,9 +815,9 @@ Music Maker - + 1985 - Astrocade Inc. and Dave Carson Software + Astrocade and Dave Carson Software @@ -726,9 +826,9 @@ - Music Maker v3.7 (Prototype) + Music Maker (Prototype v3.7) 1982 - Astrocade Inc. + Astrocade @@ -736,26 +836,25 @@ - - No-Die! - - 1984 - Astrocade Inc., Dave Carson, and Mike White + + Music Maker (Prototype Alt) + 1982 + Astrocade - + - - Pac-Man (Prototype) - - 198? - Astrocade Inc. + + No-Die! + + 1984 + Astrocade, Dave Carson, and Mike White - + @@ -784,6 +883,40 @@ + + Pac-Man (Prototype) + + 198? + Astrocade + + + + + + + + + Pac-Man (Prototype Alt) + 198? + Astrocade + + + + + + + + + Pacmaze (Prototype) + 198? + Dave Carson Software + + + + + + + Paperback Writer (Prototype) 1986 @@ -798,7 +931,7 @@ Pirate's Chase 1982 - Astrocade Inc. + Astrocade @@ -826,9 +959,9 @@ Rainbow v2 (Prototype) - + 19?? - Larry Hanson + Hanson @@ -839,7 +972,7 @@ Red Baron / Panzer Attack 1978 - Bally Mfg. Corp. + Bally @@ -873,7 +1006,7 @@ Seawolf / Missile 1978 - Bally Mfg. Corp. + Bally @@ -942,7 +1075,7 @@ Soccer (Prototype) 198? - Astrocade Inc. + Astrocade @@ -954,7 +1087,7 @@ Soccer (Prototype, Alt) 198? - Astrocade Inc. + Astrocade @@ -966,7 +1099,7 @@ Soccer (Prototype, Alt 2) 198? - Astrocade Inc. + Astrocade @@ -977,7 +1110,7 @@ Soccer (Prototype, Alt 3) 198? - Astrocade Inc. + Astrocade @@ -988,7 +1121,7 @@ Soccer (Prototype, Alt 4) 198? - Astrocade Inc. + Astrocade @@ -999,7 +1132,7 @@ Solar Conqueror 1983 - Astrocade Inc. + Astrocade @@ -1010,7 +1143,7 @@ Solar Conqueror (Prototype v2.8) 198? - Astrocade Inc. + Astrocade @@ -1021,7 +1154,7 @@ Solar Conqueror (Prototype v3.9) 198? - Astrocade Inc. + Astrocade @@ -1033,7 +1166,7 @@ Solar Conqueror (Prototype) 1982 - Astrocade Inc. + Astrocade @@ -1044,7 +1177,7 @@ Songs (Prototype) 19?? - Bally Mfg. Corp. + Bally @@ -1052,11 +1185,22 @@ + + Songs (Prototype Alt) + 19?? + Bally + + + + + + + Songs (Prototype, Unfinished) 19?? - Bally Mfg. Corp. + Bally @@ -1067,7 +1211,7 @@ Space Fortress 1981 - Astrocade Inc. + Astrocade @@ -1075,10 +1219,21 @@ - + + Space Fortress (Prototype) + 1981 + Astrocade + + + + + + + + Space Invaders 1979 - Bally Mfg. Corp. + Bally @@ -1086,10 +1241,21 @@ + + Space Invaders (Prototype) + 197? + Bally + + + + + + + Speed Math / Bingo Math 1978 - Bally Mfg. Corp. + Bally @@ -1100,7 +1266,7 @@ Star Battle 1979 - Bally Mfg. Corp. + Bally @@ -1112,7 +1278,7 @@ Stweek 19?? - Bally Mfg. Corp. + Bally @@ -1136,7 +1302,7 @@ Tests 19?? - Bally Mfg. Corp. + Bally @@ -1159,7 +1325,7 @@ The Incredible Wizard 1982 - Astrocade Inc. + Astrocade @@ -1168,10 +1334,10 @@ - The Incredible Wizard (Prototype) + The Incredible Wizard (Prototype, Bad Dump) 198? - Astrocade Inc. + Astrocade @@ -1182,7 +1348,7 @@ Tornado Baseball / Handball / Hockey / Tennis 1978 - Bally Mfg. Corp. + Bally @@ -1249,6 +1415,17 @@ + + War (Second Printing) + 2012 + Riff Raff Games + + + + + + + Yahtzee / Golddigger @@ -1262,7 +1439,7 @@ - Yesterday (no vibrato) (Prototype) + Yesterday (Prototype, no vibrato) 1986 Richard Degler and George Moses @@ -1274,7 +1451,7 @@ - Yesterday (with vibrato) (Prototype) + Yesterday (Prototype, with vibrato) 1986 Richard Degler and George Moses diff --git a/src/emu/bus/astrocde/rom.c b/src/emu/bus/astrocde/rom.c new file mode 100644 index 00000000000..3f76b024df0 --- /dev/null +++ b/src/emu/bus/astrocde/rom.c @@ -0,0 +1,100 @@ +// license:BSD-3-Clause +// copyright-holders:etabeta +/*********************************************************************************************************** + + + Bally Astrocade cart emulation + + + ***********************************************************************************************************/ + + +#include "emu.h" +#include "rom.h" + + +//------------------------------------------------- +// astrocade_rom_device - constructor +//------------------------------------------------- + +const device_type ASTROCADE_ROM_STD = &device_creator; +const device_type ASTROCADE_ROM_256K = &device_creator; +const device_type ASTROCADE_ROM_512K = &device_creator; + + +astrocade_rom_device::astrocade_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) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source), + device_astrocade_cart_interface(mconfig, *this) +{ +} + +astrocade_rom_device::astrocade_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ASTROCADE_ROM_STD, "Bally Astrocade Standard Carts", tag, owner, clock, "astrocade_rom", __FILE__), + device_astrocade_cart_interface(mconfig, *this) +{ +} + +astrocade_rom_256k_device::astrocade_rom_256k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : astrocade_rom_device(mconfig, ASTROCADE_ROM_256K, "Bally Astrocade 256K Carts", tag, owner, clock, "astrocade_256k", __FILE__) +{ +} + +astrocade_rom_512k_device::astrocade_rom_512k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : astrocade_rom_device(mconfig, ASTROCADE_ROM_512K, "Bally Astrocade 512K Carts", tag, owner, clock, "astrocade_512k", __FILE__) +{ +} + + +void astrocade_rom_256k_device::device_start() +{ + save_item(NAME(m_base_bank)); +} + +void astrocade_rom_256k_device::device_reset() +{ + m_base_bank = 0; +} + +void astrocade_rom_512k_device::device_start() +{ + save_item(NAME(m_base_bank)); +} + +void astrocade_rom_512k_device::device_reset() +{ + m_base_bank = 0; +} + + +/*------------------------------------------------- + mapper specific handlers + -------------------------------------------------*/ + +READ8_MEMBER(astrocade_rom_device::read_rom) +{ + if (offset < m_rom_size) + return m_rom[offset]; + else + return 0xff; +} + +READ8_MEMBER(astrocade_rom_256k_device::read_rom) +{ + if (offset < 0x1000) // 0x2000-0x2fff + return m_rom[offset + 0x1000 * 0x3f]; + else if (offset < 0x1fc0) // 0x3000-0x3fbf + return m_rom[(offset & 0xfff) + (0x1000 * m_base_bank)]; + else // 0x3fc0-0x3fff + return m_base_bank = offset & 0x3f; +} + +READ8_MEMBER(astrocade_rom_512k_device::read_rom) +{ + if (offset < 0x1000) // 0x2000-0x2fff + return m_rom[offset + 0x1000 * 0x7f]; + else if (offset < 0x1f80) // 0x3000-0x3fbf + return m_rom[(offset & 0xfff) + (0x1000 * m_base_bank)]; + else // 0x3fc0-0x3fff + return m_base_bank = offset & 0x7f; +} + diff --git a/src/emu/bus/astrocde/rom.h b/src/emu/bus/astrocde/rom.h new file mode 100644 index 00000000000..4c30038dfce --- /dev/null +++ b/src/emu/bus/astrocde/rom.h @@ -0,0 +1,73 @@ +// license:BSD-3-Clause +// copyright-holders:etabeta +#ifndef __ASTROCADE_ROM_H +#define __ASTROCADE_ROM_H + +#include "slot.h" + + +// ======================> astrocade_rom_device + +class astrocade_rom_device : public device_t, + public device_astrocade_cart_interface +{ +public: + // construction/destruction + astrocade_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); + astrocade_rom_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); +}; + +// ======================> astrocade_rom_256k_device + +class astrocade_rom_256k_device : public astrocade_rom_device +{ +public: + // construction/destruction + astrocade_rom_256k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual void device_start(); + virtual void device_reset(); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_rom); + +private: + UINT8 m_base_bank; +}; + +// ======================> astrocade_rom_512k_device + +class astrocade_rom_512k_device : public astrocade_rom_device +{ +public: + // construction/destruction + astrocade_rom_512k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual void device_start(); + virtual void device_reset(); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_rom); + +private: + UINT8 m_base_bank; +}; + + + + + +// device type definition +extern const device_type ASTROCADE_ROM_STD; +extern const device_type ASTROCADE_ROM_256K; +extern const device_type ASTROCADE_ROM_512K; + + +#endif diff --git a/src/emu/bus/astrocde/slot.c b/src/emu/bus/astrocde/slot.c new file mode 100644 index 00000000000..08895cbd569 --- /dev/null +++ b/src/emu/bus/astrocde/slot.c @@ -0,0 +1,239 @@ +// license:BSD-3-Clause +// copyright-holders:etabeta +/*********************************************************************************************************** + + Bally Astrocade cart emulation + (through slot devices) + + ***********************************************************************************************************/ + + +#include "emu.h" +#include "slot.h" + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type ASTROCADE_CART_SLOT = &device_creator; + +//************************************************************************** +// Astrocade Cartridges Interface +//************************************************************************** + +//------------------------------------------------- +// device_astrocade_cart_interface - constructor +//------------------------------------------------- + +device_astrocade_cart_interface::device_astrocade_cart_interface(const machine_config &mconfig, device_t &device) + : device_slot_card_interface(mconfig, device), + m_rom(NULL), + m_rom_size(0) +{ +} + + +//------------------------------------------------- +// ~device_astrocade_cart_interface - destructor +//------------------------------------------------- + +device_astrocade_cart_interface::~device_astrocade_cart_interface() +{ +} + +//------------------------------------------------- +// rom_alloc - alloc the space for the cart +//------------------------------------------------- + +void device_astrocade_cart_interface::rom_alloc(UINT32 size, const char *tag) +{ + if (m_rom == NULL) + { + astring tempstring(tag); + tempstring.cat(ASTROCADESLOT_ROM_REGION_TAG); + m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); + m_rom_size = size; + } +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// astrocade_cart_slot_device - constructor +//------------------------------------------------- +astrocade_cart_slot_device::astrocade_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, ASTROCADE_CART_SLOT, "Bally Astrocade Cartridge Slot", tag, owner, clock, "astrocade_cart_slot", __FILE__), + device_image_interface(mconfig, *this), + device_slot_interface(mconfig, *this), + m_type(ASTROCADE_STD) +{ +} + + +//------------------------------------------------- +// astrocade_cart_slot_device - destructor +//------------------------------------------------- + +astrocade_cart_slot_device::~astrocade_cart_slot_device() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void astrocade_cart_slot_device::device_start() +{ + m_cart = dynamic_cast(get_card_device()); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void astrocade_cart_slot_device::device_config_complete() +{ + // set brief and instance name + update_names(); +} + + +//------------------------------------------------- +// ASTROCADE PCB +//------------------------------------------------- + +struct astrocade_slot +{ + int pcb_id; + const char *slot_option; +}; + +// Here, we take the feature attribute from .xml (i.e. the PCB name) and we assign a unique ID to it +static const astrocade_slot slot_list[] = +{ + { ASTROCADE_STD, "rom" }, + { ASTROCADE_256K, "rom_256k" }, + { ASTROCADE_512K, "rom_512k" } +}; + +static int astrocade_get_pcb_id(const char *slot) +{ + for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + { + if (!core_stricmp(slot_list[i].slot_option, slot)) + return slot_list[i].pcb_id; + } + + return 0; +} + +static const char *astrocade_get_slot(int type) +{ + for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + { + if (slot_list[i].pcb_id == type) + return slot_list[i].slot_option; + } + + return "std"; +} + + +/*------------------------------------------------- + call load + -------------------------------------------------*/ + +bool astrocade_cart_slot_device::call_load() +{ + if (m_cart) + { + UINT32 size = (software_entry() == NULL) ? length() : get_software_region_length("rom"); + m_cart->rom_alloc(size, tag()); + + if (software_entry() == NULL) + fread(m_cart->get_rom_base(), size); + else + memcpy(m_cart->get_rom_base(), get_software_region("rom"), size); + + if (software_entry() == NULL) + { + m_type = ASTROCADE_STD; + + if (size == 0x40000) + m_type = ASTROCADE_256K; + if (size == 0x80000) + m_type = ASTROCADE_512K; + } + else + { + const char *pcb_name = get_feature("slot"); + if (pcb_name) + m_type = astrocade_get_pcb_id(pcb_name); + } + + //printf("Type: %s\n", astrocade_get_slot(m_type)); + + return IMAGE_INIT_PASS; + } + + return IMAGE_INIT_PASS; +} + + +/*------------------------------------------------- + call softlist load + -------------------------------------------------*/ + +bool astrocade_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) +{ + load_software_part_region(*this, swlist, swname, start_entry); + return TRUE; +} + + +/*------------------------------------------------- + get default card software + -------------------------------------------------*/ + +void astrocade_cart_slot_device::get_default_card_software(astring &result) +{ + if (open_image_file(mconfig().options())) + { + const char *slot_string = "rom"; + UINT32 size = core_fsize(m_file); + int type = ASTROCADE_STD; + + if (size == 0x40000) + type = ASTROCADE_256K; + if (size == 0x80000) + type = ASTROCADE_512K; + + slot_string = astrocade_get_slot(type); + + //printf("type: %s\n", slot_string); + clear(); + + result.cpy(slot_string); + return; + } + + software_get_default_slot(result, "rom"); +} + +/*------------------------------------------------- + read + -------------------------------------------------*/ + +READ8_MEMBER(astrocade_cart_slot_device::read_rom) +{ + if (m_cart) + return m_cart->read_rom(space, offset); + else + return 0xff; +} + diff --git a/src/emu/bus/astrocde/slot.h b/src/emu/bus/astrocde/slot.h new file mode 100644 index 00000000000..959043b1ef7 --- /dev/null +++ b/src/emu/bus/astrocde/slot.h @@ -0,0 +1,103 @@ +// license:BSD-3-Clause +// copyright-holders:etabeta +#ifndef __ASTROCADE_SLOT_H +#define __ASTROCADE_SLOT_H + +/*************************************************************************** + TYPE DEFINITIONS + ***************************************************************************/ + + +/* PCB */ +enum +{ + ASTROCADE_STD = 0, + ASTROCADE_256K, + ASTROCADE_512K +}; + + +// ======================> device_astrocade_cart_interface + +class device_astrocade_cart_interface : public device_slot_card_interface +{ +public: + // construction/destruction + device_astrocade_cart_interface(const machine_config &mconfig, device_t &device); + virtual ~device_astrocade_cart_interface(); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_rom) { return 0xff; } + + void rom_alloc(UINT32 size, const char *tag); + void ram_alloc(UINT32 size); + UINT8* get_rom_base() { return m_rom; } + UINT32 get_rom_size() { return m_rom_size; } + +protected: + // internal state + UINT8 *m_rom; + UINT32 m_rom_size; +}; + + +// ======================> astrocade_cart_slot_device + +class astrocade_cart_slot_device : public device_t, + public device_image_interface, + public device_slot_interface +{ +public: + // construction/destruction + astrocade_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~astrocade_cart_slot_device(); + + // device-level overrides + virtual void device_start(); + virtual void device_config_complete(); + + // image-level overrides + virtual bool call_load(); + virtual void call_unload() {} + virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry); + + int get_type() { return m_type; } + + virtual iodevice_t image_type() const { return IO_CARTSLOT; } + virtual bool is_readable() const { return 1; } + virtual bool is_writeable() const { return 0; } + virtual bool is_creatable() const { return 0; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 1; } + virtual const option_guide *create_option_guide() const { return NULL; } + virtual const char *image_interface() const { return "astrocde_cart"; } + virtual const char *file_extensions() const { return "bin"; } + + // slot interface overrides + virtual void get_default_card_software(astring &result); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_rom); + +protected: + + int m_type; + device_astrocade_cart_interface* m_cart; +}; + + + +// device type definition +extern const device_type ASTROCADE_CART_SLOT; + + +/*************************************************************************** + DEVICE CONFIGURATION MACROS + ***************************************************************************/ + +#define ASTROCADESLOT_ROM_REGION_TAG ":cart:rom" + +#define MCFG_ASTROCADE_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \ + MCFG_DEVICE_ADD(_tag, ASTROCADE_CART_SLOT, 0) \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) +#endif diff --git a/src/emu/bus/bus.mak b/src/emu/bus/bus.mak index 65409ac662c..61111be9665 100644 --- a/src/emu/bus/bus.mak +++ b/src/emu/bus/bus.mak @@ -120,6 +120,18 @@ BUSOBJS += $(BUSOBJ)/arcadia/rom.o endif +#------------------------------------------------- +# +#@src/emu/bus/astrocde/slot.h,BUSES += ASTROCADE +#------------------------------------------------- + +ifneq ($(filter ASTROCADE,$(BUSES)),) +OBJDIRS += $(BUSOBJ)/astrocde +BUSOBJS += $(BUSOBJ)/astrocde/slot.o +BUSOBJS += $(BUSOBJ)/astrocde/rom.o +endif + + #------------------------------------------------- # #@src/emu/bus/bw2/exp.h,BUSES += BW2 diff --git a/src/mess/drivers/astrocde.c b/src/mess/drivers/astrocde.c index fbdd668c8bf..9912514a583 100644 --- a/src/mess/drivers/astrocde.c +++ b/src/mess/drivers/astrocde.c @@ -12,8 +12,8 @@ #include "includes/astrocde.h" #include "machine/ram.h" #include "sound/astrocde.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" +#include "bus/astrocde/slot.h" +#include "bus/astrocde/rom.h" class astrocde_mess_state : public astrocde_state { @@ -23,7 +23,7 @@ public: m_cart(*this, "cartslot") { } - required_device m_cart; + required_device m_cart; void get_ram_expansion_settings(int &ram_expansion_installed, int &write_protect_on, int &expansion_ram_start, int &expansion_ram_end, int &shadow_ram_end); DECLARE_MACHINE_START(astrocde); DECLARE_MACHINE_RESET(astrocde); @@ -251,6 +251,13 @@ INPUT_PORTS_END * *************************************/ +static SLOT_INTERFACE_START(astrocade_cart) + SLOT_INTERFACE_INTERNAL("rom", ASTROCADE_ROM_STD) + SLOT_INTERFACE_INTERNAL("rom_256k", ASTROCADE_ROM_256K) + SLOT_INTERFACE_INTERNAL("rom_512k", ASTROCADE_ROM_512K) +SLOT_INTERFACE_END + + static MACHINE_CONFIG_START( astrocde, astrocde_mess_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, ASTROCADE_CLOCK/4) /* 1.789 MHz */ @@ -279,7 +286,7 @@ static MACHINE_CONFIG_START( astrocde, astrocde_mess_state ) MCFG_RAM_DEFAULT_SIZE("32k") /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "astrocde_cart") + MCFG_ASTROCADE_CARTRIDGE_ADD("cartslot", astrocade_cart, NULL) /* Software lists */ MCFG_SOFTWARE_LIST_ADD("cart_list","astrocde") @@ -321,7 +328,7 @@ DRIVER_INIT_MEMBER(astrocde_state,astrocde) MACHINE_START_MEMBER(astrocde_mess_state, astrocde) { if (m_cart->exists()) - m_maincpu->space(AS_PROGRAM).install_read_handler(0x2000, 0x3fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x2000, 0x3fff, read8_delegate(FUNC(astrocade_cart_slot_device::read_rom),(astrocade_cart_slot_device*)m_cart)); } MACHINE_RESET_MEMBER(astrocde_mess_state, astrocde) diff --git a/src/mess/mess.mak b/src/mess/mess.mak index d926bde0cab..545af0fc515 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -570,6 +570,7 @@ BUSES += ADAM BUSES += ADAMNET BUSES += APF BUSES += ARCADIA +BUSES += ASTROCADE BUSES += BML3 BUSES += BW2 BUSES += C64 -- cgit v1.2.3