mirror of
https://github.com/holub/mame
synced 2025-05-18 03:35:03 +03:00
Massive memory system change. This is another step along the path toward
supporting cleaner implementations of drivers in the explicitly OO world. Expect a follow-on of several more changes to clean up from this one, which deliberately tried to avoid touching much driver code. Converted address_space to a class, and moved most members behind accessor methods, apart from space->machine and space->cpu. Removed external references to 8le/8be/16le/16be/32le/32be/64le/64be. All external access is now done via virtual functions read_byte()/read_word()/etc. Moved differentiation between the endianness and the bus width internal to memory.c, and also added a new axis to support small/large address spaces, which allows for faster lookups on spaces smaller than 18 bits. Provided methods for most global memory operations within the new address_space class. These will be bulk converted in a future update, but for now there are inline wrappers to hide this change from existing callers. Created new module delegate.h which implements C++ delegates in a form that works for MAME. Details are in the opening comment. Delegates allow member functions of certain classes to be used as callbacks, which will hopefully be the beginning of the end of fetching the driver_data field in most callbacks. All classes that host delegates must derive from bindable_object. Today, all devices and driver_data do implicitly via their base class. Defined delegates for read/write handlers. The new delegates are always passed an address_space reference, along with offset, data, and mask. Delegates can refer to methods either in the driver_data class or in a device class. To specify a callback in an address map, just use AM_READ_MEMBER(class, member). In fact, all existing AM_ macros that take read/write handlers can now accept delegates in their place. Delegates that are specified in an address map are proto-delegates which have no object; they are bound to their object when the corresponding address_space is created. Added machine->m_nonspecific_space which can be passed as the required address_space parameter to the new read/write methods in legacy situations where the space is not provided. Eventually this can go away but we will need it for a while yet. Added methods to the new address_space class to dynamically install delegates just like you can dynamically install handlers today. Delegates installed this way must be pre-bound to their object. Moved beathead's read/write handlers into members of beathead_state as an example of using the new delegates. This provides examples of both static (via an address_map) and dynamic (via install_handler calls) mapping using delegates. Added read/write member functions to okim6295_device as an example of using delegates to call devices. Updated audio/williams.c as a single example of calling the device via its member function callbacks. These will be bulk updated in a future update, and the old global callbacks removed. Changed the DIRECT_UPDATE_CALLBACKs into delegates as well. Updated all users to the new function format. Added methods on direct_read_data for configuring the parameters in a standard way to make the implementation clearer. Created a simple_list template container class for managing the common singly-linked lists we use all over in the project. Many other internal changes in memory.c, mostly involving restructuring the code into proper classes.
This commit is contained in:
parent
bf9afe4c4b
commit
dd19e512c0
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -575,6 +575,8 @@ src/emu/debugger.c svneol=native#text/plain
|
||||
src/emu/debugger.h svneol=native#text/plain
|
||||
src/emu/debugint/debugint.c svneol=native#text/plain
|
||||
src/emu/debugint/debugint.h svneol=native#text/plain
|
||||
src/emu/delegate.c svneol=native#text/plain
|
||||
src/emu/delegate.h svneol=native#text/plain
|
||||
src/emu/deprecat.h svneol=native#text/plain
|
||||
src/emu/devcb.c svneol=native#text/plain
|
||||
src/emu/devcb.h svneol=native#text/plain
|
||||
|
@ -41,31 +41,22 @@
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// MACROS
|
||||
// ADDRESS MAP ENTRY
|
||||
//**************************************************************************
|
||||
|
||||
// maps a full 64-bit mask down to an 8-bit byte mask
|
||||
#define UNITMASK8(x) \
|
||||
((((UINT64)(x) >> (63-7)) & 0x80) | \
|
||||
(((UINT64)(x) >> (55-6)) & 0x40) | \
|
||||
(((UINT64)(x) >> (47-5)) & 0x20) | \
|
||||
(((UINT64)(x) >> (39-4)) & 0x10) | \
|
||||
(((UINT64)(x) >> (31-3)) & 0x08) | \
|
||||
(((UINT64)(x) >> (23-2)) & 0x04) | \
|
||||
(((UINT64)(x) >> (15-1)) & 0x02) | \
|
||||
(((UINT64)(x) >> ( 7-0)) & 0x01))
|
||||
//-------------------------------------------------
|
||||
// set_tag - set the appropriate tag for a device
|
||||
//-------------------------------------------------
|
||||
|
||||
// maps a full 64-bit mask down to a 4-bit word mask
|
||||
#define UNITMASK16(x) \
|
||||
((((UINT64)(x) >> (63-3)) & 0x08) | \
|
||||
(((UINT64)(x) >> (47-2)) & 0x04) | \
|
||||
(((UINT64)(x) >> (31-1)) & 0x02) | \
|
||||
(((UINT64)(x) >> (15-0)) & 0x01))
|
||||
|
||||
// maps a full 64-bit mask down to a 2-bit dword mask
|
||||
#define UNITMASK32(x) \
|
||||
((((UINT64)(x) >> (63-1)) & 0x02) | \
|
||||
(((UINT64)(x) >> (31-0)) & 0x01))
|
||||
inline void map_handler_data::set_tag(const device_config &devconfig, const char *tag)
|
||||
{
|
||||
if (tag == NULL)
|
||||
m_tag = NULL;
|
||||
else if (strcmp(tag, DEVICE_SELF) == 0)
|
||||
m_tag = devconfig.tag();
|
||||
else
|
||||
m_tag = devconfig.siblingtag(m_derived_tag, tag);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -93,6 +84,22 @@ address_map_entry::address_map_entry(address_map &map, offs_t start, offs_t end)
|
||||
m_gensizeptroffs_plus1(0),
|
||||
m_region(NULL),
|
||||
m_rgnoffs(0),
|
||||
m_rspace8(NULL),
|
||||
m_rspace16(NULL),
|
||||
m_rspace32(NULL),
|
||||
m_rspace64(NULL),
|
||||
m_rdevice8(NULL),
|
||||
m_rdevice16(NULL),
|
||||
m_rdevice32(NULL),
|
||||
m_rdevice64(NULL),
|
||||
m_wspace8(NULL),
|
||||
m_wspace16(NULL),
|
||||
m_wspace32(NULL),
|
||||
m_wspace64(NULL),
|
||||
m_wdevice8(NULL),
|
||||
m_wdevice16(NULL),
|
||||
m_wdevice32(NULL),
|
||||
m_wdevice64(NULL),
|
||||
m_memory(NULL),
|
||||
m_bytestart(0),
|
||||
m_byteend(0),
|
||||
@ -121,8 +128,8 @@ void address_map_entry::set_mask(offs_t _mask)
|
||||
|
||||
void address_map_entry::set_read_port(const device_config &devconfig, const char *tag)
|
||||
{
|
||||
m_read.type = AMH_PORT;
|
||||
m_read.tag = devconfig.siblingtag(m_read.derived_tag, tag);
|
||||
m_read.m_type = AMH_PORT;
|
||||
m_read.set_tag(devconfig, tag);
|
||||
}
|
||||
|
||||
|
||||
@ -133,8 +140,8 @@ void address_map_entry::set_read_port(const device_config &devconfig, const char
|
||||
|
||||
void address_map_entry::set_write_port(const device_config &devconfig, const char *tag)
|
||||
{
|
||||
m_write.type = AMH_PORT;
|
||||
m_write.tag = devconfig.siblingtag(m_write.derived_tag, tag);
|
||||
m_write.m_type = AMH_PORT;
|
||||
m_write.set_tag(devconfig, tag);
|
||||
}
|
||||
|
||||
|
||||
@ -145,10 +152,10 @@ void address_map_entry::set_write_port(const device_config &devconfig, const cha
|
||||
|
||||
void address_map_entry::set_readwrite_port(const device_config &devconfig, const char *tag)
|
||||
{
|
||||
m_read.type = AMH_PORT;
|
||||
m_read.tag = devconfig.siblingtag(m_read.derived_tag, tag);
|
||||
m_write.type = AMH_PORT;
|
||||
m_write.tag = devconfig.siblingtag(m_write.derived_tag, tag);
|
||||
m_read.m_type = AMH_PORT;
|
||||
m_read.set_tag(devconfig, tag);
|
||||
m_write.m_type = AMH_PORT;
|
||||
m_write.set_tag(devconfig, tag);
|
||||
}
|
||||
|
||||
|
||||
@ -159,8 +166,8 @@ void address_map_entry::set_readwrite_port(const device_config &devconfig, const
|
||||
|
||||
void address_map_entry::set_read_bank(const device_config &devconfig, const char *tag)
|
||||
{
|
||||
m_read.type = AMH_BANK;
|
||||
m_read.tag = devconfig.siblingtag(m_read.derived_tag, tag);
|
||||
m_read.m_type = AMH_BANK;
|
||||
m_read.set_tag(devconfig, tag);
|
||||
}
|
||||
|
||||
|
||||
@ -171,8 +178,8 @@ void address_map_entry::set_read_bank(const device_config &devconfig, const char
|
||||
|
||||
void address_map_entry::set_write_bank(const device_config &devconfig, const char *tag)
|
||||
{
|
||||
m_write.type = AMH_BANK;
|
||||
m_write.tag = devconfig.siblingtag(m_write.derived_tag, tag);
|
||||
m_write.m_type = AMH_BANK;
|
||||
m_write.set_tag(devconfig, tag);
|
||||
}
|
||||
|
||||
|
||||
@ -183,10 +190,10 @@ void address_map_entry::set_write_bank(const device_config &devconfig, const cha
|
||||
|
||||
void address_map_entry::set_readwrite_bank(const device_config &devconfig, const char *tag)
|
||||
{
|
||||
m_read.type = AMH_BANK;
|
||||
m_read.tag = devconfig.siblingtag(m_read.derived_tag, tag);
|
||||
m_write.type = AMH_BANK;
|
||||
m_write.tag = devconfig.siblingtag(m_write.derived_tag, tag);
|
||||
m_read.m_type = AMH_BANK;
|
||||
m_read.set_tag(devconfig, tag);
|
||||
m_write.m_type = AMH_BANK;
|
||||
m_write.set_tag(devconfig, tag);
|
||||
}
|
||||
|
||||
|
||||
@ -197,23 +204,25 @@ void address_map_entry::set_readwrite_bank(const device_config &devconfig, const
|
||||
|
||||
void address_map_entry::internal_set_handler(read8_space_func func, const char *string, UINT64 unitmask)
|
||||
{
|
||||
assert(func != NULL);
|
||||
assert(unitmask_is_appropriate(8, unitmask, string));
|
||||
m_read.type = AMH_HANDLER;
|
||||
m_read.bits = (unitmask == 0) ? 0 : 8;
|
||||
m_read.mask = UNITMASK8(unitmask);
|
||||
m_read.handler.read.shandler8 = func;
|
||||
m_read.name = string;
|
||||
m_read.m_type = AMH_LEGACY_SPACE_HANDLER;
|
||||
m_read.m_bits = 8;
|
||||
m_read.m_mask = unitmask;
|
||||
m_read.m_name = string;
|
||||
m_rspace8 = func;
|
||||
}
|
||||
|
||||
|
||||
void address_map_entry::internal_set_handler(write8_space_func func, const char *string, UINT64 unitmask)
|
||||
{
|
||||
assert(func != NULL);
|
||||
assert(unitmask_is_appropriate(8, unitmask, string));
|
||||
m_write.type = AMH_HANDLER;
|
||||
m_write.bits = (unitmask == 0) ? 0 : 8;
|
||||
m_write.mask = UNITMASK8(unitmask);
|
||||
m_write.handler.write.shandler8 = func;
|
||||
m_write.name = string;
|
||||
m_write.m_type = AMH_LEGACY_SPACE_HANDLER;
|
||||
m_write.m_bits = 8;
|
||||
m_write.m_mask = unitmask;
|
||||
m_write.m_name = string;
|
||||
m_wspace8 = func;
|
||||
}
|
||||
|
||||
|
||||
@ -226,25 +235,27 @@ 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)
|
||||
{
|
||||
assert(func != NULL);
|
||||
assert(unitmask_is_appropriate(8, unitmask, string));
|
||||
m_read.type = AMH_DEVICE_HANDLER;
|
||||
m_read.bits = (unitmask == 0) ? 0 : 8;
|
||||
m_read.mask = UNITMASK8(unitmask);
|
||||
m_read.handler.read.dhandler8 = func;
|
||||
m_read.name = string;
|
||||
m_read.tag = devconfig.siblingtag(m_read.derived_tag, tag);
|
||||
m_read.m_type = AMH_LEGACY_DEVICE_HANDLER;
|
||||
m_read.m_bits = 8;
|
||||
m_read.m_mask = unitmask;
|
||||
m_read.m_name = string;
|
||||
m_read.set_tag(devconfig, 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)
|
||||
{
|
||||
assert(func != NULL);
|
||||
assert(unitmask_is_appropriate(8, unitmask, string));
|
||||
m_write.type = AMH_DEVICE_HANDLER;
|
||||
m_write.bits = (unitmask == 0) ? 0 : 8;
|
||||
m_write.mask = UNITMASK8(unitmask);
|
||||
m_write.handler.write.dhandler8 = func;
|
||||
m_write.name = string;
|
||||
m_write.tag = devconfig.siblingtag(m_write.derived_tag, tag);
|
||||
m_write.m_type = AMH_LEGACY_DEVICE_HANDLER;
|
||||
m_write.m_bits = 8;
|
||||
m_write.m_mask = unitmask;
|
||||
m_write.m_name = string;
|
||||
m_write.set_tag(devconfig, tag);
|
||||
m_wdevice8 = func;
|
||||
}
|
||||
|
||||
|
||||
@ -255,6 +266,39 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
|
||||
}
|
||||
|
||||
|
||||
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate func, UINT64 unitmask)
|
||||
{
|
||||
assert(!func.isnull());
|
||||
assert(unitmask_is_appropriate(8, unitmask, func.name()));
|
||||
m_read.m_type = (tag == NULL) ? AMH_DRIVER_DELEGATE : AMH_DEVICE_DELEGATE;
|
||||
m_read.m_bits = 8;
|
||||
m_read.m_mask = unitmask;
|
||||
m_read.m_name = func.name();
|
||||
m_read.set_tag(devconfig, tag);
|
||||
m_rproto8 = func;
|
||||
}
|
||||
|
||||
|
||||
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write8_proto_delegate func, UINT64 unitmask)
|
||||
{
|
||||
assert(!func.isnull());
|
||||
assert(unitmask_is_appropriate(8, unitmask, func.name()));
|
||||
m_write.m_type = (tag == NULL) ? AMH_DRIVER_DELEGATE : AMH_DEVICE_DELEGATE;;
|
||||
m_write.m_bits = 8;
|
||||
m_write.m_mask = unitmask;
|
||||
m_write.m_name = func.name();
|
||||
m_write.set_tag(devconfig, tag);
|
||||
m_wproto8 = func;
|
||||
}
|
||||
|
||||
|
||||
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate rfunc, write8_proto_delegate wfunc, UINT64 unitmask)
|
||||
{
|
||||
internal_set_handler(devconfig, tag, rfunc, unitmask);
|
||||
internal_set_handler(devconfig, tag, wfunc, unitmask);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// internal_set_handler - handler setters for
|
||||
// 16-bit read/write handlers
|
||||
@ -262,23 +306,25 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
|
||||
|
||||
void address_map_entry::internal_set_handler(read16_space_func func, const char *string, UINT64 unitmask)
|
||||
{
|
||||
assert(func != NULL);
|
||||
assert(unitmask_is_appropriate(16, unitmask, string));
|
||||
m_read.type = AMH_HANDLER;
|
||||
m_read.bits = (unitmask == 0) ? 0 : 16;
|
||||
m_read.mask = UNITMASK16(unitmask);
|
||||
m_read.handler.read.shandler16 = func;
|
||||
m_read.name = string;
|
||||
m_read.m_type = AMH_LEGACY_SPACE_HANDLER;
|
||||
m_read.m_bits = 16;
|
||||
m_read.m_mask = unitmask;
|
||||
m_read.m_name = string;
|
||||
m_rspace16 = func;
|
||||
}
|
||||
|
||||
|
||||
void address_map_entry::internal_set_handler(write16_space_func func, const char *string, UINT64 unitmask)
|
||||
{
|
||||
assert(func != NULL);
|
||||
assert(unitmask_is_appropriate(16, unitmask, string));
|
||||
m_write.type = AMH_HANDLER;
|
||||
m_write.bits = (unitmask == 0) ? 0 : 16;
|
||||
m_write.mask = UNITMASK16(unitmask);
|
||||
m_write.handler.write.shandler16 = func;
|
||||
m_write.name = string;
|
||||
m_write.m_type = AMH_LEGACY_SPACE_HANDLER;
|
||||
m_write.m_bits = 16;
|
||||
m_write.m_mask = unitmask;
|
||||
m_write.m_name = string;
|
||||
m_wspace16 = func;
|
||||
}
|
||||
|
||||
|
||||
@ -291,25 +337,27 @@ 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)
|
||||
{
|
||||
assert(func != NULL);
|
||||
assert(unitmask_is_appropriate(16, unitmask, string));
|
||||
m_read.type = AMH_DEVICE_HANDLER;
|
||||
m_read.bits = (unitmask == 0) ? 0 : 16;
|
||||
m_read.mask = UNITMASK16(unitmask);
|
||||
m_read.handler.read.dhandler16 = func;
|
||||
m_read.name = string;
|
||||
m_read.tag = devconfig.siblingtag(m_read.derived_tag, tag);
|
||||
m_read.m_type = AMH_LEGACY_DEVICE_HANDLER;
|
||||
m_read.m_bits = 16;
|
||||
m_read.m_mask = unitmask;
|
||||
m_read.m_name = string;
|
||||
m_read.set_tag(devconfig, 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)
|
||||
{
|
||||
assert(func != NULL);
|
||||
assert(unitmask_is_appropriate(16, unitmask, string));
|
||||
m_write.type = AMH_DEVICE_HANDLER;
|
||||
m_write.bits = (unitmask == 0) ? 0 : 16;
|
||||
m_write.mask = UNITMASK16(unitmask);
|
||||
m_write.handler.write.dhandler16 = func;
|
||||
m_write.name = string;
|
||||
m_write.tag = devconfig.siblingtag(m_write.derived_tag, tag);
|
||||
m_write.m_type = AMH_LEGACY_DEVICE_HANDLER;
|
||||
m_write.m_bits = 16;
|
||||
m_write.m_mask = unitmask;
|
||||
m_write.m_name = string;
|
||||
m_write.set_tag(devconfig, tag);
|
||||
m_wdevice16 = func;
|
||||
}
|
||||
|
||||
|
||||
@ -320,6 +368,39 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
|
||||
}
|
||||
|
||||
|
||||
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate func, UINT64 unitmask)
|
||||
{
|
||||
assert(!func.isnull());
|
||||
assert(unitmask_is_appropriate(16, unitmask, func.name()));
|
||||
m_read.m_type = (tag == NULL) ? AMH_DRIVER_DELEGATE : AMH_DEVICE_DELEGATE;;
|
||||
m_read.m_bits = 16;
|
||||
m_read.m_mask = unitmask;
|
||||
m_read.m_name = func.name();
|
||||
m_read.set_tag(devconfig, tag);
|
||||
m_rproto16 = func;
|
||||
}
|
||||
|
||||
|
||||
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write16_proto_delegate func, UINT64 unitmask)
|
||||
{
|
||||
assert(!func.isnull());
|
||||
assert(unitmask_is_appropriate(16, unitmask, func.name()));
|
||||
m_write.m_type = (tag == NULL) ? AMH_DRIVER_DELEGATE : AMH_DEVICE_DELEGATE;;
|
||||
m_write.m_bits = 16;
|
||||
m_write.m_mask = unitmask;
|
||||
m_write.m_name = func.name();
|
||||
m_write.set_tag(devconfig, tag);
|
||||
m_wproto16 = func;
|
||||
}
|
||||
|
||||
|
||||
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate rfunc, write16_proto_delegate wfunc, UINT64 unitmask)
|
||||
{
|
||||
internal_set_handler(devconfig, tag, rfunc, unitmask);
|
||||
internal_set_handler(devconfig, tag, wfunc, unitmask);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// internal_set_handler - handler setters for
|
||||
// 32-bit read/write handlers
|
||||
@ -327,23 +408,25 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
|
||||
|
||||
void address_map_entry::internal_set_handler(read32_space_func func, const char *string, UINT64 unitmask)
|
||||
{
|
||||
assert(func != NULL);
|
||||
assert(unitmask_is_appropriate(32, unitmask, string));
|
||||
m_read.type = AMH_HANDLER;
|
||||
m_read.bits = (unitmask == 0) ? 0 : 32;
|
||||
m_read.mask = UNITMASK32(unitmask);
|
||||
m_read.handler.read.shandler32 = func;
|
||||
m_read.name = string;
|
||||
m_read.m_type = AMH_LEGACY_SPACE_HANDLER;
|
||||
m_read.m_bits = 32;
|
||||
m_read.m_mask = unitmask;
|
||||
m_read.m_name = string;
|
||||
m_rspace32 = func;
|
||||
}
|
||||
|
||||
|
||||
void address_map_entry::internal_set_handler(write32_space_func func, const char *string, UINT64 unitmask)
|
||||
{
|
||||
assert(func != NULL);
|
||||
assert(unitmask_is_appropriate(32, unitmask, string));
|
||||
m_write.type = AMH_HANDLER;
|
||||
m_write.bits = (unitmask == 0) ? 0 : 32;
|
||||
m_write.mask = UNITMASK32(unitmask);
|
||||
m_write.handler.write.shandler32 = func;
|
||||
m_write.name = string;
|
||||
m_write.m_type = AMH_LEGACY_SPACE_HANDLER;
|
||||
m_write.m_bits = 32;
|
||||
m_write.m_mask = unitmask;
|
||||
m_write.m_name = string;
|
||||
m_wspace32 = func;
|
||||
}
|
||||
|
||||
|
||||
@ -356,25 +439,27 @@ 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)
|
||||
{
|
||||
assert(func != NULL);
|
||||
assert(unitmask_is_appropriate(32, unitmask, string));
|
||||
m_read.type = AMH_DEVICE_HANDLER;
|
||||
m_read.bits = (unitmask == 0) ? 0 : 32;
|
||||
m_read.mask = UNITMASK32(unitmask);
|
||||
m_read.handler.read.dhandler32 = func;
|
||||
m_read.name = string;
|
||||
m_read.tag = devconfig.siblingtag(m_read.derived_tag, tag);
|
||||
m_read.m_type = AMH_LEGACY_DEVICE_HANDLER;
|
||||
m_read.m_bits = 32;
|
||||
m_read.m_mask = unitmask;
|
||||
m_read.m_name = string;
|
||||
m_read.set_tag(devconfig, 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)
|
||||
{
|
||||
assert(func != NULL);
|
||||
assert(unitmask_is_appropriate(32, unitmask, string));
|
||||
m_write.type = AMH_DEVICE_HANDLER;
|
||||
m_write.bits = (unitmask == 0) ? 0 : 32;
|
||||
m_write.mask = UNITMASK32(unitmask);
|
||||
m_write.handler.write.dhandler32 = func;
|
||||
m_write.name = string;
|
||||
m_write.tag = devconfig.siblingtag(m_write.derived_tag, tag);
|
||||
m_write.m_type = AMH_LEGACY_DEVICE_HANDLER;
|
||||
m_write.m_bits = 32;
|
||||
m_write.m_mask = unitmask;
|
||||
m_write.m_name = string;
|
||||
m_write.set_tag(devconfig, tag);
|
||||
m_wdevice32 = func;
|
||||
}
|
||||
|
||||
|
||||
@ -385,6 +470,39 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
|
||||
}
|
||||
|
||||
|
||||
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate func, UINT64 unitmask)
|
||||
{
|
||||
assert(!func.isnull());
|
||||
assert(unitmask_is_appropriate(32, unitmask, func.name()));
|
||||
m_read.m_type = (tag == NULL) ? AMH_DRIVER_DELEGATE : AMH_DEVICE_DELEGATE;;
|
||||
m_read.m_bits = 32;
|
||||
m_read.m_mask = unitmask;
|
||||
m_read.m_name = func.name();
|
||||
m_read.set_tag(devconfig, tag);
|
||||
m_rproto32 = func;
|
||||
}
|
||||
|
||||
|
||||
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write32_proto_delegate func, UINT64 unitmask)
|
||||
{
|
||||
assert(!func.isnull());
|
||||
assert(unitmask_is_appropriate(32, unitmask, func.name()));
|
||||
m_write.m_type = (tag == NULL) ? AMH_DRIVER_DELEGATE : AMH_DEVICE_DELEGATE;;
|
||||
m_write.m_bits = 32;
|
||||
m_write.m_mask = unitmask;
|
||||
m_write.m_name = func.name();
|
||||
m_write.set_tag(devconfig, tag);
|
||||
m_wproto32 = func;
|
||||
}
|
||||
|
||||
|
||||
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate rfunc, write32_proto_delegate wfunc, UINT64 unitmask)
|
||||
{
|
||||
internal_set_handler(devconfig, tag, rfunc, unitmask);
|
||||
internal_set_handler(devconfig, tag, wfunc, unitmask);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// internal_set_handler - handler setters for
|
||||
// 64-bit read/write handlers
|
||||
@ -392,23 +510,25 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
|
||||
|
||||
void address_map_entry::internal_set_handler(read64_space_func func, const char *string, UINT64 unitmask)
|
||||
{
|
||||
assert(func != NULL);
|
||||
assert(unitmask_is_appropriate(64, unitmask, string));
|
||||
m_read.type = AMH_HANDLER;
|
||||
m_read.bits = (unitmask == 0) ? 0 : 64;
|
||||
m_read.mask = 0;
|
||||
m_read.handler.read.shandler64 = func;
|
||||
m_read.name = string;
|
||||
m_read.m_type = AMH_LEGACY_SPACE_HANDLER;
|
||||
m_read.m_bits = 64;
|
||||
m_read.m_mask = 0;
|
||||
m_read.m_name = string;
|
||||
m_rspace64 = func;
|
||||
}
|
||||
|
||||
|
||||
void address_map_entry::internal_set_handler(write64_space_func func, const char *string, UINT64 unitmask)
|
||||
{
|
||||
assert(func != NULL);
|
||||
assert(unitmask_is_appropriate(64, unitmask, string));
|
||||
m_write.type = AMH_HANDLER;
|
||||
m_write.bits = (unitmask == 0) ? 0 : 64;
|
||||
m_write.mask = 0;
|
||||
m_write.handler.write.shandler64 = func;
|
||||
m_write.name = string;
|
||||
m_write.m_type = AMH_LEGACY_SPACE_HANDLER;
|
||||
m_write.m_bits = 64;
|
||||
m_write.m_mask = 0;
|
||||
m_write.m_name = string;
|
||||
m_wspace64 = func;
|
||||
}
|
||||
|
||||
|
||||
@ -421,25 +541,27 @@ 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)
|
||||
{
|
||||
assert(func != NULL);
|
||||
assert(unitmask_is_appropriate(64, unitmask, string));
|
||||
m_read.type = AMH_DEVICE_HANDLER;
|
||||
m_read.bits = (unitmask == 0) ? 0 : 64;
|
||||
m_read.mask = 0;
|
||||
m_read.handler.read.dhandler64 = func;
|
||||
m_read.name = string;
|
||||
m_read.tag = devconfig.siblingtag(m_read.derived_tag, tag);
|
||||
m_read.m_type = AMH_LEGACY_DEVICE_HANDLER;
|
||||
m_read.m_bits = 64;
|
||||
m_read.m_mask = 0;
|
||||
m_read.m_name = string;
|
||||
m_read.set_tag(devconfig, 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)
|
||||
{
|
||||
assert(func != NULL);
|
||||
assert(unitmask_is_appropriate(64, unitmask, string));
|
||||
m_write.type = AMH_DEVICE_HANDLER;
|
||||
m_write.bits = (unitmask == 0) ? 0 : 64;
|
||||
m_write.mask = 0;
|
||||
m_write.handler.write.dhandler64 = func;
|
||||
m_write.name = string;
|
||||
m_write.tag = devconfig.siblingtag(m_write.derived_tag, tag);
|
||||
m_write.m_type = AMH_LEGACY_DEVICE_HANDLER;
|
||||
m_write.m_bits = 64;
|
||||
m_write.m_mask = 0;
|
||||
m_write.m_name = string;
|
||||
m_write.set_tag(devconfig, tag);
|
||||
m_wdevice64 = func;
|
||||
}
|
||||
|
||||
|
||||
@ -450,6 +572,39 @@ void address_map_entry::internal_set_handler(const device_config &devconfig, con
|
||||
}
|
||||
|
||||
|
||||
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read64_proto_delegate func, UINT64 unitmask)
|
||||
{
|
||||
assert(!func.isnull());
|
||||
assert(unitmask_is_appropriate(64, unitmask, func.name()));
|
||||
m_read.m_type = (tag == NULL) ? AMH_DRIVER_DELEGATE : AMH_DEVICE_DELEGATE;;
|
||||
m_read.m_bits = 64;
|
||||
m_read.m_mask = 0;
|
||||
m_read.m_name = func.name();
|
||||
m_read.set_tag(devconfig, tag);
|
||||
m_rproto64 = func;
|
||||
}
|
||||
|
||||
|
||||
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write64_proto_delegate func, UINT64 unitmask)
|
||||
{
|
||||
assert(!func.isnull());
|
||||
assert(unitmask_is_appropriate(64, unitmask, func.name()));
|
||||
m_write.m_type = (tag == NULL) ? AMH_DRIVER_DELEGATE : AMH_DEVICE_DELEGATE;;
|
||||
m_write.m_bits = 64;
|
||||
m_write.m_mask = 0;
|
||||
m_write.m_name = func.name();
|
||||
m_write.set_tag(devconfig, tag);
|
||||
m_wproto64 = func;
|
||||
}
|
||||
|
||||
|
||||
void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read64_proto_delegate rfunc, write64_proto_delegate wfunc, UINT64 unitmask)
|
||||
{
|
||||
internal_set_handler(devconfig, tag, rfunc, unitmask);
|
||||
internal_set_handler(devconfig, tag, wfunc, unitmask);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// unitmask_is_appropriate - verify that the
|
||||
// provided unitmask is valid and expected
|
||||
@ -540,9 +695,7 @@ address_map::address_map(const device_config &devconfig, int spacenum)
|
||||
: m_spacenum(spacenum),
|
||||
m_databits(0xff),
|
||||
m_unmapval(0),
|
||||
m_globalmask(0),
|
||||
m_entrylist(NULL),
|
||||
m_tailptr(&m_entrylist)
|
||||
m_globalmask(0)
|
||||
{
|
||||
// get our memory interface
|
||||
const device_config_memory_interface *memintf;
|
||||
@ -574,13 +727,6 @@ address_map::address_map(const device_config &devconfig, int spacenum)
|
||||
|
||||
address_map::~address_map()
|
||||
{
|
||||
// free all entries */
|
||||
while (m_entrylist != NULL)
|
||||
{
|
||||
address_map_entry *entry = m_entrylist;
|
||||
m_entrylist = entry->m_next;
|
||||
global_free(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -621,8 +767,7 @@ void address_map::set_global_mask(offs_t mask)
|
||||
address_map_entry8 *address_map::add(offs_t start, offs_t end, address_map_entry8 *ptr)
|
||||
{
|
||||
ptr = global_alloc(address_map_entry8(*this, start, end));
|
||||
*m_tailptr = ptr;
|
||||
m_tailptr = &ptr->m_next;
|
||||
m_entrylist.append(*ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@ -630,8 +775,7 @@ address_map_entry8 *address_map::add(offs_t start, offs_t end, address_map_entry
|
||||
address_map_entry16 *address_map::add(offs_t start, offs_t end, address_map_entry16 *ptr)
|
||||
{
|
||||
ptr = global_alloc(address_map_entry16(*this, start, end));
|
||||
*m_tailptr = ptr;
|
||||
m_tailptr = &ptr->m_next;
|
||||
m_entrylist.append(*ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@ -639,8 +783,7 @@ address_map_entry16 *address_map::add(offs_t start, offs_t end, address_map_entr
|
||||
address_map_entry32 *address_map::add(offs_t start, offs_t end, address_map_entry32 *ptr)
|
||||
{
|
||||
ptr = global_alloc(address_map_entry32(*this, start, end));
|
||||
*m_tailptr = ptr;
|
||||
m_tailptr = &ptr->m_next;
|
||||
m_entrylist.append(*ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@ -648,244 +791,6 @@ address_map_entry32 *address_map::add(offs_t start, offs_t end, address_map_entr
|
||||
address_map_entry64 *address_map::add(offs_t start, offs_t end, address_map_entry64 *ptr)
|
||||
{
|
||||
ptr = global_alloc(address_map_entry64(*this, start, end));
|
||||
*m_tailptr = ptr;
|
||||
m_tailptr = &ptr->m_next;
|
||||
m_entrylist.append(*ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
// old code for reference
|
||||
|
||||
/***************************************************************************
|
||||
ADDRESS MAP HELPERS
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
map_detokenize - detokenize an array of
|
||||
address map tokens
|
||||
-------------------------------------------------*/
|
||||
|
||||
#define check_map(field) do { \
|
||||
if (map->field != 0 && map->field != tmap.field) \
|
||||
fatalerror("%s: %s included a mismatched address map (%s %d) for an existing map with %s %d!\n", driver->source_file, driver->name, #field, tmap.field, #field, map->field); \
|
||||
} while (0)
|
||||
|
||||
#define check_entry_handler(row) do { \
|
||||
if (entry->row.type != AMH_NONE) \
|
||||
fatalerror("%s: %s AM_RANGE(0x%x, 0x%x) %s handler already set!\n", driver->source_file, driver->name, entry->addrstart, entry->addrend, #row); \
|
||||
} while (0)
|
||||
|
||||
#define check_entry_field(field) do { \
|
||||
if (entry->field != 0) \
|
||||
fatalerror("%s: %s AM_RANGE(0x%x, 0x%x) setting %s already set!\n", driver->source_file, driver->name, entry->addrstart, entry->addrend, #field); \
|
||||
} while (0)
|
||||
|
||||
static void map_detokenize(memory_private *memdata, address_map *map, const game_driver *driver, const device_config *devconfig, const addrmap_token *tokens)
|
||||
{
|
||||
address_map_entry **firstentryptr;
|
||||
address_map_entry **entryptr;
|
||||
address_map_entry *entry;
|
||||
address_map tmap = {0};
|
||||
UINT32 entrytype;
|
||||
int maptype;
|
||||
|
||||
/* check the first token */
|
||||
TOKEN_GET_UINT32_UNPACK3(tokens, entrytype, 8, tmap.spacenum, 8, tmap.databits, 8);
|
||||
if (entrytype != ADDRMAP_TOKEN_START)
|
||||
fatalerror("%s: %s Address map missing ADDRMAP_TOKEN_START!\n", driver->source_file, driver->name);
|
||||
if (tmap.spacenum >= ADDRESS_SPACES)
|
||||
fatalerror("%s: %s Invalid address space %d for memory map!\n", driver->source_file, driver->name, tmap.spacenum);
|
||||
if (tmap.databits != 8 && tmap.databits != 16 && tmap.databits != 32 && tmap.databits != 64)
|
||||
fatalerror("%s: %s Invalid data bits %d for memory map!\n", driver->source_file, driver->name, tmap.databits);
|
||||
check_map(spacenum);
|
||||
check_map(databits);
|
||||
|
||||
/* fill in the map values */
|
||||
map->spacenum = tmap.spacenum;
|
||||
map->databits = tmap.databits;
|
||||
|
||||
/* find the end of the list */
|
||||
for (entryptr = &map->entrylist; *entryptr != NULL; entryptr = &(*entryptr)->next) ;
|
||||
firstentryptr = entryptr;
|
||||
entry = NULL;
|
||||
|
||||
/* loop over tokens until we hit the end */
|
||||
while (entrytype != ADDRMAP_TOKEN_END)
|
||||
{
|
||||
/* unpack the token from the first entry */
|
||||
TOKEN_GET_UINT32_UNPACK1(tokens, entrytype, 8);
|
||||
switch (entrytype)
|
||||
{
|
||||
/* end */
|
||||
case ADDRMAP_TOKEN_END:
|
||||
break;
|
||||
|
||||
/* including */
|
||||
case ADDRMAP_TOKEN_INCLUDE:
|
||||
map_detokenize(memdata, map, driver, devconfig, TOKEN_GET_PTR(tokens, tokenptr));
|
||||
for (entryptr = &map->entrylist; *entryptr != NULL; entryptr = &(*entryptr)->next) ;
|
||||
entry = NULL;
|
||||
break;
|
||||
|
||||
/* global flags */
|
||||
case ADDRMAP_TOKEN_GLOBAL_MASK:
|
||||
TOKEN_UNGET_UINT32(tokens);
|
||||
TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, tmap.globalmask, 32);
|
||||
check_map(globalmask);
|
||||
map->globalmask = tmap.globalmask;
|
||||
break;
|
||||
|
||||
case ADDRMAP_TOKEN_UNMAP_VALUE:
|
||||
TOKEN_UNGET_UINT32(tokens);
|
||||
TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, tmap.unmapval, 1);
|
||||
check_map(unmapval);
|
||||
map->unmapval = tmap.unmapval;
|
||||
break;
|
||||
|
||||
/* start a new range */
|
||||
case ADDRMAP_TOKEN_RANGE:
|
||||
entry = *entryptr = global_alloc_clear(address_map_entry);
|
||||
entryptr = &entry->next;
|
||||
TOKEN_GET_UINT64_UNPACK2(tokens, entry->addrstart, 32, entry->addrend, 32);
|
||||
break;
|
||||
|
||||
case ADDRMAP_TOKEN_MASK:
|
||||
check_entry_field(addrmask);
|
||||
TOKEN_UNGET_UINT32(tokens);
|
||||
TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, entry->addrmask, 32);
|
||||
break;
|
||||
|
||||
case ADDRMAP_TOKEN_MIRROR:
|
||||
check_entry_field(addrmirror);
|
||||
TOKEN_UNGET_UINT32(tokens);
|
||||
TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, entry->addrmirror, 32);
|
||||
if (entry->addrmirror != 0)
|
||||
{
|
||||
entry->addrstart &= ~entry->addrmirror;
|
||||
entry->addrend &= ~entry->addrmirror;
|
||||
}
|
||||
break;
|
||||
|
||||
case ADDRMAP_TOKEN_READ:
|
||||
check_entry_handler(read);
|
||||
TOKEN_UNGET_UINT32(tokens);
|
||||
TOKEN_GET_UINT32_UNPACK4(tokens, entrytype, 8, maptype, 8, entry->read.bits, 8, entry->read.mask, 8);
|
||||
entry->read.type = (map_handler_type)maptype;
|
||||
if (entry->read.type == AMH_HANDLER || entry->read.type == AMH_DEVICE_HANDLER)
|
||||
{
|
||||
entry->read.handler.read = TOKEN_GET_PTR(tokens, read);
|
||||
entry->read.name = TOKEN_GET_STRING(tokens);
|
||||
}
|
||||
if (entry->read.type == AMH_DEVICE_HANDLER || entry->read.type == AMH_PORT || entry->read.type == AMH_BANK)
|
||||
entry->read.tag = devconfig->siblingtag(entry->read.derived_tag, TOKEN_GET_STRING(tokens));
|
||||
break;
|
||||
|
||||
case ADDRMAP_TOKEN_WRITE:
|
||||
check_entry_handler(write);
|
||||
TOKEN_UNGET_UINT32(tokens);
|
||||
TOKEN_GET_UINT32_UNPACK4(tokens, entrytype, 8, maptype, 8, entry->write.bits, 8, entry->write.mask, 8);
|
||||
entry->write.type = (map_handler_type)maptype;
|
||||
if (entry->write.type == AMH_HANDLER || entry->write.type == AMH_DEVICE_HANDLER)
|
||||
{
|
||||
entry->write.handler.write = TOKEN_GET_PTR(tokens, write);
|
||||
entry->write.name = TOKEN_GET_STRING(tokens);
|
||||
}
|
||||
if (entry->write.type == AMH_DEVICE_HANDLER || entry->write.type == AMH_PORT || entry->write.type == AMH_BANK)
|
||||
entry->write.tag = devconfig->siblingtag(entry->write.derived_tag, TOKEN_GET_STRING(tokens));
|
||||
break;
|
||||
|
||||
case ADDRMAP_TOKEN_READWRITE:
|
||||
check_entry_handler(read);
|
||||
check_entry_handler(write);
|
||||
TOKEN_UNGET_UINT32(tokens);
|
||||
TOKEN_GET_UINT32_UNPACK4(tokens, entrytype, 8, maptype, 8, entry->read.bits, 8, entry->read.mask, 8);
|
||||
entry->write.type = entry->read.type = (map_handler_type)maptype;
|
||||
entry->write.bits = entry->read.bits;
|
||||
entry->write.mask = entry->read.mask;
|
||||
if (entry->read.type == AMH_HANDLER || entry->read.type == AMH_DEVICE_HANDLER)
|
||||
{
|
||||
entry->read.handler.read = TOKEN_GET_PTR(tokens, read);
|
||||
entry->read.name = TOKEN_GET_STRING(tokens);
|
||||
entry->write.handler.write = TOKEN_GET_PTR(tokens, write);
|
||||
entry->write.name = TOKEN_GET_STRING(tokens);
|
||||
}
|
||||
if (entry->read.type == AMH_DEVICE_HANDLER || entry->read.type == AMH_PORT || entry->read.type == AMH_BANK)
|
||||
{
|
||||
const char *basetag = TOKEN_GET_STRING(tokens);
|
||||
entry->read.tag = devconfig->siblingtag(entry->read.derived_tag, basetag);
|
||||
entry->write.tag = devconfig->siblingtag(entry->write.derived_tag, basetag);
|
||||
}
|
||||
break;
|
||||
|
||||
case ADDRMAP_TOKEN_REGION:
|
||||
check_entry_field(region);
|
||||
TOKEN_UNGET_UINT32(tokens);
|
||||
TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, entry->rgnoffs, 32);
|
||||
entry->region = devconfig->siblingtag(entry->region_string, TOKEN_GET_STRING(tokens));
|
||||
break;
|
||||
|
||||
case ADDRMAP_TOKEN_SHARE:
|
||||
check_entry_field(share);
|
||||
entry->share = TOKEN_GET_STRING(tokens);
|
||||
if (memdata != NULL)
|
||||
memdata->sharemap.add(entry->share, UNMAPPED_SHARE_PTR, FALSE);
|
||||
break;
|
||||
|
||||
case ADDRMAP_TOKEN_BASEPTR:
|
||||
check_entry_field(baseptr);
|
||||
entry->baseptr = (void **)TOKEN_GET_PTR(tokens, voidptr);
|
||||
break;
|
||||
|
||||
case ADDRMAP_TOKEN_BASE_MEMBER:
|
||||
check_entry_field(baseptroffs_plus1);
|
||||
TOKEN_UNGET_UINT32(tokens);
|
||||
TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, entry->baseptroffs_plus1, 24);
|
||||
entry->baseptroffs_plus1++;
|
||||
break;
|
||||
|
||||
case ADDRMAP_TOKEN_BASE_GENERIC:
|
||||
check_entry_field(genbaseptroffs_plus1);
|
||||
TOKEN_UNGET_UINT32(tokens);
|
||||
TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, entry->genbaseptroffs_plus1, 24);
|
||||
entry->genbaseptroffs_plus1++;
|
||||
break;
|
||||
|
||||
case ADDRMAP_TOKEN_SIZEPTR:
|
||||
check_entry_field(sizeptr);
|
||||
entry->sizeptr = TOKEN_GET_PTR(tokens, sizeptr);
|
||||
break;
|
||||
|
||||
case ADDRMAP_TOKEN_SIZE_MEMBER:
|
||||
check_entry_field(sizeptroffs_plus1);
|
||||
TOKEN_UNGET_UINT32(tokens);
|
||||
TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, entry->sizeptroffs_plus1, 24);
|
||||
entry->sizeptroffs_plus1++;
|
||||
break;
|
||||
|
||||
case ADDRMAP_TOKEN_SIZE_GENERIC:
|
||||
check_entry_field(gensizeptroffs_plus1);
|
||||
TOKEN_UNGET_UINT32(tokens);
|
||||
TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, entry->gensizeptroffs_plus1, 24);
|
||||
entry->gensizeptroffs_plus1++;
|
||||
break;
|
||||
|
||||
default:
|
||||
fatalerror("Invalid token %d in address map\n", entrytype);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* post-process to apply the global mask */
|
||||
if (map->globalmask != 0)
|
||||
for (entry = map->entrylist; entry != NULL; entry = entry->next)
|
||||
{
|
||||
entry->addrstart &= map->globalmask;
|
||||
entry->addrend &= map->globalmask;
|
||||
entry->addrmask &= map->globalmask;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -60,8 +60,10 @@ enum map_handler_type
|
||||
AMH_ROM,
|
||||
AMH_NOP,
|
||||
AMH_UNMAP,
|
||||
AMH_HANDLER,
|
||||
AMH_DEVICE_HANDLER,
|
||||
AMH_DRIVER_DELEGATE,
|
||||
AMH_DEVICE_DELEGATE,
|
||||
AMH_LEGACY_SPACE_HANDLER,
|
||||
AMH_LEGACY_DEVICE_HANDLER,
|
||||
AMH_PORT,
|
||||
AMH_BANK
|
||||
};
|
||||
@ -72,67 +74,25 @@ enum map_handler_type
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
// address map constructors are functions generated by tokens
|
||||
typedef void (*address_map_constructor)(address_map &map, const device_config &devconfig);
|
||||
|
||||
|
||||
// read_handler is a union of all the different read handler types
|
||||
union read_handler
|
||||
{
|
||||
genf * generic; // generic function pointer
|
||||
read8_space_func shandler8; // 8-bit space read handler
|
||||
read16_space_func shandler16; // 16-bit space read handler
|
||||
read32_space_func shandler32; // 32-bit space read handler
|
||||
read64_space_func shandler64; // 64-bit space read handler
|
||||
read8_device_func dhandler8; // 8-bit device read handler
|
||||
read16_device_func dhandler16; // 16-bit device read handler
|
||||
read32_device_func dhandler32; // 32-bit device read handler
|
||||
read64_device_func dhandler64; // 64-bit device read handler
|
||||
};
|
||||
|
||||
|
||||
// write_handler is a union of all the different write handler types
|
||||
union write_handler
|
||||
{
|
||||
genf * generic; // generic function pointer
|
||||
write8_space_func shandler8; // 8-bit space write handler
|
||||
write16_space_func shandler16; // 16-bit space write handler
|
||||
write32_space_func shandler32; // 32-bit space write handler
|
||||
write64_space_func shandler64; // 64-bit space write handler
|
||||
write8_device_func dhandler8; // 8-bit device write handler
|
||||
write16_device_func dhandler16; // 16-bit device write handler
|
||||
write32_device_func dhandler32; // 32-bit device write handler
|
||||
write64_device_func dhandler64; // 64-bit device write handler
|
||||
};
|
||||
|
||||
|
||||
// memory_handler is a union of all read and write handler types
|
||||
union memory_handler
|
||||
{
|
||||
genf * generic; // generic function pointer
|
||||
read_handler read; // read handler union
|
||||
write_handler write; // write handler union
|
||||
};
|
||||
|
||||
|
||||
// address map handler data
|
||||
class map_handler_data
|
||||
{
|
||||
public:
|
||||
map_handler_data()
|
||||
: type(AMH_NONE),
|
||||
bits(0),
|
||||
mask(0),
|
||||
name(NULL),
|
||||
tag(NULL) { handler.generic = NULL; }
|
||||
: m_type(AMH_NONE),
|
||||
m_bits(0),
|
||||
m_mask(0),
|
||||
m_name(NULL),
|
||||
m_tag(NULL) { }
|
||||
|
||||
map_handler_type type; // type of the handler
|
||||
UINT8 bits; // width of the handler in bits, or 0 for default
|
||||
UINT8 mask; // mask for which lanes apply
|
||||
memory_handler handler; // a memory handler
|
||||
const char * name; // name of the handler
|
||||
const char * tag; // tag pointing to a reference
|
||||
astring derived_tag; // string used to hold derived names
|
||||
map_handler_type m_type; // type of the handler
|
||||
UINT8 m_bits; // width of the handler in bits, or 0 for default
|
||||
UINT64 m_mask; // mask for which lanes apply
|
||||
const char * m_name; // name of the handler
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
@ -145,11 +105,14 @@ class address_map_entry
|
||||
public:
|
||||
// construction/destruction
|
||||
address_map_entry(address_map &map, offs_t start, offs_t end);
|
||||
|
||||
// getters
|
||||
address_map_entry *next() const { return m_next; }
|
||||
|
||||
// simple inline setters
|
||||
void set_mirror(offs_t _mirror) { m_addrmirror = _mirror; }
|
||||
void set_read_type(map_handler_type _type) { m_read.type = _type; }
|
||||
void set_write_type(map_handler_type _type) { m_write.type = _type; }
|
||||
void set_read_type(map_handler_type _type) { m_read.m_type = _type; }
|
||||
void set_write_type(map_handler_type _type) { m_write.m_type = _type; }
|
||||
void set_region(const char *tag, offs_t offset) { m_region = tag; m_rgnoffs = offset; }
|
||||
void set_share(const char *tag) { m_share = tag; }
|
||||
void set_sizeptr(size_t *_sizeptr) { m_sizeptr = _sizeptr; }
|
||||
@ -172,31 +135,59 @@ public:
|
||||
void set_readwrite_bank(const device_config &devconfig, const char *tag);
|
||||
|
||||
// public state
|
||||
address_map_entry * m_next; // pointer to the next entry
|
||||
address_map & m_map; // reference to our owning map
|
||||
astring m_region_string; // string used to hold derived names
|
||||
address_map_entry * m_next; // pointer to the next entry
|
||||
address_map & m_map; // reference to our owning map
|
||||
astring m_region_string; // string used to hold derived names
|
||||
|
||||
offs_t m_addrstart; // start address
|
||||
offs_t m_addrend; // end address
|
||||
offs_t m_addrmirror; // mirror bits
|
||||
offs_t m_addrmask; // mask bits
|
||||
map_handler_data m_read; // data for read handler
|
||||
map_handler_data m_write; // data for write handler
|
||||
const char * m_share; // tag of a shared memory block
|
||||
void ** m_baseptr; // receives pointer to memory (optional)
|
||||
size_t * m_sizeptr; // receives size of area in bytes (optional)
|
||||
UINT32 m_baseptroffs_plus1; // offset of base pointer within driver_data, plus 1
|
||||
UINT32 m_sizeptroffs_plus1; // offset of size pointer within driver_data, plus 1
|
||||
UINT32 m_genbaseptroffs_plus1; // offset of base pointer within generic_pointers, plus 1
|
||||
UINT32 m_gensizeptroffs_plus1; // offset of size pointer within generic_pointers, plus 1
|
||||
const char * m_region; // tag of region containing the memory backing this entry
|
||||
offs_t m_rgnoffs; // offset within the region
|
||||
// basic information
|
||||
offs_t m_addrstart; // start address
|
||||
offs_t m_addrend; // end address
|
||||
offs_t m_addrmirror; // mirror bits
|
||||
offs_t m_addrmask; // mask bits
|
||||
map_handler_data m_read; // data for read handler
|
||||
map_handler_data m_write; // data for write handler
|
||||
const char * m_share; // tag of a shared memory block
|
||||
void ** m_baseptr; // receives pointer to memory (optional)
|
||||
size_t * m_sizeptr; // receives size of area in bytes (optional)
|
||||
UINT32 m_baseptroffs_plus1; // offset of base pointer within driver_data, plus 1
|
||||
UINT32 m_sizeptroffs_plus1; // offset of size pointer within driver_data, plus 1
|
||||
UINT32 m_genbaseptroffs_plus1; // offset of base pointer within generic_pointers, plus 1
|
||||
UINT32 m_gensizeptroffs_plus1; // offset of size pointer within generic_pointers, plus 1
|
||||
const char * m_region; // tag of region containing the memory backing this entry
|
||||
offs_t m_rgnoffs; // offset within the region
|
||||
|
||||
void * m_memory; // pointer to memory backing this entry
|
||||
offs_t m_bytestart; // byte-adjusted start address
|
||||
offs_t m_byteend; // byte-adjusted end address
|
||||
offs_t m_bytemirror; // byte-adjusted mirror bits
|
||||
offs_t m_bytemask; // byte-adjusted mask bits
|
||||
// handlers
|
||||
read8_proto_delegate m_rproto8; // 8-bit read proto-delegate
|
||||
read16_proto_delegate m_rproto16; // 16-bit read proto-delegate
|
||||
read32_proto_delegate m_rproto32; // 32-bit read proto-delegate
|
||||
read64_proto_delegate m_rproto64; // 64-bit read proto-delegate
|
||||
read8_space_func m_rspace8; // 8-bit legacy address space handler
|
||||
read16_space_func m_rspace16; // 16-bit legacy address space handler
|
||||
read32_space_func m_rspace32; // 32-bit legacy address space handler
|
||||
read64_space_func m_rspace64; // 64-bit legacy address space handler
|
||||
read8_device_func m_rdevice8; // 8-bit legacy device handler
|
||||
read16_device_func m_rdevice16; // 16-bit legacy device handler
|
||||
read32_device_func m_rdevice32; // 32-bit legacy device handler
|
||||
read64_device_func m_rdevice64; // 64-bit legacy device handler
|
||||
write8_proto_delegate m_wproto8; // 8-bit write proto-delegate
|
||||
write16_proto_delegate m_wproto16; // 16-bit write proto-delegate
|
||||
write32_proto_delegate m_wproto32; // 32-bit write proto-delegate
|
||||
write64_proto_delegate m_wproto64; // 64-bit write proto-delegate
|
||||
write8_space_func m_wspace8; // 8-bit legacy address space handler
|
||||
write16_space_func m_wspace16; // 16-bit legacy address space handler
|
||||
write32_space_func m_wspace32; // 32-bit legacy address space handler
|
||||
write64_space_func m_wspace64; // 64-bit legacy address space handler
|
||||
write8_device_func m_wdevice8; // 8-bit legacy device handler
|
||||
write16_device_func m_wdevice16; // 16-bit legacy device handler
|
||||
write32_device_func m_wdevice32; // 32-bit legacy device handler
|
||||
write64_device_func m_wdevice64; // 64-bit legacy device handler
|
||||
|
||||
// information used during processing
|
||||
void * m_memory; // pointer to memory backing this entry
|
||||
offs_t m_bytestart; // byte-adjusted start address
|
||||
offs_t m_byteend; // byte-adjusted end address
|
||||
offs_t m_bytemirror; // byte-adjusted mirror bits
|
||||
offs_t m_bytemask; // byte-adjusted mask bits
|
||||
|
||||
protected:
|
||||
// internal base pointer setting (derived classes provide typed versions)
|
||||
@ -205,10 +196,13 @@ protected:
|
||||
// internal handler setters for 8-bit functions
|
||||
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(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_proto_delegate func, UINT64 mask);
|
||||
void internal_set_handler(const device_config &devconfig, const char *tag, write8_proto_delegate func, UINT64 mask);
|
||||
void internal_set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate rfunc, write8_proto_delegate wfunc, UINT64 mask);
|
||||
|
||||
// internal handler setters for 16-bit functions
|
||||
void internal_set_handler(read16_space_func func, const char *string, UINT64 mask);
|
||||
@ -217,6 +211,9 @@ protected:
|
||||
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_proto_delegate func, UINT64 mask);
|
||||
void internal_set_handler(const device_config &devconfig, const char *tag, write16_proto_delegate func, UINT64 mask);
|
||||
void internal_set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate rfunc, write16_proto_delegate wfunc, UINT64 mask);
|
||||
|
||||
// internal handler setters for 32-bit functions
|
||||
void internal_set_handler(read32_space_func func, const char *string, UINT64 mask);
|
||||
@ -225,6 +222,9 @@ protected:
|
||||
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_proto_delegate func, UINT64 mask);
|
||||
void internal_set_handler(const device_config &devconfig, const char *tag, write32_proto_delegate func, UINT64 mask);
|
||||
void internal_set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate rfunc, write32_proto_delegate wfunc, UINT64 mask);
|
||||
|
||||
// internal handler setters for 64-bit functions
|
||||
void internal_set_handler(read64_space_func func, const char *string, UINT64 mask);
|
||||
@ -233,6 +233,9 @@ protected:
|
||||
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_proto_delegate func, UINT64 mask);
|
||||
void internal_set_handler(const device_config &devconfig, const char *tag, write64_proto_delegate func, UINT64 mask);
|
||||
void internal_set_handler(const device_config &devconfig, const char *tag, read64_proto_delegate rfunc, write64_proto_delegate wfunc, UINT64 mask);
|
||||
|
||||
private:
|
||||
// helper functions
|
||||
@ -257,6 +260,9 @@ public:
|
||||
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_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, write8_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate rfunc, write8_proto_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); }
|
||||
};
|
||||
|
||||
|
||||
@ -277,6 +283,9 @@ public:
|
||||
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_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, write16_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate rfunc, write16_proto_delegate wfunc) { internal_set_handler(devconfig, 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); }
|
||||
@ -285,6 +294,9 @@ public:
|
||||
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_proto_delegate func, UINT16 mask) { internal_set_handler(devconfig, tag, func, mask); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, write8_proto_delegate func, UINT16 mask) { internal_set_handler(devconfig, tag, func, mask); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate rfunc, write8_proto_delegate wfunc, UINT16 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
|
||||
};
|
||||
|
||||
|
||||
@ -305,6 +317,9 @@ public:
|
||||
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_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, write32_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate rfunc, write32_proto_delegate wfunc) { internal_set_handler(devconfig, 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); }
|
||||
@ -313,6 +328,9 @@ public:
|
||||
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_proto_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, write16_proto_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate rfunc, write16_proto_delegate wfunc, UINT32 mask) { internal_set_handler(devconfig, 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); }
|
||||
@ -321,6 +339,9 @@ public:
|
||||
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_proto_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, write8_proto_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate rfunc, write8_proto_delegate wfunc, UINT32 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
|
||||
};
|
||||
|
||||
|
||||
@ -341,6 +362,9 @@ public:
|
||||
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_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, write64_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, read64_proto_delegate rfunc, write64_proto_delegate wfunc) { internal_set_handler(devconfig, 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); }
|
||||
@ -349,6 +373,9 @@ public:
|
||||
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_proto_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, write32_proto_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate rfunc, write32_proto_delegate wfunc, UINT64 mask) { internal_set_handler(devconfig, 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); }
|
||||
@ -357,6 +384,9 @@ public:
|
||||
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_proto_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, write16_proto_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate rfunc, write16_proto_delegate wfunc, UINT64 mask) { internal_set_handler(devconfig, 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); }
|
||||
@ -365,6 +395,9 @@ public:
|
||||
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_proto_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, write8_proto_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
|
||||
void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate rfunc, write8_proto_delegate wfunc, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
|
||||
};
|
||||
|
||||
|
||||
@ -396,11 +429,7 @@ public:
|
||||
UINT8 m_databits; // data bits represented by the map
|
||||
UINT8 m_unmapval; // unmapped memory value
|
||||
offs_t m_globalmask; // global mask
|
||||
address_map_entry * m_entrylist; // list of entries
|
||||
|
||||
private:
|
||||
// internal data
|
||||
address_map_entry ** m_tailptr;
|
||||
simple_list<address_map_entry> m_entrylist; // list of entries
|
||||
};
|
||||
|
||||
|
||||
@ -419,6 +448,8 @@ private:
|
||||
#define ADDRESS_MAP_START(_name, _space, _bits) \
|
||||
void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
|
||||
{ \
|
||||
typedef read##_bits##_proto_delegate read_proto_delegate; \
|
||||
typedef write##_bits##_proto_delegate write_proto_delegate; \
|
||||
address_map_entry##_bits *curentry = NULL; \
|
||||
(void)curentry; \
|
||||
map.configure(_space, _bits); \
|
||||
@ -458,7 +489,7 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
|
||||
curentry->set_mirror(_mirror); \
|
||||
|
||||
|
||||
// space reads
|
||||
// legacy space reads
|
||||
#define AM_READ(_handler) \
|
||||
curentry->set_handler(_handler, #_handler); \
|
||||
|
||||
@ -472,7 +503,7 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
|
||||
curentry->set_handler(_handler, #_handler, _unitmask); \
|
||||
|
||||
|
||||
// space writes
|
||||
// legacy space writes
|
||||
#define AM_WRITE(_handler) \
|
||||
curentry->set_handler(_handler, #_handler); \
|
||||
|
||||
@ -486,7 +517,7 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
|
||||
curentry->set_handler(_handler, #_handler, _unitmask); \
|
||||
|
||||
|
||||
// space reads/writes
|
||||
// legacy space reads/writes
|
||||
#define AM_READWRITE(_rhandler, _whandler) \
|
||||
curentry->set_handler(_rhandler, #_rhandler, _whandler, #_whandler); \
|
||||
|
||||
@ -500,7 +531,7 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
|
||||
curentry->set_handler(_rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \
|
||||
|
||||
|
||||
// device reads
|
||||
// legacy device reads
|
||||
#define AM_DEVREAD(_tag, _handler) \
|
||||
curentry->set_handler(devconfig, _tag, _handler, #_handler); \
|
||||
|
||||
@ -514,7 +545,7 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
|
||||
curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \
|
||||
|
||||
|
||||
// device writes
|
||||
// legacy device writes
|
||||
#define AM_DEVWRITE(_tag, _handler) \
|
||||
curentry->set_handler(devconfig, _tag, _handler, #_handler); \
|
||||
|
||||
@ -528,7 +559,7 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
|
||||
curentry->set_handler(devconfig, _tag, _handler, #_handler, _unitmask); \
|
||||
|
||||
|
||||
// device reads/writes
|
||||
// legacy device reads/writes
|
||||
#define AM_DEVREADWRITE(_tag, _rhandler, _whandler) \
|
||||
curentry->set_handler(devconfig, _tag, _rhandler, #_rhandler, _whandler, #_whandler); \
|
||||
|
||||
@ -542,6 +573,90 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
|
||||
curentry->set_handler(devconfig, _tag, _rhandler, #_rhandler, _whandler, #_whandler, _unitmask); \
|
||||
|
||||
|
||||
// driver data reads
|
||||
#define AM_READ_MEMBER(_class, _handler) \
|
||||
curentry->set_handler(devconfig, NULL, read_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler)); \
|
||||
|
||||
#define AM_READ8_MEMBER(_class, _handler, _unitmask) \
|
||||
curentry->set_handler(devconfig, NULL, read8_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
|
||||
|
||||
#define AM_READ16_MEMBER(_class, _handler, _unitmask) \
|
||||
curentry->set_handler(devconfig, NULL, read16_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
|
||||
|
||||
#define AM_READ32_MEMBER(_class, _handler, _unitmask) \
|
||||
curentry->set_handler(devconfig, NULL, read32_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
|
||||
|
||||
|
||||
// driver data writes
|
||||
#define AM_WRITE_MEMBER(_class, _handler) \
|
||||
curentry->set_handler(devconfig, NULL, write_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler)); \
|
||||
|
||||
#define AM_WRITE8_MEMBER(_class, _handler, _unitmask) \
|
||||
curentry->set_handler(devconfig, NULL, write8_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
|
||||
|
||||
#define AM_WRITE16_MEMBER(_class, _handler, _unitmask) \
|
||||
curentry->set_handler(devconfig, NULL, write16_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
|
||||
|
||||
#define AM_WRITE32_MEMBER(_class, _handler, _unitmask) \
|
||||
curentry->set_handler(devconfig, NULL, write32_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
|
||||
|
||||
|
||||
// driver data reads/writes
|
||||
#define AM_READWRITE_MEMBER(_class, _rhandler, _whandler) \
|
||||
curentry->set_handler(devconfig, NULL, read_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler)); \
|
||||
|
||||
#define AM_READWRITE8_MEMBER(_class, _rhandler, _whandler, _unitmask) \
|
||||
curentry->set_handler(devconfig, NULL, read8_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write8_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \
|
||||
|
||||
#define AM_READWRITE16_MEMBER(_class, _rhandler, _whandler, _unitmask) \
|
||||
curentry->set_handler(devconfig, NULL, read16_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write16_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \
|
||||
|
||||
#define AM_READWRITE32_MEMBER(_class, _rhandler, _whandler, _unitmask) \
|
||||
curentry->set_handler(devconfig, NULL, read32_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write32_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \
|
||||
|
||||
|
||||
// device reads
|
||||
#define AM_DEVREAD_MEMBER(_tag, _class, _handler) \
|
||||
curentry->set_handler(devconfig, _tag, read_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler)); \
|
||||
|
||||
#define AM_DEVREAD8_MEMBER(_tag, _class, _handler, _unitmask) \
|
||||
curentry->set_handler(devconfig, _tag, read8_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
|
||||
|
||||
#define AM_DEVREAD16_MEMBER(_tag, _class, _handler, _unitmask) \
|
||||
curentry->set_handler(devconfig, _tag, read16_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
|
||||
|
||||
#define AM_DEVREAD32_MEMBER(_tag, _class, _handler, _unitmask) \
|
||||
curentry->set_handler(devconfig, _tag, read32_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
|
||||
|
||||
|
||||
// device writes
|
||||
#define AM_DEVWRITE_MEMBER(_tag, _class, _handler) \
|
||||
curentry->set_handler(devconfig, _tag, write_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler)); \
|
||||
|
||||
#define AM_DEVWRITE8_MEMBER(_tag, _class, _handler, _unitmask) \
|
||||
curentry->set_handler(devconfig, _tag, write8_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
|
||||
|
||||
#define AM_DEVWRITE16_MEMBER(_tag, _class, _handler, _unitmask) \
|
||||
curentry->set_handler(devconfig, _tag, write16_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
|
||||
|
||||
#define AM_DEVWRITE32_MEMBER(_tag, _class, _handler, _unitmask) \
|
||||
curentry->set_handler(devconfig, _tag, write32_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
|
||||
|
||||
|
||||
// device reads/writes
|
||||
#define AM_DEVREADWRITE_MEMBER(_tag, _class, _rhandler, _whandler) \
|
||||
curentry->set_handler(devconfig, _tag, read_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler)); \
|
||||
|
||||
#define AM_DEVREADWRITE8_MEMBER(_tag, _class, _rhandler, _whandler, _unitmask) \
|
||||
curentry->set_handler(devconfig, _tag, read8_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write8_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \
|
||||
|
||||
#define AM_DEVREADWRITE16_MEMBER(_tag, _class, _rhandler, _whandler, _unitmask) \
|
||||
curentry->set_handler(devconfig, _tag, read16_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write16_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \
|
||||
|
||||
#define AM_DEVREADWRITE32_MEMBER(_tag, _class, _rhandler, _whandler, _unitmask) \
|
||||
curentry->set_handler(devconfig, _tag, read32_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write32_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \
|
||||
|
||||
|
||||
// special-case accesses
|
||||
#define AM_ROM \
|
||||
curentry->set_read_type(AMH_ROM); \
|
||||
@ -624,12 +739,25 @@ void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
|
||||
#define AM_ROMBANK(_bank) AM_READ_BANK(_bank)
|
||||
#define AM_RAMBANK(_bank) AM_READWRITE_BANK(_bank)
|
||||
#define AM_RAM_READ(_read) AM_READ(_read) AM_WRITEONLY
|
||||
#define AM_RAM_READ_MEMBER(_class, _read) AM_READ_MEMBER(_class, _read) AM_WRITEONLY
|
||||
#define AM_RAM_WRITE(_write) AM_READONLY AM_WRITE(_write)
|
||||
#define AM_RAM_DEVREAD(_tag, _read) AM_DEVREAD(_tag, _read) AM_WRITEONLY
|
||||
#define AM_RAM_DEVWRITE(_tag, _write) AM_READONLY AM_DEVWRITE(_tag, _write)
|
||||
#define AM_RAM_WRITE_MEMBER(_class, _write) AM_READONLY AM_WRITE_MEMBER(_class, _write)
|
||||
#define AM_RAM_DEVREAD(_tag, _read) AM_DEVREAD(_tag, _read) AM_WRITEONLY
|
||||
#define AM_RAM_DEVREAD_MEMBER(_tag, _class, _read) AM_DEVREAD_MEMBER(_tag, _class, _read) AM_WRITEONLY
|
||||
#define AM_RAM_DEVWRITE(_tag, _write) AM_READONLY AM_DEVWRITE(_tag, _write)
|
||||
#define AM_RAM_DEVWRITE_MEMBER(_tag, _class, _write) AM_READONLY AM_DEVWRITE_MEMBER(_tag, _class, _write)
|
||||
|
||||
#define AM_BASE_SIZE_MEMBER(_struct, _base, _size) AM_BASE_MEMBER(_struct, _base) AM_SIZE_MEMBER(_struct, _size)
|
||||
#define AM_BASE_SIZE_GENERIC(_member) AM_BASE_GENERIC(_member) AM_SIZE_GENERIC(_member)
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
// use this to refer to the owning device when providing a device tag
|
||||
static const char DEVICE_SELF[] = "";
|
||||
|
||||
|
||||
#endif /* __ADDRMAP_H__ */
|
||||
|
@ -277,7 +277,7 @@ struct _drcbe_state
|
||||
x86code * debug_cpu_instruction_hook;/* debugger callback */
|
||||
x86code * debug_log_hashjmp; /* hashjmp debugging */
|
||||
x86code * drcmap_get_value; /* map lookup helper */
|
||||
data_accessors accessors[ADDRESS_SPACES];/* memory accessors */
|
||||
data_accessors accessors[ADDRESS_SPACES]; /* memory accessors */
|
||||
const address_space * space[ADDRESS_SPACES]; /* address spaces */
|
||||
|
||||
UINT8 sse41; /* do we have SSE4.1 support? */
|
||||
@ -388,7 +388,6 @@ static const UINT8 fprnd_map[4] =
|
||||
};
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
TABLES
|
||||
***************************************************************************/
|
||||
@ -716,7 +715,7 @@ static drcbe_state *drcbex64_alloc(drcuml_state *drcuml, drccache *cache, runnin
|
||||
{
|
||||
drcbe->space[spacenum] = downcast<cpu_device *>(device)->space(spacenum);
|
||||
if (drcbe->space[spacenum] != NULL)
|
||||
drcbe->accessors[spacenum] = drcbe->space[spacenum]->accessors;
|
||||
drcbe->space[spacenum]->accessors(drcbe->accessors[spacenum]);
|
||||
}
|
||||
|
||||
/* build up necessary arrays */
|
||||
|
@ -178,6 +178,7 @@ struct _drcbe_state
|
||||
UINT32 * last_upper_addr; /* address where we last stored an upper register */
|
||||
double fptemp; /* temporary storage for floating point */
|
||||
|
||||
data_accessors accessors[ADDRESS_SPACES]; /* memory accessors */
|
||||
const address_space * space[ADDRESS_SPACES]; /* address spaces */
|
||||
|
||||
UINT8 sse3; /* do we have SSE3 support? */
|
||||
@ -629,9 +630,13 @@ static drcbe_state *drcbex86_alloc(drcuml_state *drcuml, drccache *cache, runnin
|
||||
drcbe->drcuml = drcuml;
|
||||
drcbe->cache = cache;
|
||||
|
||||
/* get address spaces */
|
||||
/* get address spaces and accessors */
|
||||
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
|
||||
{
|
||||
drcbe->space[spacenum] = downcast<cpu_device *>(device)->space(spacenum);
|
||||
if (drcbe->space[spacenum] != NULL)
|
||||
drcbe->space[spacenum]->accessors(drcbe->accessors[spacenum]);
|
||||
}
|
||||
|
||||
/* allocate hash tables */
|
||||
drcbe->hash = drchash_alloc(cache, modes, addrbits, ignorebits);
|
||||
@ -4262,25 +4267,25 @@ static x86code *op_read(drcbe_state *drcbe, x86code *dst, const drcuml_instructi
|
||||
emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (UINT32)drcbe->space[spacesizep.value / 16]);// mov [esp],space
|
||||
if ((spacesizep.value & 3) == DRCUML_SIZE_BYTE)
|
||||
{
|
||||
emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.read_byte);
|
||||
emit_call(&dst, (x86code *)drcbe->accessors[spacesizep.value / 16].read_byte);
|
||||
// call read_byte
|
||||
emit_movzx_r32_r8(&dst, dstreg, REG_AL); // movzx dstreg,al
|
||||
}
|
||||
else if ((spacesizep.value & 3) == DRCUML_SIZE_WORD)
|
||||
{
|
||||
emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.read_word);
|
||||
emit_call(&dst, (x86code *)drcbe->accessors[spacesizep.value / 16].read_word);
|
||||
// call read_word
|
||||
emit_movzx_r32_r16(&dst, dstreg, REG_AX); // movzx dstreg,ax
|
||||
}
|
||||
else if ((spacesizep.value & 3) == DRCUML_SIZE_DWORD)
|
||||
{
|
||||
emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.read_dword);
|
||||
emit_call(&dst, (x86code *)drcbe->accessors[spacesizep.value / 16].read_dword);
|
||||
// call read_dword
|
||||
emit_mov_r32_r32(&dst, dstreg, REG_EAX); // mov dstreg,eax
|
||||
}
|
||||
else if ((spacesizep.value & 3) == DRCUML_SIZE_QWORD)
|
||||
{
|
||||
emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.read_qword);
|
||||
emit_call(&dst, (x86code *)drcbe->accessors[spacesizep.value / 16].read_qword);
|
||||
// call read_qword
|
||||
emit_mov_r32_r32(&dst, dstreg, REG_EAX); // mov dstreg,eax
|
||||
}
|
||||
@ -4342,19 +4347,19 @@ static x86code *op_readm(drcbe_state *drcbe, x86code *dst, const drcuml_instruct
|
||||
emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (UINT32)drcbe->space[spacesizep.value / 16]);// mov [esp],space
|
||||
if ((spacesizep.value & 3) == DRCUML_SIZE_WORD)
|
||||
{
|
||||
emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.read_word_masked);
|
||||
emit_call(&dst, (x86code *)drcbe->accessors[spacesizep.value / 16].read_word_masked);
|
||||
// call read_word_masked
|
||||
emit_movzx_r32_r16(&dst, dstreg, REG_AX); // movzx dstreg,ax
|
||||
}
|
||||
else if ((spacesizep.value & 3) == DRCUML_SIZE_DWORD)
|
||||
{
|
||||
emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.read_dword_masked);
|
||||
emit_call(&dst, (x86code *)drcbe->accessors[spacesizep.value / 16].read_dword_masked);
|
||||
// call read_dword_masked
|
||||
emit_mov_r32_r32(&dst, dstreg, REG_EAX); // mov dstreg,eax
|
||||
}
|
||||
else if ((spacesizep.value & 3) == DRCUML_SIZE_QWORD)
|
||||
{
|
||||
emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.read_qword_masked);
|
||||
emit_call(&dst, (x86code *)drcbe->accessors[spacesizep.value / 16].read_qword_masked);
|
||||
// call read_qword_masked
|
||||
emit_mov_r32_r32(&dst, dstreg, REG_EAX); // mov dstreg,eax
|
||||
}
|
||||
@ -4411,16 +4416,16 @@ static x86code *op_write(drcbe_state *drcbe, x86code *dst, const drcuml_instruct
|
||||
emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 4), &addrp); // mov [esp+4],addrp
|
||||
emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (UINT32)drcbe->space[spacesizep.value / 16]);// mov [esp],space
|
||||
if ((spacesizep.value & 3) == DRCUML_SIZE_BYTE)
|
||||
emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.write_byte);
|
||||
emit_call(&dst, (x86code *)drcbe->accessors[spacesizep.value / 16].write_byte);
|
||||
// call write_byte
|
||||
else if ((spacesizep.value & 3) == DRCUML_SIZE_WORD)
|
||||
emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.write_word);
|
||||
emit_call(&dst, (x86code *)drcbe->accessors[spacesizep.value / 16].write_word);
|
||||
// call write_word
|
||||
else if ((spacesizep.value & 3) == DRCUML_SIZE_DWORD)
|
||||
emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.write_dword);
|
||||
emit_call(&dst, (x86code *)drcbe->accessors[spacesizep.value / 16].write_dword);
|
||||
// call write_dword
|
||||
else if ((spacesizep.value & 3) == DRCUML_SIZE_QWORD)
|
||||
emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.write_qword);
|
||||
emit_call(&dst, (x86code *)drcbe->accessors[spacesizep.value / 16].write_qword);
|
||||
// call write_qword
|
||||
return dst;
|
||||
}
|
||||
@ -4456,13 +4461,13 @@ static x86code *op_writem(drcbe_state *drcbe, x86code *dst, const drcuml_instruc
|
||||
emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 4), &addrp); // mov [esp+4],addrp
|
||||
emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (UINT32)drcbe->space[spacesizep.value / 16]);// mov [esp],space
|
||||
if ((spacesizep.value & 3) == DRCUML_SIZE_WORD)
|
||||
emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.write_word_masked);
|
||||
emit_call(&dst, (x86code *)drcbe->accessors[spacesizep.value / 16].write_word_masked);
|
||||
// call write_word_masked
|
||||
else if ((spacesizep.value & 3) == DRCUML_SIZE_DWORD)
|
||||
emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.write_dword_masked);
|
||||
emit_call(&dst, (x86code *)drcbe->accessors[spacesizep.value / 16].write_dword_masked);
|
||||
// call write_dword_masked
|
||||
else if ((spacesizep.value & 3) == DRCUML_SIZE_QWORD)
|
||||
emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.write_qword_masked);
|
||||
emit_call(&dst, (x86code *)drcbe->accessors[spacesizep.value / 16].write_qword_masked);
|
||||
// call write_qword_masked
|
||||
return dst;
|
||||
}
|
||||
@ -6411,9 +6416,9 @@ static x86code *op_fread(drcbe_state *drcbe, x86code *dst, const drcuml_instruct
|
||||
emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 4), &addrp); // mov [esp+4],addrp
|
||||
emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (UINT32)drcbe->space[spacep.value]); // mov [esp],space
|
||||
if (inst->size == 4)
|
||||
emit_call(&dst, (x86code *)drcbe->space[spacep.value]->accessors.read_dword); // call read_dword
|
||||
emit_call(&dst, (x86code *)drcbe->accessors[spacep.value].read_dword); // call read_dword
|
||||
else if (inst->size == 8)
|
||||
emit_call(&dst, (x86code *)drcbe->space[spacep.value]->accessors.read_qword); // call read_qword
|
||||
emit_call(&dst, (x86code *)drcbe->accessors[spacep.value].read_qword); // call read_qword
|
||||
|
||||
/* store result */
|
||||
if (inst->size == 4)
|
||||
@ -6449,9 +6454,9 @@ static x86code *op_fwrite(drcbe_state *drcbe, x86code *dst, const drcuml_instruc
|
||||
emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 4), &addrp); // mov [esp+4],addrp
|
||||
emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (UINT32)drcbe->space[spacep.value]); // mov [esp],space
|
||||
if (inst->size == 4)
|
||||
emit_call(&dst, (x86code *)drcbe->space[spacep.value]->accessors.write_dword); // call write_dword
|
||||
emit_call(&dst, (x86code *)drcbe->accessors[spacep.value].write_dword); // call write_dword
|
||||
else if (inst->size == 8)
|
||||
emit_call(&dst, (x86code *)drcbe->space[spacep.value]->accessors.write_qword); // call write_qword
|
||||
emit_call(&dst, (x86code *)drcbe->accessors[spacep.value].write_qword); // call write_qword
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
@ -67,12 +67,12 @@ static CPU_RESET( dsp56k );
|
||||
/***************************************************************************
|
||||
Direct Update Handler
|
||||
***************************************************************************/
|
||||
static DIRECT_UPDATE_HANDLER( dsp56k_direct_handler )
|
||||
DIRECT_UPDATE_HANDLER( dsp56k_direct_handler )
|
||||
{
|
||||
if (address >= (0x0000<<1) && address <= (0x07ff<<1))
|
||||
{
|
||||
dsp56k_core* cpustate = get_safe_token(space->cpu);
|
||||
direct->raw = direct->decrypted = (UINT8 *)(cpustate->program_ram - (0x0000<<1));
|
||||
dsp56k_core* cpustate = get_safe_token(direct.space().cpu);
|
||||
direct.explicit_configure(0x0000<<1, 0x07ff<<1, 0x07ff<<1, cpustate->program_ram);
|
||||
return ~0;
|
||||
}
|
||||
|
||||
@ -237,7 +237,7 @@ static CPU_INIT( dsp56k )
|
||||
|
||||
/* Setup the direct memory handler for this CPU */
|
||||
/* NOTE: Be sure to grab this guy and call him if you ever install another direct_update_hander in a driver! */
|
||||
memory_set_direct_update_handler(cpustate->program, dsp56k_direct_handler);
|
||||
const_cast<address_space *>(cpustate->program)->set_direct_update_handler(direct_update_delegate_create_static(dsp56k_direct_handler, *device->machine));
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,7 +98,7 @@ void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, legacy
|
||||
}
|
||||
|
||||
/* set up the endianness */
|
||||
mips->memory = mips->program->accessors;
|
||||
mips->program->accessors(mips->memory);
|
||||
|
||||
/* allocate the virtual TLB */
|
||||
mips->vtlb = vtlb_alloc(device, ADDRESS_SPACE_PROGRAM, 2 * mips->tlbentries + 2, 0);
|
||||
|
@ -150,7 +150,7 @@ struct _r3000_state
|
||||
/* memory accesses */
|
||||
UINT8 bigendian;
|
||||
data_accessors cur;
|
||||
const data_accessors *memory_hand;
|
||||
data_accessors memory_hand;
|
||||
const data_accessors *cache_hand;
|
||||
|
||||
/* cache memory */
|
||||
@ -319,9 +319,9 @@ static void r3000_reset(r3000_state *r3000, int bigendian)
|
||||
{
|
||||
/* set up the endianness */
|
||||
r3000->bigendian = bigendian;
|
||||
r3000->program->accessors(r3000->memory_hand);
|
||||
if (r3000->bigendian)
|
||||
{
|
||||
r3000->memory_hand = &r3000->program->accessors;
|
||||
r3000->cache_hand = &be_cache;
|
||||
r3000->lwl = lwl_be;
|
||||
r3000->lwr = lwr_be;
|
||||
@ -330,7 +330,6 @@ static void r3000_reset(r3000_state *r3000, int bigendian)
|
||||
}
|
||||
else
|
||||
{
|
||||
r3000->memory_hand = &r3000->program->accessors;
|
||||
r3000->cache_hand = &le_cache;
|
||||
r3000->lwl = lwl_le;
|
||||
r3000->lwr = lwr_le;
|
||||
@ -339,7 +338,7 @@ static void r3000_reset(r3000_state *r3000, int bigendian)
|
||||
}
|
||||
|
||||
/* initialize the rest of the config */
|
||||
r3000->cur = *r3000->memory_hand;
|
||||
r3000->cur = r3000->memory_hand;
|
||||
r3000->cache = r3000->dcache;
|
||||
r3000->cache_size = r3000->dcache_size;
|
||||
|
||||
@ -396,7 +395,7 @@ INLINE void set_cop0_reg(r3000_state *r3000, int idx, UINT32 val)
|
||||
if (val & SR_IsC)
|
||||
r3000->cur = *r3000->cache_hand;
|
||||
else
|
||||
r3000->cur = *r3000->memory_hand;
|
||||
r3000->cur = r3000->memory_hand;
|
||||
}
|
||||
|
||||
/* handle cache switching */
|
||||
|
@ -1438,14 +1438,14 @@ static void execute_wplist(running_machine *machine, int ref, int params, const
|
||||
{
|
||||
static const char *const types[] = { "unkn ", "read ", "write", "r/w " };
|
||||
|
||||
debug_console_printf(machine, "Device '%s' %s space watchpoints:\n", device->tag(), device->debug()->watchpoint_first(spacenum)->space().name);
|
||||
debug_console_printf(machine, "Device '%s' %s space watchpoints:\n", device->tag(), device->debug()->watchpoint_first(spacenum)->space().name());
|
||||
|
||||
/* loop over the watchpoints */
|
||||
for (device_debug::watchpoint *wp = device->debug()->watchpoint_first(spacenum); wp != NULL; wp = wp->next())
|
||||
{
|
||||
buffer.printf("%c%4X @ %s-%s %s", wp->enabled() ? ' ' : 'D', wp->index(),
|
||||
core_i64_hex_format(memory_byte_to_address(&wp->space(), wp->address()), wp->space().addrchars),
|
||||
core_i64_hex_format(memory_byte_to_address_end(&wp->space(), wp->address() + wp->length()) - 1, wp->space().addrchars),
|
||||
core_i64_hex_format(wp->space().byte_to_address(wp->address()), wp->space().addrchars()),
|
||||
core_i64_hex_format(wp->space().byte_to_address_end(wp->address() + wp->length()) - 1, wp->space().addrchars()),
|
||||
types[wp->type() & 3]);
|
||||
if (wp->condition() != NULL)
|
||||
buffer.catprintf(" if %s", wp->condition());
|
||||
@ -1524,8 +1524,8 @@ static void execute_save(running_machine *machine, int ref, int params, const ch
|
||||
return;
|
||||
|
||||
/* determine the addresses to write */
|
||||
endoffset = memory_address_to_byte(space, offset + length - 1) & space->bytemask;
|
||||
offset = memory_address_to_byte(space, offset) & space->bytemask;
|
||||
endoffset = space->address_to_byte(offset + length - 1) & space->bytemask();
|
||||
offset = space->address_to_byte(offset) & space->bytemask();
|
||||
|
||||
/* open the file */
|
||||
f = fopen(param[0], "wb");
|
||||
@ -1573,16 +1573,16 @@ static void execute_dump(running_machine *machine, int ref, int params, const ch
|
||||
|
||||
/* further validation */
|
||||
if (width == 0)
|
||||
width = space->dbits / 8;
|
||||
if (width < memory_address_to_byte(space, 1))
|
||||
width = memory_address_to_byte(space, 1);
|
||||
width = space->data_width() / 8;
|
||||
if (width < space->address_to_byte(1))
|
||||
width = space->address_to_byte(1);
|
||||
if (width != 1 && width != 2 && width != 4 && width != 8)
|
||||
{
|
||||
debug_console_printf(machine, "Invalid width! (must be 1,2,4 or 8)\n");
|
||||
return;
|
||||
}
|
||||
endoffset = memory_address_to_byte(space, offset + length - 1) & space->bytemask;
|
||||
offset = memory_address_to_byte(space, offset) & space->bytemask;
|
||||
endoffset = space->address_to_byte(offset + length - 1) & space->bytemask();
|
||||
offset = space->address_to_byte(offset) & space->bytemask();
|
||||
|
||||
/* open the file */
|
||||
f = fopen(param[0], "w");
|
||||
@ -1599,7 +1599,7 @@ static void execute_dump(running_machine *machine, int ref, int params, const ch
|
||||
int outdex = 0;
|
||||
|
||||
/* print the address */
|
||||
outdex += sprintf(&output[outdex], "%s: ", core_i64_hex_format((UINT32)memory_byte_to_address(space, i), space->logaddrchars));
|
||||
outdex += sprintf(&output[outdex], "%s: ", core_i64_hex_format((UINT32)space->byte_to_address(i), space->logaddrchars()));
|
||||
|
||||
/* print the bytes */
|
||||
for (j = 0; j < 16; j += width)
|
||||
@ -1711,19 +1711,19 @@ static void execute_cheatinit(running_machine *machine, int ref, int params, con
|
||||
if (params <= 1)
|
||||
{
|
||||
offset = 0;
|
||||
length = space->bytemask + 1;
|
||||
for (entry = space->map->m_entrylist; entry != NULL; entry = entry->m_next)
|
||||
length = space->bytemask() + 1;
|
||||
for (entry = space->map()->m_entrylist.first(); entry != NULL; entry = entry->next())
|
||||
{
|
||||
cheat_region[region_count].offset = memory_address_to_byte(space, entry->m_addrstart) & space->bytemask;
|
||||
cheat_region[region_count].endoffset = memory_address_to_byte(space, entry->m_addrend) & space->bytemask;
|
||||
cheat_region[region_count].offset = space->address_to_byte(entry->m_addrstart) & space->bytemask();
|
||||
cheat_region[region_count].endoffset = space->address_to_byte(entry->m_addrend) & space->bytemask();
|
||||
cheat_region[region_count].share = entry->m_share;
|
||||
cheat_region[region_count].disabled = (entry->m_write.type == AMH_RAM) ? FALSE : TRUE;
|
||||
cheat_region[region_count].disabled = (entry->m_write.m_type == AMH_RAM) ? FALSE : TRUE;
|
||||
|
||||
/* disable double share regions */
|
||||
if (entry->m_share != NULL)
|
||||
for (i = 0; i < region_count; i++)
|
||||
if (cheat_region[i].share != NULL)
|
||||
if (strcmp(cheat_region[i].share, entry->m_share)==0)
|
||||
if (strcmp(cheat_region[i].share, entry->m_share) == 0)
|
||||
cheat_region[region_count].disabled = TRUE;
|
||||
|
||||
region_count++;
|
||||
@ -1738,8 +1738,8 @@ static void execute_cheatinit(running_machine *machine, int ref, int params, con
|
||||
return;
|
||||
|
||||
/* force region to the specified range */
|
||||
cheat_region[region_count].offset = memory_address_to_byte(space, offset) & space->bytemask;;
|
||||
cheat_region[region_count].endoffset = memory_address_to_byte(space, offset + length - 1) & space->bytemask;;
|
||||
cheat_region[region_count].offset = space->address_to_byte(offset) & space->bytemask();
|
||||
cheat_region[region_count].endoffset = space->address_to_byte(offset + length - 1) & space->bytemask();
|
||||
cheat_region[region_count].share = NULL;
|
||||
cheat_region[region_count].disabled = FALSE;
|
||||
region_count++;
|
||||
@ -2000,7 +2000,7 @@ static void execute_cheatlist(running_machine *machine, int ref, int params, con
|
||||
if (params > 0)
|
||||
f = fopen(param[0], "w");
|
||||
|
||||
switch (space->spacenum)
|
||||
switch (space->spacenum())
|
||||
{
|
||||
default:
|
||||
case ADDRESS_SPACE_PROGRAM: spaceletter = 'p'; break;
|
||||
@ -2023,19 +2023,19 @@ static void execute_cheatlist(running_machine *machine, int ref, int params, con
|
||||
if (cheat.cheatmap[cheatindex].state == 1)
|
||||
{
|
||||
UINT64 value = cheat_byte_swap(&cheat, cheat_read_extended(&cheat, space, cheat.cheatmap[cheatindex].offset)) & sizemask;
|
||||
offs_t address = memory_byte_to_address(space, cheat.cheatmap[cheatindex].offset);
|
||||
offs_t address = space->byte_to_address(cheat.cheatmap[cheatindex].offset);
|
||||
|
||||
if (params > 0)
|
||||
{
|
||||
active_cheat++;
|
||||
fprintf(f, " <cheat desc=\"Possibility %d : %s (%s)\">\n", active_cheat, core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(value, cheat.width * 2));
|
||||
fprintf(f, " <cheat desc=\"Possibility %d : %s (%s)\">\n", active_cheat, core_i64_hex_format(address, space->logaddrchars()), core_i64_hex_format(value, cheat.width * 2));
|
||||
fprintf(f, " <script state=\"run\">\n");
|
||||
fprintf(f, " <action>%s.p%c%c@%s=%s</action>\n", cpu->tag(), spaceletter, sizeletter, core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(cheat_byte_swap(&cheat, cheat.cheatmap[cheatindex].first_value) & sizemask, cheat.width * 2));
|
||||
fprintf(f, " <action>%s.p%c%c@%s=%s</action>\n", cpu->tag(), spaceletter, sizeletter, core_i64_hex_format(address, space->logaddrchars()), core_i64_hex_format(cheat_byte_swap(&cheat, cheat.cheatmap[cheatindex].first_value) & sizemask, cheat.width * 2));
|
||||
fprintf(f, " </script>\n");
|
||||
fprintf(f, " </cheat>\n\n");
|
||||
}
|
||||
else
|
||||
debug_console_printf(machine, "Address=%s Start=%s Current=%s\n", core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(cheat_byte_swap(&cheat, cheat.cheatmap[cheatindex].first_value) & sizemask, cheat.width * 2), core_i64_hex_format(value, cheat.width * 2));
|
||||
debug_console_printf(machine, "Address=%s Start=%s Current=%s\n", core_i64_hex_format(address, space->logaddrchars()), core_i64_hex_format(cheat_byte_swap(&cheat, cheat.cheatmap[cheatindex].first_value) & sizemask, cheat.width * 2), core_i64_hex_format(value, cheat.width * 2));
|
||||
}
|
||||
}
|
||||
if (params > 0)
|
||||
@ -2096,9 +2096,9 @@ static void execute_find(running_machine *machine, int ref, int params, const ch
|
||||
return;
|
||||
|
||||
/* further validation */
|
||||
endoffset = memory_address_to_byte(space, offset + length - 1) & space->bytemask;
|
||||
offset = memory_address_to_byte(space, offset) & space->bytemask;
|
||||
cur_data_size = memory_address_to_byte(space, 1);
|
||||
endoffset = space->address_to_byte(offset + length - 1) & space->bytemask();
|
||||
offset = space->address_to_byte(offset) & space->bytemask();
|
||||
cur_data_size = space->address_to_byte(1);
|
||||
if (cur_data_size == 0)
|
||||
cur_data_size = 1;
|
||||
|
||||
@ -2161,7 +2161,7 @@ static void execute_find(running_machine *machine, int ref, int params, const ch
|
||||
if (match)
|
||||
{
|
||||
found++;
|
||||
debug_console_printf(machine, "Found at %s\n", core_i64_hex_format((UINT32)memory_byte_to_address(space, i), space->addrchars));
|
||||
debug_console_printf(machine, "Found at %s\n", core_i64_hex_format((UINT32)space->byte_to_address(i), space->addrchars()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2215,7 +2215,7 @@ static void execute_dasm(running_machine *machine, int ref, int params, const ch
|
||||
/* now write the data out */
|
||||
for (i = 0; i < length; )
|
||||
{
|
||||
int pcbyte = memory_address_to_byte(space, offset + i) & space->bytemask;
|
||||
int pcbyte = space->address_to_byte(offset + i) & space->bytemask();
|
||||
char output[200+DEBUG_COMMENT_MAX_LINE_LENGTH], disasm[200];
|
||||
const char *comment;
|
||||
offs_t tempaddr;
|
||||
@ -2223,7 +2223,7 @@ static void execute_dasm(running_machine *machine, int ref, int params, const ch
|
||||
int numbytes = 0;
|
||||
|
||||
/* print the address */
|
||||
outdex += sprintf(&output[outdex], "%s: ", core_i64_hex_format((UINT32)memory_byte_to_address(space, pcbyte), space->logaddrchars));
|
||||
outdex += sprintf(&output[outdex], "%s: ", core_i64_hex_format((UINT32)space->byte_to_address(pcbyte), space->logaddrchars()));
|
||||
|
||||
/* make sure we can translate the address */
|
||||
tempaddr = pcbyte;
|
||||
@ -2246,7 +2246,7 @@ static void execute_dasm(running_machine *machine, int ref, int params, const ch
|
||||
if (bytes)
|
||||
{
|
||||
int startdex = outdex;
|
||||
numbytes = memory_address_to_byte(space, numbytes);
|
||||
numbytes = space->address_to_byte(numbytes);
|
||||
for (j = 0; j < numbytes; j += minbytes)
|
||||
outdex += sprintf(&output[outdex], "%s ", core_i64_hex_format(debug_read_opcode(space, pcbyte + j, minbytes, FALSE), minbytes * 2));
|
||||
if (outdex - startdex < byteswidth)
|
||||
@ -2394,7 +2394,7 @@ static void execute_history(running_machine *machine, int ref, int params, const
|
||||
offs_t pc = debug->history_pc(-index);
|
||||
|
||||
/* fetch the bytes up to the maximum */
|
||||
offs_t pcbyte = memory_address_to_byte(space, pc) & space->bytemask;
|
||||
offs_t pcbyte = space->address_to_byte(pc) & space->bytemask();
|
||||
UINT8 opbuf[64], argbuf[64];
|
||||
for (int numbytes = 0; numbytes < maxbytes; numbytes++)
|
||||
{
|
||||
@ -2405,7 +2405,7 @@ static void execute_history(running_machine *machine, int ref, int params, const
|
||||
char buffer[200];
|
||||
debug->disassemble(buffer, pc, opbuf, argbuf);
|
||||
|
||||
debug_console_printf(machine, "%s: %s\n", core_i64_hex_format(pc, space->logaddrchars), buffer);
|
||||
debug_console_printf(machine, "%s: %s\n", core_i64_hex_format(pc, space->logaddrchars()), buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2490,14 +2490,14 @@ static void execute_map(running_machine *machine, int ref, int params, const cha
|
||||
for (intention = TRANSLATE_READ_DEBUG; intention <= TRANSLATE_FETCH_DEBUG; intention++)
|
||||
{
|
||||
static const char *const intnames[] = { "Read", "Write", "Fetch" };
|
||||
taddress = memory_address_to_byte(space, address) & space->bytemask;
|
||||
taddress = space->address_to_byte(address) & space->bytemask();
|
||||
if (debug_cpu_translate(space, intention, &taddress))
|
||||
{
|
||||
const char *mapname = memory_get_handler_string(space, intention == TRANSLATE_WRITE_DEBUG, taddress);
|
||||
debug_console_printf(machine, "%7s: %s logical == %s physical -> %s\n", intnames[intention & 3], core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(memory_byte_to_address(space, taddress), space->addrchars), mapname);
|
||||
const char *mapname = const_cast<address_space *>(space)->get_handler_string((intention == TRANSLATE_WRITE_DEBUG) ? ROW_WRITE : ROW_READ, taddress);
|
||||
debug_console_printf(machine, "%7s: %s logical == %s physical -> %s\n", intnames[intention & 3], core_i64_hex_format(address, space->logaddrchars()), core_i64_hex_format(space->byte_to_address(taddress), space->addrchars()), mapname);
|
||||
}
|
||||
else
|
||||
debug_console_printf(machine, "%7s: %s logical is unmapped\n", intnames[intention & 3], core_i64_hex_format(address, space->logaddrchars));
|
||||
debug_console_printf(machine, "%7s: %s logical is unmapped\n", intnames[intention & 3], core_i64_hex_format(address, space->logaddrchars()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -289,7 +289,7 @@ UINT32 debug_comment_get_opcode_crc32(device_t *device, offs_t address)
|
||||
offs_t numbytes;
|
||||
cpu_device *cpudevice = downcast<cpu_device *>(device);
|
||||
int maxbytes = cpudevice->max_opcode_bytes();
|
||||
UINT32 addrmask = space->logaddrmask;
|
||||
UINT32 addrmask = space->logaddrmask();
|
||||
|
||||
memset(opbuf, 0x00, sizeof(opbuf));
|
||||
memset(argbuf, 0x00, sizeof(argbuf));
|
||||
@ -302,7 +302,7 @@ UINT32 debug_comment_get_opcode_crc32(device_t *device, offs_t address)
|
||||
}
|
||||
|
||||
numbytes = device->debug()->disassemble(buff, address & addrmask, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
|
||||
numbytes = memory_address_to_byte(space, numbytes);
|
||||
numbytes = space->address_to_byte(numbytes);
|
||||
|
||||
crc = crc32(0, argbuf, numbytes);
|
||||
|
||||
|
@ -81,10 +81,10 @@ struct _debugcpu_private
|
||||
|
||||
symbol_table * symtable; /* global symbol table */
|
||||
|
||||
UINT8 within_instruction_hook;
|
||||
UINT8 vblank_occurred;
|
||||
UINT8 memory_modified;
|
||||
UINT8 debugger_access;
|
||||
bool within_instruction_hook;
|
||||
bool vblank_occurred;
|
||||
bool memory_modified;
|
||||
bool debugger_access;
|
||||
|
||||
int execution_state;
|
||||
|
||||
@ -243,14 +243,14 @@ int debug_cpu_within_instruction_hook(running_machine *machine)
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
debug_cpu_is_stopped - return TRUE if the
|
||||
debug_cpu_is_stopped - return true if the
|
||||
current execution state is stopped
|
||||
-------------------------------------------------*/
|
||||
|
||||
int debug_cpu_is_stopped(running_machine *machine)
|
||||
{
|
||||
debugcpu_private *global = machine->debugcpu_data;
|
||||
return (global != NULL) ? (global->execution_state == EXECUTION_STATE_STOPPED) : FALSE;
|
||||
return (global != NULL) ? (global->execution_state == EXECUTION_STATE_STOPPED) : false;
|
||||
}
|
||||
|
||||
|
||||
@ -327,8 +327,8 @@ int debug_cpu_translate(const address_space *space, int intention, offs_t *addre
|
||||
{
|
||||
device_memory_interface *memory;
|
||||
if (space->cpu->interface(memory))
|
||||
return memory->translate(space->spacenum, intention, *address);
|
||||
return TRUE;
|
||||
return memory->translate(space->spacenum(), intention, *address);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -341,32 +341,33 @@ int debug_cpu_translate(const address_space *space, int intention, offs_t *addre
|
||||
the specified memory space
|
||||
-------------------------------------------------*/
|
||||
|
||||
UINT8 debug_read_byte(const address_space *space, offs_t address, int apply_translation)
|
||||
UINT8 debug_read_byte(const address_space *_space, offs_t address, int apply_translation)
|
||||
{
|
||||
address_space *space = const_cast<address_space *>(_space);
|
||||
debugcpu_private *global = space->machine->debugcpu_data;
|
||||
UINT64 custom;
|
||||
UINT8 result;
|
||||
|
||||
/* mask against the logical byte mask */
|
||||
address &= space->logbytemask;
|
||||
address &= space->logbytemask();
|
||||
|
||||
/* all accesses from this point on are for the debugger */
|
||||
memory_set_debugger_access(space, global->debugger_access = TRUE);
|
||||
space->set_debugger_access(global->debugger_access = true);
|
||||
|
||||
/* translate if necessary; if not mapped, return 0xff */
|
||||
if (apply_translation && !debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
result = 0xff;
|
||||
|
||||
/* if there is a custom read handler, and it returns TRUE, use that value */
|
||||
else if (device_memory(space->cpu)->read(space->spacenum, address, 1, custom))
|
||||
/* if there is a custom read handler, and it returns true, use that value */
|
||||
else if (device_memory(space->cpu)->read(space->spacenum(), address, 1, custom))
|
||||
result = custom;
|
||||
|
||||
/* otherwise, call the byte reading function for the translated address */
|
||||
else
|
||||
result = memory_read_byte(space, address);
|
||||
result = space->read_byte(address);
|
||||
|
||||
/* no longer accessing via the debugger */
|
||||
memory_set_debugger_access(space, global->debugger_access = FALSE);
|
||||
space->set_debugger_access(global->debugger_access = false);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -376,13 +377,14 @@ UINT8 debug_read_byte(const address_space *space, offs_t address, int apply_tran
|
||||
specified memory space
|
||||
-------------------------------------------------*/
|
||||
|
||||
UINT16 debug_read_word(const address_space *space, offs_t address, int apply_translation)
|
||||
UINT16 debug_read_word(const address_space *_space, offs_t address, int apply_translation)
|
||||
{
|
||||
address_space *space = const_cast<address_space *>(_space);
|
||||
debugcpu_private *global = space->machine->debugcpu_data;
|
||||
UINT16 result;
|
||||
|
||||
/* mask against the logical byte mask */
|
||||
address &= space->logbytemask;
|
||||
address &= space->logbytemask();
|
||||
|
||||
/* if this is misaligned read, or if there are no word readers, just read two bytes */
|
||||
if ((address & 1) != 0)
|
||||
@ -391,7 +393,7 @@ UINT16 debug_read_word(const address_space *space, offs_t address, int apply_tra
|
||||
UINT8 byte1 = debug_read_byte(space, address + 1, apply_translation);
|
||||
|
||||
/* based on the endianness, the result is assembled differently */
|
||||
if (space->endianness == ENDIANNESS_LITTLE)
|
||||
if (space->endianness() == ENDIANNESS_LITTLE)
|
||||
result = byte0 | (byte1 << 8);
|
||||
else
|
||||
result = byte1 | (byte0 << 8);
|
||||
@ -403,22 +405,22 @@ UINT16 debug_read_word(const address_space *space, offs_t address, int apply_tra
|
||||
UINT64 custom;
|
||||
|
||||
/* all accesses from this point on are for the debugger */
|
||||
memory_set_debugger_access(space, global->debugger_access = TRUE);
|
||||
space->set_debugger_access(global->debugger_access = true);
|
||||
|
||||
/* translate if necessary; if not mapped, return 0xffff */
|
||||
if (apply_translation && !debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
result = 0xffff;
|
||||
|
||||
/* if there is a custom read handler, and it returns TRUE, use that value */
|
||||
else if (device_memory(space->cpu)->read(space->spacenum, address, 2, custom))
|
||||
/* if there is a custom read handler, and it returns true, use that value */
|
||||
else if (device_memory(space->cpu)->read(space->spacenum(), address, 2, custom))
|
||||
result = custom;
|
||||
|
||||
/* otherwise, call the byte reading function for the translated address */
|
||||
else
|
||||
result = memory_read_word(space, address);
|
||||
result = space->read_word(address);
|
||||
|
||||
/* no longer accessing via the debugger */
|
||||
memory_set_debugger_access(space, global->debugger_access = FALSE);
|
||||
space->set_debugger_access(global->debugger_access = false);
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -430,13 +432,14 @@ UINT16 debug_read_word(const address_space *space, offs_t address, int apply_tra
|
||||
specified memory space
|
||||
-------------------------------------------------*/
|
||||
|
||||
UINT32 debug_read_dword(const address_space *space, offs_t address, int apply_translation)
|
||||
UINT32 debug_read_dword(const address_space *_space, offs_t address, int apply_translation)
|
||||
{
|
||||
address_space *space = const_cast<address_space *>(_space);
|
||||
debugcpu_private *global = space->machine->debugcpu_data;
|
||||
UINT32 result;
|
||||
|
||||
/* mask against the logical byte mask */
|
||||
address &= space->logbytemask;
|
||||
address &= space->logbytemask();
|
||||
|
||||
/* if this is misaligned read, or if there are no dword readers, just read two words */
|
||||
if ((address & 3) != 0)
|
||||
@ -445,7 +448,7 @@ UINT32 debug_read_dword(const address_space *space, offs_t address, int apply_tr
|
||||
UINT16 word1 = debug_read_word(space, address + 2, apply_translation);
|
||||
|
||||
/* based on the endianness, the result is assembled differently */
|
||||
if (space->endianness == ENDIANNESS_LITTLE)
|
||||
if (space->endianness() == ENDIANNESS_LITTLE)
|
||||
result = word0 | (word1 << 16);
|
||||
else
|
||||
result = word1 | (word0 << 16);
|
||||
@ -457,22 +460,22 @@ UINT32 debug_read_dword(const address_space *space, offs_t address, int apply_tr
|
||||
UINT64 custom;
|
||||
|
||||
/* all accesses from this point on are for the debugger */
|
||||
memory_set_debugger_access(space, global->debugger_access = TRUE);
|
||||
space->set_debugger_access(global->debugger_access = true);
|
||||
|
||||
/* translate if necessary; if not mapped, return 0xffffffff */
|
||||
if (apply_translation && !debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
result = 0xffffffff;
|
||||
|
||||
/* if there is a custom read handler, and it returns TRUE, use that value */
|
||||
else if (device_memory(space->cpu)->read(space->spacenum, address, 4, custom))
|
||||
/* if there is a custom read handler, and it returns true, use that value */
|
||||
else if (device_memory(space->cpu)->read(space->spacenum(), address, 4, custom))
|
||||
result = custom;
|
||||
|
||||
/* otherwise, call the byte reading function for the translated address */
|
||||
else
|
||||
result = memory_read_dword(space, address);
|
||||
result = space->read_dword(address);
|
||||
|
||||
/* no longer accessing via the debugger */
|
||||
memory_set_debugger_access(space, global->debugger_access = FALSE);
|
||||
space->set_debugger_access(global->debugger_access = false);
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -484,13 +487,14 @@ UINT32 debug_read_dword(const address_space *space, offs_t address, int apply_tr
|
||||
specified memory space
|
||||
-------------------------------------------------*/
|
||||
|
||||
UINT64 debug_read_qword(const address_space *space, offs_t address, int apply_translation)
|
||||
UINT64 debug_read_qword(const address_space *_space, offs_t address, int apply_translation)
|
||||
{
|
||||
address_space *space = const_cast<address_space *>(_space);
|
||||
debugcpu_private *global = space->machine->debugcpu_data;
|
||||
UINT64 result;
|
||||
|
||||
/* mask against the logical byte mask */
|
||||
address &= space->logbytemask;
|
||||
address &= space->logbytemask();
|
||||
|
||||
/* if this is misaligned read, or if there are no qword readers, just read two dwords */
|
||||
if ((address & 7) != 0)
|
||||
@ -499,7 +503,7 @@ UINT64 debug_read_qword(const address_space *space, offs_t address, int apply_tr
|
||||
UINT32 dword1 = debug_read_dword(space, address + 4, apply_translation);
|
||||
|
||||
/* based on the endianness, the result is assembled differently */
|
||||
if (space->endianness == ENDIANNESS_LITTLE)
|
||||
if (space->endianness() == ENDIANNESS_LITTLE)
|
||||
result = dword0 | ((UINT64)dword1 << 32);
|
||||
else
|
||||
result = dword1 | ((UINT64)dword0 << 32);
|
||||
@ -511,22 +515,22 @@ UINT64 debug_read_qword(const address_space *space, offs_t address, int apply_tr
|
||||
UINT64 custom;
|
||||
|
||||
/* all accesses from this point on are for the debugger */
|
||||
memory_set_debugger_access(space, global->debugger_access = TRUE);
|
||||
space->set_debugger_access(global->debugger_access = true);
|
||||
|
||||
/* translate if necessary; if not mapped, return 0xffffffffffffffff */
|
||||
if (apply_translation && !debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
result = ~(UINT64)0;
|
||||
|
||||
/* if there is a custom read handler, and it returns TRUE, use that value */
|
||||
else if (device_memory(space->cpu)->read(space->spacenum, address, 8, custom))
|
||||
/* if there is a custom read handler, and it returns true, use that value */
|
||||
else if (device_memory(space->cpu)->read(space->spacenum(), address, 8, custom))
|
||||
result = custom;
|
||||
|
||||
/* otherwise, call the byte reading function for the translated address */
|
||||
else
|
||||
result = memory_read_qword(space, address);
|
||||
result = space->read_qword(address);
|
||||
|
||||
/* no longer accessing via the debugger */
|
||||
memory_set_debugger_access(space, global->debugger_access = FALSE);
|
||||
space->set_debugger_access(global->debugger_access = false);
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -557,31 +561,32 @@ UINT64 debug_read_memory(const address_space *space, offs_t address, int size, i
|
||||
specified memory space
|
||||
-------------------------------------------------*/
|
||||
|
||||
void debug_write_byte(const address_space *space, offs_t address, UINT8 data, int apply_translation)
|
||||
void debug_write_byte(const address_space *_space, offs_t address, UINT8 data, int apply_translation)
|
||||
{
|
||||
address_space *space = const_cast<address_space *>(_space);
|
||||
debugcpu_private *global = space->machine->debugcpu_data;
|
||||
|
||||
/* mask against the logical byte mask */
|
||||
address &= space->logbytemask;
|
||||
address &= space->logbytemask();
|
||||
|
||||
/* all accesses from this point on are for the debugger */
|
||||
memory_set_debugger_access(space, global->debugger_access = TRUE);
|
||||
space->set_debugger_access(global->debugger_access = true);
|
||||
|
||||
/* translate if necessary; if not mapped, we're done */
|
||||
if (apply_translation && !debug_cpu_translate(space, TRANSLATE_WRITE_DEBUG, &address))
|
||||
;
|
||||
|
||||
/* if there is a custom write handler, and it returns TRUE, use that */
|
||||
else if (device_memory(space->cpu)->write(space->spacenum, address, 1, data))
|
||||
/* if there is a custom write handler, and it returns true, use that */
|
||||
else if (device_memory(space->cpu)->write(space->spacenum(), address, 1, data))
|
||||
;
|
||||
|
||||
/* otherwise, call the byte reading function for the translated address */
|
||||
else
|
||||
memory_write_byte(space, address, data);
|
||||
space->write_byte(address, data);
|
||||
|
||||
/* no longer accessing via the debugger */
|
||||
memory_set_debugger_access(space, global->debugger_access = FALSE);
|
||||
global->memory_modified = TRUE;
|
||||
space->set_debugger_access(global->debugger_access = false);
|
||||
global->memory_modified = true;
|
||||
}
|
||||
|
||||
|
||||
@ -590,17 +595,18 @@ void debug_write_byte(const address_space *space, offs_t address, UINT8 data, in
|
||||
specified memory space
|
||||
-------------------------------------------------*/
|
||||
|
||||
void debug_write_word(const address_space *space, offs_t address, UINT16 data, int apply_translation)
|
||||
void debug_write_word(const address_space *_space, offs_t address, UINT16 data, int apply_translation)
|
||||
{
|
||||
address_space *space = const_cast<address_space *>(_space);
|
||||
debugcpu_private *global = space->machine->debugcpu_data;
|
||||
|
||||
/* mask against the logical byte mask */
|
||||
address &= space->logbytemask;
|
||||
address &= space->logbytemask();
|
||||
|
||||
/* if this is a misaligned write, or if there are no word writers, just read two bytes */
|
||||
if ((address & 1) != 0)
|
||||
{
|
||||
if (space->endianness == ENDIANNESS_LITTLE)
|
||||
if (space->endianness() == ENDIANNESS_LITTLE)
|
||||
{
|
||||
debug_write_byte(space, address + 0, data >> 0, apply_translation);
|
||||
debug_write_byte(space, address + 1, data >> 8, apply_translation);
|
||||
@ -616,23 +622,23 @@ void debug_write_word(const address_space *space, offs_t address, UINT16 data, i
|
||||
else
|
||||
{
|
||||
/* all accesses from this point on are for the debugger */
|
||||
memory_set_debugger_access(space, global->debugger_access = TRUE);
|
||||
space->set_debugger_access(global->debugger_access = true);
|
||||
|
||||
/* translate if necessary; if not mapped, we're done */
|
||||
if (apply_translation && !debug_cpu_translate(space, TRANSLATE_WRITE_DEBUG, &address))
|
||||
;
|
||||
|
||||
/* if there is a custom write handler, and it returns TRUE, use that */
|
||||
else if (device_memory(space->cpu)->write(space->spacenum, address, 2, data))
|
||||
/* if there is a custom write handler, and it returns true, use that */
|
||||
else if (device_memory(space->cpu)->write(space->spacenum(), address, 2, data))
|
||||
;
|
||||
|
||||
/* otherwise, call the byte reading function for the translated address */
|
||||
else
|
||||
memory_write_word(space, address, data);
|
||||
space->write_word(address, data);
|
||||
|
||||
/* no longer accessing via the debugger */
|
||||
memory_set_debugger_access(space, global->debugger_access = FALSE);
|
||||
global->memory_modified = TRUE;
|
||||
space->set_debugger_access(global->debugger_access = false);
|
||||
global->memory_modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -642,17 +648,18 @@ void debug_write_word(const address_space *space, offs_t address, UINT16 data, i
|
||||
specified memory space
|
||||
-------------------------------------------------*/
|
||||
|
||||
void debug_write_dword(const address_space *space, offs_t address, UINT32 data, int apply_translation)
|
||||
void debug_write_dword(const address_space *_space, offs_t address, UINT32 data, int apply_translation)
|
||||
{
|
||||
address_space *space = const_cast<address_space *>(_space);
|
||||
debugcpu_private *global = space->machine->debugcpu_data;
|
||||
|
||||
/* mask against the logical byte mask */
|
||||
address &= space->logbytemask;
|
||||
address &= space->logbytemask();
|
||||
|
||||
/* if this is a misaligned write, or if there are no dword writers, just read two words */
|
||||
if ((address & 3) != 0)
|
||||
{
|
||||
if (space->endianness == ENDIANNESS_LITTLE)
|
||||
if (space->endianness() == ENDIANNESS_LITTLE)
|
||||
{
|
||||
debug_write_word(space, address + 0, data >> 0, apply_translation);
|
||||
debug_write_word(space, address + 2, data >> 16, apply_translation);
|
||||
@ -668,23 +675,23 @@ void debug_write_dword(const address_space *space, offs_t address, UINT32 data,
|
||||
else
|
||||
{
|
||||
/* all accesses from this point on are for the debugger */
|
||||
memory_set_debugger_access(space, global->debugger_access = TRUE);
|
||||
space->set_debugger_access(global->debugger_access = true);
|
||||
|
||||
/* translate if necessary; if not mapped, we're done */
|
||||
if (apply_translation && !debug_cpu_translate(space, TRANSLATE_WRITE_DEBUG, &address))
|
||||
;
|
||||
|
||||
/* if there is a custom write handler, and it returns TRUE, use that */
|
||||
else if (device_memory(space->cpu)->write(space->spacenum, address, 4, data))
|
||||
/* if there is a custom write handler, and it returns true, use that */
|
||||
else if (device_memory(space->cpu)->write(space->spacenum(), address, 4, data))
|
||||
;
|
||||
|
||||
/* otherwise, call the byte reading function for the translated address */
|
||||
else
|
||||
memory_write_dword(space, address, data);
|
||||
space->write_dword(address, data);
|
||||
|
||||
/* no longer accessing via the debugger */
|
||||
memory_set_debugger_access(space, global->debugger_access = FALSE);
|
||||
global->memory_modified = TRUE;
|
||||
space->set_debugger_access(global->debugger_access = false);
|
||||
global->memory_modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -694,17 +701,18 @@ void debug_write_dword(const address_space *space, offs_t address, UINT32 data,
|
||||
specified memory space
|
||||
-------------------------------------------------*/
|
||||
|
||||
void debug_write_qword(const address_space *space, offs_t address, UINT64 data, int apply_translation)
|
||||
void debug_write_qword(const address_space *_space, offs_t address, UINT64 data, int apply_translation)
|
||||
{
|
||||
address_space *space = const_cast<address_space *>(_space);
|
||||
debugcpu_private *global = space->machine->debugcpu_data;
|
||||
|
||||
/* mask against the logical byte mask */
|
||||
address &= space->logbytemask;
|
||||
address &= space->logbytemask();
|
||||
|
||||
/* if this is a misaligned write, or if there are no qword writers, just read two dwords */
|
||||
if ((address & 7) != 0)
|
||||
{
|
||||
if (space->endianness == ENDIANNESS_LITTLE)
|
||||
if (space->endianness() == ENDIANNESS_LITTLE)
|
||||
{
|
||||
debug_write_dword(space, address + 0, data >> 0, apply_translation);
|
||||
debug_write_dword(space, address + 4, data >> 32, apply_translation);
|
||||
@ -720,23 +728,23 @@ void debug_write_qword(const address_space *space, offs_t address, UINT64 data,
|
||||
else
|
||||
{
|
||||
/* all accesses from this point on are for the debugger */
|
||||
memory_set_debugger_access(space, global->debugger_access = TRUE);
|
||||
space->set_debugger_access(global->debugger_access = true);
|
||||
|
||||
/* translate if necessary; if not mapped, we're done */
|
||||
if (apply_translation && !debug_cpu_translate(space, TRANSLATE_WRITE_DEBUG, &address))
|
||||
;
|
||||
|
||||
/* if there is a custom write handler, and it returns TRUE, use that */
|
||||
else if (device_memory(space->cpu)->write(space->spacenum, address, 8, data))
|
||||
/* if there is a custom write handler, and it returns true, use that */
|
||||
else if (device_memory(space->cpu)->write(space->spacenum(), address, 8, data))
|
||||
;
|
||||
|
||||
/* otherwise, call the byte reading function for the translated address */
|
||||
else
|
||||
memory_write_qword(space, address, data);
|
||||
space->write_qword(address, data);
|
||||
|
||||
/* no longer accessing via the debugger */
|
||||
memory_set_debugger_access(space, global->debugger_access = FALSE);
|
||||
global->memory_modified = TRUE;
|
||||
space->set_debugger_access(global->debugger_access = false);
|
||||
global->memory_modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -763,31 +771,32 @@ void debug_write_memory(const address_space *space, offs_t address, UINT64 data,
|
||||
the given offset from opcode space
|
||||
-------------------------------------------------*/
|
||||
|
||||
UINT64 debug_read_opcode(const address_space *space, offs_t address, int size, int arg)
|
||||
UINT64 debug_read_opcode(const address_space *_space, offs_t address, int size, int arg)
|
||||
{
|
||||
address_space *space = const_cast<address_space *>(_space);
|
||||
UINT64 result = ~(UINT64)0 & (~(UINT64)0 >> (64 - 8*size)), result2;
|
||||
debugcpu_private *global = space->machine->debugcpu_data;
|
||||
|
||||
/* keep in logical range */
|
||||
address &= space->logbytemask;
|
||||
address &= space->logbytemask();
|
||||
|
||||
/* return early if we got the result directly */
|
||||
memory_set_debugger_access(space, global->debugger_access = TRUE);
|
||||
space->set_debugger_access(global->debugger_access = true);
|
||||
device_memory_interface *memory;
|
||||
if (space->cpu->interface(memory) && memory->readop(address, size, result2))
|
||||
{
|
||||
memory_set_debugger_access(space, global->debugger_access = FALSE);
|
||||
space->set_debugger_access(global->debugger_access = false);
|
||||
return result2;
|
||||
}
|
||||
|
||||
/* if we're bigger than the address bus, break into smaller pieces */
|
||||
if (size > space->dbits / 8)
|
||||
if (size > space->data_width() / 8)
|
||||
{
|
||||
int halfsize = size / 2;
|
||||
UINT64 r0 = debug_read_opcode(space, address + 0, halfsize, arg);
|
||||
UINT64 r1 = debug_read_opcode(space, address + halfsize, halfsize, arg);
|
||||
|
||||
if (space->endianness == ENDIANNESS_LITTLE)
|
||||
if (space->endianness() == ENDIANNESS_LITTLE)
|
||||
return r0 | (r1 << (8 * halfsize));
|
||||
else
|
||||
return r1 | (r0 << (8 * halfsize));
|
||||
@ -798,8 +807,8 @@ UINT64 debug_read_opcode(const address_space *space, offs_t address, int size, i
|
||||
return result;
|
||||
|
||||
/* keep in physical range */
|
||||
address &= space->bytemask;
|
||||
switch (space->dbits / 8 * 10 + size)
|
||||
address &= space->bytemask();
|
||||
switch (space->data_width() / 8 * 10 + size)
|
||||
{
|
||||
/* dump opcodes in bytes from a byte-sized bus */
|
||||
case 11:
|
||||
@ -807,7 +816,7 @@ UINT64 debug_read_opcode(const address_space *space, offs_t address, int size, i
|
||||
|
||||
/* dump opcodes in bytes from a word-sized bus */
|
||||
case 21:
|
||||
address ^= (space->endianness == ENDIANNESS_LITTLE) ? BYTE_XOR_LE(0) : BYTE_XOR_BE(0);
|
||||
address ^= (space->endianness() == ENDIANNESS_LITTLE) ? BYTE_XOR_LE(0) : BYTE_XOR_BE(0);
|
||||
break;
|
||||
|
||||
/* dump opcodes in words from a word-sized bus */
|
||||
@ -816,12 +825,12 @@ UINT64 debug_read_opcode(const address_space *space, offs_t address, int size, i
|
||||
|
||||
/* dump opcodes in bytes from a dword-sized bus */
|
||||
case 41:
|
||||
address ^= (space->endianness == ENDIANNESS_LITTLE) ? BYTE4_XOR_LE(0) : BYTE4_XOR_BE(0);
|
||||
address ^= (space->endianness() == ENDIANNESS_LITTLE) ? BYTE4_XOR_LE(0) : BYTE4_XOR_BE(0);
|
||||
break;
|
||||
|
||||
/* dump opcodes in words from a dword-sized bus */
|
||||
case 42:
|
||||
address ^= (space->endianness == ENDIANNESS_LITTLE) ? WORD_XOR_LE(0) : WORD_XOR_BE(0);
|
||||
address ^= (space->endianness() == ENDIANNESS_LITTLE) ? WORD_XOR_LE(0) : WORD_XOR_BE(0);
|
||||
break;
|
||||
|
||||
/* dump opcodes in dwords from a dword-sized bus */
|
||||
@ -830,17 +839,17 @@ UINT64 debug_read_opcode(const address_space *space, offs_t address, int size, i
|
||||
|
||||
/* dump opcodes in bytes from a qword-sized bus */
|
||||
case 81:
|
||||
address ^= (space->endianness == ENDIANNESS_LITTLE) ? BYTE8_XOR_LE(0) : BYTE8_XOR_BE(0);
|
||||
address ^= (space->endianness() == ENDIANNESS_LITTLE) ? BYTE8_XOR_LE(0) : BYTE8_XOR_BE(0);
|
||||
break;
|
||||
|
||||
/* dump opcodes in words from a qword-sized bus */
|
||||
case 82:
|
||||
address ^= (space->endianness == ENDIANNESS_LITTLE) ? WORD2_XOR_LE(0) : WORD2_XOR_BE(0);
|
||||
address ^= (space->endianness() == ENDIANNESS_LITTLE) ? WORD2_XOR_LE(0) : WORD2_XOR_BE(0);
|
||||
break;
|
||||
|
||||
/* dump opcodes in dwords from a qword-sized bus */
|
||||
case 84:
|
||||
address ^= (space->endianness == ENDIANNESS_LITTLE) ? DWORD_XOR_LE(0) : DWORD_XOR_BE(0);
|
||||
address ^= (space->endianness() == ENDIANNESS_LITTLE) ? DWORD_XOR_LE(0) : DWORD_XOR_BE(0);
|
||||
break;
|
||||
|
||||
/* dump opcodes in qwords from a qword-sized bus */
|
||||
@ -848,13 +857,13 @@ UINT64 debug_read_opcode(const address_space *space, offs_t address, int size, i
|
||||
break;
|
||||
|
||||
default:
|
||||
fatalerror("debug_read_opcode: unknown type = %d", space->dbits / 8 * 10 + size);
|
||||
fatalerror("debug_read_opcode: unknown type = %d", space->data_width() / 8 * 10 + size);
|
||||
break;
|
||||
}
|
||||
|
||||
/* turn on debugger access */
|
||||
if (!global->debugger_access)
|
||||
memory_set_debugger_access(space, global->debugger_access = TRUE);
|
||||
space->set_debugger_access(global->debugger_access = true);
|
||||
|
||||
/* switch off the size and handle unaligned accesses */
|
||||
switch (size)
|
||||
@ -868,7 +877,7 @@ UINT64 debug_read_opcode(const address_space *space, offs_t address, int size, i
|
||||
if ((address & 1) != 0)
|
||||
{
|
||||
result2 = (arg) ? memory_raw_read_word(space, (address & ~1) + 2) : memory_decrypted_read_word(space, (address & ~1) + 2);
|
||||
if (space->endianness == ENDIANNESS_LITTLE)
|
||||
if (space->endianness() == ENDIANNESS_LITTLE)
|
||||
result = (result >> (8 * (address & 1))) | (result2 << (16 - 8 * (address & 1)));
|
||||
else
|
||||
result = (result << (8 * (address & 1))) | (result2 >> (16 - 8 * (address & 1)));
|
||||
@ -881,7 +890,7 @@ UINT64 debug_read_opcode(const address_space *space, offs_t address, int size, i
|
||||
if ((address & 3) != 0)
|
||||
{
|
||||
result2 = (arg) ? memory_raw_read_dword(space, (address & ~3) + 4) : memory_decrypted_read_dword(space, (address & ~3) + 4);
|
||||
if (space->endianness == ENDIANNESS_LITTLE)
|
||||
if (space->endianness() == ENDIANNESS_LITTLE)
|
||||
result = (result >> (8 * (address & 3))) | (result2 << (32 - 8 * (address & 3)));
|
||||
else
|
||||
result = (result << (8 * (address & 3))) | (result2 >> (32 - 8 * (address & 3)));
|
||||
@ -894,7 +903,7 @@ UINT64 debug_read_opcode(const address_space *space, offs_t address, int size, i
|
||||
if ((address & 7) != 0)
|
||||
{
|
||||
result2 = (arg) ? memory_raw_read_qword(space, (address & ~7) + 8) : memory_decrypted_read_qword(space, (address & ~7) + 8);
|
||||
if (space->endianness == ENDIANNESS_LITTLE)
|
||||
if (space->endianness() == ENDIANNESS_LITTLE)
|
||||
result = (result >> (8 * (address & 7))) | (result2 << (64 - 8 * (address & 7)));
|
||||
else
|
||||
result = (result << (8 * (address & 7))) | (result2 >> (64 - 8 * (address & 7)));
|
||||
@ -903,7 +912,7 @@ UINT64 debug_read_opcode(const address_space *space, offs_t address, int size, i
|
||||
}
|
||||
|
||||
/* no longer accessing via the debugger */
|
||||
memory_set_debugger_access(space, global->debugger_access = FALSE);
|
||||
space->set_debugger_access(global->debugger_access = false);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -935,7 +944,7 @@ static void on_vblank(screen_device &device, void *param, bool vblank_state)
|
||||
{
|
||||
/* just set a global flag to be consumed later */
|
||||
if (vblank_state)
|
||||
device.machine->debugcpu_data->vblank_occurred = TRUE;
|
||||
device.machine->debugcpu_data->vblank_occurred = true;
|
||||
}
|
||||
|
||||
|
||||
@ -1044,7 +1053,7 @@ static UINT64 expression_read_memory(void *param, const char *name, int spacenum
|
||||
device = debug_cpu_get_visible_cpu(machine);
|
||||
space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL));
|
||||
if (space != NULL)
|
||||
result = debug_read_memory(space, memory_address_to_byte(space, address), size, TRUE);
|
||||
result = debug_read_memory(space, space->address_to_byte(address), size, true);
|
||||
break;
|
||||
|
||||
case EXPSPACE_PROGRAM_PHYSICAL:
|
||||
@ -1057,7 +1066,7 @@ static UINT64 expression_read_memory(void *param, const char *name, int spacenum
|
||||
device = debug_cpu_get_visible_cpu(machine);
|
||||
space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM + (spacenum - EXPSPACE_PROGRAM_PHYSICAL));
|
||||
if (space != NULL)
|
||||
result = debug_read_memory(space, memory_address_to_byte(space, address), size, FALSE);
|
||||
result = debug_read_memory(space, space->address_to_byte(address), size, false);
|
||||
break;
|
||||
|
||||
case EXPSPACE_OPCODE:
|
||||
@ -1084,8 +1093,9 @@ static UINT64 expression_read_memory(void *param, const char *name, int spacenum
|
||||
directly from an opcode or RAM pointer
|
||||
-------------------------------------------------*/
|
||||
|
||||
static UINT64 expression_read_program_direct(const address_space *space, int opcode, offs_t address, int size)
|
||||
static UINT64 expression_read_program_direct(const address_space *_space, int opcode, offs_t address, int size)
|
||||
{
|
||||
address_space *space = const_cast<address_space *>(_space);
|
||||
UINT64 result = ~(UINT64)0 >> (64 - 8*size);
|
||||
|
||||
if (space != NULL)
|
||||
@ -1094,7 +1104,7 @@ static UINT64 expression_read_program_direct(const address_space *space, int opc
|
||||
|
||||
/* adjust the address into a byte address, but not if being called recursively */
|
||||
if ((opcode & 2) == 0)
|
||||
address = memory_address_to_byte(space, address);
|
||||
address = space->address_to_byte(address);
|
||||
|
||||
/* call ourself recursively until we are byte-sized */
|
||||
if (size > 1)
|
||||
@ -1107,7 +1117,7 @@ static UINT64 expression_read_program_direct(const address_space *space, int opc
|
||||
r1 = expression_read_program_direct(space, opcode | 2, address + halfsize, halfsize);
|
||||
|
||||
/* assemble based on the target endianness */
|
||||
if (space->endianness == ENDIANNESS_LITTLE)
|
||||
if (space->endianness() == ENDIANNESS_LITTLE)
|
||||
result = r0 | (r1 << (8 * halfsize));
|
||||
else
|
||||
result = r1 | (r0 << (8 * halfsize));
|
||||
@ -1117,7 +1127,7 @@ static UINT64 expression_read_program_direct(const address_space *space, int opc
|
||||
else
|
||||
{
|
||||
/* lowmask specified which address bits are within the databus width */
|
||||
offs_t lowmask = space->dbits / 8 - 1;
|
||||
offs_t lowmask = space->data_width() / 8 - 1;
|
||||
|
||||
/* get the base of memory, aligned to the address minus the lowbits */
|
||||
if (opcode & 1)
|
||||
@ -1128,7 +1138,7 @@ static UINT64 expression_read_program_direct(const address_space *space, int opc
|
||||
/* if we have a valid base, return the appropriate byte */
|
||||
if (base != NULL)
|
||||
{
|
||||
if (space->endianness == ENDIANNESS_LITTLE)
|
||||
if (space->endianness() == ENDIANNESS_LITTLE)
|
||||
result = base[BYTE8_XOR_LE(address) & lowmask];
|
||||
else
|
||||
result = base[BYTE8_XOR_BE(address) & lowmask];
|
||||
@ -1211,7 +1221,7 @@ static void expression_write_memory(void *param, const char *name, int spacenum,
|
||||
device = debug_cpu_get_visible_cpu(machine);
|
||||
space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL));
|
||||
if (space != NULL)
|
||||
debug_write_memory(space, memory_address_to_byte(space, address), data, size, TRUE);
|
||||
debug_write_memory(space, space->address_to_byte(address), data, size, true);
|
||||
break;
|
||||
|
||||
case EXPSPACE_PROGRAM_PHYSICAL:
|
||||
@ -1224,7 +1234,7 @@ static void expression_write_memory(void *param, const char *name, int spacenum,
|
||||
device = debug_cpu_get_visible_cpu(machine);
|
||||
space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM + (spacenum - EXPSPACE_PROGRAM_PHYSICAL));
|
||||
if (space != NULL)
|
||||
debug_write_memory(space, memory_address_to_byte(space, address), data, size, FALSE);
|
||||
debug_write_memory(space, space->address_to_byte(address), data, size, false);
|
||||
break;
|
||||
|
||||
case EXPSPACE_OPCODE:
|
||||
@ -1250,8 +1260,9 @@ static void expression_write_memory(void *param, const char *name, int spacenum,
|
||||
directly to an opcode or RAM pointer
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void expression_write_program_direct(const address_space *space, int opcode, offs_t address, int size, UINT64 data)
|
||||
static void expression_write_program_direct(const address_space *_space, int opcode, offs_t address, int size, UINT64 data)
|
||||
{
|
||||
address_space *space = const_cast<address_space *>(_space);
|
||||
if (space != NULL)
|
||||
{
|
||||
debugcpu_private *global = space->machine->debugcpu_data;
|
||||
@ -1259,7 +1270,7 @@ static void expression_write_program_direct(const address_space *space, int opco
|
||||
|
||||
/* adjust the address into a byte address, but not if being called recursively */
|
||||
if ((opcode & 2) == 0)
|
||||
address = memory_address_to_byte(space, address);
|
||||
address = space->address_to_byte(address);
|
||||
|
||||
/* call ourself recursively until we are byte-sized */
|
||||
if (size > 1)
|
||||
@ -1269,7 +1280,7 @@ static void expression_write_program_direct(const address_space *space, int opco
|
||||
|
||||
/* break apart based on the target endianness */
|
||||
halfmask = ~(UINT64)0 >> (64 - 8 * halfsize);
|
||||
if (space->endianness == ENDIANNESS_LITTLE)
|
||||
if (space->endianness() == ENDIANNESS_LITTLE)
|
||||
{
|
||||
r0 = data & halfmask;
|
||||
r1 = (data >> (8 * halfsize)) & halfmask;
|
||||
@ -1289,7 +1300,7 @@ static void expression_write_program_direct(const address_space *space, int opco
|
||||
else
|
||||
{
|
||||
/* lowmask specified which address bits are within the databus width */
|
||||
offs_t lowmask = space->dbits / 8 - 1;
|
||||
offs_t lowmask = space->data_width() / 8 - 1;
|
||||
|
||||
/* get the base of memory, aligned to the address minus the lowbits */
|
||||
if (opcode & 1)
|
||||
@ -1300,11 +1311,11 @@ static void expression_write_program_direct(const address_space *space, int opco
|
||||
/* if we have a valid base, write the appropriate byte */
|
||||
if (base != NULL)
|
||||
{
|
||||
if (space->endianness == ENDIANNESS_LITTLE)
|
||||
if (space->endianness() == ENDIANNESS_LITTLE)
|
||||
base[BYTE8_XOR_LE(address) & lowmask] = data;
|
||||
else
|
||||
base[BYTE8_XOR_BE(address) & lowmask] = data;
|
||||
global->memory_modified = TRUE;
|
||||
global->memory_modified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1360,7 +1371,7 @@ static void expression_write_memory_region(running_machine *machine, const char
|
||||
base[BYTE8_XOR_LE(address) & lowmask] = data;
|
||||
else
|
||||
base[BYTE8_XOR_BE(address) & lowmask] = data;
|
||||
global->memory_modified = TRUE;
|
||||
global->memory_modified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1678,7 +1689,7 @@ void device_debug::start_hook(attotime endtime)
|
||||
// if a VBLANK occurred, check on things
|
||||
if (global->vblank_occurred)
|
||||
{
|
||||
global->vblank_occurred = FALSE;
|
||||
global->vblank_occurred = false;
|
||||
|
||||
// if we were waiting for a VBLANK, signal it now
|
||||
if ((m_flags & DEBUG_FLAG_STOP_VBLANK) != 0)
|
||||
@ -1769,7 +1780,7 @@ void device_debug::instruction_hook(offs_t curpc)
|
||||
debugcpu_private *global = m_device.machine->debugcpu_data;
|
||||
|
||||
// note that we are in the debugger code
|
||||
global->within_instruction_hook = TRUE;
|
||||
global->within_instruction_hook = true;
|
||||
|
||||
// update the history
|
||||
m_pc_history[m_pc_history_index++ % HISTORY_SIZE] = curpc;
|
||||
@ -1831,7 +1842,7 @@ void device_debug::instruction_hook(offs_t curpc)
|
||||
// if we are supposed to halt, do it now
|
||||
if (global->execution_state == EXECUTION_STATE_STOPPED)
|
||||
{
|
||||
int firststop = TRUE;
|
||||
int firststop = true;
|
||||
|
||||
// reset any transient state
|
||||
reset_transient_flags(*m_device.machine);
|
||||
@ -1845,19 +1856,19 @@ void device_debug::instruction_hook(offs_t curpc)
|
||||
debugger_refresh_display(m_device.machine);
|
||||
|
||||
// wait for the debugger; during this time, disable sound output
|
||||
sound_mute(m_device.machine, TRUE);
|
||||
sound_mute(m_device.machine, true);
|
||||
while (global->execution_state == EXECUTION_STATE_STOPPED)
|
||||
{
|
||||
// flush any pending updates before waiting again
|
||||
m_device.machine->m_debug_view->flush_osd_updates();
|
||||
|
||||
// clear the memory modified flag and wait
|
||||
global->memory_modified = FALSE;
|
||||
global->memory_modified = false;
|
||||
if (m_device.machine->debug_flags & DEBUG_FLAG_OSD_ENABLED)
|
||||
osd_wait_for_debugger(&m_device, firststop);
|
||||
else if (m_device.machine->debug_flags & DEBUG_FLAG_ENABLED)
|
||||
debugint_wait_for_debugger(&m_device, firststop);
|
||||
firststop = FALSE;
|
||||
firststop = false;
|
||||
|
||||
// if something modified memory, update the screen
|
||||
if (global->memory_modified)
|
||||
@ -1873,7 +1884,7 @@ void device_debug::instruction_hook(offs_t curpc)
|
||||
if (m_device.machine->scheduled_event_pending())
|
||||
global->execution_state = EXECUTION_STATE_RUNNING;
|
||||
}
|
||||
sound_mute(m_device.machine, FALSE);
|
||||
sound_mute(m_device.machine, false);
|
||||
|
||||
// remember the last visible CPU in the debugger
|
||||
global->visiblecpu = &m_device;
|
||||
@ -1884,7 +1895,7 @@ void device_debug::instruction_hook(offs_t curpc)
|
||||
prepare_for_step_overout(pc());
|
||||
|
||||
// no longer in debugger code
|
||||
global->within_instruction_hook = FALSE;
|
||||
global->within_instruction_hook = false;
|
||||
}
|
||||
|
||||
|
||||
@ -1956,7 +1967,7 @@ offs_t device_debug::disassemble(char *buffer, offs_t pc, const UINT8 *oprom, co
|
||||
if (m_memory != NULL && m_disasm != NULL)
|
||||
{
|
||||
const address_space *space = m_memory->space(AS_PROGRAM);
|
||||
int bytes = memory_address_to_byte(space, result & DASMFLAG_LENGTHMASK);
|
||||
int bytes = space->address_to_byte(result & DASMFLAG_LENGTHMASK);
|
||||
assert(bytes >= m_disasm->min_opcode_bytes());
|
||||
assert(bytes <= m_disasm->max_opcode_bytes());
|
||||
(void) bytes; // appease compiler
|
||||
@ -2068,7 +2079,7 @@ void device_debug::go_vblank()
|
||||
|
||||
assert(m_exec != NULL);
|
||||
|
||||
global->vblank_occurred = FALSE;
|
||||
global->vblank_occurred = false;
|
||||
m_flags |= DEBUG_FLAG_STOP_VBLANK;
|
||||
global->execution_state = EXECUTION_STATE_RUNNING;
|
||||
}
|
||||
@ -2270,14 +2281,14 @@ void device_debug::breakpoint_enable_all(bool enable)
|
||||
|
||||
int device_debug::watchpoint_set(const address_space &space, int type, offs_t address, offs_t length, parsed_expression *condition, const char *action)
|
||||
{
|
||||
assert(space.spacenum < ARRAY_LENGTH(m_wplist));
|
||||
assert(space.spacenum() < ARRAY_LENGTH(m_wplist));
|
||||
|
||||
// allocate a new one
|
||||
watchpoint *wp = auto_alloc(m_device.machine, watchpoint(m_device.machine->debugcpu_data->bpindex++, space, type, address, length, condition, action));
|
||||
|
||||
// hook it into our list
|
||||
wp->m_next = m_wplist[space.spacenum];
|
||||
m_wplist[space.spacenum] = wp;
|
||||
wp->m_next = m_wplist[space.spacenum()];
|
||||
m_wplist[space.spacenum()] = wp;
|
||||
|
||||
// update the flags and return the index
|
||||
watchpoint_update_flags(wp->m_space);
|
||||
@ -2571,7 +2582,7 @@ void device_debug::watchpoint_update_flags(const address_space &space)
|
||||
|
||||
// see if there are any enabled breakpoints
|
||||
bool enablewrite = false;
|
||||
for (watchpoint *wp = m_wplist[space.spacenum]; wp != NULL; wp = wp->m_next)
|
||||
for (watchpoint *wp = m_wplist[space.spacenum()]; wp != NULL; wp = wp->m_next)
|
||||
if (wp->m_enabled)
|
||||
{
|
||||
if (wp->m_type & WATCHPOINT_READ)
|
||||
@ -2598,13 +2609,13 @@ void device_debug::watchpoint_check(const address_space &space, int type, offs_t
|
||||
// if we're within debugger code, don't stop
|
||||
if (global->within_instruction_hook || global->debugger_access)
|
||||
return;
|
||||
global->within_instruction_hook = TRUE;
|
||||
global->within_instruction_hook = true;
|
||||
|
||||
// adjust address, size & value_to_write based on mem_mask.
|
||||
offs_t size = 0;
|
||||
if (mem_mask != 0)
|
||||
{
|
||||
int bus_size = space.dbits / 8;
|
||||
int bus_size = space.data_width() / 8;
|
||||
int address_offset = 0;
|
||||
|
||||
while (address_offset < bus_size && (mem_mask & 0xff) == 0)
|
||||
@ -2620,7 +2631,7 @@ void device_debug::watchpoint_check(const address_space &space, int type, offs_t
|
||||
mem_mask >>= 8;
|
||||
}
|
||||
|
||||
if (space.endianness == ENDIANNESS_LITTLE)
|
||||
if (space.endianness() == ENDIANNESS_LITTLE)
|
||||
address += address_offset;
|
||||
else
|
||||
address += bus_size - size - address_offset;
|
||||
@ -2632,7 +2643,7 @@ void device_debug::watchpoint_check(const address_space &space, int type, offs_t
|
||||
global->wpdata = value_to_write;
|
||||
|
||||
// see if we match
|
||||
for (watchpoint *wp = m_wplist[space.spacenum]; wp != NULL; wp = wp->m_next)
|
||||
for (watchpoint *wp = m_wplist[space.spacenum()]; wp != NULL; wp = wp->m_next)
|
||||
if (wp->hit(type, address, size))
|
||||
{
|
||||
// halt in the debugger by default
|
||||
@ -2654,21 +2665,21 @@ void device_debug::watchpoint_check(const address_space &space, int type, offs_t
|
||||
|
||||
if (type & WATCHPOINT_WRITE)
|
||||
{
|
||||
buffer.printf("Stopped at watchpoint %X writing %s to %08X (PC=%X)", wp->m_index, sizes[size], memory_byte_to_address(&space, address), pc);
|
||||
buffer.printf("Stopped at watchpoint %X writing %s to %08X (PC=%X)", wp->m_index, sizes[size], space.byte_to_address(address), pc);
|
||||
if (value_to_write >> 32)
|
||||
buffer.catprintf(" (data=%X%08X)", (UINT32)(value_to_write >> 32), (UINT32)value_to_write);
|
||||
else
|
||||
buffer.catprintf(" (data=%X)", (UINT32)value_to_write);
|
||||
}
|
||||
else
|
||||
buffer.printf("Stopped at watchpoint %X reading %s from %08X (PC=%X)", wp->m_index, sizes[size], memory_byte_to_address(&space, address), pc);
|
||||
buffer.printf("Stopped at watchpoint %X reading %s from %08X (PC=%X)", wp->m_index, sizes[size], space.byte_to_address(address), pc);
|
||||
debug_console_printf(space.machine, "%s\n", buffer.cstr());
|
||||
space.cpu->debug()->compute_debug_flags();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
global->within_instruction_hook = FALSE;
|
||||
global->within_instruction_hook = false;
|
||||
}
|
||||
|
||||
|
||||
@ -2693,7 +2704,7 @@ void device_debug::hotspot_check(const address_space &space, offs_t address)
|
||||
// if the bottom of the list is over the threshhold, print it
|
||||
hotspot_entry &spot = m_hotspots[m_hotspot_count - 1];
|
||||
if (spot.m_count > m_hotspot_threshhold)
|
||||
debug_console_printf(space.machine, "Hotspot @ %s %08X (PC=%08X) hit %d times (fell off bottom)\n", space.name, spot.m_access, spot.m_pc, spot.m_count);
|
||||
debug_console_printf(space.machine, "Hotspot @ %s %08X (PC=%08X) hit %d times (fell off bottom)\n", space.name(), spot.m_access, spot.m_pc, spot.m_count);
|
||||
|
||||
// move everything else down and insert this one at the top
|
||||
memmove(&m_hotspots[1], &m_hotspots[0], sizeof(m_hotspots[0]) * (m_hotspot_count - 1));
|
||||
@ -2729,15 +2740,15 @@ UINT32 device_debug::dasm_wrapped(astring &buffer, offs_t pc)
|
||||
|
||||
// determine the adjusted PC
|
||||
const address_space *space = m_memory->space(AS_PROGRAM);
|
||||
offs_t pcbyte = memory_address_to_byte(space, pc) & space->bytemask;
|
||||
offs_t pcbyte = space->address_to_byte(pc) & space->bytemask();
|
||||
|
||||
// fetch the bytes up to the maximum
|
||||
UINT8 opbuf[64], argbuf[64];
|
||||
int maxbytes = max_opcode_bytes();
|
||||
for (int numbytes = 0; numbytes < maxbytes; numbytes++)
|
||||
{
|
||||
opbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, FALSE);
|
||||
argbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, TRUE);
|
||||
opbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, false);
|
||||
argbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, true);
|
||||
}
|
||||
|
||||
// disassemble to our buffer
|
||||
@ -2789,8 +2800,8 @@ UINT64 device_debug::get_logunmap(void *globalref, void *ref)
|
||||
|
||||
void device_debug::set_logunmap(void *globalref, void *ref, UINT64 value)
|
||||
{
|
||||
const address_space *space = reinterpret_cast<const address_space *>(ref);
|
||||
memory_set_log_unmap(space, value ? 1 : 0);
|
||||
address_space *space = reinterpret_cast<address_space *>(ref);
|
||||
space->set_log_unmap(value ? true : false);
|
||||
}
|
||||
|
||||
|
||||
@ -2887,8 +2898,8 @@ device_debug::watchpoint::watchpoint(int index, const address_space &space, int
|
||||
m_index(index),
|
||||
m_enabled(true),
|
||||
m_type(type),
|
||||
m_address(memory_address_to_byte(&space, address) & space.bytemask),
|
||||
m_length(memory_address_to_byte(&space, length)),
|
||||
m_address(space.address_to_byte(address) & space.bytemask()),
|
||||
m_length(space.address_to_byte(length)),
|
||||
m_condition(condition),
|
||||
m_action((action != NULL) ? action : "")
|
||||
{
|
||||
|
@ -146,7 +146,7 @@ public:
|
||||
|
||||
// commonly-used pass-throughs
|
||||
offs_t pc() const { return (m_state != NULL) ? m_state->pc() : 0; }
|
||||
int logaddrchars(int spacenum = AS_PROGRAM) const { return (m_memory != NULL && m_memory->space(spacenum) != NULL) ? m_memory->space(spacenum)->logaddrchars : 8; }
|
||||
int logaddrchars(int spacenum = AS_PROGRAM) const { return (m_memory != NULL && m_memory->space(spacenum) != NULL) ? m_memory->space(spacenum)->logaddrchars() : 8; }
|
||||
int min_opcode_bytes() const { return (m_disasm != NULL) ? m_disasm->max_opcode_bytes() : 1; }
|
||||
int max_opcode_bytes() const { return (m_disasm != NULL) ? m_disasm->max_opcode_bytes() : 1; }
|
||||
|
||||
|
@ -203,7 +203,7 @@ void debug_view_disasm::view_char(int chval)
|
||||
case DCH_HOME: // set the active column to the PC
|
||||
{
|
||||
const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source);
|
||||
offs_t pc = memory_address_to_byte(source.m_space, cpu_get_pc(&source.m_device)) & source.m_space->logbytemask;
|
||||
offs_t pc = source.m_space->address_to_byte(cpu_get_pc(&source.m_device)) & source.m_space->logbytemask();
|
||||
|
||||
// figure out which row the pc is on
|
||||
for (int curline = 0; curline < m_allocated.y; curline++)
|
||||
@ -242,9 +242,9 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs)
|
||||
const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source);
|
||||
|
||||
// compute the increment
|
||||
int minlen = memory_byte_to_address(source.m_space, source.m_disasmintf->min_opcode_bytes());
|
||||
int minlen = source.m_space->byte_to_address(source.m_disasmintf->min_opcode_bytes());
|
||||
if (minlen == 0) minlen = 1;
|
||||
int maxlen = memory_byte_to_address(source.m_space, source.m_disasmintf->max_opcode_bytes());
|
||||
int maxlen = source.m_space->byte_to_address(source.m_disasmintf->max_opcode_bytes());
|
||||
if (maxlen == 0) maxlen = 1;
|
||||
|
||||
// start off numinstrs back
|
||||
@ -253,13 +253,13 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs)
|
||||
curpc = 0;
|
||||
|
||||
/* loop until we find what we are looking for */
|
||||
offs_t targetpcbyte = memory_address_to_byte(source.m_space, targetpc) & source.m_space->logbytemask;
|
||||
offs_t targetpcbyte = source.m_space->address_to_byte(targetpc) & source.m_space->logbytemask();
|
||||
offs_t fillpcbyte = targetpcbyte;
|
||||
offs_t lastgoodpc = targetpc;
|
||||
while (1)
|
||||
{
|
||||
// fill the buffer up to the target
|
||||
offs_t curpcbyte = memory_address_to_byte(source.m_space, curpc) & source.m_space->logbytemask;
|
||||
offs_t curpcbyte = source.m_space->address_to_byte(curpc) & source.m_space->logbytemask();
|
||||
UINT8 opbuf[1024], argbuf[1024];
|
||||
while (curpcbyte < fillpcbyte)
|
||||
{
|
||||
@ -274,7 +274,7 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs)
|
||||
offs_t scanpc;
|
||||
for (scanpc = curpc; scanpc < targetpc; scanpc += instlen)
|
||||
{
|
||||
offs_t scanpcbyte = memory_address_to_byte(source.m_space, scanpc) & source.m_space->logbytemask;
|
||||
offs_t scanpcbyte = source.m_space->address_to_byte(scanpc) & source.m_space->logbytemask();
|
||||
offs_t physpcbyte = scanpcbyte;
|
||||
|
||||
// get the disassembly, but only if mapped
|
||||
@ -348,7 +348,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
|
||||
const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source);
|
||||
|
||||
// determine how many characters we need for an address and set the divider
|
||||
m_divider1 = 1 + source.m_space->logaddrchars + 1;
|
||||
m_divider1 = 1 + source.m_space->logaddrchars() + 1;
|
||||
|
||||
// assume a fixed number of characters for the disassembly
|
||||
m_divider2 = m_divider1 + 1 + m_dasm_width + 1;
|
||||
@ -358,7 +358,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
|
||||
int maxbytes = source.m_disasmintf->max_opcode_bytes();
|
||||
|
||||
// ensure that the PC is aligned to the minimum opcode size
|
||||
pc &= ~memory_byte_to_address_end(source.m_space, minbytes - 1);
|
||||
pc &= ~source.m_space->byte_to_address_end(minbytes - 1);
|
||||
|
||||
// set the width of the third column according to display mode
|
||||
if (m_right_column == DASM_RIGHTCOL_RAW || m_right_column == DASM_RIGHTCOL_ENCRYPTED)
|
||||
@ -390,7 +390,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
|
||||
for (int line = 0; line < lines; line++)
|
||||
{
|
||||
// convert PC to a byte offset
|
||||
offs_t pcbyte = memory_address_to_byte(source.m_space, pc) & source.m_space->logbytemask;
|
||||
offs_t pcbyte = source.m_space->address_to_byte(pc) & source.m_space->logbytemask();
|
||||
|
||||
// save a copy of the previous line as a backup if we're only doing one line
|
||||
int instr = startline + line;
|
||||
@ -401,7 +401,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
|
||||
|
||||
// convert back and set the address of this instruction
|
||||
m_byteaddress[instr] = pcbyte;
|
||||
sprintf(&destbuf[0], " %s ", core_i64_hex_format(memory_byte_to_address(source.m_space, pcbyte), source.m_space->logaddrchars));
|
||||
sprintf(&destbuf[0], " %s ", core_i64_hex_format(source.m_space->byte_to_address(pcbyte), source.m_space->logaddrchars()));
|
||||
|
||||
// make sure we can translate the address, and then disassemble the result
|
||||
char buffer[100];
|
||||
@ -419,7 +419,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
|
||||
}
|
||||
|
||||
// disassemble the result
|
||||
pc += numbytes = source.m_disasmintf->disassemble(buffer, pc & source.m_space->logaddrmask, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
|
||||
pc += numbytes = source.m_disasmintf->disassemble(buffer, pc & source.m_space->logaddrmask(), opbuf, argbuf) & DASMFLAG_LENGTHMASK;
|
||||
}
|
||||
else
|
||||
strcpy(buffer, "<unmapped>");
|
||||
@ -431,13 +431,13 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
|
||||
if (m_right_column == DASM_RIGHTCOL_RAW || m_right_column == DASM_RIGHTCOL_ENCRYPTED)
|
||||
{
|
||||
// get the bytes
|
||||
numbytes = memory_address_to_byte(source.m_space, numbytes) & source.m_space->logbytemask;
|
||||
numbytes = source.m_space->address_to_byte(numbytes) & source.m_space->logbytemask();
|
||||
generate_bytes(pcbyte, numbytes, minbytes, &destbuf[m_divider2], m_allocated.x - m_divider2, m_right_column == DASM_RIGHTCOL_ENCRYPTED);
|
||||
}
|
||||
else if (m_right_column == DASM_RIGHTCOL_COMMENTS)
|
||||
{
|
||||
// get and add the comment, if present
|
||||
offs_t comment_address = memory_byte_to_address(source.m_space, m_byteaddress[instr]);
|
||||
offs_t comment_address = source.m_space->byte_to_address(m_byteaddress[instr]);
|
||||
const char *text = debug_comment_get_text(&source.m_device, comment_address, debug_comment_get_opcode_crc32(&source.m_device, comment_address));
|
||||
if (text != NULL)
|
||||
sprintf(&destbuf[m_divider2], "// %.*s", m_allocated.x - m_divider2 - 1, text);
|
||||
@ -449,8 +449,8 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
|
||||
}
|
||||
|
||||
// update opcode base information
|
||||
m_last_direct_decrypted = source.m_space->direct.decrypted;
|
||||
m_last_direct_raw = source.m_space->direct.raw;
|
||||
m_last_direct_decrypted = source.m_space->direct().decrypted();
|
||||
m_last_direct_raw = source.m_space->direct().raw();
|
||||
m_last_change_count = debug_comment_all_change_count(&m_machine);
|
||||
|
||||
// now longer need to recompute
|
||||
@ -469,7 +469,7 @@ void debug_view_disasm::view_update()
|
||||
const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source);
|
||||
|
||||
offs_t pc = cpu_get_pc(&source.m_device);
|
||||
offs_t pcbyte = memory_address_to_byte(source.m_space, pc) & source.m_space->logbytemask;
|
||||
offs_t pcbyte = source.m_space->address_to_byte(pc) & source.m_space->logbytemask();
|
||||
|
||||
// update our context; if the expression is dirty, recompute
|
||||
if (m_expression.dirty())
|
||||
@ -480,7 +480,7 @@ void debug_view_disasm::view_update()
|
||||
UINT64 result = m_expression.value();
|
||||
if (result != previous)
|
||||
{
|
||||
offs_t resultbyte = memory_address_to_byte(source.m_space, result) & source.m_space->logbytemask;
|
||||
offs_t resultbyte = source.m_space->address_to_byte(result) & source.m_space->logbytemask();
|
||||
|
||||
// see if the new result is an address we already have
|
||||
UINT32 row;
|
||||
@ -498,7 +498,7 @@ void debug_view_disasm::view_update()
|
||||
}
|
||||
|
||||
// if the opcode base has changed, rework things
|
||||
if (source.m_space->direct.decrypted != m_last_direct_decrypted || source.m_space->direct.raw != m_last_direct_raw)
|
||||
if (source.m_space->direct().decrypted() != m_last_direct_decrypted || source.m_space->direct().raw() != m_last_direct_raw)
|
||||
m_recompute = true;
|
||||
|
||||
// if the comments have changed, redo it
|
||||
@ -517,7 +517,7 @@ recompute:
|
||||
m_topleft.x = 0;
|
||||
|
||||
// recompute from where we last recomputed!
|
||||
recompute(memory_byte_to_address(source.m_space, m_byteaddress[0]), 0, m_total.y);
|
||||
recompute(source.m_space->byte_to_address(m_byteaddress[0]), 0, m_total.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -579,7 +579,7 @@ recompute:
|
||||
else
|
||||
{
|
||||
for (device_debug::breakpoint *bp = source.m_device.debug()->breakpoint_first(); bp != NULL; bp = bp->next())
|
||||
if (m_byteaddress[effrow] == (memory_address_to_byte(source.m_space, bp->address()) & source.m_space->logbytemask))
|
||||
if (m_byteaddress[effrow] == (source.m_space->address_to_byte(bp->address()) & source.m_space->logbytemask()))
|
||||
attrib = DCA_CHANGED;
|
||||
}
|
||||
|
||||
@ -627,7 +627,7 @@ recompute:
|
||||
offs_t debug_view_disasm::selected_address()
|
||||
{
|
||||
flush_updates();
|
||||
return memory_byte_to_address(downcast<const debug_view_disasm_source &>(*m_source).m_space, m_byteaddress[m_cursor.y]);
|
||||
return downcast<const debug_view_disasm_source &>(*m_source).m_space->byte_to_address(m_byteaddress[m_cursor.y]);
|
||||
}
|
||||
|
||||
|
||||
@ -695,7 +695,7 @@ void debug_view_disasm::set_disasm_width(UINT32 width)
|
||||
void debug_view_disasm::set_selected_address(offs_t address)
|
||||
{
|
||||
const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source);
|
||||
offs_t byteaddress = memory_address_to_byte(source.m_space, address) & source.m_space->logbytemask;
|
||||
offs_t byteaddress = source.m_space->address_to_byte(address) & source.m_space->logbytemask();
|
||||
for (int line = 0; line < m_total.y; line++)
|
||||
if (m_byteaddress[line] == byteaddress)
|
||||
{
|
||||
|
@ -79,8 +79,8 @@ debug_view_memory_source::debug_view_memory_source(const char *name, const addre
|
||||
m_base(NULL),
|
||||
m_length(0),
|
||||
m_offsetxor(0),
|
||||
m_endianness(space.endianness),
|
||||
m_prefsize(space.dbits / 8)
|
||||
m_endianness(space.endianness()),
|
||||
m_prefsize(space.data_width() / 8)
|
||||
{
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ void debug_view_memory::enumerate_sources()
|
||||
const address_space *space = memintf->space(spacenum);
|
||||
if (space != NULL)
|
||||
{
|
||||
name.printf("%s '%s' %s space memory", memintf->device().name(), memintf->device().tag(), space->name);
|
||||
name.printf("%s '%s' %s space memory", memintf->device().name(), memintf->device().tag(), space->name());
|
||||
m_source_list.append(*auto_alloc(&m_machine, debug_view_memory_source(name, *space)));
|
||||
}
|
||||
}
|
||||
@ -263,7 +263,7 @@ void debug_view_memory::view_update()
|
||||
if (effrow < m_total.y)
|
||||
{
|
||||
offs_t addrbyte = m_byte_offset + effrow * m_bytes_per_row;
|
||||
offs_t address = (source.m_space != NULL) ? memory_byte_to_address(source.m_space, addrbyte) : addrbyte;
|
||||
offs_t address = (source.m_space != NULL) ? source.m_space->byte_to_address(addrbyte) : addrbyte;
|
||||
char addrtext[20];
|
||||
|
||||
// generate the address
|
||||
@ -441,8 +441,8 @@ void debug_view_memory::recompute()
|
||||
int addrchars;
|
||||
if (source.m_space != NULL)
|
||||
{
|
||||
m_maxaddr = m_no_translation ? source.m_space->bytemask : source.m_space->logbytemask;
|
||||
addrchars = m_no_translation ? source.m_space->addrchars : source.m_space->logaddrchars;
|
||||
m_maxaddr = m_no_translation ? source.m_space->bytemask() : source.m_space->logbytemask();
|
||||
addrchars = m_no_translation ? source.m_space->addrchars() : source.m_space->logaddrchars();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -457,9 +457,9 @@ void debug_view_memory::recompute()
|
||||
m_addrformat.printf("%%0%dX%*s", addrchars, 8 - addrchars, "");
|
||||
|
||||
// if we are viewing a space with a minimum chunk size, clamp the bytes per chunk
|
||||
if (source.m_space != NULL && source.m_space->ashift < 0)
|
||||
if (source.m_space != NULL && source.m_space->byte_to_address(1) > 1)
|
||||
{
|
||||
UINT32 min_bytes_per_chunk = 1 << -source.m_space->ashift;
|
||||
UINT32 min_bytes_per_chunk = source.m_space->byte_to_address(1);
|
||||
while (m_bytes_per_chunk < min_bytes_per_chunk)
|
||||
{
|
||||
m_bytes_per_chunk *= 2;
|
||||
@ -521,7 +521,7 @@ bool debug_view_memory::needs_recompute()
|
||||
const debug_view_memory_source &source = downcast<const debug_view_memory_source &>(*m_source);
|
||||
offs_t resultbyte;
|
||||
if (source.m_space != NULL)
|
||||
resultbyte = memory_address_to_byte(source.m_space, m_expression.value()) & source.m_space->logbytemask;
|
||||
resultbyte = source.m_space->address_to_byte(m_expression.value()) & source.m_space->logbytemask();
|
||||
else
|
||||
resultbyte = m_expression.value();
|
||||
|
||||
@ -621,7 +621,7 @@ bool debug_view_memory::read(UINT8 size, offs_t offs, UINT64 &data)
|
||||
{
|
||||
offs_t dummyaddr = offs;
|
||||
|
||||
bool ismapped = m_no_translation ? true : source.m_memintf->translate(source.m_space->spacenum, TRANSLATE_READ_DEBUG, dummyaddr);
|
||||
bool ismapped = m_no_translation ? true : source.m_memintf->translate(source.m_space->spacenum(), TRANSLATE_READ_DEBUG, dummyaddr);
|
||||
data = ~(UINT64)0;
|
||||
if (ismapped)
|
||||
{
|
||||
|
97
src/emu/delegate.c
Normal file
97
src/emu/delegate.c
Normal file
@ -0,0 +1,97 @@
|
||||
/***************************************************************************
|
||||
|
||||
delegate.c
|
||||
|
||||
Templates and classes to enable delegates for callbacks.
|
||||
|
||||
****************************************************************************
|
||||
|
||||
Copyright Aaron Giles
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name 'MAME' nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emucore.h"
|
||||
#include "delegate.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// BINDABLE OBJECT
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// bindable_object - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
bindable_object::bindable_object()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// ~bindable_object - destructor
|
||||
//-------------------------------------------------
|
||||
|
||||
bindable_object::~bindable_object()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// INTERNAL DELEGATE HELPERS
|
||||
//**************************************************************************
|
||||
|
||||
#if (USE_DELEGATE_TYPE == DELEGATE_TYPE_INTERNAL)
|
||||
|
||||
// NULL structure used in dummy constructor
|
||||
delegate_gcc_mfp_internal delegate_gcc_mfp_null;
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// delegate_convert_raw - given an object and
|
||||
// an raw function, adjust the object base and
|
||||
// return the actual final code pointer
|
||||
//-------------------------------------------------
|
||||
|
||||
delegate_generic_function delegate_convert_raw(delegate_generic_class *&object, delegate_gcc_mfp_internal &mfp)
|
||||
{
|
||||
// apply the "this" delta to the object first
|
||||
object = reinterpret_cast<delegate_generic_class *>(reinterpret_cast<UINT8 *>(object) + mfp.this_delta);
|
||||
|
||||
// if the low bit of the vtable index is clear, then it is just a raw function pointer
|
||||
if (!(mfp.u.vtable_index & 1))
|
||||
return mfp.u.funcptr;
|
||||
|
||||
// otherwise, it is the byte index into the vtable where the actual function lives
|
||||
UINT8 *vtable_base = *reinterpret_cast<UINT8 **>(object);
|
||||
return *reinterpret_cast<delegate_generic_function *>(vtable_base + mfp.u.vtable_index - 1);
|
||||
}
|
||||
|
||||
#endif
|
1209
src/emu/delegate.h
Normal file
1209
src/emu/delegate.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -78,6 +78,8 @@ legacy_cpu_device_config::legacy_cpu_device_config(const machine_config &mconfig
|
||||
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));
|
||||
|
@ -347,7 +347,7 @@ protected:
|
||||
// ======================> device_t
|
||||
|
||||
// device_t represents a device that is live and attached to a running_machine
|
||||
class device_t
|
||||
class device_t : public bindable_object
|
||||
{
|
||||
DISABLE_COPYING(device_t);
|
||||
|
||||
|
@ -191,7 +191,7 @@ bool device_config_memory_interface::interface_validity_check(const game_driver
|
||||
::address_map *map = global_alloc(::address_map(*devconfig, spacenum));
|
||||
|
||||
// if this is an empty map, just skip it
|
||||
if (map->m_entrylist == NULL)
|
||||
if (map->m_entrylist.first() == NULL)
|
||||
{
|
||||
global_free(map);
|
||||
continue;
|
||||
@ -210,7 +210,7 @@ bool device_config_memory_interface::interface_validity_check(const game_driver
|
||||
}
|
||||
|
||||
// loop over entries and look for errors
|
||||
for (address_map_entry *entry = map->m_entrylist; entry != NULL; entry = entry->m_next)
|
||||
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);
|
||||
@ -219,12 +219,12 @@ bool device_config_memory_interface::interface_validity_check(const game_driver
|
||||
if (!detected_overlap)
|
||||
{
|
||||
address_map_entry *scan;
|
||||
for (scan = map->m_entrylist; scan != entry; scan = scan->m_next)
|
||||
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.type != AMH_NONE && scan->m_read.type != AMH_NONE) ||
|
||||
(entry->m_write.type != AMH_NONE && scan->m_write.type != AMH_NONE)))
|
||||
((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.type, entry->m_write.type, scan->m_addrstart, scan->m_addrend, scan->m_read.type, scan->m_write.type);
|
||||
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;
|
||||
}
|
||||
@ -245,7 +245,7 @@ bool device_config_memory_interface::interface_validity_check(const game_driver
|
||||
}
|
||||
|
||||
// if this is a program space, auto-assign implicit ROM entries
|
||||
if (entry->m_read.type == AMH_ROM && entry->m_region == NULL)
|
||||
if (entry->m_read.m_type == AMH_ROM && entry->m_region == NULL)
|
||||
{
|
||||
entry->m_region = devconfig->tag();
|
||||
entry->m_rgnoffs = entry->m_addrstart;
|
||||
@ -287,25 +287,25 @@ bool device_config_memory_interface::interface_validity_check(const game_driver
|
||||
}
|
||||
|
||||
// make sure all devices exist
|
||||
if ((entry->m_read.type == AMH_DEVICE_HANDLER && entry->m_read.tag != NULL && m_machine_config.m_devicelist.find(entry->m_read.tag) == NULL) ||
|
||||
(entry->m_write.type == AMH_DEVICE_HANDLER && entry->m_write.tag != NULL && m_machine_config.m_devicelist.find(entry->m_write.tag) == NULL))
|
||||
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.tag);
|
||||
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.type == AMH_PORT && entry->m_read.tag != NULL && portlist.find(entry->m_read.tag) == NULL) ||
|
||||
// (entry->m_write.type == AMH_PORT && entry->m_write.tag != NULL && portlist.find(entry->m_write.tag) == NULL))
|
||||
// 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.type == AMH_BANK && !validate_tag(&driver, "bank", entry->m_read.tag))
|
||||
if (entry->m_read.m_type == AMH_BANK && !validate_tag(&driver, "bank", entry->m_read.m_tag))
|
||||
error = true ;
|
||||
if (entry->m_write.type == AMH_BANK && !validate_tag(&driver, "bank", entry->m_write.tag))
|
||||
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;
|
||||
@ -350,10 +350,10 @@ device_memory_interface::~device_memory_interface()
|
||||
// to a device
|
||||
//-------------------------------------------------
|
||||
|
||||
void device_memory_interface::set_address_space(int spacenum, const address_space *space)
|
||||
void device_memory_interface::set_address_space(int spacenum, address_space &space)
|
||||
{
|
||||
assert(spacenum < ARRAY_LENGTH(m_addrspace));
|
||||
m_addrspace[spacenum] = space;
|
||||
m_addrspace[spacenum] = &space;
|
||||
}
|
||||
|
||||
|
||||
|
@ -100,48 +100,6 @@ const int TRANSLATE_FETCH_DEBUG = (TRANSLATE_FETCH | TRANSLATE_DEBUG_MASK);
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
// ======================> address_space_config
|
||||
|
||||
class address_space_config
|
||||
{
|
||||
public:
|
||||
address_space_config();
|
||||
address_space_config(const char *name, endianness_t endian, UINT8 datawidth, UINT8 addrwidth, INT8 addrshift = 0, address_map_constructor internal = NULL, address_map_constructor defmap = NULL);
|
||||
address_space_config(const char *name, endianness_t endian, UINT8 datawidth, UINT8 addrwidth, INT8 addrshift, UINT8 logwidth, UINT8 pageshift, address_map_constructor internal = NULL, address_map_constructor defmap = NULL);
|
||||
|
||||
inline offs_t addr2byte(offs_t address) const
|
||||
{
|
||||
return (m_addrbus_shift < 0) ? (address << -m_addrbus_shift) : (address >> m_addrbus_shift);
|
||||
}
|
||||
|
||||
inline offs_t addr2byte_end(offs_t address) const
|
||||
{
|
||||
return (m_addrbus_shift < 0) ? ((address << -m_addrbus_shift) | ((1 << -m_addrbus_shift) - 1)) : (address >> m_addrbus_shift);
|
||||
}
|
||||
|
||||
inline offs_t byte2addr(offs_t address) const
|
||||
{
|
||||
return (m_addrbus_shift > 0) ? (address << m_addrbus_shift) : (address >> -m_addrbus_shift);
|
||||
}
|
||||
|
||||
inline offs_t byte2addr_end(offs_t address) const
|
||||
{
|
||||
return (m_addrbus_shift > 0) ? ((address << m_addrbus_shift) | ((1 << -m_addrbus_shift) - 1)) : (address >> -m_addrbus_shift);
|
||||
}
|
||||
|
||||
const char * m_name;
|
||||
endianness_t m_endianness;
|
||||
UINT8 m_databus_width;
|
||||
UINT8 m_addrbus_width;
|
||||
INT8 m_addrbus_shift;
|
||||
UINT8 m_logaddr_width;
|
||||
UINT8 m_page_shift;
|
||||
address_map_constructor m_internal_map;
|
||||
address_map_constructor m_default_map;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// ======================> device_config_memory_interface
|
||||
|
||||
// class representing interface-specific configuration state
|
||||
@ -187,11 +145,11 @@ public:
|
||||
|
||||
// basic information getters
|
||||
const address_space_config *space_config(int spacenum = 0) const { return m_memory_config.space_config(spacenum); }
|
||||
const address_space *space(int index = 0) const { return m_addrspace[index]; }
|
||||
const address_space *space(device_space index) const { return m_addrspace[static_cast<int>(index)]; }
|
||||
address_space *space(int index = 0) const { return m_addrspace[index]; }
|
||||
address_space *space(device_space index) const { return m_addrspace[static_cast<int>(index)]; }
|
||||
|
||||
// address space accessors
|
||||
void set_address_space(int spacenum, const address_space *space);
|
||||
void set_address_space(int spacenum, address_space &space);
|
||||
|
||||
// address translation
|
||||
bool translate(int spacenum, int intention, offs_t &address) { return memory_translate(spacenum, intention, address); }
|
||||
@ -212,7 +170,7 @@ protected:
|
||||
|
||||
// configuration
|
||||
const device_config_memory_interface &m_memory_config; // reference to our device_config_execute_interface
|
||||
const address_space * m_addrspace[ADDRESS_SPACES]; // reported address spaces
|
||||
address_space * m_addrspace[ADDRESS_SPACES]; // reported address spaces
|
||||
};
|
||||
|
||||
|
||||
|
@ -62,6 +62,7 @@
|
||||
#include "attotime.h"
|
||||
#include "fileio.h" // remove me once NVRAM is implemented as device
|
||||
#include "tokenize.h"
|
||||
#include "delegate.h"
|
||||
|
||||
// memory and address spaces
|
||||
#include "memory.h"
|
||||
|
@ -45,6 +45,7 @@ EMUOBJS = \
|
||||
$(EMUOBJ)/config.o \
|
||||
$(EMUOBJ)/crsshair.o \
|
||||
$(EMUOBJ)/debugger.o \
|
||||
$(EMUOBJ)/delegate.o \
|
||||
$(EMUOBJ)/devcb.o \
|
||||
$(EMUOBJ)/devcpu.o \
|
||||
$(EMUOBJ)/devimage.o \
|
||||
|
@ -355,6 +355,100 @@ inline _Dest crosscast(_Source *src)
|
||||
// COMMON TEMPLATES
|
||||
//**************************************************************************
|
||||
|
||||
// ======================> simple_list
|
||||
|
||||
template<class T>
|
||||
class simple_list
|
||||
{
|
||||
DISABLE_COPYING(simple_list);
|
||||
|
||||
T *m_head;
|
||||
T *m_tail;
|
||||
resource_pool &m_pool;
|
||||
int m_count;
|
||||
|
||||
public:
|
||||
simple_list(resource_pool &pool = global_resource_pool) :
|
||||
m_head(NULL),
|
||||
m_tail(NULL),
|
||||
m_pool(pool),
|
||||
m_count(0) { }
|
||||
|
||||
virtual ~simple_list() { reset(); }
|
||||
|
||||
T *first() const { return m_head; }
|
||||
T *last() const { return m_tail; }
|
||||
int count() const { return m_count; }
|
||||
|
||||
void reset() { while (m_head != NULL) remove(*m_head); }
|
||||
|
||||
int index(T *object) const
|
||||
{
|
||||
int num = 0;
|
||||
for (T *cur = m_head; cur != NULL; cur = cur->m_next)
|
||||
if (cur == object)
|
||||
return num;
|
||||
else
|
||||
num++;
|
||||
return -1;
|
||||
}
|
||||
|
||||
T &prepend(T &object)
|
||||
{
|
||||
object.m_next = m_head;
|
||||
m_head = &object;
|
||||
if (m_tail == NULL)
|
||||
m_tail = m_head;
|
||||
m_count++;
|
||||
return object;
|
||||
}
|
||||
|
||||
T &append(T &object)
|
||||
{
|
||||
object.m_next = NULL;
|
||||
if (m_tail != NULL)
|
||||
m_tail = m_tail->m_next = &object;
|
||||
else
|
||||
m_tail = m_head = &object;
|
||||
m_count++;
|
||||
return object;
|
||||
}
|
||||
|
||||
void detach(T &object)
|
||||
{
|
||||
T *prev = NULL;
|
||||
for (T *cur = m_head; cur != NULL; prev = cur, cur = cur->m_next)
|
||||
if (cur == &object)
|
||||
{
|
||||
if (prev != NULL)
|
||||
prev->m_next = object.m_next;
|
||||
else
|
||||
m_head = object.m_next;
|
||||
if (m_tail == &object)
|
||||
m_tail = prev;
|
||||
m_count--;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void remove(T &object)
|
||||
{
|
||||
detach(object);
|
||||
pool_free(m_pool, &object);
|
||||
}
|
||||
|
||||
T *find(int index) const
|
||||
{
|
||||
for (T *cur = m_head; cur != NULL; cur = cur->m_next)
|
||||
if (index-- == 0)
|
||||
return cur;
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// ======================> tagged_list
|
||||
|
||||
template<class T>
|
||||
class tagged_list
|
||||
{
|
||||
|
@ -243,7 +243,7 @@ const char *running_machine::describe_context()
|
||||
{
|
||||
cpu_device *cpu = downcast<cpu_device *>(&executing->device());
|
||||
if (cpu != NULL)
|
||||
m_context.printf("'%s' (%s)", cpu->tag(), core_i64_hex_format(cpu->pc(), cpu->space(AS_PROGRAM)->logaddrchars));
|
||||
m_context.printf("'%s' (%s)", cpu->tag(), core_i64_hex_format(cpu->pc(), cpu->space(AS_PROGRAM)->logaddrchars()));
|
||||
else
|
||||
m_context.printf("'%s'", cpu->tag());
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ typedef tagged_list<region_info> region_list;
|
||||
|
||||
|
||||
// base class for all driver data structures
|
||||
class driver_data_t
|
||||
class driver_data_t : public bindable_object
|
||||
{
|
||||
public:
|
||||
driver_data_t(running_machine &machine);
|
||||
@ -271,7 +271,7 @@ public:
|
||||
|
||||
|
||||
// description of the currently-running machine
|
||||
class running_machine
|
||||
class running_machine : public bindable_object
|
||||
{
|
||||
DISABLE_COPYING(running_machine);
|
||||
|
||||
@ -346,6 +346,7 @@ public:
|
||||
|
||||
// CPU information
|
||||
cpu_device * firstcpu; // first CPU (allows for quick iteration via typenext)
|
||||
address_space * m_nonspecific_space;// a dummy address_space used for legacy compatibility
|
||||
|
||||
// game-related information
|
||||
const game_driver * gamedrv; // points to the definition of the game machine
|
||||
|
@ -816,7 +816,7 @@ INTERRUPT_GEN( irq7_line_assert ) { if (interrupt_enabled(device)) cpu_set_input
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE8_HANDLER( watchdog_reset_w ) { watchdog_reset(space->machine); }
|
||||
READ8_HANDLER( watchdog_reset_r ) { watchdog_reset(space->machine); return space->unmap; }
|
||||
READ8_HANDLER( watchdog_reset_r ) { watchdog_reset(space->machine); return space->unmap(); }
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
@ -824,7 +824,7 @@ READ8_HANDLER( watchdog_reset_r ) { watchdog_reset(space->machine); return space
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE16_HANDLER( watchdog_reset16_w ) { watchdog_reset(space->machine); }
|
||||
READ16_HANDLER( watchdog_reset16_r ) { watchdog_reset(space->machine); return space->unmap; }
|
||||
READ16_HANDLER( watchdog_reset16_r ) { watchdog_reset(space->machine); return space->unmap(); }
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
@ -832,7 +832,7 @@ READ16_HANDLER( watchdog_reset16_r ) { watchdog_reset(space->machine); return sp
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE32_HANDLER( watchdog_reset32_w ) { watchdog_reset(space->machine); }
|
||||
READ32_HANDLER( watchdog_reset32_r ) { watchdog_reset(space->machine); return space->unmap; }
|
||||
READ32_HANDLER( watchdog_reset32_r ) { watchdog_reset(space->machine); return space->unmap(); }
|
||||
|
||||
|
||||
|
||||
|
@ -1819,7 +1819,7 @@ static DEVICE_START( ide_controller )
|
||||
ide->dma_space = memory->space(config->bmspace);
|
||||
if (ide->dma_space == NULL)
|
||||
throw emu_fatalerror("IDE controller '%s' bus master target '%s' does not have specified space %d!", device->tag(), config->bmcpu, config->bmspace);
|
||||
ide->dma_address_xor = (ide->dma_space->endianness == ENDIANNESS_LITTLE) ? 0 : 3;
|
||||
ide->dma_address_xor = (ide->dma_space->endianness() == ENDIANNESS_LITTLE) ? 0 : 3;
|
||||
}
|
||||
|
||||
/* get and copy the geometry */
|
||||
|
7764
src/emu/memory.c
7764
src/emu/memory.c
File diff suppressed because it is too large
Load Diff
1412
src/emu/memory.h
1412
src/emu/memory.h
File diff suppressed because it is too large
Load Diff
@ -159,7 +159,8 @@ okim6295_device::okim6295_device(running_machine &_machine, const okim6295_devic
|
||||
m_bank_installed(false),
|
||||
m_bank_offs(0),
|
||||
m_stream(NULL),
|
||||
m_pin7_state(m_config.m_pin7)
|
||||
m_pin7_state(m_config.m_pin7),
|
||||
m_direct(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@ -170,6 +171,9 @@ okim6295_device::okim6295_device(running_machine &_machine, const okim6295_devic
|
||||
|
||||
void okim6295_device::device_start()
|
||||
{
|
||||
// find our direct access
|
||||
m_direct = &space()->direct();
|
||||
|
||||
// create the stream
|
||||
int divisor = m_config.m_pin7 ? 132 : 165;
|
||||
m_stream = stream_create(this, 0, 1, clock() / divisor, this, static_stream_generate);
|
||||
@ -240,7 +244,7 @@ void okim6295_device::stream_generate(stream_sample_t **inputs, stream_sample_t
|
||||
|
||||
// iterate over voices and accumulate sample data
|
||||
for (int voicenum = 0; voicenum < OKIM6295_VOICES; voicenum++)
|
||||
m_voice[voicenum].generate_adpcm(space(), outputs[0], samples);
|
||||
m_voice[voicenum].generate_adpcm(*m_direct, outputs[0], samples);
|
||||
}
|
||||
|
||||
|
||||
@ -289,10 +293,10 @@ void okim6295_device::set_pin7(int pin7)
|
||||
|
||||
READ8_DEVICE_HANDLER( okim6295_r )
|
||||
{
|
||||
return downcast<okim6295_device *>(device)->status_read();
|
||||
return downcast<okim6295_device *>(device)->read(*device->machine->m_nonspecific_space, offset);
|
||||
}
|
||||
|
||||
UINT8 okim6295_device::status_read()
|
||||
READ8_MEMBER( okim6295_device::read )
|
||||
{
|
||||
UINT8 result = 0xf0; // naname expects bits 4-7 to be 1
|
||||
|
||||
@ -312,10 +316,10 @@ UINT8 okim6295_device::status_read()
|
||||
|
||||
WRITE8_DEVICE_HANDLER( okim6295_w )
|
||||
{
|
||||
downcast<okim6295_device *>(device)->data_write(data);
|
||||
downcast<okim6295_device *>(device)->write(*device->machine->m_nonspecific_space, offset, data);
|
||||
}
|
||||
|
||||
void okim6295_device::data_write(UINT8 data)
|
||||
WRITE8_MEMBER( okim6295_device::write )
|
||||
{
|
||||
// if a command is pending, process the second half
|
||||
if (m_command != -1)
|
||||
@ -337,14 +341,14 @@ void okim6295_device::data_write(UINT8 data)
|
||||
// determine the start/stop positions
|
||||
offs_t base = m_command * 8;
|
||||
|
||||
offs_t start = memory_raw_read_byte(space(), base + 0) << 16;
|
||||
start |= memory_raw_read_byte(space(), base + 1) << 8;
|
||||
start |= memory_raw_read_byte(space(), base + 2) << 0;
|
||||
offs_t start = m_direct->read_raw_byte(base + 0) << 16;
|
||||
start |= m_direct->read_raw_byte(base + 1) << 8;
|
||||
start |= m_direct->read_raw_byte(base + 2) << 0;
|
||||
start &= 0x3ffff;
|
||||
|
||||
offs_t stop = memory_raw_read_byte(space(), base + 3) << 16;
|
||||
stop |= memory_raw_read_byte(space(), base + 4) << 8;
|
||||
stop |= memory_raw_read_byte(space(), base + 5) << 0;
|
||||
offs_t stop = m_direct->read_raw_byte(base + 3) << 16;
|
||||
stop |= m_direct->read_raw_byte(base + 4) << 8;
|
||||
stop |= m_direct->read_raw_byte(base + 5) << 0;
|
||||
stop &= 0x3ffff;
|
||||
|
||||
// set up the voice to play this sample
|
||||
@ -420,7 +424,7 @@ okim6295_device::okim_voice::okim_voice()
|
||||
// add them to an output stream
|
||||
//-------------------------------------------------
|
||||
|
||||
void okim6295_device::okim_voice::generate_adpcm(const address_space *space, stream_sample_t *buffer, int samples)
|
||||
void okim6295_device::okim_voice::generate_adpcm(direct_read_data &direct, stream_sample_t *buffer, int samples)
|
||||
{
|
||||
// skip if not active
|
||||
if (!m_playing)
|
||||
@ -430,7 +434,7 @@ void okim6295_device::okim_voice::generate_adpcm(const address_space *space, str
|
||||
while (samples-- != 0)
|
||||
{
|
||||
// fetch the next sample byte
|
||||
int nibble = memory_raw_read_byte(space, m_base_offset + m_sample / 2) >> (((m_sample & 1) << 2) ^ 4);
|
||||
int nibble = direct.read_raw_byte(m_base_offset + m_sample / 2) >> (((m_sample & 1) << 2) ^ 4);
|
||||
|
||||
// output to the buffer, scaling by the volume
|
||||
// signal in range -2048..2047, volume in range 2..32 => signal * volume / 2 in range -32768..32767
|
||||
|
@ -122,8 +122,8 @@ public:
|
||||
void set_bank_base(offs_t base);
|
||||
void set_pin7(int pin7);
|
||||
|
||||
UINT8 status_read();
|
||||
void data_write(UINT8 data);
|
||||
DECLARE_READ8_MEMBER( read );
|
||||
DECLARE_WRITE8_MEMBER( write );
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
@ -141,7 +141,7 @@ protected:
|
||||
{
|
||||
public:
|
||||
okim_voice();
|
||||
void generate_adpcm(const address_space *space, stream_sample_t *buffer, int samples);
|
||||
void generate_adpcm(direct_read_data &direct, stream_sample_t *buffer, int samples);
|
||||
|
||||
adpcm_state m_adpcm; // current ADPCM state
|
||||
bool m_playing;
|
||||
@ -156,12 +156,13 @@ protected:
|
||||
|
||||
const okim6295_device_config &m_config;
|
||||
|
||||
okim_voice m_voice[OKIM6295_VOICES];
|
||||
INT32 m_command;
|
||||
bool m_bank_installed;
|
||||
offs_t m_bank_offs;
|
||||
sound_stream * m_stream;
|
||||
UINT8 m_pin7_state;
|
||||
okim_voice m_voice[OKIM6295_VOICES];
|
||||
INT32 m_command;
|
||||
bool m_bank_installed;
|
||||
offs_t m_bank_offs;
|
||||
sound_stream * m_stream;
|
||||
UINT8 m_pin7_state;
|
||||
direct_read_data * m_direct;
|
||||
|
||||
static const UINT8 s_volume_table[16];
|
||||
};
|
||||
|
@ -141,7 +141,7 @@ static ADDRESS_MAP_START( williams_adpcm_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x03ff) AM_WRITE(adpcm_bank_select_w)
|
||||
AM_RANGE(0x2400, 0x2401) AM_MIRROR(0x03fe) AM_DEVREADWRITE("ymsnd", ym2151_r, ym2151_w)
|
||||
AM_RANGE(0x2800, 0x2800) AM_MIRROR(0x03ff) AM_DEVWRITE("dac", dac_w)
|
||||
AM_RANGE(0x2c00, 0x2c00) AM_MIRROR(0x03ff) AM_DEVREADWRITE("oki", okim6295_r, okim6295_w)
|
||||
AM_RANGE(0x2c00, 0x2c00) AM_MIRROR(0x03ff) AM_DEVREADWRITE_MEMBER("oki", okim6295_device, read, write)
|
||||
AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x03ff) AM_READ(adpcm_command_r)
|
||||
AM_RANGE(0x3400, 0x3400) AM_MIRROR(0x03ff) AM_DEVWRITE("oki", adpcm_6295_bank_select_w)
|
||||
AM_RANGE(0x3c00, 0x3c00) AM_MIRROR(0x03ff) AM_WRITE(adpcm_talkback_w)
|
||||
|
@ -138,12 +138,12 @@ static WRITE16_HANDLER( mo_command_w )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static DIRECT_UPDATE_HANDLER( sloop_direct_handler )
|
||||
DIRECT_UPDATE_HANDLER( atarig42_sloop_direct_handler )
|
||||
{
|
||||
atarig42_state *state = space->machine->driver_data<atarig42_state>();
|
||||
if (address < 0x80000)
|
||||
{
|
||||
direct->raw = direct->decrypted = (UINT8 *)state->sloop_base;
|
||||
atarig42_state *state = machine->driver_data<atarig42_state>();
|
||||
direct.explicit_configure(0x00000, 0x7ffff, 0x7ffff, state->sloop_base);
|
||||
return (offs_t)-1;
|
||||
}
|
||||
return address;
|
||||
@ -696,8 +696,9 @@ static DRIVER_INIT( roadriot )
|
||||
state->motion_object_base = 0x200;
|
||||
state->motion_object_mask = 0x1ff;
|
||||
|
||||
state->sloop_base = memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, roadriot_sloop_data_r, roadriot_sloop_data_w);
|
||||
memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), sloop_direct_handler);
|
||||
address_space *main = machine->device<m68000_device>("maincpu")->space(AS_PROGRAM);
|
||||
state->sloop_base = memory_install_readwrite16_handler(main, 0x000000, 0x07ffff, 0, 0, roadriot_sloop_data_r, roadriot_sloop_data_w);
|
||||
main->set_direct_update_handler(direct_update_delegate_create_static(atarig42_sloop_direct_handler, *machine));
|
||||
|
||||
asic65_config(machine, ASIC65_ROMBASED);
|
||||
/*
|
||||
@ -750,8 +751,9 @@ static DRIVER_INIT( guardian )
|
||||
/* put an RTS there so we don't die */
|
||||
*(UINT16 *)&memory_region(machine, "maincpu")[0x80000] = 0x4E75;
|
||||
|
||||
state->sloop_base = memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, guardians_sloop_data_r, guardians_sloop_data_w);
|
||||
memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), sloop_direct_handler);
|
||||
address_space *main = machine->device<m68000_device>("maincpu")->space(AS_PROGRAM);
|
||||
state->sloop_base = memory_install_readwrite16_handler(main, 0x000000, 0x07ffff, 0, 0, guardians_sloop_data_r, guardians_sloop_data_w);
|
||||
main->set_direct_update_handler(direct_update_delegate_create_static(atarig42_sloop_direct_handler, *machine));
|
||||
|
||||
asic65_config(machine, ASIC65_GUARDIANS);
|
||||
/*
|
||||
|
@ -208,14 +208,13 @@ static void scanline_update(screen_device &screen, int scanline)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static DIRECT_UPDATE_HANDLER( atarisy2_direct_handler )
|
||||
DIRECT_UPDATE_HANDLER( atarisy2_direct_handler )
|
||||
{
|
||||
atarisy2_state *state = space->machine->driver_data<atarisy2_state>();
|
||||
|
||||
/* make sure slapstic area looks like ROM */
|
||||
if (address >= 0x8000 && address < 0x8200)
|
||||
{
|
||||
direct->raw = direct->decrypted = (UINT8 *)state->slapstic_base - 0x8000;
|
||||
atarisy2_state *state = machine->driver_data<atarisy2_state>();
|
||||
direct.explicit_configure(0x8000, 0x81ff, 0x1ff, (UINT8 *)state->slapstic_base);
|
||||
return ~0;
|
||||
}
|
||||
return address;
|
||||
@ -245,7 +244,9 @@ static MACHINE_RESET( atarisy2 )
|
||||
atarigen_interrupt_reset(state, update_interrupts);
|
||||
atarigen_sound_io_reset(machine->device("soundcpu"));
|
||||
atarigen_scanline_timer_reset(*machine->primary_screen, scanline_update, 64);
|
||||
memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), atarisy2_direct_handler);
|
||||
|
||||
address_space *main = machine->device<t11_device>("maincpu")->space(AS_PROGRAM);
|
||||
main->set_direct_update_handler(direct_update_delegate_create_static(atarisy2_direct_handler, *machine));
|
||||
|
||||
state->p2portwr_state = 0;
|
||||
state->p2portrd_state = 0;
|
||||
|
@ -98,9 +98,6 @@
|
||||
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/asap/asap.h"
|
||||
#include "machine/atarigen.h"
|
||||
#include "audio/atarijsa.h"
|
||||
#include "includes/beathead.h"
|
||||
|
||||
|
||||
@ -115,8 +112,6 @@
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void update_interrupts(running_machine *machine);
|
||||
|
||||
static TIMER_DEVICE_CALLBACK( scanline_callback )
|
||||
{
|
||||
beathead_state *state = timer.machine->driver_data<beathead_state>();
|
||||
@ -135,11 +130,11 @@ static TIMER_DEVICE_CALLBACK( scanline_callback )
|
||||
scanline = 0;
|
||||
|
||||
/* set the scanline IRQ */
|
||||
state->irq_state[2] = 1;
|
||||
update_interrupts(timer.machine);
|
||||
state->m_irq_state[2] = 1;
|
||||
state->update_interrupts();
|
||||
|
||||
/* set the timer for the next one */
|
||||
timer.adjust(double_to_attotime(attotime_to_double(timer.machine->primary_screen->time_until_pos(scanline)) - state->hblank_offset), scanline);
|
||||
timer.adjust(double_to_attotime(attotime_to_double(timer.machine->primary_screen->time_until_pos(scanline)) - state->m_hblank_offset), scanline);
|
||||
}
|
||||
|
||||
|
||||
@ -149,6 +144,7 @@ static MACHINE_START( beathead )
|
||||
}
|
||||
|
||||
|
||||
static void update_interrupts(running_machine *machine) { machine->driver_data<beathead_state>()->update_interrupts(); }
|
||||
static MACHINE_RESET( beathead )
|
||||
{
|
||||
beathead_state *state = machine->driver_data<beathead_state>();
|
||||
@ -160,17 +156,17 @@ static MACHINE_RESET( beathead )
|
||||
|
||||
/* the code is temporarily mapped at 0 at startup */
|
||||
/* just copying the first 0x40 bytes is sufficient */
|
||||
memcpy(state->ram_base, state->rom_base, 0x40);
|
||||
memcpy(state->m_ram_base, state->m_rom_base, 0x40);
|
||||
|
||||
/* compute the timing of the HBLANK interrupt and set the first timer */
|
||||
state->hblank_offset = attotime_to_double(machine->primary_screen->scan_period()) * ((455. - 336. - 25.) / 455.);
|
||||
state->m_hblank_offset = attotime_to_double(machine->primary_screen->scan_period()) * ((455. - 336. - 25.) / 455.);
|
||||
timer_device *scanline_timer = machine->device<timer_device>("scan_timer");
|
||||
scanline_timer->adjust(double_to_attotime(attotime_to_double(machine->primary_screen->time_until_pos(0)) - state->hblank_offset));
|
||||
scanline_timer->adjust(double_to_attotime(attotime_to_double(machine->primary_screen->time_until_pos(0)) - state->m_hblank_offset));
|
||||
|
||||
/* reset IRQs */
|
||||
state->irq_line_state = CLEAR_LINE;
|
||||
state->irq_state[0] = state->irq_state[1] = state->irq_state[2] = 0;
|
||||
state->irq_enable[0] = state->irq_enable[1] = state->irq_enable[2] = 0;
|
||||
state->m_irq_line_state = CLEAR_LINE;
|
||||
state->m_irq_state[0] = state->m_irq_state[1] = state->m_irq_state[2] = 0;
|
||||
state->m_irq_enable[0] = state->m_irq_enable[1] = state->m_irq_enable[2] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -181,54 +177,50 @@ static MACHINE_RESET( beathead )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void update_interrupts(running_machine *machine)
|
||||
void beathead_state::update_interrupts()
|
||||
{
|
||||
beathead_state *state = machine->driver_data<beathead_state>();
|
||||
int gen_int;
|
||||
|
||||
/* compute the combined interrupt signal */
|
||||
gen_int = state->irq_state[0] & state->irq_enable[0];
|
||||
gen_int |= state->irq_state[1] & state->irq_enable[1];
|
||||
gen_int |= state->irq_state[2] & state->irq_enable[2];
|
||||
gen_int = m_irq_state[0] & m_irq_enable[0];
|
||||
gen_int |= m_irq_state[1] & m_irq_enable[1];
|
||||
gen_int |= m_irq_state[2] & m_irq_enable[2];
|
||||
gen_int = gen_int ? ASSERT_LINE : CLEAR_LINE;
|
||||
|
||||
/* if it's changed since the last time, call through */
|
||||
if (state->irq_line_state != gen_int)
|
||||
if (m_irq_line_state != gen_int)
|
||||
{
|
||||
state->irq_line_state = gen_int;
|
||||
//if (state->irq_line_state != CLEAR_LINE)
|
||||
cputag_set_input_line(machine, "maincpu", ASAP_IRQ0, state->irq_line_state);
|
||||
m_irq_line_state = gen_int;
|
||||
//if (m_irq_line_state != CLEAR_LINE)
|
||||
cputag_set_input_line(&m_machine, "maincpu", ASAP_IRQ0, m_irq_line_state);
|
||||
//else
|
||||
//asap_set_irq_line(ASAP_IRQ0, state->irq_line_state);
|
||||
//asap_set_irq_line(ASAP_IRQ0, m_irq_line_state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static WRITE32_HANDLER( interrupt_control_w )
|
||||
WRITE32_MEMBER( beathead_state::interrupt_control_w )
|
||||
{
|
||||
beathead_state *state = space->machine->driver_data<beathead_state>();
|
||||
int irq = offset & 3;
|
||||
int control = (offset >> 2) & 1;
|
||||
|
||||
/* offsets 1-3 seem to be the enable latches for the IRQs */
|
||||
if (irq != 0)
|
||||
state->irq_enable[irq - 1] = control;
|
||||
m_irq_enable[irq - 1] = control;
|
||||
|
||||
/* offset 0 seems to be the interrupt ack */
|
||||
else
|
||||
state->irq_state[0] = state->irq_state[1] = state->irq_state[2] = 0;
|
||||
m_irq_state[0] = m_irq_state[1] = m_irq_state[2] = 0;
|
||||
|
||||
/* update the current state */
|
||||
update_interrupts(space->machine);
|
||||
update_interrupts();
|
||||
}
|
||||
|
||||
|
||||
static READ32_HANDLER( interrupt_control_r )
|
||||
READ32_MEMBER( beathead_state::interrupt_control_r )
|
||||
{
|
||||
beathead_state *state = space->machine->driver_data<beathead_state>();
|
||||
|
||||
/* return the enables as a bitfield */
|
||||
return (state->irq_enable[0]) | (state->irq_enable[1] << 1) | (state->irq_enable[2] << 2);
|
||||
return (m_irq_enable[0]) | (m_irq_enable[1] << 1) | (m_irq_enable[2] << 2);
|
||||
}
|
||||
|
||||
|
||||
@ -239,24 +231,20 @@ static READ32_HANDLER( interrupt_control_r )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static WRITE32_HANDLER( eeprom_data_w )
|
||||
WRITE32_MEMBER( beathead_state::eeprom_data_w )
|
||||
{
|
||||
beathead_state *state = space->machine->driver_data<beathead_state>();
|
||||
|
||||
if (state->eeprom_enabled)
|
||||
if (m_eeprom_enabled)
|
||||
{
|
||||
mem_mask &= 0x000000ff;
|
||||
COMBINE_DATA(space->machine->generic.nvram.u32 + offset);
|
||||
state->eeprom_enabled = 0;
|
||||
COMBINE_DATA(m_machine.generic.nvram.u32 + offset);
|
||||
m_eeprom_enabled = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static WRITE32_HANDLER( eeprom_enable_w )
|
||||
WRITE32_MEMBER( beathead_state::eeprom_enable_w )
|
||||
{
|
||||
beathead_state *state = space->machine->driver_data<beathead_state>();
|
||||
|
||||
state->eeprom_enabled = 1;
|
||||
m_eeprom_enabled = 1;
|
||||
}
|
||||
|
||||
|
||||
@ -267,12 +255,11 @@ static WRITE32_HANDLER( eeprom_enable_w )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static READ32_HANDLER( input_2_r )
|
||||
READ32_MEMBER( beathead_state::input_2_r )
|
||||
{
|
||||
beathead_state *state = space->machine->driver_data<beathead_state>();
|
||||
int result = input_port_read(space->machine, "IN2");
|
||||
if (state->sound_to_cpu_ready) result ^= 0x10;
|
||||
if (state->cpu_to_sound_ready) result ^= 0x20;
|
||||
int result = input_port_read(&m_machine, "IN2");
|
||||
if (sound_to_cpu_ready) result ^= 0x10;
|
||||
if (cpu_to_sound_ready) result ^= 0x20;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -284,23 +271,23 @@ static READ32_HANDLER( input_2_r )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static READ32_HANDLER( sound_data_r )
|
||||
READ32_MEMBER( beathead_state::sound_data_r )
|
||||
{
|
||||
return atarigen_sound_r(space,offset,0xffff);
|
||||
return atarigen_sound_r(&space, offset, 0xffff);
|
||||
}
|
||||
|
||||
|
||||
static WRITE32_HANDLER( sound_data_w )
|
||||
WRITE32_MEMBER( beathead_state::sound_data_w )
|
||||
{
|
||||
if (ACCESSING_BITS_0_7)
|
||||
atarigen_sound_w(space,offset, data, mem_mask);
|
||||
atarigen_sound_w(&space, offset, data, mem_mask);
|
||||
}
|
||||
|
||||
|
||||
static WRITE32_HANDLER( sound_reset_w )
|
||||
WRITE32_MEMBER( beathead_state::sound_reset_w )
|
||||
{
|
||||
logerror("Sound reset = %d\n", !offset);
|
||||
cputag_set_input_line(space->machine, "jsa", INPUT_LINE_RESET, offset ? CLEAR_LINE : ASSERT_LINE);
|
||||
cputag_set_input_line(&m_machine, "jsa", INPUT_LINE_RESET, offset ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -311,9 +298,9 @@ static WRITE32_HANDLER( sound_reset_w )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static WRITE32_HANDLER( coin_count_w )
|
||||
WRITE32_MEMBER( beathead_state::coin_count_w )
|
||||
{
|
||||
coin_counter_w(space->machine, 0, !offset);
|
||||
coin_counter_w(&m_machine, 0, !offset);
|
||||
}
|
||||
|
||||
|
||||
@ -325,31 +312,31 @@ static WRITE32_HANDLER( coin_count_w )
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x00000000, 0x0001ffff) AM_RAM AM_BASE_MEMBER(beathead_state, ram_base)
|
||||
AM_RANGE(0x01800000, 0x01bfffff) AM_ROM AM_REGION("user1", 0) AM_BASE_MEMBER(beathead_state, rom_base)
|
||||
AM_RANGE(0x40000000, 0x400007ff) AM_RAM_WRITE(eeprom_data_w) AM_BASE_SIZE_GENERIC(nvram)
|
||||
AM_RANGE(0x41000000, 0x41000003) AM_READWRITE(sound_data_r, sound_data_w)
|
||||
AM_RANGE(0x41000100, 0x41000103) AM_READ(interrupt_control_r)
|
||||
AM_RANGE(0x41000100, 0x4100011f) AM_WRITE(interrupt_control_w)
|
||||
AM_RANGE(0x00000000, 0x0001ffff) AM_RAM AM_BASE_MEMBER(beathead_state, m_ram_base)
|
||||
AM_RANGE(0x01800000, 0x01bfffff) AM_ROM AM_REGION("user1", 0) AM_BASE_MEMBER(beathead_state, m_rom_base)
|
||||
AM_RANGE(0x40000000, 0x400007ff) AM_RAM_WRITE_MEMBER(beathead_state, eeprom_data_w) AM_BASE_SIZE_GENERIC(nvram)
|
||||
AM_RANGE(0x41000000, 0x41000003) AM_READWRITE_MEMBER(beathead_state, sound_data_r, sound_data_w)
|
||||
AM_RANGE(0x41000100, 0x41000103) AM_READ_MEMBER(beathead_state, interrupt_control_r)
|
||||
AM_RANGE(0x41000100, 0x4100011f) AM_WRITE_MEMBER(beathead_state, interrupt_control_w)
|
||||
AM_RANGE(0x41000200, 0x41000203) AM_READ_PORT("IN1")
|
||||
AM_RANGE(0x41000204, 0x41000207) AM_READ_PORT("IN0")
|
||||
AM_RANGE(0x41000208, 0x4100020f) AM_WRITE(sound_reset_w)
|
||||
AM_RANGE(0x41000220, 0x41000227) AM_WRITE(coin_count_w)
|
||||
AM_RANGE(0x41000300, 0x41000303) AM_READ(input_2_r)
|
||||
AM_RANGE(0x41000208, 0x4100020f) AM_WRITE_MEMBER(beathead_state, sound_reset_w)
|
||||
AM_RANGE(0x41000220, 0x41000227) AM_WRITE_MEMBER(beathead_state, coin_count_w)
|
||||
AM_RANGE(0x41000300, 0x41000303) AM_READ_MEMBER(beathead_state, input_2_r)
|
||||
AM_RANGE(0x41000304, 0x41000307) AM_READ_PORT("IN3")
|
||||
AM_RANGE(0x41000400, 0x41000403) AM_WRITEONLY AM_BASE_MEMBER(beathead_state, palette_select)
|
||||
AM_RANGE(0x41000500, 0x41000503) AM_WRITE(eeprom_enable_w)
|
||||
AM_RANGE(0x41000600, 0x41000603) AM_WRITE(beathead_finescroll_w)
|
||||
AM_RANGE(0x41000400, 0x41000403) AM_WRITEONLY AM_BASE_MEMBER(beathead_state, m_palette_select)
|
||||
AM_RANGE(0x41000500, 0x41000503) AM_WRITE_MEMBER(beathead_state, eeprom_enable_w)
|
||||
AM_RANGE(0x41000600, 0x41000603) AM_WRITE_MEMBER(beathead_state, finescroll_w)
|
||||
AM_RANGE(0x41000700, 0x41000703) AM_WRITE(watchdog_reset32_w)
|
||||
AM_RANGE(0x42000000, 0x4201ffff) AM_RAM_WRITE(beathead_palette_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0x43000000, 0x43000007) AM_READWRITE(beathead_hsync_ram_r, beathead_hsync_ram_w)
|
||||
AM_RANGE(0x42000000, 0x4201ffff) AM_RAM_WRITE_MEMBER(beathead_state, palette_w) AM_BASE_MEMBER(beathead_state, m_paletteram)
|
||||
AM_RANGE(0x43000000, 0x43000007) AM_READWRITE_MEMBER(beathead_state, hsync_ram_r, hsync_ram_w)
|
||||
AM_RANGE(0x8df80000, 0x8df80003) AM_READNOP /* noisy x4 during scanline int */
|
||||
AM_RANGE(0x8f380000, 0x8f3fffff) AM_WRITE(beathead_vram_latch_w)
|
||||
AM_RANGE(0x8f900000, 0x8f97ffff) AM_WRITE(beathead_vram_transparent_w)
|
||||
AM_RANGE(0x8f980000, 0x8f9fffff) AM_RAM AM_BASE_GENERIC(videoram)
|
||||
AM_RANGE(0x8fb80000, 0x8fbfffff) AM_WRITE(beathead_vram_bulk_w)
|
||||
AM_RANGE(0x8fff8000, 0x8fff8003) AM_WRITEONLY AM_BASE_MEMBER(beathead_state, vram_bulk_latch)
|
||||
AM_RANGE(0x9e280000, 0x9e2fffff) AM_WRITE(beathead_vram_copy_w)
|
||||
AM_RANGE(0x8f380000, 0x8f3fffff) AM_WRITE_MEMBER(beathead_state, vram_latch_w)
|
||||
AM_RANGE(0x8f900000, 0x8f97ffff) AM_WRITE_MEMBER(beathead_state, vram_transparent_w)
|
||||
AM_RANGE(0x8f980000, 0x8f9fffff) AM_RAM AM_BASE_MEMBER(beathead_state, m_videoram)
|
||||
AM_RANGE(0x8fb80000, 0x8fbfffff) AM_WRITE_MEMBER(beathead_state, vram_bulk_w)
|
||||
AM_RANGE(0x8fff8000, 0x8fff8003) AM_WRITEONLY AM_BASE_MEMBER(beathead_state, m_vram_bulk_latch)
|
||||
AM_RANGE(0x9e280000, 0x9e2fffff) AM_WRITE_MEMBER(beathead_state, vram_copy_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
@ -480,26 +467,24 @@ ROM_END
|
||||
*/
|
||||
|
||||
|
||||
static UINT32 *speedup_data;
|
||||
static READ32_HANDLER( speedup_r )
|
||||
READ32_MEMBER( beathead_state::speedup_r )
|
||||
{
|
||||
int result = *speedup_data;
|
||||
if ((cpu_get_previouspc(space->cpu) & 0xfffff) == 0x006f0 && result == cpu_get_reg(space->cpu, ASAP_R3))
|
||||
cpu_spinuntil_int(space->cpu);
|
||||
int result = *m_speedup_data;
|
||||
if ((cpu_get_previouspc(space.cpu) & 0xfffff) == 0x006f0 && result == cpu_get_reg(space.cpu, ASAP_R3))
|
||||
cpu_spinuntil_int(space.cpu);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static UINT32 *movie_speedup_data;
|
||||
static READ32_HANDLER( movie_speedup_r )
|
||||
READ32_MEMBER( beathead_state::movie_speedup_r )
|
||||
{
|
||||
int result = *movie_speedup_data;
|
||||
if ((cpu_get_previouspc(space->cpu) & 0xfffff) == 0x00a88 && (cpu_get_reg(space->cpu, ASAP_R28) & 0xfffff) == 0x397c0 &&
|
||||
movie_speedup_data[4] == cpu_get_reg(space->cpu, ASAP_R1))
|
||||
int result = *m_movie_speedup_data;
|
||||
if ((cpu_get_previouspc(space.cpu) & 0xfffff) == 0x00a88 && (cpu_get_reg(space.cpu, ASAP_R28) & 0xfffff) == 0x397c0 &&
|
||||
m_movie_speedup_data[4] == cpu_get_reg(space.cpu, ASAP_R1))
|
||||
{
|
||||
UINT32 temp = (INT16)result + movie_speedup_data[4] * 262;
|
||||
if (temp - (UINT32)cpu_get_reg(space->cpu, ASAP_R15) < (UINT32)cpu_get_reg(space->cpu, ASAP_R23))
|
||||
cpu_spinuntil_int(space->cpu);
|
||||
UINT32 temp = (INT16)result + m_movie_speedup_data[4] * 262;
|
||||
if (temp - (UINT32)cpu_get_reg(space.cpu, ASAP_R15) < (UINT32)cpu_get_reg(space.cpu, ASAP_R23))
|
||||
cpu_spinuntil_int(space.cpu);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -514,12 +499,14 @@ static READ32_HANDLER( movie_speedup_r )
|
||||
|
||||
static DRIVER_INIT( beathead )
|
||||
{
|
||||
beathead_state *state = machine->driver_data<beathead_state>();
|
||||
|
||||
/* initialize the common systems */
|
||||
atarijsa_init(machine, "IN2", 0x0040);
|
||||
|
||||
/* prepare the speedups */
|
||||
speedup_data = memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x00000ae8, 0x00000aeb, 0, 0, speedup_r);
|
||||
movie_speedup_data = memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x00000804, 0x00000807, 0, 0, movie_speedup_r);
|
||||
state->m_speedup_data = state->m_maincpu.space(AS_PROGRAM)->install_handler(0x00000ae8, 0x00000aeb, 0, 0, read32_delegate_create(beathead_state, speedup_r, *state));
|
||||
state->m_movie_speedup_data = state->m_maincpu.space(AS_PROGRAM)->install_handler(0x00000804, 0x00000807, 0, 0, read32_delegate_create(beathead_state, movie_speedup_r, *state));
|
||||
}
|
||||
|
||||
|
||||
|
@ -607,7 +607,7 @@ INLINE void cps3_drawgfxzoom(bitmap_t *dest_bmp,const rectangle *clip,const gfx_
|
||||
|
||||
|
||||
|
||||
static DIRECT_UPDATE_HANDLER( cps3_direct_handler );
|
||||
DIRECT_UPDATE_HANDLER( cps3_direct_handler );
|
||||
|
||||
/* Encryption */
|
||||
|
||||
@ -706,7 +706,9 @@ static DRIVER_INIT( cps3 )
|
||||
|
||||
|
||||
cps3_0xc0000000_ram_decrypted = auto_alloc_array(machine, UINT32, 0x400/4);
|
||||
memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), cps3_direct_handler);
|
||||
|
||||
address_space *main = machine->device<sh2_device>("maincpu")->space(AS_PROGRAM);
|
||||
main->set_direct_update_handler(direct_update_delegate_create_static(cps3_direct_handler, *machine));
|
||||
|
||||
// flash roms
|
||||
|
||||
@ -1263,38 +1265,37 @@ static WRITE32_HANDLER( cps3_0xc0000000_ram_w )
|
||||
|
||||
|
||||
|
||||
static DIRECT_UPDATE_HANDLER( cps3_direct_handler )
|
||||
DIRECT_UPDATE_HANDLER( cps3_direct_handler )
|
||||
{
|
||||
// if(DEBUG_PRINTF) printf("address %04x\n",address);
|
||||
|
||||
/* BIOS ROM */
|
||||
if (address < 0x80000)
|
||||
{
|
||||
direct->raw = direct->decrypted = memory_region(space->machine, "user1");
|
||||
direct.explicit_configure(0x00000, 0x7ffff, 0x7ffff, *direct.space().m_machine.region("user1"));
|
||||
return ~0;
|
||||
}
|
||||
/* RAM */
|
||||
else if (address >= 0x06000000 && address <= 0x06ffffff)
|
||||
{
|
||||
direct->decrypted = (UINT8*)decrypted_gamerom-0x06000000;
|
||||
direct->raw = (UINT8*)decrypted_gamerom-0x06000000;
|
||||
UINT8 *decrypted = (UINT8*)decrypted_gamerom;
|
||||
UINT8 *raw = decrypted;
|
||||
|
||||
if (cps3_altEncryption) direct->raw = (UINT8*) cps3_user4region-0x06000000;
|
||||
if (cps3_altEncryption) raw = (UINT8*) cps3_user4region;
|
||||
|
||||
direct.explicit_configure(0x06000000, 0x06ffffff, 0x00ffffff, raw, decrypted);
|
||||
|
||||
return ~0;
|
||||
}
|
||||
else if (address >= 0xc0000000 && address <= 0xc00003ff)
|
||||
{
|
||||
//direct->decrypted = (void*)cps3_0xc0000000_ram_decrypted;
|
||||
direct->decrypted = (UINT8*)cps3_0xc0000000_ram_decrypted-0xc0000000;
|
||||
direct->raw = (UINT8*)cps3_0xc0000000_ram-0xc0000000;
|
||||
direct.explicit_configure(0xc0000000, 0xc00003ff, 0x3ff, (UINT8*)cps3_0xc0000000_ram, (UINT8*)cps3_0xc0000000_ram_decrypted);
|
||||
return ~0;
|
||||
}
|
||||
|
||||
/* anything else falls through to NOPs */
|
||||
direct->decrypted = (UINT8*)cps3_nops-address;
|
||||
direct->raw = (UINT8*)cps3_nops-address;
|
||||
direct.explicit_configure(address, address, 0, (UINT8*)cps3_nops, (UINT8*)cps3_nops);
|
||||
return ~0;
|
||||
}
|
||||
|
||||
|
@ -1106,9 +1106,9 @@ ADDRESS_MAP_END
|
||||
#define KL5C_MMU_A(xxx) ( (xxx==0) ? 0x0000 : (hng64_com_mmu_mem[((xxx-1)*2)+1] << 2) | ((hng64_com_mmu_mem[(xxx-1)*2] & 0xc0) >> 6) )
|
||||
#define KL5C_MMU_B(xxx) ( (xxx==0) ? 0x0000 : (hng64_com_mmu_mem[(xxx-1)*2] & 0x3f) )
|
||||
|
||||
static DIRECT_UPDATE_HANDLER( KL5C80_direct_handler )
|
||||
DIRECT_UPDATE_HANDLER( KL5C80_direct_handler )
|
||||
{
|
||||
direct->raw = direct->decrypted = hng64_com_op_base;
|
||||
direct.explicit_configure(0x0000, 0xffff, 0xffff, hng64_com_op_base);
|
||||
return ~0;
|
||||
}
|
||||
|
||||
@ -1677,7 +1677,9 @@ static MACHINE_RESET(hyperneo)
|
||||
hng64_com_virtual_mem[i] = rom[i];
|
||||
|
||||
KL5C80_virtual_mem_sync();
|
||||
memory_set_direct_update_handler(cputag_get_address_space(machine, "comm", ADDRESS_SPACE_PROGRAM), KL5C80_direct_handler);
|
||||
|
||||
address_space *space = machine->device<z80_device>("comm")->space(AS_PROGRAM);
|
||||
space->set_direct_update_handler(direct_update_delegate_create_static(KL5C80_direct_handler, *machine));
|
||||
|
||||
cputag_set_input_line(machine, "comm", INPUT_LINE_RESET, PULSE_LINE); // reset the CPU and let 'er rip
|
||||
// cputag_set_input_line(machine, "comm", INPUT_LINE_HALT, ASSERT_LINE); // hold on there pardner...
|
||||
|
@ -445,7 +445,7 @@ static TIMER_CALLBACK( adjust_cpu_speed )
|
||||
}
|
||||
|
||||
|
||||
static DIRECT_UPDATE_HANDLER( missile_direct_handler )
|
||||
DIRECT_UPDATE_HANDLER( missile_direct_handler )
|
||||
{
|
||||
/* offset accounts for lack of A15 decoding */
|
||||
int offset = address & 0x8000;
|
||||
@ -454,14 +454,14 @@ static DIRECT_UPDATE_HANDLER( missile_direct_handler )
|
||||
/* RAM? */
|
||||
if (address < 0x4000)
|
||||
{
|
||||
direct->raw = direct->decrypted = space->machine->generic.videoram.u8 - offset;
|
||||
direct.explicit_configure(0x0000 | offset, 0x3fff | offset, 0x3fff, direct.space().m_machine.generic.videoram.u8);
|
||||
return ~0;
|
||||
}
|
||||
|
||||
/* ROM? */
|
||||
else if (address >= 0x5000)
|
||||
{
|
||||
direct->raw = direct->decrypted = memory_region(space->machine, "maincpu") - offset;
|
||||
direct.explicit_configure(0x5000 | offset, 0x7fff | offset, 0x7fff, direct.space().m_machine.region("maincpu")->base() + 0x5000);
|
||||
return ~0;
|
||||
}
|
||||
|
||||
@ -477,7 +477,8 @@ static MACHINE_START( missile )
|
||||
flipscreen = 0;
|
||||
|
||||
/* set up an opcode base handler since we use mapped handlers for RAM */
|
||||
memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), missile_direct_handler);
|
||||
address_space *space = machine->device<m6502_device>("maincpu")->space(AS_PROGRAM);
|
||||
space->set_direct_update_handler(direct_update_delegate_create_static(missile_direct_handler, *machine));
|
||||
|
||||
/* create a timer to speed/slow the CPU */
|
||||
cpu_timer = timer_alloc(machine, adjust_cpu_speed, NULL);
|
||||
|
@ -319,26 +319,26 @@ static READ16_HANDLER( dsp56k_bootload_r )
|
||||
return 0x7fff;
|
||||
}
|
||||
|
||||
static DIRECT_UPDATE_HANDLER( plygonet_dsp56k_direct_handler )
|
||||
DIRECT_UPDATE_HANDLER( plygonet_dsp56k_direct_handler )
|
||||
{
|
||||
polygonet_state *state = space->machine->driver_data<polygonet_state>();
|
||||
polygonet_state *state = machine->driver_data<polygonet_state>();
|
||||
|
||||
/* Call the dsp's update handler first */
|
||||
if (state->dsp56k_update_handler != NULL)
|
||||
if (!state->dsp56k_update_handler.isnull())
|
||||
{
|
||||
if ((*state->dsp56k_update_handler)(space, address, direct) == ~0)
|
||||
if (state->dsp56k_update_handler(direct, address) == ~0)
|
||||
return ~0;
|
||||
}
|
||||
|
||||
/* If the requested region wasn't in there, see if it needs to be caught driver-side */
|
||||
if (address >= (0x7000<<1) && address <= (0x7fff<<1))
|
||||
{
|
||||
direct->raw = direct->decrypted = (UINT8*)(state->dsp56k_p_mirror) - (0x7000<<1);
|
||||
direct.explicit_configure(0x7000<<1, 0x7fff<<1, 0xfff<<1, state->dsp56k_p_mirror);
|
||||
return ~0;
|
||||
}
|
||||
else if (address >= (0x8000<<1) && address <= (0x87ff<<1))
|
||||
{
|
||||
direct->raw = direct->decrypted = (UINT8*)(state->dsp56k_p_8000) - (0x8000<<1);
|
||||
direct.explicit_configure(0x8000<<1, 0x87ff<<1, 0x7ff<<1, state->dsp56k_p_8000);
|
||||
return ~0;
|
||||
}
|
||||
|
||||
@ -764,7 +764,8 @@ static DRIVER_INIT(polygonet)
|
||||
state->dsp56k_bank04_ram = auto_alloc_array_clear(machine, UINT16, 2 * 8 * dsp56k_bank04_size);
|
||||
|
||||
/* The dsp56k occasionally executes out of mapped memory */
|
||||
state->dsp56k_update_handler = memory_set_direct_update_handler(cputag_get_address_space(machine, "dsp", ADDRESS_SPACE_PROGRAM), plygonet_dsp56k_direct_handler);
|
||||
address_space *space = machine->device<dsp56k_device>("dsp")->space(AS_PROGRAM);
|
||||
state->dsp56k_update_handler = space->set_direct_update_handler(direct_update_delegate_create_static(plygonet_dsp56k_direct_handler, *machine));
|
||||
|
||||
/* save states */
|
||||
state_save_register_global_pointer(machine, state->dsp56k_bank00_ram, 2 * 8 * dsp56k_bank00_size);
|
||||
|
@ -127,12 +127,12 @@ static WRITE8_HANDLER( esb_slapstic_w )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static DIRECT_UPDATE_HANDLER( esb_setdirect )
|
||||
DIRECT_UPDATE_HANDLER( esb_setdirect )
|
||||
{
|
||||
/* if we are in the slapstic region, process it */
|
||||
if ((address & 0xe000) == 0x8000)
|
||||
{
|
||||
offs_t pc = cpu_get_pc(space->cpu);
|
||||
offs_t pc = cpu_get_pc(&direct.space().device());
|
||||
|
||||
/* filter out duplicates; we get these because the handler gets called for
|
||||
multiple reasons:
|
||||
@ -143,7 +143,7 @@ static DIRECT_UPDATE_HANDLER( esb_setdirect )
|
||||
{
|
||||
slapstic_last_pc = pc;
|
||||
slapstic_last_address = address;
|
||||
esb_slapstic_tweak(space, address & 0x1fff);
|
||||
esb_slapstic_tweak(&direct.space(), address & 0x1fff);
|
||||
}
|
||||
return ~0;
|
||||
}
|
||||
@ -527,7 +527,8 @@ static DRIVER_INIT( esb )
|
||||
slapstic_base = &rom[0x08000];
|
||||
|
||||
/* install an opcode base handler */
|
||||
memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), esb_setdirect);
|
||||
address_space *space = machine->device<m6809_device>("maincpu")->space(AS_PROGRAM);
|
||||
space->set_direct_update_handler(direct_update_delegate_create_static(esb_setdirect, *machine));
|
||||
|
||||
/* install read/write handlers for it */
|
||||
memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0x9fff, 0, 0, esb_slapstic_r, esb_slapstic_w);
|
||||
|
@ -389,21 +389,21 @@ static MACHINE_RESET( shadfgtr )
|
||||
}
|
||||
|
||||
|
||||
static DIRECT_UPDATE_HANDLER( vid_0_direct_handler )
|
||||
DIRECT_UPDATE_HANDLER( vcombat_vid_0_direct_handler )
|
||||
{
|
||||
if (address >= 0xfffc0000 && address <= 0xffffffff)
|
||||
{
|
||||
direct->raw = direct->decrypted = ((UINT8*)vid_0_shared_RAM) - 0xfffc0000;
|
||||
direct.explicit_configure(0xfffc0000, 0xffffffff, 0x3ffff, vid_0_shared_RAM);
|
||||
return ~0;
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
static DIRECT_UPDATE_HANDLER( vid_1_direct_handler )
|
||||
DIRECT_UPDATE_HANDLER( vcombat_vid_1_direct_handler )
|
||||
{
|
||||
if (address >= 0xfffc0000 && address <= 0xffffffff)
|
||||
{
|
||||
direct->raw = direct->decrypted = ((UINT8*)vid_1_shared_RAM) - 0xfffc0000;
|
||||
direct.explicit_configure(0xfffc0000, 0xffffffff, 0x3ffff, vid_1_shared_RAM);
|
||||
return ~0;
|
||||
}
|
||||
return address;
|
||||
@ -415,8 +415,11 @@ static DRIVER_INIT( vcombat )
|
||||
UINT8 *ROM = memory_region(machine, "maincpu");
|
||||
|
||||
/* The two i860s execute out of RAM */
|
||||
memory_set_direct_update_handler(cputag_get_address_space(machine, "vid_0", ADDRESS_SPACE_PROGRAM), vid_0_direct_handler);
|
||||
memory_set_direct_update_handler(cputag_get_address_space(machine, "vid_1", ADDRESS_SPACE_PROGRAM), vid_1_direct_handler);
|
||||
address_space *space = machine->device<i860_device>("vid_0")->space(AS_PROGRAM);
|
||||
space->set_direct_update_handler(direct_update_delegate_create_static(vcombat_vid_0_direct_handler, *machine));
|
||||
|
||||
space = machine->device<i860_device>("vid_1")->space(AS_PROGRAM);
|
||||
space->set_direct_update_handler(direct_update_delegate_create_static(vcombat_vid_1_direct_handler, *machine));
|
||||
|
||||
/* Allocate the 68000 framebuffers */
|
||||
m68k_framebuffer[0] = auto_alloc_array(machine, UINT16, 0x8000);
|
||||
@ -459,7 +462,8 @@ static DRIVER_INIT( shadfgtr )
|
||||
i860_framebuffer[1][1] = NULL;
|
||||
|
||||
/* The i860 executes out of RAM */
|
||||
memory_set_direct_update_handler(cputag_get_address_space(machine, "vid_0", ADDRESS_SPACE_PROGRAM), vid_0_direct_handler);
|
||||
address_space *space = machine->device<i860_device>("vid_0")->space(AS_PROGRAM);
|
||||
space->set_direct_update_handler(direct_update_delegate_create_static(vcombat_vid_0_direct_handler, *machine));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1675,6 +1675,8 @@ static void remap_dynamic_addresses(running_machine *machine)
|
||||
|
||||
/* now remap everything */
|
||||
if (LOG_DYNAMIC) logerror("remap_dynamic_addresses:\n");
|
||||
address_space *space = const_cast<address_space *>(machine->device<cpu_device>("maincpu")->space(AS_PROGRAM));
|
||||
assert(space != NULL);
|
||||
for (addr = 0; addr < dynamic_count; addr++)
|
||||
{
|
||||
if (LOG_DYNAMIC) logerror(" installing: %08X-%08X %s,%s\n", dynamic[addr].start, dynamic[addr].end, dynamic[addr].rdname, dynamic[addr].wrname);
|
||||
@ -1682,12 +1684,15 @@ static void remap_dynamic_addresses(running_machine *machine)
|
||||
if (dynamic[addr].mread == NOP_HANDLER)
|
||||
memory_nop_read(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), dynamic[addr].start, dynamic[addr].end, 0, 0);
|
||||
else if (dynamic[addr].mread != NULL)
|
||||
_memory_install_handler32(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), dynamic[addr].start, dynamic[addr].end, 0, 0, dynamic[addr].mread, dynamic[addr].rdname, NULL, NULL, 0);
|
||||
space->install_legacy_handler(dynamic[addr].start, dynamic[addr].end, 0, 0, dynamic[addr].mread, dynamic[addr].rdname);
|
||||
if (dynamic[addr].mwrite != NULL)
|
||||
_memory_install_handler32(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), dynamic[addr].start, dynamic[addr].end, 0, 0, NULL, NULL, dynamic[addr].mwrite, dynamic[addr].wrname, 0);
|
||||
space->install_legacy_handler(dynamic[addr].start, dynamic[addr].end, 0, 0, dynamic[addr].mwrite, dynamic[addr].wrname);
|
||||
|
||||
if (dynamic[addr].dread != NULL || dynamic[addr].dwrite != NULL)
|
||||
_memory_install_device_handler32(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), dynamic[addr].device, dynamic[addr].start, dynamic[addr].end, 0, 0, dynamic[addr].dread, dynamic[addr].rdname, dynamic[addr].dwrite, dynamic[addr].wrname, 0);
|
||||
{
|
||||
space->install_legacy_handler(*dynamic[addr].device, dynamic[addr].start, dynamic[addr].end, 0, 0, dynamic[addr].dread, dynamic[addr].rdname);
|
||||
space->install_legacy_handler(*dynamic[addr].device, dynamic[addr].start, dynamic[addr].end, 0, 0, dynamic[addr].dwrite, dynamic[addr].wrname);
|
||||
}
|
||||
}
|
||||
|
||||
if (LOG_DYNAMIC)
|
||||
|
@ -5,6 +5,8 @@
|
||||
*************************************************************************/
|
||||
|
||||
#include "machine/atarigen.h"
|
||||
#include "cpu/asap/asap.h"
|
||||
#include "audio/atarijsa.h"
|
||||
|
||||
class beathead_state : public atarigen_state
|
||||
{
|
||||
@ -12,28 +14,61 @@ public:
|
||||
static driver_data_t *alloc(running_machine &machine) { return auto_alloc_clear(&machine, beathead_state(machine)); }
|
||||
|
||||
beathead_state(running_machine &machine)
|
||||
: atarigen_state(machine) { }
|
||||
: atarigen_state(machine),
|
||||
m_maincpu(*machine.device<asap_device>("maincpu")) { }
|
||||
|
||||
asap_device & m_maincpu;
|
||||
|
||||
UINT32 * vram_bulk_latch;
|
||||
UINT32 * palette_select;
|
||||
UINT32 * m_videoram;
|
||||
UINT32 * m_paletteram;
|
||||
|
||||
UINT32 finescroll;
|
||||
offs_t vram_latch_offset;
|
||||
UINT32 * m_vram_bulk_latch;
|
||||
UINT32 * m_palette_select;
|
||||
|
||||
offs_t hsyncram_offset;
|
||||
offs_t hsyncram_start;
|
||||
UINT8 hsyncram[0x800];
|
||||
UINT32 m_finescroll;
|
||||
offs_t m_vram_latch_offset;
|
||||
|
||||
UINT32 * ram_base;
|
||||
UINT32 * rom_base;
|
||||
offs_t m_hsyncram_offset;
|
||||
offs_t m_hsyncram_start;
|
||||
UINT8 m_hsyncram[0x800];
|
||||
|
||||
double hblank_offset;
|
||||
UINT32 * m_ram_base;
|
||||
UINT32 * m_rom_base;
|
||||
|
||||
UINT8 irq_line_state;
|
||||
UINT8 irq_enable[3];
|
||||
UINT8 irq_state[3];
|
||||
double m_hblank_offset;
|
||||
|
||||
UINT8 eeprom_enabled;
|
||||
UINT8 m_irq_line_state;
|
||||
UINT8 m_irq_enable[3];
|
||||
UINT8 m_irq_state[3];
|
||||
|
||||
UINT8 m_eeprom_enabled;
|
||||
|
||||
UINT32 * m_speedup_data;
|
||||
UINT32 * m_movie_speedup_data;
|
||||
|
||||
// in drivers/beathead.c
|
||||
void update_interrupts();
|
||||
DECLARE_WRITE32_MEMBER( interrupt_control_w );
|
||||
DECLARE_READ32_MEMBER( interrupt_control_r );
|
||||
DECLARE_WRITE32_MEMBER( eeprom_data_w );
|
||||
DECLARE_WRITE32_MEMBER( eeprom_enable_w );
|
||||
DECLARE_READ32_MEMBER( input_2_r );
|
||||
DECLARE_READ32_MEMBER( sound_data_r );
|
||||
DECLARE_WRITE32_MEMBER( sound_data_w );
|
||||
DECLARE_WRITE32_MEMBER( sound_reset_w );
|
||||
DECLARE_WRITE32_MEMBER( coin_count_w );
|
||||
DECLARE_READ32_MEMBER( speedup_r );
|
||||
DECLARE_READ32_MEMBER( movie_speedup_r );
|
||||
|
||||
// in video/beathead.c
|
||||
DECLARE_WRITE32_MEMBER( vram_transparent_w );
|
||||
DECLARE_WRITE32_MEMBER( vram_bulk_w );
|
||||
DECLARE_WRITE32_MEMBER( vram_latch_w );
|
||||
DECLARE_WRITE32_MEMBER( vram_copy_w );
|
||||
DECLARE_WRITE32_MEMBER( finescroll_w );
|
||||
DECLARE_WRITE32_MEMBER( palette_w );
|
||||
DECLARE_READ32_MEMBER( hsync_ram_r );
|
||||
DECLARE_WRITE32_MEMBER( hsync_ram_w );
|
||||
};
|
||||
|
||||
|
||||
@ -41,12 +76,3 @@ public:
|
||||
|
||||
VIDEO_START( beathead );
|
||||
VIDEO_UPDATE( beathead );
|
||||
|
||||
WRITE32_HANDLER( beathead_vram_transparent_w );
|
||||
WRITE32_HANDLER( beathead_vram_bulk_w );
|
||||
WRITE32_HANDLER( beathead_vram_latch_w );
|
||||
WRITE32_HANDLER( beathead_vram_copy_w );
|
||||
WRITE32_HANDLER( beathead_finescroll_w );
|
||||
WRITE32_HANDLER( beathead_palette_w );
|
||||
READ32_HANDLER( beathead_hsync_ram_r );
|
||||
WRITE32_HANDLER( beathead_hsync_ram_w );
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
UINT16* dsp56k_bank04_ram;
|
||||
int cur_sound_region;
|
||||
|
||||
direct_update_func dsp56k_update_handler;
|
||||
direct_update_delegate dsp56k_update_handler;
|
||||
|
||||
/* TTL text plane stuff */
|
||||
int ttl_gfx_index;
|
||||
|
@ -279,7 +279,7 @@ WRITE32_HANDLER(archimedes_memc_logical_w)
|
||||
}
|
||||
}
|
||||
|
||||
static DIRECT_UPDATE_HANDLER( a310_setopbase )
|
||||
DIRECT_UPDATE_HANDLER( a310_setopbase )
|
||||
{
|
||||
// if we're not in logical memory, MAME can do the right thing
|
||||
if (address > 0x1ffffff)
|
||||
@ -290,19 +290,14 @@ static DIRECT_UPDATE_HANDLER( a310_setopbase )
|
||||
// if the boot ROM is mapped in, do some trickery to make it show up
|
||||
if (memc_latchrom)
|
||||
{
|
||||
direct->bytemask = 0x1fffff;
|
||||
direct->bytestart = 0;
|
||||
direct->byteend = 0x1fffff;
|
||||
direct->raw = direct->decrypted = memory_region(space->machine, "maincpu");
|
||||
direct.explicit_configure(0x000000, 0x1fffff, 0x1fffff, *direct.space().m_machine.region("maincpu"));
|
||||
}
|
||||
else // executing from logical memory
|
||||
{
|
||||
UINT32 page = address / page_sizes[memc_pagesize];
|
||||
|
||||
direct->bytemask = page_sizes[memc_pagesize]-1;
|
||||
direct->bytestart = page * page_sizes[memc_pagesize];
|
||||
direct->byteend = direct->bytestart + direct->bytemask;
|
||||
direct->raw = direct->decrypted = (UINT8 *)&archimedes_memc_physmem[(memc_pages[page] * page_sizes[memc_pagesize])>>2];
|
||||
offs_t pagesize = page_sizes[memc_pagesize];
|
||||
UINT32 page = address / pagesize;
|
||||
|
||||
direct.explicit_configure(page * pagesize, page * pagesize - 1, pagesize - 1, &archimedes_memc_physmem[(memc_pages[page] * pagesize)>>2]);
|
||||
}
|
||||
|
||||
return ~0;
|
||||
@ -310,7 +305,8 @@ static DIRECT_UPDATE_HANDLER( a310_setopbase )
|
||||
|
||||
void archimedes_driver_init(running_machine *machine)
|
||||
{
|
||||
memory_set_direct_update_handler( cputag_get_address_space( machine, "maincpu", ADDRESS_SPACE_PROGRAM ), a310_setopbase);
|
||||
address_space *space = machine->device<arm_device>("maincpu")->space(AS_PROGRAM);
|
||||
space->set_direct_update_handler(direct_update_delegate_create_static(a310_setopbase, *machine));
|
||||
}
|
||||
|
||||
static const char *const ioc_regnames[] =
|
||||
|
@ -491,9 +491,9 @@ static STATE_POSTLOAD( slapstic_postload )
|
||||
}
|
||||
|
||||
|
||||
static DIRECT_UPDATE_HANDLER( atarigen_slapstic_setdirect )
|
||||
DIRECT_UPDATE_HANDLER( atarigen_slapstic_setdirect )
|
||||
{
|
||||
atarigen_state *state = space->machine->driver_data<atarigen_state>();
|
||||
atarigen_state *state = machine->driver_data<atarigen_state>();
|
||||
|
||||
/* if we jump to an address in the slapstic region, tweak the slapstic
|
||||
at that address and return ~0; this will cause us to be called on
|
||||
@ -501,12 +501,12 @@ static DIRECT_UPDATE_HANDLER( atarigen_slapstic_setdirect )
|
||||
address &= ~state->slapstic_mirror;
|
||||
if (address >= state->slapstic_base && address < state->slapstic_base + 0x8000)
|
||||
{
|
||||
offs_t pc = cpu_get_previouspc(space->cpu);
|
||||
offs_t pc = cpu_get_previouspc(&direct.space().device());
|
||||
if (pc != state->slapstic_last_pc || address != state->slapstic_last_address)
|
||||
{
|
||||
state->slapstic_last_pc = pc;
|
||||
state->slapstic_last_address = address;
|
||||
atarigen_slapstic_r(space, (address >> 1) & 0x3fff, 0xffff);
|
||||
atarigen_slapstic_r(&direct.space(), (address >> 1) & 0x3fff, 0xffff);
|
||||
}
|
||||
return ~0;
|
||||
}
|
||||
@ -548,7 +548,9 @@ void atarigen_slapstic_init(running_device *device, offs_t base, offs_t mirror,
|
||||
/* install an opcode base handler if we are a 68000 or variant */
|
||||
state->slapstic_base = base;
|
||||
state->slapstic_mirror = mirror;
|
||||
memory_set_direct_update_handler(cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), atarigen_slapstic_setdirect);
|
||||
|
||||
address_space *space = downcast<cpu_device *>(device)->space(AS_PROGRAM);
|
||||
space->set_direct_update_handler(direct_update_delegate_create_static(atarigen_slapstic_setdirect, *device->machine));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -460,7 +460,7 @@ INLINE int addr_is_valid(const address_space *space, UINT32 addr, UINT32 flags)
|
||||
return 0;
|
||||
|
||||
/* if we're invalid, fail */
|
||||
if (strcmp(memory_get_handler_string(space, 0, addr), "segaic16_memory_mapper_lsb_r") == 0)
|
||||
if (strcmp(const_cast<address_space *>(space)->get_handler_string(ROW_READ, addr), "segaic16_memory_mapper_lsb_r") == 0)
|
||||
return 2;
|
||||
|
||||
return 1;
|
||||
|
@ -1965,7 +1965,7 @@ static UINT32 cic_status = 0x00000000;
|
||||
READ32_HANDLER( n64_pif_ram_r )
|
||||
{
|
||||
/*mame_printf_debug( "pif_ram_r: %08X, %08X = %08X\n", offset << 2, mem_mask, ( ( pif_ram[offset*4+0] << 24 ) | ( pif_ram[offset*4+1] << 16 ) | ( pif_ram[offset*4+2] << 8 ) | ( pif_ram[offset*4+3] << 0 ) ) & mem_mask );*/
|
||||
if(!space->debugger_access)
|
||||
if(!space->debugger_access())
|
||||
{
|
||||
if( offset == ( 0x24 / 4 ) )
|
||||
{
|
||||
|
@ -957,7 +957,7 @@ READ8_HANDLER( snes_r_bank1 )
|
||||
else
|
||||
value = snes_ram[offset];
|
||||
|
||||
if(!space->debugger_access)
|
||||
if(!space->debugger_access())
|
||||
cpu_adjust_icount(space->cpu, -snes_bank_0x00_0x3f_cycles(space->machine, offset));
|
||||
|
||||
return value;
|
||||
@ -1020,7 +1020,7 @@ READ8_HANDLER( snes_r_bank2 )
|
||||
else
|
||||
value = snes_ram[0x300000 + offset];
|
||||
|
||||
if(!space->debugger_access)
|
||||
if(!space->debugger_access())
|
||||
cpu_adjust_icount(space->cpu, -snes_bank_0x00_0x3f_cycles(space->machine, offset));
|
||||
|
||||
return value;
|
||||
@ -1061,7 +1061,7 @@ READ8_HANDLER( snes_r_bank3 )
|
||||
else /* Mode 21 & 25 + SuperFX games */
|
||||
value = snes_ram[0x400000 + offset];
|
||||
|
||||
if(!space->debugger_access)
|
||||
if(!space->debugger_access())
|
||||
cpu_adjust_icount(space->cpu, -8);
|
||||
|
||||
return value;
|
||||
@ -1099,7 +1099,7 @@ READ8_HANDLER( snes_r_bank4 )
|
||||
else if (state->cart[0].mode & 0x0a) /* Mode 21 & 25 */
|
||||
value = snes_ram[0x600000 + offset];
|
||||
|
||||
if(!space->debugger_access)
|
||||
if(!space->debugger_access())
|
||||
cpu_adjust_icount(space->cpu, -8);
|
||||
|
||||
return value;
|
||||
@ -1135,7 +1135,7 @@ READ8_HANDLER( snes_r_bank5 )
|
||||
else
|
||||
value = snes_ram[0x700000 + offset];
|
||||
|
||||
if(!space->debugger_access)
|
||||
if(!space->debugger_access())
|
||||
cpu_adjust_icount(space->cpu, -8);
|
||||
|
||||
return value;
|
||||
@ -1183,7 +1183,7 @@ READ8_HANDLER( snes_r_bank6 )
|
||||
else
|
||||
value = snes_ram[0x800000 + offset];
|
||||
|
||||
if(!space->debugger_access)
|
||||
if(!space->debugger_access())
|
||||
cpu_adjust_icount(space->cpu, -snes_bank_0x80_0xbf_cycles(space->machine, offset));
|
||||
|
||||
return value;
|
||||
@ -1236,7 +1236,7 @@ READ8_HANDLER( snes_r_bank7 )
|
||||
else /* Mode 21 & 25 + SuperFX Games */
|
||||
value = snes_ram[0xc00000 + offset];
|
||||
|
||||
if(!space->debugger_access)
|
||||
if(!space->debugger_access())
|
||||
cpu_adjust_icount(space->cpu, -((snes_ram[MEMSEL] & 1) ? 6 : 8));
|
||||
|
||||
return value;
|
||||
@ -1290,7 +1290,7 @@ WRITE8_HANDLER( snes_w_bank1 )
|
||||
else
|
||||
logerror( "(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(space->cpu),offset );
|
||||
|
||||
if(!space->debugger_access)
|
||||
if(!space->debugger_access())
|
||||
cpu_adjust_icount(space->cpu, -snes_bank_0x00_0x3f_cycles(space->machine, offset));
|
||||
}
|
||||
|
||||
@ -1347,7 +1347,7 @@ WRITE8_HANDLER( snes_w_bank2 )
|
||||
else
|
||||
logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(space->cpu),offset + 0x300000);
|
||||
|
||||
if(!space->debugger_access)
|
||||
if(!space->debugger_access())
|
||||
cpu_adjust_icount(space->cpu, -snes_bank_0x00_0x3f_cycles(space->machine, offset));
|
||||
}
|
||||
|
||||
@ -1373,7 +1373,7 @@ WRITE8_HANDLER( snes_w_bank4 )
|
||||
else if (state->cart[0].mode & 0x0a)
|
||||
logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(space->cpu),offset + 0x600000);
|
||||
|
||||
if(!space->debugger_access)
|
||||
if(!space->debugger_access())
|
||||
cpu_adjust_icount(space->cpu, -8);
|
||||
}
|
||||
|
||||
@ -1398,7 +1398,7 @@ WRITE8_HANDLER( snes_w_bank5 )
|
||||
else if (state->cart[0].mode & 0x0a)
|
||||
logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(space->cpu),offset + 0x700000);
|
||||
|
||||
if(!space->debugger_access)
|
||||
if(!space->debugger_access())
|
||||
cpu_adjust_icount(space->cpu, -8);
|
||||
}
|
||||
|
||||
@ -1446,7 +1446,7 @@ WRITE8_HANDLER( snes_w_bank6 )
|
||||
else
|
||||
logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(space->cpu),offset + 0x800000);
|
||||
|
||||
if(!space->debugger_access)
|
||||
if(!space->debugger_access())
|
||||
cpu_adjust_icount(space->cpu, -snes_bank_0x80_0xbf_cycles(space->machine, offset));
|
||||
}
|
||||
|
||||
@ -1486,7 +1486,7 @@ WRITE8_HANDLER( snes_w_bank7 )
|
||||
else if (state->cart[0].mode & 0x0a)
|
||||
logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(space->cpu),offset + 0xc00000);
|
||||
|
||||
if(!space->debugger_access)
|
||||
if(!space->debugger_access())
|
||||
cpu_adjust_icount(space->cpu, -((snes_ram[MEMSEL] & 1) ? 6 : 8));
|
||||
}
|
||||
|
||||
@ -1677,15 +1677,15 @@ static void snes_init_ram( running_machine *machine )
|
||||
}
|
||||
|
||||
|
||||
static DIRECT_UPDATE_HANDLER( spc_direct )
|
||||
DIRECT_UPDATE_HANDLER( snes_spc_direct )
|
||||
{
|
||||
direct->raw = direct->decrypted = spc_get_ram(space->machine->device("spc700"));
|
||||
direct.explicit_configure(0x0000, 0xffff, 0xffff, spc_get_ram(machine->device("spc700")));
|
||||
return ~0;
|
||||
}
|
||||
|
||||
static DIRECT_UPDATE_HANDLER( snes_direct )
|
||||
DIRECT_UPDATE_HANDLER( snes_direct )
|
||||
{
|
||||
direct->raw = direct->decrypted = snes_ram;
|
||||
direct.explicit_configure(0x0000, 0xffff, 0xffff, snes_ram);
|
||||
return ~0;
|
||||
}
|
||||
|
||||
@ -1694,14 +1694,14 @@ MACHINE_START( snes )
|
||||
snes_state *state = machine->driver_data<snes_state>();
|
||||
int i;
|
||||
|
||||
memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), snes_direct);
|
||||
memory_set_direct_update_handler(cputag_get_address_space(machine, "soundcpu", ADDRESS_SPACE_PROGRAM), spc_direct);
|
||||
|
||||
state->maincpu = machine->device<_5a22_device>("maincpu");
|
||||
state->soundcpu = machine->device<spc700_device>("soundcpu");
|
||||
state->spc700 = machine->device<snes_sound_sound_device>("spc700");
|
||||
state->superfx = machine->device<cpu_device>("superfx");
|
||||
|
||||
state->maincpu->space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(snes_direct, *machine));
|
||||
state->soundcpu->space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(snes_spc_direct, *machine));
|
||||
|
||||
// power-on sets these registers like this
|
||||
snes_ram[WRIO] = 0xff;
|
||||
snes_ram[WRMPYA] = 0xff;
|
||||
|
@ -18,11 +18,11 @@
|
||||
VIDEO_START( beathead )
|
||||
{
|
||||
beathead_state *state = machine->driver_data<beathead_state>();
|
||||
state_save_register_global(machine, state->finescroll);
|
||||
state_save_register_global(machine, state->vram_latch_offset);
|
||||
state_save_register_global(machine, state->hsyncram_offset);
|
||||
state_save_register_global(machine, state->hsyncram_start);
|
||||
state_save_register_global_array(machine, state->hsyncram);
|
||||
state_save_register_global(machine, state->m_finescroll);
|
||||
state_save_register_global(machine, state->m_vram_latch_offset);
|
||||
state_save_register_global(machine, state->m_hsyncram_offset);
|
||||
state_save_register_global(machine, state->m_hsyncram_start);
|
||||
state_save_register_global_array(machine, state->m_hsyncram);
|
||||
}
|
||||
|
||||
|
||||
@ -33,21 +33,19 @@ VIDEO_START( beathead )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
WRITE32_HANDLER( beathead_vram_transparent_w )
|
||||
WRITE32_MEMBER( beathead_state::vram_transparent_w )
|
||||
{
|
||||
/* writes to this area appear to handle transparency */
|
||||
if (!(data & 0x000000ff)) mem_mask &= ~0x000000ff;
|
||||
if (!(data & 0x0000ff00)) mem_mask &= ~0x0000ff00;
|
||||
if (!(data & 0x00ff0000)) mem_mask &= ~0x00ff0000;
|
||||
if (!(data & 0xff000000)) mem_mask &= ~0xff000000;
|
||||
COMBINE_DATA(&space->machine->generic.videoram.u32[offset]);
|
||||
COMBINE_DATA(&m_videoram[offset]);
|
||||
}
|
||||
|
||||
|
||||
WRITE32_HANDLER( beathead_vram_bulk_w )
|
||||
WRITE32_MEMBER( beathead_state::vram_bulk_w )
|
||||
{
|
||||
beathead_state *state = space->machine->driver_data<beathead_state>();
|
||||
|
||||
/* it appears that writes to this area pass in a mask for 4 words in VRAM */
|
||||
/* allowing them to be filled from a preset latch */
|
||||
offset &= ~3;
|
||||
@ -55,29 +53,24 @@ WRITE32_HANDLER( beathead_vram_bulk_w )
|
||||
|
||||
/* for now, just handle the bulk fill case; the others we'll catch later */
|
||||
if (data == 0x0f0f0f0f)
|
||||
space->machine->generic.videoram.u32[offset+0] =
|
||||
space->machine->generic.videoram.u32[offset+1] =
|
||||
space->machine->generic.videoram.u32[offset+2] =
|
||||
space->machine->generic.videoram.u32[offset+3] = *state->vram_bulk_latch;
|
||||
m_videoram[offset+0] = m_videoram[offset+1] = m_videoram[offset+2] = m_videoram[offset+3] = *m_vram_bulk_latch;
|
||||
else
|
||||
logerror("Detected bulk VRAM write with mask %08x\n", data);
|
||||
}
|
||||
|
||||
|
||||
WRITE32_HANDLER( beathead_vram_latch_w )
|
||||
WRITE32_MEMBER( beathead_state::vram_latch_w )
|
||||
{
|
||||
/* latch the address */
|
||||
beathead_state *state = space->machine->driver_data<beathead_state>();
|
||||
state->vram_latch_offset = (4 * offset) & 0x7ffff;
|
||||
m_vram_latch_offset = (4 * offset) & 0x7ffff;
|
||||
}
|
||||
|
||||
|
||||
WRITE32_HANDLER( beathead_vram_copy_w )
|
||||
WRITE32_MEMBER( beathead_state::vram_copy_w )
|
||||
{
|
||||
/* copy from VRAM to VRAM, for 1024 bytes */
|
||||
beathead_state *state = space->machine->driver_data<beathead_state>();
|
||||
offs_t dest_offset = (4 * offset) & 0x7ffff;
|
||||
memcpy(&space->machine->generic.videoram.u32[dest_offset / 4], &space->machine->generic.videoram.u32[state->vram_latch_offset / 4], 0x400);
|
||||
memcpy(&m_videoram[dest_offset / 4], &m_videoram[m_vram_latch_offset / 4], 0x400);
|
||||
}
|
||||
|
||||
|
||||
@ -88,17 +81,16 @@ WRITE32_HANDLER( beathead_vram_copy_w )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
WRITE32_HANDLER( beathead_finescroll_w )
|
||||
WRITE32_MEMBER( beathead_state::finescroll_w )
|
||||
{
|
||||
beathead_state *state = space->machine->driver_data<beathead_state>();
|
||||
UINT32 oldword = state->finescroll;
|
||||
UINT32 newword = COMBINE_DATA(&state->finescroll);
|
||||
UINT32 oldword = m_finescroll;
|
||||
UINT32 newword = COMBINE_DATA(&m_finescroll);
|
||||
|
||||
/* if VBLANK is going off on a scanline other than the last, suspend time */
|
||||
if ((oldword & 8) && !(newword & 8) && space->machine->primary_screen->vpos() != 261)
|
||||
if ((oldword & 8) && !(newword & 8) && space.machine->primary_screen->vpos() != 261)
|
||||
{
|
||||
logerror("Suspending time! (scanline = %d)\n", space->machine->primary_screen->vpos());
|
||||
cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_HALT, ASSERT_LINE);
|
||||
logerror("Suspending time! (scanline = %d)\n", space.machine->primary_screen->vpos());
|
||||
cputag_set_input_line(space.machine, "maincpu", INPUT_LINE_HALT, ASSERT_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,13 +102,13 @@ WRITE32_HANDLER( beathead_finescroll_w )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
WRITE32_HANDLER( beathead_palette_w )
|
||||
WRITE32_MEMBER( beathead_state::palette_w )
|
||||
{
|
||||
int newword = COMBINE_DATA(&space->machine->generic.paletteram.u32[offset]);
|
||||
int newword = COMBINE_DATA(&m_paletteram[offset]);
|
||||
int r = ((newword >> 9) & 0x3e) | ((newword >> 15) & 0x01);
|
||||
int g = ((newword >> 4) & 0x3e) | ((newword >> 15) & 0x01);
|
||||
int b = ((newword << 1) & 0x3e) | ((newword >> 15) & 0x01);
|
||||
palette_set_color_rgb(space->machine, offset, pal6bit(r), pal6bit(g), pal6bit(b));
|
||||
palette_set_color_rgb(space.machine, offset, pal6bit(r), pal6bit(g), pal6bit(b));
|
||||
}
|
||||
|
||||
|
||||
@ -127,36 +119,32 @@ WRITE32_HANDLER( beathead_palette_w )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
READ32_HANDLER( beathead_hsync_ram_r )
|
||||
READ32_MEMBER( beathead_state::hsync_ram_r )
|
||||
{
|
||||
beathead_state *state = space->machine->driver_data<beathead_state>();
|
||||
|
||||
/* offset 0 is probably write-only */
|
||||
if (offset == 0)
|
||||
logerror("%08X:Unexpected HSYNC RAM read at offset 0\n", cpu_get_previouspc(space->cpu));
|
||||
logerror("%08X:Unexpected HSYNC RAM read at offset 0\n", cpu_get_previouspc(space.cpu));
|
||||
|
||||
/* offset 1 reads the data */
|
||||
else
|
||||
return state->hsyncram[state->hsyncram_offset];
|
||||
return m_hsyncram[m_hsyncram_offset];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WRITE32_HANDLER( beathead_hsync_ram_w )
|
||||
WRITE32_MEMBER( beathead_state::hsync_ram_w )
|
||||
{
|
||||
beathead_state *state = space->machine->driver_data<beathead_state>();
|
||||
|
||||
/* offset 0 selects the address, and can specify the start address */
|
||||
if (offset == 0)
|
||||
{
|
||||
COMBINE_DATA(&state->hsyncram_offset);
|
||||
if (state->hsyncram_offset & 0x800)
|
||||
state->hsyncram_start = state->hsyncram_offset & 0x7ff;
|
||||
COMBINE_DATA(&m_hsyncram_offset);
|
||||
if (m_hsyncram_offset & 0x800)
|
||||
m_hsyncram_start = m_hsyncram_offset & 0x7ff;
|
||||
}
|
||||
|
||||
/* offset 1 writes the data */
|
||||
else
|
||||
COMBINE_DATA(&state->hsyncram[state->hsyncram_offset]);
|
||||
COMBINE_DATA(&m_hsyncram[m_hsyncram_offset]);
|
||||
}
|
||||
|
||||
|
||||
@ -170,24 +158,24 @@ WRITE32_HANDLER( beathead_hsync_ram_w )
|
||||
VIDEO_UPDATE( beathead )
|
||||
{
|
||||
beathead_state *state = screen->machine->driver_data<beathead_state>();
|
||||
UINT8 *videoram = screen->machine->generic.videoram.u8;
|
||||
UINT8 *videoram = reinterpret_cast<UINT8 *>(state->m_videoram);
|
||||
int x, y;
|
||||
|
||||
/* generate the final screen */
|
||||
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
|
||||
{
|
||||
pen_t pen_base = (*state->palette_select & 0x7f) * 256;
|
||||
pen_t pen_base = (*state->m_palette_select & 0x7f) * 256;
|
||||
UINT16 scanline[336];
|
||||
|
||||
/* blanking */
|
||||
if (state->finescroll & 8)
|
||||
if (state->m_finescroll & 8)
|
||||
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
|
||||
scanline[x] = pen_base;
|
||||
|
||||
/* non-blanking */
|
||||
else
|
||||
{
|
||||
offs_t scanline_offset = state->vram_latch_offset + (state->finescroll & 3);
|
||||
offs_t scanline_offset = state->m_vram_latch_offset + (state->m_finescroll & 3);
|
||||
offs_t src = scanline_offset + cliprect->min_x;
|
||||
|
||||
/* unswizzle the scanline first */
|
||||
|
Loading…
Reference in New Issue
Block a user