diff options
Diffstat (limited to 'src/devices/cpu/tms57002/tms57002.cpp')
-rw-r--r-- | src/devices/cpu/tms57002/tms57002.cpp | 67 |
1 files changed, 24 insertions, 43 deletions
diff --git a/src/devices/cpu/tms57002/tms57002.cpp b/src/devices/cpu/tms57002/tms57002.cpp index 576450c10aa..3485ba25695 100644 --- a/src/devices/cpu/tms57002/tms57002.cpp +++ b/src/devices/cpu/tms57002/tms57002.cpp @@ -10,7 +10,6 @@ #include "emu.h" #include "tms57002.h" -#include "debugger.h" #include "57002dsm.h" @@ -38,7 +37,7 @@ std::unique_ptr<util::disasm_interface> tms57002_device::create_disassembler() return std::make_unique<tms57002_disassembler>(); } -WRITE_LINE_MEMBER(tms57002_device::pload_w) +void tms57002_device::pload_w(int state) { u8 olds = sti; if (state) @@ -57,7 +56,7 @@ WRITE_LINE_MEMBER(tms57002_device::pload_w) } } -WRITE_LINE_MEMBER(tms57002_device::cload_w) +void tms57002_device::cload_w(int state) { u8 olds = sti; if (state) @@ -83,6 +82,9 @@ void tms57002_device::device_reset() id = 0; ba0 = 0; ba1 = 0; + sa = 0; + rptc = 0; + rptc_next = 0; update_counter_tail = 0; update_counter_head = 0; st0 &= ~(ST0_INCS | ST0_DIRI | ST0_FI | ST0_SIM | ST0_PLRI | @@ -183,7 +185,7 @@ u8 tms57002_device::data_r() return res; } -READ_LINE_MEMBER(tms57002_device::dready_r) +int tms57002_device::dready_r() { return sti & S_HOST ? 0 : 1; } @@ -193,7 +195,7 @@ void tms57002_device::update_dready() m_dready_callback(sti & S_HOST ? 0 : 1); } -READ_LINE_MEMBER(tms57002_device::pc0_r) +int tms57002_device::pc0_r() { return pc == 0 ? 0 : 1; } @@ -203,7 +205,7 @@ void tms57002_device::update_pc0() m_pc0_callback(pc == 0 ? 0 : 1); } -READ_LINE_MEMBER(tms57002_device::empty_r) +int tms57002_device::empty_r() { return (update_counter_head == update_counter_tail); } @@ -213,7 +215,7 @@ void tms57002_device::update_empty() m_empty_callback(update_counter_head == update_counter_tail); } -WRITE_LINE_MEMBER(tms57002_device::sync_w) +void tms57002_device::sync_w(int state) { if (sti & (IN_PLOAD /*| IN_CLOAD*/)) return; @@ -918,37 +920,22 @@ void tms57002_device::execute_run() icount = 0; } -void tms57002_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +void tms57002_device::sound_stream_update(sound_stream &stream) { - assert(samples == 1); + assert(stream.samples() == 1); - if (st0 & ST0_SIM) - { - si[0] = (inputs[0][0] << 8) & 0xffffff; - si[1] = (inputs[1][0] << 8) & 0xffffff; - si[2] = (inputs[2][0] << 8) & 0xffffff; - si[3] = (inputs[3][0] << 8) & 0xffffff; - } - else - { - si[0] = inputs[0][0] & 0xffffff; - si[1] = inputs[1][0] & 0xffffff; - si[2] = inputs[2][0] & 0xffffff; - si[3] = inputs[3][0] & 0xffffff; - } - outputs[0][0] = int16_t(so[0] >> 8); - outputs[1][0] = int16_t(so[1] >> 8); - outputs[2][0] = int16_t(so[2] >> 8); - outputs[3][0] = int16_t(so[3] >> 8); + sound_stream::sample_t in_scale = 32768.0 * ((st0 & ST0_SIM) ? 256.0 : 1.0); + si[0] = s32(stream.get(0, 0) * in_scale) & 0xffffff; + si[1] = s32(stream.get(1, 0) * in_scale) & 0xffffff; + si[2] = s32(stream.get(2, 0) * in_scale) & 0xffffff; + si[3] = s32(stream.get(3, 0) * in_scale) & 0xffffff; - sync_w(1); -} + stream.put(0, 0, s32(so[0] << 8) / 2147483648.0); + stream.put(1, 0, s32(so[1] << 8) / 2147483648.0); + stream.put(2, 0, s32(so[2] << 8) / 2147483648.0); + stream.put(3, 0, s32(so[3] << 8) / 2147483648.0); -void tms57002_device::device_resolve_objects() -{ - m_dready_callback.resolve_safe(); - m_pc0_callback.resolve_safe(); - m_empty_callback.resolve_safe(); + sync_w(1); } void tms57002_device::device_start() @@ -981,8 +968,7 @@ void tms57002_device::device_start() state_add(TMS57002_HOST3, "HOST3", host[3]); set_icountptr(icount); - - stream_alloc(4, 4, STREAM_SYNC); + stream_alloc(4, 4, SAMPLE_RATE_INPUT_ADAPTIVE, STREAM_SYNCHRONOUS); save_item(NAME(macc)); save_item(NAME(macc_read)); @@ -1026,21 +1012,16 @@ void tms57002_device::device_start() save_item(NAME(allow_update)); } -u32 tms57002_device::execute_min_cycles() const +u32 tms57002_device::execute_min_cycles() const noexcept { return 1; } -u32 tms57002_device::execute_max_cycles() const +u32 tms57002_device::execute_max_cycles() const noexcept { return 3; } -u32 tms57002_device::execute_input_lines() const -{ - return 0; -} - device_memory_interface::space_config_vector tms57002_device::memory_space_config() const { return space_config_vector { |