Collapsed device_config and device_t into one class. Updated all

existing modern devices and the legacy wrappers to work in this
environment. This in general greatly simplifies writing a modern
device. [Aaron Giles]

General notes:
 * some more cleanup probably needs to happen behind this change,
   but I needed to get it in before the next device modernization 
   or import from MESS  :)

 * new template function device_creator which automatically defines
   the static function that creates the device; use this instead of
   creating a static_alloc_device_config function

 * added device_stop() method which is called at around the time
   the previous device_t's destructor was called; if you auto_free
   anything, do it here because the machine is gone when the 
   destructor is called

 * changed the static_set_* calls to pass a device_t & instead of
   a device_config *

 * for many devices, the static config structure member names over-
   lapped the device's names for devcb_* functions; in these cases
   the members in the interface were renamed to have a _cb suffix

 * changed the driver_enumerator to only cache 100 machine_configs
   because caching them all took a ton of memory; fortunately this
   implementation detail is completely hidden behind the 
   driver_enumerator interface

 * got rid of the macros for creating derived classes; doing it
   manually is now clean enough that it isn't worth hiding the
   details in a macro
This commit is contained in:
Aaron Giles 2011-04-27 05:11:18 +00:00
parent 84f2c31f7d
commit 919913f118
1585 changed files with 10315 additions and 16971 deletions

View File

@ -48,19 +48,19 @@
// set_tag - set the appropriate tag for a device
//-------------------------------------------------
inline void map_handler_data::set_tag(const device_config &devconfig, const char *tag)
inline void map_handler_data::set_tag(const device_t &device, const char *tag)
{
if (tag == NULL)
m_tag = NULL;
else if (strcmp(tag, DEVICE_SELF) == 0)
m_tag = devconfig.tag();
m_tag = device.tag();
else if (strcmp(tag, DEVICE_SELF_OWNER) == 0)
{
assert(devconfig.owner() != NULL);
m_tag = devconfig.owner()->tag();
assert(device.owner() != NULL);
m_tag = device.owner()->tag();
}
else
m_tag = devconfig.siblingtag(m_derived_tag, tag);
m_tag = device.siblingtag(m_derived_tag, tag);
}
@ -131,10 +131,10 @@ void address_map_entry::set_mask(offs_t _mask)
// an I/O port
//-------------------------------------------------
void address_map_entry::set_read_port(const device_config &devconfig, const char *tag)
void address_map_entry::set_read_port(const device_t &device, const char *tag)
{
m_read.m_type = AMH_PORT;
m_read.set_tag(devconfig, tag);
m_read.set_tag(device, tag);
}
@ -143,10 +143,10 @@ void address_map_entry::set_read_port(const device_config &devconfig, const char
// an I/O port
//-------------------------------------------------
void address_map_entry::set_write_port(const device_config &devconfig, const char *tag)
void address_map_entry::set_write_port(const device_t &device, const char *tag)
{
m_write.m_type = AMH_PORT;
m_write.set_tag(devconfig, tag);
m_write.set_tag(device, tag);
}
@ -155,12 +155,12 @@ void address_map_entry::set_write_port(const device_config &devconfig, const cha
// reading and writing an I/O port
//-------------------------------------------------
void address_map_entry::set_readwrite_port(const device_config &devconfig, const char *tag)
void address_map_entry::set_readwrite_port(const device_t &device, const char *tag)
{
m_read.m_type = AMH_PORT;
m_read.set_tag(devconfig, tag);
m_read.set_tag(device, tag);
m_write.m_type = AMH_PORT;
m_write.set_tag(devconfig, tag);
m_write.set_tag(device, tag);
}
@ -169,10 +169,10 @@ void address_map_entry::set_readwrite_port(const device_config &devconfig, const
// from a memory bank
//-------------------------------------------------
void address_map_entry::set_read_bank(const device_config &devconfig, const char *tag)
void address_map_entry::set_read_bank(const device_t &device, const char *tag)
{
m_read.m_type = AMH_BANK;
m_read.set_tag(devconfig, tag);
m_read.set_tag(device, tag);
}
@ -181,10 +181,10 @@ void address_map_entry::set_read_bank(const device_config &devconfig, const char
// to a memory bank
//-------------------------------------------------
void address_map_entry::set_write_bank(const device_config &devconfig, const char *tag)
void address_map_entry::set_write_bank(const device_t &device, const char *tag)
{
m_write.m_type = AMH_BANK;
m_write.set_tag(devconfig, tag);
m_write.set_tag(device, tag);
}
@ -193,12 +193,12 @@ void address_map_entry::set_write_bank(const device_config &devconfig, const cha
// writing to a memory bank
//-------------------------------------------------
void address_map_entry::set_readwrite_bank(const device_config &devconfig, const char *tag)
void address_map_entry::set_readwrite_bank(const device_t &device, const char *tag)
{
m_read.m_type = AMH_BANK;
m_read.set_tag(devconfig, tag);
m_read.set_tag(device, tag);
m_write.m_type = AMH_BANK;
m_write.set_tag(devconfig, tag);
m_write.set_tag(device, tag);
}
@ -238,7 +238,7 @@ void address_map_entry::internal_set_handler(read8_space_func rfunc, const char
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read8_device_func func, const char *string, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read8_device_func func, const char *string, UINT64 unitmask)
{
assert(func != NULL);
assert(unitmask_is_appropriate(8, unitmask, string));
@ -246,12 +246,12 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
m_read.m_bits = 8;
m_read.m_mask = unitmask;
m_read.m_name = string;
m_read.set_tag(devconfig, tag);
m_read.set_tag(device, tag);
m_rdevice8 = func;
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write8_device_func func, const char *string, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, write8_device_func func, const char *string, UINT64 unitmask)
{
assert(func != NULL);
assert(unitmask_is_appropriate(8, unitmask, string));
@ -259,19 +259,19 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
m_write.m_bits = 8;
m_write.m_mask = unitmask;
m_write.m_name = string;
m_write.set_tag(devconfig, tag);
m_write.set_tag(device, tag);
m_wdevice8 = func;
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring, UINT64 unitmask)
{
internal_set_handler(devconfig, tag, rfunc, rstring, unitmask);
internal_set_handler(devconfig, tag, wfunc, wstring, unitmask);
internal_set_handler(device, tag, rfunc, rstring, unitmask);
internal_set_handler(device, tag, wfunc, wstring, unitmask);
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read8_delegate func, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read8_delegate func, UINT64 unitmask)
{
assert(!func.isnull());
assert(unitmask_is_appropriate(8, unitmask, func.name()));
@ -279,12 +279,12 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
m_read.m_bits = 8;
m_read.m_mask = unitmask;
m_read.m_name = func.name();
m_read.set_tag(devconfig, tag);
m_read.set_tag(device, tag);
m_rproto8 = func;
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write8_delegate func, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, write8_delegate func, UINT64 unitmask)
{
assert(!func.isnull());
assert(unitmask_is_appropriate(8, unitmask, func.name()));
@ -292,15 +292,15 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
m_write.m_bits = 8;
m_write.m_mask = unitmask;
m_write.m_name = func.name();
m_write.set_tag(devconfig, tag);
m_write.set_tag(device, tag);
m_wproto8 = func;
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT64 unitmask)
{
internal_set_handler(devconfig, tag, rfunc, unitmask);
internal_set_handler(devconfig, tag, wfunc, unitmask);
internal_set_handler(device, tag, rfunc, unitmask);
internal_set_handler(device, tag, wfunc, unitmask);
}
@ -340,7 +340,7 @@ void address_map_entry::internal_set_handler(read16_space_func rfunc, const char
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read16_device_func func, const char *string, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read16_device_func func, const char *string, UINT64 unitmask)
{
assert(func != NULL);
assert(unitmask_is_appropriate(16, unitmask, string));
@ -348,12 +348,12 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
m_read.m_bits = 16;
m_read.m_mask = unitmask;
m_read.m_name = string;
m_read.set_tag(devconfig, tag);
m_read.set_tag(device, tag);
m_rdevice16 = func;
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write16_device_func func, const char *string, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, write16_device_func func, const char *string, UINT64 unitmask)
{
assert(func != NULL);
assert(unitmask_is_appropriate(16, unitmask, string));
@ -361,19 +361,19 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
m_write.m_bits = 16;
m_write.m_mask = unitmask;
m_write.m_name = string;
m_write.set_tag(devconfig, tag);
m_write.set_tag(device, tag);
m_wdevice16 = func;
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read16_device_func rfunc, const char *rstring, write16_device_func wfunc, const char *wstring, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read16_device_func rfunc, const char *rstring, write16_device_func wfunc, const char *wstring, UINT64 unitmask)
{
internal_set_handler(devconfig, tag, rfunc, rstring, unitmask);
internal_set_handler(devconfig, tag, wfunc, wstring, unitmask);
internal_set_handler(device, tag, rfunc, rstring, unitmask);
internal_set_handler(device, tag, wfunc, wstring, unitmask);
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read16_delegate func, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read16_delegate func, UINT64 unitmask)
{
assert(!func.isnull());
assert(unitmask_is_appropriate(16, unitmask, func.name()));
@ -381,12 +381,12 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
m_read.m_bits = 16;
m_read.m_mask = unitmask;
m_read.m_name = func.name();
m_read.set_tag(devconfig, tag);
m_read.set_tag(device, tag);
m_rproto16 = func;
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write16_delegate func, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, write16_delegate func, UINT64 unitmask)
{
assert(!func.isnull());
assert(unitmask_is_appropriate(16, unitmask, func.name()));
@ -394,15 +394,15 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
m_write.m_bits = 16;
m_write.m_mask = unitmask;
m_write.m_name = func.name();
m_write.set_tag(devconfig, tag);
m_write.set_tag(device, tag);
m_wproto16 = func;
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT64 unitmask)
{
internal_set_handler(devconfig, tag, rfunc, unitmask);
internal_set_handler(devconfig, tag, wfunc, unitmask);
internal_set_handler(device, tag, rfunc, unitmask);
internal_set_handler(device, tag, wfunc, unitmask);
}
@ -442,7 +442,7 @@ void address_map_entry::internal_set_handler(read32_space_func rfunc, const char
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read32_device_func func, const char *string, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read32_device_func func, const char *string, UINT64 unitmask)
{
assert(func != NULL);
assert(unitmask_is_appropriate(32, unitmask, string));
@ -450,12 +450,12 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
m_read.m_bits = 32;
m_read.m_mask = unitmask;
m_read.m_name = string;
m_read.set_tag(devconfig, tag);
m_read.set_tag(device, tag);
m_rdevice32 = func;
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write32_device_func func, const char *string, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, write32_device_func func, const char *string, UINT64 unitmask)
{
assert(func != NULL);
assert(unitmask_is_appropriate(32, unitmask, string));
@ -463,19 +463,19 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
m_write.m_bits = 32;
m_write.m_mask = unitmask;
m_write.m_name = string;
m_write.set_tag(devconfig, tag);
m_write.set_tag(device, tag);
m_wdevice32 = func;
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read32_device_func rfunc, const char *rstring, write32_device_func wfunc, const char *wstring, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read32_device_func rfunc, const char *rstring, write32_device_func wfunc, const char *wstring, UINT64 unitmask)
{
internal_set_handler(devconfig, tag, rfunc, rstring, unitmask);
internal_set_handler(devconfig, tag, wfunc, wstring, unitmask);
internal_set_handler(device, tag, rfunc, rstring, unitmask);
internal_set_handler(device, tag, wfunc, wstring, unitmask);
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read32_delegate func, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read32_delegate func, UINT64 unitmask)
{
assert(!func.isnull());
assert(unitmask_is_appropriate(32, unitmask, func.name()));
@ -483,12 +483,12 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
m_read.m_bits = 32;
m_read.m_mask = unitmask;
m_read.m_name = func.name();
m_read.set_tag(devconfig, tag);
m_read.set_tag(device, tag);
m_rproto32 = func;
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write32_delegate func, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, write32_delegate func, UINT64 unitmask)
{
assert(!func.isnull());
assert(unitmask_is_appropriate(32, unitmask, func.name()));
@ -496,15 +496,15 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
m_write.m_bits = 32;
m_write.m_mask = unitmask;
m_write.m_name = func.name();
m_write.set_tag(devconfig, tag);
m_write.set_tag(device, tag);
m_wproto32 = func;
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read32_delegate rfunc, write32_delegate wfunc, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read32_delegate rfunc, write32_delegate wfunc, UINT64 unitmask)
{
internal_set_handler(devconfig, tag, rfunc, unitmask);
internal_set_handler(devconfig, tag, wfunc, unitmask);
internal_set_handler(device, tag, rfunc, unitmask);
internal_set_handler(device, tag, wfunc, unitmask);
}
@ -544,7 +544,7 @@ void address_map_entry::internal_set_handler(read64_space_func rfunc, const char
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read64_device_func func, const char *string, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read64_device_func func, const char *string, UINT64 unitmask)
{
assert(func != NULL);
assert(unitmask_is_appropriate(64, unitmask, string));
@ -552,12 +552,12 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
m_read.m_bits = 64;
m_read.m_mask = 0;
m_read.m_name = string;
m_read.set_tag(devconfig, tag);
m_read.set_tag(device, tag);
m_rdevice64 = func;
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write64_device_func func, const char *string, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, write64_device_func func, const char *string, UINT64 unitmask)
{
assert(func != NULL);
assert(unitmask_is_appropriate(64, unitmask, string));
@ -565,19 +565,19 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
m_write.m_bits = 64;
m_write.m_mask = 0;
m_write.m_name = string;
m_write.set_tag(devconfig, tag);
m_write.set_tag(device, tag);
m_wdevice64 = func;
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read64_device_func rfunc, const char *rstring, write64_device_func wfunc, const char *wstring, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read64_device_func rfunc, const char *rstring, write64_device_func wfunc, const char *wstring, UINT64 unitmask)
{
internal_set_handler(devconfig, tag, rfunc, rstring, unitmask);
internal_set_handler(devconfig, tag, wfunc, wstring, unitmask);
internal_set_handler(device, tag, rfunc, rstring, unitmask);
internal_set_handler(device, tag, wfunc, wstring, unitmask);
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read64_delegate func, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read64_delegate func, UINT64 unitmask)
{
assert(!func.isnull());
assert(unitmask_is_appropriate(64, unitmask, func.name()));
@ -585,12 +585,12 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
m_read.m_bits = 64;
m_read.m_mask = 0;
m_read.m_name = func.name();
m_read.set_tag(devconfig, tag);
m_read.set_tag(device, tag);
m_rproto64 = func;
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write64_delegate func, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, write64_delegate func, UINT64 unitmask)
{
assert(!func.isnull());
assert(unitmask_is_appropriate(64, unitmask, func.name()));
@ -598,15 +598,15 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
m_write.m_bits = 64;
m_write.m_mask = 0;
m_write.m_name = func.name();
m_write.set_tag(devconfig, tag);
m_write.set_tag(device, tag);
m_wproto64 = func;
}
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read64_delegate rfunc, write64_delegate wfunc, UINT64 unitmask)
void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read64_delegate rfunc, write64_delegate wfunc, UINT64 unitmask)
{
internal_set_handler(devconfig, tag, rfunc, unitmask);
internal_set_handler(devconfig, tag, wfunc, unitmask);
internal_set_handler(device, tag, rfunc, unitmask);
internal_set_handler(device, tag, wfunc, unitmask);
}
@ -696,33 +696,33 @@ address_map_entry64::address_map_entry64(address_map &map, offs_t start, offs_t
// address_map - constructor
//-------------------------------------------------
address_map::address_map(const device_config &devconfig, address_spacenum spacenum)
address_map::address_map(const device_t &device, address_spacenum spacenum)
: m_spacenum(spacenum),
m_databits(0xff),
m_unmapval(0),
m_globalmask(0)
{
// get our memory interface
const device_config_memory_interface *memintf;
if (!devconfig.interface(memintf))
throw emu_fatalerror("No memory interface defined for device '%s'\n", devconfig.tag());
const device_memory_interface *memintf;
if (!device.interface(memintf))
throw emu_fatalerror("No memory interface defined for device '%s'\n", device.tag());
// and then the configuration for the current address space
const address_space_config *spaceconfig = memintf->space_config(spacenum);
if (!devconfig.interface(memintf))
throw emu_fatalerror("No memory address space configuration found for device '%s', space %d\n", devconfig.tag(), spacenum);
if (!device.interface(memintf))
throw emu_fatalerror("No memory address space configuration found for device '%s', space %d\n", device.tag(), spacenum);
// append the internal device map (first so it takes priority) */
if (spaceconfig->m_internal_map != NULL)
(*spaceconfig->m_internal_map)(*this, devconfig);
(*spaceconfig->m_internal_map)(*this, device);
// construct the standard map */
if (memintf->address_map(spacenum) != NULL)
(*memintf->address_map(spacenum))(*this, devconfig);
(*memintf->address_map(spacenum))(*this, device);
// append the default device map (last so it can be overridden) */
if (spaceconfig->m_default_map != NULL)
(*spaceconfig->m_default_map)(*this, devconfig);
(*spaceconfig->m_default_map)(*this, device);
}

View File

@ -92,7 +92,7 @@ public:
const char * m_tag; // tag pointing to a reference
astring m_derived_tag; // string used to hold derived names
void set_tag(const device_config &devconfig, const char *tag);
void set_tag(const device_t &device, const char *tag);
};
@ -125,14 +125,14 @@ public:
void set_mask(offs_t _mask);
// I/O port configuration
void set_read_port(const device_config &devconfig, const char *tag);
void set_write_port(const device_config &devconfig, const char *tag);
void set_readwrite_port(const device_config &devconfig, const char *tag);
void set_read_port(const device_t &device, const char *tag);
void set_write_port(const device_t &device, const char *tag);
void set_readwrite_port(const device_t &device, const char *tag);
// memory bank configuration
void set_read_bank(const device_config &devconfig, const char *tag);
void set_write_bank(const device_config &devconfig, const char *tag);
void set_readwrite_bank(const device_config &devconfig, const char *tag);
void set_read_bank(const device_t &device, const char *tag);
void set_write_bank(const device_t &device, const char *tag);
void set_readwrite_bank(const device_t &device, const char *tag);
// public state
address_map_entry * m_next; // pointer to the next entry
@ -197,45 +197,45 @@ protected:
void internal_set_handler(read8_space_func func, const char *string, UINT64 mask);
void internal_set_handler(write8_space_func func, const char *string, UINT64 mask);
void internal_set_handler(read8_space_func rfunc, const char *rstring, write8_space_func wfunc, const char *wstring, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, read8_device_func func, const char *string, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, write8_device_func func, const char *string, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, read8_delegate func, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, write8_delegate func, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, read8_device_func func, const char *string, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, write8_device_func func, const char *string, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, read8_delegate func, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, write8_delegate func, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT64 mask);
// internal handler setters for 16-bit functions
void internal_set_handler(read16_space_func func, const char *string, UINT64 mask);
void internal_set_handler(write16_space_func func, const char *string, UINT64 mask);
void internal_set_handler(read16_space_func rfunc, const char *rstring, write16_space_func wfunc, const char *wstring, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, read16_device_func func, const char *string, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, write16_device_func func, const char *string, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, read16_device_func rfunc, const char *rstring, write16_device_func wfunc, const char *wstring, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, read16_delegate func, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, write16_delegate func, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, read16_device_func func, const char *string, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, write16_device_func func, const char *string, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, read16_device_func rfunc, const char *rstring, write16_device_func wfunc, const char *wstring, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, read16_delegate func, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, write16_delegate func, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT64 mask);
// internal handler setters for 32-bit functions
void internal_set_handler(read32_space_func func, const char *string, UINT64 mask);
void internal_set_handler(write32_space_func func, const char *string, UINT64 mask);
void internal_set_handler(read32_space_func rfunc, const char *rstring, write32_space_func wfunc, const char *wstring, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, read32_device_func func, const char *string, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, write32_device_func func, const char *string, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, read32_device_func rfunc, const char *rstring, write32_device_func wfunc, const char *wstring, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, read32_delegate func, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, write32_delegate func, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, read32_delegate rfunc, write32_delegate wfunc, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, read32_device_func func, const char *string, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, write32_device_func func, const char *string, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, read32_device_func rfunc, const char *rstring, write32_device_func wfunc, const char *wstring, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, read32_delegate func, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, write32_delegate func, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, read32_delegate rfunc, write32_delegate wfunc, UINT64 mask);
// internal handler setters for 64-bit functions
void internal_set_handler(read64_space_func func, const char *string, UINT64 mask);
void internal_set_handler(write64_space_func func, const char *string, UINT64 mask);
void internal_set_handler(read64_space_func rfunc, const char *rstring, write64_space_func wfunc, const char *wstring, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, read64_device_func func, const char *string, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, write64_device_func func, const char *string, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, read64_device_func rfunc, const char *rstring, write64_device_func wfunc, const char *wstring, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, read64_delegate func, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, write64_delegate func, UINT64 mask);
void internal_set_handler(const device_config &devconfig, const char *tag, read64_delegate rfunc, write64_delegate wfunc, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, read64_device_func func, const char *string, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, write64_device_func func, const char *string, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, read64_device_func rfunc, const char *rstring, write64_device_func wfunc, const char *wstring, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, read64_delegate func, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, write64_delegate func, UINT64 mask);
void internal_set_handler(const device_t &device, const char *tag, read64_delegate rfunc, write64_delegate wfunc, UINT64 mask);
private:
// helper functions
@ -257,12 +257,12 @@ public:
void set_handler(read8_space_func func, const char *string) { internal_set_handler(func, string, 0); }
void set_handler(write8_space_func func, const char *string) { internal_set_handler(func, string, 0); }
void set_handler(read8_space_func rfunc, const char *rstring, write8_space_func wfunc, const char *wstring) { internal_set_handler(rfunc, rstring, wfunc, wstring, 0); }
void set_handler(const device_config &devconfig, const char *tag, read8_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); }
void set_handler(const device_config &devconfig, const char *tag, write8_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); }
void set_handler(const device_config &devconfig, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, 0); }
void set_handler(const device_config &devconfig, const char *tag, read8_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
void set_handler(const device_config &devconfig, const char *tag, write8_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
void set_handler(const device_config &devconfig, const char *tag, read8_delegate rfunc, write8_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); }
void set_handler(const device_t &device, const char *tag, read8_device_func func, const char *string) { internal_set_handler(device, tag, func, string, 0); }
void set_handler(const device_t &device, const char *tag, write8_device_func func, const char *string) { internal_set_handler(device, tag, func, string, 0); }
void set_handler(const device_t &device, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring) { internal_set_handler(device, tag, rfunc, rstring, wfunc, wstring, 0); }
void set_handler(const device_t &device, const char *tag, read8_delegate func) { internal_set_handler(device, tag, func, 0); }
void set_handler(const device_t &device, const char *tag, write8_delegate func) { internal_set_handler(device, tag, func, 0); }
void set_handler(const device_t &device, const char *tag, read8_delegate rfunc, write8_delegate wfunc) { internal_set_handler(device, tag, rfunc, wfunc, 0); }
};
@ -280,23 +280,23 @@ public:
void set_handler(read16_space_func func, const char *string) { internal_set_handler(func, string, 0); }
void set_handler(write16_space_func func, const char *string) { internal_set_handler(func, string, 0); }
void set_handler(read16_space_func rfunc, const char *rstring, write16_space_func wfunc, const char *wstring) { internal_set_handler(rfunc, rstring, wfunc, wstring, 0); }
void set_handler(const device_config &devconfig, const char *tag, read16_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); }
void set_handler(const device_config &devconfig, const char *tag, write16_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); }
void set_handler(const device_config &devconfig, const char *tag, read16_device_func rfunc, const char *rstring, write16_device_func wfunc, const char *wstring) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, 0); }
void set_handler(const device_config &devconfig, const char *tag, read16_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
void set_handler(const device_config &devconfig, const char *tag, write16_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
void set_handler(const device_config &devconfig, const char *tag, read16_delegate rfunc, write16_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); }
void set_handler(const device_t &device, const char *tag, read16_device_func func, const char *string) { internal_set_handler(device, tag, func, string, 0); }
void set_handler(const device_t &device, const char *tag, write16_device_func func, const char *string) { internal_set_handler(device, tag, func, string, 0); }
void set_handler(const device_t &device, const char *tag, read16_device_func rfunc, const char *rstring, write16_device_func wfunc, const char *wstring) { internal_set_handler(device, tag, rfunc, rstring, wfunc, wstring, 0); }
void set_handler(const device_t &device, const char *tag, read16_delegate func) { internal_set_handler(device, tag, func, 0); }
void set_handler(const device_t &device, const char *tag, write16_delegate func) { internal_set_handler(device, tag, func, 0); }
void set_handler(const device_t &device, const char *tag, read16_delegate rfunc, write16_delegate wfunc) { internal_set_handler(device, tag, rfunc, wfunc, 0); }
// 8-bit handlers
void set_handler(read8_space_func func, const char *string, UINT16 mask) { internal_set_handler(func, string, mask); }
void set_handler(write8_space_func func, const char *string, UINT16 mask) { internal_set_handler(func, string, mask); }
void set_handler(read8_space_func rfunc, const char *rstring, write8_space_func wfunc, const char *wstring, UINT16 mask) { internal_set_handler(rfunc, rstring, wfunc, wstring, mask); }
void set_handler(const device_config &devconfig, const char *tag, read8_device_func func, const char *string, UINT16 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
void set_handler(const device_config &devconfig, const char *tag, write8_device_func func, const char *string, UINT16 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
void set_handler(const device_config &devconfig, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring, UINT16 mask) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, mask); }
void set_handler(const device_config &devconfig, const char *tag, read8_delegate func, UINT16 mask) { internal_set_handler(devconfig, tag, func, mask); }
void set_handler(const device_config &devconfig, const char *tag, write8_delegate func, UINT16 mask) { internal_set_handler(devconfig, tag, func, mask); }
void set_handler(const device_config &devconfig, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT16 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
void set_handler(const device_t &device, const char *tag, read8_device_func func, const char *string, UINT16 mask) { internal_set_handler(device, tag, func, string, mask); }
void set_handler(const device_t &device, const char *tag, write8_device_func func, const char *string, UINT16 mask) { internal_set_handler(device, tag, func, string, mask); }
void set_handler(const device_t &device, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring, UINT16 mask) { internal_set_handler(device, tag, rfunc, rstring, wfunc, wstring, mask); }
void set_handler(const device_t &device, const char *tag, read8_delegate func, UINT16 mask) { internal_set_handler(device, tag, func, mask); }
void set_handler(const device_t &device, const char *tag, write8_delegate func, UINT16 mask) { internal_set_handler(device, tag, func, mask); }
void set_handler(const device_t &device, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT16 mask) { internal_set_handler(device, tag, rfunc, wfunc, mask); }
};
@ -314,34 +314,34 @@ public:
void set_handler(read32_space_func func, const char *string) { internal_set_handler(func, string, 0); }
void set_handler(write32_space_func func, const char *string) { internal_set_handler(func, string, 0); }
void set_handler(read32_space_func rfunc, const char *rstring, write32_space_func wfunc, const char *wstring) { internal_set_handler(rfunc, rstring, wfunc, wstring, 0); }
void set_handler(const device_config &devconfig, const char *tag, read32_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); }
void set_handler(const device_config &devconfig, const char *tag, write32_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); }
void set_handler(const device_config &devconfig, const char *tag, read32_device_func rfunc, const char *rstring, write32_device_func wfunc, const char *wstring) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, 0); }
void set_handler(const device_config &devconfig, const char *tag, read32_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
void set_handler(const device_config &devconfig, const char *tag, write32_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
void set_handler(const device_config &devconfig, const char *tag, read32_delegate rfunc, write32_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); }
void set_handler(const device_t &device, const char *tag, read32_device_func func, const char *string) { internal_set_handler(device, tag, func, string, 0); }
void set_handler(const device_t &device, const char *tag, write32_device_func func, const char *string) { internal_set_handler(device, tag, func, string, 0); }
void set_handler(const device_t &device, const char *tag, read32_device_func rfunc, const char *rstring, write32_device_func wfunc, const char *wstring) { internal_set_handler(device, tag, rfunc, rstring, wfunc, wstring, 0); }
void set_handler(const device_t &device, const char *tag, read32_delegate func) { internal_set_handler(device, tag, func, 0); }
void set_handler(const device_t &device, const char *tag, write32_delegate func) { internal_set_handler(device, tag, func, 0); }
void set_handler(const device_t &device, const char *tag, read32_delegate rfunc, write32_delegate wfunc) { internal_set_handler(device, tag, rfunc, wfunc, 0); }
// 16-bit handlers
void set_handler(read16_space_func func, const char *string, UINT32 mask) { internal_set_handler(func, string, mask); }
void set_handler(write16_space_func func, const char *string, UINT32 mask) { internal_set_handler(func, string, mask); }
void set_handler(read16_space_func rfunc, const char *rstring, write16_space_func wfunc, const char *wstring, UINT32 mask) { internal_set_handler(rfunc, rstring, wfunc, wstring, mask); }
void set_handler(const device_config &devconfig, const char *tag, read16_device_func func, const char *string, UINT32 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
void set_handler(const device_config &devconfig, const char *tag, write16_device_func func, const char *string, UINT32 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
void set_handler(const device_config &devconfig, const char *tag, read16_device_func rfunc, const char *rstring, write16_device_func wfunc, const char *wstring, UINT32 mask) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, mask); }
void set_handler(const device_config &devconfig, const char *tag, read16_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); }
void set_handler(const device_config &devconfig, const char *tag, write16_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); }
void set_handler(const device_config &devconfig, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT32 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
void set_handler(const device_t &device, const char *tag, read16_device_func func, const char *string, UINT32 mask) { internal_set_handler(device, tag, func, string, mask); }
void set_handler(const device_t &device, const char *tag, write16_device_func func, const char *string, UINT32 mask) { internal_set_handler(device, tag, func, string, mask); }
void set_handler(const device_t &device, const char *tag, read16_device_func rfunc, const char *rstring, write16_device_func wfunc, const char *wstring, UINT32 mask) { internal_set_handler(device, tag, rfunc, rstring, wfunc, wstring, mask); }
void set_handler(const device_t &device, const char *tag, read16_delegate func, UINT32 mask) { internal_set_handler(device, tag, func, mask); }
void set_handler(const device_t &device, const char *tag, write16_delegate func, UINT32 mask) { internal_set_handler(device, tag, func, mask); }
void set_handler(const device_t &device, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT32 mask) { internal_set_handler(device, tag, rfunc, wfunc, mask); }
// 8-bit handlers
void set_handler(read8_space_func func, const char *string, UINT32 mask) { internal_set_handler(func, string, mask); }
void set_handler(write8_space_func func, const char *string, UINT32 mask) { internal_set_handler(func, string, mask); }
void set_handler(read8_space_func rfunc, const char *rstring, write8_space_func wfunc, const char *wstring, UINT32 mask) { internal_set_handler(rfunc, rstring, wfunc, wstring, mask); }
void set_handler(const device_config &devconfig, const char *tag, read8_device_func func, const char *string, UINT32 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
void set_handler(const device_config &devconfig, const char *tag, write8_device_func func, const char *string, UINT32 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
void set_handler(const device_config &devconfig, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring, UINT32 mask) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, mask); }
void set_handler(const device_config &devconfig, const char *tag, read8_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); }
void set_handler(const device_config &devconfig, const char *tag, write8_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); }
void set_handler(const device_config &devconfig, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT32 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
void set_handler(const device_t &device, const char *tag, read8_device_func func, const char *string, UINT32 mask) { internal_set_handler(device, tag, func, string, mask); }
void set_handler(const device_t &device, const char *tag, write8_device_func func, const char *string, UINT32 mask) { internal_set_handler(device, tag, func, string, mask); }
void set_handler(const device_t &device, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring, UINT32 mask) { internal_set_handler(device, tag, rfunc, rstring, wfunc, wstring, mask); }
void set_handler(const device_t &device, const char *tag, read8_delegate func, UINT32 mask) { internal_set_handler(device, tag, func, mask); }
void set_handler(const device_t &device, const char *tag, write8_delegate func, UINT32 mask) { internal_set_handler(device, tag, func, mask); }
void set_handler(const device_t &device, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT32 mask) { internal_set_handler(device, tag, rfunc, wfunc, mask); }
};
@ -359,45 +359,45 @@ public:
void set_handler(read64_space_func func, const char *string) { internal_set_handler(func, string, 0); }
void set_handler(write64_space_func func, const char *string) { internal_set_handler(func, string, 0); }
void set_handler(read64_space_func rfunc, const char *rstring, write64_space_func wfunc, const char *wstring) { internal_set_handler(rfunc, rstring, wfunc, wstring, 0); }
void set_handler(const device_config &devconfig, const char *tag, read64_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); }
void set_handler(const device_config &devconfig, const char *tag, write64_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); }
void set_handler(const device_config &devconfig, const char *tag, read64_device_func rfunc, const char *rstring, write64_device_func wfunc, const char *wstring) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, 0); }
void set_handler(const device_config &devconfig, const char *tag, read64_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
void set_handler(const device_config &devconfig, const char *tag, write64_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
void set_handler(const device_config &devconfig, const char *tag, read64_delegate rfunc, write64_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); }
void set_handler(const device_t &device, const char *tag, read64_device_func func, const char *string) { internal_set_handler(device, tag, func, string, 0); }
void set_handler(const device_t &device, const char *tag, write64_device_func func, const char *string) { internal_set_handler(device, tag, func, string, 0); }
void set_handler(const device_t &device, const char *tag, read64_device_func rfunc, const char *rstring, write64_device_func wfunc, const char *wstring) { internal_set_handler(device, tag, rfunc, rstring, wfunc, wstring, 0); }
void set_handler(const device_t &device, const char *tag, read64_delegate func) { internal_set_handler(device, tag, func, 0); }
void set_handler(const device_t &device, const char *tag, write64_delegate func) { internal_set_handler(device, tag, func, 0); }
void set_handler(const device_t &device, const char *tag, read64_delegate rfunc, write64_delegate wfunc) { internal_set_handler(device, tag, rfunc, wfunc, 0); }
// 32-bit handlers
void set_handler(read32_space_func func, const char *string, UINT64 mask) { internal_set_handler(func, string, mask); }
void set_handler(write32_space_func func, const char *string, UINT64 mask) { internal_set_handler(func, string, mask); }
void set_handler(read32_space_func rfunc, const char *rstring, write32_space_func wfunc, const char *wstring, UINT64 mask) { internal_set_handler(rfunc, rstring, wfunc, wstring, mask); }
void set_handler(const device_config &devconfig, const char *tag, read32_device_func func, const char *string, UINT64 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
void set_handler(const device_config &devconfig, const char *tag, write32_device_func func, const char *string, UINT64 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
void set_handler(const device_config &devconfig, const char *tag, read32_device_func rfunc, const char *rstring, write32_device_func wfunc, const char *wstring, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, mask); }
void set_handler(const device_config &devconfig, const char *tag, read32_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
void set_handler(const device_config &devconfig, const char *tag, write32_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
void set_handler(const device_config &devconfig, const char *tag, read32_delegate rfunc, write32_delegate wfunc, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
void set_handler(const device_t &device, const char *tag, read32_device_func func, const char *string, UINT64 mask) { internal_set_handler(device, tag, func, string, mask); }
void set_handler(const device_t &device, const char *tag, write32_device_func func, const char *string, UINT64 mask) { internal_set_handler(device, tag, func, string, mask); }
void set_handler(const device_t &device, const char *tag, read32_device_func rfunc, const char *rstring, write32_device_func wfunc, const char *wstring, UINT64 mask) { internal_set_handler(device, tag, rfunc, rstring, wfunc, wstring, mask); }
void set_handler(const device_t &device, const char *tag, read32_delegate func, UINT64 mask) { internal_set_handler(device, tag, func, mask); }
void set_handler(const device_t &device, const char *tag, write32_delegate func, UINT64 mask) { internal_set_handler(device, tag, func, mask); }
void set_handler(const device_t &device, const char *tag, read32_delegate rfunc, write32_delegate wfunc, UINT64 mask) { internal_set_handler(device, tag, rfunc, wfunc, mask); }
// 16-bit handlers
void set_handler(read16_space_func func, const char *string, UINT64 mask) { internal_set_handler(func, string, mask); }
void set_handler(write16_space_func func, const char *string, UINT64 mask) { internal_set_handler(func, string, mask); }
void set_handler(read16_space_func rfunc, const char *rstring, write16_space_func wfunc, const char *wstring, UINT64 mask) { internal_set_handler(rfunc, rstring, wfunc, wstring, mask); }
void set_handler(const device_config &devconfig, const char *tag, read16_device_func func, const char *string, UINT64 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
void set_handler(const device_config &devconfig, const char *tag, write16_device_func func, const char *string, UINT64 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
void set_handler(const device_config &devconfig, const char *tag, read16_device_func rfunc, const char *rstring, write16_device_func wfunc, const char *wstring, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, mask); }
void set_handler(const device_config &devconfig, const char *tag, read16_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
void set_handler(const device_config &devconfig, const char *tag, write16_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
void set_handler(const device_config &devconfig, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
void set_handler(const device_t &device, const char *tag, read16_device_func func, const char *string, UINT64 mask) { internal_set_handler(device, tag, func, string, mask); }
void set_handler(const device_t &device, const char *tag, write16_device_func func, const char *string, UINT64 mask) { internal_set_handler(device, tag, func, string, mask); }
void set_handler(const device_t &device, const char *tag, read16_device_func rfunc, const char *rstring, write16_device_func wfunc, const char *wstring, UINT64 mask) { internal_set_handler(device, tag, rfunc, rstring, wfunc, wstring, mask); }
void set_handler(const device_t &device, const char *tag, read16_delegate func, UINT64 mask) { internal_set_handler(device, tag, func, mask); }
void set_handler(const device_t &device, const char *tag, write16_delegate func, UINT64 mask) { internal_set_handler(device, tag, func, mask); }
void set_handler(const device_t &device, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT64 mask) { internal_set_handler(device, tag, rfunc, wfunc, mask); }
// 8-bit handlers
void set_handler(read8_space_func func, const char *string, UINT64 mask) { internal_set_handler(func, string, mask); }
void set_handler(write8_space_func func, const char *string, UINT64 mask) { internal_set_handler(func, string, mask); }
void set_handler(read8_space_func rfunc, const char *rstring, write8_space_func wfunc, const char *wstring, UINT64 mask) { internal_set_handler(rfunc, rstring, wfunc, wstring, mask); }
void set_handler(const device_config &devconfig, const char *tag, read8_device_func func, const char *string, UINT64 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
void set_handler(const device_config &devconfig, const char *tag, write8_device_func func, const char *string, UINT64 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
void set_handler(const device_config &devconfig, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, mask); }
void set_handler(const device_config &devconfig, const char *tag, read8_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
void set_handler(const device_config &devconfig, const char *tag, write8_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
void set_handler(const device_config &devconfig, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
void set_handler(const device_t &device, const char *tag, read8_device_func func, const char *string, UINT64 mask) { internal_set_handler(device, tag, func, string, mask); }
void set_handler(const device_t &device, const char *tag, write8_device_func func, const char *string, UINT64 mask) { internal_set_handler(device, tag, func, string, mask); }
void set_handler(const device_t &device, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring, UINT64 mask) { internal_set_handler(device, tag, rfunc, rstring, wfunc, wstring, mask); }
void set_handler(const device_t &device, const char *tag, read8_delegate func, UINT64 mask) { internal_set_handler(device, tag, func, mask); }
void set_handler(const device_t &device, const char *tag, write8_delegate func, UINT64 mask) { internal_set_handler(device, tag, func, mask); }
void set_handler(const device_t &device, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT64 mask) { internal_set_handler(device, tag, rfunc, wfunc, mask); }
};
@ -408,7 +408,7 @@ class address_map
{
public:
// construction/destruction
address_map(const device_config &devconfig, address_spacenum spacenum);
address_map(const device_t &device, address_spacenum spacenum);
~address_map();
// configuration
@ -459,7 +459,7 @@ public:
#define ADDRESS_MAP_NAME(_name) construct_address_map_##_name
#define ADDRESS_MAP_START(_name, _space, _bits) \
void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
void ADDRESS_MAP_NAME(_name)(address_map &map, const device_t &device) \
{ \
typedef read##_bits##_delegate read_delegate; \
typedef write##_bits##_delegate write_delegate; \
@ -472,7 +472,7 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
// use this to declare external references to an address map
#define ADDRESS_MAP_EXTERN(_name, _bits) \
extern void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig)
extern void ADDRESS_MAP_NAME(_name)(address_map &map, const device_t &device)
// global controls
@ -488,7 +488,7 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
// importing data from other address maps
#define AM_IMPORT_FROM(_name) \
ADDRESS_MAP_NAME(_name)(map, devconfig); \
ADDRESS_MAP_NAME(_name)(map, device); \
// address ranges
@ -546,86 +546,86 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
// legacy device reads
#define AM_DEVREAD(_tag, _handler) \
curentry->set_handler(devconfig, _tag, _handler, #_handler); \
curentry->set_handler(device, _tag, _handler, #_handler); \
#define AM_DEVREAD8(_tag, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \
curentry->set_handler(device, _tag, _handler, #_handler, _unitmask); \
#define AM_DEVREAD16(_tag, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \
curentry->set_handler(device, _tag, _handler, #_handler, _unitmask); \
#define AM_DEVREAD32(_tag, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \
curentry->set_handler(device, _tag, _handler, #_handler, _unitmask); \
// legacy device writes
#define AM_DEVWRITE(_tag, _handler) \
curentry->set_handler(devconfig, _tag, _handler, #_handler); \
curentry->set_handler(device, _tag, _handler, #_handler); \
#define AM_DEVWRITE8(_tag, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \
curentry->set_handler(device, _tag, _handler, #_handler, _unitmask); \
#define AM_DEVWRITE16(_tag, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \
curentry->set_handler(device, _tag, _handler, #_handler, _unitmask); \
#define AM_DEVWRITE32(_tag, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \
curentry->set_handler(device, _tag, _handler, #_handler, _unitmask); \
// legacy device reads/writes
#define AM_DEVREADWRITE(_tag, _rhandler, _whandler) \
curentry->set_handler(devconfig, _tag, _rhandler, #_rhandler, _whandler, #_whandler); \
curentry->set_handler(device, _tag, _rhandler, #_rhandler, _whandler, #_whandler); \
#define AM_DEVREADWRITE8(_tag, _rhandler, _whandler, _unitmask) \
curentry->set_handler(devconfig, _tag, _rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \
curentry->set_handler(device, _tag, _rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \
#define AM_DEVREADWRITE16(_tag, _rhandler, _whandler, _unitmask) \
curentry->set_handler(devconfig, _tag, _rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \
curentry->set_handler(device, _tag, _rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \
#define AM_DEVREADWRITE32(_tag, _rhandler, _whandler, _unitmask) \
curentry->set_handler(devconfig, _tag, _rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \
curentry->set_handler(device, _tag, _rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \
// device reads
#define AM_DEVREAD_MODERN(_tag, _class, _handler) \
curentry->set_handler(devconfig, _tag, read_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0)); \
curentry->set_handler(device, _tag, read_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0)); \
#define AM_DEVREAD8_MODERN(_tag, _class, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, read8_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
curentry->set_handler(device, _tag, read8_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
#define AM_DEVREAD16_MODERN(_tag, _class, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, read16_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
curentry->set_handler(device, _tag, read16_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
#define AM_DEVREAD32_MODERN(_tag, _class, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, read32_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
curentry->set_handler(device, _tag, read32_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
// device writes
#define AM_DEVWRITE_MODERN(_tag, _class, _handler) \
curentry->set_handler(devconfig, _tag, write_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0)); \
curentry->set_handler(device, _tag, write_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0)); \
#define AM_DEVWRITE8_MODERN(_tag, _class, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, write8_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
curentry->set_handler(device, _tag, write8_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
#define AM_DEVWRITE16_MODERN(_tag, _class, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, write16_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
curentry->set_handler(device, _tag, write16_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
#define AM_DEVWRITE32_MODERN(_tag, _class, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, write32_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
curentry->set_handler(device, _tag, write32_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
// device reads/writes
#define AM_DEVREADWRITE_MODERN(_tag, _class, _rhandler, _whandler) \
curentry->set_handler(devconfig, _tag, read_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0)); \
curentry->set_handler(device, _tag, read_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0)); \
#define AM_DEVREADWRITE8_MODERN(_tag, _class, _rhandler, _whandler, _unitmask) \
curentry->set_handler(devconfig, _tag, read8_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write8_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \
curentry->set_handler(device, _tag, read8_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write8_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \
#define AM_DEVREADWRITE16_MODERN(_tag, _class, _rhandler, _whandler, _unitmask) \
curentry->set_handler(devconfig, _tag, read16_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write16_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \
curentry->set_handler(device, _tag, read16_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write16_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \
#define AM_DEVREADWRITE32_MODERN(_tag, _class, _rhandler, _whandler, _unitmask) \
curentry->set_handler(devconfig, _tag, read32_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write32_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \
curentry->set_handler(device, _tag, read32_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write32_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \
// special-case accesses
@ -659,24 +659,24 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
// port accesses
#define AM_READ_PORT(_tag) \
curentry->set_read_port(devconfig, _tag); \
curentry->set_read_port(device, _tag); \
#define AM_WRITE_PORT(_tag) \
curentry->set_write_port(devconfig, _tag); \
curentry->set_write_port(device, _tag); \
#define AM_READWRITE_PORT(_tag) \
curentry->set_readwrite_port(devconfig, _tag); \
curentry->set_readwrite_port(device, _tag); \
// bank accesses
#define AM_READ_BANK(_tag) \
curentry->set_read_bank(devconfig, _tag); \
curentry->set_read_bank(device, _tag); \
#define AM_WRITE_BANK(_tag) \
curentry->set_write_bank(devconfig, _tag); \
curentry->set_write_bank(device, _tag); \
#define AM_READWRITE_BANK(_tag) \
curentry->set_readwrite_bank(devconfig, _tag); \
curentry->set_readwrite_bank(device, _tag); \
// attributes for accesses
@ -728,7 +728,7 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
#define ADDRESS_MAP_NAME(_name) construct_address_map_##_name
#define ADDRESS_MAP_START(_name, _space, _bits, _class) \
void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
void ADDRESS_MAP_NAME(_name)(address_map &map, const device_t &device) \
{ \
typedef read##_bits##_delegate read_delegate; \
typedef write##_bits##_delegate write_delegate; \
@ -742,7 +742,7 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
// use this to declare external references to an address map
#define ADDRESS_MAP_EXTERN(_name, _bits) \
extern void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig)
extern void ADDRESS_MAP_NAME(_name)(address_map &map, const device_t &device)
// global controls
@ -758,7 +758,7 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
// importing data from other address maps
#define AM_IMPORT_FROM(_name) \
ADDRESS_MAP_NAME(_name)(map, devconfig); \
ADDRESS_MAP_NAME(_name)(map, device); \
// address ranges
@ -816,170 +816,170 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
// legacy device reads
#define AM_DEVREAD_LEGACY(_tag, _handler) \
curentry->set_handler(devconfig, _tag, _handler, #_handler); \
curentry->set_handler(device, _tag, _handler, #_handler); \
#define AM_DEVREAD8_LEGACY(_tag, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \
curentry->set_handler(device, _tag, _handler, #_handler, _unitmask); \
#define AM_DEVREAD16_LEGACY(_tag, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \
curentry->set_handler(device, _tag, _handler, #_handler, _unitmask); \
#define AM_DEVREAD32_LEGACY(_tag, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \
curentry->set_handler(device, _tag, _handler, #_handler, _unitmask); \
// legacy device writes
#define AM_DEVWRITE_LEGACY(_tag, _handler) \
curentry->set_handler(devconfig, _tag, _handler, #_handler); \
curentry->set_handler(device, _tag, _handler, #_handler); \
#define AM_DEVWRITE8_LEGACY(_tag, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \
curentry->set_handler(device, _tag, _handler, #_handler, _unitmask); \
#define AM_DEVWRITE16_LEGACY(_tag, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \
curentry->set_handler(device, _tag, _handler, #_handler, _unitmask); \
#define AM_DEVWRITE32_LEGACY(_tag, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \
curentry->set_handler(device, _tag, _handler, #_handler, _unitmask); \
// legacy device reads/writes
#define AM_DEVREADWRITE_LEGACY(_tag, _rhandler, _whandler) \
curentry->set_handler(devconfig, _tag, _rhandler, #_rhandler, _whandler, #_whandler); \
curentry->set_handler(device, _tag, _rhandler, #_rhandler, _whandler, #_whandler); \
#define AM_DEVREADWRITE8_LEGACY(_tag, _rhandler, _whandler, _unitmask) \
curentry->set_handler(devconfig, _tag, _rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \
curentry->set_handler(device, _tag, _rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \
#define AM_DEVREADWRITE16_LEGACY(_tag, _rhandler, _whandler, _unitmask) \
curentry->set_handler(devconfig, _tag, _rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \
curentry->set_handler(device, _tag, _rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \
#define AM_DEVREADWRITE32_LEGACY(_tag, _rhandler, _whandler, _unitmask) \
curentry->set_handler(devconfig, _tag, _rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \
curentry->set_handler(device, _tag, _rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \
// driver data base reads
#define AM_READ_BASE(_class, _handler) \
curentry->set_handler(devconfig, NULL, read_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0)); \
curentry->set_handler(device, NULL, read_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0)); \
#define AM_READ8_BASE(_class, _handler, _unitmask) \
curentry->set_handler(devconfig, NULL, read8_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \
curentry->set_handler(device, NULL, read8_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \
#define AM_READ16_BASE(_class, _handler, _unitmask) \
curentry->set_handler(devconfig, NULL, read16_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \
curentry->set_handler(device, NULL, read16_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \
#define AM_READ32_BASE(_class, _handler, _unitmask) \
curentry->set_handler(devconfig, NULL, read32_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \
curentry->set_handler(device, NULL, read32_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \
// driver data base writes
#define AM_WRITE_BASE(_class, _handler) \
curentry->set_handler(devconfig, NULL, write_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0)); \
curentry->set_handler(device, NULL, write_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0)); \
#define AM_WRITE8_BASE(_class, _handler, _unitmask) \
curentry->set_handler(devconfig, NULL, write8_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \
curentry->set_handler(device, NULL, write8_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \
#define AM_WRITE16_BASE(_class, _handler, _unitmask) \
curentry->set_handler(devconfig, NULL, write16_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \
curentry->set_handler(device, NULL, write16_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \
#define AM_WRITE32_BASE(_class, _handler, _unitmask) \
curentry->set_handler(devconfig, NULL, write32_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \
curentry->set_handler(device, NULL, write32_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \
// driver data base reads/writes
#define AM_READWRITE_BASE(_class, _rhandler, _whandler) \
curentry->set_handler(devconfig, NULL, read_delegate(&_class::_rhandler, "driver_data::" #_rhandler, (_class *)0), write_delegate(&_class::_whandler, "driver_data::" #_whandler, (_class *)0)); \
curentry->set_handler(device, NULL, read_delegate(&_class::_rhandler, "driver_data::" #_rhandler, (_class *)0), write_delegate(&_class::_whandler, "driver_data::" #_whandler, (_class *)0)); \
#define AM_READWRITE8_BASE(_class, _rhandler, _whandler, _unitmask) \
curentry->set_handler(devconfig, NULL, read8_delegate(&_class::_rhandler, "driver_data::" #_rhandler, (_class *)0), write8_delegate(&_class::_whandler, "driver_data::" #_whandler, (_class *)0), _unitmask); \
curentry->set_handler(device, NULL, read8_delegate(&_class::_rhandler, "driver_data::" #_rhandler, (_class *)0), write8_delegate(&_class::_whandler, "driver_data::" #_whandler, (_class *)0), _unitmask); \
#define AM_READWRITE16_BASE(_class, _rhandler, _whandler, _unitmask) \
curentry->set_handler(devconfig, NULL, read16_delegate(&_class::_rhandler, "driver_data::" #_rhandler, (_class *)0), write16_delegate(&_class::_whandler, "driver_data::" #_whandler, (_class *)0), _unitmask); \
curentry->set_handler(device, NULL, read16_delegate(&_class::_rhandler, "driver_data::" #_rhandler, (_class *)0), write16_delegate(&_class::_whandler, "driver_data::" #_whandler, (_class *)0), _unitmask); \
#define AM_READWRITE32_BASE(_class, _rhandler, _whandler, _unitmask) \
curentry->set_handler(devconfig, NULL, read32_delegate(&_class::_rhandler, "driver_data::" #_rhandler, (_class *)0), write32_delegate(&_class::_whandler, "driver_data::" #_whandler, (_class *)0), _unitmask); \
curentry->set_handler(device, NULL, read32_delegate(&_class::_rhandler, "driver_data::" #_rhandler, (_class *)0), write32_delegate(&_class::_whandler, "driver_data::" #_whandler, (_class *)0), _unitmask); \
// driver data reads
#define AM_READ(_handler) \
curentry->set_handler(devconfig, NULL, read_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0)); \
curentry->set_handler(device, NULL, read_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0)); \
#define AM_READ8(_handler, _unitmask) \
curentry->set_handler(devconfig, NULL, read8_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \
curentry->set_handler(device, NULL, read8_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \
#define AM_READ16(_handler, _unitmask) \
curentry->set_handler(devconfig, NULL, read16_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \
curentry->set_handler(device, NULL, read16_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \
#define AM_READ32(_handler, _unitmask) \
curentry->set_handler(devconfig, NULL, read32_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \
curentry->set_handler(device, NULL, read32_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \
// driver data writes
#define AM_WRITE(_handler) \
curentry->set_handler(devconfig, NULL, write_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0)); \
curentry->set_handler(device, NULL, write_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0)); \
#define AM_WRITE8(_handler, _unitmask) \
curentry->set_handler(devconfig, NULL, write8_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \
curentry->set_handler(device, NULL, write8_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \
#define AM_WRITE16(_handler, _unitmask) \
curentry->set_handler(devconfig, NULL, write16_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \
curentry->set_handler(device, NULL, write16_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \
#define AM_WRITE32(_handler, _unitmask) \
curentry->set_handler(devconfig, NULL, write32_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \
curentry->set_handler(device, NULL, write32_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \
// driver data reads/writes
#define AM_READWRITE(_rhandler, _whandler) \
curentry->set_handler(devconfig, NULL, read_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0)); \
curentry->set_handler(device, NULL, read_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0)); \
#define AM_READWRITE8(_rhandler, _whandler, _unitmask) \
curentry->set_handler(devconfig, NULL, read8_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write8_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0), _unitmask); \
curentry->set_handler(device, NULL, read8_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write8_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0), _unitmask); \
#define AM_READWRITE16(_rhandler, _whandler, _unitmask) \
curentry->set_handler(devconfig, NULL, read16_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write16_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0), _unitmask); \
curentry->set_handler(device, NULL, read16_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write16_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0), _unitmask); \
#define AM_READWRITE32(_rhandler, _whandler, _unitmask) \
curentry->set_handler(devconfig, NULL, read32_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write32_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0), _unitmask); \
curentry->set_handler(device, NULL, read32_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write32_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0), _unitmask); \
// device reads
#define AM_DEVREAD(_tag, _class, _handler) \
curentry->set_handler(devconfig, _tag, read_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0)); \
curentry->set_handler(device, _tag, read_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0)); \
#define AM_DEVREAD8(_tag, _class, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, read8_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
curentry->set_handler(device, _tag, read8_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
#define AM_DEVREAD16(_tag, _class, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, read16_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
curentry->set_handler(device, _tag, read16_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
#define AM_DEVREAD32(_tag, _class, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, read32_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
curentry->set_handler(device, _tag, read32_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
// device writes
#define AM_DEVWRITE(_tag, _class, _handler) \
curentry->set_handler(devconfig, _tag, write_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0)); \
curentry->set_handler(device, _tag, write_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0)); \
#define AM_DEVWRITE8(_tag, _class, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, write8_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
curentry->set_handler(device, _tag, write8_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
#define AM_DEVWRITE16(_tag, _class, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, write16_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
curentry->set_handler(device, _tag, write16_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
#define AM_DEVWRITE32(_tag, _class, _handler, _unitmask) \
curentry->set_handler(devconfig, _tag, write32_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
curentry->set_handler(device, _tag, write32_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
// device reads/writes
#define AM_DEVREADWRITE(_tag, _class, _rhandler, _whandler) \
curentry->set_handler(devconfig, _tag, read_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0)); \
curentry->set_handler(device, _tag, read_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0)); \
#define AM_DEVREADWRITE8(_tag, _class, _rhandler, _whandler, _unitmask) \
curentry->set_handler(devconfig, _tag, read8_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write8_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \
curentry->set_handler(device, _tag, read8_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write8_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \
#define AM_DEVREADWRITE16(_tag, _class, _rhandler, _whandler, _unitmask) \
curentry->set_handler(devconfig, _tag, read16_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write16_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \
curentry->set_handler(device, _tag, read16_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write16_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \
#define AM_DEVREADWRITE32(_tag, _class, _rhandler, _whandler, _unitmask) \
curentry->set_handler(devconfig, _tag, read32_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write32_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \
curentry->set_handler(device, _tag, read32_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write32_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \
// special-case accesses
@ -1013,24 +1013,24 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
// port accesses
#define AM_READ_PORT(_tag) \
curentry->set_read_port(devconfig, _tag); \
curentry->set_read_port(device, _tag); \
#define AM_WRITE_PORT(_tag) \
curentry->set_write_port(devconfig, _tag); \
curentry->set_write_port(device, _tag); \
#define AM_READWRITE_PORT(_tag) \
curentry->set_readwrite_port(devconfig, _tag); \
curentry->set_readwrite_port(device, _tag); \
// bank accesses
#define AM_READ_BANK(_tag) \
curentry->set_read_bank(devconfig, _tag); \
curentry->set_read_bank(device, _tag); \
#define AM_WRITE_BANK(_tag) \
curentry->set_write_bank(devconfig, _tag); \
curentry->set_write_bank(device, _tag); \
#define AM_READWRITE_BANK(_tag) \
curentry->set_readwrite_bank(devconfig, _tag); \
curentry->set_readwrite_bank(device, _tag); \
// attributes for accesses

View File

@ -76,41 +76,46 @@ media_auditor::summary media_auditor::audit_media(const char *validation)
// temporary hack until romload is update: get the driver path and support it for
// all searches
const char *driverpath = m_enumerator.config().m_devicelist.find("root")->searchpath();
const char *driverpath = m_enumerator.config().devicelist().find("root")->searchpath();
// iterate over ROM sources and regions
int found = 0;
int required = 0;
int shared_found = 0;
int shared_required = 0;
int sharedFound = 0;
int sharedRequired = 0;
for (const rom_source *source = rom_first_source(m_enumerator.config()); source != NULL; source = rom_next_source(*source))
{
// determine the search path for this source and iterate through the regions
m_searchpath = source->searchpath();
// also determine if this is the driver's specific ROMs or not
bool source_is_gamedrv = (dynamic_cast<const driver_device_config_base *>(source) != NULL);
bool source_is_gamedrv = (dynamic_cast<const driver_device *>(source) != NULL);
// now iterate over regions and ROMs within
for (const rom_entry *region = rom_first_region(*source); region != NULL; region = rom_next_region(region))
{
// temporary hack: add the driver path & region name
astring combinedpath(source->searchpath(), ";", driverpath);
if (ROMREGION_ISLOADBYNAME(region))
combinedpath.cat(";").cat(ROMREGION_GETTAG(region));
astring combinedpath(m_searchpath, ";", driverpath);
if(ROMREGION_ISLOADBYNAME(region))
{
combinedpath=combinedpath.cat(";");
combinedpath=combinedpath.cat(ROMREGION_GETTAG(region));
}
m_searchpath = combinedpath;
for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom))
{
hash_collection hashes(ROM_GETHASHDATA(rom));
bool shared = (also_used_by_parent(hashes) != -1);
bool shared = also_used_by_parent(hashes) >= 0;
// if a dump exists, then at least one entry is required
if (!hashes.flag(hash_collection::FLAG_NO_DUMP))
{
required++;
if (shared)
shared_required++;
{
sharedRequired++;
}
}
// audit a file
@ -131,14 +136,16 @@ m_searchpath = combinedpath;
{
found++;
if (shared)
shared_found++;
{
sharedFound++;
}
}
}
}
}
// if we found nothing unique to this set & the set needs roms that aren't in the parent or the parent isn't found either, then we don't have the set at all
if (found == shared_found && required > 0 && (required != shared_required || shared_found == 0))
if (found == sharedFound && required > 0 && (required != sharedRequired || sharedFound == 0))
m_record_list.reset();
// return a summary
@ -157,10 +164,10 @@ media_auditor::summary media_auditor::audit_samples()
m_record_list.reset();
// iterate over sample entries
for (const device_config *devconfig = m_enumerator.config().first_device(); devconfig != NULL; devconfig = devconfig->next())
if (devconfig->type() == SAMPLES)
for (const device_t *device = m_enumerator.config().first_device(); device != NULL; device = device->next())
if (device->type() == SAMPLES)
{
const samples_interface *intf = reinterpret_cast<const samples_interface *>(devconfig->static_config());
const samples_interface *intf = reinterpret_cast<const samples_interface *>(device->static_config());
if (intf->samplenames != NULL)
{
// by default we just search using the driver name

View File

@ -1175,7 +1175,7 @@ void cheat_manager::reload()
// load the cheat file, MESS will load a crc32.xml ( eg. 01234567.xml )
// and MAME will load gamename.xml
device_image_interface *image = NULL;
for (bool gotone = machine().m_devicelist.first(image); gotone; gotone = image->next(image))
for (bool gotone = machine().devicelist().first(image); gotone; gotone = image->next(image))
if (image->exists())
{
// if we are loading through software lists, try to load shortname.xml

View File

@ -485,11 +485,11 @@ void cli_frontend::listsamples(const char *gamename)
while (drivlist.next())
{
// see if we have samples
const device_config *devconfig;
for (devconfig = drivlist.config().first_device(); devconfig != NULL; devconfig = devconfig->next())
if (devconfig->type() == SAMPLES)
const device_t *device;
for (device = drivlist.config().first_device(); device != NULL; device = device->next())
if (device->type() == SAMPLES)
break;
if (devconfig == NULL)
if (device == NULL)
continue;
// print a header
@ -499,11 +499,11 @@ void cli_frontend::listsamples(const char *gamename)
mame_printf_info("Samples required for driver \"%s\".\n", drivlist.driver().name);
// iterate over samples devices
for ( ; devconfig != NULL; devconfig = devconfig->next())
if (devconfig->type() == SAMPLES)
for ( ; device != NULL; device = device->next())
if (device->type() == SAMPLES)
{
// if the list is legit, walk it and print the sample info
const char *const *samplenames = reinterpret_cast<const samples_interface *>(devconfig->static_config())->samplenames;
const char *const *samplenames = reinterpret_cast<const samples_interface *>(device->static_config())->samplenames;
if (samplenames != NULL)
for (int sampnum = 0; samplenames[sampnum] != NULL; sampnum++)
if (samplenames[sampnum][0] != '*')
@ -536,11 +536,11 @@ void cli_frontend::listdevices(const char *gamename)
printf("Driver %s (%s):\n", drivlist.driver().name, drivlist.driver().description);
// iterate through devices
for (const device_config *devconfig = drivlist.config().first_device(); devconfig != NULL; devconfig = devconfig->next())
for (const device_t *device = drivlist.config().first_device(); device != NULL; device = device->next())
{
printf(" %s ('%s')", devconfig->name(), devconfig->tag());
printf(" %s ('%s')", device->name(), device->tag());
UINT32 clock = devconfig->clock();
UINT32 clock = device->clock();
if (clock >= 1000000000)
printf(" @ %d.%02d GHz\n", clock / 1000000000, (clock / 10000000) % 100);
else if (clock >= 1000000)
@ -576,9 +576,9 @@ void cli_frontend::listmedia(const char *gamename)
while (drivlist.next())
{
// iterate
const device_config_image_interface *imagedev = NULL;
const device_image_interface *imagedev = NULL;
bool first = true;
for (bool gotone = drivlist.config().m_devicelist.first(imagedev); gotone; gotone = imagedev->next(imagedev))
for (bool gotone = drivlist.config().devicelist().first(imagedev); gotone; gotone = imagedev->next(imagedev))
{
// extract the shortname with parentheses
astring paren_shortname;
@ -809,9 +809,9 @@ static void info_listsoftware(const char *gamename)
// first determine the maximum number of lists we might encounter
int list_count = 0;
while (drivlist.next())
for (const device_config *dev = drivlist.config().m_devicelist.first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext())
for (const device_t *dev = drivlist.config().devicelist().first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext())
{
software_list_config *swlist = (software_list_config *)downcast<const legacy_device_config_base *>(dev)->inline_config();
software_list_config *swlist = (software_list_config *)downcast<const legacy_device_base *>(dev)->inline_config();
for (int listnum = 0; listnum < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; listnum++)
if (swlist->list_name[listnum] && *swlist->list_name[listnum] && swlist->list_type == SOFTWARE_LIST_ORIGINAL_SYSTEM)
@ -898,9 +898,9 @@ static void info_listsoftware(const char *gamename)
drivlist.reset();
list_count = 0;
while (drivlist.next())
for (const device_config *dev = drivlist.config().m_devicelist.first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext())
for (const device_t *dev = drivlist.config().devicelist().first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext())
{
software_list_config *swlist = (software_list_config *)downcast<const legacy_device_config_base *>(dev)->inline_config();
software_list_config *swlist = (software_list_config *)downcast<const legacy_device_base *>(dev)->inline_config();
for (int listnum = 0; listnum < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; listnum++)
{
@ -1452,9 +1452,9 @@ int media_identifier::find_by_hash(const hash_collection &hashes, int length)
}
// next iterate over softlists
for (const device_config *dev = m_drivlist.config().m_devicelist.first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext())
for (const device_t *dev = m_drivlist.config().devicelist().first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext())
{
software_list_config *swlist = (software_list_config *)downcast<const legacy_device_config_base *>(dev)->inline_config();
software_list_config *swlist = (software_list_config *)downcast<const legacy_device_base *>(dev)->inline_config();
for (int listnum = 0; listnum < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; listnum++)
if (swlist->list_name[listnum] != NULL)

View File

@ -80,8 +80,8 @@ inline void adsp21xx_device::update_mstat()
m_alt = temp;
}
if ((m_mstat ^ m_mstat_prev) & MSTAT_TIMER)
if (m_config.m_timer_fired != NULL)
(*m_config.m_timer_fired)(*this, (m_mstat & MSTAT_TIMER) != 0);
if (m_timer_fired != NULL)
(*m_timer_fired)(*this, (m_mstat & MSTAT_TIMER) != 0);
if (m_mstat & MSTAT_STICKYV)
m_astat_clear = ~(CFLAG | NFLAG | ZFLAG);
else
@ -419,11 +419,11 @@ void adsp21xx_device::write_reg3(int regnum, INT32 val)
case 0x05: cntr_stack_push(); m_cntr = val & 0x3fff; break;
case 0x06: m_core.sb.s = (INT32)(val << 27) >> 27; break;
case 0x07: m_px = val; break;
case 0x09: if (m_config.m_sport_tx_callback != NULL) (*m_config.m_sport_tx_callback)(*this, 0, val); break;
case 0x0b: if (m_config.m_sport_tx_callback != NULL) (*m_config.m_sport_tx_callback)(*this, 1, val); break;
case 0x09: if (m_sport_tx_callback != NULL) (*m_sport_tx_callback)(*this, 0, val); break;
case 0x0b: if (m_sport_tx_callback != NULL) (*m_sport_tx_callback)(*this, 1, val); break;
case 0x0c:
m_ifc = val;
if (m_config.m_chip_type >= adsp21xx_device_config::CHIP_TYPE_ADSP2181)
if (m_chip_type >= CHIP_TYPE_ADSP2181)
{
/* clear timer */
if (val & 0x0002) m_irq_latch[ADSP2181_IRQ0] = 0;
@ -500,8 +500,8 @@ INT32 adsp21xx_device::read_reg3(int regnum)
case 0x05: return m_cntr;
case 0x06: return m_core.sb.s;
case 0x07: return m_px;
case 0x08: if (m_config.m_sport_rx_callback) return (*m_config.m_sport_rx_callback)(*this, 0); else return 0;
case 0x0a: if (m_config.m_sport_rx_callback) return (*m_config.m_sport_rx_callback)(*this, 1); else return 0;
case 0x08: if (m_sport_rx_callback) return (*m_sport_rx_callback)(*this, 0); else return 0;
case 0x0a: if (m_sport_rx_callback) return (*m_sport_rx_callback)(*this, 1); else return 0;
case 0x0f: return pc_stack_pop_val();
default: logerror("ADSP %04x: Reading from an invalid register!\n", m_ppc); return 0;
}

View File

@ -131,205 +131,13 @@
#include "adsp2100.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
const device_type ADSP2100 = adsp2100_device_config::static_alloc_device_config;
const device_type ADSP2101 = adsp2101_device_config::static_alloc_device_config;
const device_type ADSP2104 = adsp2104_device_config::static_alloc_device_config;
const device_type ADSP2105 = adsp2105_device_config::static_alloc_device_config;
const device_type ADSP2115 = adsp2115_device_config::static_alloc_device_config;
const device_type ADSP2181 = adsp2181_device_config::static_alloc_device_config;
//**************************************************************************
// TRIVIAL IMPLEMENTATIONS
//**************************************************************************
DEFINE_TRIVIAL_DERIVED_DEVICE(adsp2104_device_config, adsp2101_device_config, adsp2104_device, adsp2101_device, "ADSP-2104", CHIP_TYPE_ADSP2104)
DEFINE_TRIVIAL_DERIVED_DEVICE(adsp2105_device_config, adsp2101_device_config, adsp2105_device, adsp2101_device, "ADSP-2105", CHIP_TYPE_ADSP2105)
DEFINE_TRIVIAL_DERIVED_DEVICE(adsp2115_device_config, adsp2101_device_config, adsp2115_device, adsp2101_device, "ADSP-2115", CHIP_TYPE_ADSP2115)
//**************************************************************************
// ADSP21XX DEVICE CONFIG
//**************************************************************************
//-------------------------------------------------
// adsp21xx_device_config - constructor
//-------------------------------------------------
adsp21xx_device_config::adsp21xx_device_config(const machine_config &mconfig, device_type type, const char *name, const char *tag, const device_config *owner, UINT32 clock, UINT32 chiptype)
: cpu_device_config(mconfig, type, name, tag, owner, clock),
m_program_config("program", ENDIANNESS_LITTLE, 32, 14, -2),
m_data_config("data", ENDIANNESS_LITTLE, 16, 14, -1),
m_chip_type(chiptype)
{
m_sport_rx_callback = NULL;
m_sport_tx_callback = NULL;
m_timer_fired = NULL;
}
adsp2100_device_config::adsp2100_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
: adsp21xx_device_config(mconfig, static_alloc_device_config, "ADSP-2100", tag, owner, clock, CHIP_TYPE_ADSP2100) { }
adsp2101_device_config::adsp2101_device_config(const machine_config &mconfig, device_type type, const char *name, const char *tag, const device_config *owner, UINT32 clock, UINT32 chiptype)
: adsp21xx_device_config(mconfig, type, name, tag, owner, clock, chiptype) { }
adsp2181_device_config::adsp2181_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
: adsp21xx_device_config(mconfig, static_alloc_device_config, "ADSP-2181", tag, owner, clock, CHIP_TYPE_ADSP2181),
m_io_config("I/O", ENDIANNESS_LITTLE, 16, 11, -1) { }
//-------------------------------------------------
// static_alloc_device_config - allocate a new
// configuration object
//-------------------------------------------------
device_config *adsp2100_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
{
return global_alloc(adsp2100_device_config(mconfig, tag, owner, clock));
}
device_config *adsp2101_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
{
return global_alloc(adsp2101_device_config(mconfig, static_alloc_device_config, "ADSP-2101", tag, owner, clock, CHIP_TYPE_ADSP2101));
}
device_config *adsp2181_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
{
return global_alloc(adsp2181_device_config(mconfig, tag, owner, clock));
}
//-------------------------------------------------
// alloc_device - allocate a new device object
//-------------------------------------------------
device_t *adsp2100_device_config::alloc_device(running_machine &machine) const
{
return auto_alloc(machine, adsp2100_device(machine, *this));
}
device_t *adsp2101_device_config::alloc_device(running_machine &machine) const
{
return auto_alloc(machine, adsp2101_device(machine, *this));
}
device_t *adsp2181_device_config::alloc_device(running_machine &machine) const
{
return auto_alloc(machine, adsp2181_device(machine, *this));
}
//-------------------------------------------------
// static_set_config - set the configuration
// structure
//-------------------------------------------------
void adsp21xx_device_config::static_set_config(device_config *device, const adsp21xx_config &config)
{
adsp21xx_device_config *adsp = downcast<adsp21xx_device_config *>(device);
*static_cast<adsp21xx_config *>(adsp) = config;
}
//-------------------------------------------------
// execute_min_cycles - return minimum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 adsp21xx_device_config::execute_min_cycles() const
{
return 1;
}
//-------------------------------------------------
// execute_max_cycles - return maximum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 adsp21xx_device_config::execute_max_cycles() const
{
return 1;
}
//-------------------------------------------------
// execute_input_lines - return the number of
// input/interrupt lines
//-------------------------------------------------
UINT32 adsp2100_device_config::execute_input_lines() const
{
return 4;
}
UINT32 adsp2101_device_config::execute_input_lines() const
{
return 5;
}
UINT32 adsp2181_device_config::execute_input_lines() const
{
return 9;
}
//-------------------------------------------------
// memory_space_config - return the configuration
// of the specified address space, or NULL if
// the space doesn't exist
//-------------------------------------------------
const address_space_config *adsp2100_device_config::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_PROGRAM) ? &m_program_config :
(spacenum == AS_DATA) ? &m_data_config :
NULL;
}
const address_space_config *adsp2101_device_config::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_PROGRAM) ? &m_program_config :
(spacenum == AS_DATA) ? &m_data_config :
NULL;
}
const address_space_config *adsp2181_device_config::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_PROGRAM) ? &m_program_config :
(spacenum == AS_DATA) ? &m_data_config :
(spacenum == AS_IO) ? &m_io_config :
NULL;
}
//-------------------------------------------------
// disasm_min_opcode_bytes - return the length
// of the shortest instruction, in bytes
//-------------------------------------------------
UINT32 adsp21xx_device_config::disasm_min_opcode_bytes() const
{
return 4;
}
//-------------------------------------------------
// disasm_max_opcode_bytes - return the length
// of the longest instruction, in bytes
//-------------------------------------------------
UINT32 adsp21xx_device_config::disasm_max_opcode_bytes() const
{
return 4;
}
// device type definitions
const device_type ADSP2100 = &device_creator<adsp2100_device>;
const device_type ADSP2101 = &device_creator<adsp2101_device>;
const device_type ADSP2104 = &device_creator<adsp2104_device>;
const device_type ADSP2105 = &device_creator<adsp2105_device>;
const device_type ADSP2115 = &device_creator<adsp2115_device>;
const device_type ADSP2181 = &device_creator<adsp2181_device>;
//**************************************************************************
@ -340,9 +148,11 @@ UINT32 adsp21xx_device_config::disasm_max_opcode_bytes() const
// adsp21xx_device - constructor
//-------------------------------------------------
adsp21xx_device::adsp21xx_device(running_machine &_machine, const adsp21xx_device_config &config)
: cpu_device(_machine, config),
m_config(config),
adsp21xx_device::adsp21xx_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 chiptype)
: cpu_device(mconfig, type, name, tag, owner, clock),
m_program_config("program", ENDIANNESS_LITTLE, 32, 14, -2),
m_data_config("data", ENDIANNESS_LITTLE, 16, 14, -1),
m_chip_type(chiptype),
m_pc(0),
m_ppc(0),
m_loop(0),
@ -371,9 +181,9 @@ adsp21xx_device::adsp21xx_device(running_machine &_machine, const adsp21xx_devic
m_icntl(0),
m_ifc(0),
m_icount(0),
m_mstat_mask((config.m_chip_type >= adsp21xx_device_config::CHIP_TYPE_ADSP2101) ? 0x7f : 0x0f),
m_imask_mask((config.m_chip_type >= adsp21xx_device_config::CHIP_TYPE_ADSP2181) ? 0x3ff :
(config.m_chip_type >= adsp21xx_device_config::CHIP_TYPE_ADSP2101) ? 0x3f : 0x0f)
m_mstat_mask((m_chip_type >= CHIP_TYPE_ADSP2101) ? 0x7f : 0x0f),
m_imask_mask((m_chip_type >= CHIP_TYPE_ADSP2181) ? 0x3ff :
(m_chip_type >= CHIP_TYPE_ADSP2101) ? 0x3f : 0x0f)
{
// initialize remaining state
memset(&m_core, 0, sizeof(m_core));
@ -390,6 +200,10 @@ adsp21xx_device::adsp21xx_device(running_machine &_machine, const adsp21xx_devic
memset(&m_irq_state, 0, sizeof(m_irq_state));
memset(&m_irq_latch, 0, sizeof(m_irq_latch));
m_sport_rx_callback = NULL;
m_sport_tx_callback = NULL;
m_timer_fired = NULL;
// create the tables
create_tables();
@ -463,14 +277,27 @@ adsp21xx_device::adsp21xx_device(running_machine &_machine, const adsp21xx_devic
m_shift_xregs[7] = &m_core.sr.srx.sr1;
}
adsp2100_device::adsp2100_device(running_machine &_machine, const adsp2100_device_config &config)
: adsp21xx_device(_machine, config) { }
adsp2100_device::adsp2100_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: adsp21xx_device(mconfig, ADSP2100, "ADSP-2100", tag, owner, clock, CHIP_TYPE_ADSP2100) { }
adsp2101_device::adsp2101_device(running_machine &_machine, const adsp2101_device_config &config)
: adsp21xx_device(_machine, config) { }
adsp2101_device::adsp2101_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: adsp21xx_device(mconfig, ADSP2101, "ADSP-2101", tag, owner, clock, CHIP_TYPE_ADSP2101) { }
adsp2181_device::adsp2181_device(running_machine &_machine, const adsp2181_device_config &config)
: adsp21xx_device(_machine, config) { }
adsp2101_device::adsp2101_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 chiptype)
: adsp21xx_device(mconfig, type, name, tag, owner, clock, chiptype) { }
adsp2104_device::adsp2104_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: adsp2101_device(mconfig, ADSP2104, "ADSP-2104", tag, owner, clock, CHIP_TYPE_ADSP2104) { }
adsp2105_device::adsp2105_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: adsp2101_device(mconfig, ADSP2105, "ADSP-2105", tag, owner, clock, CHIP_TYPE_ADSP2105) { }
adsp2115_device::adsp2115_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: adsp2101_device(mconfig, ADSP2115, "ADSP-2115", tag, owner, clock, CHIP_TYPE_ADSP2115) { }
adsp2181_device::adsp2181_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: adsp21xx_device(mconfig, ADSP2181, "ADSP-2181", tag, owner, clock, CHIP_TYPE_ADSP2181),
m_io_config("I/O", ENDIANNESS_LITTLE, 16, 11, -1) { }
//-------------------------------------------------
@ -497,6 +324,18 @@ adsp21xx_device::~adsp21xx_device()
}
//-------------------------------------------------
// static_set_config - set the configuration
// structure
//-------------------------------------------------
void adsp21xx_device::static_set_config(device_t &device, const adsp21xx_config &config)
{
adsp21xx_device &adsp = downcast<adsp21xx_device &>(device);
static_cast<adsp21xx_config &>(adsp) = config;
}
//-------------------------------------------------
// load_boot_data - load the boot data from an
// 8-bit ROM
@ -757,7 +596,7 @@ void adsp21xx_device::device_start()
state_add(ADSP2100_CNTR, "CNTR", m_cntr).mask(0x3fff);
state_add(ADSP2100_ASTAT, "ASTAT", m_astat).mask(0xff);
state_add(ADSP2100_SSTAT, "SSTAT", m_sstat).mask(0xff);
state_add(ADSP2100_MSTAT, "MSTAT", m_mstat).mask((m_config.m_chip_type == adsp21xx_device_config::CHIP_TYPE_ADSP2100) ? 0x0f : 0x7f).callimport();
state_add(ADSP2100_MSTAT, "MSTAT", m_mstat).mask((m_chip_type == CHIP_TYPE_ADSP2100) ? 0x0f : 0x7f).callimport();
state_add(ADSP2100_PCSP, "PCSP", m_pc_sp).mask(0xff);
state_add(STATE_GENSP, "GENSP", m_pc_sp).mask(0xff).noshow();
@ -765,11 +604,11 @@ void adsp21xx_device::device_start()
state_add(ADSP2100_STATSP, "STATSP", m_stat_sp).mask(0xf);
state_add(ADSP2100_LOOPSP, "LOOPSP", m_loop_sp).mask(0xf);
state_add(ADSP2100_IMASK, "IMASK", m_imask).mask((m_config.m_chip_type == adsp21xx_device_config::CHIP_TYPE_ADSP2100) ? 0x00f : (m_config.m_chip_type == adsp21xx_device_config::CHIP_TYPE_ADSP2181) ? 0x3ff : 0x07f).callimport();
state_add(ADSP2100_IMASK, "IMASK", m_imask).mask((m_chip_type == CHIP_TYPE_ADSP2100) ? 0x00f : (m_chip_type == CHIP_TYPE_ADSP2181) ? 0x3ff : 0x07f).callimport();
state_add(ADSP2100_ICNTL, "ICNTL", m_icntl).mask(0x1f).callimport();
for (int irqnum = 0; irqnum < 4; irqnum++)
if (irqnum < 4 || m_config.m_chip_type == adsp21xx_device_config::CHIP_TYPE_ADSP2100)
if (irqnum < 4 || m_chip_type == CHIP_TYPE_ADSP2100)
state_add(ADSP2100_IRQSTATE0 + irqnum, tempstring.format("IRQ%d", irqnum), m_irq_state[irqnum]).mask(1).callimport();
state_add(ADSP2100_FLAGIN, "FLAGIN", m_flagin).mask(1);
@ -803,7 +642,7 @@ void adsp21xx_device::device_reset()
write_reg2(0x0b, m_l[7]); write_reg2(0x03, m_i[7]);
// reset PC and loops
m_pc = (m_config.m_chip_type >= adsp21xx_device_config::CHIP_TYPE_ADSP2101) ? 0 : 4;
m_pc = (m_chip_type >= CHIP_TYPE_ADSP2101) ? 0 : 4;
m_ppc = -1;
m_loop = 0xffff;
m_loop_condition = 0;
@ -835,6 +674,35 @@ void adsp21xx_device::device_reset()
}
//-------------------------------------------------
// memory_space_config - return the configuration
// of the specified address space, or NULL if
// the space doesn't exist
//-------------------------------------------------
const address_space_config *adsp2100_device::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_PROGRAM) ? &m_program_config :
(spacenum == AS_DATA) ? &m_data_config :
NULL;
}
const address_space_config *adsp2101_device::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_PROGRAM) ? &m_program_config :
(spacenum == AS_DATA) ? &m_data_config :
NULL;
}
const address_space_config *adsp2181_device::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_PROGRAM) ? &m_program_config :
(spacenum == AS_DATA) ? &m_data_config :
(spacenum == AS_IO) ? &m_io_config :
NULL;
}
//-------------------------------------------------
// state_import - import state into the device,
// after it has been set
@ -910,6 +778,28 @@ void adsp21xx_device::state_string_export(const device_state_entry &entry, astri
}
//-------------------------------------------------
// disasm_min_opcode_bytes - return the length
// of the shortest instruction, in bytes
//-------------------------------------------------
UINT32 adsp21xx_device::disasm_min_opcode_bytes() const
{
return 4;
}
//-------------------------------------------------
// disasm_max_opcode_bytes - return the length
// of the longest instruction, in bytes
//-------------------------------------------------
UINT32 adsp21xx_device::disasm_max_opcode_bytes() const
{
return 4;
}
//-------------------------------------------------
// disasm_disassemble - call the disassembly
// helper function
@ -1250,6 +1140,49 @@ void adsp21xx_device::create_tables()
CORE EXECUTION LOOP
***************************************************************************/
//-------------------------------------------------
// execute_min_cycles - return minimum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 adsp21xx_device::execute_min_cycles() const
{
return 1;
}
//-------------------------------------------------
// execute_max_cycles - return maximum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 adsp21xx_device::execute_max_cycles() const
{
return 1;
}
//-------------------------------------------------
// execute_input_lines - return the number of
// input/interrupt lines
//-------------------------------------------------
UINT32 adsp2100_device::execute_input_lines() const
{
return 4;
}
UINT32 adsp2101_device::execute_input_lines() const
{
return 5;
}
UINT32 adsp2181_device::execute_input_lines() const
{
return 9;
}
void adsp21xx_device::execute_set_input(int inputnum, int state)
{
// update the latched state
@ -1312,7 +1245,7 @@ void adsp21xx_device::execute_run()
// 00000001 0xxxxxxx xxxxxxxx dst = IO(x)
// 00000001 1xxxxxxx xxxxxxxx IO(x) = dst
// ADSP-218x only
if (m_config.m_chip_type >= adsp21xx_device_config::CHIP_TYPE_ADSP2181)
if (m_chip_type >= CHIP_TYPE_ADSP2181)
{
if ((op & 0x008000) == 0x000000)
write_reg0(op & 15, io_read((op >> 4) & 0x7ff));
@ -1335,7 +1268,7 @@ void adsp21xx_device::execute_run()
{
if (op & 0x020) m_flagout = 0;
if (op & 0x010) m_flagout ^= 1;
if (m_config.m_chip_type >= adsp21xx_device_config::CHIP_TYPE_ADSP2101)
if (m_chip_type >= CHIP_TYPE_ADSP2101)
{
if (op & 0x080) m_fl0 = 0;
if (op & 0x040) m_fl0 ^= 1;
@ -1453,7 +1386,7 @@ void adsp21xx_device::execute_run()
break;
case 0x0c:
// 00001100 xxxxxxxx xxxxxxxx mode control
if (m_config.m_chip_type >= adsp21xx_device_config::CHIP_TYPE_ADSP2101)
if (m_chip_type >= CHIP_TYPE_ADSP2101)
{
if (op & 0x000008) m_mstat = (m_mstat & ~MSTAT_GOMODE) | ((op << 5) & MSTAT_GOMODE);
if (op & 0x002000) m_mstat = (m_mstat & ~MSTAT_INTEGER) | ((op >> 8) & MSTAT_INTEGER);
@ -1567,7 +1500,7 @@ void adsp21xx_device::execute_run()
// 0010000x xxxxxxxx xxxxxxxx conditional MAC to MR
if (condition(op & 15))
{
if (m_config.m_chip_type >= adsp21xx_device_config::CHIP_TYPE_ADSP2181 && (op & 0x0018f0) == 0x000010)
if (m_chip_type >= CHIP_TYPE_ADSP2181 && (op & 0x0018f0) == 0x000010)
mac_op_mr_xop(op);
else
mac_op_mr(op);
@ -1577,7 +1510,7 @@ void adsp21xx_device::execute_run()
// 0010001x xxxxxxxx xxxxxxxx conditional ALU to AR
if (condition(op & 15))
{
if (m_config.m_chip_type >= adsp21xx_device_config::CHIP_TYPE_ADSP2181 && (op & 0x000010) == 0x000010)
if (m_chip_type >= CHIP_TYPE_ADSP2181 && (op & 0x000010) == 0x000010)
alu_op_ar_const(op);
else
alu_op_ar(op);
@ -1587,7 +1520,7 @@ void adsp21xx_device::execute_run()
// 0010010x xxxxxxxx xxxxxxxx conditional MAC to MF
if (condition(op & 15))
{
if (m_config.m_chip_type >= adsp21xx_device_config::CHIP_TYPE_ADSP2181 && (op & 0x0018f0) == 0x000010)
if (m_chip_type >= CHIP_TYPE_ADSP2181 && (op & 0x0018f0) == 0x000010)
mac_op_mf_xop(op);
else
mac_op_mf(op);
@ -1597,7 +1530,7 @@ void adsp21xx_device::execute_run()
// 0010011x xxxxxxxx xxxxxxxx conditional ALU to AF
if (condition(op & 15))
{
if (m_config.m_chip_type >= adsp21xx_device_config::CHIP_TYPE_ADSP2181 && (op & 0x000010) == 0x000010)
if (m_chip_type >= CHIP_TYPE_ADSP2181 && (op & 0x000010) == 0x000010)
alu_op_af_const(op);
else
alu_op_af(op);
@ -1611,7 +1544,7 @@ void adsp21xx_device::execute_run()
break;
case 0x2a: case 0x2b:
// 0010101x xxxxxxxx xxxxxxxx ALU to AR with internal data register move
if (m_config.m_chip_type >= adsp21xx_device_config::CHIP_TYPE_ADSP2181 && (op & 0x0000ff) == 0x0000aa)
if (m_chip_type >= CHIP_TYPE_ADSP2181 && (op & 0x0000ff) == 0x0000aa)
alu_op_none(op);
else
{

View File

@ -213,21 +213,7 @@ enum
//**************************************************************************
#define MCFG_ADSP21XX_CONFIG(_config) \
adsp21xx_device_config::static_set_config(device, _config); \
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
// device type definition
extern const device_type ADSP2100;
extern const device_type ADSP2101;
extern const device_type ADSP2104;
extern const device_type ADSP2105;
extern const device_type ADSP2115;
extern const device_type ADSP2181;
adsp21xx_device::static_set_config(*device, _config); \
@ -236,9 +222,6 @@ extern const device_type ADSP2181;
//**************************************************************************
class adsp21xx_device;
class adsp2100_device;
class adsp2101_device;
class adsp2181_device;
// transmit and receive data callbacks types
typedef INT32 (*adsp21xx_rx_func)(adsp21xx_device &device, int port);
@ -257,13 +240,11 @@ struct adsp21xx_config
// ======================> adsp21xx_device_config
// ======================> adsp21xx_device
class adsp21xx_device_config : public cpu_device_config,
public adsp21xx_config
class adsp21xx_device : public cpu_device,
public adsp21xx_config
{
friend class adsp21xx_device;
protected:
enum
{
@ -276,43 +257,13 @@ protected:
};
// construction/destruction
adsp21xx_device_config(const machine_config &mconfig, device_type type, const char *name, const char *tag, const device_config *owner, UINT32 clock, UINT32 chiptype);
public:
// inline configuration helpers
static void static_set_config(device_config *device, const adsp21xx_config &config);
protected:
// device_config_execute_interface overrides
virtual UINT32 execute_min_cycles() const;
virtual UINT32 execute_max_cycles() const;
// device_config_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const;
virtual UINT32 disasm_max_opcode_bytes() const;
// address spaces
const address_space_config m_program_config;
const address_space_config m_data_config;
// internal state
UINT32 m_chip_type;
};
// ======================> adsp21xx_device
class adsp21xx_device : public cpu_device
{
friend class adsp21xx_device_config;
protected:
// construction/destruction
adsp21xx_device(running_machine &_machine, const adsp21xx_device_config &config);
adsp21xx_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 chiptype);
virtual ~adsp21xx_device();
public:
// inline configuration helpers
static void static_set_config(device_t &device, const adsp21xx_config &config);
// public interfaces
void load_boot_data(UINT8 *srcdata, UINT32 *dstdata);
@ -322,6 +273,8 @@ protected:
virtual void device_reset();
// device_execute_interface overrides
virtual UINT32 execute_min_cycles() const;
virtual UINT32 execute_max_cycles() const;
virtual void execute_run();
virtual void execute_set_input(int inputnum, int state);
@ -330,6 +283,8 @@ protected:
virtual void state_string_export(const device_state_entry &entry, astring &string);
// device_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const;
virtual UINT32 disasm_max_opcode_bytes() const;
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
// helpers
@ -458,7 +413,9 @@ protected:
};
// configuration
const adsp21xx_device_config &m_config;
const address_space_config m_program_config;
const address_space_config m_data_config;
UINT32 m_chip_type;
// other CPU registers
UINT32 m_pc;
@ -559,37 +516,20 @@ protected:
};
// ======================> adsp2100_device_config
class adsp2100_device_config : public adsp21xx_device_config
{
friend class adsp2100_device;
// construction/destruction
adsp2100_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
public:
// allocators
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
virtual device_t *alloc_device(running_machine &machine) const;
protected:
// device_config_execute_interface overrides
virtual UINT32 execute_input_lines() const;
// device_config_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
};
// ======================> adsp2100_device
class adsp2100_device : public adsp21xx_device
{
friend class adsp2100_device_config;
public:
// construction/destruction
adsp2100_device(running_machine &_machine, const adsp2100_device_config &config);
adsp2100_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
protected:
// device_execute_interface overrides
virtual UINT32 execute_input_lines() const;
// device_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
// interrupts
virtual bool generate_irq(int which, int indx);
@ -597,42 +537,22 @@ class adsp2100_device : public adsp21xx_device
};
// ======================> adsp2101_device_config
class adsp2101_device_config : public adsp21xx_device_config
{
friend class adsp2101_device;
protected:
// construction/destruction
adsp2101_device_config(const machine_config &mconfig, device_type type, const char *name, const char *tag, const device_config *owner, UINT32 clock, UINT32 chiptype);
public:
// allocators
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
virtual device_t *alloc_device(running_machine &machine) const;
protected:
// device_config_execute_interface overrides
virtual UINT32 execute_input_lines() const;
// device_config_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
};
// ======================> adsp2101_device
class adsp2101_device : public adsp21xx_device
{
friend class adsp2101_device_config;
friend class adsp2104_device_config;
friend class adsp2105_device_config;
friend class adsp2115_device_config;
public:
// construction/destruction
adsp2101_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
protected:
// construction/destruction
adsp2101_device(running_machine &_machine, const adsp2101_device_config &config);
adsp2101_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 chiptype);
// device_execute_interface overrides
virtual UINT32 execute_input_lines() const;
// device_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
// interrupts
virtual bool generate_irq(int which, int indx);
@ -640,45 +560,28 @@ protected:
};
// ======================> adsp2181_device_config
class adsp2181_device_config : public adsp21xx_device_config
{
friend class adsp2181_device;
// construction/destruction
adsp2181_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
public:
// allocators
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
virtual device_t *alloc_device(running_machine &machine) const;
protected:
// device_config_execute_interface overrides
virtual UINT32 execute_input_lines() const;
// device_config_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
// address spaces
const address_space_config m_io_config;
};
// ======================> adsp2181_device
class adsp2181_device : public adsp21xx_device
{
friend class adsp2181_device_config;
public:
// construction/destruction
adsp2181_device(running_machine &_machine, const adsp2181_device_config &config);
adsp2181_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
protected:
// device_execute_interface overrides
virtual UINT32 execute_input_lines() const;
// device_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
// interrupts
virtual bool generate_irq(int which, int indx);
virtual void check_irqs();
// address spaces
const address_space_config m_io_config;
public:
// public interfaces
void idma_addr_w(UINT16 data);
@ -690,9 +593,33 @@ public:
// ======================> trivial variants
DECLARE_TRIVIAL_DERIVED_DEVICE(adsp2104_device_config, adsp2101_device_config, adsp2104_device, adsp2101_device)
DECLARE_TRIVIAL_DERIVED_DEVICE(adsp2105_device_config, adsp2101_device_config, adsp2105_device, adsp2101_device)
DECLARE_TRIVIAL_DERIVED_DEVICE(adsp2115_device_config, adsp2101_device_config, adsp2115_device, adsp2101_device)
class adsp2104_device : public adsp2101_device
{
public:
adsp2104_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
class adsp2105_device : public adsp2101_device
{
public:
adsp2105_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
class adsp2115_device : public adsp2101_device
{
public:
adsp2115_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
// device type definition
extern const device_type ADSP2100;
extern const device_type ADSP2101;
extern const device_type ADSP2104;
extern const device_type ADSP2105;
extern const device_type ADSP2115;
extern const device_type ADSP2181;
#endif /* __ADSP2100_H__ */

View File

@ -45,14 +45,6 @@
#include "asap.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
const device_type ASAP = asap_device_config::static_alloc_device_config;
//**************************************************************************
// CONSTANTS
//**************************************************************************
@ -162,120 +154,20 @@ const asap_device::ophandler asap_device::s_conditiontable[16] =
//**************************************************************************
// ASAP DEVICE CONFIG
//**************************************************************************
//-------------------------------------------------
// asap_device_config - constructor
//-------------------------------------------------
asap_device_config::asap_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
: cpu_device_config(mconfig, static_alloc_device_config, "ASAP", tag, owner, clock),
m_program_config("program", ENDIANNESS_LITTLE, 32, 32)
{
}
//-------------------------------------------------
// static_alloc_device_config - allocate a new
// configuration object
//-------------------------------------------------
device_config *asap_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
{
return global_alloc(asap_device_config(mconfig, tag, owner, clock));
}
//-------------------------------------------------
// alloc_device - allocate a new device object
//-------------------------------------------------
device_t *asap_device_config::alloc_device(running_machine &machine) const
{
return auto_alloc(machine, asap_device(machine, *this));
}
//-------------------------------------------------
// execute_min_cycles - return minimum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 asap_device_config::execute_min_cycles() const
{
return 1;
}
//-------------------------------------------------
// execute_max_cycles - return maximum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 asap_device_config::execute_max_cycles() const
{
return 2;
}
//-------------------------------------------------
// execute_input_lines - return the number of
// input/interrupt lines
//-------------------------------------------------
UINT32 asap_device_config::execute_input_lines() const
{
return 1;
}
//-------------------------------------------------
// memory_space_config - return the configuration
// of the specified address space, or NULL if
// the space doesn't exist
//-------------------------------------------------
const address_space_config *asap_device_config::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_PROGRAM) ? &m_program_config : NULL;
}
//-------------------------------------------------
// disasm_min_opcode_bytes - return the length
// of the shortest instruction, in bytes
//-------------------------------------------------
UINT32 asap_device_config::disasm_min_opcode_bytes() const
{
return 4;
}
//-------------------------------------------------
// disasm_max_opcode_bytes - return the length
// of the longest instruction, in bytes
//-------------------------------------------------
UINT32 asap_device_config::disasm_max_opcode_bytes() const
{
return 12;
}
//**************************************************************************
// DEVICE INTERFACE
//**************************************************************************
// device type definition
const device_type ASAP = &device_creator<asap_device>;
//-------------------------------------------------
// asap_device - constructor
//-------------------------------------------------
asap_device::asap_device(running_machine &_machine, const asap_device_config &config)
: cpu_device(_machine, config),
asap_device::asap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: cpu_device(mconfig, ASAP, "ASAP", tag, owner, clock),
m_program_config("program", ENDIANNESS_LITTLE, 32, 32),
m_pc(0),
m_pflag(0),
m_iflag(0),
@ -367,6 +259,18 @@ void asap_device::device_reset()
}
//-------------------------------------------------
// memory_space_config - return the configuration
// of the specified address space, or NULL if
// the space doesn't exist
//-------------------------------------------------
const address_space_config *asap_device::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_PROGRAM) ? &m_program_config : NULL;
}
//-------------------------------------------------
// state_import - import state into the device,
// after it has been set
@ -423,6 +327,28 @@ void asap_device::state_string_export(const device_state_entry &entry, astring &
}
//-------------------------------------------------
// disasm_min_opcode_bytes - return the length
// of the shortest instruction, in bytes
//-------------------------------------------------
UINT32 asap_device::disasm_min_opcode_bytes() const
{
return 4;
}
//-------------------------------------------------
// disasm_max_opcode_bytes - return the length
// of the longest instruction, in bytes
//-------------------------------------------------
UINT32 asap_device::disasm_max_opcode_bytes() const
{
return 12;
}
//-------------------------------------------------
// disasm_disassemble - call the disassembly
// helper function
@ -623,6 +549,39 @@ inline void asap_device::execute_instruction()
}
//-------------------------------------------------
// execute_min_cycles - return minimum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 asap_device::execute_min_cycles() const
{
return 1;
}
//-------------------------------------------------
// execute_max_cycles - return maximum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 asap_device::execute_max_cycles() const
{
return 2;
}
//-------------------------------------------------
// execute_input_lines - return the number of
// input/interrupt lines
//-------------------------------------------------
UINT32 asap_device::execute_input_lines() const
{
return 1;
}
void asap_device::execute_set_input(int inputnum, int state)
{
m_irq_state = (state != CLEAR_LINE);

View File

@ -49,49 +49,14 @@
//**************************************************************************
// ======================> asap_device_config
class asap_device_config : public cpu_device_config
{
friend class asap_device;
// construction/destruction
asap_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
public:
// allocators
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
virtual device_t *alloc_device(running_machine &machine) const;
protected:
// device_config_execute_interface overrides
virtual UINT32 execute_min_cycles() const;
virtual UINT32 execute_max_cycles() const;
virtual UINT32 execute_input_lines() const;
// device_config_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
// device_config_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const;
virtual UINT32 disasm_max_opcode_bytes() const;
// inline data
const address_space_config m_program_config;
};
// ======================> asap_device
class asap_device : public cpu_device
{
friend class asap_device_config;
// construction/destruction
asap_device(running_machine &_machine, const asap_device_config &config);
public:
// construction/destruction
asap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// public interfaces
protected:
@ -100,15 +65,23 @@ protected:
virtual void device_reset();
// device_execute_interface overrides
virtual UINT32 execute_min_cycles() const;
virtual UINT32 execute_max_cycles() const;
virtual UINT32 execute_input_lines() const;
virtual void execute_run();
virtual void execute_set_input(int inputnum, int state);
// device_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
// device_state_interface overrides
virtual void state_import(const device_state_entry &entry);
virtual void state_export(const device_state_entry &entry);
virtual void state_string_export(const device_state_entry &entry, astring &string);
// device_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const;
virtual UINT32 disasm_max_opcode_bytes() const;
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
// helpers
@ -240,6 +213,7 @@ protected:
void trapf();
// internal state
const address_space_config m_program_config;
UINT32 m_pc;
// expanded flags

View File

@ -124,7 +124,7 @@ void ccpu_wdt_timer_trigger(device_t *device)
static CPU_INIT( ccpu )
{
const ccpu_config *configdata = (const ccpu_config *)device->baseconfig().static_config();
const ccpu_config *configdata = (const ccpu_config *)device->static_config();
ccpu_state *cpustate = get_safe_token(device);
/* copy input params */

View File

@ -869,7 +869,7 @@ static void cop400_init(legacy_cpu_device *device, UINT8 g_mask, UINT8 d_mask, U
{
cop400_state *cpustate = get_safe_token(device);
cpustate->intf = (cop400_interface *) device->baseconfig().static_config();
cpustate->intf = (cop400_interface *) device->static_config();
/* find address spaces */
@ -1380,7 +1380,7 @@ static CPU_SET_INFO( cop400 )
static CPU_GET_INFO( cop400 )
{
cop400_state *cpustate = (device != NULL && device->token() != NULL) ? get_safe_token(device) : NULL;
cop400_interface *intf = (devconfig->static_config() != NULL) ? (cop400_interface *)devconfig->static_config() : NULL;
cop400_interface *intf = (device->static_config() != NULL) ? (cop400_interface *)device->static_config() : NULL;
switch (state)
{

View File

@ -27,14 +27,6 @@ ALLOW_SAVE_TYPE(cosmac_device::cosmac_mode);
ALLOW_SAVE_TYPE(cosmac_device::cosmac_state);
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
const device_type COSMAC = cosmac_device_config::static_alloc_device_config;
//**************************************************************************
// CONSTANTS
//**************************************************************************
@ -182,116 +174,33 @@ const cosmac_device::ophandler cosmac_device::s_opcodetable[256] =
//**************************************************************************
// COSMAC DEVICE CONFIG
// DEVICE INTERFACE
//**************************************************************************
// device type definition
const device_type COSMAC = &device_creator<cosmac_device>;
//-------------------------------------------------
// cosmac_device_config - constructor
// cosmac_device - constructor
//-------------------------------------------------
cosmac_device_config::cosmac_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
: cpu_device_config(mconfig, static_alloc_device_config, "COSMAC", tag, owner, clock),
cosmac_device::cosmac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: cpu_device(mconfig, COSMAC, "COSMAC", tag, owner, clock),
m_program_config("program", ENDIANNESS_LITTLE, 8, 16),
m_io_config("io", ENDIANNESS_LITTLE, 8, 3)
m_io_config("io", ENDIANNESS_LITTLE, 8, 3),
m_op(0),
m_state(COSMAC_STATE_1_RESET),
m_mode(COSMAC_MODE_RESET),
m_irq(0),
m_dmain(0),
m_dmaout(0),
m_program(NULL),
m_io(NULL),
m_direct(NULL)
{
}
//-------------------------------------------------
// static_alloc_device_config - allocate a new
// configuration object
//-------------------------------------------------
device_config *cosmac_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
{
return global_alloc(cosmac_device_config(mconfig, tag, owner, clock));
}
//-------------------------------------------------
// alloc_device - allocate a new device object
//-------------------------------------------------
device_t *cosmac_device_config::alloc_device(running_machine &machine) const
{
return auto_alloc(machine, cosmac_device(machine, *this));
}
//-------------------------------------------------
// execute_min_cycles - return minimum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 cosmac_device_config::execute_min_cycles() const
{
return 8 * 2;
}
//-------------------------------------------------
// execute_max_cycles - return maximum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 cosmac_device_config::execute_max_cycles() const
{
return 8 * 3;
}
//-------------------------------------------------
// execute_input_lines - return the number of
// input/interrupt lines
//-------------------------------------------------
UINT32 cosmac_device_config::execute_input_lines() const
{
return 7;
}
//-------------------------------------------------
// memory_space_config - return the configuration
// of the specified address space, or NULL if
// the space doesn't exist
//-------------------------------------------------
const address_space_config *cosmac_device_config::memory_space_config(address_spacenum spacenum) const
{
switch (spacenum)
{
case AS_PROGRAM:
return &m_program_config;
case AS_IO:
return &m_io_config;
default:
return NULL;
}
}
//-------------------------------------------------
// disasm_min_opcode_bytes - return the length
// of the shortest instruction, in bytes
//-------------------------------------------------
UINT32 cosmac_device_config::disasm_min_opcode_bytes() const
{
return 1;
}
//-------------------------------------------------
// disasm_max_opcode_bytes - return the length
// of the longest instruction, in bytes
//-------------------------------------------------
UINT32 cosmac_device_config::disasm_max_opcode_bytes() const
{
return 3;
for (int i = 0; i < 4; i++)
EF[i] = 0;
}
@ -301,7 +210,7 @@ UINT32 cosmac_device_config::disasm_max_opcode_bytes() const
// complete
//-------------------------------------------------
void cosmac_device_config::device_config_complete()
void cosmac_device::device_config_complete()
{
// inherit a copy of the static data
const cosmac_interface *intf = reinterpret_cast<const cosmac_interface *>(static_config());
@ -324,33 +233,6 @@ void cosmac_device_config::device_config_complete()
}
//**************************************************************************
// DEVICE INTERFACE
//**************************************************************************
//-------------------------------------------------
// cosmac_device - constructor
//-------------------------------------------------
cosmac_device::cosmac_device(running_machine &_machine, const cosmac_device_config &config)
: cpu_device(_machine, config),
m_op(0),
m_state(COSMAC_STATE_1_RESET),
m_mode(COSMAC_MODE_RESET),
m_irq(0),
m_dmain(0),
m_dmaout(0),
m_program(NULL),
m_io(NULL),
m_direct(NULL),
m_config(config)
{
for (int i = 0; i < 4; i++)
EF[i] = 0;
}
//-------------------------------------------------
// device_start - start up the device
//-------------------------------------------------
@ -384,18 +266,18 @@ void cosmac_device::device_start()
state_add(COSMAC_Q, "Q", m_q).mask(0x1).noshow();
// resolve callbacks
devcb_resolve_read_line(&m_in_wait_func, &m_config.m_in_wait_func, this);
devcb_resolve_read_line(&m_in_clear_func, &m_config.m_in_clear_func, this);
devcb_resolve_read_line(&m_in_ef_func[0], &m_config.m_in_ef1_func, this);
devcb_resolve_read_line(&m_in_ef_func[1], &m_config.m_in_ef2_func, this);
devcb_resolve_read_line(&m_in_ef_func[2], &m_config.m_in_ef3_func, this);
devcb_resolve_read_line(&m_in_ef_func[3], &m_config.m_in_ef4_func, this);
devcb_resolve_write_line(&m_out_q_func, &m_config.m_out_q_func, this);
devcb_resolve_read8(&m_in_dma_func, &m_config.m_in_dma_func, this);
devcb_resolve_write8(&m_out_dma_func, &m_config.m_out_dma_func, this);
m_out_sc_func = m_config.m_out_sc_func;
devcb_resolve_write_line(&m_out_tpa_func, &m_config.m_out_tpa_func, this);
devcb_resolve_write_line(&m_out_tpb_func, &m_config.m_out_tpb_func, this);
devcb_resolve_read_line(&m_in_wait_func, &m_in_wait_cb, this);
devcb_resolve_read_line(&m_in_clear_func, &m_in_clear_cb, this);
devcb_resolve_read_line(&m_in_ef_func[0], &m_in_ef1_cb, this);
devcb_resolve_read_line(&m_in_ef_func[1], &m_in_ef2_cb, this);
devcb_resolve_read_line(&m_in_ef_func[2], &m_in_ef3_cb, this);
devcb_resolve_read_line(&m_in_ef_func[3], &m_in_ef4_cb, this);
devcb_resolve_write_line(&m_out_q_func, &m_out_q_cb, this);
devcb_resolve_read8(&m_in_dma_func, &m_in_dma_cb, this);
devcb_resolve_write8(&m_out_dma_func, &m_out_dma_cb, this);
m_out_sc_func = m_out_sc_cb;
devcb_resolve_write_line(&m_out_tpa_func, &m_out_tpa_cb, this);
devcb_resolve_write_line(&m_out_tpb_func, &m_out_tpb_cb, this);
// register our state for saving
save_item(NAME(m_op));
@ -434,6 +316,28 @@ void cosmac_device::device_reset()
}
//-------------------------------------------------
// memory_space_config - return the configuration
// of the specified address space, or NULL if
// the space doesn't exist
//-------------------------------------------------
const address_space_config *cosmac_device::memory_space_config(address_spacenum spacenum) const
{
switch (spacenum)
{
case AS_PROGRAM:
return &m_program_config;
case AS_IO:
return &m_io_config;
default:
return NULL;
}
}
//-------------------------------------------------
// state_import - import state into the device,
// after it has been set
@ -485,6 +389,28 @@ void cosmac_device::state_string_export(const device_state_entry &entry, astring
}
//-------------------------------------------------
// disasm_min_opcode_bytes - return the length
// of the shortest instruction, in bytes
//-------------------------------------------------
UINT32 cosmac_device::disasm_min_opcode_bytes() const
{
return 1;
}
//-------------------------------------------------
// disasm_max_opcode_bytes - return the length
// of the longest instruction, in bytes
//-------------------------------------------------
UINT32 cosmac_device::disasm_max_opcode_bytes() const
{
return 3;
}
//-------------------------------------------------
// disasm_disassemble - call the disassembly
// helper function
@ -569,6 +495,39 @@ offs_t cosmac_device::get_memory_address()
return R[X];
}
//-------------------------------------------------
// execute_min_cycles - return minimum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 cosmac_device::execute_min_cycles() const
{
return 8 * 2;
}
//-------------------------------------------------
// execute_max_cycles - return maximum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 cosmac_device::execute_max_cycles() const
{
return 8 * 3;
}
//-------------------------------------------------
// execute_input_lines - return the number of
// input/interrupt lines
//-------------------------------------------------
UINT32 cosmac_device::execute_input_lines() const
{
return 7;
}
//-------------------------------------------------
// execute_set_input -
//-------------------------------------------------

View File

@ -105,9 +105,6 @@ enum cosmac_state_code
};
// device type definition
extern const device_type COSMAC;
//**************************************************************************
@ -122,90 +119,60 @@ typedef void (*cosmac_out_sc_func)(device_t *device, cosmac_state_code sc);
struct cosmac_interface
{
devcb_read_line m_in_wait_func;
devcb_read_line m_in_clear_func;
devcb_read_line m_in_ef1_func;
devcb_read_line m_in_ef2_func;
devcb_read_line m_in_ef3_func;
devcb_read_line m_in_ef4_func;
devcb_write_line m_out_q_func;
devcb_read8 m_in_dma_func;
devcb_write8 m_out_dma_func;
cosmac_out_sc_func m_out_sc_func;
devcb_write_line m_out_tpa_func;
devcb_write_line m_out_tpb_func;
devcb_read_line m_in_wait_cb;
devcb_read_line m_in_clear_cb;
devcb_read_line m_in_ef1_cb;
devcb_read_line m_in_ef2_cb;
devcb_read_line m_in_ef3_cb;
devcb_read_line m_in_ef4_cb;
devcb_write_line m_out_q_cb;
devcb_read8 m_in_dma_cb;
devcb_write8 m_out_dma_cb;
cosmac_out_sc_func m_out_sc_cb;
devcb_write_line m_out_tpa_cb;
devcb_write_line m_out_tpb_cb;
};
#define COSMAC_INTERFACE(name) \
const cosmac_interface (name) =
// ======================> cosmac_device_config
class cosmac_device_config : public cpu_device_config,
public cosmac_interface
{
friend class cosmac_device;
// construction/destruction
cosmac_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
public:
// allocators
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
virtual device_t *alloc_device(running_machine &machine) const;
protected:
// device_config overrides
virtual void device_config_complete();
// device_config_execute_interface overrides
virtual UINT32 execute_min_cycles() const;
virtual UINT32 execute_max_cycles() const;
virtual UINT32 execute_input_lines() const;
// device_config_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
// device_config_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const;
virtual UINT32 disasm_max_opcode_bytes() const;
// inline data
const address_space_config m_program_config;
const address_space_config m_io_config;
};
// ======================> cosmac_device
class cosmac_device : public cpu_device
class cosmac_device : public cpu_device,
public cosmac_interface
{
friend class cosmac_device_config;
// construction/destruction
cosmac_device(running_machine &_machine, const cosmac_device_config &config);
public:
// construction/destruction
cosmac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// public interfaces
offs_t get_memory_address();
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
// device_execute_interface overrides
virtual UINT32 execute_min_cycles() const;
virtual UINT32 execute_max_cycles() const;
virtual UINT32 execute_input_lines() const;
virtual void execute_run();
virtual void execute_set_input(int inputnum, int state);
// device_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
// device_state_interface overrides
virtual void state_import(const device_state_entry &entry);
virtual void state_export(const device_state_entry &entry);
virtual void state_string_export(const device_state_entry &entry, astring &string);
// device_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const;
virtual UINT32 disasm_max_opcode_bytes() const;
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
// helpers
@ -336,6 +303,9 @@ protected:
void out();
void inp();
const address_space_config m_program_config;
const address_space_config m_io_config;
// device callbacks
devcb_resolved_read_line m_in_wait_func;
devcb_resolved_read_line m_in_clear_func;
@ -404,9 +374,11 @@ protected:
typedef void (cosmac_device::*ophandler)();
static const ophandler s_opcodetable[256];
const cosmac_device_config &m_config;
};
// device type definition
extern const device_type COSMAC;
#endif /* __COSMAC_H__ */

View File

@ -281,7 +281,7 @@ static void cquestsnd_state_register(device_t *device)
static CPU_INIT( cquestsnd )
{
cquestsnd_state *cpustate = get_safe_token_snd(device);
cubeqst_snd_config* _config = (cubeqst_snd_config*)device->baseconfig().static_config();
cubeqst_snd_config* _config = (cubeqst_snd_config*)device->static_config();
memset(cpustate, 0, sizeof(*cpustate));
@ -354,7 +354,7 @@ static void cquestrot_state_register(device_t *device)
static CPU_INIT( cquestrot )
{
const cubeqst_rot_config *rotconfig = (const cubeqst_rot_config *)device->baseconfig().static_config();
const cubeqst_rot_config *rotconfig = (const cubeqst_rot_config *)device->static_config();
cquestrot_state *cpustate = get_safe_token_rot(device);
memset(cpustate, 0, sizeof(*cpustate));
@ -438,7 +438,7 @@ static void cquestlin_state_register(device_t *device)
static CPU_INIT( cquestlin )
{
const cubeqst_lin_config *linconfig = (const cubeqst_lin_config *)device->baseconfig().static_config();
const cubeqst_lin_config *linconfig = (const cubeqst_lin_config *)device->static_config();
cquestlin_state *cpustate = get_safe_token_lin(device);
memset(cpustate, 0, sizeof(*cpustate));

View File

@ -10,123 +10,22 @@
#include "debugger.h"
#include "dsp16.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
const device_type DSP16 = dsp16_device_config::static_alloc_device_config;
//**************************************************************************
// DSP16 DEVICE CONFIG
//**************************************************************************
dsp16_device_config::dsp16_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
: cpu_device_config(mconfig, static_alloc_device_config, "DSP16", tag, owner, clock),
m_program_config("program", ENDIANNESS_LITTLE, 16, 16, -1)
{ }
//-------------------------------------------------
// static_alloc_device_config - allocate a new
// configuration object
//-------------------------------------------------
device_config *dsp16_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
{
return global_alloc(dsp16_device_config(mconfig, tag, owner, clock));
}
//-------------------------------------------------
// alloc_device - allocate a new device object
//-------------------------------------------------
device_t *dsp16_device_config::alloc_device(running_machine &machine) const
{
return auto_alloc(machine, dsp16_device(machine, *this));
}
//-------------------------------------------------
// execute_min_cycles - return minimum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 dsp16_device_config::execute_min_cycles() const
{
return 1;
}
//-------------------------------------------------
// execute_max_cycles - return maximum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 dsp16_device_config::execute_max_cycles() const
{
return 1;
}
//-------------------------------------------------
// execute_input_lines - return the number of
// input/interrupt lines
//-------------------------------------------------
UINT32 dsp16_device_config::execute_input_lines() const
{
return 1; // TODO
}
//-------------------------------------------------
// memory_space_config - return the configuration
// of the specified address space, or NULL if
// the space doesn't exist
//-------------------------------------------------
const address_space_config *dsp16_device_config::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_PROGRAM) ? &m_program_config : NULL;
}
//-------------------------------------------------
// disasm_min_opcode_bytes - return the length
// of the shortest instruction, in bytes
//-------------------------------------------------
UINT32 dsp16_device_config::disasm_min_opcode_bytes() const
{
return 2;
}
//-------------------------------------------------
// disasm_max_opcode_bytes - return the length
// of the longest instruction, in bytes
//-------------------------------------------------
UINT32 dsp16_device_config::disasm_max_opcode_bytes() const
{
return 4;
}
//**************************************************************************
// DEVICE INTERFACE
//**************************************************************************
// device type definition
const device_type DSP16 = &device_creator<dsp16_device>;
//-------------------------------------------------
// dsp16_device - constructor
//-------------------------------------------------
dsp16_device::dsp16_device(running_machine &_machine, const dsp16_device_config &config)
: cpu_device(_machine, config),
dsp16_device::dsp16_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: cpu_device(mconfig, DSP16, "DSP16", tag, owner, clock),
m_program_config("program", ENDIANNESS_LITTLE, 16, 16, -1),
m_pc(0),
m_ppc(0),
m_icount(0)
@ -166,6 +65,18 @@ void dsp16_device::device_reset()
}
//-------------------------------------------------
// memory_space_config - return the configuration
// of the specified address space, or NULL if
// the space doesn't exist
//-------------------------------------------------
const address_space_config *dsp16_device::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_PROGRAM) ? &m_program_config : NULL;
}
//-------------------------------------------------
// state_import - import state into the device,
// after it has been set
@ -188,6 +99,28 @@ void dsp16_device::state_string_export(const device_state_entry &entry, astring
}
//-------------------------------------------------
// disasm_min_opcode_bytes - return the length
// of the shortest instruction, in bytes
//-------------------------------------------------
UINT32 dsp16_device::disasm_min_opcode_bytes() const
{
return 2;
}
//-------------------------------------------------
// disasm_max_opcode_bytes - return the length
// of the longest instruction, in bytes
//-------------------------------------------------
UINT32 dsp16_device::disasm_max_opcode_bytes() const
{
return 4;
}
//-------------------------------------------------
// disasm_disassemble - call the disassembly
// helper function
@ -225,6 +158,39 @@ inline UINT32 dsp16_device::opcode_read()
CORE EXECUTION LOOP
***************************************************************************/
//-------------------------------------------------
// execute_min_cycles - return minimum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 dsp16_device::execute_min_cycles() const
{
return 1;
}
//-------------------------------------------------
// execute_max_cycles - return maximum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 dsp16_device::execute_max_cycles() const
{
return 1;
}
//-------------------------------------------------
// execute_input_lines - return the number of
// input/interrupt lines
//-------------------------------------------------
UINT32 dsp16_device::execute_input_lines() const
{
return 1; // TODO
}
void dsp16_device::execute_set_input(int inputnum, int state)
{
}

View File

@ -17,16 +17,7 @@
//**************************************************************************
//#define MCFG_DSP16_CONFIG(_config)
// dsp16_device_config::static_set_config(device, _config);
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
// device type definition
extern const device_type DSP16;
// dsp16_device::static_set_config(*device, _config);
@ -34,52 +25,14 @@ extern const device_type DSP16;
// TYPE DEFINITIONS
//**************************************************************************
class dsp16_device;
// ======================> dsp16_device_config
class dsp16_device_config : public cpu_device_config
{
friend class dsp16_device;
// construction/destruction
dsp16_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
public:
// allocators
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
virtual device_t *alloc_device(running_machine &machine) const;
protected:
// device_config_execute_interface overrides
virtual UINT32 execute_min_cycles() const;
virtual UINT32 execute_max_cycles() const;
virtual UINT32 execute_input_lines() const;
// device_config_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
// device_config_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const;
virtual UINT32 disasm_max_opcode_bytes() const;
// address spaces
const address_space_config m_program_config;
};
// ======================> dsp16_device
class dsp16_device : public cpu_device
{
friend class dsp16_device_config;
// construction/destruction
dsp16_device(running_machine &_machine, const dsp16_device_config &config);
public:
// construction/destruction
dsp16_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// public interfaces
protected:
@ -88,18 +41,27 @@ protected:
virtual void device_reset();
// device_execute_interface overrides
virtual UINT32 execute_min_cycles() const;
virtual UINT32 execute_max_cycles() const;
virtual UINT32 execute_input_lines() const;
virtual void execute_run();
virtual void execute_set_input(int inputnum, int state);
// device_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
// device_state_interface overrides
virtual void state_import(const device_state_entry &entry);
virtual void state_export(const device_state_entry &entry);
virtual void state_string_export(const device_state_entry &entry, astring &string);
// device_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const;
virtual UINT32 disasm_max_opcode_bytes() const;
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
// address spaces
const address_space_config m_program_config;
// CPU registers
UINT16 m_pc;
@ -121,6 +83,10 @@ protected:
};
// device type definition
extern const device_type DSP16;
/***************************************************************************
REGISTER ENUMERATION
***************************************************************************/

View File

@ -70,14 +70,6 @@
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
const device_type DSP32C = dsp32c_device_config::static_alloc_device_config;
//**************************************************************************
// CONSTANTS
//**************************************************************************
@ -169,134 +161,19 @@ const device_type DSP32C = dsp32c_device_config::static_alloc_device_config;
//**************************************************************************
// DSP32C DEVICE CONFIG
//**************************************************************************
//-------------------------------------------------
// dsp32c_device_config - constructor
//-------------------------------------------------
dsp32c_device_config::dsp32c_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
: cpu_device_config(mconfig, static_alloc_device_config, "DSP32C", tag, owner, clock),
m_program_config("program", ENDIANNESS_LITTLE, 32, 24)
{
m_output_pins_changed = NULL;
}
//-------------------------------------------------
// static_alloc_device_config - allocate a new
// configuration object
//-------------------------------------------------
device_config *dsp32c_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
{
return global_alloc(dsp32c_device_config(mconfig, tag, owner, clock));
}
//-------------------------------------------------
// alloc_device - allocate a new device object
//-------------------------------------------------
device_t *dsp32c_device_config::alloc_device(running_machine &machine) const
{
return auto_alloc(machine, dsp32c_device(machine, *this));
}
//-------------------------------------------------
// static_set_config - set the configuration
// structure
//-------------------------------------------------
void dsp32c_device_config::static_set_config(device_config *device, const dsp32_config &config)
{
dsp32c_device_config *dsp = downcast<dsp32c_device_config *>(device);
*static_cast<dsp32_config *>(dsp) = config;
}
//-------------------------------------------------
// execute_min_cycles - return minimum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 dsp32c_device_config::execute_min_cycles() const
{
return 4;
}
//-------------------------------------------------
// execute_max_cycles - return maximum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 dsp32c_device_config::execute_max_cycles() const
{
return 4;
}
//-------------------------------------------------
// execute_input_lines - return the number of
// input/interrupt lines
//-------------------------------------------------
UINT32 dsp32c_device_config::execute_input_lines() const
{
return 2;
}
//-------------------------------------------------
// memory_space_config - return the configuration
// of the specified address space, or NULL if
// the space doesn't exist
//-------------------------------------------------
const address_space_config *dsp32c_device_config::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_PROGRAM) ? &m_program_config : NULL;
}
//-------------------------------------------------
// disasm_min_opcode_bytes - return the length
// of the shortest instruction, in bytes
//-------------------------------------------------
UINT32 dsp32c_device_config::disasm_min_opcode_bytes() const
{
return 4;
}
//-------------------------------------------------
// disasm_max_opcode_bytes - return the length
// of the longest instruction, in bytes
//-------------------------------------------------
UINT32 dsp32c_device_config::disasm_max_opcode_bytes() const
{
return 4;
}
//**************************************************************************
// DEVICE INTERFACE
//**************************************************************************
const device_type DSP32C = &device_creator<dsp32c_device>;
//-------------------------------------------------
// dsp32c_device - constructor
//-------------------------------------------------
dsp32c_device::dsp32c_device(running_machine &_machine, const dsp32c_device_config &config)
: cpu_device(_machine, config),
m_config(config),
dsp32c_device::dsp32c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: cpu_device(mconfig, DSP32C, "DSP32C", tag, owner, clock),
m_program_config("program", ENDIANNESS_LITTLE, 32, 24),
m_pin(0),
m_pout(0),
m_ivtp(0),
@ -328,11 +205,25 @@ dsp32c_device::dsp32c_device(running_machine &_machine, const dsp32c_device_conf
m_program(NULL),
m_direct(NULL)
{
m_output_pins_changed = NULL;
// set our instruction counter
m_icountptr = &m_icount;
}
//-------------------------------------------------
// static_set_config - set the configuration
// structure
//-------------------------------------------------
void dsp32c_device::static_set_config(device_t &device, const dsp32_config &config)
{
dsp32c_device &dsp = downcast<dsp32c_device &>(device);
static_cast<dsp32_config &>(dsp) = config;
}
//-------------------------------------------------
// device_start - start up the device
//-------------------------------------------------
@ -447,6 +338,18 @@ void dsp32c_device::device_reset()
}
//-------------------------------------------------
// memory_space_config - return the configuration
// of the specified address space, or NULL if
// the space doesn't exist
//-------------------------------------------------
const address_space_config *dsp32c_device::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_PROGRAM) ? &m_program_config : NULL;
}
//-------------------------------------------------
// state_import - import state into the device,
// after it has been set
@ -532,6 +435,28 @@ void dsp32c_device::state_string_export(const device_state_entry &entry, astring
}
//-------------------------------------------------
// disasm_min_opcode_bytes - return the length
// of the shortest instruction, in bytes
//-------------------------------------------------
UINT32 dsp32c_device::disasm_min_opcode_bytes() const
{
return 4;
}
//-------------------------------------------------
// disasm_max_opcode_bytes - return the length
// of the longest instruction, in bytes
//-------------------------------------------------
UINT32 dsp32c_device::disasm_max_opcode_bytes() const
{
return 4;
}
//-------------------------------------------------
// disasm_disassemble - call the disassembly
// helper function
@ -630,13 +555,13 @@ void dsp32c_device::update_pcr(UINT16 newval)
reset();
// track the state of the output pins
if (m_config.m_output_pins_changed != NULL)
if (m_output_pins_changed != NULL)
{
UINT16 newoutput = ((newval & (PCR_PIFs | PCR_ENI)) == (PCR_PIFs | PCR_ENI)) ? DSP32_OUTPUT_PIF : 0;
if (newoutput != m_lastpins)
{
m_lastpins = newoutput;
(*m_config.m_output_pins_changed)(*this, newoutput);
(*m_output_pins_changed)(*this, newoutput);
}
}
}
@ -655,6 +580,39 @@ void dsp32c_device::update_pcr(UINT16 newval)
// CORE EXECUTION LOOP
//**************************************************************************
//-------------------------------------------------
// execute_min_cycles - return minimum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 dsp32c_device::execute_min_cycles() const
{
return 4;
}
//-------------------------------------------------
// execute_max_cycles - return maximum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 dsp32c_device::execute_max_cycles() const
{
return 4;
}
//-------------------------------------------------
// execute_input_lines - return the number of
// input/interrupt lines
//-------------------------------------------------
UINT32 dsp32c_device::execute_input_lines() const
{
return 2;
}
void dsp32c_device::execute_set_input(int inputnum, int state)
{
}

View File

@ -47,7 +47,7 @@
//**************************************************************************
#define MCFG_DSP32C_CONFIG(_config) \
dsp32c_device_config::static_set_config(device, _config); \
dsp32c_device::static_set_config(*device, _config); \
@ -120,14 +120,6 @@ enum
};
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
extern const device_type DSP32C;
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@ -144,53 +136,18 @@ struct dsp32_config
// ======================> dsp32c_device_config
class dsp32c_device_config : public cpu_device_config,
public dsp32_config
{
friend class dsp32c_device;
// construction/destruction
dsp32c_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
public:
// allocators
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
virtual device_t *alloc_device(running_machine &machine) const;
// inline configuration helpers
static void static_set_config(device_config *device, const dsp32_config &config);
protected:
// device_config_execute_interface overrides
virtual UINT32 execute_min_cycles() const;
virtual UINT32 execute_max_cycles() const;
virtual UINT32 execute_input_lines() const;
// device_config_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
// device_config_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const;
virtual UINT32 disasm_max_opcode_bytes() const;
// inline data
const address_space_config m_program_config;
};
// ======================> dsp32c_device
class dsp32c_device : public cpu_device
class dsp32c_device : public cpu_device,
public dsp32_config
{
friend class dsp32c_device_config;
// construction/destruction
dsp32c_device(running_machine &_machine, const dsp32c_device_config &config);
public:
// construction/destruction
dsp32c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// inline configuration helpers
static void static_set_config(device_t &device, const dsp32_config &config);
// public interfaces
void pio_w(int reg, int data);
int pio_r(int reg);
@ -201,15 +158,23 @@ protected:
virtual void device_reset();
// device_execute_interface overrides
virtual UINT32 execute_min_cycles() const;
virtual UINT32 execute_max_cycles() const;
virtual UINT32 execute_input_lines() const;
virtual void execute_run();
virtual void execute_set_input(int inputnum, int state);
// device_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
// device_state_interface overrides
virtual void state_import(const device_state_entry &entry);
virtual void state_export(const device_state_entry &entry);
virtual void state_string_export(const device_state_entry &entry, astring &string);
// device_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const;
virtual UINT32 disasm_max_opcode_bytes() const;
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
// memory accessors
@ -456,7 +421,7 @@ protected:
void dma_store();
// configuration
const dsp32c_device_config &m_config;
const address_space_config m_program_config;
// internal state
UINT32 m_r[32];
@ -512,4 +477,8 @@ protected:
};
extern const device_type DSP32C;
#endif /* __DSP32_H__ */

View File

@ -229,7 +229,7 @@ static CPU_INIT( dsp56k )
device->save_item(NAME(cpustate->HI.trxl));
device->save_item(NAME(cpustate->HI.bootstrap_offset));
//cpustate->config = device->baseconfig().static_config();
//cpustate->config = device->static_config();
//cpustate->irq_callback = irqcallback;
cpustate->device = device;
cpustate->program = device->space(AS_PROGRAM);

View File

@ -249,7 +249,7 @@ static void make_ops(esrip_state *cpustate)
static CPU_INIT( esrip )
{
esrip_state *cpustate = get_safe_token(device);
esrip_config* _config = (esrip_config*)device->baseconfig().static_config();
esrip_config* _config = (esrip_config*)device->static_config();
memset(cpustate, 0, sizeof(cpustate));

View File

@ -90,45 +90,20 @@
static const UINT16 irq_vector[] = {0x0032, 0x0042, 0x0052, 0x0062, 0x0072};
//**************************************************************************
// DEVICE DEFINITIONS
// HD61700 DEVICE
//**************************************************************************
const device_type HD61700 = hd61700_cpu_device_config::static_alloc_device_config;
//**************************************************************************
// HD61700 DEVICE CONFIG
//**************************************************************************
const device_type HD61700 = &device_creator<hd61700_cpu_device>;
//-------------------------------------------------
// hd61700_cpu_device_config - constructor
// hd61700_cpu_device - constructor
//-------------------------------------------------
hd61700_cpu_device_config::hd61700_cpu_device_config(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock)
: cpu_device_config(mconfig, type, "HD61700", tag, owner, clock),
hd61700_cpu_device::hd61700_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: cpu_device(mconfig, HD61700, "HD61700", tag, owner, clock),
m_program_config("program", ENDIANNESS_BIG, 16, 18, -1)
{
}
//-------------------------------------------------
// static_alloc_device_config - allocate a new
// configuration object
//-------------------------------------------------
device_config *hd61700_cpu_device_config::static_alloc_device_config( const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock )
{
return global_alloc(hd61700_cpu_device_config(mconfig, HD61700, tag, owner, clock));
}
//-------------------------------------------------
// alloc_device - allocate a new device object
//-------------------------------------------------
device_t *hd61700_cpu_device_config::alloc_device(running_machine &machine) const
{
return pool_alloc(machine_get_pool(machine), hd61700_cpu_device(machine, *this));
memset(&m_partial_frame_period, 0, sizeof(m_partial_frame_period));
}
@ -137,29 +112,12 @@ device_t *hd61700_cpu_device_config::alloc_device(running_machine &machine) cons
// structure
//-------------------------------------------------
void hd61700_cpu_device_config::static_set_config(device_config *device, const hd61700_config &config)
void hd61700_cpu_device::static_set_config(device_t &device, const hd61700_config &config)
{
hd61700_cpu_device_config *conf = downcast<hd61700_cpu_device_config *>(device);
*static_cast<hd61700_config *>(conf) = config;
hd61700_cpu_device &conf = downcast<hd61700_cpu_device &>(device);
static_cast<hd61700_config &>(conf) = config;
}
//**************************************************************************
// HD61700 DEVICE
//**************************************************************************
//-------------------------------------------------
// hd61700_cpu_device - constructor
//-------------------------------------------------
hd61700_cpu_device::hd61700_cpu_device(running_machine &machine, const hd61700_cpu_device_config &config)
: cpu_device(machine, config),
m_cpu_config(config)
{
memset(&m_partial_frame_period, 0, sizeof(m_partial_frame_period));
}
//-------------------------------------------------
// device_start - start up the device
//-------------------------------------------------
@ -498,8 +456,8 @@ void hd61700_cpu_device::execute_run()
{
UINT8 arg = read_op();
if (m_cpu_config.m_lcd_data_w)
(*m_cpu_config.m_lcd_data_w)(*this, READ_REG(arg));
if (m_lcd_data_w)
(*m_lcd_data_w)(*this, READ_REG(arg));
check_optional_jr(arg);
m_icount -= 11;
@ -511,8 +469,8 @@ void hd61700_cpu_device::execute_run()
UINT8 arg = read_op();
UINT8 res = 0xff;
if (m_cpu_config.m_lcd_data_r)
res = (*m_cpu_config.m_lcd_data_r)(*this);
if (m_lcd_data_r)
res = (*m_lcd_data_r)(*this);
WRITE_REG(arg, res);
@ -531,8 +489,8 @@ void hd61700_cpu_device::execute_run()
}
else
{
if (m_cpu_config.m_lcd_control)
(*m_cpu_config.m_lcd_control)(*this, READ_REG(arg));
if (m_lcd_control)
(*m_lcd_control)(*this, READ_REG(arg));
}
check_optional_jr(arg);
@ -562,8 +520,8 @@ void hd61700_cpu_device::execute_run()
case 0: //PE
case 1: //PD
WRITE_REG8(idx, src);
if (m_cpu_config.m_port_w)
(*m_cpu_config.m_port_w)(*this, REG_PD & REG_PE);
if (m_port_w)
(*m_port_w)(*this, REG_PD & REG_PE);
break;
case 2: //IB
REG_IB = (REG_IB & 0x1f) | (src & 0xe0);
@ -572,8 +530,8 @@ void hd61700_cpu_device::execute_run()
WRITE_REG8(idx, src);
break;
case 4: //IA
if (m_cpu_config.m_kb_w)
(*m_cpu_config.m_kb_w)(*this, src);
if (m_kb_w)
(*m_kb_w)(*this, src);
WRITE_REG8(idx, src);
break;
case 5: //IE
@ -706,8 +664,8 @@ void hd61700_cpu_device::execute_run()
}
else
{
if (m_cpu_config.m_port_r)
src = (*m_cpu_config.m_port_r)(*this);
if (m_port_r)
src = (*m_port_r)(*this);
src&=(~REG_PE);
}
@ -1051,8 +1009,8 @@ void hd61700_cpu_device::execute_run()
{
UINT8 arg = read_op();
if (m_cpu_config.m_lcd_data_w)
(*m_cpu_config.m_lcd_data_w)(*this, arg);
if (m_lcd_data_w)
(*m_lcd_data_w)(*this, arg);
m_icount -= 12;
}
@ -1069,8 +1027,8 @@ void hd61700_cpu_device::execute_run()
}
else
{
if (m_cpu_config.m_lcd_control)
(*m_cpu_config.m_lcd_control)(*this, src);
if (m_lcd_control)
(*m_lcd_control)(*this, src);
}
m_icount -= 3;
@ -1098,8 +1056,8 @@ void hd61700_cpu_device::execute_run()
case 0: //PE
case 1: //PD
WRITE_REG8(idx, src);
if (m_cpu_config.m_port_w)
(*m_cpu_config.m_port_w)(*this, REG_PD & REG_PE);
if (m_port_w)
(*m_port_w)(*this, REG_PD & REG_PE);
break;
case 2: //IB
REG_IB = (REG_IB & 0x1f) | (src & 0xe0);
@ -1108,8 +1066,8 @@ void hd61700_cpu_device::execute_run()
WRITE_REG8(idx, src);
break;
case 4: //IA
if (m_cpu_config.m_kb_w)
(*m_cpu_config.m_kb_w)(*this, src);
if (m_kb_w)
(*m_kb_w)(*this, src);
WRITE_REG8(idx, src);
break;
case 5: //IE
@ -1482,10 +1440,10 @@ void hd61700_cpu_device::execute_run()
{
UINT8 arg = read_op();
if (m_cpu_config.m_lcd_data_w)
if (m_lcd_data_w)
{
(*m_cpu_config.m_lcd_data_w)(*this, READ_REG(arg));
(*m_cpu_config.m_lcd_data_w)(*this, READ_REG(arg+1));
(*m_lcd_data_w)(*this, READ_REG(arg));
(*m_lcd_data_w)(*this, READ_REG(arg+1));
}
check_optional_jr(arg);
@ -1498,10 +1456,10 @@ void hd61700_cpu_device::execute_run()
UINT8 arg = read_op();
UINT8 reg0, reg1;
if (m_cpu_config.m_lcd_data_r)
if (m_lcd_data_r)
{
reg0 = (*m_cpu_config.m_lcd_data_r)(*this);
reg1 = (*m_cpu_config.m_lcd_data_r)(*this);
reg0 = (*m_lcd_data_r)(*this);
reg1 = (*m_lcd_data_r)(*this);
}
else
reg0 = reg1 = 0xff;
@ -1666,10 +1624,10 @@ void hd61700_cpu_device::execute_run()
}
else
{
if (m_cpu_config.m_port_r)
if (m_port_r)
{
reg0 = (*m_cpu_config.m_port_r)(*this);
reg1 = (*m_cpu_config.m_port_r)(*this);
reg0 = (*m_port_r)(*this);
reg1 = (*m_port_r)(*this);
}
else
reg0 = reg1 = 0xff;
@ -1698,8 +1656,8 @@ void hd61700_cpu_device::execute_run()
{
UINT16 port = 0xff;
if (m_cpu_config.m_kb_r)
port = (*m_cpu_config.m_kb_r)(*this);
if (m_kb_r)
port = (*m_kb_r)(*this);
src = (REG_KY & 0x0f00) | (port & 0xf0ff);
}
@ -2158,8 +2116,8 @@ void hd61700_cpu_device::execute_run()
for (int n=GET_IM3(arg1); n>0; n--)
{
if (m_cpu_config.m_lcd_data_w)
(*m_cpu_config.m_lcd_data_w)(*this, READ_REG(arg));
if (m_lcd_data_w)
(*m_lcd_data_w)(*this, READ_REG(arg));
arg++;
m_icount -= 8;
@ -2177,8 +2135,8 @@ void hd61700_cpu_device::execute_run()
for (int n=GET_IM3(arg1); n>0; n--)
{
if (m_cpu_config.m_lcd_data_r)
src = (*m_cpu_config.m_lcd_data_r)(*this);
if (m_lcd_data_r)
src = (*m_lcd_data_r)(*this);
else
src = 0xff;
@ -2674,11 +2632,11 @@ void hd61700_cpu_device::execute_run()
m_state |= CPU_SLP;
m_irq_status = 0;
if (m_cpu_config.m_lcd_control)
(*m_cpu_config.m_lcd_control)(*this, 0);
if (m_lcd_control)
(*m_lcd_control)(*this, 0);
if (m_cpu_config.m_kb_w)
(*m_cpu_config.m_kb_w)(*this, 0);
if (m_kb_w)
(*m_kb_w)(*this, 0);
m_icount -= 3;
}
break;

View File

@ -14,13 +14,7 @@
//**************************************************************************
#define MCFG_HD61700_CONFIG(_config) \
hd61700_cpu_device_config::static_set_config(device, _config); \
//**************************************************************************
// DEVICE TYPE DEFINITION
//**************************************************************************
extern const device_type HD61700;
hd61700_cpu_device::static_set_config(*device, _config); \
//**************************************************************************
// DEFINITIONS
@ -28,7 +22,6 @@ extern const device_type HD61700;
// class definition
class hd61700_cpu_device;
class hd61700_cpu_device_config;
// cpu port callbacks types
typedef void (*hd61700_lcd_control_func)(hd61700_cpu_device &device, UINT8 data);
@ -72,57 +65,27 @@ enum
};
// ======================> hd61700_cpu_device_config
class hd61700_cpu_device_config : public cpu_device_config,
public hd61700_config
{
friend class hd61700_cpu_device;
protected:
// construction/destruction
hd61700_cpu_device_config(const machine_config &mconfig, device_type _type, const char *_tag, const device_config *_owner, UINT32 _clock);
public:
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
virtual device_t *alloc_device(running_machine &machine) const;
// inline configuration helpers
static void static_set_config(device_config *device, const hd61700_config &config);
protected:
// device_config_execute_interface overrides
virtual UINT32 execute_min_cycles() const { return 1; }
virtual UINT32 execute_max_cycles() const { return 52; }
virtual UINT32 execute_input_lines() const { return 6; }
// device_config_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; }
// device_config_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const { return 1; }
virtual UINT32 disasm_max_opcode_bytes() const { return 16; }
// internal state
address_space_config m_program_config;
};
// ======================> hd61700_cpu_device
class hd61700_cpu_device : public cpu_device
class hd61700_cpu_device : public cpu_device,
public hd61700_config
{
friend class hd61700_cpu_device_config;
public:
// construction/destruction
hd61700_cpu_device(const machine_config &mconfig, const char *_tag, device_t *_owner, UINT32 _clock);
static void static_set_config(device_t &device, const hd61700_config &config);
protected:
// construction/destruction
hd61700_cpu_device(running_machine &machine, const hd61700_cpu_device_config &config);
// device-level overrides
virtual void device_start();
virtual void device_reset();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
// device_execute_interface overrides
virtual UINT32 execute_min_cycles() const { return 1; }
virtual UINT32 execute_max_cycles() const { return 52; }
virtual UINT32 execute_input_lines() const { return 6; }
virtual void execute_run();
virtual void execute_set_input(int inputnum, int state);
@ -130,8 +93,12 @@ protected:
virtual void state_import(const device_state_entry &entry);
void state_string_export(const device_state_entry &entry, astring &string);
// device_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; }
// device_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const { return 1; }
virtual UINT32 disasm_max_opcode_bytes() const { return 16; }
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
// interrupts
@ -159,7 +126,7 @@ protected:
protected:
// internal state
const hd61700_cpu_device_config &m_cpu_config; // reference to the config
address_space_config m_program_config;
static const device_timer_id SEC_TIMER = 1;
emu_timer *m_sec_timer;
@ -189,4 +156,7 @@ protected:
static const int FLAG_APO = 0x04;
};
extern const device_type HD61700;
#endif /* __HD61700_H__ */

View File

@ -1001,8 +1001,8 @@ static void init_808x_common(legacy_cpu_device *device, device_irq_callback irqc
state->state_add(I8085_INTE, "INTE", cpustate->ietemp).mask(0x1).callimport().callexport();
}
if (device->baseconfig().static_config() != NULL)
cpustate->config = *(i8085_config *)device->baseconfig().static_config();
if (device->static_config() != NULL)
cpustate->config = *(i8085_config *)device->static_config();
cpustate->cputype = type;
cpustate->irq_callback = irqcallback;
cpustate->device = device;

View File

@ -296,8 +296,8 @@ static CPU_INIT( i80286 )
cpustate->direct = &cpustate->program->direct();
/* If a reset parameter is given, take it as pointer to an address mask */
if( device->baseconfig().static_config() )
cpustate->amask = *(unsigned*)device->baseconfig().static_config();
if( device->static_config() )
cpustate->amask = *(unsigned*)device->static_config();
else
cpustate->amask = 0x00ffff;

View File

@ -220,7 +220,7 @@ static CPU_INIT( i80186 )
CPU_INIT_CALL(i8086);
/* resolve callbacks */
i80186_interface *intf = (i80186_interface *) device->baseconfig().static_config();
i80186_interface *intf = (i80186_interface *) device->static_config();
if (intf != NULL)
{

View File

@ -411,7 +411,7 @@ static STATE_POSTLOAD( jaguar_postload )
static void init_common(int isdsp, legacy_cpu_device *device, device_irq_callback irqcallback)
{
const jaguar_cpu_config *configdata = (const jaguar_cpu_config *)device->baseconfig().static_config();
const jaguar_cpu_config *configdata = (const jaguar_cpu_config *)device->static_config();
jaguar_state *jaguar = get_safe_token(device);
init_tables();

View File

@ -116,7 +116,7 @@ static CPU_INIT( lh5801 )
lh5801_state *cpustate = get_safe_token(device);
memset(cpustate, 0, sizeof(*cpustate));
cpustate->config = (const lh5801_cpu_core *) device->baseconfig().static_config();
cpustate->config = (const lh5801_cpu_core *) device->static_config();
cpustate->device = device;
cpustate->program = device->space(AS_PROGRAM);
cpustate->io = device->space(AS_IO);

View File

@ -189,7 +189,7 @@ static CPU_INIT( lr35902 )
{
lr35902_state *cpustate = get_safe_token(device);
cpustate->w.config = (const lr35902_cpu_core *) device->baseconfig().static_config();
cpustate->w.config = (const lr35902_cpu_core *) device->static_config();
cpustate->w.irq_callback = irqcallback;
cpustate->w.device = device;
cpustate->w.program = device->space(AS_PROGRAM);

View File

@ -198,7 +198,7 @@ static void default_wrmem_id(address_space *space, offs_t address, UINT8 data)
static CPU_INIT( m4510 )
{
m4510_Regs *cpustate = get_safe_token(device);
const m6502_interface *intf = (const m6502_interface *)device->baseconfig().static_config();
const m6502_interface *intf = (const m6502_interface *)device->static_config();
cpustate->interrupt_inhibit = 0;
cpustate->rdmem_id = default_rdmem_id;

View File

@ -133,7 +133,7 @@ static void default_wdmem_id(address_space *space, offs_t offset, UINT8 data) {
static void m6502_common_init(legacy_cpu_device *device, device_irq_callback irqcallback, UINT8 subtype, void (*const *insn)(m6502_Regs *cpustate), const char *type)
{
m6502_Regs *cpustate = get_safe_token(device);
const m6502_interface *intf = (const m6502_interface *)device->baseconfig().static_config();
const m6502_interface *intf = (const m6502_interface *)device->static_config();
cpustate->irq_callback = irqcallback;
cpustate->device = device;

View File

@ -141,7 +141,7 @@ static void default_wdmem_id(address_space *space, offs_t address, UINT8 data) {
static CPU_INIT( m6509 )
{
m6509_Regs *cpustate = get_safe_token(device);
const m6502_interface *intf = (const m6502_interface *)device->baseconfig().static_config();
const m6502_interface *intf = (const m6502_interface *)device->static_config();
cpustate->rdmem_id = default_rdmem_id;
cpustate->wrmem_id = default_wdmem_id;

View File

@ -101,7 +101,7 @@ static void default_wdmem_id(address_space *space, offs_t address, UINT8 data) {
static CPU_INIT( m65ce02 )
{
m65ce02_Regs *cpustate = get_safe_token(device);
const m6502_interface *intf = (const m6502_interface *)device->baseconfig().static_config();
const m6502_interface *intf = (const m6502_interface *)device->static_config();
cpustate->rdmem_id = default_rdmem_id;
cpustate->wrmem_id = default_wdmem_id;

View File

@ -1208,9 +1208,9 @@ static CPU_INIT( m6801 )
state_register(cpustate, "m6801");
if (device->baseconfig().static_config() != NULL)
if (device->static_config() != NULL)
{
m6801_interface *intf = (m6801_interface *) device->baseconfig().static_config();
m6801_interface *intf = (m6801_interface *) device->static_config();
devcb_resolve_write_line(&cpustate->out_sc2_func, &intf->out_sc2_func, device);
}
@ -1258,9 +1258,9 @@ static CPU_INIT( m6803 )
state_register(cpustate, "m6803");
if (device->baseconfig().static_config() != NULL)
if (device->static_config() != NULL)
{
m6801_interface *intf = (m6801_interface *) device->baseconfig().static_config();
m6801_interface *intf = (m6801_interface *) device->static_config();
devcb_resolve_write_line(&cpustate->out_sc2_func, &intf->out_sc2_func, device);
}

View File

@ -369,7 +369,7 @@ CPU_DISASSEMBLE( m6809 )
const UINT8 *operandarray;
unsigned int ea, flags;
int numoperands, offset, indirect;
const m6809_config *configdata = device ? (const m6809_config *)device->baseconfig().static_config() : NULL;
const m6809_config *configdata = device ? (const m6809_config *)device->static_config() : NULL;
int encrypt_only_first_byte = configdata ? configdata->encrypt_only_first_byte : 0;
int i, p = 0, page = 0, opcode_found = FALSE;

View File

@ -371,7 +371,7 @@ static CPU_INIT( m6809 )
0
};
const m6809_config *configdata = device->baseconfig().static_config() ? (const m6809_config *)device->baseconfig().static_config() : &default_config;
const m6809_config *configdata = device->static_config() ? (const m6809_config *)device->static_config() : &default_config;
m68_state_t *m68_state = get_safe_token(device);
m68_state->config = configdata;

View File

@ -107,7 +107,7 @@ INLINE mb86233_state *get_safe_token(device_t *device)
static CPU_INIT( mb86233 )
{
mb86233_state *cpustate = get_safe_token(device);
mb86233_cpu_core * _config = (mb86233_cpu_core *)device->baseconfig().static_config();
mb86233_cpu_core * _config = (mb86233_cpu_core *)device->static_config();
(void)irqcallback;
memset(cpustate, 0, sizeof( *cpustate ) );

View File

@ -136,9 +136,9 @@ static CPU_INIT( mb88 )
{
mb88_state *cpustate = get_safe_token(device);
if ( device->baseconfig().static_config() )
if ( device->static_config() )
{
const mb88_cpu_core *_config = (const mb88_cpu_core*)device->baseconfig().static_config();
const mb88_cpu_core *_config = (const mb88_cpu_core*)device->static_config();
cpustate->PLA = _config->PLA_config;
}

View File

@ -369,7 +369,7 @@ static CPU_INIT( hc11 )
hc11_state *cpustate = get_safe_token(device);
int i;
const hc11_config *conf = (const hc11_config *)device->baseconfig().static_config();
const hc11_config *conf = (const hc11_config *)device->static_config();
/* clear the opcode tables */
for(i=0; i < 256; i++) {

View File

@ -1418,7 +1418,7 @@ static CPU_GET_INFO( mcs48 )
CPU-SPECIFIC CONTEXT ACCESS
***************************************************************************/
static void mcs48_generic_get_info(const device_config *devconfig, legacy_cpu_device *device, UINT32 state, cpuinfo *info, UINT8 features, int romsize, int ramsize, const char *name)
static void mcs48_generic_get_info(legacy_cpu_device *device, UINT32 state, cpuinfo *info, UINT8 features, int romsize, int ramsize, const char *name)
{
switch (state)
{
@ -1494,31 +1494,31 @@ static void mcs48_generic_get_info(const device_config *devconfig, legacy_cpu_de
/* Official Intel MCS-48 parts */
CPU_GET_INFO( i8021 ) { mcs48_generic_get_info(devconfig, device, state, info, MCS48_FEATURE, 1024, 64, "I8021"); }
CPU_GET_INFO( i8022 ) { mcs48_generic_get_info(devconfig, device, state, info, MCS48_FEATURE, 2048, 128, "I8022"); }
CPU_GET_INFO( i8035 ) { mcs48_generic_get_info(devconfig, device, state, info, MCS48_FEATURE, 0, 64, "I8035"); }
CPU_GET_INFO( i8048 ) { mcs48_generic_get_info(devconfig, device, state, info, MCS48_FEATURE, 1024, 64, "I8048"); }
CPU_GET_INFO( i8648 ) { mcs48_generic_get_info(devconfig, device, state, info, MCS48_FEATURE, 1024, 64, "I8648"); }
CPU_GET_INFO( i8748 ) { mcs48_generic_get_info(devconfig, device, state, info, MCS48_FEATURE, 1024, 64, "I8748"); }
CPU_GET_INFO( i8039 ) { mcs48_generic_get_info(devconfig, device, state, info, MCS48_FEATURE, 0, 128, "I8039"); }
CPU_GET_INFO( i8049 ) { mcs48_generic_get_info(devconfig, device, state, info, MCS48_FEATURE, 2048, 128, "I8049"); }
CPU_GET_INFO( i8749 ) { mcs48_generic_get_info(devconfig, device, state, info, MCS48_FEATURE, 2048, 128, "I8749"); }
CPU_GET_INFO( i8040 ) { mcs48_generic_get_info(devconfig, device, state, info, MCS48_FEATURE, 0, 256, "I8040"); }
CPU_GET_INFO( i8050 ) { mcs48_generic_get_info(devconfig, device, state, info, MCS48_FEATURE, 4096, 256, "I8050"); }
CPU_GET_INFO( i8021 ) { mcs48_generic_get_info(device, state, info, MCS48_FEATURE, 1024, 64, "I8021"); }
CPU_GET_INFO( i8022 ) { mcs48_generic_get_info(device, state, info, MCS48_FEATURE, 2048, 128, "I8022"); }
CPU_GET_INFO( i8035 ) { mcs48_generic_get_info(device, state, info, MCS48_FEATURE, 0, 64, "I8035"); }
CPU_GET_INFO( i8048 ) { mcs48_generic_get_info(device, state, info, MCS48_FEATURE, 1024, 64, "I8048"); }
CPU_GET_INFO( i8648 ) { mcs48_generic_get_info(device, state, info, MCS48_FEATURE, 1024, 64, "I8648"); }
CPU_GET_INFO( i8748 ) { mcs48_generic_get_info(device, state, info, MCS48_FEATURE, 1024, 64, "I8748"); }
CPU_GET_INFO( i8039 ) { mcs48_generic_get_info(device, state, info, MCS48_FEATURE, 0, 128, "I8039"); }
CPU_GET_INFO( i8049 ) { mcs48_generic_get_info(device, state, info, MCS48_FEATURE, 2048, 128, "I8049"); }
CPU_GET_INFO( i8749 ) { mcs48_generic_get_info(device, state, info, MCS48_FEATURE, 2048, 128, "I8749"); }
CPU_GET_INFO( i8040 ) { mcs48_generic_get_info(device, state, info, MCS48_FEATURE, 0, 256, "I8040"); }
CPU_GET_INFO( i8050 ) { mcs48_generic_get_info(device, state, info, MCS48_FEATURE, 4096, 256, "I8050"); }
/* Official Intel UPI-41 parts */
CPU_GET_INFO( i8041 ) { mcs48_generic_get_info(devconfig, device, state, info, UPI41_FEATURE, 1024, 128, "I8041"); }
CPU_GET_INFO( i8741 ) { mcs48_generic_get_info(devconfig, device, state, info, UPI41_FEATURE, 1024, 128, "I8741"); }
CPU_GET_INFO( i8042 ) { mcs48_generic_get_info(devconfig, device, state, info, UPI41_FEATURE, 2048, 256, "I8042"); }
CPU_GET_INFO( i8242 ) { mcs48_generic_get_info(devconfig, device, state, info, UPI41_FEATURE, 2048, 256, "I8242"); }
CPU_GET_INFO( i8742 ) { mcs48_generic_get_info(devconfig, device, state, info, UPI41_FEATURE, 2048, 256, "I8742"); }
CPU_GET_INFO( i8041 ) { mcs48_generic_get_info(device, state, info, UPI41_FEATURE, 1024, 128, "I8041"); }
CPU_GET_INFO( i8741 ) { mcs48_generic_get_info(device, state, info, UPI41_FEATURE, 1024, 128, "I8741"); }
CPU_GET_INFO( i8042 ) { mcs48_generic_get_info(device, state, info, UPI41_FEATURE, 2048, 256, "I8042"); }
CPU_GET_INFO( i8242 ) { mcs48_generic_get_info(device, state, info, UPI41_FEATURE, 2048, 256, "I8242"); }
CPU_GET_INFO( i8742 ) { mcs48_generic_get_info(device, state, info, UPI41_FEATURE, 2048, 256, "I8742"); }
/* Clones */
CPU_GET_INFO( mb8884 ) { mcs48_generic_get_info(devconfig, device, state, info, MCS48_FEATURE, 0, 64, "MB8884"); }
CPU_GET_INFO( n7751 ) { mcs48_generic_get_info(devconfig, device, state, info, MCS48_FEATURE, 1024, 64, "N7751"); }
CPU_GET_INFO( m58715 ) { mcs48_generic_get_info(devconfig, device, state, info, MCS48_FEATURE, 2048, 128, "M58715"); }
CPU_GET_INFO( mb8884 ) { mcs48_generic_get_info(device, state, info, MCS48_FEATURE, 0, 64, "MB8884"); }
CPU_GET_INFO( n7751 ) { mcs48_generic_get_info(device, state, info, MCS48_FEATURE, 1024, 64, "N7751"); }
CPU_GET_INFO( m58715 ) { mcs48_generic_get_info(device, state, info, MCS48_FEATURE, 2048, 128, "M58715"); }
/* Official Intel MCS-48 parts */
DEFINE_LEGACY_CPU_DEVICE(I8021, i8021); /* 1k internal ROM, 64 bytes internal RAM */

View File

@ -2384,7 +2384,7 @@ static CPU_INIT( ds5002fp )
{
/* default configuration */
static const ds5002fp_config default_config = { 0x00, 0x00, 0x00 };
const ds5002fp_config *sconfig = device->baseconfig().static_config() ? (const ds5002fp_config *)device->baseconfig().static_config() : &default_config;
const ds5002fp_config *sconfig = device->static_config() ? (const ds5002fp_config *)device->static_config() : &default_config;
mcs51_state_t *mcs51_state = get_safe_token(device);
CPU_INIT_CALL( mcs51 );

View File

@ -120,7 +120,7 @@ static CPU_INIT( minx )
minx->irq_callback = irqcallback;
minx->device = device;
minx->program = device->space(AS_PROGRAM);
if ( device->baseconfig().static_config() != NULL )
if ( device->static_config() != NULL )
{
}
else

View File

@ -71,7 +71,7 @@ INLINE int tlb_entry_is_global(const mips3_tlb_entry *entry)
void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, legacy_cpu_device *device, device_irq_callback irqcallback)
{
const mips3_config *config = (const mips3_config *)device->baseconfig().static_config();
const mips3_config *config = (const mips3_config *)device->static_config();
int tlbindex;
/* initialize based on the config */

View File

@ -158,6 +158,10 @@ static const char *const delayn[] =
"pc", "!pc"
};
// device type definition
const device_type PSXCPU = &device_creator<psxcpu_device>;
const device_type CXD8661R = &device_creator<cxd8661r_device>;
static const UINT32 mtc0_writemask[]=
{
0x00000000, /* !INDEX */
@ -1557,60 +1561,6 @@ static ADDRESS_MAP_START( cxd8661r_internal_map, AS_PROGRAM, 32 )
ADDRESS_MAP_END
const device_type PSXCPU = psxcpu_device_config::static_alloc_device_config;
const device_type CXD8661R = cxd8661r_device_config::static_alloc_device_config;
//**************************************************************************
// PSXCPU DEVICE CONFIG
//**************************************************************************
//-------------------------------------------------
// psxcpu_device_config - constructor
//-------------------------------------------------
psxcpu_device_config::psxcpu_device_config(const machine_config &mconfig, device_type type, const char *name, const char *tag, const device_config *owner, UINT32 clock, address_map_constructor internal_map)
: cpu_device_config(mconfig, type, name, tag, owner, clock),
m_program_config("program", ENDIANNESS_LITTLE, 32, 32, 0, internal_map)
{
}
//-------------------------------------------------
// static_alloc_device_config - allocate a new
// configuration object
//-------------------------------------------------
device_config *psxcpu_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
{
return global_alloc(psxcpu_device_config(mconfig, PSXCPU, "PSXCPU", tag, owner, clock, ADDRESS_MAP_NAME(psxcpu_internal_map)));
}
//-------------------------------------------------
// static_alloc_device_config - allocate a new
// configuration object
//-------------------------------------------------
device_config *cxd8661r_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
{
return global_alloc(psxcpu_device_config(mconfig, CXD8661R, "CXD8661R", tag, owner, clock, ADDRESS_MAP_NAME(cxd8661r_internal_map)));
}
//-------------------------------------------------
// alloc_device - allocate a new device object
//-------------------------------------------------
device_t *psxcpu_device_config::alloc_device(running_machine &machine) const
{
return auto_alloc(machine, psxcpu_device(machine, *this));
}
device_t *cxd8661r_device_config::alloc_device(running_machine &machine) const
{
return auto_alloc(machine, psxcpu_device(machine, *this));
}
//**************************************************************************
// DEVICE INTERFACE
//**************************************************************************
@ -1619,8 +1569,20 @@ device_t *cxd8661r_device_config::alloc_device(running_machine &machine) const
// psxcpu_device - constructor
//-------------------------------------------------
psxcpu_device::psxcpu_device(running_machine &machine, const psxcpu_device_config &config)
: cpu_device(machine, config)
psxcpu_device::psxcpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, address_map_constructor internal_map)
: cpu_device(mconfig, type, name, tag, owner, clock),
m_program_config("program", ENDIANNESS_LITTLE, 32, 32, 0, internal_map)
{
}
psxcpu_device::psxcpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: cpu_device(mconfig, PSXCPU, "PSXCPU", tag, owner, clock),
m_program_config("program", ENDIANNESS_LITTLE, 32, 32, 0, ADDRESS_MAP_NAME(psxcpu_internal_map))
{
}
cxd8661r_device::cxd8661r_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: psxcpu_device(mconfig, CXD8661R, "CXD8661R", tag, owner, clock, ADDRESS_MAP_NAME(cxd8661r_internal_map))
{
}

View File

@ -96,25 +96,13 @@ enum
PSXCPU_CP2CR30, PSXCPU_CP2CR31
};
extern const device_type PSXCPU;
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
//#define MCFG_PSXCPU_CONFIG(_config)
// psxcpu_device_config::static_set_config(device, _config);
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
// device type definition
extern const device_type PSXCPU;
extern const device_type CXD8661R;
// psxcpu_device::static_set_config(*device, _config);
@ -122,65 +110,21 @@ extern const device_type CXD8661R;
// TYPE DEFINITIONS
//**************************************************************************
class psxcpu_device;
// ======================> psxcpu_device_config
class psxcpu_device_config : public cpu_device_config
{
friend class psxcpu_device;
public:
// allocators
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
virtual device_t *alloc_device(running_machine &machine) const;
// construction/destruction
psxcpu_device_config(const machine_config &mconfig, device_type _type, const char *name, const char *tag, const device_config *owner, UINT32 clock, address_map_constructor internal_map);
protected:
// device_config_execute_interface overrides
virtual UINT32 execute_min_cycles() const { return 1; }
virtual UINT32 execute_max_cycles() const { return 40; }
virtual UINT32 execute_input_lines() const { return 6; }
virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const { return ( clocks + 3 ) / 4; }
virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const { return cycles * 4; }
// device_config_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; }
// device_config_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const { return 4; }
virtual UINT32 disasm_max_opcode_bytes() const { return 4; }
// address spaces
const address_space_config m_program_config;
};
class cxd8661r_device_config : public psxcpu_device_config
{
public:
// allocators
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
virtual device_t *alloc_device(running_machine &machine) const;
};
// ======================> psxcpu_device
class psxcpu_device : public cpu_device
{
friend class psxcpu_device_config;
friend class cxd8661r_device_config;
public:
// construction/destruction
psxcpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// public interfaces
void set_berr();
void set_biu( UINT32 data, UINT32 mem_mask );
UINT32 get_biu();
protected:
// construction/destruction
psxcpu_device(running_machine &_machine, const psxcpu_device_config &config);
psxcpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, address_map_constructor internal_map);
// device-level overrides
virtual void device_start();
@ -188,14 +132,24 @@ protected:
virtual void device_post_load();
// device_execute_interface overrides
virtual UINT32 execute_min_cycles() const { return 1; }
virtual UINT32 execute_max_cycles() const { return 40; }
virtual UINT32 execute_input_lines() const { return 6; }
virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const { return ( clocks + 3 ) / 4; }
virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const { return cycles * 4; }
virtual void execute_run();
virtual void execute_set_input(int inputnum, int state);
// device_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; }
// device_state_interface overrides
virtual void state_import(const device_state_entry &entry);
virtual void state_string_export(const device_state_entry &entry, astring &string);
// device_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const { return 4; }
virtual UINT32 disasm_max_opcode_bytes() const { return 4; }
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
@ -218,6 +172,7 @@ protected:
inline UINT32 opcode_read();
// address spaces
const address_space_config m_program_config;
address_space *m_program;
direct_read_data *m_direct;
@ -311,6 +266,19 @@ protected:
void docop2( int gteop );
};
class cxd8661r_device : public psxcpu_device
{
public:
// construction/destruction
cxd8661r_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
// device type definition
extern const device_type PSXCPU;
extern const device_type CXD8661R;
#define PSXCPU_DELAYR_PC ( 32 )
#define PSXCPU_DELAYR_NOTPC ( 33 )

View File

@ -299,7 +299,7 @@ static void set_irq_line(r3000_state *r3000, int irqline, int state)
static CPU_INIT( r3000 )
{
const r3000_cpu_core *configdata = (const r3000_cpu_core *)device->baseconfig().static_config();
const r3000_cpu_core *configdata = (const r3000_cpu_core *)device->static_config();
r3000_state *r3000 = get_safe_token(device);
/* allocate memory */

View File

@ -398,7 +398,7 @@ static CPU_DISASSEMBLE( v25 )
static void v25_init(legacy_cpu_device *device, device_irq_callback irqcallback, int type)
{
const nec_config *config = device->baseconfig().static_config() ? (const nec_config *)device->baseconfig().static_config() : &default_config;
const nec_config *config = device->static_config() ? (const nec_config *)device->static_config() : &default_config;
v25_state_t *nec_state = get_safe_token(device);
unsigned int i, j, c;

View File

@ -537,7 +537,7 @@ static void pdp1_set_irq_line (pdp1_state *cpustate, int irqline, int state)
static CPU_INIT( pdp1 )
{
const pdp1_reset_param_t *param = (const pdp1_reset_param_t *)device->baseconfig().static_config();
const pdp1_reset_param_t *param = (const pdp1_reset_param_t *)device->static_config();
pdp1_state *cpustate = get_safe_token(device);
int i;

View File

@ -130,7 +130,7 @@ static void tx0_init_common(legacy_cpu_device *device, device_irq_callback irqca
tx0_state *cpustate = get_safe_token(device);
/* clean-up */
cpustate->iface = (const tx0_reset_param_t *)device->baseconfig().static_config();
cpustate->iface = (const tx0_reset_param_t *)device->static_config();
cpustate->address_mask = is_64kw ? ADDRESS_MASK_64KW : ADDRESS_MASK_8KW;
cpustate->ir_mask = is_64kw ? 03 : 037;

View File

@ -929,7 +929,7 @@ static void ppc_init(void)
// !!! probably should move this stuff elsewhere !!!
static CPU_INIT( ppc403 )
{
const ppc_config *configdata = device->baseconfig().static_config();
const ppc_config *configdata = device->static_config();
ppc_init();
@ -975,7 +975,7 @@ static CPU_EXIT( ppc403 )
static CPU_INIT( ppc603 )
{
const ppc_config *configdata = device->baseconfig().static_config();
const ppc_config *configdata = device->static_config();
int pll_config = 0;
float multiplier;
int i ;
@ -1120,7 +1120,7 @@ static CPU_EXIT( ppc603 )
static CPU_INIT( ppc602 )
{
float multiplier;
const ppc_config *configdata = device->baseconfig().static_config();
const ppc_config *configdata = device->static_config();
int i ;
@ -1263,7 +1263,7 @@ static void mpc8240_tlbld(UINT32 op)
static CPU_INIT( mpc8240 )
{
float multiplier;
const ppc_config *configdata = device->baseconfig().static_config();
const ppc_config *configdata = device->static_config();
int i ;
@ -1393,7 +1393,7 @@ static CPU_EXIT( mpc8240 )
static CPU_INIT( ppc601 )
{
const ppc_config *configdata = device->baseconfig().static_config();
const ppc_config *configdata = device->static_config();
float multiplier;
int i ;
@ -1521,7 +1521,7 @@ static CPU_EXIT( ppc601 )
static CPU_INIT( ppc604 )
{
const ppc_config *configdata = device->baseconfig().static_config();
const ppc_config *configdata = device->static_config();
float multiplier;
int i ;

View File

@ -304,7 +304,7 @@ INLINE int sign_double(double x)
void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_divisor, legacy_cpu_device *device, device_irq_callback irqcallback)
{
const powerpc_config *config = (const powerpc_config *)device->baseconfig().static_config();
const powerpc_config *config = (const powerpc_config *)device->static_config();
/* initialize based on the config */
memset(ppc, 0, sizeof(*ppc));

View File

@ -274,7 +274,7 @@ static CPU_INIT( rsp )
rsp_state *rsp = get_safe_token(device);
int regIdx;
int accumIdx;
rsp->config = (const rsp_config *)device->baseconfig().static_config();
rsp->config = (const rsp_config *)device->static_config();
if (LOG_INSTRUCTION_EXECUTION)
rsp->exec_output = fopen("rsp_execute.txt", "wt");

View File

@ -569,7 +569,7 @@ static void rspcom_init(rsp_state *rsp, legacy_cpu_device *device, device_irq_ca
memset(rsp, 0, sizeof(*rsp));
rsp->config = (const rsp_config *)device->baseconfig().static_config();
rsp->config = (const rsp_config *)device->static_config();
rsp->irq_callback = irqcallback;
rsp->device = device;
rsp->program = device->space(AS_PROGRAM);

View File

@ -112,7 +112,7 @@ static CPU_INIT( saturn )
{
saturn_state *cpustate = get_safe_token(device);
cpustate->config = (saturn_cpu_core *) device->baseconfig().static_config();
cpustate->config = (saturn_cpu_core *) device->static_config();
cpustate->irq_callback = irqcallback;
cpustate->device = device;
cpustate->program = device->space(AS_PROGRAM);

View File

@ -103,7 +103,7 @@ static CPU_RESET( sc61860 )
static CPU_INIT( sc61860 )
{
sc61860_state *cpustate = get_safe_token(device);
cpustate->config = (sc61860_cpu_core *) device->baseconfig().static_config();
cpustate->config = (sc61860_cpu_core *) device->static_config();
device->machine().scheduler().timer_pulse(attotime::from_hz(500), FUNC(sc61860_2ms_tick), 0, cpustate);
cpustate->device = device;
cpustate->program = device->space(AS_PROGRAM);

View File

@ -494,8 +494,8 @@ static CPU_INIT( scmp )
{
scmp_state *cpustate = get_safe_token(device);
if (device->baseconfig().static_config() != NULL)
cpustate->config = *(scmp_config *)device->baseconfig().static_config();
if (device->static_config() != NULL)
cpustate->config = *(scmp_config *)device->static_config();
/* set up the state table */
{

View File

@ -920,7 +920,7 @@ void sh2_exception(sh2_state *sh2, const char *message, int irqline)
void sh2_common_init(sh2_state *sh2, legacy_cpu_device *device, device_irq_callback irqcallback)
{
const sh2_cpu_core *conf = (const sh2_cpu_core *)device->baseconfig().static_config();
const sh2_cpu_core *conf = (const sh2_cpu_core *)device->static_config();
int i;
sh2->timer = device->machine().scheduler().timer_alloc(FUNC(sh2_timer_callback), sh2);

View File

@ -3377,7 +3377,7 @@ static CPU_EXECUTE( sh4 )
static CPU_INIT( sh4 )
{
const struct sh4_config *conf = (const struct sh4_config *)device->baseconfig().static_config();
const struct sh4_config *conf = (const struct sh4_config *)device->static_config();
sh4_state *sh4 = get_safe_token(device);
sh4_common_init(device);

View File

@ -418,7 +418,7 @@ void sharc_external_dma_write(device_t *device, UINT32 address, UINT64 data)
static CPU_INIT( sharc )
{
SHARC_REGS *cpustate = get_safe_token(device);
const sharc_config *cfg = (const sharc_config *)device->baseconfig().static_config();
const sharc_config *cfg = (const sharc_config *)device->static_config();
int saveindex;
cpustate->boot_mode = cfg->boot_mode;

View File

@ -126,9 +126,9 @@ static CPU_INIT( sm8500 )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
cpustate->program = device->space(AS_PROGRAM);
if ( device->baseconfig().static_config() != NULL ) {
cpustate->config.handle_dma = ((SM8500_CONFIG *)device->baseconfig().static_config())->handle_dma;
cpustate->config.handle_timers = ((SM8500_CONFIG *)device->baseconfig().static_config())->handle_timers;
if ( device->static_config() != NULL ) {
cpustate->config.handle_dma = ((SM8500_CONFIG *)device->static_config())->handle_dma;
cpustate->config.handle_timers = ((SM8500_CONFIG *)device->static_config())->handle_timers;
} else {
cpustate->config.handle_dma = NULL;
cpustate->config.handle_timers = NULL;

View File

@ -754,9 +754,9 @@ static CPU_INIT( superfx )
cpustate->device = device;
cpustate->program = device->space(AS_PROGRAM);
if (device->baseconfig().static_config() != NULL)
if (device->static_config() != NULL)
{
cpustate->config = *(superfx_config *)device->baseconfig().static_config();
cpustate->config = *(superfx_config *)device->static_config();
}
devcb_resolve_write_line(&cpustate->out_irq_func, &cpustate->config.out_irq_func, device);

View File

@ -258,7 +258,7 @@ static CPU_INIT( t11 )
0xc000, 0x8000, 0x4000, 0x2000,
0x1000, 0x0000, 0xf600, 0xf400
};
const struct t11_setup *setup = (const struct t11_setup *)device->baseconfig().static_config();
const struct t11_setup *setup = (const struct t11_setup *)device->static_config();
t11_state *cpustate = get_safe_token(device);
cpustate->initial_pc = initial_pc[setup->mode >> 13];

View File

@ -217,7 +217,7 @@ static CPU_INIT( tlcs900 )
{
tlcs900_state *cpustate = get_safe_token(device);
cpustate->intf = (const tlcs900_interface *)device->baseconfig().static_config();
cpustate->intf = (const tlcs900_interface *)device->static_config();
cpustate->irqcallback = irqcallback;
cpustate->device = device;
cpustate->program = device->space( AS_PROGRAM );

View File

@ -494,7 +494,7 @@ static void cpu_init_tms_common( legacy_cpu_device *device, const UINT32* decode
{
tms0980_state *cpustate = get_safe_token( device );
cpustate->config = (const tms0980_config *) device->baseconfig().static_config();
cpustate->config = (const tms0980_config *) device->static_config();
assert( cpustate->config != NULL );

View File

@ -138,10 +138,10 @@ void tms3203x_device::update_special(int dreg)
}
else if (dreg == TMR_IOF)
{
if (m_config.m_xf0_w != NULL && IREG(TMR_IOF) & 0x002)
(*m_config.m_xf0_w)(*this, (IREG(TMR_IOF) >> 2) & 1);
if (m_config.m_xf1_w != NULL && IREG(TMR_IOF) & 0x020)
(*m_config.m_xf1_w)(*this, (IREG(TMR_IOF) >> 6) & 1);
if (m_xf0_w != NULL && IREG(TMR_IOF) & 0x002)
(*m_xf0_w)(*this, (IREG(TMR_IOF) >> 2) & 1);
if (m_xf1_w != NULL && IREG(TMR_IOF) & 0x020)
(*m_xf1_w)(*this, (IREG(TMR_IOF) >> 6) & 1);
}
else if (dreg == TMR_ST || dreg == TMR_IF || dreg == TMR_IE)
check_irqs();
@ -3142,21 +3142,21 @@ void tms3203x_device::xor_imm(UINT32 op)
void tms3203x_device::iack_dir(UINT32 op)
{
offs_t addr = DIRECT(op);
if (m_config.m_iack_w)
(*m_config.m_iack_w)(*this, ASSERT_LINE, addr);
if (m_iack_w)
(*m_iack_w)(*this, ASSERT_LINE, addr);
RMEM(addr);
if (m_config.m_iack_w)
(*m_config.m_iack_w)(*this, CLEAR_LINE, addr);
if (m_iack_w)
(*m_iack_w)(*this, CLEAR_LINE, addr);
}
void tms3203x_device::iack_ind(UINT32 op)
{
offs_t addr = INDIRECT_D(op, op >> 8);
if (m_config.m_iack_w)
(*m_config.m_iack_w)(*this, ASSERT_LINE, addr);
if (m_iack_w)
(*m_iack_w)(*this, ASSERT_LINE, addr);
RMEM(addr);
if (m_config.m_iack_w)
(*m_config.m_iack_w)(*this, CLEAR_LINE, addr);
if (m_iack_w)
(*m_iack_w)(*this, CLEAR_LINE, addr);
}
/*-----------------------------------------------------*/
@ -5671,7 +5671,7 @@ void tms3203x_device::trap(int trapnum)
{
WMEM(++IREG(TMR_SP), m_pc);
IREG(TMR_ST) &= ~GIEFLAG;
if (m_config.m_chip_type == tms3203x_device_config::CHIP_TYPE_TMS32032)
if (m_chip_type == CHIP_TYPE_TMS32032)
m_pc = RMEM(((IREG(TMR_IF) >> 16) << 8) + trapnum);
else if (m_mcu_mode)
m_pc = 0x809fc0 + trapnum;

View File

@ -115,9 +115,9 @@ const int GIEFLAG = 0x2000;
// GLOBAL VARIABLES
//**************************************************************************
// device definitions
const device_type TMS32031 = tms32031_device_config::static_alloc_device_config;
const device_type TMS32032 = tms32032_device_config::static_alloc_device_config;
// device type definition
const device_type TMS32031 = &device_creator<tms32031_device>;
const device_type TMS32032 = &device_creator<tms32032_device>;
// internal memory maps
static ADDRESS_MAP_START( internal_32031, AS_PROGRAM, 32 )
@ -130,143 +130,6 @@ ADDRESS_MAP_END
//**************************************************************************
// TMS3203X DEVICE CONFIG
//**************************************************************************
//-------------------------------------------------
// tms3203x_device_config - constructor
//-------------------------------------------------
tms3203x_device_config::tms3203x_device_config(const machine_config &mconfig, device_type type, const char *name, const char *tag, const device_config *owner, UINT32 clock, UINT32 chiptype, address_map_constructor internal_map)
: cpu_device_config(mconfig, type, name, tag, owner, clock),
m_program_config("program", ENDIANNESS_LITTLE, 32, 24, -2, internal_map),
m_chip_type(chiptype)
{
m_bootoffset = 0;
m_xf0_w = NULL;
m_xf1_w = NULL;
m_iack_w = NULL;
}
tms32031_device_config::tms32031_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
: tms3203x_device_config(mconfig, static_alloc_device_config, "TMS32031", tag, owner, clock, CHIP_TYPE_TMS32031, ADDRESS_MAP_NAME(internal_32031)) { }
tms32032_device_config::tms32032_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
: tms3203x_device_config(mconfig, static_alloc_device_config, "TMS32032", tag, owner, clock, CHIP_TYPE_TMS32032, ADDRESS_MAP_NAME(internal_32032)) { }
//-------------------------------------------------
// static_alloc_device_config - allocate a new
// configuration object
//-------------------------------------------------
device_config *tms32031_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
{
return global_alloc(tms32031_device_config(mconfig, tag, owner, clock));
}
device_config *tms32032_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
{
return global_alloc(tms32032_device_config(mconfig, tag, owner, clock));
}
//-------------------------------------------------
// alloc_device - allocate a new device object
//-------------------------------------------------
device_t *tms32031_device_config::alloc_device(running_machine &machine) const
{
return auto_alloc(machine, tms32031_device(machine, *this));
}
device_t *tms32032_device_config::alloc_device(running_machine &machine) const
{
return auto_alloc(machine, tms32032_device(machine, *this));
}
//-------------------------------------------------
// static_set_config - set the configuration
// structure
//-------------------------------------------------
void tms3203x_device_config::static_set_config(device_config *device, const tms3203x_config &config)
{
tms3203x_device_config *tms = downcast<tms3203x_device_config *>(device);
*static_cast<tms3203x_config *>(tms) = config;
}
//-------------------------------------------------
// execute_min_cycles - return minimum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 tms3203x_device_config::execute_min_cycles() const
{
return 1;
}
//-------------------------------------------------
// execute_max_cycles - return maximum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 tms3203x_device_config::execute_max_cycles() const
{
return 4;
}
//-------------------------------------------------
// execute_input_lines - return the number of
// input/interrupt lines
//-------------------------------------------------
UINT32 tms3203x_device_config::execute_input_lines() const
{
return 11;
}
//-------------------------------------------------
// memory_space_config - return the configuration
// of the specified address space, or NULL if
// the space doesn't exist
//-------------------------------------------------
const address_space_config *tms3203x_device_config::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_PROGRAM) ? &m_program_config : NULL;
}
//-------------------------------------------------
// disasm_min_opcode_bytes - return the length
// of the shortest instruction, in bytes
//-------------------------------------------------
UINT32 tms3203x_device_config::disasm_min_opcode_bytes() const
{
return 4;
}
//-------------------------------------------------
// disasm_max_opcode_bytes - return the length
// of the longest instruction, in bytes
//-------------------------------------------------
UINT32 tms3203x_device_config::disasm_max_opcode_bytes() const
{
return 4;
}
//**************************************************************************
// TMSREG REGISTER
//**************************************************************************
@ -403,9 +266,10 @@ void tms3203x_device::tmsreg::from_double(double val)
// tms3203x_device - constructor
//-------------------------------------------------
tms3203x_device::tms3203x_device(running_machine &_machine, const tms3203x_device_config &config)
: cpu_device(_machine, config),
m_config(config),
tms3203x_device::tms3203x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 chiptype, address_map_constructor internal_map)
: cpu_device(mconfig, type, name, tag, owner, clock),
m_program_config("program", ENDIANNESS_LITTLE, 32, 24, -2, internal_map),
m_chip_type(chiptype),
m_pc(0),
m_bkmask(0),
m_irq_state(0),
@ -418,6 +282,11 @@ tms3203x_device::tms3203x_device(running_machine &_machine, const tms3203x_devic
m_program(0),
m_direct(0)
{
m_bootoffset = 0;
m_xf0_w = NULL;
m_xf1_w = NULL;
m_iack_w = NULL;
// initialize remaining state
memset(&m_r, 0, sizeof(m_r));
@ -429,11 +298,11 @@ tms3203x_device::tms3203x_device(running_machine &_machine, const tms3203x_devic
#endif
}
tms32031_device::tms32031_device(running_machine &_machine, const tms32031_device_config &config)
: tms3203x_device(_machine, config) { }
tms32031_device::tms32031_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: tms3203x_device(mconfig, TMS32031, "TMS32031", tag, owner, clock, CHIP_TYPE_TMS32031, ADDRESS_MAP_NAME(internal_32031)) { }
tms32032_device::tms32032_device(running_machine &_machine, const tms32032_device_config &config)
: tms3203x_device(_machine, config) { }
tms32032_device::tms32032_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: tms3203x_device(mconfig, TMS32032, "TMS32032", tag, owner, clock, CHIP_TYPE_TMS32032, ADDRESS_MAP_NAME(internal_32032)) { }
//-------------------------------------------------
@ -450,6 +319,18 @@ tms3203x_device::~tms3203x_device()
}
//-------------------------------------------------
// static_set_config - set the configuration
// structure
//-------------------------------------------------
void tms3203x_device::static_set_config(device_t &device, const tms3203x_config &config)
{
tms3203x_device &tms = downcast<tms3203x_device &>(device);
static_cast<tms3203x_config &>(tms) = config;
}
//-------------------------------------------------
// ROPCODE - fetch an opcode
//-------------------------------------------------
@ -551,10 +432,10 @@ void tms3203x_device::device_start()
void tms3203x_device::device_reset()
{
// if we have a config struct, get the boot ROM address
if (m_config.m_bootoffset != 0)
if (m_bootoffset != 0)
{
m_mcu_mode = true;
m_pc = boot_loader(m_config.m_bootoffset);
m_pc = boot_loader(m_bootoffset);
}
else
{
@ -573,6 +454,18 @@ void tms3203x_device::device_reset()
}
//-------------------------------------------------
// memory_space_config - return the configuration
// of the specified address space, or NULL if
// the space doesn't exist
//-------------------------------------------------
const address_space_config *tms3203x_device::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_PROGRAM) ? &m_program_config : NULL;
}
//-------------------------------------------------
// state_import - import state into the device,
// after it has been set
@ -663,6 +556,28 @@ void tms3203x_device::state_string_export(const device_state_entry &entry, astri
}
//-------------------------------------------------
// disasm_min_opcode_bytes - return the length
// of the shortest instruction, in bytes
//-------------------------------------------------
UINT32 tms3203x_device::disasm_min_opcode_bytes() const
{
return 4;
}
//-------------------------------------------------
// disasm_max_opcode_bytes - return the length
// of the longest instruction, in bytes
//-------------------------------------------------
UINT32 tms3203x_device::disasm_max_opcode_bytes() const
{
return 4;
}
//-------------------------------------------------
// disasm_disassemble - call the disassembly
// helper function
@ -766,7 +681,7 @@ void tms3203x_device::check_irqs()
// after auto-clearing the interrupt bit, we need to re-trigger
// level-sensitive interrupts
if (m_config.m_chip_type == tms3203x_device_config::CHIP_TYPE_TMS32031 || (IREG(TMR_ST) & 0x4000) == 0)
if (m_chip_type == CHIP_TYPE_TMS32031 || (IREG(TMR_ST) & 0x4000) == 0)
IREG(TMR_IF) |= m_irq_state & 0x0f;
}
else
@ -774,6 +689,39 @@ void tms3203x_device::check_irqs()
}
//-------------------------------------------------
// execute_min_cycles - return minimum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 tms3203x_device::execute_min_cycles() const
{
return 1;
}
//-------------------------------------------------
// execute_max_cycles - return maximum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 tms3203x_device::execute_max_cycles() const
{
return 4;
}
//-------------------------------------------------
// execute_input_lines - return the number of
// input/interrupt lines
//-------------------------------------------------
UINT32 tms3203x_device::execute_input_lines() const
{
return 11;
}
//-------------------------------------------------
// execute_set_input - set input and IRQ lines
//-------------------------------------------------
@ -797,7 +745,7 @@ void tms3203x_device::execute_set_input(int inputnum, int state)
// external interrupts are level-sensitive on the '31 and can be
// configured as such on the '32; in that case, if the external
// signal is high, we need to update the value in IF accordingly
if (m_config.m_chip_type == tms3203x_device_config::CHIP_TYPE_TMS32031 || (IREG(TMR_ST) & 0x4000) == 0)
if (m_chip_type == CHIP_TYPE_TMS32031 || (IREG(TMR_ST) & 0x4000) == 0)
IREG(TMR_IF) |= m_irq_state & 0x0f;
}

View File

@ -119,17 +119,7 @@ enum
//**************************************************************************
#define MCFG_TMS3203X_CONFIG(_config) \
tms3203x_device_config::static_set_config(device, _config); \
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
// device type definition
extern const device_type TMS32031;
extern const device_type TMS32032;
tms3203x_device::static_set_config(*device, _config); \
@ -156,55 +146,11 @@ struct tms3203x_config
// ======================> tms3203x_device_config
class tms3203x_device_config : public cpu_device_config,
public tms3203x_config
{
friend class tms3203x_device;
protected:
enum
{
CHIP_TYPE_TMS32031,
CHIP_TYPE_TMS32032,
};
// construction/destruction
tms3203x_device_config(const machine_config &mconfig, device_type type, const char *name, const char *tag, const device_config *owner, UINT32 clock, UINT32 chiptype, address_map_constructor internal_map);
public:
// inline configuration helpers
static void static_set_config(device_config *device, const tms3203x_config &config);
protected:
// device_config_execute_interface overrides
virtual UINT32 execute_min_cycles() const;
virtual UINT32 execute_max_cycles() const;
virtual UINT32 execute_input_lines() const;
// device_config_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
// device_config_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const;
virtual UINT32 disasm_max_opcode_bytes() const;
// address spaces
const address_space_config m_program_config;
// internal state
UINT32 m_chip_type;
};
// ======================> tms3203x_device
class tms3203x_device : public cpu_device
class tms3203x_device : public cpu_device,
public tms3203x_config
{
friend class tms3203x_device_config;
struct tmsreg
{
// constructors
@ -230,11 +176,20 @@ class tms3203x_device : public cpu_device
};
protected:
enum
{
CHIP_TYPE_TMS32031,
CHIP_TYPE_TMS32032,
};
// construction/destruction
tms3203x_device(running_machine &_machine, const tms3203x_device_config &config);
tms3203x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 chiptype, address_map_constructor internal_map);
virtual ~tms3203x_device();
public:
// inline configuration helpers
static void static_set_config(device_t &device, const tms3203x_config &config);
// public interfaces
static float fp_to_float(UINT32 floatdata);
static double fp_to_double(UINT32 floatdata);
@ -247,15 +202,23 @@ protected:
virtual void device_reset();
// device_execute_interface overrides
virtual UINT32 execute_min_cycles() const;
virtual UINT32 execute_max_cycles() const;
virtual UINT32 execute_input_lines() const;
virtual void execute_run();
virtual void execute_set_input(int inputnum, int state);
// device_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
// device_state_interface overrides
virtual void state_import(const device_state_entry &entry);
virtual void state_export(const device_state_entry &entry);
virtual void state_string_export(const device_state_entry &entry, astring &string);
// device_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const;
virtual UINT32 disasm_max_opcode_bytes() const;
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
// memory helpers
@ -816,7 +779,8 @@ protected:
void xor3sti(UINT32 op);
// configuration
const tms3203x_device_config &m_config;
const address_space_config m_program_config;
UINT32 m_chip_type;
union int_double
{
@ -855,47 +819,13 @@ protected:
};
// ======================> tms32031_device_config
class tms32031_device_config : public tms3203x_device_config
{
friend class tms32031_device;
// construction/destruction
tms32031_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
public:
// allocators
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
virtual device_t *alloc_device(running_machine &machine) const;
};
// ======================> tms32031_device
class tms32031_device : public tms3203x_device
{
friend class tms32031_device_config;
// construction/destruction
tms32031_device(running_machine &_machine, const tms32031_device_config &config);
};
// ======================> tms32032_device_config
class tms32032_device_config : public tms3203x_device_config
{
friend class tms32032_device;
protected:
// construction/destruction
tms32032_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
public:
// allocators
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
virtual device_t *alloc_device(running_machine &machine) const;
// construction/destruction
tms32031_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
@ -903,12 +833,16 @@ public:
class tms32032_device : public tms3203x_device
{
friend class tms32032_device_config;
protected:
public:
// construction/destruction
tms32032_device(running_machine &_machine, const tms32032_device_config &config);
tms32032_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
// device type definition
extern const device_type TMS32031;
extern const device_type TMS32032;
#endif /* __TMS32031_H__ */

View File

@ -620,7 +620,7 @@ static void check_interrupt(tms34010_state *tms)
static CPU_INIT( tms34010 )
{
const tms34010_config *configdata = device->baseconfig().static_config() ? (const tms34010_config *)device->baseconfig().static_config() : &default_config;
const tms34010_config *configdata = device->static_config() ? (const tms34010_config *)device->static_config() : &default_config;
tms34010_state *tms = get_safe_token(device);
tms->external_host_access = FALSE;
@ -1087,7 +1087,7 @@ SCREEN_UPDATE( tms340x0 )
int x;
/* find the owning CPU */
for (cpu = screen->machine().m_devicelist.first(); cpu != NULL; cpu = cpu->next())
for (cpu = screen->machine().devicelist().first(); cpu != NULL; cpu = cpu->next())
{
device_type type = cpu->type();
if (type == TMS34010 || type == TMS34020)

View File

@ -1286,7 +1286,7 @@ static void register_for_save_state(device_t *device)
static CPU_INIT( tms99xx )
{
const TMS99XX_RESET_PARAM *param = (const TMS99XX_RESET_PARAM *) device->baseconfig().static_config();
const TMS99XX_RESET_PARAM *param = (const TMS99XX_RESET_PARAM *) device->static_config();
tms99xx_state *cpustate = get_safe_token(device);
register_for_save_state(device);
@ -4630,7 +4630,7 @@ static CPU_SET_INFO( tms99xx )
* Generic get_info
**************************************************************************/
void TMS99XX_GET_INFO(const device_config *devconfig, legacy_cpu_device *device, UINT32 state, cpuinfo *info)
void TMS99XX_GET_INFO(legacy_cpu_device *device, UINT32 state, cpuinfo *info)
{
tms99xx_state *cpustate = (device != NULL && device->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)

View File

@ -13,151 +13,44 @@
#include "debugger.h"
#include "upd7725.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
const device_type UPD7725 = upd7725_device_config::static_alloc_device_config;
const device_type UPD96050 = upd96050_device_config::static_alloc_device_config;
//**************************************************************************
// UPD7725 DEVICE CONFIG
// DEVICE INTERFACE
//**************************************************************************
//-------------------------------------------------
// necdsp_device_config - constructor
//-------------------------------------------------
// device type definition
const device_type UPD7725 = &device_creator<upd7725_device>;
const device_type UPD96050 = &device_creator<upd96050_device>;
necdsp_device_config::necdsp_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock, UINT32 abits, UINT32 dbits, const char *name)
: cpu_device_config(mconfig, static_alloc_device_config, name, tag, owner, clock),
necdsp_device::necdsp_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, UINT32 abits, UINT32 dbits, const char *name)
: cpu_device(mconfig, type, name, tag, owner, clock),
m_program_config("program", ENDIANNESS_BIG, 32, abits, -2), // data bus width, address bus width, -2 means DWORD-addressable
m_data_config("data", ENDIANNESS_BIG, 16, dbits, -1) // -1 for WORD-addressable
m_data_config("data", ENDIANNESS_BIG, 16, dbits, -1), // -1 for WORD-addressable
m_irq(0),
m_program(NULL),
m_data(NULL),
m_direct(NULL)
{
}
upd7725_device_config::upd7725_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
: necdsp_device_config(mconfig, tag, owner, clock, 11, 11, "uPD7725")
upd7725_device::upd7725_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: necdsp_device(mconfig, UPD7725, tag, owner, clock, 11, 11, "uPD7725")
{
}
upd96050_device_config::upd96050_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
: necdsp_device_config(mconfig, tag, owner, clock, 14, 12, "uPD96050")
upd96050_device::upd96050_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: necdsp_device(mconfig, UPD96050, tag, owner, clock, 14, 12, "uPD96050")
{
}
//-------------------------------------------------
// static_alloc_device_config - allocate a new
// configuration object
//-------------------------------------------------
device_config *necdsp_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
{
return global_alloc(necdsp_device_config(mconfig, tag, owner, clock, 13, 11, "NECDSP"));
}
device_config *upd7725_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
{
return global_alloc(upd7725_device_config(mconfig, tag, owner, clock));
}
device_config *upd96050_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
{
return global_alloc(upd96050_device_config(mconfig, tag, owner, clock));
}
//-------------------------------------------------
// alloc_device - allocate a new device object
//-------------------------------------------------
device_t *necdsp_device_config::alloc_device(running_machine &machine) const
{
return auto_alloc(machine, necdsp_device(machine, *this));
}
device_t *upd7725_device_config::alloc_device(running_machine &machine) const
{
return auto_alloc(machine, upd7725_device(machine, *this));
}
device_t *upd96050_device_config::alloc_device(running_machine &machine) const
{
return auto_alloc(machine, upd96050_device(machine, *this));
}
//-------------------------------------------------
// execute_min_cycles - return minimum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 necdsp_device_config::execute_min_cycles() const
{
return 4;
}
//-------------------------------------------------
// execute_max_cycles - return maximum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 necdsp_device_config::execute_max_cycles() const
{
return 4;
}
//-------------------------------------------------
// execute_input_lines - return the number of
// input/interrupt lines
//-------------------------------------------------
UINT32 necdsp_device_config::execute_input_lines() const
{
return 3; // TODO: there should be 11: INT, SCK, /SIEN, /SOEN, SI, and /DACK, plus SO, /SORQ and DRQ; for now, just INT, P0, and P1 are enough.
}
//-------------------------------------------------
// memory_space_config - return the configuration
// of the specified address space, or NULL if
// the space doesn't exist
//-------------------------------------------------
const address_space_config *necdsp_device_config::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_PROGRAM) ? &m_program_config : &m_data_config;
}
//-------------------------------------------------
// disasm_min_opcode_bytes - return the length
// of the shortest instruction, in bytes
//-------------------------------------------------
UINT32 necdsp_device_config::disasm_min_opcode_bytes() const
{
return 4;
}
//-------------------------------------------------
// disasm_max_opcode_bytes - return the length
// of the longest instruction, in bytes
//-------------------------------------------------
UINT32 necdsp_device_config::disasm_max_opcode_bytes() const
{
return 4;
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void necdsp_device_config::device_config_complete()
void necdsp_device::device_config_complete()
{
// inherit a copy of the static data
const necdsp_interface *intf = reinterpret_cast<const necdsp_interface *>(static_config());
@ -180,32 +73,6 @@ void necdsp_device_config::device_config_complete()
//memset(&m_out_drq_func, 0, sizeof(m_out_drq_func));
}
}
//**************************************************************************
// DEVICE INTERFACE
//**************************************************************************
necdsp_device::necdsp_device(running_machine &_machine, const necdsp_device_config &config)
: cpu_device(_machine, config),
m_irq(0),
m_program(NULL),
m_data(NULL),
m_direct(NULL),
m_config(config)
{
}
upd7725_device::upd7725_device(running_machine &_machine, const upd7725_device_config &config)
: necdsp_device(_machine, config)
{
}
upd96050_device::upd96050_device(running_machine &_machine, const upd96050_device_config &config)
: necdsp_device(_machine, config)
{
}
//-------------------------------------------------
// device_start - start up the device
//-------------------------------------------------
@ -238,17 +105,17 @@ void necdsp_device::device_start()
state_add(UPD7725_IDB, "IDB", regs.idb);
// resolve callbacks
devcb_resolve_read_line(&m_in_int_func, &m_config.m_in_int_func, this);
//devcb_resolve_read8(&m_in_si_func, &m_config.m_in_si_func, this);
//devcb_resolve_read_line(&m_in_sck_func, &m_config.m_in_sck_func, this);
//devcb_resolve_read_line(&m_in_sien_func, &m_config.m_in_sien_func, this);
//devcb_resolve_read_line(&m_in_soen_func, &m_config.m_in_soen_func, this);
//devcb_resolve_read_line(&m_in_dack_func, &m_config.m_in_dack_func, this);
devcb_resolve_write_line(&m_out_p0_func, &m_config.m_out_p0_func, this);
devcb_resolve_write_line(&m_out_p1_func, &m_config.m_out_p1_func, this);
//devcb_resolve_write8(&m_out_so_func, &m_config.m_out_so_func, this);
//devcb_resolve_write_line(&m_out_sorq_func, &m_config.m_out_sorq_func, this);
//devcb_resolve_write_line(&m_out_drq_func, &m_config.m_out_drq_func, this);
devcb_resolve_read_line(&m_in_int_func, &m_in_int_cb, this);
//devcb_resolve_read8(&m_in_si_func, &m_in_si_cb, this);
//devcb_resolve_read_line(&m_in_sck_func, &m_in_sck_cb, this);
//devcb_resolve_read_line(&m_in_sien_func, &m_in_sien_cb, this);
//devcb_resolve_read_line(&m_in_soen_func, &m_in_soen_cb, this);
//devcb_resolve_read_line(&m_in_dack_func, &m_in_dack_cb, this);
devcb_resolve_write_line(&m_out_p0_func, &m_out_p0_cb, this);
devcb_resolve_write_line(&m_out_p1_func, &m_out_p1_cb, this);
//devcb_resolve_write8(&m_out_so_func, &m_out_so_cb, this);
//devcb_resolve_write_line(&m_out_sorq_func, &m_out_sorq_cb, this);
//devcb_resolve_write_line(&m_out_drq_func, &m_out_drq_cb, this);
// save state registrations
save_item(NAME(regs.pc));
@ -315,6 +182,18 @@ void necdsp_device::device_reset()
regs.idb = 0x0000;
}
//-------------------------------------------------
// memory_space_config - return the configuration
// of the specified address space, or NULL if
// the space doesn't exist
//-------------------------------------------------
const address_space_config *necdsp_device::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_PROGRAM) ? &m_program_config : &m_data_config;
}
//-------------------------------------------------
// state_import - import state into the device,
// after it has been set
@ -366,6 +245,39 @@ void necdsp_device::state_string_export(const device_state_entry &entry, astring
}
}
//-------------------------------------------------
// execute_min_cycles - return minimum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 necdsp_device::execute_min_cycles() const
{
return 4;
}
//-------------------------------------------------
// execute_max_cycles - return maximum number of
// cycles it takes for one instruction to execute
//-------------------------------------------------
UINT32 necdsp_device::execute_max_cycles() const
{
return 4;
}
//-------------------------------------------------
// execute_input_lines - return the number of
// input/interrupt lines
//-------------------------------------------------
UINT32 necdsp_device::execute_input_lines() const
{
return 3; // TODO: there should be 11: INT, SCK, /SIEN, /SOEN, SI, and /DACK, plus SO, /SORQ and DRQ; for now, just INT, P0, and P1 are enough.
}
//-------------------------------------------------
// execute_set_input -
//-------------------------------------------------
@ -382,6 +294,27 @@ void necdsp_device::execute_set_input(int inputnum, int state)
}
}
//-------------------------------------------------
// disasm_min_opcode_bytes - return the length
// of the shortest instruction, in bytes
//-------------------------------------------------
UINT32 necdsp_device::disasm_min_opcode_bytes() const
{
return 4;
}
//-------------------------------------------------
// disasm_max_opcode_bytes - return the length
// of the longest instruction, in bytes
//-------------------------------------------------
UINT32 necdsp_device::disasm_max_opcode_bytes() const
{
return 4;
}
//-------------------------------------------------
// disasm_disassemble - call the disassembly
// helper function

View File

@ -34,92 +34,29 @@ class upd96050_device;
struct necdsp_interface
{
devcb_read_line m_in_int_func;
//devcb_read8 m_in_si_func;
//devcb_read_line m_in_sck_func;
//devcb_read_line m_in_sien_func;
//devcb_read_line m_in_soen_func;
//devcb_read_line m_in_dack_func;
devcb_write_line m_out_p0_func;
devcb_write_line m_out_p1_func;
//devcb_write8 m_out_so_func;
//devcb_write_line m_out_sorq_func;
//devcb_write_line m_out_drq_func;
devcb_read_line m_in_int_cb;
//devcb_read8 m_in_si_cb;
//devcb_read_line m_in_sck_cb;
//devcb_read_line m_in_sien_cb;
//devcb_read_line m_in_soen_cb;
//devcb_read_line m_in_dack_cb;
devcb_write_line m_out_p0_cb;
devcb_write_line m_out_p1_cb;
//devcb_write8 m_out_so_cb;
//devcb_write_line m_out_sorq_cb;
//devcb_write_line m_out_drq_cb;
};
#define NECDSP_INTERFACE(name) \
const necdsp_interface (name) =
// ======================> necdsp_device_config
class necdsp_device_config : public cpu_device_config, public necdsp_interface
{
friend class necdsp_device;
protected:
// construction/destruction
necdsp_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock, UINT32 abits, UINT32 dbits, const char *name);
public:
// allocators
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
virtual device_t *alloc_device(running_machine &machine) const;
protected:
// device_config overrides
virtual void device_config_complete();
// device_config_execute_interface overrides
virtual UINT32 execute_min_cycles() const;
virtual UINT32 execute_max_cycles() const;
virtual UINT32 execute_input_lines() const;
// device_config_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
// device_config_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const;
virtual UINT32 disasm_max_opcode_bytes() const;
// inline data
const address_space_config m_program_config, m_data_config;
};
class upd7725_device_config : public necdsp_device_config
{
friend class upd7725_device;
// construction/destruction
upd7725_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
public:
// allocators
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
virtual device_t *alloc_device(running_machine &machine) const;
};
class upd96050_device_config : public necdsp_device_config
{
friend class upd96050_device;
// construction/destruction
upd96050_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
public:
// allocators
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
virtual device_t *alloc_device(running_machine &machine) const;
};
// ======================> necdsp_device
class necdsp_device : public cpu_device
class necdsp_device : public cpu_device, public necdsp_interface
{
friend class necdsp_device_config;
protected:
// construction/destruction
necdsp_device(running_machine &_machine, const necdsp_device_config &config);
necdsp_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, UINT32 abits, UINT32 dbits, const char *name);
public:
UINT8 snesdsp_read(bool mode);
@ -127,21 +64,33 @@ public:
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
// device_execute_interface overrides
virtual UINT32 execute_min_cycles() const;
virtual UINT32 execute_max_cycles() const;
virtual UINT32 execute_input_lines() const;
virtual void execute_run();
virtual void execute_set_input(int inputnum, int state);
// device_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
// device_state_interface overrides
virtual void state_import(const device_state_entry &entry);
virtual void state_export(const device_state_entry &entry);
virtual void state_string_export(const device_state_entry &entry, astring &string);
// device_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const;
virtual UINT32 disasm_max_opcode_bytes() const;
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
// inline data
const address_space_config m_program_config, m_data_config;
UINT16 dataRAM[2048];
private:
@ -232,26 +181,21 @@ protected:
//devcb_resolved_write8 m_out_so_func;
//devcb_resolved_write_line m_out_sorq_func;
//devcb_resolved_write_line m_out_drq_func;
const necdsp_device_config &m_config;
};
class upd7725_device : public necdsp_device
{
friend class upd7725_device_config;
public:
// construction/destruction
upd7725_device(running_machine &_machine, const upd7725_device_config &config);
upd7725_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
class upd96050_device : public necdsp_device
{
friend class upd96050_device_config;
// construction/destruction
upd96050_device(running_machine &_machine, const upd96050_device_config &config);
public:
// construction/destruction
upd96050_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
UINT16 dataram_r(UINT16 addr) { return dataRAM[addr]; }
void dataram_w(UINT16 addr, UINT16 data) { dataRAM[addr] = data; }
};

View File

@ -1700,7 +1700,7 @@ static CPU_INIT( upd7810 )
{
upd7810_state *cpustate = get_safe_token(device);
cpustate->config = *(const UPD7810_CONFIG*) device->baseconfig().static_config();
cpustate->config = *(const UPD7810_CONFIG*) device->static_config();
cpustate->irq_callback = irqcallback;
cpustate->device = device;
cpustate->program = device->space(AS_PROGRAM);

View File

@ -66,7 +66,7 @@ vtlb_state *vtlb_alloc(device_t *cpu, address_spacenum space, int fixed_entries,
vtlb->space = space;
vtlb->dynamic = dynamic_entries;
vtlb->fixed = fixed_entries;
const address_space_config *spaceconfig = devconfig_get_space_config(cpu->baseconfig(), space);
const address_space_config *spaceconfig = device_get_space_config(*cpu, space);
assert(spaceconfig != NULL);
vtlb->pageshift = spaceconfig->m_page_shift;
vtlb->addrwidth = spaceconfig->m_logaddr_width;

View File

@ -1941,8 +1941,8 @@ static void z180_write_iolines(z180_state *cpustate, UINT32 data)
static CPU_INIT( z180 )
{
z180_state *cpustate = get_safe_token(device);
if (device->baseconfig().static_config() != NULL)
cpustate->daisy.init(device, (const z80_daisy_config *)device->baseconfig().static_config());
if (device->static_config() != NULL)
cpustate->daisy.init(device, (const z80_daisy_config *)device->static_config());
cpustate->irq_callback = irqcallback;
SZHVC_add = auto_alloc_array(device->machine(), UINT8, 2*256*256);

View File

@ -3477,8 +3477,8 @@ static CPU_INIT( z80 )
z80->after_ldair = 0;
z80->ea = 0;
if (device->baseconfig().static_config() != NULL)
z80->daisy.init(device, (const z80_daisy_config *)device->baseconfig().static_config());
if (device->static_config() != NULL)
z80->daisy.init(device, (const z80_daisy_config *)device->static_config());
z80->irq_callback = irqcallback;
z80->device = device;
z80->program = device->space(AS_PROGRAM);

View File

@ -10,30 +10,6 @@
#include "z80daisy.h"
//**************************************************************************
// DEVICE CONFIG Z80 DAISY INTERFACE
//**************************************************************************
//-------------------------------------------------
// device_config_z80daisy_interface - constructor
//-------------------------------------------------
device_config_z80daisy_interface::device_config_z80daisy_interface(const machine_config &mconfig, device_config &devconfig)
: device_config_interface(mconfig, devconfig)
{
}
//-------------------------------------------------
// ~device_config_z80daisy_interface - destructor
//-------------------------------------------------
device_config_z80daisy_interface::~device_config_z80daisy_interface()
{
}
//**************************************************************************
// DEVICE Z80 DAISY INTERFACE
//**************************************************************************
@ -42,9 +18,8 @@ device_config_z80daisy_interface::~device_config_z80daisy_interface()
// device_z80daisy_interface - constructor
//-------------------------------------------------
device_z80daisy_interface::device_z80daisy_interface(running_machine &machine, const device_config &config, device_t &device)
: device_interface(machine, config, device),
m_z80daisy_config(dynamic_cast<const device_config_z80daisy_interface &>(config))
device_z80daisy_interface::device_z80daisy_interface(const machine_config &mconfig, device_t &device)
: device_interface(device)
{
}

View File

@ -37,35 +37,19 @@ struct z80_daisy_config
// ======================> device_config_z80daisy_interface
// device_config_z80daisy_interface represents configuration information for a z80daisy device
class device_config_z80daisy_interface : public device_config_interface
{
public:
// construction/destruction
device_config_z80daisy_interface(const machine_config &mconfig, device_config &devconfig);
virtual ~device_config_z80daisy_interface();
};
// ======================> device_z80daisy_interface
class device_z80daisy_interface : public device_interface
{
public:
// construction/destruction
device_z80daisy_interface(running_machine &machine, const device_config &config, device_t &device);
device_z80daisy_interface(const machine_config &mconfig, device_t &device);
virtual ~device_z80daisy_interface();
// required operation overrides
virtual int z80daisy_irq_state() = 0;
virtual int z80daisy_irq_ack() = 0;
virtual void z80daisy_irq_reti() = 0;
protected:
const device_config_z80daisy_interface &m_z80daisy_config;
};

View File

@ -385,7 +385,7 @@ void debug_command_init(running_machine &machine)
static void debug_command_exit(running_machine &machine)
{
/* turn off all traces */
for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next())
for (device_t *device = machine.devicelist().first(); device != NULL; device = device->next())
device->debug()->trace(NULL, 0, NULL);
if (cheat.length)
@ -540,7 +540,7 @@ int debug_command_parameter_cpu(running_machine &machine, const char *param, dev
/* if we got a valid one, return */
device_execute_interface *exec = NULL;
for (bool gotone = machine.m_devicelist.first(exec); gotone; gotone = exec->next(exec))
for (bool gotone = machine.devicelist().first(exec); gotone; gotone = exec->next(exec))
if (cpunum-- == 0)
{
*result = &exec->device();
@ -977,7 +977,7 @@ static void execute_focus(running_machine &machine, int ref, int params, const c
/* then loop over CPUs and set the ignore flags on all other CPUs */
device_execute_interface *exec = NULL;
for (bool gotone = machine.m_devicelist.first(exec); gotone; gotone = exec->next(exec))
for (bool gotone = machine.devicelist().first(exec); gotone; gotone = exec->next(exec))
if (&exec->device() != cpu)
exec->device().debug()->ignore(true);
debug_console_printf(machine, "Now focused on CPU '%s'\n", cpu->tag());
@ -997,7 +997,7 @@ static void execute_ignore(running_machine &machine, int ref, int params, const
/* loop over all executable devices */
device_execute_interface *exec = NULL;
for (bool gotone = machine.m_devicelist.first(exec); gotone; gotone = exec->next(exec))
for (bool gotone = machine.devicelist().first(exec); gotone; gotone = exec->next(exec))
/* build up a comma-separated list */
if (!exec->device().debug()->observing())
@ -1030,7 +1030,7 @@ static void execute_ignore(running_machine &machine, int ref, int params, const
/* make sure this isn't the last live CPU */
device_execute_interface *exec = NULL;
bool gotone;
for (gotone = machine.m_devicelist.first(exec); gotone; gotone = exec->next(exec))
for (gotone = machine.devicelist().first(exec); gotone; gotone = exec->next(exec))
if (&exec->device() != devicelist[paramnum] && exec->device().debug()->observing())
break;
if (!gotone)
@ -1059,7 +1059,7 @@ static void execute_observe(running_machine &machine, int ref, int params, const
/* loop over all executable devices */
device_execute_interface *exec = NULL;
for (bool gotone = machine.m_devicelist.first(exec); gotone; gotone = exec->next(exec))
for (bool gotone = machine.devicelist().first(exec); gotone; gotone = exec->next(exec))
/* build up a comma-separated list */
if (exec->device().debug()->observing())
@ -1208,7 +1208,7 @@ static void execute_bpclear(running_machine &machine, int ref, int params, const
/* if 0 parameters, clear all */
if (params == 0)
{
for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next())
for (device_t *device = machine.devicelist().first(); device != NULL; device = device->next())
device->debug()->breakpoint_clear_all();
debug_console_printf(machine, "Cleared all breakpoints\n");
}
@ -1219,7 +1219,7 @@ static void execute_bpclear(running_machine &machine, int ref, int params, const
else
{
bool found = false;
for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next())
for (device_t *device = machine.devicelist().first(); device != NULL; device = device->next())
if (device->debug()->breakpoint_clear(bpindex))
found = true;
if (found)
@ -1242,7 +1242,7 @@ static void execute_bpdisenable(running_machine &machine, int ref, int params, c
/* if 0 parameters, clear all */
if (params == 0)
{
for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next())
for (device_t *device = machine.devicelist().first(); device != NULL; device = device->next())
device->debug()->breakpoint_enable_all(ref);
if (ref == 0)
debug_console_printf(machine, "Disabled all breakpoints\n");
@ -1256,7 +1256,7 @@ static void execute_bpdisenable(running_machine &machine, int ref, int params, c
else
{
bool found = false;
for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next())
for (device_t *device = machine.devicelist().first(); device != NULL; device = device->next())
if (device->debug()->breakpoint_enable(bpindex, ref))
found = true;
if (found)
@ -1278,7 +1278,7 @@ static void execute_bplist(running_machine &machine, int ref, int params, const
astring buffer;
/* loop over all CPUs */
for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next())
for (device_t *device = machine.devicelist().first(); device != NULL; device = device->next())
if (device->debug()->breakpoint_first() != NULL)
{
debug_console_printf(machine, "Device '%s' breakpoints:\n", device->tag());
@ -1366,7 +1366,7 @@ static void execute_wpclear(running_machine &machine, int ref, int params, const
/* if 0 parameters, clear all */
if (params == 0)
{
for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next())
for (device_t *device = machine.devicelist().first(); device != NULL; device = device->next())
device->debug()->watchpoint_clear_all();
debug_console_printf(machine, "Cleared all watchpoints\n");
}
@ -1377,7 +1377,7 @@ static void execute_wpclear(running_machine &machine, int ref, int params, const
else
{
bool found = false;
for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next())
for (device_t *device = machine.devicelist().first(); device != NULL; device = device->next())
if (device->debug()->watchpoint_clear(wpindex))
found = true;
if (found)
@ -1400,7 +1400,7 @@ static void execute_wpdisenable(running_machine &machine, int ref, int params, c
/* if 0 parameters, clear all */
if (params == 0)
{
for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next())
for (device_t *device = machine.devicelist().first(); device != NULL; device = device->next())
device->debug()->watchpoint_enable_all(ref);
if (ref == 0)
debug_console_printf(machine, "Disabled all watchpoints\n");
@ -1414,7 +1414,7 @@ static void execute_wpdisenable(running_machine &machine, int ref, int params, c
else
{
bool found = false;
for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next())
for (device_t *device = machine.devicelist().first(); device != NULL; device = device->next())
if (device->debug()->watchpoint_enable(wpindex, ref))
found = true;
if (found)
@ -1436,7 +1436,7 @@ static void execute_wplist(running_machine &machine, int ref, int params, const
astring buffer;
/* loop over all CPUs */
for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next())
for (device_t *device = machine.devicelist().first(); device != NULL; device = device->next())
for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++)
if (device->debug()->watchpoint_first(spacenum) != NULL)
{
@ -1478,7 +1478,7 @@ static void execute_hotspot(running_machine &machine, int ref, int params, const
bool cleared = false;
/* loop over CPUs and find live spots */
for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next())
for (device_t *device = machine.devicelist().first(); device != NULL; device = device->next())
if (device->debug()->hotspot_tracking_enabled())
{
device->debug()->hotspot_track(0, 0);
@ -2492,7 +2492,7 @@ static void execute_snap(running_machine &machine, int ref, int params, const ch
const char *filename = param[0];
int scrnum = (params > 1) ? atoi(param[1]) : 0;
screen_device *screen = downcast<screen_device *>(machine.m_devicelist.find(SCREEN, scrnum));
screen_device *screen = downcast<screen_device *>(machine.devicelist().find(SCREEN, scrnum));
if ((screen == NULL) || !machine.render().is_live(*screen))
{

View File

@ -204,7 +204,7 @@ void debug_cpu_flush_traces(running_machine &machine)
{
/* this can be called on exit even when no debugging is enabled, so
make sure the devdebug is valid before proceeding */
for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next())
for (device_t *device = machine.devicelist().first(); device != NULL; device = device->next())
if (device->debug() != NULL)
device->debug()->trace_flush();
}
@ -341,7 +341,7 @@ bool debug_comment_save(running_machine &machine)
// for each device
bool found_comments = false;
for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next())
for (device_t *device = machine.devicelist().first(); device != NULL; device = device->next())
if (device->debug()->comment_count() > 0)
{
// create a node for this device
@ -1084,7 +1084,7 @@ static void on_vblank(screen_device &device, void *param, bool vblank_state)
static void reset_transient_flags(running_machine &machine)
{
/* loop over CPUs and reset the transient flags */
for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next())
for (device_t *device = machine.devicelist().first(); device != NULL; device = device->next())
device->debug()->reset_transient_flag();
machine.debugcpu_data->m_stop_when_not_device = NULL;
}
@ -1149,7 +1149,7 @@ static device_t *expression_get_device(running_machine &machine, const char *tag
{
device_t *device;
for (device = machine.m_devicelist.first(); device != NULL; device = device->next())
for (device = machine.devicelist().first(); device != NULL; device = device->next())
if (mame_stricmp(device->tag(), tag) == 0)
return device;
@ -1635,7 +1635,7 @@ static UINT64 get_cpunum(symbol_table &table, void *ref)
device_execute_interface *exec = NULL;
int index = 0;
for (bool gotone = machine.m_devicelist.first(exec); gotone; gotone = exec->next(exec))
for (bool gotone = machine.devicelist().first(exec); gotone; gotone = exec->next(exec))
{
if (&exec->device() == target)
return index;

View File

@ -134,7 +134,7 @@ void debug_view_disasm::enumerate_sources()
// iterate over devices with disassembly interfaces
device_disasm_interface *dasm = NULL;
astring name;
for (bool gotone = machine().m_devicelist.first(dasm); gotone; gotone = dasm->next(dasm))
for (bool gotone = machine().devicelist().first(dasm); gotone; gotone = dasm->next(dasm))
{
name.printf("%s '%s'", dasm->device().name(), dasm->device().tag());
m_source_list.append(*auto_alloc(machine(), debug_view_disasm_source(name, dasm->device())));

View File

@ -153,7 +153,7 @@ void debug_view_memory::enumerate_sources()
// first add all the devices' address spaces
device_memory_interface *memintf = NULL;
for (bool gotone = machine().m_devicelist.first(memintf); gotone; gotone = memintf->next(memintf))
for (bool gotone = machine().devicelist().first(memintf); gotone; gotone = memintf->next(memintf))
for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++)
{
address_space *space = memintf->space(spacenum);

View File

@ -105,7 +105,7 @@ void debug_view_state::enumerate_sources()
// iterate over devices that have state interfaces
device_state_interface *state = NULL;
astring name;
for (bool gotone = machine().m_devicelist.first(state); gotone; gotone = state->next(state))
for (bool gotone = machine().devicelist().first(state); gotone; gotone = state->next(state))
{
name.printf("%s '%s'", state->device().name(), state->device().tag());
m_source_list.append(*auto_alloc(machine(), debug_view_state_source(name, state->device())));

View File

@ -31,7 +31,7 @@
*************************************/
#define MCFG_CPU_VBLANK_INT_HACK(_func, _rate) \
device_config_execute_interface::static_set_vblank_int(device, _func, NULL, _rate); \
device_execute_interface::static_set_vblank_int(*device, _func, NULL, _rate); \

View File

@ -176,10 +176,6 @@ void devcb_stub16(device_t *device, offs_t offset, UINT16 data)
TYPE DEFINITIONS
***************************************************************************/
/* forward declarations */
class device_config;
/* static structure used for device configuration when the desired callback type is a read_line_device_func */
typedef struct _devcb_read_line devcb_read_line;
struct _devcb_read_line

View File

@ -42,144 +42,6 @@
#include <ctype.h>
//**************************************************************************
// CPU DEVICE CONFIGURATION
//**************************************************************************
//-------------------------------------------------
// cpu_device_config - constructor
//-------------------------------------------------
cpu_device_config::cpu_device_config(const machine_config &mconfig, device_type type, const char *name, const char *tag, const device_config *owner, UINT32 clock)
: device_config(mconfig, type, name, tag, owner, clock),
device_config_execute_interface(mconfig, *this),
device_config_memory_interface(mconfig, *this),
device_config_state_interface(mconfig, *this),
device_config_disasm_interface(mconfig, *this)
{
}
//-------------------------------------------------
// legacy_cpu_device_config - constructor
//-------------------------------------------------
legacy_cpu_device_config::legacy_cpu_device_config(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock, cpu_get_info_func get_info)
: cpu_device_config(mconfig, type, "CPU", tag, owner, clock),
m_get_info(get_info)
{
// build up our address spaces; legacy devices don't have logical spaces
memset(m_space_config, 0, sizeof(m_space_config));
for (address_spacenum spacenum = AS_0; spacenum < ARRAY_LENGTH(m_space_config); spacenum++)
{
m_space_config[spacenum].m_name = (spacenum == 1) ? "data" : (spacenum == 2) ? "i/o" : "program";
m_space_config[spacenum].m_endianness = static_cast<endianness_t>(get_legacy_config_int(DEVINFO_INT_ENDIANNESS));
m_space_config[spacenum].m_databus_width = get_legacy_config_int(DEVINFO_INT_DATABUS_WIDTH + spacenum);
m_space_config[spacenum].m_addrbus_width = get_legacy_config_int(DEVINFO_INT_ADDRBUS_WIDTH + spacenum);
m_space_config[spacenum].m_addrbus_shift = get_legacy_config_int(DEVINFO_INT_ADDRBUS_SHIFT + spacenum);
m_space_config[spacenum].m_logaddr_width = get_legacy_config_int(CPUINFO_INT_LOGADDR_WIDTH + spacenum);
if (m_space_config[spacenum].m_logaddr_width == 0)
m_space_config[spacenum].m_logaddr_width = m_space_config[spacenum].m_addrbus_width;
m_space_config[spacenum].m_page_shift = get_legacy_config_int(CPUINFO_INT_PAGE_SHIFT + spacenum);
m_space_config[spacenum].m_internal_map = reinterpret_cast<address_map_constructor>(get_legacy_config_fct(DEVINFO_PTR_INTERNAL_MEMORY_MAP + spacenum));
m_space_config[spacenum].m_default_map = reinterpret_cast<address_map_constructor>(get_legacy_config_fct(DEVINFO_PTR_DEFAULT_MEMORY_MAP + spacenum));
}
// set the real name
m_name = get_legacy_config_string(DEVINFO_STR_NAME);
m_shortname = get_legacy_config_string(DEVINFO_STR_SHORTNAME);
m_searchpath = m_shortname;
}
//-------------------------------------------------
// execute_clocks_to_cycles - convert the raw
// clock into cycles per second
//-------------------------------------------------
UINT64 legacy_cpu_device_config::execute_clocks_to_cycles(UINT64 clocks) const
{
UINT32 multiplier = get_legacy_config_int(CPUINFO_INT_CLOCK_MULTIPLIER);
UINT32 divider = get_legacy_config_int(CPUINFO_INT_CLOCK_DIVIDER);
if (multiplier == 0) multiplier = 1;
if (divider == 0) divider = 1;
return (clocks * multiplier + divider - 1) / divider;
}
//-------------------------------------------------
// execute_cycles_to_clocks - convert a cycle
// count back to raw clocks
//-------------------------------------------------
UINT64 legacy_cpu_device_config::execute_cycles_to_clocks(UINT64 cycles) const
{
UINT32 multiplier = get_legacy_config_int(CPUINFO_INT_CLOCK_MULTIPLIER);
UINT32 divider = get_legacy_config_int(CPUINFO_INT_CLOCK_DIVIDER);
if (multiplier == 0) multiplier = 1;
if (divider == 0) divider = 1;
return (cycles * divider + multiplier - 1) / multiplier;
}
//-------------------------------------------------
// get_legacy_config_int - return a legacy
// integer value
//-------------------------------------------------
INT64 legacy_cpu_device_config::get_legacy_config_int(UINT32 state) const
{
cpuinfo info = { 0 };
(*m_get_info)(this, NULL, state, &info);
return info.i;
}
//-------------------------------------------------
// get_legacy_config_ptr - return a legacy
// pointer value
//-------------------------------------------------
void *legacy_cpu_device_config::get_legacy_config_ptr(UINT32 state) const
{
cpuinfo info = { 0 };
(*m_get_info)(this, NULL, state, &info);
return info.p;
}
//-------------------------------------------------
// get_legacy_config_fct - return a legacy
// function value
//-------------------------------------------------
genf *legacy_cpu_device_config::get_legacy_config_fct(UINT32 state) const
{
cpuinfo info = { 0 };
(*m_get_info)(this, NULL, state, &info);
return info.f;
}
//-------------------------------------------------
// get_legacy_config_string - return a legacy
// string value
//-------------------------------------------------
const char *legacy_cpu_device_config::get_legacy_config_string(UINT32 state) const
{
cpuinfo info;
info.s = get_temp_string_buffer();
(*m_get_info)(this, NULL, state, &info);
return info.s;
}
//**************************************************************************
// CPU RUNNING DEVICE
//**************************************************************************
@ -188,12 +50,12 @@ const char *legacy_cpu_device_config::get_legacy_config_string(UINT32 state) con
// cpu_device - constructor
//-------------------------------------------------
cpu_device::cpu_device(running_machine &machine, const cpu_device_config &config)
: device_t(machine, config),
device_execute_interface(machine, config, *this),
device_memory_interface(machine, config, *this),
device_state_interface(machine, config, *this),
device_disasm_interface(machine, config, *this)
cpu_device::cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, type, name, tag, owner, clock),
device_execute_interface(mconfig, *this),
device_memory_interface(mconfig, *this),
device_state_interface(mconfig, *this),
device_disasm_interface(mconfig, *this)
{
}
@ -211,33 +73,55 @@ cpu_device::~cpu_device()
// legacy_cpu_device - constructor
//-------------------------------------------------
legacy_cpu_device::legacy_cpu_device(running_machine &machine, const legacy_cpu_device_config &config)
: cpu_device(machine, config),
m_cpu_config(config),
legacy_cpu_device::legacy_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, cpu_get_info_func get_info)
: cpu_device(mconfig, type, "CPU", tag, owner, clock),
m_get_info(get_info),
m_token(NULL),
m_set_info(reinterpret_cast<cpu_set_info_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_SET_INFO))),
m_execute(reinterpret_cast<cpu_execute_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_EXECUTE))),
m_burn(reinterpret_cast<cpu_burn_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_BURN))),
m_translate(reinterpret_cast<cpu_translate_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_TRANSLATE))),
m_read(reinterpret_cast<cpu_read_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_READ))),
m_write(reinterpret_cast<cpu_write_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_WRITE))),
m_readop(reinterpret_cast<cpu_readop_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_READOP))),
m_disassemble(reinterpret_cast<cpu_disassemble_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_DISASSEMBLE))),
m_state_import(reinterpret_cast<cpu_state_io_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_IMPORT_STATE))),
m_state_export(reinterpret_cast<cpu_state_io_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_EXPORT_STATE))),
m_string_export(reinterpret_cast<cpu_string_io_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_EXPORT_STRING))),
m_exit(reinterpret_cast<cpu_exit_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_EXIT))),
m_set_info(reinterpret_cast<cpu_set_info_func>(get_legacy_fct(CPUINFO_FCT_SET_INFO))),
m_execute(reinterpret_cast<cpu_execute_func>(get_legacy_fct(CPUINFO_FCT_EXECUTE))),
m_burn(reinterpret_cast<cpu_burn_func>(get_legacy_fct(CPUINFO_FCT_BURN))),
m_translate(reinterpret_cast<cpu_translate_func>(get_legacy_fct(CPUINFO_FCT_TRANSLATE))),
m_read(reinterpret_cast<cpu_read_func>(get_legacy_fct(CPUINFO_FCT_READ))),
m_write(reinterpret_cast<cpu_write_func>(get_legacy_fct(CPUINFO_FCT_WRITE))),
m_readop(reinterpret_cast<cpu_readop_func>(get_legacy_fct(CPUINFO_FCT_READOP))),
m_disassemble(reinterpret_cast<cpu_disassemble_func>(get_legacy_fct(CPUINFO_FCT_DISASSEMBLE))),
m_state_import(reinterpret_cast<cpu_state_io_func>(get_legacy_fct(CPUINFO_FCT_IMPORT_STATE))),
m_state_export(reinterpret_cast<cpu_state_io_func>(get_legacy_fct(CPUINFO_FCT_EXPORT_STATE))),
m_string_export(reinterpret_cast<cpu_string_io_func>(get_legacy_fct(CPUINFO_FCT_EXPORT_STRING))),
m_exit(reinterpret_cast<cpu_exit_func>(get_legacy_fct(CPUINFO_FCT_EXIT))),
m_using_legacy_state(false),
m_inited(false)
{
// build up our address spaces; legacy devices don't have logical spaces
memset(m_space_config, 0, sizeof(m_space_config));
for (address_spacenum spacenum = AS_0; spacenum < ARRAY_LENGTH(m_space_config); spacenum++)
{
m_space_config[spacenum].m_name = (spacenum == 1) ? "data" : (spacenum == 2) ? "i/o" : "program";
m_space_config[spacenum].m_endianness = static_cast<endianness_t>(get_legacy_int(DEVINFO_INT_ENDIANNESS));
m_space_config[spacenum].m_databus_width = get_legacy_int(DEVINFO_INT_DATABUS_WIDTH + spacenum);
m_space_config[spacenum].m_addrbus_width = get_legacy_int(DEVINFO_INT_ADDRBUS_WIDTH + spacenum);
m_space_config[spacenum].m_addrbus_shift = get_legacy_int(DEVINFO_INT_ADDRBUS_SHIFT + spacenum);
m_space_config[spacenum].m_logaddr_width = get_legacy_int(CPUINFO_INT_LOGADDR_WIDTH + spacenum);
if (m_space_config[spacenum].m_logaddr_width == 0)
m_space_config[spacenum].m_logaddr_width = m_space_config[spacenum].m_addrbus_width;
m_space_config[spacenum].m_page_shift = get_legacy_int(CPUINFO_INT_PAGE_SHIFT + spacenum);
m_space_config[spacenum].m_internal_map = reinterpret_cast<address_map_constructor>(get_legacy_fct(DEVINFO_PTR_INTERNAL_MEMORY_MAP + spacenum));
m_space_config[spacenum].m_default_map = reinterpret_cast<address_map_constructor>(get_legacy_fct(DEVINFO_PTR_DEFAULT_MEMORY_MAP + spacenum));
}
// set the real name
m_name = get_legacy_string(DEVINFO_STR_NAME);
m_shortname = get_legacy_string(DEVINFO_STR_SHORTNAME);
m_searchpath = m_shortname;
memset(&m_partial_frame_period, 0, sizeof(m_partial_frame_period));
int tokenbytes = m_cpu_config.get_legacy_config_int(CPUINFO_INT_CONTEXT_SIZE);
int tokenbytes = get_legacy_int(CPUINFO_INT_CONTEXT_SIZE);
if (tokenbytes == 0)
throw emu_fatalerror("Device %s specifies a 0 context size!\n", tag());
throw emu_fatalerror("Device %s specifies a 0 context size!\n", tag);
// allocate memory for the token
m_token = auto_alloc_array_clear(machine, UINT8, tokenbytes);
m_token = global_alloc_array_clear(UINT8, tokenbytes);
}
@ -247,9 +131,7 @@ legacy_cpu_device::legacy_cpu_device(running_machine &machine, const legacy_cpu_
legacy_cpu_device::~legacy_cpu_device()
{
// call the CPU's exit function if present
if (m_inited && m_exit != NULL)
(*m_exit)(this);
global_free(m_token);
}
@ -260,7 +142,7 @@ legacy_cpu_device::~legacy_cpu_device()
void legacy_cpu_device::device_start()
{
// standard init
cpu_init_func init = reinterpret_cast<cpu_init_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_INIT));
cpu_init_func init = reinterpret_cast<cpu_init_func>(get_legacy_fct(CPUINFO_FCT_INIT));
(*init)(this, static_standard_irq_callback);
m_inited = true;
@ -270,7 +152,7 @@ void legacy_cpu_device::device_start()
m_using_legacy_state = true;
for (int index = 0; index < MAX_REGS; index++)
{
const char *string = get_legacy_runtime_string(CPUINFO_STR_REGISTER + index);
const char *string = get_legacy_string(CPUINFO_STR_REGISTER + index);
if (strchr(string, ':') != NULL)
{
astring tempstr(string);
@ -293,7 +175,7 @@ void legacy_cpu_device::device_start()
state_add(STATE_GENPC, "curpc", m_state_io).callimport().callexport().formatstr("%8s").noshow();
state_add(STATE_GENPCBASE, "curpcbase", m_state_io).callimport().callexport().formatstr("%8s").noshow();
const char *string = get_legacy_runtime_string(CPUINFO_STR_FLAGS);
const char *string = get_legacy_string(CPUINFO_STR_FLAGS);
if (string != NULL && string[0] != 0)
{
astring flagstr;
@ -303,7 +185,7 @@ void legacy_cpu_device::device_start()
}
// get our icount pointer
m_icountptr = reinterpret_cast<int *>(get_legacy_runtime_ptr(CPUINFO_PTR_INSTRUCTION_COUNTER));
m_icountptr = reinterpret_cast<int *>(get_legacy_ptr(CPUINFO_PTR_INSTRUCTION_COUNTER));
assert(m_icountptr != 0);
*m_icountptr = 0;
}
@ -315,15 +197,62 @@ void legacy_cpu_device::device_start()
void legacy_cpu_device::device_reset()
{
cpu_reset_func reset = reinterpret_cast<cpu_reset_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_RESET));
cpu_reset_func reset = reinterpret_cast<cpu_reset_func>(get_legacy_fct(CPUINFO_FCT_RESET));
if (reset != NULL)
(*reset)(this);
}
//-------------------------------------------------
// execute - execute for the provided number of
// cycles
// device_stop - clean up before the machine goes
// away
//-------------------------------------------------
void legacy_cpu_device::device_stop()
{
// call the CPU's exit function if present
if (m_inited && m_exit != NULL)
(*m_exit)(this);
}
//-------------------------------------------------
// execute_clocks_to_cycles - convert the raw
// clock into cycles per second
//-------------------------------------------------
UINT64 legacy_cpu_device::execute_clocks_to_cycles(UINT64 clocks) const
{
UINT32 multiplier = get_legacy_int(CPUINFO_INT_CLOCK_MULTIPLIER);
UINT32 divider = get_legacy_int(CPUINFO_INT_CLOCK_DIVIDER);
if (multiplier == 0) multiplier = 1;
if (divider == 0) divider = 1;
return (clocks * multiplier + divider - 1) / divider;
}
//-------------------------------------------------
// execute_cycles_to_clocks - convert a cycle
// count back to raw clocks
//-------------------------------------------------
UINT64 legacy_cpu_device::execute_cycles_to_clocks(UINT64 cycles) const
{
UINT32 multiplier = get_legacy_int(CPUINFO_INT_CLOCK_MULTIPLIER);
UINT32 divider = get_legacy_int(CPUINFO_INT_CLOCK_DIVIDER);
if (multiplier == 0) multiplier = 1;
if (divider == 0) divider = 1;
return (cycles * divider + multiplier - 1) / multiplier;
}
//-------------------------------------------------
// execute_run - execute for the provided number
// of cycles
//-------------------------------------------------
void legacy_cpu_device::execute_run()
@ -402,7 +331,7 @@ bool legacy_cpu_device::memory_readop(offs_t offset, int size, UINT64 &value)
void legacy_cpu_device::device_debug_setup()
{
cpu_debug_init_func init = reinterpret_cast<cpu_debug_init_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_DEBUG_INIT));
cpu_debug_init_func init = reinterpret_cast<cpu_debug_init_func>(get_legacy_fct(CPUINFO_FCT_DEBUG_INIT));
if (init != NULL)
(*init)(this);
}
@ -445,51 +374,61 @@ offs_t legacy_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT
//-------------------------------------------------
// get_legacy_runtime_int - call the get info
// function to retrieve an integer value
// get_legacy_int - return a legacy integer value
//-------------------------------------------------
INT64 legacy_cpu_device::get_legacy_runtime_int(UINT32 state)
INT64 legacy_cpu_device::get_legacy_int(UINT32 state) const
{
cpuinfo info = { 0 };
(*m_cpu_config.m_get_info)(&m_cpu_config, this, state, &info);
(*m_get_info)(const_cast<legacy_cpu_device *>(this), state, &info);
return info.i;
}
//-------------------------------------------------
// get_legacy_runtime_ptr - call the get info
// function to retrieve a pointer value
// get_legacy_ptr - return a legacy pointer value
//-------------------------------------------------
void *legacy_cpu_device::get_legacy_runtime_ptr(UINT32 state)
void *legacy_cpu_device::get_legacy_ptr(UINT32 state) const
{
cpuinfo info = { 0 };
(*m_cpu_config.m_get_info)(&m_cpu_config, this, state, &info);
(*m_get_info)(const_cast<legacy_cpu_device *>(this), state, &info);
return info.p;
}
//-------------------------------------------------
// get_legacy_runtime_string - call the get info
// function to retrieve a string value
// get_legacy_fct - return a legacy function value
//-------------------------------------------------
const char *legacy_cpu_device::get_legacy_runtime_string(UINT32 state)
genf *legacy_cpu_device::get_legacy_fct(UINT32 state) const
{
cpuinfo info = { 0 };
(*m_get_info)(const_cast<legacy_cpu_device *>(this), state, &info);
return info.f;
}
//-------------------------------------------------
// get_legacy_string - return a legacy
// string value
//-------------------------------------------------
const char *legacy_cpu_device::get_legacy_string(UINT32 state) const
{
cpuinfo info;
info.s = get_temp_string_buffer();
(*m_cpu_config.m_get_info)(&m_cpu_config, this, state, &info);
(*m_get_info)(const_cast<legacy_cpu_device *>(this), state, &info);
return info.s;
}
//-------------------------------------------------
// set_legacy_runtime_int - call the get info
// function to set an integer value
// set_legacy_int - call the get info function
// to set an integer value
//-------------------------------------------------
void legacy_cpu_device::set_legacy_runtime_int(UINT32 state, INT64 value)
void legacy_cpu_device::set_legacy_int(UINT32 state, INT64 value)
{
cpuinfo info = { 0 };
info.i = value;
@ -505,7 +444,7 @@ void legacy_cpu_device::state_import(const device_state_entry &entry)
if (entry.index() == STATE_GENFLAGS)
; // do nothing
else
set_legacy_runtime_int(CPUINFO_INT_REGISTER + entry.index(), m_state_io);
set_legacy_int(CPUINFO_INT_REGISTER + entry.index(), m_state_io);
}
else if (m_state_import != NULL)
(*m_state_import)(this, entry);
@ -518,13 +457,13 @@ void legacy_cpu_device::state_export(const device_state_entry &entry)
{
if (entry.index() == STATE_GENFLAGS)
{
const char *temp = get_legacy_runtime_string(CPUINFO_STR_FLAGS);
const char *temp = get_legacy_string(CPUINFO_STR_FLAGS);
m_state_io = 0;
while (*temp != 0)
m_state_io = ((m_state_io << 5) | (m_state_io >> (64-5))) ^ *temp++;
}
else
m_state_io = get_legacy_runtime_int(CPUINFO_INT_REGISTER + entry.index());
m_state_io = get_legacy_int(CPUINFO_INT_REGISTER + entry.index());
}
else if (m_state_export != NULL)
(*m_state_export)(this, entry);
@ -536,9 +475,9 @@ void legacy_cpu_device::state_string_export(const device_state_entry &entry, ast
if (m_using_legacy_state)
{
if (entry.index() == STATE_GENFLAGS)
string.cpy(get_legacy_runtime_string(CPUINFO_STR_FLAGS));
string.cpy(get_legacy_string(CPUINFO_STR_FLAGS));
else
string.cpy(strchr(get_legacy_runtime_string(CPUINFO_STR_REGISTER + entry.index()), ':') + 1);
string.cpy(strchr(get_legacy_string(CPUINFO_STR_REGISTER + entry.index()), ':') + 1);
}
else if (m_string_export != NULL)
(*m_string_export)(this, entry, string);

View File

@ -166,54 +166,30 @@ enum
\
CPU_GET_INFO( basename ); \
\
class basename##_device_config; \
\
class basename##_device : public legacy_cpu_device \
{ \
friend class basename##_device_config; \
basename##_device(running_machine &_machine, const basename##_device_config &config); \
}; \
\
class basename##_device_config : public legacy_cpu_device_config \
{ \
basename##_device_config(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock); \
\
public: \
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); \
virtual device_t *alloc_device(running_machine &machine) const; \
basename##_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock); \
}; \
\
extern const device_type name
extern const device_type name;
// macro for defining the implementation needed for configuration and device classes
#define DEFINE_LEGACY_CPU_DEVICE(name, basename) \
\
basename##_device::basename##_device(running_machine &_machine, const basename##_device_config &config) \
: legacy_cpu_device(_machine, config) \
basename##_device::basename##_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock) \
: legacy_cpu_device(mconfig, type, tag, owner, clock, CPU_GET_INFO_NAME(basename)) \
{ \
} \
\
basename##_device_config::basename##_device_config(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock) \
: legacy_cpu_device_config(mconfig, type, tag, owner, clock, CPU_GET_INFO_NAME(basename)) \
{ \
} \
\
device_config *basename##_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) \
{ \
return global_alloc(basename##_device_config(mconfig, static_alloc_device_config, tag, owner, clock)); \
} \
\
device_t *basename##_device_config::alloc_device(running_machine &machine) const \
{ \
return pool_alloc(machine_get_pool(machine), basename##_device(machine, *this)); \
} \
const device_type name = basename##_device_config::static_alloc_device_config
const device_type name = &legacy_device_creator<basename##_device>
// CPU interface functions
#define CPU_GET_INFO_NAME(name) cpu_get_info_##name
#define CPU_GET_INFO(name) void CPU_GET_INFO_NAME(name)(const device_config *devconfig, legacy_cpu_device *device, UINT32 state, cpuinfo *info)
#define CPU_GET_INFO_CALL(name) CPU_GET_INFO_NAME(name)(devconfig, device, state, info)
#define CPU_GET_INFO(name) void CPU_GET_INFO_NAME(name)(legacy_cpu_device *device, UINT32 state, cpuinfo *info)
#define CPU_GET_INFO_CALL(name) CPU_GET_INFO_NAME(name)(device, state, info)
#define CPU_SET_INFO_NAME(name) cpu_set_info_##name
#define CPU_SET_INFO(name) void CPU_SET_INFO_NAME(name)(legacy_cpu_device *device, UINT32 state, cpuinfo *info)
@ -302,7 +278,7 @@ class legacy_cpu_device;
// CPU interface functions
typedef void (*cpu_get_info_func)(const device_config *devconfig, legacy_cpu_device *device, UINT32 state, cpuinfo *info);
typedef void (*cpu_get_info_func)(legacy_cpu_device *device, UINT32 state, cpuinfo *info);
typedef void (*cpu_set_info_func)(legacy_cpu_device *device, UINT32 state, cpuinfo *info);
typedef void (*cpu_init_func)(legacy_cpu_device *device, device_irq_callback irqcallback);
typedef void (*cpu_reset_func)(legacy_cpu_device *device);
@ -356,66 +332,6 @@ union cpuinfo
// ======================> cpu_device_config
class cpu_device_config : public device_config,
public device_config_execute_interface,
public device_config_memory_interface,
public device_config_state_interface,
public device_config_disasm_interface
{
friend class cpu_device;
protected:
// construction/destruction
cpu_device_config(const machine_config &mconfig, device_type type, const char *name, const char *tag, const device_config *owner, UINT32 clock);
};
// ======================> legacy_cpu_device_config
class legacy_cpu_device_config : public cpu_device_config
{
friend class legacy_cpu_device;
protected:
// construction/destruction
legacy_cpu_device_config(const machine_config &mconfig, device_type _type, const char *_tag, const device_config *_owner, UINT32 _clock, cpu_get_info_func get_info);
// basic information getters
virtual const rom_entry *device_rom_region() const { return reinterpret_cast<const rom_entry *>(get_legacy_config_ptr(DEVINFO_PTR_ROM_REGION)); }
virtual machine_config_constructor device_mconfig_additions() const { return reinterpret_cast<machine_config_constructor>(get_legacy_config_ptr(DEVINFO_PTR_MACHINE_CONFIG)); }
virtual const input_port_token *device_input_ports() const { return reinterpret_cast<const input_port_token *>(get_legacy_config_ptr(DEVINFO_PTR_INPUT_PORTS)); }
// device_config_execute_interface overrides
virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const;
virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const;
virtual UINT32 execute_min_cycles() const { return get_legacy_config_int(CPUINFO_INT_MIN_CYCLES); }
virtual UINT32 execute_max_cycles() const { return get_legacy_config_int(CPUINFO_INT_MAX_CYCLES); }
virtual UINT32 execute_input_lines() const { return get_legacy_config_int(CPUINFO_INT_INPUT_LINES); }
virtual UINT32 execute_default_irq_vector() const { return get_legacy_config_int(CPUINFO_INT_DEFAULT_IRQ_VECTOR); }
// device_config_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum < ARRAY_LENGTH(m_space_config) && m_space_config[spacenum].m_addrbus_width != 0) ? &m_space_config[spacenum] : NULL; }
// device_config_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const { return get_legacy_config_int(CPUINFO_INT_MIN_INSTRUCTION_BYTES); }
virtual UINT32 disasm_max_opcode_bytes() const { return get_legacy_config_int(CPUINFO_INT_MAX_INSTRUCTION_BYTES); }
// legacy interface helpers
INT64 get_legacy_config_int(UINT32 state) const;
void *get_legacy_config_ptr(UINT32 state) const;
genf *get_legacy_config_fct(UINT32 state) const;
const char *get_legacy_config_string(UINT32 state) const;
// internal state
cpu_get_info_func m_get_info;
address_space_config m_space_config[3]; // array of address space configs
};
// ======================> cpu_device
class cpu_device : public device_t,
@ -424,12 +340,11 @@ class cpu_device : public device_t,
public device_state_interface,
public device_disasm_interface
{
friend class cpu_device_config;
friend resource_pool_object<cpu_device>::~resource_pool_object();
protected:
// construction/destruction
cpu_device(running_machine &machine, const cpu_device_config &config);
cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
virtual ~cpu_device();
};
@ -439,12 +354,11 @@ protected:
class legacy_cpu_device : public cpu_device
{
friend class legacy_cpu_device_config;
friend resource_pool_object<legacy_cpu_device>::~resource_pool_object();
protected:
// construction/destruction
legacy_cpu_device(running_machine &machine, const legacy_cpu_device_config &config);
legacy_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, cpu_get_info_func info);
virtual ~legacy_cpu_device();
public:
@ -452,16 +366,27 @@ public:
protected:
// device-level overrides
virtual const rom_entry *device_rom_region() const { return reinterpret_cast<const rom_entry *>(get_legacy_ptr(DEVINFO_PTR_ROM_REGION)); }
virtual machine_config_constructor device_mconfig_additions() const { return reinterpret_cast<machine_config_constructor>(get_legacy_ptr(DEVINFO_PTR_MACHINE_CONFIG)); }
virtual const input_port_token *device_input_ports() const { return reinterpret_cast<const input_port_token *>(get_legacy_ptr(DEVINFO_PTR_INPUT_PORTS)); }
virtual void device_start();
virtual void device_reset();
virtual void device_stop();
virtual void device_debug_setup();
// device_execute_interface overrides
virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const;
virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const;
virtual UINT32 execute_min_cycles() const { return get_legacy_int(CPUINFO_INT_MIN_CYCLES); }
virtual UINT32 execute_max_cycles() const { return get_legacy_int(CPUINFO_INT_MAX_CYCLES); }
virtual UINT32 execute_input_lines() const { return get_legacy_int(CPUINFO_INT_INPUT_LINES); }
virtual UINT32 execute_default_irq_vector() const { return get_legacy_int(CPUINFO_INT_DEFAULT_IRQ_VECTOR); }
virtual void execute_run();
virtual void execute_burn(INT32 cycles);
virtual void execute_set_input(int inputnum, int state) { set_legacy_runtime_int(CPUINFO_INT_INPUT_STATE + inputnum, state); }
virtual void execute_set_input(int inputnum, int state) { set_legacy_int(CPUINFO_INT_INPUT_STATE + inputnum, state); }
// device_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum < ARRAY_LENGTH(m_space_config) && m_space_config[spacenum].m_addrbus_width != 0) ? &m_space_config[spacenum] : NULL; }
virtual bool memory_translate(address_spacenum spacenum, int intention, offs_t &address);
virtual bool memory_read(address_spacenum spacenum, offs_t offset, int size, UINT64 &value);
virtual bool memory_write(address_spacenum spacenum, offs_t offset, int size, UINT64 value);
@ -473,17 +398,21 @@ protected:
virtual void state_string_export(const device_state_entry &entry, astring &string);
// device_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const { return get_legacy_int(CPUINFO_INT_MIN_INSTRUCTION_BYTES); }
virtual UINT32 disasm_max_opcode_bytes() const { return get_legacy_int(CPUINFO_INT_MAX_INSTRUCTION_BYTES); }
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
// helpers to access data via the legacy get_info functions
INT64 get_legacy_runtime_int(UINT32 state);
void *get_legacy_runtime_ptr(UINT32 state);
const char *get_legacy_runtime_string(UINT32 state);
void set_legacy_runtime_int(UINT32 state, INT64 value);
INT64 get_legacy_int(UINT32 state) const;
void *get_legacy_ptr(UINT32 state) const;
genf *get_legacy_fct(UINT32 state) const;
const char *get_legacy_string(UINT32 state) const;
void set_legacy_int(UINT32 state, INT64 value);
protected:
// internal state
const legacy_cpu_device_config &m_cpu_config; // reference to the config
cpu_get_info_func m_get_info;
address_space_config m_space_config[3]; // array of address space configs
void * m_token; // pointer to our state
cpu_set_info_func m_set_info; // extracted legacy function pointers

View File

@ -49,25 +49,53 @@
//**************************************************************************
//-------------------------------------------------
// legacy_image_device_config_base - constructor
// legacy_device_base - destructor
//-------------------------------------------------
legacy_image_device_config_base::legacy_image_device_config_base(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock, device_get_config_func get_config)
: legacy_device_config_base(mconfig, type, tag, owner, clock, get_config),
device_config_image_interface(mconfig, *this),
legacy_image_device_base::~legacy_image_device_base()
{
image_device_format **formatptr = &m_formatlist;
/* free all entries */
while (*formatptr != NULL)
{
image_device_format *entry = *formatptr;
*formatptr = entry->m_next;
global_free(entry);
}
}
device_image_partialhash_func legacy_image_device_base::get_partial_hash() const
{
return reinterpret_cast<device_image_partialhash_func>(get_legacy_fct(DEVINFO_FCT_IMAGE_PARTIAL_HASH));
}
//**************************************************************************
// LIVE LEGACY IMAGE DEVICE
//**************************************************************************
//-------------------------------------------------
// legacy_image_device_base - constructor
//-------------------------------------------------
legacy_image_device_base::legacy_image_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, device_get_config_func get_config)
: legacy_device_base(mconfig, type, tag, owner, clock, get_config),
device_image_interface(mconfig, *this),
m_create_option_guide(NULL),
m_formatlist(NULL)
m_formatlist(NULL),
m_is_loading(FALSE)
{
}
//-------------------------------------------------
// device_config_complete - update configuration
// based on completed device setup
//-------------------------------------------------
void legacy_image_device_config_base::device_config_complete()
void legacy_image_device_base::device_config_complete()
{
const device_config_image_interface *image = NULL;
const device_image_interface *image = NULL;
int count = 0;
int index = -1;
image_device_format **formatptr;
@ -75,35 +103,35 @@ void legacy_image_device_config_base::device_config_complete()
formatptr = &m_formatlist;
int cnt = 0;
m_type = static_cast<iodevice_t>(get_legacy_config_int(DEVINFO_INT_IMAGE_TYPE));
m_readable = get_legacy_config_int(DEVINFO_INT_IMAGE_READABLE)!=0;
m_writeable = get_legacy_config_int(DEVINFO_INT_IMAGE_WRITEABLE)!=0;
m_creatable = get_legacy_config_int(DEVINFO_INT_IMAGE_CREATABLE)!=0;
m_must_be_loaded = get_legacy_config_int(DEVINFO_INT_IMAGE_MUST_BE_LOADED)!=0;
m_reset_on_load = get_legacy_config_int(DEVINFO_INT_IMAGE_RESET_ON_LOAD)!=0;
m_has_partial_hash = get_legacy_config_int(DEVINFO_FCT_IMAGE_PARTIAL_HASH)!=0;
m_type = static_cast<iodevice_t>(get_legacy_int(DEVINFO_INT_IMAGE_TYPE));
m_readable = get_legacy_int(DEVINFO_INT_IMAGE_READABLE)!=0;
m_writeable = get_legacy_int(DEVINFO_INT_IMAGE_WRITEABLE)!=0;
m_creatable = get_legacy_int(DEVINFO_INT_IMAGE_CREATABLE)!=0;
m_must_be_loaded = get_legacy_int(DEVINFO_INT_IMAGE_MUST_BE_LOADED)!=0;
m_reset_on_load = get_legacy_int(DEVINFO_INT_IMAGE_RESET_ON_LOAD)!=0;
m_has_partial_hash = get_legacy_int(DEVINFO_FCT_IMAGE_PARTIAL_HASH)!=0;
m_interface_name = get_legacy_config_string(DEVINFO_STR_IMAGE_INTERFACE);
m_interface_name = get_legacy_string(DEVINFO_STR_IMAGE_INTERFACE);
m_file_extensions = get_legacy_config_string(DEVINFO_STR_IMAGE_FILE_EXTENSIONS);
m_file_extensions = get_legacy_string(DEVINFO_STR_IMAGE_FILE_EXTENSIONS);
m_create_option_guide = reinterpret_cast<const option_guide *>(get_legacy_config_ptr(DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE));
m_create_option_guide = reinterpret_cast<const option_guide *>(get_legacy_ptr(DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE));
int format_count = get_legacy_config_int(DEVINFO_INT_IMAGE_CREATE_OPTCOUNT);
int format_count = get_legacy_int(DEVINFO_INT_IMAGE_CREATE_OPTCOUNT);
for (int i = 0; i < format_count; i++)
{
// only add if creatable
if (get_legacy_config_string(DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + i)) {
if (get_legacy_string(DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + i)) {
// allocate a new format
format = global_alloc_clear(image_device_format);
// populate it
format->m_index = cnt;
format->m_name = get_legacy_config_string(DEVINFO_STR_IMAGE_CREATE_OPTNAME + i);
format->m_description = get_legacy_config_string(DEVINFO_STR_IMAGE_CREATE_OPTDESC + i);
format->m_extensions = get_legacy_config_string(DEVINFO_STR_IMAGE_CREATE_OPTEXTS + i);
format->m_optspec = get_legacy_config_string(DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + i);
format->m_name = get_legacy_string(DEVINFO_STR_IMAGE_CREATE_OPTNAME + i);
format->m_description = get_legacy_string(DEVINFO_STR_IMAGE_CREATE_OPTDESC + i);
format->m_extensions = get_legacy_string(DEVINFO_STR_IMAGE_CREATE_OPTEXTS + i);
format->m_optspec = get_legacy_string(DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + i);
// and append it to the list
*formatptr = format;
@ -112,7 +140,7 @@ void legacy_image_device_config_base::device_config_complete()
}
}
for (bool gotone = device_config::m_machine_config.m_devicelist.first(image); gotone; gotone = image->next(image))
for (bool gotone = device_t::m_machine_config.devicelist().first(image); gotone; gotone = image->next(image))
{
if (this == image)
index = count;
@ -129,11 +157,11 @@ void legacy_image_device_config_base::device_config_complete()
m_brief_instance_name = device_brieftypename(m_type);
}
// Override in case of hardcoded values
if (strlen(get_legacy_config_string(DEVINFO_STR_IMAGE_INSTANCE_NAME))>0) {
m_instance_name = get_legacy_config_string(DEVINFO_STR_IMAGE_INSTANCE_NAME);
if (strlen(get_legacy_string(DEVINFO_STR_IMAGE_INSTANCE_NAME))>0) {
m_instance_name = get_legacy_string(DEVINFO_STR_IMAGE_INSTANCE_NAME);
}
if (strlen(get_legacy_config_string(DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME))>0) {
m_brief_instance_name = get_legacy_config_string(DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME);
if (strlen(get_legacy_string(DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME))>0) {
m_brief_instance_name = get_legacy_string(DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME);
}
}
@ -142,7 +170,7 @@ void legacy_image_device_config_base::device_config_complete()
// based on completed device setup
//-------------------------------------------------
bool legacy_image_device_config_base::uses_file_extension(const char *file_extension) const
bool legacy_image_device_base::uses_file_extension(const char *file_extension) const
{
bool result = FALSE;
@ -164,44 +192,6 @@ bool legacy_image_device_config_base::uses_file_extension(const char *file_exten
return result;
}
//-------------------------------------------------
// ~legacy_device_config_base - destructor
//-------------------------------------------------
legacy_image_device_config_base::~legacy_image_device_config_base()
{
image_device_format **formatptr = &m_formatlist;
/* free all entries */
while (*formatptr != NULL)
{
image_device_format *entry = *formatptr;
*formatptr = entry->m_next;
global_free(entry);
}
}
device_image_partialhash_func legacy_image_device_config_base::get_partial_hash() const
{
return reinterpret_cast<device_image_partialhash_func>(get_legacy_config_fct(DEVINFO_FCT_IMAGE_PARTIAL_HASH));
}
//**************************************************************************
// LIVE LEGACY IMAGE DEVICE
//**************************************************************************
//-------------------------------------------------
// legacy_image_device_base - constructor
//-------------------------------------------------
legacy_image_device_base::legacy_image_device_base(running_machine &machine, const device_config &config)
: legacy_device_base(machine, config),
device_image_interface(machine, config, *this),
m_is_loading(FALSE)
{
}
/****************************************************************************
IMAGE LOADING
****************************************************************************/
@ -282,13 +272,13 @@ void legacy_image_device_base::determine_open_plan(int is_create, UINT32 *open_p
int i = 0;
/* emit flags */
if (!is_create && m_image_config.is_readable() && m_image_config.is_writeable())
if (!is_create && is_readable() && is_writeable())
open_plan[i++] = OPEN_FLAG_READ | OPEN_FLAG_WRITE;
if (!is_create && !m_image_config.is_readable() && m_image_config.is_writeable())
if (!is_create && !is_readable() && is_writeable())
open_plan[i++] = OPEN_FLAG_WRITE;
if (!is_create && m_image_config.is_readable())
if (!is_create && is_readable())
open_plan[i++] = OPEN_FLAG_READ;
if (m_image_config.is_writeable() && m_image_config.is_creatable())
if (is_writeable() && is_creatable())
open_plan[i++] = OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE;
open_plan[i] = 0;
}
@ -498,7 +488,7 @@ done:
}
else {
/* do we need to reset the CPU? only schedule it if load/create is successful */
if (device().machine().time() > attotime::zero && m_image_config.is_reset_on_load())
if (device().machine().time() > attotime::zero && is_reset_on_load())
device().machine().schedule_hard_reset();
else
{
@ -542,7 +532,7 @@ bool legacy_image_device_base::finish_load()
if (m_from_swlist)
call_display_info();
if (has_been_created() && m_config.get_legacy_config_fct(DEVINFO_FCT_IMAGE_CREATE) != NULL)
if (has_been_created() && get_legacy_fct(DEVINFO_FCT_IMAGE_CREATE) != NULL)
{
err = call_create(m_create_format, m_create_args);
if (err)
@ -631,7 +621,7 @@ void legacy_image_device_base::unload()
int legacy_image_device_base::call_load()
{
device_image_load_func func = reinterpret_cast<device_image_load_func>(m_config.get_legacy_config_fct(DEVINFO_FCT_IMAGE_LOAD));
device_image_load_func func = reinterpret_cast<device_image_load_func>(get_legacy_fct(DEVINFO_FCT_IMAGE_LOAD));
if (func) {
return (*func)(*this);
} else {
@ -641,7 +631,7 @@ int legacy_image_device_base::call_load()
bool legacy_image_device_base::call_softlist_load(char *swlist, char *swname, rom_entry *start_entry)
{
device_image_softlist_load_func func = reinterpret_cast<device_image_softlist_load_func>(m_config.get_legacy_config_fct(DEVINFO_FCT_IMAGE_SOFTLIST_LOAD));
device_image_softlist_load_func func = reinterpret_cast<device_image_softlist_load_func>(get_legacy_fct(DEVINFO_FCT_IMAGE_SOFTLIST_LOAD));
if (func) {
return (*func)(*this,swlist,swname,start_entry);
} else {
@ -651,7 +641,7 @@ bool legacy_image_device_base::call_softlist_load(char *swlist, char *swname, ro
int legacy_image_device_base::call_create(int format_type, option_resolution *format_options)
{
device_image_create_func func = reinterpret_cast<device_image_create_func>(m_config.get_legacy_config_fct(DEVINFO_FCT_IMAGE_CREATE));
device_image_create_func func = reinterpret_cast<device_image_create_func>(get_legacy_fct(DEVINFO_FCT_IMAGE_CREATE));
if (func) {
return (*func)(*this,format_type,format_options);
} else {
@ -661,34 +651,34 @@ int legacy_image_device_base::call_create(int format_type, option_resolution *fo
void legacy_image_device_base::call_unload()
{
device_image_unload_func func = reinterpret_cast<device_image_unload_func>(m_config.get_legacy_config_fct(DEVINFO_FCT_IMAGE_UNLOAD));
device_image_unload_func func = reinterpret_cast<device_image_unload_func>(get_legacy_fct(DEVINFO_FCT_IMAGE_UNLOAD));
if (func) (*func)(*this);
}
void legacy_image_device_base::call_display()
{
device_image_display_func func = reinterpret_cast<device_image_display_func>(m_config.get_legacy_config_fct(DEVINFO_FCT_IMAGE_DISPLAY));
device_image_display_func func = reinterpret_cast<device_image_display_func>(get_legacy_fct(DEVINFO_FCT_IMAGE_DISPLAY));
if (func) (*func)(*this);
}
void legacy_image_device_base::call_display_info()
{
device_image_display_info_func func = reinterpret_cast<device_image_display_info_func>(m_config.get_legacy_config_fct(DEVINFO_FCT_IMAGE_DISPLAY_INFO));
device_image_display_info_func func = reinterpret_cast<device_image_display_info_func>(get_legacy_fct(DEVINFO_FCT_IMAGE_DISPLAY_INFO));
if (func) (*func)(*this);
}
device_image_partialhash_func legacy_image_device_base::get_partial_hash()
{
return reinterpret_cast<device_image_partialhash_func>(m_config.get_legacy_config_fct(DEVINFO_FCT_IMAGE_PARTIAL_HASH));
return reinterpret_cast<device_image_partialhash_func>(get_legacy_fct(DEVINFO_FCT_IMAGE_PARTIAL_HASH));
}
void legacy_image_device_base::call_get_devices()
{
device_image_get_devices_func func = reinterpret_cast<device_image_get_devices_func>(m_config.get_legacy_config_fct(DEVINFO_FCT_IMAGE_GET_DEVICES));
device_image_get_devices_func func = reinterpret_cast<device_image_get_devices_func>(get_legacy_fct(DEVINFO_FCT_IMAGE_GET_DEVICES));
if (func) (*func)(*this);
}
void *legacy_image_device_base::get_device_specific_call()
{
return (void*) m_config.get_legacy_config_fct(DEVINFO_FCT_DEVICE_SPECIFIC);
return (void*) get_legacy_fct(DEVINFO_FCT_DEVICE_SPECIFIC);
}

File diff suppressed because it is too large Load Diff

View File

@ -58,40 +58,6 @@
// shorthand for accessing devices by machine/type/tag
#define devtag_reset(mach,tag) (mach).device(tag)->reset()
// often derived devices need only a different name and a simple parameter to differentiate them
// these are provided as macros because you can't pass string literals to templates, annoyingly enough
// use this to declare the existence of a derived device in the header file
#define DECLARE_TRIVIAL_DERIVED_DEVICE(_ConfigClass, _ConfigBase, _DeviceClass, _DeviceBase) \
typedef _DeviceBase _DeviceClass; \
class _ConfigClass; \
\
class _ConfigClass : public _ConfigBase \
{ \
protected: \
_ConfigClass(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock, UINT32 param = 0); \
\
public: \
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); \
virtual device_t *alloc_device(running_machine &machine) const; \
}; \
// use this macro to define the actual implementation in the source file
#define DEFINE_TRIVIAL_DERIVED_DEVICE(_ConfigClass, _ConfigBase, _DeviceClass, _DeviceBase, _Name, _Param) \
_ConfigClass::_ConfigClass(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock, UINT32 param) \
: _ConfigBase(mconfig, static_alloc_device_config, _Name, tag, owner, clock, param) \
{ \
} \
\
device_config *_ConfigClass::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) \
{ \
return global_alloc(_ConfigClass(mconfig, tag, owner, clock, _Param)); \
} \
\
device_t *_ConfigClass::alloc_device(running_machine &machine) const \
{ \
return auto_alloc(machine, _DeviceClass(machine, *this)); \
} \
//**************************************************************************
@ -100,16 +66,16 @@ device_t *_ConfigClass::alloc_device(running_machine &machine) const \
// configure devices
#define MCFG_DEVICE_CONFIG(_config) \
device_config::static_set_static_config(device, &(_config)); \
device_t::static_set_static_config(*device, &(_config)); \
#define MCFG_DEVICE_CONFIG_CLEAR() \
device_config::static_set_static_config(device, NULL); \
device_t::static_set_static_config(*device, NULL); \
#define MCFG_DEVICE_CLOCK(_clock) \
device_config::static_set_clock(device, _clock); \
device_t::static_set_clock(*device, _clock); \
#define MCFG_DEVICE_INPUT_DEFAULTS(_config) \
device_config::static_set_input_default(device, DEVICE_INPUT_DEFAULTS_NAME(_config)); \
device_t::static_set_input_default(*device, DEVICE_INPUT_DEFAULTS_NAME(_config)); \
//**************************************************************************
@ -119,8 +85,6 @@ device_t *_ConfigClass::alloc_device(running_machine &machine) const \
// forward references
class memory_region;
class device_debug;
class device_config;
class device_config_interface;
class device_t;
class device_interface;
class device_execute_interface;
@ -138,7 +102,15 @@ class device_missing_dependencies : public emu_exception { };
// a device_type is simply a pointer to its alloc function
typedef device_config *(*device_type)(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
typedef device_t *(*device_type)(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// this template function creates a stub which constructs a device
template<class T>
device_t *device_creator(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
{
return global_alloc(T(mconfig, tag, owner, clock));
}
// timer IDs for devices
@ -154,14 +126,23 @@ typedef void (*write_line_device_func)(device_t *device, int state);
// ======================> tagged_device_list
// tagged_device_list is a tagged_list with additional searching based on type
template<class T>
class tagged_device_list : public tagged_list<T>
class device_list : public tagged_list<device_t>
{
typedef tagged_list<T> super;
typedef tagged_list<device_t> super;
public:
tagged_device_list(resource_pool &pool = global_resource_pool)
: tagged_list<T>(pool) { }
// construction/destruction
device_list(resource_pool &pool = global_resource_pool);
// getters
running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
// bulk operations
void set_machine_all(running_machine &machine);
void start_all();
void start_new_devices();
void reset_all() const;
void stop_all();
// pull the generic forms forward
using super::first;
@ -170,126 +151,54 @@ public:
using super::find;
// provide type-specific overrides
T *first(device_type type) const
{
T *cur;
for (cur = super::first(); cur != NULL && cur->type() != type; cur = cur->next()) ;
return cur;
}
int count(device_type type) const
{
int num = 0;
for (const T *curdev = first(type); curdev != NULL; curdev = curdev->typenext()) num++;
return num;
}
int indexof(device_type type, T &object) const
{
int num = 0;
for (T *cur = first(type); cur != NULL; cur = cur->typenext(), num++)
if (cur == &object) return num;
return -1;
}
int indexof(device_type type, const char *tag) const
{
T *object = find(tag);
return (object != NULL && object->type() == type) ? indexof(type, *object) : -1;
}
T *find(device_type type, int index) const
{
for (T *cur = first(type); cur != NULL; cur = cur->typenext())
if (index-- == 0) return cur;
return NULL;
}
device_t *first(device_type type) const;
int count(device_type type) const;
int indexof(device_type type, device_t &object) const;
int indexof(device_type type, const char *tag) const;
device_t *find(device_type type, int index) const;
// provide interface-specific overrides
template<class I>
bool first(I *&intf) const
{
for (T *cur = super::first(); cur != NULL; cur = cur->next())
if (cur->interface(intf))
return true;
return false;
}
};
// ======================> device_config_list
// device_config_list manages a list of device_configs
typedef tagged_device_list<device_config> device_config_list;
// ======================> device_list
// device_list manages a list of device_ts
class device_list : public tagged_device_list<device_t>
{
running_machine *m_machine;
bool first(I *&intf) const;
private:
// internal helpers
static void static_reset(running_machine &machine);
static void static_exit(running_machine &machine);
static void static_pre_save(running_machine &machine, void *param);
static void static_post_load(running_machine &machine, void *param);
public:
device_list(resource_pool &pool = global_resource_pool);
void import_config_list(const device_config_list &list, running_machine &machine);
running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
void start_all();
void reset_all();
// internal state
running_machine *m_machine;
};
// ======================> device_config
// ======================> device_t
// device_config represents a device configuration that is attached to a machine_config
class device_config
// device_t represents a device
class device_t : public bindable_object
{
DISABLE_COPYING(device_config);
DISABLE_COPYING(device_t);
friend class machine_config;
friend class device_t;
friend class device_config_interface;
friend class simple_list<device_config>;
friend class device_interface;
friend class device_memory_interface;
friend class device_state_interface;
friend class device_execute_interface;
friend class simple_list<device_t>;
friend class device_list;
protected:
// construction/destruction
device_config(const machine_config &mconfig, device_type type, const char *name, const char *tag, const device_config *owner, UINT32 clock, UINT32 param = 0);
device_config(const machine_config &mconfig, device_type type, const char *name, const char *shortname, const char *tag, const device_config *owner, UINT32 clock, UINT32 param = 0);
virtual ~device_config();
device_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
device_t(const machine_config &mconfig, device_type type, const char *name, const char *shortname, const char *tag, device_t *owner, UINT32 clock);
virtual ~device_t();
public:
// iteration helpers
device_config *next() const { return m_next; }
device_config *typenext() const;
device_config *owner() const { return m_owner; }
// interface helpers
template<class T> bool interface(const T *&intf) const { intf = dynamic_cast<const T *>(this); return (intf != NULL); }
template<class T> bool next(T *&intf) const
{
for (device_config *cur = m_next; cur != NULL; cur = cur->m_next)
if (cur->interface(intf))
return true;
return false;
}
// owned object helpers
astring &subtag(astring &dest, const char *tag) const;
astring &siblingtag(astring &dest, const char *tag) const;
// basic information getters
// getters
running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
device_type type() const { return m_type; }
UINT32 clock() const { return m_clock; }
UINT32 configured_clock() const { return m_configured_clock; }
const char *name() const { return m_name; }
const char *shortname() const { return m_shortname; }
const char *searchpath() const { return m_searchpath; }
@ -301,109 +210,6 @@ public:
machine_config_constructor machine_config_additions() const { return device_mconfig_additions(); }
const input_port_token *input_ports() const { return device_input_ports(); }
// methods that wrap both interface-level and device-level behavior
void config_complete();
bool validity_check(emu_options &options, const game_driver &driver) const;
// configuration helpers
static void static_set_clock(device_config *device, UINT32 clock) { device->m_clock = clock; }
static void static_set_static_config(device_config *device, const void *config) { device->m_static_config = config; }
static void static_set_input_default(device_config *device, const input_device_default *config) { device->m_input_defaults = config; }
//------------------- begin derived class overrides
// required operation overrides
virtual device_t *alloc_device(running_machine &machine) const = 0;
// optional operation overrides
protected:
virtual void device_config_complete();
virtual bool device_validity_check(emu_options &options, const game_driver &driver) const;
// optional information overrides
virtual const rom_entry *device_rom_region() const;
virtual machine_config_constructor device_mconfig_additions() const;
virtual const input_port_token *device_input_ports() const;
//------------------- end derived class overrides
// device relationships
device_config * m_next; // next device (of any type/class)
device_config * m_owner; // device that owns us, or NULL if nobody
device_config_interface *m_interface_list; // head of interface list
const device_type m_type; // device type
UINT32 m_clock; // device clock
const machine_config & m_machine_config; // reference to the machine's configuration
const void * m_static_config; // static device configuration
const input_device_default *m_input_defaults; // devices input ports default overrides
astring m_name; // name of the device
astring m_shortname; // short name of the device
astring m_searchpath; // search path, used for media loading
private:
astring m_tag; // tag for this instance
bool m_config_complete; // have we completed our configuration?
};
// ======================> device_config_interface
// device_config_interface represents configuration information for a particular device interface
class device_config_interface
{
DISABLE_COPYING(device_config_interface);
protected:
// construction/destruction
device_config_interface(const machine_config &mconfig, device_config &devconfig);
virtual ~device_config_interface();
public:
// casting helpers
const device_config &devconfig() const { return m_device_config; }
operator const device_config &() const { return m_device_config; }
operator const device_config *() const { return &m_device_config; }
// iteration helpers
device_config_interface *interface_next() const { return m_interface_next; }
template<class T> bool next(T *&intf) const { return m_device_config.next(intf); }
// optional operation overrides
virtual void interface_config_complete();
virtual bool interface_validity_check(emu_options &options, const game_driver &driver) const;
protected:
const device_config & m_device_config;
const machine_config & m_machine_config;
device_config_interface * m_interface_next;
};
// ======================> device_t
// device_t represents a device that is live and attached to a running_machine
class device_t : public bindable_object
{
DISABLE_COPYING(device_t);
friend class device_interface;
friend class simple_list<device_t>;
friend class device_list;
protected:
// construction/destruction
device_t(running_machine &machine, const device_config &config);
virtual ~device_t();
public:
// getters
running_machine &machine() const { return m_machine; }
// iteration helpers
device_t *next() const { return m_next; }
device_t *typenext() const;
@ -427,22 +233,28 @@ public:
bool interface(device_memory_interface *&intf) const { intf = m_memory; return (intf != NULL); }
bool interface(device_state_interface *&intf) { intf = m_state; return (intf != NULL); }
bool interface(device_state_interface *&intf) const { intf = m_state; return (intf != NULL); }
device_execute_interface &execute() const { assert(m_execute != NULL); return *m_execute; }
device_memory_interface &memory() const { assert(m_memory != NULL); return *m_memory; }
// owned object helpers
astring &subtag(astring &dest, const char *tag) const { return m_baseconfig.subtag(dest, tag); }
astring &siblingtag(astring &dest, const char *tag) const { return m_baseconfig.siblingtag(dest, tag); }
astring &subtag(astring &dest, const char *tag) const;
astring &siblingtag(astring &dest, const char *tag) const;
const memory_region *subregion(const char *tag) const;
device_t *subdevice(const char *tag) const;
device_t *siblingdevice(const char *tag) const;
template<class T> inline T *subdevice(const char *tag) { return downcast<T *>(subdevice(tag)); }
template<class T> inline T *siblingdevice(const char *tag) { return downcast<T *>(siblingdevice(tag)); }
// configuration helpers
const device_config &baseconfig() const { return m_baseconfig; }
const memory_region *region() const { return m_region; }
// configuration helpers
static void static_set_clock(device_t &device, UINT32 clock) { device.m_clock = clock; }
static void static_set_static_config(device_t &device, const void *config) { device.m_static_config = config; }
static void static_set_input_default(device_t &device, const input_device_default *config) { device.m_input_defaults = config; }
// state helpers
void config_complete();
bool configured() const { return m_config_complete; }
bool validity_check(emu_options &options, const game_driver &driver) const;
bool started() const { return m_started; }
void reset();
@ -463,27 +275,18 @@ public:
// state saving interfaces
template<typename T>
void save_item(T &value, const char *valname, int index = 0) { m_save_manager.save_item(name(), tag(), index, value, valname); }
void save_item(T &value, const char *valname, int index = 0) { assert(m_save != NULL); m_save->save_item(name(), tag(), index, value, valname); }
template<typename T>
void save_pointer(T *value, const char *valname, UINT32 count, int index = 0) { m_save_manager.save_pointer(name(), tag(), index, value, valname, count); }
void save_pointer(T *value, const char *valname, UINT32 count, int index = 0) { assert(m_save != NULL); m_save->save_pointer(name(), tag(), index, value, valname, count); }
// debugging
device_debug *debug() const { return m_debug; }
// basic information getters ... pass through to underlying config
device_type type() const { return m_baseconfig.type(); }
const char *name() const { return m_baseconfig.name(); }
const char *tag() const { return m_baseconfig.tag(); }
// machine and ROM configuration getters ... pass through to underlying config
const rom_entry *rom_region() const { return m_baseconfig.rom_region(); }
machine_config_constructor machine_config_additions() const { return m_baseconfig.machine_config_additions(); }
const input_port_token *input_ports() const { return m_baseconfig.input_ports(); }
protected:
// miscellaneous helpers
void find_interfaces();
void set_machine(running_machine &machine);
void start();
void stop();
void debug_setup();
void pre_save();
void post_load();
@ -492,17 +295,22 @@ protected:
//------------------- begin derived class overrides
// device-level overrides
virtual const rom_entry *device_rom_region() const;
virtual machine_config_constructor device_mconfig_additions() const;
virtual const input_port_token *device_input_ports() const;
virtual void device_config_complete();
virtual bool device_validity_check(emu_options &options, const game_driver &driver) const;
virtual void device_start() = 0;
virtual void device_stop();
virtual void device_reset();
virtual void device_pre_save();
virtual void device_post_load();
virtual void device_clock_changed();
virtual void device_debug_setup();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
//------------------- end derived class overrides
save_manager & m_save_manager;
device_debug * m_debug;
// core device interfaces for speed
@ -515,11 +323,21 @@ protected:
device_t * m_owner; // device that owns us, or NULL if nobody
device_interface * m_interface_list; // head of interface list
const device_type m_type; // device type
UINT32 m_configured_clock; // originally configured device clock
const machine_config & m_machine_config; // reference to the machine's configuration
const void * m_static_config; // static device configuration
const input_device_default *m_input_defaults; // devices input ports default overrides
astring m_name; // name of the device
astring m_shortname; // short name of the device
astring m_searchpath; // search path, used for media loading
bool m_started; // true if the start function has succeeded
UINT32 m_clock; // device clock
const memory_region * m_region; // our device-local region
const device_config & m_baseconfig; // reference to our device_config
UINT32 m_unscaled_clock; // unscaled clock
double m_clock_scale; // clock scale factor
attoseconds_t m_attoseconds_per_clock;// period in attoseconds
@ -630,7 +448,11 @@ protected:
auto_finder_base * m_auto_finder_list;
private:
running_machine & m_machine;
// private state; accessor use required
running_machine * m_machine;
save_manager * m_save;
astring m_tag; // tag for this instance
bool m_config_complete; // have we completed our configuration?
};
@ -644,7 +466,7 @@ class device_interface
protected:
// construction/destruction
device_interface(running_machine &machine, const device_config &config, device_t &device);
device_interface(device_t &device);
virtual ~device_interface();
public:
@ -659,16 +481,21 @@ public:
template<class T> bool next(T *&intf) const { return m_device.next(intf); }
// optional operation overrides
virtual void interface_config_complete();
virtual bool interface_validity_check(emu_options &options, const game_driver &driver) const;
virtual void interface_pre_start();
virtual void interface_post_start();
virtual void interface_pre_reset();
virtual void interface_post_reset();
virtual void interface_pre_stop();
virtual void interface_post_stop();
virtual void interface_pre_save();
virtual void interface_post_load();
virtual void interface_clock_changed();
virtual void interface_debug_setup();
protected:
// internal state
device_interface * m_interface_next;
device_t & m_device;
};
@ -682,38 +509,35 @@ protected:
// ======================> device config helpers
// find the next device_config of the same type
inline device_config *device_config::typenext() const
// find the next device_t of the same type
inline device_t *device_t::typenext() const
{
device_config *cur;
device_t *cur;
for (cur = m_next; cur != NULL && cur->m_type != m_type; cur = cur->m_next) ;
return cur;
}
// create a tag for an object that is owned by this device
inline astring &device_config::subtag(astring &dest, const char *_tag) const
inline astring &device_t::subtag(astring &dest, const char *_tag) const
{
// temp. for now: don't include the root tag in the full tag name
return (this != NULL && m_owner != NULL) ? dest.cpy(m_tag).cat(":").cat(_tag) : dest.cpy(_tag);
}
// create a tag for an object that a sibling to this device
inline astring &device_config::siblingtag(astring &dest, const char *_tag) const
inline astring &device_t::siblingtag(astring &dest, const char *_tag) const
{
return (this != NULL && m_owner != NULL) ? m_owner->subtag(dest, _tag) : dest.cpy(_tag);
}
// ======================> running device helpers
// find the next device_t of the same type
inline device_t *device_t::typenext() const
template<class I>
bool device_list::first(I *&intf) const
{
device_t *cur;
for (cur = m_next; cur != NULL && cur->type() != type(); cur = cur->m_next) ;
return cur;
for (device_t *cur = super::first(); cur != NULL; cur = cur->next())
if (cur->interface(intf))
return true;
return false;
}
#endif /* __DEVINTRF_H__ */

View File

@ -46,42 +46,54 @@
//**************************************************************************
//-------------------------------------------------
// legacy_device_config_base - constructor
// legacy_device_base - constructor
//-------------------------------------------------
legacy_device_config_base::legacy_device_config_base(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock, device_get_config_func get_config)
: device_config(mconfig, type, "Legacy Device", tag, owner, clock),
legacy_device_base::legacy_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, device_get_config_func get_config)
: device_t(mconfig, type, "Legacy Device", tag, owner, clock),
m_get_config_func(get_config),
m_inline_config(NULL)
{
// allocate a buffer for the inline configuration
UINT32 configlen = (UINT32)get_legacy_config_int(DEVINFO_INT_INLINE_CONFIG_BYTES);
UINT32 configlen = (UINT32)get_legacy_int(DEVINFO_INT_INLINE_CONFIG_BYTES);
if (configlen != 0)
m_inline_config = global_alloc_array_clear(UINT8, configlen);
// set the proper name
m_name = get_legacy_config_string(DEVINFO_STR_NAME);
m_shortname = get_legacy_config_string(DEVINFO_STR_SHORTNAME);
m_name = get_legacy_string(DEVINFO_STR_NAME);
m_shortname = get_legacy_string(DEVINFO_STR_SHORTNAME);
m_searchpath = m_shortname;
// create the token
int tokenbytes = get_legacy_int(DEVINFO_INT_TOKEN_BYTES);
if (tokenbytes != 0)
m_token = global_alloc_array_clear(UINT8, tokenbytes);
}
//-------------------------------------------------
// ~legacy_device_config_base - destructor
// ~legacy_device_base - destructor
//-------------------------------------------------
legacy_device_config_base::~legacy_device_config_base()
legacy_device_base::~legacy_device_base()
{
if (m_started)
{
device_stop_func stop_func = reinterpret_cast<device_stop_func>(get_legacy_fct(DEVINFO_FCT_STOP));
if (stop_func != NULL)
(*stop_func)(this);
}
global_free(m_token);
global_free(m_inline_config);
}
//-------------------------------------------------
// get_legacy_config_int - return a legacy
// get_legacy_int - return a legacy
// configuration parameter as an integer
//-------------------------------------------------
INT64 legacy_device_config_base::get_legacy_config_int(UINT32 state) const
INT64 legacy_device_base::get_legacy_int(UINT32 state) const
{
deviceinfo info = { 0 };
(*m_get_config_func)(this, state, &info);
@ -90,11 +102,11 @@ INT64 legacy_device_config_base::get_legacy_config_int(UINT32 state) const
//-------------------------------------------------
// get_legacy_config_ptr - return a legacy
// get_legacy_ptr - return a legacy
// configuration parameter as a pointer
//-------------------------------------------------
void *legacy_device_config_base::get_legacy_config_ptr(UINT32 state) const
void *legacy_device_base::get_legacy_ptr(UINT32 state) const
{
deviceinfo info = { 0 };
(*m_get_config_func)(this, state, &info);
@ -103,11 +115,11 @@ void *legacy_device_config_base::get_legacy_config_ptr(UINT32 state) const
//-------------------------------------------------
// get_legacy_config_fct - return a legacy
// get_legacy_fct - return a legacy
// configuration parameter as a function pointer
//-------------------------------------------------
genf *legacy_device_config_base::get_legacy_config_fct(UINT32 state) const
genf *legacy_device_base::get_legacy_fct(UINT32 state) const
{
deviceinfo info = { 0 };
(*m_get_config_func)(this, state, &info);
@ -116,11 +128,11 @@ genf *legacy_device_config_base::get_legacy_config_fct(UINT32 state) const
//-------------------------------------------------
// get_legacy_config_string - return a legacy
// get_legacy_string - return a legacy
// configuration parameter as a string pointer
//-------------------------------------------------
const char *legacy_device_config_base::get_legacy_config_string(UINT32 state) const
const char *legacy_device_base::get_legacy_string(UINT32 state) const
{
deviceinfo info;
info.s = get_temp_string_buffer();
@ -134,10 +146,10 @@ const char *legacy_device_config_base::get_legacy_config_string(UINT32 state) co
// set a 32-bit value in the inline configuration
//-------------------------------------------------
void legacy_device_config_base::static_set_inline32(device_config *device, UINT32 offset, UINT32 size, UINT32 value)
void legacy_device_base::static_set_inline32(device_t &device, UINT32 offset, UINT32 size, UINT32 value)
{
legacy_device_config_base *legacy = downcast<legacy_device_config_base *>(device);
void *dest = reinterpret_cast<UINT8 *>(legacy->m_inline_config) + offset;
legacy_device_base &legacy = downcast<legacy_device_base &>(device);
void *dest = reinterpret_cast<UINT8 *>(legacy.m_inline_config) + offset;
if (size == 1)
*reinterpret_cast<UINT8 *>(dest) = value;
else if (size == 2)
@ -145,7 +157,7 @@ void legacy_device_config_base::static_set_inline32(device_config *device, UINT3
else if (size == 4)
*reinterpret_cast<UINT32 *>(dest) = value;
else
throw emu_fatalerror("Unexpected size %d in legacy_device_config_base::static_set_inline32", size);
throw emu_fatalerror("Unexpected size %d in legacy_device_base::static_set_inline32", size);
}
@ -154,10 +166,10 @@ void legacy_device_config_base::static_set_inline32(device_config *device, UINT3
// set a 64-bit value in the inline configuration
//-------------------------------------------------
void legacy_device_config_base::static_set_inline64(device_config *device, UINT32 offset, UINT32 size, UINT64 value)
void legacy_device_base::static_set_inline64(device_t &device, UINT32 offset, UINT32 size, UINT64 value)
{
legacy_device_config_base *legacy = downcast<legacy_device_config_base *>(device);
void *dest = reinterpret_cast<UINT8 *>(legacy->m_inline_config) + offset;
legacy_device_base &legacy = downcast<legacy_device_base &>(device);
void *dest = reinterpret_cast<UINT8 *>(legacy.m_inline_config) + offset;
if (size == 1)
*reinterpret_cast<UINT8 *>(dest) = value;
else if (size == 2)
@ -167,7 +179,7 @@ void legacy_device_config_base::static_set_inline64(device_config *device, UINT3
else if (size == 8)
*reinterpret_cast<UINT64 *>(dest) = value;
else
throw emu_fatalerror("Unexpected size %d in legacy_device_config_base::static_set_inline64", size);
throw emu_fatalerror("Unexpected size %d in legacy_device_base::static_set_inline64", size);
}
@ -177,14 +189,14 @@ void legacy_device_config_base::static_set_inline64(device_config *device, UINT3
// configuration
//-------------------------------------------------
void legacy_device_config_base::static_set_inline_float(device_config *device, UINT32 offset, UINT32 size, float value)
void legacy_device_base::static_set_inline_float(device_t &device, UINT32 offset, UINT32 size, float value)
{
legacy_device_config_base *legacy = downcast<legacy_device_config_base *>(device);
void *dest = reinterpret_cast<UINT8 *>(legacy->m_inline_config) + offset;
legacy_device_base &legacy = downcast<legacy_device_base &>(device);
void *dest = reinterpret_cast<UINT8 *>(legacy.m_inline_config) + offset;
if (size == 4)
*reinterpret_cast<float *>(dest) = value;
else
throw emu_fatalerror("Unexpected size %d in legacy_device_config_base::static_set_inline_float", size);
throw emu_fatalerror("Unexpected size %d in legacy_device_base::static_set_inline_float", size);
}
@ -193,57 +205,22 @@ void legacy_device_config_base::static_set_inline_float(device_config *device, U
// checks on a device configuration
//-------------------------------------------------
bool legacy_device_config_base::device_validity_check(emu_options &options, const game_driver &driver) const
bool legacy_device_base::device_validity_check(emu_options &options, const game_driver &driver) const
{
device_validity_check_func validity_func = reinterpret_cast<device_validity_check_func>(get_legacy_config_fct(DEVINFO_FCT_VALIDITY_CHECK));
device_validity_check_func validity_func = reinterpret_cast<device_validity_check_func>(get_legacy_fct(DEVINFO_FCT_VALIDITY_CHECK));
if (validity_func != NULL)
return (*validity_func)(&driver, this, options);
return false;
}
//**************************************************************************
// LIVE LEGACY DEVICE
//**************************************************************************
//-------------------------------------------------
// legacy_device_base - constructor
//-------------------------------------------------
legacy_device_base::legacy_device_base(running_machine &_machine, const device_config &config)
: device_t(_machine, config),
m_config(downcast<const legacy_device_config_base &>(config)),
m_token(NULL)
{
int tokenbytes = m_config.get_legacy_config_int(DEVINFO_INT_TOKEN_BYTES);
if (tokenbytes != 0)
m_token = auto_alloc_array_clear(machine(), UINT8, tokenbytes);
}
//-------------------------------------------------
// ~legacy_device_base - destructor
//-------------------------------------------------
legacy_device_base::~legacy_device_base()
{
if (m_started)
{
device_stop_func stop_func = reinterpret_cast<device_stop_func>(m_config.get_legacy_config_fct(DEVINFO_FCT_STOP));
if (stop_func != NULL)
(*stop_func)(this);
}
}
//-------------------------------------------------
// device_start - called to start up a device
//-------------------------------------------------
void legacy_device_base::device_start()
{
device_start_func start_func = reinterpret_cast<device_start_func>(m_config.get_legacy_config_fct(DEVINFO_FCT_START));
device_start_func start_func = reinterpret_cast<device_start_func>(get_legacy_fct(DEVINFO_FCT_START));
assert(start_func != NULL);
(*start_func)(this);
}
@ -255,7 +232,7 @@ void legacy_device_base::device_start()
void legacy_device_base::device_reset()
{
device_reset_func reset_func = reinterpret_cast<device_reset_func>(m_config.get_legacy_config_fct(DEVINFO_FCT_RESET));
device_reset_func reset_func = reinterpret_cast<device_reset_func>(get_legacy_fct(DEVINFO_FCT_RESET));
if (reset_func != NULL)
(*reset_func)(this);
}
@ -263,32 +240,16 @@ void legacy_device_base::device_reset()
//**************************************************************************
// LEGACY SOUND DEVICE CONFIGURATION
//**************************************************************************
//-------------------------------------------------
// legacy_sound_device_config_base - constructor
//-------------------------------------------------
legacy_sound_device_config_base::legacy_sound_device_config_base(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock, device_get_config_func get_config)
: legacy_device_config_base(mconfig, type, tag, owner, clock, get_config),
device_config_sound_interface(mconfig, *this)
{
}
//**************************************************************************
// LIVE LEGACY SOUND DEVICE
// LEGACY SOUND DEVICE
//**************************************************************************
//-------------------------------------------------
// legacy_sound_device_base - constructor
//-------------------------------------------------
legacy_sound_device_base::legacy_sound_device_base(running_machine &machine, const device_config &config)
: legacy_device_base(machine, config),
device_sound_interface(machine, config, *this)
legacy_sound_device_base::legacy_sound_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, device_get_config_func get_config)
: legacy_device_base(mconfig, type, tag, owner, clock, get_config),
device_sound_interface(mconfig, *this)
{
}
@ -306,16 +267,16 @@ void legacy_sound_device_base::sound_stream_update(sound_stream &stream, stream_
//**************************************************************************
// LEGACY MEMORY DEVICE CONFIGURATION
// LEGACY MEMORY DEVICE
//**************************************************************************
//-------------------------------------------------
// legacy_memory_device_config_base - constructor
// legacy_memory_device_base - constructor
//-------------------------------------------------
legacy_memory_device_config_base::legacy_memory_device_config_base(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock, device_get_config_func get_config)
: legacy_device_config_base(mconfig, type, tag, owner, clock, get_config),
device_config_memory_interface(mconfig, *this)
legacy_memory_device_base::legacy_memory_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, device_get_config_func get_config)
: legacy_device_base(mconfig, type, tag, owner, clock, get_config),
device_memory_interface(mconfig, *this)
{
memset(&m_space_config, 0, sizeof(m_space_config));
}
@ -326,64 +287,32 @@ legacy_memory_device_config_base::legacy_memory_device_config_base(const machine
// based on completed device setup
//-------------------------------------------------
void legacy_memory_device_config_base::device_config_complete()
void legacy_memory_device_base::device_config_complete()
{
m_space_config.m_name = "memory";
m_space_config.m_endianness = static_cast<endianness_t>(get_legacy_config_int(DEVINFO_INT_ENDIANNESS));
m_space_config.m_databus_width = get_legacy_config_int(DEVINFO_INT_DATABUS_WIDTH);
m_space_config.m_addrbus_width = get_legacy_config_int(DEVINFO_INT_ADDRBUS_WIDTH);
m_space_config.m_addrbus_shift = get_legacy_config_int(DEVINFO_INT_ADDRBUS_SHIFT);
m_space_config.m_endianness = static_cast<endianness_t>(get_legacy_int(DEVINFO_INT_ENDIANNESS));
m_space_config.m_databus_width = get_legacy_int(DEVINFO_INT_DATABUS_WIDTH);
m_space_config.m_addrbus_width = get_legacy_int(DEVINFO_INT_ADDRBUS_WIDTH);
m_space_config.m_addrbus_shift = get_legacy_int(DEVINFO_INT_ADDRBUS_SHIFT);
m_space_config.m_logaddr_width = m_space_config.m_addrbus_width;
m_space_config.m_page_shift = 0;
m_space_config.m_internal_map = reinterpret_cast<address_map_constructor>(get_legacy_config_fct(DEVINFO_PTR_INTERNAL_MEMORY_MAP));
m_space_config.m_default_map = reinterpret_cast<address_map_constructor>(get_legacy_config_fct(DEVINFO_PTR_DEFAULT_MEMORY_MAP));
m_space_config.m_internal_map = reinterpret_cast<address_map_constructor>(get_legacy_fct(DEVINFO_PTR_INTERNAL_MEMORY_MAP));
m_space_config.m_default_map = reinterpret_cast<address_map_constructor>(get_legacy_fct(DEVINFO_PTR_DEFAULT_MEMORY_MAP));
}
//**************************************************************************
// LIVE LEGACY MEMORY DEVICE
//**************************************************************************
//-------------------------------------------------
// legacy_memory_device_base - constructor
//-------------------------------------------------
legacy_memory_device_base::legacy_memory_device_base(running_machine &machine, const device_config &config)
: legacy_device_base(machine, config),
device_memory_interface(machine, config, *this)
{
}
//**************************************************************************
// LEGACY NVRAM DEVICE CONFIGURATION
//**************************************************************************
//-------------------------------------------------
// legacy_nvram_device_config_base - constructor
//-------------------------------------------------
legacy_nvram_device_config_base::legacy_nvram_device_config_base(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock, device_get_config_func get_config)
: legacy_device_config_base(mconfig, type, tag, owner, clock, get_config),
device_config_nvram_interface(mconfig, *this)
{
}
//**************************************************************************
// LIVE LEGACY NVRAM DEVICE
// LEGACY NVRAM DEVICE
//**************************************************************************
//-------------------------------------------------
// legacy_nvram_device_base - constructor
//-------------------------------------------------
legacy_nvram_device_base::legacy_nvram_device_base(running_machine &machine, const device_config &config)
: legacy_device_base(machine, config),
device_nvram_interface(machine, config, *this)
legacy_nvram_device_base::legacy_nvram_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, device_get_config_func get_config)
: legacy_device_base(mconfig, type, tag, owner, clock, get_config),
device_nvram_interface(mconfig, *this)
{
}
@ -394,7 +323,7 @@ legacy_nvram_device_base::legacy_nvram_device_base(running_machine &machine, con
void legacy_nvram_device_base::nvram_default()
{
device_nvram_func nvram_func = reinterpret_cast<device_nvram_func>(m_config.get_legacy_config_fct(DEVINFO_FCT_NVRAM));
device_nvram_func nvram_func = reinterpret_cast<device_nvram_func>(get_legacy_fct(DEVINFO_FCT_NVRAM));
(*nvram_func)(this, NULL, FALSE);
}
@ -405,7 +334,7 @@ void legacy_nvram_device_base::nvram_default()
void legacy_nvram_device_base::nvram_read(emu_file &file)
{
device_nvram_func nvram_func = reinterpret_cast<device_nvram_func>(m_config.get_legacy_config_fct(DEVINFO_FCT_NVRAM));
device_nvram_func nvram_func = reinterpret_cast<device_nvram_func>(get_legacy_fct(DEVINFO_FCT_NVRAM));
(*nvram_func)(this, &file, FALSE);
}
@ -416,6 +345,6 @@ void legacy_nvram_device_base::nvram_read(emu_file &file)
void legacy_nvram_device_base::nvram_write(emu_file &file)
{
device_nvram_func nvram_func = reinterpret_cast<device_nvram_func>(m_config.get_legacy_config_fct(DEVINFO_FCT_NVRAM));
device_nvram_func nvram_func = reinterpret_cast<device_nvram_func>(get_legacy_fct(DEVINFO_FCT_NVRAM));
(*nvram_func)(this, &file, TRUE);
}

View File

@ -182,74 +182,57 @@ enum
//**************************************************************************
// macro for declaring the configuration and device classes of a legacy device
#define _DECLARE_LEGACY_DEVICE(name, basename, configclass, deviceclass, baseconfigclass, basedeviceclass) \
#define _DECLARE_LEGACY_DEVICE(name, basename, deviceclass, basedeviceclass) \
\
DEVICE_GET_INFO( basename ); \
\
class configclass; \
\
class deviceclass : public basedeviceclass \
{ \
friend class configclass; \
deviceclass(running_machine &_machine, const configclass &config); \
}; \
\
class configclass : public baseconfigclass \
{ \
configclass(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock); \
\
public: \
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); \
virtual device_t *alloc_device(running_machine &machine) const; \
deviceclass(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock); \
}; \
\
extern const device_type name
// macro for defining the implementation needed for configuration and device classes
#define _DEFINE_LEGACY_DEVICE(name, basename, configclass, deviceclass, baseconfigclass, basedeviceclass) \
#define _DEFINE_LEGACY_DEVICE(name, basename, deviceclass, basedeviceclass) \
\
deviceclass::deviceclass(running_machine &_machine, const configclass &config) \
: basedeviceclass(_machine, config) \
deviceclass::deviceclass(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock) \
: basedeviceclass(mconfig, type, tag, owner, clock, DEVICE_GET_INFO_NAME(basename)) \
{ \
} \
\
configclass::configclass(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock) \
: baseconfigclass(mconfig, type, tag, owner, clock, DEVICE_GET_INFO_NAME(basename)) \
{ \
} \
\
device_config *configclass::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) \
{ \
return global_alloc(configclass(mconfig, static_alloc_device_config, tag, owner, clock)); \
} \
\
device_t *configclass::alloc_device(running_machine &machine) const \
{ \
return pool_alloc(machine_get_pool(machine), deviceclass(machine, *this)); \
} \
const device_type name = configclass::static_alloc_device_config
const device_type name = &legacy_device_creator<deviceclass>
// this template function creates a stub which constructs a device
template<class T>
device_t *legacy_device_creator(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
{
return global_alloc(T(mconfig, &legacy_device_creator<T>, tag, owner, clock));
}
// reduced macros that are easier to use, and map to the above two macros
#define DECLARE_LEGACY_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device_config, basename##_device, legacy_device_config_base, legacy_device_base)
#define DECLARE_LEGACY_SOUND_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device_config, basename##_device, legacy_sound_device_config_base, legacy_sound_device_base)
#define DECLARE_LEGACY_MEMORY_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device_config, basename##_device, legacy_memory_device_config_base, legacy_memory_device_base)
#define DECLARE_LEGACY_NVRAM_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device_config, basename##_device, legacy_nvram_device_config_base, legacy_nvram_device_base)
#define DECLARE_LEGACY_IMAGE_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device_config, basename##_device, legacy_image_device_config_base, legacy_image_device_base)
#define DECLARE_LEGACY_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device, legacy_device_base)
#define DECLARE_LEGACY_SOUND_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device, legacy_sound_device_base)
#define DECLARE_LEGACY_MEMORY_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device, legacy_memory_device_base)
#define DECLARE_LEGACY_NVRAM_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device, legacy_nvram_device_base)
#define DECLARE_LEGACY_IMAGE_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device, legacy_image_device_base)
#define DEFINE_LEGACY_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device_config, basename##_device, legacy_device_config_base, legacy_device_base)
#define DEFINE_LEGACY_SOUND_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device_config, basename##_device, legacy_sound_device_config_base, legacy_sound_device_base)
#define DEFINE_LEGACY_MEMORY_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device_config, basename##_device, legacy_memory_device_config_base, legacy_memory_device_base)
#define DEFINE_LEGACY_NVRAM_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device_config, basename##_device, legacy_nvram_device_config_base, legacy_nvram_device_base)
#define DEFINE_LEGACY_IMAGE_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device_config, basename##_device, legacy_image_device_config_base, legacy_image_device_base)
#define DEFINE_LEGACY_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device, legacy_device_base)
#define DEFINE_LEGACY_SOUND_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device, legacy_sound_device_base)
#define DEFINE_LEGACY_MEMORY_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device, legacy_memory_device_base)
#define DEFINE_LEGACY_NVRAM_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device, legacy_nvram_device_base)
#define DEFINE_LEGACY_IMAGE_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device, legacy_image_device_base)
// macros to wrap legacy device functions
#define DEVICE_GET_INFO_NAME(name) device_get_config_##name
#define DEVICE_GET_INFO(name) void DEVICE_GET_INFO_NAME(name)(const device_config *device, UINT32 state, deviceinfo *info)
#define DEVICE_GET_INFO(name) void DEVICE_GET_INFO_NAME(name)(const device_t *device, UINT32 state, deviceinfo *info)
#define DEVICE_GET_INFO_CALL(name) DEVICE_GET_INFO_NAME(name)(device, state, info)
#define DEVICE_VALIDITY_CHECK_NAME(name) device_validity_check_##name
#define DEVICE_VALIDITY_CHECK(name) int DEVICE_VALIDITY_CHECK_NAME(name)(const game_driver *driver, const device_config *device, emu_options &options)
#define DEVICE_VALIDITY_CHECK(name) int DEVICE_VALIDITY_CHECK_NAME(name)(const game_driver *driver, const device_t *device, emu_options &options)
#define DEVICE_VALIDITY_CHECK_CALL(name) DEVICE_VALIDITY_CHECK_NAME(name)(driver, device)
#define DEVICE_START_NAME(name) device_start_##name
@ -282,7 +265,7 @@ const device_type name = configclass::static_alloc_device_config
// inline device configurations that require 32 bits of storage in the token
#define MCFG_DEVICE_CONFIG_DATA32_EXPLICIT(_size, _offset, _val) \
legacy_device_config_base::static_set_inline32(device, _offset, _size, (UINT32)(_val));
legacy_device_base::static_set_inline32(*device, _offset, _size, (UINT32)(_val));
#define MCFG_DEVICE_CONFIG_DATA32(_struct, _field, _val) \
MCFG_DEVICE_CONFIG_DATA32_EXPLICIT(structsizeof(_struct, _field), offsetof(_struct, _field), _val)
@ -305,7 +288,7 @@ const device_type name = configclass::static_alloc_device_config
// inline device configurations that require 32 bits of fixed-point storage in the token
#define MCFG_DEVICE_CONFIG_DATAFP32_EXPLICIT(_size, _offset, _val, _fixbits) \
legacy_device_config_base::static_set_inline_float(device, _offset, _size, (float)(_val));
legacy_device_base::static_set_inline_float(*device, _offset, _size, (float)(_val));
#define MCFG_DEVICE_CONFIG_DATAFP32(_struct, _field, _val, _fixbits) \
MCFG_DEVICE_CONFIG_DATAFP32_EXPLICIT(structsizeof(_struct, _field), offsetof(_struct, _field), _val, _fixbits)
@ -328,7 +311,7 @@ const device_type name = configclass::static_alloc_device_config
// inline device configurations that require 64 bits of storage in the token
#define MCFG_DEVICE_CONFIG_DATA64_EXPLICIT(_size, _offset, _val) \
legacy_device_config_base::static_set_inline64(device, _offset, _size, (UINT64)(_val));
legacy_device_base::static_set_inline64(*device, _offset, _size, (UINT64)(_val));
#define MCFG_DEVICE_CONFIG_DATA64(_struct, _field, _val) \
MCFG_DEVICE_CONFIG_DATA64_EXPLICIT(structsizeof(_struct, _field), offsetof(_struct, _field), _val)
@ -376,15 +359,15 @@ const device_type name = configclass::static_alloc_device_config
union deviceinfo;
class machine_config;
class device_config;
class device_t;
char *get_temp_string_buffer(void);
resource_pool &machine_get_pool(running_machine &machine);
// device interface function types
typedef void (*device_get_config_func)(const device_config *device, UINT32 state, deviceinfo *info);
typedef int (*device_validity_check_func)(const game_driver *driver, const device_config *device, emu_options &options);
typedef void (*device_get_config_func)(const device_t *device, UINT32 state, deviceinfo *info);
typedef int (*device_validity_check_func)(const game_driver *driver, const device_t *device, emu_options &options);
typedef void (*device_start_func)(device_t *device);
typedef void (*device_stop_func)(device_t *device);
@ -419,52 +402,6 @@ union deviceinfo
};
// ======================> legacy_device_config_base
// legacy_device_config_base describes a base configuration class for legacy devices
class legacy_device_config_base : public device_config
{
friend class legacy_device_base;
friend class legacy_nvram_device_base;
friend class legacy_image_device_base;
protected:
// construction/destruction
legacy_device_config_base(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock, device_get_config_func get_config);
virtual ~legacy_device_config_base();
// allocators - defined in derived classes
// basic information getters
public:
// access to legacy inline configuartion
void *inline_config() const { return m_inline_config; }
// inline configuration helpers
static void static_set_inline32(device_config *device, UINT32 offset, UINT32 size, UINT32 value);
static void static_set_inline64(device_config *device, UINT32 offset, UINT32 size, UINT64 value);
static void static_set_inline_float(device_config *device, UINT32 offset, UINT32 size, float value);
protected:
// overrides
virtual bool device_validity_check(emu_options &options, const game_driver &driver) const;
virtual const rom_entry *device_rom_region() const { return reinterpret_cast<const rom_entry *>(get_legacy_config_ptr(DEVINFO_PTR_ROM_REGION)); }
virtual machine_config_constructor device_mconfig_additions() const { return reinterpret_cast<machine_config_constructor>(get_legacy_config_ptr(DEVINFO_PTR_MACHINE_CONFIG)); }
virtual const input_port_token *device_input_ports() const { return reinterpret_cast<const input_port_token *>(get_legacy_config_ptr(DEVINFO_PTR_INPUT_PORTS)); }
// access to legacy configuration info
INT64 get_legacy_config_int(UINT32 state) const;
void *get_legacy_config_ptr(UINT32 state) const;
genf *get_legacy_config_fct(UINT32 state) const;
const char *get_legacy_config_string(UINT32 state) const;
// internal state
device_get_config_func m_get_config_func;
void * m_inline_config;
};
// ======================> legacy_device_base
// legacy_device_base serves as a common base class for legacy devices
@ -472,34 +409,42 @@ class legacy_device_base : public device_t
{
protected:
// construction/destruction
legacy_device_base(running_machine &_machine, const device_config &config);
legacy_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, device_get_config_func get_config);
virtual ~legacy_device_base();
public:
// access to legacy inline configuartion
void *inline_config() const { return m_inline_config; }
// inline configuration helpers
static void static_set_inline32(device_t &device, UINT32 offset, UINT32 size, UINT32 value);
static void static_set_inline64(device_t &device, UINT32 offset, UINT32 size, UINT64 value);
static void static_set_inline_float(device_t &device, UINT32 offset, UINT32 size, float value);
// access to legacy token
void *token() const { return m_token; }
void *token() const { assert(m_token != NULL); return m_token; }
protected:
// device-level overrides
virtual const rom_entry *device_rom_region() const { return reinterpret_cast<const rom_entry *>(get_legacy_ptr(DEVINFO_PTR_ROM_REGION)); }
virtual machine_config_constructor device_mconfig_additions() const { return reinterpret_cast<machine_config_constructor>(get_legacy_ptr(DEVINFO_PTR_MACHINE_CONFIG)); }
virtual const input_port_token *device_input_ports() const { return reinterpret_cast<const input_port_token *>(get_legacy_ptr(DEVINFO_PTR_INPUT_PORTS)); }
virtual bool device_validity_check(emu_options &options, const game_driver &driver) const;
virtual void device_start();
virtual void device_reset();
// access to legacy configuration info
INT64 get_legacy_int(UINT32 state) const;
void *get_legacy_ptr(UINT32 state) const;
genf *get_legacy_fct(UINT32 state) const;
const char *get_legacy_string(UINT32 state) const;
// configuration state
device_get_config_func m_get_config_func;
void * m_inline_config;
// internal state
const legacy_device_config_base & m_config;
void * m_token;
};
// ======================> legacy_sound_device_config_base
// legacy_sound_device_config is a device_config with a sound interface
class legacy_sound_device_config_base : public legacy_device_config_base,
public device_config_sound_interface
{
protected:
// construction/destruction
legacy_sound_device_config_base(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock, device_get_config_func get_config);
void * m_token;
};
@ -512,7 +457,7 @@ class legacy_sound_device_base : public legacy_device_base,
{
protected:
// construction/destruction
legacy_sound_device_base(running_machine &machine, const device_config &config);
legacy_sound_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, device_get_config_func get_config);
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
@ -520,28 +465,6 @@ protected:
// ======================> legacy_memory_device_config_base
// legacy_memory_device_config is a device_config with a memory interface
class legacy_memory_device_config_base : public legacy_device_config_base,
public device_config_memory_interface
{
protected:
// construction/destruction
legacy_memory_device_config_base(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock, device_get_config_func get_config);
// device_config overrides
virtual void device_config_complete();
// device_config_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == 0) ? &m_space_config : NULL; }
// internal state
address_space_config m_space_config;
};
// ======================> legacy_memory_device_base
// legacy_memory_device is a legacy_device_base with a memory interface
@ -550,20 +473,16 @@ class legacy_memory_device_base : public legacy_device_base,
{
protected:
// construction/destruction
legacy_memory_device_base(running_machine &machine, const device_config &config);
};
legacy_memory_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, device_get_config_func get_config);
// device overrides
virtual void device_config_complete();
// device_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == 0) ? &m_space_config : NULL; }
// ======================> legacy_nvram_device_config
// legacy_nvram_device_config is a device_config with a nvram interface
class legacy_nvram_device_config_base : public legacy_device_config_base,
public device_config_nvram_interface
{
protected:
// construction/destruction
legacy_nvram_device_config_base(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock, device_get_config_func get_config);
// internal state
address_space_config m_space_config;
};
@ -576,7 +495,7 @@ class legacy_nvram_device_base : public legacy_device_base,
{
protected:
// construction/destruction
legacy_nvram_device_base(running_machine &machine, const device_config &config);
legacy_nvram_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, device_get_config_func get_config);
// device_nvram_interface overrides
virtual void nvram_default();
@ -584,16 +503,18 @@ protected:
virtual void nvram_write(emu_file &file);
};
// ======================> legacy_image_device_config
// legacy_image_device_config is a device_config with a image interface
class legacy_image_device_config_base : public legacy_device_config_base,
public device_config_image_interface
// ======================> legacy_image_device
// legacy_image_device is a legacy_device_base with a image interface
class legacy_image_device_base : public legacy_device_base,
public device_image_interface
{
public:
virtual iodevice_t image_type() const { return m_type; }
virtual const char *image_type_name() const { return device_typename(m_type); }
virtual iodevice_t image_type_direct() const { return static_cast<iodevice_t>(get_legacy_config_int(DEVINFO_INT_IMAGE_TYPE)); }
virtual iodevice_t image_type_direct() const { return static_cast<iodevice_t>(get_legacy_int(DEVINFO_INT_IMAGE_TYPE)); }
virtual bool is_readable() const { return m_readable; }
virtual bool is_writeable() const { return m_writeable; }
virtual bool is_creatable() const { return m_creatable; }
@ -608,12 +529,24 @@ public:
virtual const option_guide *create_option_guide() const { return m_create_option_guide; }
virtual image_device_format *formatlist() const { return m_formatlist; }
virtual device_image_partialhash_func get_partial_hash() const;
protected:
// construction/destruction
legacy_image_device_config_base(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock, device_get_config_func get_config);
virtual ~legacy_image_device_config_base();
// device_config overrides
virtual bool load(const char *path);
virtual bool finish_load();
virtual void unload();
virtual bool create(const char *path, const image_device_format *create_format, option_resolution *create_args);
virtual bool load_software(char *swlist, char *swname, rom_entry *entry);
virtual int call_load();
virtual bool call_softlist_load(char *swlist, char *swname, rom_entry *start_entry);
virtual int call_create(int format_type, option_resolution *format_options);
virtual void call_unload();
virtual void call_display();
virtual void call_display_info();
virtual device_image_partialhash_func get_partial_hash();
virtual void call_get_devices();
virtual void *get_device_specific_call();
protected:
// device overrides
virtual void device_config_complete();
iodevice_t m_type;
@ -631,34 +564,10 @@ protected:
/* creation info */
const option_guide *m_create_option_guide;
image_device_format *m_formatlist;
};
// ======================> legacy_image_device
// legacy_image_device is a legacy_device_base with a image interface
class legacy_image_device_base : public legacy_device_base,
public device_image_interface
{
public:
virtual bool load(const char *path);
virtual bool finish_load();
virtual void unload();
virtual bool create(const char *path, const image_device_format *create_format, option_resolution *create_args);
virtual bool load_software(char *swlist, char *swname, rom_entry *entry);
virtual int call_load();
virtual bool call_softlist_load(char *swlist, char *swname, rom_entry *start_entry);
virtual int call_create(int format_type, option_resolution *format_options);
virtual void call_unload();
virtual void call_display();
virtual void call_display_info();
virtual device_image_partialhash_func get_partial_hash();
virtual void call_get_devices();
virtual void *get_device_specific_call();
protected:
// construction/destruction
legacy_image_device_base(running_machine &machine, const device_config &config);
legacy_image_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, device_get_config_func get_config);
~legacy_image_device_base();
// device_image_interface overrides
bool load_internal(const char *path, bool is_create, int create_format, option_resolution *create_args);
void determine_open_plan(int is_create, UINT32 *open_plan);
@ -670,6 +579,4 @@ protected:
};
#endif /* __DEVLEGCY_H__ */

View File

@ -40,30 +40,6 @@
#include "emu.h"
//**************************************************************************
// DEVICE CONFIG DISASM INTERFACE
//**************************************************************************
//-------------------------------------------------
// device_config_disasm_interface - constructor
//-------------------------------------------------
device_config_disasm_interface::device_config_disasm_interface(const machine_config &mconfig, device_config &devconfig)
: device_config_interface(mconfig, devconfig)
{
}
//-------------------------------------------------
// ~device_config_disasm_interface - destructor
//-------------------------------------------------
device_config_disasm_interface::~device_config_disasm_interface()
{
}
//**************************************************************************
// DEVICE DISASM INTERFACE
//**************************************************************************
@ -72,9 +48,8 @@ device_config_disasm_interface::~device_config_disasm_interface()
// device_disasm_interface - constructor
//-------------------------------------------------
device_disasm_interface::device_disasm_interface(running_machine &machine, const device_config &config, device_t &device)
: device_interface(machine, config, device),
m_disasm_config(dynamic_cast<const device_config_disasm_interface &>(config))
device_disasm_interface::device_disasm_interface(const machine_config &mconfig, device_t &device)
: device_interface(device)
{
}

View File

@ -74,28 +74,6 @@ const UINT32 DASMFLAG_LENGTHMASK = 0x0000ffff; // the low 16-bits contain the ac
//**************************************************************************
// ======================> device_config_disasm_interface
// class representing interface-specific configuration disasm
class device_config_disasm_interface : public device_config_interface
{
public:
// construction/destruction
device_config_disasm_interface(const machine_config &mconfig, device_config &device);
virtual ~device_config_disasm_interface();
// required configuration overrides
UINT32 min_opcode_bytes() const { return disasm_min_opcode_bytes(); }
UINT32 max_opcode_bytes() const { return disasm_max_opcode_bytes(); }
protected:
// required configuration overrides
virtual UINT32 disasm_min_opcode_bytes() const = 0;
virtual UINT32 disasm_max_opcode_bytes() const = 0;
};
// ======================> device_disasm_interface
// class representing interface-specific live disasm
@ -103,22 +81,21 @@ class device_disasm_interface : public device_interface
{
public:
// construction/destruction
device_disasm_interface(running_machine &machine, const device_config &config, device_t &device);
device_disasm_interface(const machine_config &mconfig, device_t &device);
virtual ~device_disasm_interface();
// configuration access
const device_config_disasm_interface &disasm_config() const { return m_disasm_config; }
UINT32 min_opcode_bytes() const { return m_disasm_config.min_opcode_bytes(); }
UINT32 max_opcode_bytes() const { return m_disasm_config.max_opcode_bytes(); }
UINT32 min_opcode_bytes() const { return disasm_min_opcode_bytes(); }
UINT32 max_opcode_bytes() const { return disasm_max_opcode_bytes(); }
// interface for disassembly
offs_t disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options = 0) { return disasm_disassemble(buffer, pc, oprom, opram, options); }
protected:
// required operation overrides
virtual UINT32 disasm_min_opcode_bytes() const = 0;
virtual UINT32 disasm_max_opcode_bytes() const = 0;
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) = 0;
const device_config_disasm_interface & m_disasm_config; // reference to configuration data
};

View File

@ -68,211 +68,17 @@ const int TRIGGER_SUSPENDTIME = -4000;
//**************************************************************************
//-------------------------------------------------
// device_config_execute_interface - constructor
// device_execute_interface - constructor
//-------------------------------------------------
device_config_execute_interface::device_config_execute_interface(const machine_config &mconfig, device_config &devconfig)
: device_config_interface(mconfig, devconfig),
device_execute_interface::device_execute_interface(const machine_config &mconfig, device_t &device)
: device_interface(device),
m_disabled(false),
m_vblank_interrupt(NULL),
m_vblank_interrupts_per_frame(0),
m_vblank_interrupt_screen(NULL),
m_timed_interrupt(NULL),
m_timed_interrupt_period(attotime::zero)
{
}
//-------------------------------------------------
// device_config_execute_interface - destructor
//-------------------------------------------------
device_config_execute_interface::~device_config_execute_interface()
{
}
//-------------------------------------------------
// static_set_disable - configuration helper to
// set the disabled state of a device
//-------------------------------------------------
void device_config_execute_interface::static_set_disable(device_config *device)
{
device_config_execute_interface *exec = dynamic_cast<device_config_execute_interface *>(device);
if (exec == NULL)
throw emu_fatalerror("MCFG_DEVICE_DISABLE called on device '%s' with no execute interface", device->tag());
exec->m_disabled = true;
}
//-------------------------------------------------
// static_set_vblank_int - configuration helper
// to set up VBLANK interrupts on the device
//-------------------------------------------------
void device_config_execute_interface::static_set_vblank_int(device_config *device, device_interrupt_func function, const char *tag, int rate)
{
device_config_execute_interface *exec = dynamic_cast<device_config_execute_interface *>(device);
if (exec == NULL)
throw emu_fatalerror("MCFG_DEVICE_VBLANK_INT called on device '%s' with no execute interface", device->tag());
exec->m_vblank_interrupt = function;
exec->m_vblank_interrupts_per_frame = rate;
exec->m_vblank_interrupt_screen = tag;
}
//-------------------------------------------------
// static_set_periodic_int - configuration helper
// to set up periodic interrupts on the device
//-------------------------------------------------
void device_config_execute_interface::static_set_periodic_int(device_config *device, device_interrupt_func function, attotime rate)
{
device_config_execute_interface *exec = dynamic_cast<device_config_execute_interface *>(device);
if (exec == NULL)
throw emu_fatalerror("MCFG_DEVICE_PERIODIC_INT called on device '%s' with no execute interface", device->tag());
exec->m_timed_interrupt = function;
exec->m_timed_interrupt_period = rate;
}
//-------------------------------------------------
// execute_clocks_to_cycles - convert the number
// of clocks to cycles, rounding down if necessary
//-------------------------------------------------
UINT64 device_config_execute_interface::execute_clocks_to_cycles(UINT64 clocks) const
{
return clocks;
}
//-------------------------------------------------
// execute_cycles_to_clocks - convert the number
// of cycles to clocks, rounding down if necessary
//-------------------------------------------------
UINT64 device_config_execute_interface::execute_cycles_to_clocks(UINT64 cycles) const
{
return cycles;
}
//-------------------------------------------------
// execute_min_cycles - return the smallest number
// of cycles that a single instruction or
// operation can take
//-------------------------------------------------
UINT32 device_config_execute_interface::execute_min_cycles() const
{
return 1;
}
//-------------------------------------------------
// execute_max_cycles - return the maximum number
// of cycles that a single instruction or
// operation can take
//-------------------------------------------------
UINT32 device_config_execute_interface::execute_max_cycles() const
{
return 1;
}
//-------------------------------------------------
// execute_input_lines - return the total number
// of input lines for the device
//-------------------------------------------------
UINT32 device_config_execute_interface::execute_input_lines() const
{
return 0;
}
//-------------------------------------------------
// execute_default_irq_vector - return the default
// IRQ vector when an acknowledge is processed
//-------------------------------------------------
UINT32 device_config_execute_interface::execute_default_irq_vector() const
{
return 0;
}
//-------------------------------------------------
// interface_validity_check - validation for a
// device after the configuration has been
// constructed
//-------------------------------------------------
bool device_config_execute_interface::interface_validity_check(emu_options &options, const game_driver &driver) const
{
const device_config *devconfig = crosscast<const device_config *>(this);
bool error = false;
/* validate the interrupts */
if (m_vblank_interrupt != NULL)
{
if (m_machine_config.m_devicelist.count(SCREEN) == 0)
{
mame_printf_error("%s: %s device '%s' has a VBLANK interrupt, but the driver is screenless!\n", driver.source_file, driver.name, devconfig->tag());
error = true;
}
else if (m_vblank_interrupt_screen != NULL && m_vblank_interrupts_per_frame != 0)
{
mame_printf_error("%s: %s device '%s' has a new VBLANK interrupt handler with >1 interrupts!\n", driver.source_file, driver.name, devconfig->tag());
error = true;
}
else if (m_vblank_interrupt_screen != NULL && m_machine_config.m_devicelist.find(m_vblank_interrupt_screen) == NULL)
{
mame_printf_error("%s: %s device '%s' VBLANK interrupt with a non-existant screen tag (%s)!\n", driver.source_file, driver.name, devconfig->tag(), m_vblank_interrupt_screen);
error = true;
}
else if (m_vblank_interrupt_screen == NULL && m_vblank_interrupts_per_frame == 0)
{
mame_printf_error("%s: %s device '%s' has a VBLANK interrupt handler with 0 interrupts!\n", driver.source_file, driver.name, devconfig->tag());
error = true;
}
}
else if (m_vblank_interrupts_per_frame != 0)
{
mame_printf_error("%s: %s device '%s' has no VBLANK interrupt handler but a non-0 interrupt count is given!\n", driver.source_file, driver.name, devconfig->tag());
error = true;
}
if (m_timed_interrupt != NULL && m_timed_interrupt_period == attotime::zero)
{
mame_printf_error("%s: %s device '%s' has a timer interrupt handler with 0 period!\n", driver.source_file, driver.name, devconfig->tag());
error = true;
}
else if (m_timed_interrupt == NULL && m_timed_interrupt_period != attotime::zero)
{
mame_printf_error("%s: %s device '%s' has a no timer interrupt handler but has a non-0 period given!\n", driver.source_file, driver.name, devconfig->tag());
error = true;
}
return error;
}
//**************************************************************************
// EXECUTING DEVICE MANAGEMENT
//**************************************************************************
//-------------------------------------------------
// device_execute_interface - constructor
//-------------------------------------------------
device_execute_interface::device_execute_interface(running_machine &machine, const device_config &config, device_t &device)
: device_interface(machine, config, device),
m_execute_config(dynamic_cast<const device_config_execute_interface &>(config)),
m_timed_interrupt_period(attotime::zero),
m_nextexec(NULL),
m_driver_irq(0),
m_timedint_timer(NULL),
@ -295,11 +101,14 @@ device_execute_interface::device_execute_interface(running_machine &machine, con
m_attoseconds_per_cycle(0)
{
memset(&m_localtime, 0, sizeof(m_localtime));
// configure the fast accessor
device.m_execute = this;
}
//-------------------------------------------------
// ~device_execute_interface - destructor
// device_execute_interface - destructor
//-------------------------------------------------
device_execute_interface::~device_execute_interface()
@ -307,6 +116,51 @@ device_execute_interface::~device_execute_interface()
}
//-------------------------------------------------
// static_set_disable - configuration helper to
// set the disabled state of a device
//-------------------------------------------------
void device_execute_interface::static_set_disable(device_t &device)
{
device_execute_interface *exec;
if (!device.interface(exec))
throw emu_fatalerror("MCFG_DEVICE_DISABLE called on device '%s' with no execute interface", device.tag());
exec->m_disabled = true;
}
//-------------------------------------------------
// static_set_vblank_int - configuration helper
// to set up VBLANK interrupts on the device
//-------------------------------------------------
void device_execute_interface::static_set_vblank_int(device_t &device, device_interrupt_func function, const char *tag, int rate)
{
device_execute_interface *exec;
if (!device.interface(exec))
throw emu_fatalerror("MCFG_DEVICE_VBLANK_INT called on device '%s' with no execute interface", device.tag());
exec->m_vblank_interrupt = function;
exec->m_vblank_interrupts_per_frame = rate;
exec->m_vblank_interrupt_screen = tag;
}
//-------------------------------------------------
// static_set_periodic_int - configuration helper
// to set up periodic interrupts on the device
//-------------------------------------------------
void device_execute_interface::static_set_periodic_int(device_t &device, device_interrupt_func function, attotime rate)
{
device_execute_interface *exec;
if (!device.interface(exec))
throw emu_fatalerror("MCFG_DEVICE_PERIODIC_INT called on device '%s' with no execute interface", device.tag());
exec->m_timed_interrupt = function;
exec->m_timed_interrupt_period = rate;
}
//-------------------------------------------------
// executing - return true if this device is
// within its execute function
@ -430,7 +284,7 @@ if (TEMPLOG) printf("resume %s (%X)\n", device().tag(), reason);
//-------------------------------------------------
// spinuntil_time - burn cycles for a specific
// spin_until_time - burn cycles for a specific
// period of time
//-------------------------------------------------
@ -516,6 +370,74 @@ UINT64 device_execute_interface::total_cycles() const
}
//-------------------------------------------------
// execute_clocks_to_cycles - convert the number
// of clocks to cycles, rounding down if necessary
//-------------------------------------------------
UINT64 device_execute_interface::execute_clocks_to_cycles(UINT64 clocks) const
{
return clocks;
}
//-------------------------------------------------
// execute_cycles_to_clocks - convert the number
// of cycles to clocks, rounding down if necessary
//-------------------------------------------------
UINT64 device_execute_interface::execute_cycles_to_clocks(UINT64 cycles) const
{
return cycles;
}
//-------------------------------------------------
// execute_min_cycles - return the smallest number
// of cycles that a single instruction or
// operation can take
//-------------------------------------------------
UINT32 device_execute_interface::execute_min_cycles() const
{
return 1;
}
//-------------------------------------------------
// execute_max_cycles - return the maximum number
// of cycles that a single instruction or
// operation can take
//-------------------------------------------------
UINT32 device_execute_interface::execute_max_cycles() const
{
return 1;
}
//-------------------------------------------------
// execute_input_lines - return the total number
// of input lines for the device
//-------------------------------------------------
UINT32 device_execute_interface::execute_input_lines() const
{
return 0;
}
//-------------------------------------------------
// execute_default_irq_vector - return the default
// IRQ vector when an acknowledge is processed
//-------------------------------------------------
UINT32 device_execute_interface::execute_default_irq_vector() const
{
return 0;
}
//-------------------------------------------------
// execute_burn - called after we consume a bunch
// of cycles for artifical reasons (such as
@ -539,6 +461,61 @@ void device_execute_interface::execute_set_input(int linenum, int state)
}
//-------------------------------------------------
// interface_validity_check - validation for a
// device after the configuration has been
// constructed
//-------------------------------------------------
bool device_execute_interface::interface_validity_check(emu_options &options, const game_driver &driver) const
{
bool error = false;
/* validate the interrupts */
if (m_vblank_interrupt != NULL)
{
if (device().mconfig().devicelist().count(SCREEN) == 0)
{
mame_printf_error("%s: %s device '%s' has a VBLANK interrupt, but the driver is screenless!\n", driver.source_file, driver.name, device().tag());
error = true;
}
else if (m_vblank_interrupt_screen != NULL && m_vblank_interrupts_per_frame != 0)
{
mame_printf_error("%s: %s device '%s' has a new VBLANK interrupt handler with >1 interrupts!\n", driver.source_file, driver.name, device().tag());
error = true;
}
else if (m_vblank_interrupt_screen != NULL && device().mconfig().devicelist().find(m_vblank_interrupt_screen) == NULL)
{
mame_printf_error("%s: %s device '%s' VBLANK interrupt with a non-existant screen tag (%s)!\n", driver.source_file, driver.name, device().tag(), m_vblank_interrupt_screen);
error = true;
}
else if (m_vblank_interrupt_screen == NULL && m_vblank_interrupts_per_frame == 0)
{
mame_printf_error("%s: %s device '%s' has a VBLANK interrupt handler with 0 interrupts!\n", driver.source_file, driver.name, device().tag());
error = true;
}
}
else if (m_vblank_interrupts_per_frame != 0)
{
mame_printf_error("%s: %s device '%s' has no VBLANK interrupt handler but a non-0 interrupt count is given!\n", driver.source_file, driver.name, device().tag());
error = true;
}
if (m_timed_interrupt != NULL && m_timed_interrupt_period == attotime::zero)
{
mame_printf_error("%s: %s device '%s' has a timer interrupt handler with 0 period!\n", driver.source_file, driver.name, device().tag());
error = true;
}
else if (m_timed_interrupt == NULL && m_timed_interrupt_period != attotime::zero)
{
mame_printf_error("%s: %s device '%s' has a no timer interrupt handler but has a non-0 period given!\n", driver.source_file, driver.name, device().tag());
error = true;
}
return error;
}
//-------------------------------------------------
// interface_pre_start - work to be done prior to
// actually starting a device
@ -547,7 +524,7 @@ void device_execute_interface::execute_set_input(int linenum, int state)
void device_execute_interface::interface_pre_start()
{
// fill in the initial states
int index = device().machine().m_devicelist.indexof(m_device);
int index = device().machine().devicelist().indexof(m_device);
m_suspend = SUSPEND_REASON_RESET;
m_profiler = profile_type(index + PROFILER_DEVICE_FIRST);
m_inttrigger = index + TRIGGER_INT;
@ -557,9 +534,9 @@ void device_execute_interface::interface_pre_start()
m_input[line].start(this, line);
// allocate timers if we need them
if (m_execute_config.m_vblank_interrupts_per_frame > 1)
if (m_vblank_interrupts_per_frame > 1)
m_partial_frame_timer = device().machine().scheduler().timer_alloc(FUNC(static_trigger_partial_frame_interrupt), (void *)this);
if (m_execute_config.m_timed_interrupt_period != attotime::zero)
if (m_timed_interrupt_period != attotime::zero)
m_timedint_timer = device().machine().scheduler().timer_alloc(FUNC(static_trigger_periodic_interrupt), (void *)this);
// register for save states
@ -597,7 +574,7 @@ void device_execute_interface::interface_pre_reset()
m_totalcycles = 0;
// enable all devices (except for disabled devices)
if (!m_execute_config.disabled())
if (!disabled())
resume(SUSPEND_ANY_REASON);
else
suspend(SUSPEND_REASON_DISABLE, true);
@ -616,14 +593,14 @@ void device_execute_interface::interface_post_reset()
m_input[line].reset();
// reconfingure VBLANK interrupts
if (m_execute_config.m_vblank_interrupts_per_frame > 0 || m_execute_config.m_vblank_interrupt_screen != NULL)
if (m_vblank_interrupts_per_frame > 0 || m_vblank_interrupt_screen != NULL)
{
// get the screen that will trigger the VBLANK
// new style - use screen tag directly
screen_device *screen;
if (m_execute_config.m_vblank_interrupt_screen != NULL)
screen = downcast<screen_device *>(device().machine().device(m_execute_config.m_vblank_interrupt_screen));
if (m_vblank_interrupt_screen != NULL)
screen = downcast<screen_device *>(device().machine().device(m_vblank_interrupt_screen));
// old style 'hack' setup - use screen #0
else
@ -634,9 +611,9 @@ void device_execute_interface::interface_post_reset()
}
// reconfigure periodic interrupts
if (m_execute_config.m_timed_interrupt_period != attotime::zero)
if (m_timed_interrupt_period != attotime::zero)
{
attotime timedint_period = m_execute_config.m_timed_interrupt_period;
attotime timedint_period = m_timed_interrupt_period;
assert(m_timedint_timer != NULL);
m_timedint_timer->adjust(timedint_period, 0, timedint_period);
}
@ -670,8 +647,35 @@ void device_execute_interface::interface_clock_changed()
//-------------------------------------------------
// get_minimum_quantum - return the minimum
// quantum required for this device
// static_standard_irq_callback - IRQ acknowledge
// callback; handles HOLD_LINE case and signals
// to the debugger
//-------------------------------------------------
IRQ_CALLBACK( device_execute_interface::static_standard_irq_callback )
{
return device_execute(device)->standard_irq_callback(irqline);
}
int device_execute_interface::standard_irq_callback(int irqline)
{
// get the default vector and acknowledge the interrupt if needed
int vector = m_input[irqline].default_irq_callback();
LOG(("static_standard_irq_callback('%s', %d) $%04x\n", m_device.tag(), irqline, vector));
// if there's a driver callback, run it to get the vector
if (m_driver_irq != NULL)
vector = (*m_driver_irq)(&m_device, irqline);
// notify the debugger
debugger_interrupt_hook(&m_device, irqline);
return vector;
}
//-------------------------------------------------
// minimum_quantum - return the minimum quantum
// required for this device
//-------------------------------------------------
attoseconds_t device_execute_interface::minimum_quantum() const
@ -709,7 +713,7 @@ void device_execute_interface::static_on_vblank(screen_device &screen, void *par
if (vblank_state)
{
device_execute_interface *exec = NULL;
for (bool gotone = screen.machine().m_devicelist.first(exec); gotone; gotone = exec->next(exec))
for (bool gotone = screen.machine().devicelist().first(exec); gotone; gotone = exec->next(exec))
exec->on_vblank_start(screen);
}
}
@ -724,23 +728,23 @@ void device_execute_interface::on_vblank_start(screen_device &screen)
// the hack style VBLANK decleration always uses the first screen
bool interested = false;
if (m_execute_config.m_vblank_interrupts_per_frame > 1)
if (m_vblank_interrupts_per_frame > 1)
interested = true;
// for new style declaration, we need to compare the tags
else if (m_execute_config.m_vblank_interrupt_screen != NULL)
interested = (strcmp(screen.tag(), m_execute_config.m_vblank_interrupt_screen) == 0);
else if (m_vblank_interrupt_screen != NULL)
interested = (strcmp(screen.tag(), m_vblank_interrupt_screen) == 0);
// if interested, call the interrupt handler
if (interested)
{
if (!suspended(SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE))
(*m_execute_config.m_vblank_interrupt)(&m_device);
(*m_vblank_interrupt)(&m_device);
// if we have more than one interrupt per frame, start the timer now to trigger the rest of them
if (m_execute_config.m_vblank_interrupts_per_frame > 1 && !suspended(SUSPEND_REASON_DISABLE))
if (m_vblank_interrupts_per_frame > 1 && !suspended(SUSPEND_REASON_DISABLE))
{
m_partial_frame_period = device().machine().primary_screen->frame_period() / m_execute_config.m_vblank_interrupts_per_frame;
m_partial_frame_period = device().machine().primary_screen->frame_period() / m_vblank_interrupts_per_frame;
m_partial_frame_timer->adjust(m_partial_frame_period);
}
}
@ -761,14 +765,14 @@ void device_execute_interface::trigger_partial_frame_interrupt()
{
// when we hit 0, reset to the total count
if (m_iloops == 0)
m_iloops = m_execute_config.m_vblank_interrupts_per_frame;
m_iloops = m_vblank_interrupts_per_frame;
// count one more "iloop"
m_iloops--;
// call the interrupt handler if we're not suspended
if (!suspended(SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE))
(*m_execute_config.m_vblank_interrupt)(&m_device);
(*m_vblank_interrupt)(&m_device);
// set up to retrigger if there's more interrupts to generate
if (m_iloops > 1)
@ -789,35 +793,8 @@ TIMER_CALLBACK( device_execute_interface::static_trigger_periodic_interrupt )
void device_execute_interface::trigger_periodic_interrupt()
{
// bail if there is no routine
if (m_execute_config.m_timed_interrupt != NULL && !suspended(SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE))
(*m_execute_config.m_timed_interrupt)(&m_device);
}
//-------------------------------------------------
// static_standard_irq_callback - IRQ acknowledge
// callback; handles HOLD_LINE case and signals
// to the debugger
//-------------------------------------------------
IRQ_CALLBACK( device_execute_interface::static_standard_irq_callback )
{
return device_execute(device)->standard_irq_callback(irqline);
}
int device_execute_interface::standard_irq_callback(int irqline)
{
// get the default vector and acknowledge the interrupt if needed
int vector = m_input[irqline].default_irq_callback();
LOG(("static_standard_irq_callback('%s', %d) $%04x\n", m_device.tag(), irqline, vector));
// if there's a driver callback, run it to get the vector
if (m_driver_irq != NULL)
vector = (*m_driver_irq)(&m_device, irqline);
// notify the debugger
debugger_interrupt_hook(&m_device, irqline);
return vector;
if (m_timed_interrupt != NULL && !suspended(SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE))
(*m_timed_interrupt)(&m_device);
}

View File

@ -109,13 +109,13 @@ enum
//**************************************************************************
#define MCFG_DEVICE_DISABLE() \
device_config_execute_interface::static_set_disable(device); \
device_execute_interface::static_set_disable(*device); \
#define MCFG_DEVICE_VBLANK_INT(_tag, _func) \
device_config_execute_interface::static_set_vblank_int(device, _func, _tag); \
device_execute_interface::static_set_vblank_int(*device, _func, _tag); \
#define MCFG_DEVICE_PERIODIC_INT(_func, _rate) \
device_config_execute_interface::static_set_periodic_int(device, _func, attotime::from_hz(_rate)); \
device_execute_interface::static_set_periodic_int(*device, _func, attotime::from_hz(_rate)); \
@ -135,60 +135,6 @@ typedef int (*device_irq_callback)(device_t *device, int irqnum);
// ======================> device_config_execute_interface
// class representing interface-specific configuration state
class device_config_execute_interface : public device_config_interface
{
friend class device_execute_interface;
public:
// construction/destruction
device_config_execute_interface(const machine_config &mconfig, device_config &devconfig);
virtual ~device_config_execute_interface();
// basic information getters
bool disabled() const { return m_disabled; }
// clock and cycle information getters
UINT64 clocks_to_cycles(UINT64 clocks) const { return execute_clocks_to_cycles(clocks); }
UINT64 cycles_to_clocks(UINT64 cycles) const { return execute_cycles_to_clocks(cycles); }
UINT32 min_cycles() const { return execute_min_cycles(); }
UINT32 max_cycles() const { return execute_max_cycles(); }
// input line information getters
UINT32 input_lines() const { return execute_input_lines(); }
UINT32 default_irq_vector() const { return execute_default_irq_vector(); }
// static inline helpers
static void static_set_disable(device_config *device);
static void static_set_vblank_int(device_config *device, device_interrupt_func function, const char *tag, int rate = 0);
static void static_set_periodic_int(device_config *device, device_interrupt_func function, attotime rate);
protected:
// clock and cycle information getters
virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const;
virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const;
virtual UINT32 execute_min_cycles() const;
virtual UINT32 execute_max_cycles() const;
// input line information getters
virtual UINT32 execute_input_lines() const;
virtual UINT32 execute_default_irq_vector() const;
// optional operation overrides
virtual bool interface_validity_check(emu_options &options, const game_driver &driver) const;
bool m_disabled;
device_interrupt_func m_vblank_interrupt; // for interrupts tied to VBLANK
int m_vblank_interrupts_per_frame; // usually 1
const char * m_vblank_interrupt_screen; // the screen that causes the VBLANK interrupt
device_interrupt_func m_timed_interrupt; // for interrupts not tied to VBLANK
attotime m_timed_interrupt_period; // period for periodic interrupts
};
// ======================> device_execute_interface
class device_execute_interface : public device_interface
@ -197,14 +143,24 @@ class device_execute_interface : public device_interface
public:
// construction/destruction
device_execute_interface(running_machine &machine, const device_config &config, device_t &device);
device_execute_interface(const machine_config &mconfig, device_t &device);
virtual ~device_execute_interface();
// configuration access
const device_config_execute_interface &execute_config() const { return m_execute_config; }
bool disabled() const { return m_disabled; }
UINT64 clocks_to_cycles(UINT64 clocks) const { return execute_clocks_to_cycles(clocks); }
UINT64 cycles_to_clocks(UINT64 cycles) const { return execute_cycles_to_clocks(cycles); }
UINT32 min_cycles() const { return execute_min_cycles(); }
UINT32 max_cycles() const { return execute_max_cycles(); }
attotime cycles_to_attotime(UINT64 cycles) const { return device().clocks_to_attotime(cycles_to_clocks(cycles)); }
UINT64 attotime_to_cycles(attotime duration) const { return clocks_to_cycles(device().attotime_to_clocks(duration)); }
UINT32 input_lines() const { return execute_input_lines(); }
UINT32 default_irq_vector() const { return execute_default_irq_vector(); }
// basic information getters
bool disabled() const { return m_execute_config.disabled(); }
// static inline configuration helpers
static void static_set_disable(device_t &device);
static void static_set_vblank_int(device_t &device, device_interrupt_func function, const char *tag, int rate = 0);
static void static_set_periodic_int(device_t &device, device_interrupt_func function, attotime rate);
// execution management
bool executing() const;
@ -242,28 +198,27 @@ public:
attotime local_time() const;
UINT64 total_cycles() const;
// clock and cycle information getters ... pass through to underlying config
UINT64 clocks_to_cycles(UINT64 clocks) const { return m_execute_config.clocks_to_cycles(clocks); }
UINT64 cycles_to_clocks(UINT64 cycles) const { return m_execute_config.cycles_to_clocks(cycles); }
UINT32 min_cycles() const { return m_execute_config.min_cycles(); }
UINT32 max_cycles() const { return m_execute_config.max_cycles(); }
attotime cycles_to_attotime(UINT64 cycles) const { return device().clocks_to_attotime(cycles_to_clocks(cycles)); }
UINT64 attotime_to_cycles(attotime duration) const { return clocks_to_cycles(device().attotime_to_clocks(duration)); }
// input line information getters
UINT32 input_lines() const { return m_execute_config.input_lines(); }
UINT32 default_irq_vector() const { return m_execute_config.default_irq_vector(); }
// required operation overrides
void run() { execute_run(); }
protected:
// clock and cycle information getters
virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const;
virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const;
virtual UINT32 execute_min_cycles() const;
virtual UINT32 execute_max_cycles() const;
// input line information getters
virtual UINT32 execute_input_lines() const;
virtual UINT32 execute_default_irq_vector() const;
// optional operation overrides
virtual void execute_run() = 0;
virtual void execute_burn(INT32 cycles);
virtual void execute_set_input(int linenum, int state);
// interface-level overrides
virtual bool interface_validity_check(emu_options &options, const game_driver &driver) const;
virtual void interface_pre_start();
virtual void interface_post_start();
virtual void interface_pre_reset();
@ -305,7 +260,12 @@ protected:
};
// configuration
const device_config_execute_interface &m_execute_config; // reference to our device_config_execute_interface
bool m_disabled; // disabled from executing?
device_interrupt_func m_vblank_interrupt; // for interrupts tied to VBLANK
int m_vblank_interrupts_per_frame; // usually 1
const char * m_vblank_interrupt_screen; // the screen that causes the VBLANK interrupt
device_interrupt_func m_timed_interrupt; // for interrupts not tied to VBLANK
attotime m_timed_interrupt_period; // period for periodic interrupts
// execution lists
device_execute_interface *m_nextexec; // pointer to the next device to execute, in order

View File

@ -46,7 +46,7 @@
//**************************************************************************
// DEVICE CONFIG IMAGE INTERFACE
//**************************************************************************
const image_device_type_info device_config_image_interface::m_device_info_array[] =
const image_device_type_info device_image_interface::m_device_info_array[] =
{
{ IO_CARTSLOT, "cartridge", "cart" }, /* 0 */
{ IO_FLOPPY, "floppydisk", "flop" }, /* 1 */
@ -65,94 +65,6 @@ const image_device_type_info device_config_image_interface::m_device_info_array[
{ IO_MAGTAPE, "magtape", "magt" }, /* 14 */
};
//-------------------------------------------------
// device_config_image_interface - constructor
//-------------------------------------------------
device_config_image_interface::device_config_image_interface(const machine_config &mconfig, device_config &devconfig)
: device_config_interface(mconfig, devconfig)
{
}
//-------------------------------------------------
// ~device_config_image_interface - destructor
//-------------------------------------------------
device_config_image_interface::~device_config_image_interface()
{
}
//-------------------------------------------------
// find_device_type - search trough list of
// device types to extact data
//-------------------------------------------------
const image_device_type_info *device_config_image_interface::find_device_type(iodevice_t type)
{
int i;
for (i = 0; i < ARRAY_LENGTH(device_config_image_interface::m_device_info_array); i++)
{
if (m_device_info_array[i].m_type == type)
return &m_device_info_array[i];
}
return NULL;
}
//-------------------------------------------------
// device_typename - retrieves device type name
//-------------------------------------------------
const char *device_config_image_interface::device_typename(iodevice_t type)
{
const image_device_type_info *info = find_device_type(type);
return (info != NULL) ? info->m_name : NULL;
}
//-------------------------------------------------
// device_brieftypename - retrieves device
// brief type name
//-------------------------------------------------
const char *device_config_image_interface::device_brieftypename(iodevice_t type)
{
const image_device_type_info *info = find_device_type(type);
return (info != NULL) ? info->m_shortname : NULL;
}
//-------------------------------------------------
// device_typeid - retrieves device type id
//-------------------------------------------------
iodevice_t device_config_image_interface::device_typeid(const char *name)
{
int i;
for (i = 0; i < ARRAY_LENGTH(device_config_image_interface::m_device_info_array); i++)
{
if (!mame_stricmp(name, m_device_info_array[i].m_name) || !mame_stricmp(name, m_device_info_array[i].m_shortname))
return m_device_info_array[i].m_type;
}
return (iodevice_t)-1;
}
/*-------------------------------------------------
device_compute_hash - compute a hash,
using this device's partial hash if appropriate
-------------------------------------------------*/
void device_config_image_interface::device_compute_hash(hash_collection &hashes, const void *data, size_t length, const char *types) const
{
/* retrieve the partial hash func */
device_image_partialhash_func partialhash = get_partial_hash();
/* compute the hash */
if (partialhash)
partialhash(hashes, (const unsigned char*)data, length, types);
else
hashes.compute(reinterpret_cast<const UINT8 *>(data), length, types);
}
//**************************************************************************
// DEVICE IMAGE INTERFACE
@ -172,9 +84,8 @@ static void memory_error(const char *message)
// device_image_interface - constructor
//-------------------------------------------------
device_image_interface::device_image_interface(running_machine &machine, const device_config &config, device_t &device)
: device_interface(machine, config, device),
m_image_config(dynamic_cast<const device_config_image_interface &>(config)),
device_image_interface::device_image_interface(const machine_config &mconfig, device_t &device)
: device_interface(device),
m_file(NULL),
m_mame_file(NULL),
m_full_software_name(NULL),
@ -194,6 +105,75 @@ device_image_interface::~device_image_interface()
pool_free_lib(m_mempool);
}
//-------------------------------------------------
// find_device_type - search trough list of
// device types to extact data
//-------------------------------------------------
const image_device_type_info *device_image_interface::find_device_type(iodevice_t type)
{
int i;
for (i = 0; i < ARRAY_LENGTH(device_image_interface::m_device_info_array); i++)
{
if (m_device_info_array[i].m_type == type)
return &m_device_info_array[i];
}
return NULL;
}
//-------------------------------------------------
// device_typename - retrieves device type name
//-------------------------------------------------
const char *device_image_interface::device_typename(iodevice_t type)
{
const image_device_type_info *info = find_device_type(type);
return (info != NULL) ? info->m_name : NULL;
}
//-------------------------------------------------
// device_brieftypename - retrieves device
// brief type name
//-------------------------------------------------
const char *device_image_interface::device_brieftypename(iodevice_t type)
{
const image_device_type_info *info = find_device_type(type);
return (info != NULL) ? info->m_shortname : NULL;
}
//-------------------------------------------------
// device_typeid - retrieves device type id
//-------------------------------------------------
iodevice_t device_image_interface::device_typeid(const char *name)
{
int i;
for (i = 0; i < ARRAY_LENGTH(device_image_interface::m_device_info_array); i++)
{
if (!mame_stricmp(name, m_device_info_array[i].m_name) || !mame_stricmp(name, m_device_info_array[i].m_shortname))
return m_device_info_array[i].m_type;
}
return (iodevice_t)-1;
}
/*-------------------------------------------------
device_compute_hash - compute a hash,
using this device's partial hash if appropriate
-------------------------------------------------*/
void device_image_interface::device_compute_hash(hash_collection &hashes, const void *data, size_t length, const char *types) const
{
/* retrieve the partial hash func */
device_image_partialhash_func partialhash = get_partial_hash();
/* compute the hash */
if (partialhash)
partialhash(hashes, (const unsigned char*)data, length, types);
else
hashes.compute(reinterpret_cast<const UINT8 *>(data), length, types);
}
/*-------------------------------------------------
set_image_filename - specifies the filename of
an image
@ -201,13 +181,13 @@ device_image_interface::~device_image_interface()
image_error_t device_image_interface::set_image_filename(const char *filename)
{
m_name = filename;
m_image_name = filename;
zippath_parent(&m_working_directory, filename);
m_basename = m_name.cpy(m_name);
m_basename.cpy(m_image_name);
int loc1 = m_name.rchr(0,'\\');
int loc2 = m_name.rchr(0,'/');
int loc3 = m_name.rchr(0,':');
int loc1 = m_image_name.rchr(0,'\\');
int loc2 = m_image_name.rchr(0,'/');
int loc3 = m_image_name.rchr(0,':');
int loc = MAX(loc1,MAX(loc2,loc3));
if (loc!=-1) {
m_basename = m_basename.substr(loc + 1,m_basename.len()-loc);
@ -540,7 +520,7 @@ void device_image_interface::image_checkhash()
{
/* do not cause a linear read of 600 megs please */
/* TODO: use SHA/MD5 in the CHD header as the hash */
if (m_image_config.image_type() == IO_CDROM)
if (image_type() == IO_CDROM)
return;
/* Skip calculating the hash when we have an image mounted through a software list */

View File

@ -148,18 +148,18 @@ typedef void (*device_image_display_info_func)(device_image_interface &image);
#define DEVICE_IMAGE_SOFTLIST_LOAD_NAME(name) device_softlist_load_##name
#define DEVICE_IMAGE_SOFTLIST_LOAD(name) bool DEVICE_IMAGE_SOFTLIST_LOAD_NAME(name)(device_image_interface &image, char *swlist, char *swname, rom_entry *start_entry)
// ======================> device_config_image_interface
// class representing interface-specific configuration image
class device_config_image_interface : public device_config_interface
// ======================> device_image_interface
// class representing interface-specific live image
class device_image_interface : public device_interface
{
friend class device_image_interface;
public:
// construction/destruction
device_config_image_interface(const machine_config &mconfig, device_config &device);
virtual ~device_config_image_interface();
device_image_interface(const machine_config &mconfig, device_t &device);
virtual ~device_image_interface();
// public accessors... for now
virtual iodevice_t image_type() const = 0;
virtual const char *image_type_name() const = 0;
virtual iodevice_t image_type_direct() const = 0;
@ -183,23 +183,6 @@ public:
virtual device_image_partialhash_func get_partial_hash() const = 0;
virtual void device_compute_hash(hash_collection &hashes, const void *data, size_t length, const char *types) const;
protected:
static const image_device_type_info *find_device_type(iodevice_t type);
static const image_device_type_info m_device_info_array[];
};
// ======================> device_image_interface
// class representing interface-specific live image
class device_image_interface : public device_interface
{
friend class device_config_image_interface;
public:
// construction/destruction
device_image_interface(running_machine &machine, const device_config &config, device_t &device);
virtual ~device_image_interface();
virtual bool load(const char *path) = 0;
virtual bool finish_load() = 0;
@ -212,14 +195,13 @@ public:
virtual void call_unload() = 0;
virtual void call_display() = 0;
virtual void call_display_info() = 0;
virtual device_image_partialhash_func get_partial_hash() = 0;
virtual void call_get_devices() = 0;
virtual void *get_device_specific_call() = 0;
virtual const image_device_format *device_get_indexed_creatable_format(int index);
virtual const image_device_format *device_get_named_creatable_format(const char *format_name);
const option_guide *device_get_creation_option_guide() { return m_image_config.create_option_guide(); }
const image_device_format *device_get_creatable_formats() { return m_image_config.formatlist(); }
const option_guide *device_get_creation_option_guide() { return create_option_guide(); }
const image_device_format *device_get_creatable_formats() { return formatlist(); }
virtual bool create(const char *path, const image_device_format *create_format, option_resolution *create_args) = 0;
@ -227,8 +209,8 @@ public:
void seterror(image_error_t err, const char *message);
void message(const char *format, ...);
bool exists() { return m_name; }
const char *filename() { if (!m_name) return NULL; else return m_name; }
bool exists() { return m_image_name; }
const char *filename() { if (!m_image_name) return NULL; else return m_image_name; }
const char *basename() { if (!m_basename) return NULL; else return m_basename; }
const char *basename_noext() { if (!m_basename_noext) return NULL; else return m_basename_noext; }
const char *filetype() { if (!m_filetype) return NULL; else return m_filetype; }
@ -246,8 +228,6 @@ public:
int image_feof() { check_for_file(); return core_feof(m_file); }
void *ptr() {check_for_file(); return (void *) core_fbuffer(m_file); }
// configuration access
const device_config_image_interface &image_config() const { return m_image_config; }
void set_init_phase() { m_init_phase = TRUE; }
const char* longname() { return m_longname; }
@ -291,7 +271,8 @@ protected:
// derived class overrides
// configuration
const device_config_image_interface &m_image_config; // reference to our device_config_execute_interface
static const image_device_type_info *find_device_type(iodevice_t type);
static const image_device_type_info m_device_info_array[];
/* error related info */
image_error_t m_err;
@ -300,7 +281,7 @@ protected:
/* variables that are only non-zero when an image is mounted */
core_file *m_file;
emu_file *m_mame_file;
astring m_name;
astring m_image_name;
astring m_basename;
astring m_basename_noext;
astring m_filetype;

View File

@ -106,212 +106,6 @@ address_space_config::address_space_config(const char *name, endianness_t endian
//**************************************************************************
// MEMORY DEVICE CONFIG
//**************************************************************************
//-------------------------------------------------
// device_config_memory_interface - constructor
//-------------------------------------------------
device_config_memory_interface::device_config_memory_interface(const machine_config &mconfig, device_config &devconfig)
: device_config_interface(mconfig, devconfig)
{
// initialize remaining members
memset(m_address_map, 0, sizeof(m_address_map));
}
//-------------------------------------------------
// device_config_memory_interface - destructor
//-------------------------------------------------
device_config_memory_interface::~device_config_memory_interface()
{
}
//-------------------------------------------------
// memory_space_config - return configuration for
// the given space by index, or NULL if the space
// does not exist
//-------------------------------------------------
const address_space_config *device_config_memory_interface::memory_space_config(address_spacenum spacenum) const
{
return NULL;
}
//-------------------------------------------------
// static_set_vblank_int - configuration helper
// to set up VBLANK interrupts on the device
//-------------------------------------------------
void device_config_memory_interface::static_set_addrmap(device_config *device, address_spacenum spacenum, address_map_constructor map)
{
device_config_memory_interface *memory = dynamic_cast<device_config_memory_interface *>(device);
if (memory == NULL)
throw emu_fatalerror("MCFG_DEVICE_ADDRESS_MAP called on device '%s' with no memory interface", device->tag());
if (spacenum >= ARRAY_LENGTH(memory->m_address_map))
throw emu_fatalerror("MCFG_DEVICE_ADDRESS_MAP called with out-of-range space number %d", device->tag(), spacenum);
memory->m_address_map[spacenum] = map;
}
//-------------------------------------------------
// interface_validity_check - perform validity
// checks on the memory configuration
//-------------------------------------------------
bool device_config_memory_interface::interface_validity_check(emu_options &options, const game_driver &driver) const
{
const device_config *devconfig = &m_device_config;
bool detected_overlap = DETECT_OVERLAPPING_MEMORY ? false : true;
bool error = false;
// loop over all address spaces
for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++)
{
const address_space_config *spaceconfig = space_config(spacenum);
if (spaceconfig != NULL)
{
int datawidth = spaceconfig->m_databus_width;
int alignunit = datawidth / 8;
// construct the maps
::address_map *map = global_alloc(::address_map(*devconfig, spacenum));
// if this is an empty map, just skip it
if (map->m_entrylist.first() == NULL)
{
global_free(map);
continue;
}
// validate the global map parameters
if (map->m_spacenum != spacenum)
{
mame_printf_error("%s: %s device '%s' space %d has address space %d handlers!\n", driver.source_file, driver.name, devconfig->tag(), spacenum, map->m_spacenum);
error = true;
}
if (map->m_databits != datawidth)
{
mame_printf_error("%s: %s device '%s' uses wrong memory handlers for %s space! (width = %d, memory = %08x)\n", driver.source_file, driver.name, devconfig->tag(), spaceconfig->m_name, datawidth, map->m_databits);
error = true;
}
// loop over entries and look for errors
for (address_map_entry *entry = map->m_entrylist.first(); entry != NULL; entry = entry->next())
{
UINT32 bytestart = spaceconfig->addr2byte(entry->m_addrstart);
UINT32 byteend = spaceconfig->addr2byte_end(entry->m_addrend);
// look for overlapping entries
if (!detected_overlap)
{
address_map_entry *scan;
for (scan = map->m_entrylist.first(); scan != entry; scan = scan->next())
if (entry->m_addrstart <= scan->m_addrend && entry->m_addrend >= scan->m_addrstart &&
((entry->m_read.m_type != AMH_NONE && scan->m_read.m_type != AMH_NONE) ||
(entry->m_write.m_type != AMH_NONE && scan->m_write.m_type != AMH_NONE)))
{
mame_printf_warning("%s: %s '%s' %s space has overlapping memory (%X-%X,%d,%d) vs (%X-%X,%d,%d)\n", driver.source_file, driver.name, devconfig->tag(), spaceconfig->m_name, entry->m_addrstart, entry->m_addrend, entry->m_read.m_type, entry->m_write.m_type, scan->m_addrstart, scan->m_addrend, scan->m_read.m_type, scan->m_write.m_type);
detected_overlap = true;
break;
}
}
// look for inverted start/end pairs
if (byteend < bytestart)
{
mame_printf_error("%s: %s wrong %s memory read handler start = %08x > end = %08x\n", driver.source_file, driver.name, spaceconfig->m_name, entry->m_addrstart, entry->m_addrend);
error = true;
}
// look for misaligned entries
if ((bytestart & (alignunit - 1)) != 0 || (byteend & (alignunit - 1)) != (alignunit - 1))
{
mame_printf_error("%s: %s wrong %s memory read handler start = %08x, end = %08x ALIGN = %d\n", driver.source_file, driver.name, spaceconfig->m_name, entry->m_addrstart, entry->m_addrend, alignunit);
error = true;
}
// if this is a program space, auto-assign implicit ROM entries
if (entry->m_read.m_type == AMH_ROM && entry->m_region == NULL)
{
entry->m_region = devconfig->tag();
entry->m_rgnoffs = entry->m_addrstart;
}
// if this entry references a memory region, validate it
if (entry->m_region != NULL && entry->m_share == 0)
{
// look for the region
bool found = false;
for (const rom_source *source = rom_first_source(m_machine_config); source != NULL && !found; source = rom_next_source(*source))
for (const rom_entry *romp = rom_first_region(*source); !ROMENTRY_ISEND(romp) && !found; romp++)
{
const char *regiontag = ROMREGION_GETTAG(romp);
if (regiontag != NULL)
{
astring fulltag;
rom_region_name(fulltag, &driver, source, romp);
if (fulltag.cmp(entry->m_region) == 0)
{
// verify the address range is within the region's bounds
offs_t length = ROMREGION_GETLENGTH(romp);
if (entry->m_rgnoffs + (byteend - bytestart + 1) > length)
{
mame_printf_error("%s: %s device '%s' %s space memory map entry %X-%X extends beyond region '%s' size (%X)\n", driver.source_file, driver.name, devconfig->tag(), spaceconfig->m_name, entry->m_addrstart, entry->m_addrend, entry->m_region, length);
error = true;
}
found = true;
}
}
}
// error if not found
if (!found)
{
mame_printf_error("%s: %s device '%s' %s space memory map entry %X-%X references non-existant region '%s'\n", driver.source_file, driver.name, devconfig->tag(), spaceconfig->m_name, entry->m_addrstart, entry->m_addrend, entry->m_region);
error = true;
}
}
// make sure all devices exist
if ((entry->m_read.m_type == AMH_LEGACY_DEVICE_HANDLER && entry->m_read.m_tag != NULL && m_machine_config.m_devicelist.find(entry->m_read.m_tag) == NULL) ||
(entry->m_write.m_type == AMH_LEGACY_DEVICE_HANDLER && entry->m_write.m_tag != NULL && m_machine_config.m_devicelist.find(entry->m_write.m_tag) == NULL))
{
mame_printf_error("%s: %s device '%s' %s space memory map entry references nonexistant device '%s'\n", driver.source_file, driver.name, devconfig->tag(), spaceconfig->m_name, entry->m_write.m_tag);
error = true;
}
// make sure ports exist
// if ((entry->m_read.m_type == AMH_PORT && entry->m_read.m_tag != NULL && portlist.find(entry->m_read.m_tag) == NULL) ||
// (entry->m_write.m_type == AMH_PORT && entry->m_write.m_tag != NULL && portlist.find(entry->m_write.m_tag) == NULL))
// {
// mame_printf_error("%s: %s device '%s' %s space memory map entry references nonexistant port tag '%s'\n", driver.source_file, driver.name, devconfig->tag(), spaceconfig->m_name, entry->m_read.tag);
// error = true;
// }
// validate bank and share tags
if (entry->m_read.m_type == AMH_BANK && !validate_tag(driver, "bank", entry->m_read.m_tag))
error = true ;
if (entry->m_write.m_type == AMH_BANK && !validate_tag(driver, "bank", entry->m_write.m_tag))
error = true;
if (entry->m_share != NULL && !validate_tag(driver, "share", entry->m_share))
error = true;
}
// release the address map
global_free(map);
}
}
return error;
}
//**************************************************************************
// MEMORY DEVICE MANAGEMENT
//**************************************************************************
@ -320,11 +114,14 @@ bool device_config_memory_interface::interface_validity_check(emu_options &optio
// device_memory_interface - constructor
//-------------------------------------------------
device_memory_interface::device_memory_interface(running_machine &machine, const device_config &config, device_t &device)
: device_interface(machine, config, device),
m_memory_config(dynamic_cast<const device_config_memory_interface &>(config))
device_memory_interface::device_memory_interface(const machine_config &mconfig, device_t &device)
: device_interface(device)
{
memset(m_address_map, 0, sizeof(m_address_map));
memset(m_addrspace, 0, sizeof(m_addrspace));
// configure the fast accessor
device.m_memory = this;
}
@ -337,6 +134,22 @@ device_memory_interface::~device_memory_interface()
}
//-------------------------------------------------
// static_set_vblank_int - configuration helper
// to set up VBLANK interrupts on the device
//-------------------------------------------------
void device_memory_interface::static_set_addrmap(device_t &device, address_spacenum spacenum, address_map_constructor map)
{
device_memory_interface *memory;
if (!device.interface(memory))
throw emu_fatalerror("MCFG_DEVICE_ADDRESS_MAP called on device '%s' with no memory interface", device.tag());
if (spacenum >= ARRAY_LENGTH(memory->m_address_map))
throw emu_fatalerror("MCFG_DEVICE_ADDRESS_MAP called with out-of-range space number %d", device.tag(), spacenum);
memory->m_address_map[spacenum] = map;
}
//-------------------------------------------------
// set_address_space - connect an address space
// to a device
@ -407,3 +220,154 @@ bool device_memory_interface::memory_readop(offs_t offset, int size, UINT64 &val
// by default, we don't do anything
return false;
}
//-------------------------------------------------
// interface_validity_check - perform validity
// checks on the memory configuration
//-------------------------------------------------
bool device_memory_interface::interface_validity_check(emu_options &options, const game_driver &driver) const
{
bool detected_overlap = DETECT_OVERLAPPING_MEMORY ? false : true;
bool error = false;
// loop over all address spaces
for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++)
{
const address_space_config *spaceconfig = space_config(spacenum);
if (spaceconfig != NULL)
{
int datawidth = spaceconfig->m_databus_width;
int alignunit = datawidth / 8;
// construct the maps
::address_map *map = global_alloc(::address_map(device(), spacenum));
// if this is an empty map, just skip it
if (map->m_entrylist.first() == NULL)
{
global_free(map);
continue;
}
// validate the global map parameters
if (map->m_spacenum != spacenum)
{
mame_printf_error("%s: %s device '%s' space %d has address space %d handlers!\n", driver.source_file, driver.name, device().tag(), spacenum, map->m_spacenum);
error = true;
}
if (map->m_databits != datawidth)
{
mame_printf_error("%s: %s device '%s' uses wrong memory handlers for %s space! (width = %d, memory = %08x)\n", driver.source_file, driver.name, device().tag(), spaceconfig->m_name, datawidth, map->m_databits);
error = true;
}
// loop over entries and look for errors
for (address_map_entry *entry = map->m_entrylist.first(); entry != NULL; entry = entry->next())
{
UINT32 bytestart = spaceconfig->addr2byte(entry->m_addrstart);
UINT32 byteend = spaceconfig->addr2byte_end(entry->m_addrend);
// look for overlapping entries
if (!detected_overlap)
{
address_map_entry *scan;
for (scan = map->m_entrylist.first(); scan != entry; scan = scan->next())
if (entry->m_addrstart <= scan->m_addrend && entry->m_addrend >= scan->m_addrstart &&
((entry->m_read.m_type != AMH_NONE && scan->m_read.m_type != AMH_NONE) ||
(entry->m_write.m_type != AMH_NONE && scan->m_write.m_type != AMH_NONE)))
{
mame_printf_warning("%s: %s '%s' %s space has overlapping memory (%X-%X,%d,%d) vs (%X-%X,%d,%d)\n", driver.source_file, driver.name, device().tag(), spaceconfig->m_name, entry->m_addrstart, entry->m_addrend, entry->m_read.m_type, entry->m_write.m_type, scan->m_addrstart, scan->m_addrend, scan->m_read.m_type, scan->m_write.m_type);
detected_overlap = true;
break;
}
}
// look for inverted start/end pairs
if (byteend < bytestart)
{
mame_printf_error("%s: %s wrong %s memory read handler start = %08x > end = %08x\n", driver.source_file, driver.name, spaceconfig->m_name, entry->m_addrstart, entry->m_addrend);
error = true;
}
// look for misaligned entries
if ((bytestart & (alignunit - 1)) != 0 || (byteend & (alignunit - 1)) != (alignunit - 1))
{
mame_printf_error("%s: %s wrong %s memory read handler start = %08x, end = %08x ALIGN = %d\n", driver.source_file, driver.name, spaceconfig->m_name, entry->m_addrstart, entry->m_addrend, alignunit);
error = true;
}
// if this is a program space, auto-assign implicit ROM entries
if (entry->m_read.m_type == AMH_ROM && entry->m_region == NULL)
{
entry->m_region = device().tag();
entry->m_rgnoffs = entry->m_addrstart;
}
// if this entry references a memory region, validate it
if (entry->m_region != NULL && entry->m_share == 0)
{
// look for the region
bool found = false;
for (const rom_source *source = rom_first_source(device().mconfig()); source != NULL && !found; source = rom_next_source(*source))
for (const rom_entry *romp = rom_first_region(*source); !ROMENTRY_ISEND(romp) && !found; romp++)
{
const char *regiontag = ROMREGION_GETTAG(romp);
if (regiontag != NULL)
{
astring fulltag;
rom_region_name(fulltag, &driver, source, romp);
if (fulltag.cmp(entry->m_region) == 0)
{
// verify the address range is within the region's bounds
offs_t length = ROMREGION_GETLENGTH(romp);
if (entry->m_rgnoffs + (byteend - bytestart + 1) > length)
{
mame_printf_error("%s: %s device '%s' %s space memory map entry %X-%X extends beyond region '%s' size (%X)\n", driver.source_file, driver.name, device().tag(), spaceconfig->m_name, entry->m_addrstart, entry->m_addrend, entry->m_region, length);
error = true;
}
found = true;
}
}
}
// error if not found
if (!found)
{
mame_printf_error("%s: %s device '%s' %s space memory map entry %X-%X references non-existant region '%s'\n", driver.source_file, driver.name, device().tag(), spaceconfig->m_name, entry->m_addrstart, entry->m_addrend, entry->m_region);
error = true;
}
}
// make sure all devices exist
if ((entry->m_read.m_type == AMH_LEGACY_DEVICE_HANDLER && entry->m_read.m_tag != NULL && device().mconfig().devicelist().find(entry->m_read.m_tag) == NULL) ||
(entry->m_write.m_type == AMH_LEGACY_DEVICE_HANDLER && entry->m_write.m_tag != NULL && device().mconfig().devicelist().find(entry->m_write.m_tag) == NULL))
{
mame_printf_error("%s: %s device '%s' %s space memory map entry references nonexistant device '%s'\n", driver.source_file, driver.name, device().tag(), spaceconfig->m_name, entry->m_write.m_tag);
error = true;
}
// make sure ports exist
// if ((entry->m_read.m_type == AMH_PORT && entry->m_read.m_tag != NULL && portlist.find(entry->m_read.m_tag) == NULL) ||
// (entry->m_write.m_type == AMH_PORT && entry->m_write.m_tag != NULL && portlist.find(entry->m_write.m_tag) == NULL))
// {
// mame_printf_error("%s: %s device '%s' %s space memory map entry references nonexistant port tag '%s'\n", driver.source_file, driver.name, device().tag(), spaceconfig->m_name, entry->m_read.tag);
// error = true;
// }
// validate bank and share tags
if (entry->m_read.m_type == AMH_BANK && !validate_tag(driver, "bank", entry->m_read.m_tag))
error = true ;
if (entry->m_write.m_type == AMH_BANK && !validate_tag(driver, "bank", entry->m_write.m_tag))
error = true;
if (entry->m_share != NULL && !validate_tag(driver, "share", entry->m_share))
error = true;
}
// release the address map
global_free(map);
}
}
return error;
}

View File

@ -73,7 +73,7 @@ const int TRANSLATE_FETCH_DEBUG = (TRANSLATE_FETCH | TRANSLATE_DEBUG_MASK);
//**************************************************************************
#define MCFG_DEVICE_ADDRESS_MAP(_space, _map) \
device_config_memory_interface::static_set_addrmap(device, _space, ADDRESS_MAP_NAME(_map));
device_memory_interface::static_set_addrmap(*device, _space, ADDRESS_MAP_NAME(_map));
#define MCFG_DEVICE_PROGRAM_MAP(_map) \
MCFG_DEVICE_ADDRESS_MAP(AS_PROGRAM, _map)
@ -90,37 +90,6 @@ const int TRANSLATE_FETCH_DEBUG = (TRANSLATE_FETCH | TRANSLATE_DEBUG_MASK);
// TYPE DEFINITIONS
//**************************************************************************
// ======================> device_config_memory_interface
// class representing interface-specific configuration state
class device_config_memory_interface : public device_config_interface
{
friend class device_memory_interface;
public:
// construction/destruction
device_config_memory_interface(const machine_config &mconfig, device_config &devconfig);
virtual ~device_config_memory_interface();
// basic information getters
address_map_constructor address_map(address_spacenum spacenum = AS_0) const { return (spacenum < ARRAY_LENGTH(m_address_map)) ? m_address_map[spacenum] : NULL; }
const address_space_config *space_config(address_spacenum spacenum = AS_0) const { return memory_space_config(spacenum); }
// static inline helpers
static void static_set_addrmap(device_config *device, address_spacenum spacenum, address_map_constructor map);
protected:
// required overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum) const = 0;
// optional operation overrides
virtual bool interface_validity_check(emu_options &options, const game_driver &driver) const;
address_map_constructor m_address_map[ADDRESS_SPACES]; // address maps for each address space
};
// ======================> device_memory_interface
class device_memory_interface : public device_interface
@ -129,14 +98,17 @@ class device_memory_interface : public device_interface
public:
// construction/destruction
device_memory_interface(running_machine &machine, const device_config &config, device_t &device);
device_memory_interface(const machine_config &mconfig, device_t &device);
virtual ~device_memory_interface();
// configuration access
const device_config_memory_interface &memory_config() const { return m_memory_config; }
address_map_constructor address_map(address_spacenum spacenum = AS_0) const { return (spacenum < ARRAY_LENGTH(m_address_map)) ? m_address_map[spacenum] : NULL; }
const address_space_config *space_config(address_spacenum spacenum = AS_0) const { return memory_space_config(spacenum); }
// static inline configuration helpers
static void static_set_addrmap(device_t &device, address_spacenum spacenum, address_map_constructor map);
// basic information getters
const address_space_config *space_config(address_spacenum spacenum = AS_0) const { return m_memory_config.space_config(spacenum); }
address_space *space(int index = 0) const { return m_addrspace[index]; }
address_space *space(address_spacenum index) const { return m_addrspace[static_cast<int>(index)]; }
@ -152,6 +124,9 @@ public:
bool readop(offs_t offset, int size, UINT64 &value) { return memory_readop(offset, size, value); }
protected:
// required overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum) const = 0;
// optional operation overrides
virtual bool memory_translate(address_spacenum spacenum, int intention, offs_t &address);
virtual bool memory_read(address_spacenum spacenum, offs_t offset, int size, UINT64 &value);
@ -159,9 +134,10 @@ protected:
virtual bool memory_readop(offs_t offset, int size, UINT64 &value);
// interface-level overrides
virtual bool interface_validity_check(emu_options &options, const game_driver &driver) const;
// configuration
const device_config_memory_interface &m_memory_config; // reference to our device_config_execute_interface
address_map_constructor m_address_map[ADDRESS_SPACES]; // address maps for each address space
address_space * m_addrspace[ADDRESS_SPACES]; // reported address spaces
};
@ -172,15 +148,15 @@ protected:
//**************************************************************************
//-------------------------------------------------
// devconfig_get_space_config - return a pointer
// device_get_space_config - return a pointer
// to sthe given address space's configuration
//-------------------------------------------------
inline const address_space_config *devconfig_get_space_config(const device_config &devconfig, address_spacenum spacenum = AS_0)
inline const address_space_config *device_get_space_config(const device_t &device, address_spacenum spacenum = AS_0)
{
const device_config_memory_interface *intf;
if (!devconfig.interface(intf))
throw emu_fatalerror("Device '%s' does not have memory interface", devconfig.tag());
const device_memory_interface *intf;
if (!device.interface(intf))
throw emu_fatalerror("Device '%s' does not have memory interface", device.tag());
return intf->space_config(spacenum);
}

View File

@ -41,30 +41,6 @@
//**************************************************************************
// DEVICE CONFIG NVRAM INTERFACE
//**************************************************************************
//-------------------------------------------------
// device_config_nvram_interface - constructor
//-------------------------------------------------
device_config_nvram_interface::device_config_nvram_interface(const machine_config &mconfig, device_config &devconfig)
: device_config_interface(mconfig, devconfig)
{
}
//-------------------------------------------------
// ~device_config_nvram_interface - destructor
//-------------------------------------------------
device_config_nvram_interface::~device_config_nvram_interface()
{
}
//**************************************************************************
// DEVICE NVRAM INTERFACE
//**************************************************************************
@ -73,9 +49,8 @@ device_config_nvram_interface::~device_config_nvram_interface()
// device_nvram_interface - constructor
//-------------------------------------------------
device_nvram_interface::device_nvram_interface(running_machine &machine, const device_config &config, device_t &device)
: device_interface(machine, config, device),
m_nvram_config(dynamic_cast<const device_config_nvram_interface &>(config))
device_nvram_interface::device_nvram_interface(const machine_config &mconfig, device_t &device)
: device_interface(device)
{
}

Some files were not shown because too many files have changed in this diff Show More