From d70a5a252205e8bc4cb715fb354cebb7345f2966 Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 13 Aug 2018 14:20:31 -0400 Subject: tms57002: Add dready callback for superctr (nw) --- src/devices/cpu/tms57002/tms57002.cpp | 13 +++++++++++++ src/devices/cpu/tms57002/tms57002.h | 7 +++++++ src/devices/cpu/tms57002/tmsinstr.lst | 1 + 3 files changed, 21 insertions(+) diff --git a/src/devices/cpu/tms57002/tms57002.cpp b/src/devices/cpu/tms57002/tms57002.cpp index 55f36c2369d..6e93f82040f 100644 --- a/src/devices/cpu/tms57002/tms57002.cpp +++ b/src/devices/cpu/tms57002/tms57002.cpp @@ -26,6 +26,7 @@ tms57002_device::tms57002_device(const machine_config &mconfig, const char *tag, : cpu_device(mconfig, TMS57002, tag, owner, clock) , device_sound_interface(mconfig, *this) , macc(0), st0(0), st1(0), sti(0), txrd(0) + , m_dready_callback(*this) , program_config("program", ENDIANNESS_LITTLE, 32, 8, -2, address_map_constructor(FUNC(tms57002_device::internal_pgm), this)) , data_config("data", ENDIANNESS_LITTLE, 8, 20) { @@ -80,6 +81,7 @@ void tms57002_device::device_reset() ST0_PBCO | ST0_CNS); st1 &= ~(ST1_AOV | ST1_SFAI | ST1_SFAO | ST1_MOVM | ST1_MOV | ST1_SFMA | ST1_SFMO | ST1_RND | ST1_CRM | ST1_DBP); + update_dready(); xba = 0; xoa = 0; @@ -152,6 +154,7 @@ READ8_MEMBER(tms57002_device::data_r) if(hidx == 4) { hidx = 0; sti &= ~S_HOST; + update_dready(); } return res; @@ -167,6 +170,11 @@ READ_LINE_MEMBER(tms57002_device::dready_r) return sti & S_HOST ? 0 : 1; } +void tms57002_device::update_dready() +{ + m_dready_callback(sti & S_HOST ? 0 : 1); +} + READ_LINE_MEMBER(tms57002_device::pc0_r) { return pc == 0 ? 0 : 1; @@ -814,6 +822,11 @@ void tms57002_device::sound_stream_update(sound_stream &stream, stream_sample_t sync_w(1); } +void tms57002_device::device_resolve_objects() +{ + m_dready_callback.resolve_safe(); +} + void tms57002_device::device_start() { sti = S_IDLE; diff --git a/src/devices/cpu/tms57002/tms57002.h b/src/devices/cpu/tms57002/tms57002.h index f0cf2eb03c3..640aed2a55b 100644 --- a/src/devices/cpu/tms57002/tms57002.h +++ b/src/devices/cpu/tms57002/tms57002.h @@ -16,6 +16,8 @@ class tms57002_device : public cpu_device, public device_sound_interface { public: tms57002_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + auto dready_callback() { return m_dready_callback.bind(); } + DECLARE_READ8_MEMBER(data_r); DECLARE_WRITE8_MEMBER(data_w); @@ -28,6 +30,7 @@ public: void internal_pgm(address_map &map); protected: + virtual void device_resolve_objects() override; virtual void device_start() override; virtual void device_reset() override; virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; @@ -136,6 +139,8 @@ private: cd cache; + devcb_write_line m_dready_callback; + const address_space_config program_config, data_config; address_space *program, *data; @@ -158,6 +163,8 @@ private: inline int movm(uint32_t st1); inline int sfma(uint32_t st1); + void update_dready(); + void xm_init(); void xm_step_read(); void xm_step_write(); diff --git a/src/devices/cpu/tms57002/tmsinstr.lst b/src/devices/cpu/tms57002/tmsinstr.lst index d3fb0fa57f5..c1c0a2cf658 100644 --- a/src/devices/cpu/tms57002/tmsinstr.lst +++ b/src/devices/cpu/tms57002/tmsinstr.lst @@ -240,6 +240,7 @@ lpc 2b 31 1 n host[3] = c; hidx = 0; sti |= S_HOST; + update_dready(); lpd 2b 30 1 n lpd %d -- cgit v1.2.3