Hooked SCUDSP to machine struct

This commit is contained in:
Angelo Salese 2013-10-10 13:46:23 +00:00
parent 997e4f2080
commit c32493ce46
6 changed files with 54 additions and 15 deletions

View File

@ -15,18 +15,43 @@ const device_type SCUDSP = &device_creator<scudsp_cpu_device>;
/* FLAGS */ /* FLAGS */
#if 0 #define PRF m_flags & 0x04000000
#define S 0x80 #define EPF m_flags & 0x02000000
#define Z 0x40 #define T0F m_flags & 0x00800000
#define OV 0x20 #define SF m_flags & 0x00400000
#define C 0x10 #define ZF m_flags & 0x00200000
#endif #define CF m_flags & 0x00100000
#define VF m_flags & 0x00080000
#define EF m_flags & 0x00040000
#define ESF m_flags & 0x00020000
#define EXF m_flags & 0x00010000 // execute flag (basically tied to RESET pin)
#define LEF m_flags & 0x00008000 // change PC value
#define scudsp_readop(A) m_program->read_dword(A) #define scudsp_readop(A) m_program->read_dword(A)
#define scudsp_readmem16(A) m_data->read_dword(A) #define scudsp_readmem16(A) m_data->read_dword(A)
#define scudsp_writemem16(A,B) m_data->write_dword((A),B) #define scudsp_writemem16(A,B) m_data->write_dword((A),B)
READ32_MEMBER( scudsp_cpu_device::program_control_r )
{
return (m_pc & 0xff) | (m_flags & 0xffffff00);
}
WRITE32_MEMBER( scudsp_cpu_device::program_control_w )
{
UINT32 oldval, newval;
oldval = (m_flags & 0xffffff00) | (m_pc & 0xff);
newval = oldval;
COMBINE_DATA(&newval);
m_flags = newval & 0xffffff00;
if(LEF)
m_pc = newval & 0xff;
set_input_line(INPUT_LINE_RESET, (EXF) ? CLEAR_LINE : ASSERT_LINE);
}
/*********************************** /***********************************
* illegal opcodes * illegal opcodes
@ -70,7 +95,8 @@ void scudsp_cpu_device::device_start()
save_item(NAME(m_reset_state)); save_item(NAME(m_reset_state));
// Register state for debugger // Register state for debugger
// state_add( CP1610_R0, "PC", m_pc ).formatstr("%02X"); state_add( SCUDSP_PC, "PC", m_pc ).formatstr("%02X");
state_add( SCUDSP_FLAGS, "SR", m_flags ).formatstr("%08X");
state_add( STATE_GENPC, "curpc", m_pc ).noshow(); state_add( STATE_GENPC, "curpc", m_pc ).noshow();
state_add( STATE_GENFLAGS, "GENFLAGS", m_flags ).noshow(); state_add( STATE_GENFLAGS, "GENFLAGS", m_flags ).noshow();

View File

@ -11,13 +11,10 @@
#ifndef __SCUDSP_H__ #ifndef __SCUDSP_H__
#define __SCUDSP_H__ #define __SCUDSP_H__
#if 0
enum enum
{ {
SCUDSP_R0=1, SCUDSP_R1, SCUDSP_R2, SCUDSP_R3, SCUDSP_PC=1, SCUDSP_FLAGS
SCUDSP_R4, SCUDSP_R5, SCUDSP_R6, SCUDSP_R7
}; };
#endif
#define SCUDSP_RESET INPUT_LINE_RESET /* Non-Maskable */ #define SCUDSP_RESET INPUT_LINE_RESET /* Non-Maskable */
@ -28,6 +25,11 @@ public:
// construction/destruction // construction/destruction
scudsp_cpu_device(const machine_config &mconfig, const char *_tag, device_t *_owner, UINT32 _clock); scudsp_cpu_device(const machine_config &mconfig, const char *_tag, device_t *_owner, UINT32 _clock);
DECLARE_READ32_MEMBER( program_control_r );
DECLARE_WRITE32_MEMBER( program_control_w );
// virtual DECLARE_ADDRESS_MAP(map, 32) = 0;
protected: protected:
// device-level overrides // device-level overrides
virtual void device_start(); virtual void device_start();
@ -56,7 +58,7 @@ private:
address_space_config m_data_config; address_space_config m_data_config;
UINT8 m_pc; /* registers */ UINT8 m_pc; /* registers */
UINT8 m_flags; /* flags */ UINT32 m_flags; /* flags */
int m_reset_state; int m_reset_state;
address_space *m_program; address_space *m_program;
address_space *m_data; address_space *m_data;

View File

@ -238,6 +238,7 @@ READ32_MEMBER(saturn_state::saturn_scu_r)
res = m_scu.status; res = m_scu.status;
break; break;
case 0x80/4: case 0x80/4:
res = m_scudsp->program_control_r(space, 0, mem_mask);
res = dsp_prg_ctrl_r(space); res = dsp_prg_ctrl_r(space);
break; break;
case 0x8c/4: case 0x8c/4:
@ -313,6 +314,7 @@ WRITE32_MEMBER(saturn_state::saturn_scu_w)
case 0x80/4: case 0x80/4:
/* TODO: you can't overwrite some flags with this */ /* TODO: you can't overwrite some flags with this */
dsp_prg_ctrl_w(space, m_scu_regs[offset]); dsp_prg_ctrl_w(space, m_scu_regs[offset]);
m_scudsp->program_control_w(space, 0, mem_mask,data);
if(LOG_SCU) logerror("SCU DSP: Program Control Port Access %08x\n",data); if(LOG_SCU) logerror("SCU DSP: Program Control Port Access %08x\n",data);
break; break;
case 0x84/4: case 0x84/4:

View File

