summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author R. Belmont <rb6502@users.noreply.github.com>2013-01-02 02:15:20 +0000
committer R. Belmont <rb6502@users.noreply.github.com>2013-01-02 02:15:20 +0000
commitaefb97104830eb4db0946cec794ee718a45fe92c (patch)
treec22895e7e679dd3a82e47f0457c872fa3442f239 /src
parent1eb265397a331090624824cc65dd49921fbd815b (diff)
And the rest of that commit (nw)
Diffstat (limited to 'src')
-rw-r--r--src/mess/machine/cuda.c6
-rw-r--r--src/mess/machine/cuda.h9
-rw-r--r--src/mess/machine/egret.c34
-rw-r--r--src/mess/machine/egret.h21
4 files changed, 53 insertions, 17 deletions
diff --git a/src/mess/machine/cuda.c b/src/mess/machine/cuda.c
index 475a2f4479d..ac3c1a1d870 100644
--- a/src/mess/machine/cuda.c
+++ b/src/mess/machine/cuda.c
@@ -132,8 +132,8 @@ void cuda_device::send_port(address_space &space, UINT8 offset, UINT8 data)
adb_in = (data & 0x80) ? true : false;
- mac_state *mac = machine().driver_data<mac_state>();
- mac->adb_linechange(((data & 0x80) >> 7) ^ 1, (int)(machine().time().as_ticks(1000000) - last_adb_time));
+ m_adb_dtime = (int)(machine().time().as_ticks(1000000) - last_adb_time);
+ m_out_adb_func(((data & 0x80) >> 7) ^ 1);
last_adb = data & 0x80;
last_adb_time = machine().time().as_ticks(1000000);
@@ -405,6 +405,7 @@ void cuda_device::static_set_type(device_t &device, int type)
void cuda_device::device_start()
{
m_out_reset_func.resolve(m_out_reset_cb, *this);
+ m_out_adb_func.resolve(m_out_adb_cb, *this);
m_timer = timer_alloc(0, NULL);
m_prog_timer = timer_alloc(1, NULL);
@@ -426,6 +427,7 @@ void cuda_device::device_start()
save_item(NAME(via_clock));
save_item(NAME(adb_in));
save_item(NAME(reset_line));
+ save_item(NAME(m_adb_dtime));
save_item(NAME(pram_loaded));
save_item(NAME(pram));
save_item(NAME(disk_pram));
diff --git a/src/mess/machine/cuda.h b/src/mess/machine/cuda.h
index b9f72258f1c..36b532ef192 100644
--- a/src/mess/machine/cuda.h
+++ b/src/mess/machine/cuda.h
@@ -5,8 +5,6 @@
#include "emu.h"
-
-
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
@@ -37,6 +35,9 @@
#define MCFG_CUDA_TYPE(_type) \
cuda_device::static_set_type(*device, _type);
+#define MCFG_CUDA_REMOVE() \
+ MCFG_DEVICE_REMOVE(CUDA_TAG)
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -44,6 +45,7 @@
struct cuda_interface
{
devcb_write_line m_out_reset_cb;
+ devcb_write_line m_out_adb_cb;
};
// ======================> cuda_device
@@ -85,6 +87,7 @@ public:
void set_via_data(UINT8 dat) { via_data = dat; }
UINT8 get_via_clock() { return via_clock; }
void set_adb_line(int linestate) { adb_in = (linestate == ASSERT_LINE) ? true : false; }
+ int get_adb_dtime() { return m_adb_dtime; }
int rom_offset;
@@ -112,6 +115,7 @@ private:
bool cuda_controls_power;
bool adb_in;
int reset_line;
+ int m_adb_dtime;
emu_timer *m_timer, *m_prog_timer;
UINT8 pram[0x100], disk_pram[0x100];
bool pram_loaded;
@@ -119,6 +123,7 @@ private:
void send_port(address_space &space, UINT8 offset, UINT8 data);
devcb_resolved_write_line m_out_reset_func;
+ devcb_resolved_write_line m_out_adb_func;
};
// device type definition
diff --git a/src/mess/machine/egret.c b/src/mess/machine/egret.c
index 429b4e7dc26..b464724812a 100644
--- a/src/mess/machine/egret.c
+++ b/src/mess/machine/egret.c
@@ -130,8 +130,8 @@ void egret_device::send_port(address_space &space, UINT8 offset, UINT8 data)
// allow the linechange handler to override us
adb_in = (data & 0x80) ? true : false;
- mac_state *mac = machine().driver_data<mac_state>();
- mac->adb_linechange(((data & 0x80) >> 7) ^ 1, (int)(machine().time().as_ticks(1000000) - last_adb_time));
+ m_adb_dtime = (int)(machine().time().as_ticks(1000000) - last_adb_time);
+ m_out_adb_func(((data & 0x80) >> 7) ^ 1);
last_adb = data & 0x80;
last_adb_time = machine().time().as_ticks(1000000);
@@ -177,12 +177,6 @@ void egret_device::send_port(address_space &space, UINT8 offset, UINT8 data)
// falling edge, should reset the machine too
if ((ports[2] & 8) && !(data&8))
{
- mac_state *mac = machine().driver_data<mac_state>();
-
- // force the memory overlay
- mac->set_memory_overlay(0);
- mac->set_memory_overlay(1);
-
// if PRAM's waiting to be loaded, transfer it now
if (!pram_loaded)
{
@@ -191,7 +185,7 @@ void egret_device::send_port(address_space &space, UINT8 offset, UINT8 data)
}
}
- machine().device("maincpu")->execute().set_input_line(INPUT_LINE_RESET, (reset_line & 8) ? ASSERT_LINE : CLEAR_LINE);
+ m_out_reset_func((reset_line & 8) ? ASSERT_LINE : CLEAR_LINE);
}
break;
}
@@ -356,12 +350,33 @@ void egret_device::static_set_type(device_t &device, int type)
egret.rom_offset = type;
}
+void egret_device::device_config_complete()
+{
+ m_shortname = "egret";
+
+ // inherit a copy of the static data
+ const egret_interface *intf = reinterpret_cast<const egret_interface *>(static_config());
+ if (intf != NULL)
+ {
+ *static_cast<egret_interface *>(this) = *intf;
+ }
+ // or initialize to defaults if none provided
+ else
+ {
+ memset(&m_out_reset_cb, 0, sizeof(m_out_reset_cb));
+ memset(&m_out_adb_cb, 0, sizeof(m_out_adb_cb));
+ }
+}
+
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void egret_device::device_start()
{
+ m_out_reset_func.resolve(m_out_reset_cb, *this);
+ m_out_adb_func.resolve(m_out_adb_cb, *this);
+
m_timer = timer_alloc(0, NULL);
save_item(NAME(ddrs[0]));
save_item(NAME(ddrs[1]));
@@ -380,6 +395,7 @@ void egret_device::device_start()
save_item(NAME(via_clock));
save_item(NAME(adb_in));
save_item(NAME(reset_line));
+ save_item(NAME(m_adb_dtime));
save_item(NAME(pram_loaded));
save_item(NAME(pram));
save_item(NAME(disk_pram));
diff --git a/src/mess/machine/egret.h b/src/mess/machine/egret.h
index afaad798c40..44b1a51745f 100644
--- a/src/mess/machine/egret.h
+++ b/src/mess/machine/egret.h
@@ -21,12 +21,14 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_EGRET_ADD(_type) \
+#define MCFG_EGRET_ADD(_type, _config) \
MCFG_DEVICE_ADD(EGRET_TAG, EGRET, 0) \
+ MCFG_DEVICE_CONFIG(_config) \
MCFG_EGRET_TYPE(_type)
-#define MCFG_EGRET_REPLACE(_type) \
+#define MCFG_EGRET_REPLACE(_type, _config) \
MCFG_DEVICE_REPLACE(EGRET_TAG, EGRET, 0) \
+ MCFG_DEVICE_CONFIG(_config) \
MCFG_EGRET_TYPE(_type)
#define MCFG_EGRET_TYPE(_type) \
@@ -39,9 +41,15 @@
// TYPE DEFINITIONS
//**************************************************************************
+struct egret_interface
+{
+ devcb_write_line m_out_reset_cb;
+ devcb_write_line m_out_adb_cb;
+};
+
// ======================> egret_device
-class egret_device : public device_t, public device_nvram_interface
+class egret_device : public device_t, public device_nvram_interface, public egret_interface
{
public:
// construction/destruction
@@ -78,6 +86,7 @@ public:
void set_via_data(UINT8 dat) { via_data = dat; }
UINT8 get_via_clock() { return via_clock; }
void set_adb_line(int linestate) { adb_in = (linestate == ASSERT_LINE) ? true : false; }
+ int get_adb_dtime() { return m_adb_dtime; }
int rom_offset;
@@ -85,7 +94,7 @@ protected:
// device-level overrides
virtual void device_start();
virtual void device_reset();
- virtual void device_config_complete() { m_shortname = "egret"; }
+ virtual void device_config_complete();
virtual machine_config_constructor device_mconfig_additions() const;
virtual const rom_entry *device_rom_region() const;
@@ -105,11 +114,15 @@ private:
bool egret_controls_power;
bool adb_in;
int reset_line;
+ int m_adb_dtime;
emu_timer *m_timer;
UINT8 pram[0x100], disk_pram[0x100];
bool pram_loaded;
void send_port(address_space &space, UINT8 offset, UINT8 data);
+
+ devcb_resolved_write_line m_out_reset_func;
+ devcb_resolved_write_line m_out_adb_func;
};
// device type definition