diff options
author | Curt Coder <curtcoder@mail.com> | 2012-09-10 14:18:45 +0000 |
---|---|---|
committer | Curt Coder <curtcoder@mail.com> | 2012-09-10 14:18:45 +0000 |
commit | be3af47f06821ce44fa7ebd16c026ede804d82bf (patch) | |
tree | b23d5c56e44b0d689a6bd5431e26bfa3cd39d04d /src/emu | |
parent | 7de113e8959929b99676f27f6a9762461c01ef7d (diff) |
(MESS) c128: MMU WIP. (nw)
(MESS) mos6581: Improved interface. (nw)
mos6526: Improved interface. (nw)
Diffstat (limited to 'src/emu')
-rw-r--r-- | src/emu/machine/6526cia.c | 44 | ||||
-rw-r--r-- | src/emu/machine/6526cia.h | 51 | ||||
-rw-r--r-- | src/emu/sound/sid6581.c | 8 | ||||
-rw-r--r-- | src/emu/sound/sid6581.h | 8 | ||||
-rw-r--r-- | src/emu/video/mc6845.c | 9 | ||||
-rw-r--r-- | src/emu/video/mc6845.h | 1 |
6 files changed, 87 insertions, 34 deletions
diff --git a/src/emu/machine/6526cia.c b/src/emu/machine/6526cia.c index 5c4ec103a7d..e55ebc04847 100644 --- a/src/emu/machine/6526cia.c +++ b/src/emu/machine/6526cia.c @@ -53,6 +53,7 @@ const device_type MOS6526R1 = &device_creator<mos6526r1_device>; const device_type MOS6526R2 = &device_creator<mos6526r2_device>; const device_type MOS8520 = &device_creator<mos8520_device>; +const device_type MOS5710 = &device_creator<mos5710_device>; @@ -89,6 +90,17 @@ mos6526r2_device::mos6526r2_device(const machine_config &mconfig, const char *ta mos8520_device::mos8520_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : mos6526_device(mconfig, MOS8520, "MOS8520", tag, owner, clock) { } +mos5710_device::mos5710_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : mos6526_device(mconfig, MOS5710, "MOS5710", tag, owner, clock) { } + + +void mos6526_device::static_set_tod_clock(device_t &device, int tod_clock) +{ + mos6526_device &cia = dynamic_cast<mos6526_device &>(device); + + cia.m_tod_clock = tod_clock; +} + //------------------------------------------------- // device_reset - device-specific reset @@ -152,7 +164,6 @@ void mos6526_device::device_config_complete() // or initialize to defaults if none provided else { - m_tod_clock = 0; memset(&m_out_irq_cb, 0, sizeof(m_out_irq_cb)); memset(&m_out_pc_cb, 0, sizeof(m_out_pc_cb)); memset(&m_out_cnt_cb, 0, sizeof(m_out_cnt_cb)); @@ -200,10 +211,10 @@ void mos6526_device::device_start() timer->m_irq = 0x01 << t; } - /* setup TOD timer, if appropriate */ - if (m_tod_clock != 0) + if (m_tod_clock > 0) { - machine().scheduler().timer_pulse(attotime::from_hz(m_tod_clock), FUNC(clock_tod_callback), 0, (void *)this); + m_tod_timer = timer_alloc(TIMER_TOD); + m_tod_timer->adjust(attotime::from_hz(m_tod_clock), 0, attotime::from_hz(m_tod_clock)); } /* state save support */ @@ -254,6 +265,10 @@ void mos6526_device::device_timer(emu_timer &timer, device_timer_id id, int para case TIMER_PC: m_out_pc_func(1); break; + + case TIMER_TOD: + clock_tod(); + break; } } @@ -506,17 +521,6 @@ void mos6526_device::clock_tod() /*------------------------------------------------- - clock_tod_callback --------------------------------------------------*/ - -TIMER_CALLBACK( mos6526_device::clock_tod_callback ) -{ - mos6526_device *cia = reinterpret_cast<mos6526_device *>(ptr); - cia->clock_tod(); -} - - -/*------------------------------------------------- cnt_w -------------------------------------------------*/ @@ -577,6 +581,16 @@ void mos6526_device::flag_w(UINT8 state) m_flag = state; } +READ8_MEMBER( mos6526_device::read ) +{ + return reg_r(offset); +} + +WRITE8_MEMBER( mos6526_device::write ) +{ + reg_w(offset, data); +} + /*------------------------------------------------- reg_r -------------------------------------------------*/ diff --git a/src/emu/machine/6526cia.h b/src/emu/machine/6526cia.h index 3aee04adcd4..b28952c4a2b 100644 --- a/src/emu/machine/6526cia.h +++ b/src/emu/machine/6526cia.h @@ -43,17 +43,26 @@ // INTERFACE CONFIGURATION MACROS //************************************************************************** -#define MCFG_MOS6526R1_ADD(_tag, _clock, _config) \ +#define MCFG_MOS6526R1_ADD(_tag, _clock, _tod_clock, _config) \ MCFG_DEVICE_ADD(_tag, MOS6526R1, _clock) \ - MCFG_DEVICE_CONFIG(_config) + MCFG_DEVICE_CONFIG(_config) \ + mos6526_device::static_set_tod_clock(*device, _tod_clock); -#define MCFG_MOS6526R2_ADD(_tag, _clock, _config) \ +#define MCFG_MOS6526R2_ADD(_tag, _clock, _tod_clock, _config) \ MCFG_DEVICE_ADD(_tag, MOS6526R2, _clock) \ - MCFG_DEVICE_CONFIG(_config) + MCFG_DEVICE_CONFIG(_config) \ + mos6526_device::static_set_tod_clock(*device, _tod_clock); -#define MCFG_MOS8520_ADD(_tag, _clock, _config) \ +#define MCFG_MOS8520_ADD(_tag, _clock, _tod_clock, _config) \ MCFG_DEVICE_ADD(_tag, MOS8520, _clock) \ - MCFG_DEVICE_CONFIG(_config) + MCFG_DEVICE_CONFIG(_config) \ + mos6526_device::static_set_tod_clock(*device, _tod_clock); + +#define MCFG_MOS5710_ADD(_tag, _clock, _tod_clock, _config) \ + MCFG_DEVICE_ADD(_tag, MOS5710, _clock) \ + MCFG_DEVICE_CONFIG(_config) \ + mos6526_device::static_set_tod_clock(*device, _tod_clock); + #define MOS6526_INTERFACE(name) \ const mos6526_interface (name)= @@ -61,6 +70,11 @@ #define MOS8520_INTERFACE(name) \ const mos6526_interface (name)= +#define MOS5710_INTERFACE(name) \ + const mos6526_interface (name)= + + + /*************************************************************************** TYPE DEFINITIONS ***************************************************************************/ @@ -70,8 +84,6 @@ struct mos6526_interface { - int m_tod_clock; - devcb_write_line m_out_irq_cb; devcb_write_line m_out_pc_cb; devcb_write_line m_out_cnt_cb; @@ -91,13 +103,17 @@ struct mos6526_interface class mos6526_device : public device_t, public mos6526_interface { - friend class dart_channel; - protected: // construction/destruction mos6526_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); public: + // inline configuration + static void static_set_tod_clock(device_t &device, int tod_clock); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + UINT8 reg_r(UINT8 offset); void reg_w(UINT8 offset, UINT8 data); @@ -138,7 +154,11 @@ protected: static TIMER_CALLBACK( clock_tod_callback ); private: - static const device_timer_id TIMER_PC = 0; + enum + { + TIMER_PC, + TIMER_TOD + }; inline attotime cycles_to_time(int c); void update_pc(); @@ -185,6 +205,7 @@ private: cia_timer m_timer[2]; /* Time Of the Day clock (TOD) */ + int m_tod_clock; UINT32 m_tod; UINT32 m_tod_latch; UINT8 m_tod_latched; @@ -206,6 +227,7 @@ private: UINT8 m_serial; emu_timer *m_pc_timer; + emu_timer *m_tod_timer; }; class mos6526r1_device : public mos6526_device @@ -226,11 +248,18 @@ public: mos8520_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); }; +class mos5710_device : public mos6526_device +{ +public: + mos5710_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + // device type definition extern const device_type MOS6526R1; extern const device_type MOS6526R2; extern const device_type MOS8520; +extern const device_type MOS5710; diff --git a/src/emu/sound/sid6581.c b/src/emu/sound/sid6581.c index 60bab96bf6c..248838ae47a 100644 --- a/src/emu/sound/sid6581.c +++ b/src/emu/sound/sid6581.c @@ -73,15 +73,15 @@ static DEVICE_START( sid8580 ) -READ8_DEVICE_HANDLER ( sid6581_r ) +READ8_MEMBER( sid6581_device::read ) { - return sid6581_port_r(device->machine(), get_sid(device), offset); + return sid6581_port_r(machine(), get_sid(this), offset); } -WRITE8_DEVICE_HANDLER ( sid6581_w ) +WRITE8_MEMBER( sid6581_device::write ) { - sid6581_port_w(get_sid(device), offset, data); + sid6581_port_w(get_sid(this), offset, data); } const device_type SID6581 = &device_creator<sid6581_device>; diff --git a/src/emu/sound/sid6581.h b/src/emu/sound/sid6581.h index ba6e74d6d7e..1ea20c528d4 100644 --- a/src/emu/sound/sid6581.h +++ b/src/emu/sound/sid6581.h @@ -30,10 +30,6 @@ struct _sid6581_interface devcb_read8 in_poty_cb; }; - -READ8_DEVICE_HANDLER ( sid6581_r ); -WRITE8_DEVICE_HANDLER ( sid6581_w ); - class sid6581_device : public device_t, public device_sound_interface { @@ -44,6 +40,10 @@ public: // access to legacy token void *token() const { assert(m_token != NULL); return m_token; } + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + protected: // device-level overrides virtual void device_config_complete(); diff --git a/src/emu/video/mc6845.c b/src/emu/video/mc6845.c index 06c1b223876..c29acbb26c4 100644 --- a/src/emu/video/mc6845.c +++ b/src/emu/video/mc6845.c @@ -1169,6 +1169,8 @@ void mos8563_device::device_start() m_supports_status_reg_d7 = true; m_update_ready_bit = 1; + m_update_row = vdc_update_row; + save_item(NAME(m_char_buffer)); save_item(NAME(m_attr_buffer)); save_item(NAME(m_attribute_addr)); @@ -1424,3 +1426,10 @@ void mos8563_device::update_row(bitmap_rgb32 &bitmap, const rectangle &cliprect, } } } + +MC6845_UPDATE_ROW( mos8563_device::vdc_update_row ) +{ + mos8563_device *mos8563 = static_cast<mos8563_device *>(device); + + mos8563->update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, param); +} diff --git a/src/emu/video/mc6845.h b/src/emu/video/mc6845.h index 2b9582b5f24..6ba8a4a5ded 100644 --- a/src/emu/video/mc6845.h +++ b/src/emu/video/mc6845.h @@ -395,6 +395,7 @@ public: inline void write_videoram(offs_t offset, UINT8 data); void update_row(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param); + static MC6845_UPDATE_ROW( vdc_update_row ); protected: // device-level overrides |