summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Curt Coder <curtcoder@mail.com>2014-03-19 12:23:39 +0000
committer Curt Coder <curtcoder@mail.com>2014-03-19 12:23:39 +0000
commit89ea6a3b3ba4003cb539b04c537bca7727455f7e (patch)
tree423db914257f86c2fe01e2f67530fa8d6a7fc1e6
parent9271b7e281e9ca701aadb96090f1851098cbcf98 (diff)
(MESS) 6883sam: devcb2. (nw)
-rw-r--r--src/mess/drivers/coco12.c1
-rw-r--r--src/mess/includes/coco12.h4
-rw-r--r--src/mess/machine/6883sam.c3
-rw-r--r--src/mess/machine/6883sam.h11
-rw-r--r--src/mess/machine/coco12.c1
5 files changed, 11 insertions, 9 deletions
diff --git a/src/mess/drivers/coco12.c b/src/mess/drivers/coco12.c
index e1a33fbfb15..a63e244316d 100644
--- a/src/mess/drivers/coco12.c
+++ b/src/mess/drivers/coco12.c
@@ -291,6 +291,7 @@ static MACHINE_CONFIG_START( coco, coco12_state )
MCFG_PIA_IRQB_HANDLER(WRITELINE(coco_state, pia1_firq_b))
MCFG_SAM6883_ADD(SAM_TAG, XTAL_3_579545MHz, coco12_state::sam6883_config)
+ MCFG_SAM6883_RES_CALLBACK(READ8(coco12_state, sam_read))
MCFG_CASSETTE_ADD("cassette", coco_state::coco_cassette_interface)
MCFG_BITBANGER_ADD(BITBANGER_TAG, coco_state::coco_bitbanger_config)
MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_state::cartridge_config, coco_cart, "pak")
diff --git a/src/mess/includes/coco12.h b/src/mess/includes/coco12.h
index 19d1a7c1750..a1b3e36495a 100644
--- a/src/mess/includes/coco12.h
+++ b/src/mess/includes/coco12.h
@@ -48,6 +48,8 @@ public:
static const mc6847_interface mc6847_config;
static const sam6883_interface sam6883_config;
+ DECLARE_READ8_MEMBER( sam_read );
+
protected:
virtual void device_start();
virtual void update_cart_base(UINT8 *cart_base);
@@ -59,8 +61,6 @@ private:
DECLARE_WRITE_LINE_MEMBER( horizontal_sync );
DECLARE_WRITE_LINE_MEMBER( field_sync );
- DECLARE_READ8_MEMBER( sam_read );
-
void configure_sam(void);
};
diff --git a/src/mess/machine/6883sam.c b/src/mess/machine/6883sam.c
index 0e54975ab25..30306f3bcf3 100644
--- a/src/mess/machine/6883sam.c
+++ b/src/mess/machine/6883sam.c
@@ -70,6 +70,7 @@ const device_type SAM6883 = &device_creator<sam6883_device>;
sam6883_device::sam6883_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, SAM6883, "SAM6883", tag, owner, clock, "sam6883", __FILE__),
+ m_read_res(*this),
m_space_0000(*this),
m_space_8000(*this),
m_space_A000(*this),
@@ -98,7 +99,7 @@ void sam6883_device::device_start()
m_cpu_space = &m_cpu->space(config->m_cpu_space);
// resolve callbacks
- m_res_input_func.resolve(config->m_input_func, *this);
+ m_read_res.resolve_safe(0);
// install SAM handlers
m_cpu_space->install_read_handler(0xFFC0, 0xFFDF, 0, 0, read8_delegate(FUNC(sam6883_device::read), this));
diff --git a/src/mess/machine/6883sam.h b/src/mess/machine/6883sam.h
index a47427faa60..395585e59ec 100644
--- a/src/mess/machine/6883sam.h
+++ b/src/mess/machine/6883sam.h
@@ -17,6 +17,8 @@
MCFG_DEVICE_ADD(_tag, SAM6883, _clock) \
MCFG_DEVICE_CONFIG(_config)
+#define MCFG_SAM6883_RES_CALLBACK(_read) \
+ devcb = &sam6883_device::set_res_rd_callback(*device, DEVCB2_##_read);
/* interface */
struct sam6883_interface
@@ -24,9 +26,6 @@ struct sam6883_interface
/* the CPU/space from which the SAM reads data */
const char * m_cpu_tag;
address_spacenum m_cpu_space;
-
- /* function for reading from memory for video */
- devcb_read8 m_input_func;
};
@@ -96,6 +95,8 @@ class sam6883_device : public device_t, public sam6883_friend_device
public:
sam6883_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ template<class _Object> static devcb2_base &set_res_rd_callback(device_t &device, _Object object) { return downcast<sam6883_device &>(device).m_read_res.set_callback(object); }
+
// called to configure banks
void configure_bank(int bank, UINT8 *memory, UINT32 memory_size, bool is_read_only);
void configure_bank(int bank, read8_delegate rhandler, write8_delegate whandler);
@@ -120,7 +121,7 @@ public:
if (bit3_carry)
counter_carry_bit3();
}
- return m_res_input_func((m_counter & m_counter_mask) | m_counter_or);
+ return m_read_res((m_counter & m_counter_mask) | m_counter_or);
}
DECLARE_WRITE_LINE_MEMBER( hs_w );
@@ -169,7 +170,7 @@ private:
// incidentals
address_space * m_cpu_space;
- devcb_resolved_read8 m_res_input_func;
+ devcb2_read8 m_read_res;
sam_bank m_banks[8];
sam_space<0x0000, 0x7FFF> m_space_0000;
sam_space<0x8000, 0x9FFF> m_space_8000;
diff --git a/src/mess/machine/coco12.c b/src/mess/machine/coco12.c
index 2b65c47e99e..299ae5e10c8 100644
--- a/src/mess/machine/coco12.c
+++ b/src/mess/machine/coco12.c
@@ -141,5 +141,4 @@ const sam6883_interface coco12_state::sam6883_config =
{
MAINCPU_TAG,
AS_PROGRAM,
- DEVCB_DRIVER_MEMBER(coco12_state, sam_read)
};