summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/scudsp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/scudsp')
-rw-r--r--src/devices/cpu/scudsp/scudsp.cpp32
-rw-r--r--src/devices/cpu/scudsp/scudsp.h25
2 files changed, 25 insertions, 32 deletions
diff --git a/src/devices/cpu/scudsp/scudsp.cpp b/src/devices/cpu/scudsp/scudsp.cpp
index 920d75ac4f5..79f7c0402b8 100644
--- a/src/devices/cpu/scudsp/scudsp.cpp
+++ b/src/devices/cpu/scudsp/scudsp.cpp
@@ -5,7 +5,7 @@
* scudsp.c
* Sega SCUDSP emulator version 1.00
*
- * copyright Angelo Salese & Mariusz Wojcieszek, all rights reserved
+ * copyright Angelo Salese & Mariusz Wojcieszek
*
* Changelog:
* 131010: Angelo Salese
@@ -94,8 +94,6 @@
#include "scudsp.h"
#include "scudspdasm.h"
-#include "debugger.h"
-
DEFINE_DEVICE_TYPE(SCUDSP, scudsp_cpu_device, "scudsp", "Sega SCUDSP")
@@ -130,6 +128,8 @@ DEFINE_DEVICE_TYPE(SCUDSP, scudsp_cpu_device, "scudsp", "Sega SCUDSP")
#define scudsp_readmem(A,MD) m_data->read_dword(A | (MD << 6))
#define scudsp_writemem(A,MD,B) m_data->write_dword(A | (MD << 6), B)
+constexpr uint64_t concat_64(uint32_t hi, uint32_t lo) { return (uint64_t(hi) << 32) | lo; }
+
uint32_t scudsp_cpu_device::scudsp_get_source_mem_reg_value( uint32_t mode )
{
if ( mode < 0x8 )
@@ -340,12 +340,12 @@ uint32_t scudsp_cpu_device::scudsp_get_mem_source_dma( uint32_t memcode, uint32_
}
-READ32_MEMBER( scudsp_cpu_device::program_control_r )
+uint32_t scudsp_cpu_device::program_control_r()
{
return (m_pc & 0xff) | (m_flags & FLAGS_MASK);
}
-WRITE32_MEMBER( scudsp_cpu_device::program_control_w )
+void scudsp_cpu_device::program_control_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
uint32_t oldval, newval;
@@ -362,13 +362,13 @@ WRITE32_MEMBER( scudsp_cpu_device::program_control_w )
set_input_line(INPUT_LINE_RESET, (EXF) ? CLEAR_LINE : ASSERT_LINE);
}
-WRITE32_MEMBER( scudsp_cpu_device::program_w )
+void scudsp_cpu_device::program_w(uint32_t data)
{
//printf("%02x %08x PRG\n",m_pc,data);
scudsp_writeop(m_pc++, data);
}
-WRITE32_MEMBER( scudsp_cpu_device::ram_address_control_w )
+void scudsp_cpu_device::ram_address_control_w(uint32_t data)
{
//printf("%02x %08x PRG\n",m_pc,data);
m_ra = data & 0xff;
@@ -382,7 +382,7 @@ WRITE32_MEMBER( scudsp_cpu_device::ram_address_control_w )
}
}
-READ32_MEMBER( scudsp_cpu_device::ram_address_r )
+uint32_t scudsp_cpu_device::ram_address_r()
{
uint32_t data;
@@ -391,7 +391,7 @@ READ32_MEMBER( scudsp_cpu_device::ram_address_r )
return data;
}
-WRITE32_MEMBER( scudsp_cpu_device::ram_address_w )
+void scudsp_cpu_device::ram_address_w(uint32_t data)
{
scudsp_set_dest_mem_reg( (m_ra & 0xc0) >> 6, data );
}
@@ -498,7 +498,7 @@ void scudsp_cpu_device::scudsp_operation(uint32_t opcode)
/* Unrecognized opcode */
break;
case 0xF: /* RL8 */
- i3 = ((m_acl.si << 8) & 0xffffff00) | ((m_acl.si >> 24) & 0xff);
+ i3 = rotl_32(m_acl.si, 8);
m_alu = i3;
SET_Z( i3 == 0 );
SET_S( i3 < 0 );
@@ -611,15 +611,13 @@ void scudsp_cpu_device::scudsp_move_immediate( uint32_t opcode )
{
if ( scudsp_compute_condition( (opcode & 0x3F80000 ) >> 19 ) )
{
- value = opcode & 0x7ffff;
- if ( value & 0x40000 ) value |= 0xfff80000;
+ value = util::sext( opcode, 19 );
scudsp_set_dest_mem_reg_2( (opcode & 0x3C000000) >> 26, value );
}
}
else
{
- value = opcode & 0x1ffffff;
- if ( value & 0x1000000 ) value |= 0xfe000000;
+ value = util::sext( opcode, 25 );
scudsp_set_dest_mem_reg_2( (opcode & 0x3C000000) >> 26, value );
}
m_icount -= 1;
@@ -989,10 +987,6 @@ void scudsp_cpu_device::device_start()
state_add( STATE_GENPCBASE, "CURPC", m_pc ).noshow();
state_add( STATE_GENFLAGS, "GENFLAGS", m_flags ).formatstr("%17s").noshow();
- m_out_irq_cb.resolve_safe();
- m_in_dma_cb.resolve_safe(0);
- m_out_dma_cb.resolve_safe();
-
set_icountptr(m_icount);
}
@@ -1023,7 +1017,7 @@ void scudsp_cpu_device::data_map(address_map &map)
scudsp_cpu_device::scudsp_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: cpu_device(mconfig, SCUDSP, tag, owner, clock)
, m_out_irq_cb(*this)
- , m_in_dma_cb(*this)
+ , m_in_dma_cb(*this, 0)
, m_out_dma_cb(*this)
, m_program_config("program", ENDIANNESS_BIG, 32, 8, -2, address_map_constructor(FUNC(scudsp_cpu_device::program_map), this))
, m_data_config("data", ENDIANNESS_BIG, 32, 8, -2, address_map_constructor(FUNC(scudsp_cpu_device::data_map), this))
diff --git a/src/devices/cpu/scudsp/scudsp.h b/src/devices/cpu/scudsp/scudsp.h
index 9b271f8b53e..bb4bc6b8fea 100644
--- a/src/devices/cpu/scudsp/scudsp.h
+++ b/src/devices/cpu/scudsp/scudsp.h
@@ -49,27 +49,26 @@ public:
auto out_dma_callback() { return m_out_dma_cb.bind(); }
/* port 0 */
- DECLARE_READ32_MEMBER( program_control_r );
- DECLARE_WRITE32_MEMBER( program_control_w );
+ uint32_t program_control_r();
+ void program_control_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
/* port 1 */
- DECLARE_WRITE32_MEMBER( program_w );
+ void program_w(uint32_t data);
/* port 2 */
- DECLARE_WRITE32_MEMBER( ram_address_control_w );
+ void ram_address_control_w(uint32_t data);
/* port 3 */
- DECLARE_READ32_MEMBER( ram_address_r );
- DECLARE_WRITE32_MEMBER( ram_address_w );
+ uint32_t ram_address_r();
+ void ram_address_w(uint32_t data);
- void data_map(address_map &map);
- void program_map(address_map &map);
+ void data_map(address_map &map) ATTR_COLD;
+ void program_map(address_map &map) ATTR_COLD;
protected:
// device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
+ virtual void device_start() override ATTR_COLD;
+ virtual void device_reset() override ATTR_COLD;
// device_execute_interface overrides
- virtual uint32_t execute_min_cycles() const override { return 1; }
- virtual uint32_t execute_max_cycles() const override { return 7; }
- virtual uint32_t execute_input_lines() const override { return 0; }
+ virtual uint32_t execute_min_cycles() const noexcept override { return 1; }
+ virtual uint32_t execute_max_cycles() const noexcept override { return 7; }
virtual void execute_run() override;
virtual void execute_set_input(int inputnum, int state) override;