diff options
author | 2013-10-10 13:46:23 +0000 | |
---|---|---|
committer | 2013-10-10 13:46:23 +0000 | |
commit | c32493ce4672488f30189686325b317c40a2108f (patch) | |
tree | 0fb02f13168dc1e8913c427370d06f5947860448 | |
parent | 997e4f2080cb30321b00afbaa67e8aafdab9c768 (diff) |
Hooked SCUDSP to machine struct
-rw-r--r-- | src/emu/cpu/scudsp/scudsp.c | 40 | ||||
-rw-r--r-- | src/emu/cpu/scudsp/scudsp.h | 12 | ||||
-rw-r--r-- | src/emu/machine/saturn.c | 2 | ||||
-rw-r--r-- | src/mame/drivers/stv.c | 7 | ||||
-rw-r--r-- | src/mame/includes/stv.h | 3 | ||||
-rw-r--r-- | src/mess/drivers/saturn.c | 5 |
6 files changed, 54 insertions, 15 deletions
diff --git a/src/emu/cpu/scudsp/scudsp.c b/src/emu/cpu/scudsp/scudsp.c index 48af7f0eef1..b4ca54104ec 100644 --- a/src/emu/cpu/scudsp/scudsp.c +++ b/src/emu/cpu/scudsp/scudsp.c @@ -15,18 +15,43 @@ const device_type SCUDSP = &device_creator<scudsp_cpu_device>; /* FLAGS */ -#if 0 -#define S 0x80 -#define Z 0x40 -#define OV 0x20 -#define C 0x10 -#endif +#define PRF m_flags & 0x04000000 +#define EPF m_flags & 0x02000000 +#define T0F m_flags & 0x00800000 +#define SF m_flags & 0x00400000 +#define ZF m_flags & 0x00200000 +#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_readmem16(A) m_data->read_dword(A) #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 @@ -70,7 +95,8 @@ void scudsp_cpu_device::device_start() save_item(NAME(m_reset_state)); // 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_GENFLAGS, "GENFLAGS", m_flags ).noshow(); diff --git a/src/emu/cpu/scudsp/scudsp.h b/src/emu/cpu/scudsp/scudsp.h index b4366c453a2..67b8a0dfa9e 100644 --- a/src/emu/cpu/scudsp/scudsp.h +++ b/src/emu/cpu/scudsp/scudsp.h @@ -11,13 +11,10 @@ #ifndef __SCUDSP_H__ #define __SCUDSP_H__ -#if 0 enum { - SCUDSP_R0=1, SCUDSP_R1, SCUDSP_R2, SCUDSP_R3, - SCUDSP_R4, SCUDSP_R5, SCUDSP_R6, SCUDSP_R7 + SCUDSP_PC=1, SCUDSP_FLAGS }; -#endif #define SCUDSP_RESET INPUT_LINE_RESET /* Non-Maskable */ @@ -28,6 +25,11 @@ public: // construction/destruction 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: // device-level overrides virtual void device_start(); @@ -56,7 +58,7 @@ private: address_space_config m_data_config; UINT8 m_pc; /* registers */ - UINT8 m_flags; /* flags */ + UINT32 m_flags; /* flags */ int m_reset_state; address_space *m_program; address_space *m_data; diff --git a/src/emu/machine/saturn.c b/src/emu/machine/saturn.c index afd77a75113..40972459cd4 100644 --- a/src/emu/machine/saturn.c +++ b/src/emu/machine/saturn.c @@ -238,6 +238,7 @@ READ32_MEMBER(saturn_state::saturn_scu_r) res = m_scu.status; break; case 0x80/4: + res = m_scudsp->program_control_r(space, 0, mem_mask); res = dsp_prg_ctrl_r(space); break; case 0x8c/4: @@ -313,6 +314,7 @@ WRITE32_MEMBER(saturn_state::saturn_scu_w) case 0x80/4: /* TODO: you can't overwrite some flags with this */ 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); break; case 0x84/4: diff --git a/src/mame/drivers/stv.c b/src/mame/drivers/stv.c index e5df7ac2260..3a825294595 100644 --- a/src/mame/drivers/stv.c +++ b/src/mame/drivers/stv.c @@ -39,6 +39,7 @@ #include "cpu/sh2/sh2.h" #include "cpu/m68000/m68000.h" #include "cpu/adsp2100/adsp2100.h" +#include "cpu/scudsp/scudsp.h" #include "machine/eepromser.h" #include "machine/scudsp.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_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_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 m_slave->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_NMI_reset = 0; diff --git a/src/mame/includes/stv.h b/src/mame/includes/stv.h index d50f4a86b20..e0ec59e74b8 100644 --- a/src/mame/includes/stv.h +++ b/src/mame/includes/stv.h @@ -3,6 +3,7 @@ #include "machine/eepromser.h" #include "cpu/m68000/m68000.h" #include "cpu/adsp2100/adsp2100.h" +#include "cpu/scudsp/scudsp.h" #define MAX_FILTERS (24) #define MAX_BLOCKS (200) @@ -20,6 +21,7 @@ public: m_maincpu(*this, "maincpu"), m_slave(*this, "slave"), m_audiocpu(*this, "audiocpu"), + m_scudsp(*this, "scudsp"), m_eeprom(*this, "eeprom") { } @@ -144,6 +146,7 @@ public: required_device<cpu_device> m_maincpu; required_device<cpu_device> m_slave; required_device<m68000_base_device> m_audiocpu; + required_device<scudsp_cpu_device> m_scudsp; optional_device<eeprom_serial_93cxx_device> m_eeprom; bitmap_rgb32 m_tmpbitmap; diff --git a/src/mess/drivers/saturn.c b/src/mess/drivers/saturn.c index b04a63bff79..58f1ecef5c8 100644 --- a/src/mess/drivers/saturn.c +++ b/src/mess/drivers/saturn.c @@ -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) ADDRESS_MAP_END -#if 0 +#if 1 static ADDRESS_MAP_START( scudsp_mem, AS_PROGRAM, 32, sat_console_state ) AM_RANGE(0x00, 0xff) AM_RAM 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 m_slave->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 @@ -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_PROGRAM_MAP(sound_mem) -#if 0 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) -#endif // SH-1 |