@ -39,6 +39,7 @@
#include "cpu/sh2/sh2.h" #include "cpu/sh2/sh2.h"
#include "cpu/m68000/m68000.h" #include "cpu/m68000/m68000.h"
#include "cpu/adsp2100/adsp2100.h" #include "cpu/adsp2100/adsp2100.h"
#include "cpu/scudsp/scudsp.h"
#include "machine/eepromser.h" #include "machine/eepromser.h"
#include "machine/scudsp.h" #include "machine/scudsp.h"
#include "sound/scsp.h" #include "sound/scsp.h"
@ -976,6 +977,11 @@ static MACHINE_CONFIG_START( stv, stv_state )
MCFG_CPU_ADD("audiocpu", M68000, 11289600) //11.2896 MHz MCFG_CPU_ADD("audiocpu", M68000, 11289600) //11.2896 MHz
MCFG_CPU_PROGRAM_MAP(sound_mem) MCFG_CPU_PROGRAM_MAP(sound_mem)
MCFG_CPU_ADD("scudsp", SCUDSP, MASTER_CLOCK_352/4) // 14 MHz
MCFG_CPU_PROGRAM_MAP(scudsp_mem)
MCFG_CPU_DATA_MAP(scudsp_data)
// MCFG_CPU_CONFIG(scudsp_config)
MCFG_MACHINE_START_OVERRIDE(stv_state,stv) MCFG_MACHINE_START_OVERRIDE(stv_state,stv)
MCFG_MACHINE_RESET_OVERRIDE(stv_state,stv) MCFG_MACHINE_RESET_OVERRIDE(stv_state,stv)
@ -1220,6 +1226,7 @@ MACHINE_RESET_MEMBER(stv_state,stv)
// don't let the slave cpu and the 68k go anywhere // don't let the slave cpu and the 68k go anywhere
m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
m_scudsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
m_en_68k = 0; m_en_68k = 0;
m_NMI_reset = 0; m_NMI_reset = 0;

View File

@ -3,6 +3,7 @@
#include "machine/eepromser.h" #include "machine/eepromser.h"
#include "cpu/m68000/m68000.h" #include "cpu/m68000/m68000.h"
#include "cpu/adsp2100/adsp2100.h" #include "cpu/adsp2100/adsp2100.h"
#include "cpu/scudsp/scudsp.h"
#define MAX_FILTERS (24) #define MAX_FILTERS (24)
#define MAX_BLOCKS (200) #define MAX_BLOCKS (200)
@ -20,6 +21,7 @@ public:
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_slave(*this, "slave"), m_slave(*this, "slave"),
m_audiocpu(*this, "audiocpu"), m_audiocpu(*this, "audiocpu"),
m_scudsp(*this, "scudsp"),
m_eeprom(*this, "eeprom") m_eeprom(*this, "eeprom")
{ {
} }
@ -144,6 +146,7 @@ public:
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_slave; required_device<cpu_device> m_slave;
required_device<m68000_base_device> m_audiocpu; required_device<m68000_base_device> m_audiocpu;
required_device<scudsp_cpu_device> m_scudsp;
optional_device<eeprom_serial_93cxx_device> m_eeprom; optional_device<eeprom_serial_93cxx_device> m_eeprom;
bitmap_rgb32 m_tmpbitmap; bitmap_rgb32 m_tmpbitmap;

View File

@ -184,7 +184,7 @@ static ADDRESS_MAP_START( sound_mem, AS_PROGRAM, 16, sat_console_state )
AM_RANGE(0x100000, 0x100fff) AM_DEVREADWRITE_LEGACY("scsp", scsp_r, scsp_w) AM_RANGE(0x100000, 0x100fff) AM_DEVREADWRITE_LEGACY("scsp", scsp_r, scsp_w)
ADDRESS_MAP_END ADDRESS_MAP_END
#if 0 #if 1
static ADDRESS_MAP_START( scudsp_mem, AS_PROGRAM, 32, sat_console_state ) static ADDRESS_MAP_START( scudsp_mem, AS_PROGRAM, 32, sat_console_state )
AM_RANGE(0x00, 0xff) AM_RAM AM_RANGE(0x00, 0xff) AM_RAM
ADDRESS_MAP_END ADDRESS_MAP_END
@ -706,6 +706,7 @@ MACHINE_RESET_MEMBER(sat_console_state,saturn)
// don't let the slave cpu and the 68k go anywhere // don't let the slave cpu and the 68k go anywhere
m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
m_scudsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
m_smpc.SR = 0x40; // this bit is always on according to docs m_smpc.SR = 0x40; // this bit is always on according to docs
@ -754,12 +755,10 @@ static MACHINE_CONFIG_START( saturn, sat_console_state )
MCFG_CPU_ADD("audiocpu", M68000, 11289600) //256 x 44100 Hz = 11.2896 MHz MCFG_CPU_ADD("audiocpu", M68000, 11289600) //256 x 44100 Hz = 11.2896 MHz
MCFG_CPU_PROGRAM_MAP(sound_mem) MCFG_CPU_PROGRAM_MAP(sound_mem)
#if 0
MCFG_CPU_ADD("scudsp", SCUDSP, MASTER_CLOCK_352/4) // 14 MHz MCFG_CPU_ADD("scudsp", SCUDSP, MASTER_CLOCK_352/4) // 14 MHz
MCFG_CPU_PROGRAM_MAP(scudsp_mem) MCFG_CPU_PROGRAM_MAP(scudsp_mem)
MCFG_CPU_DATA_MAP(scudsp_data) MCFG_CPU_DATA_MAP(scudsp_data)
// MCFG_CPU_CONFIG(scudsp_config) // MCFG_CPU_CONFIG(scudsp_config)
#endif
// SH-1 // SH-1