runtime enable for sharcdrc (nw)

This commit is contained in:
Ville Linde 2016-06-06 23:36:12 +03:00
parent 758aaa496a
commit 728e18f768
5 changed files with 95 additions and 58 deletions

View File

@ -11,7 +11,6 @@
#include "sharcfe.h"
#define ENABLE_DRC 0
#define DISABLE_FAST_REGISTERS 1
@ -76,6 +75,7 @@ adsp21062_device::adsp21062_device(const machine_config &mconfig, const char *ta
, m_cache(CACHE_SIZE + sizeof(sharc_internal_state))
, m_drcuml(nullptr)
, m_drcfe(nullptr)
, m_enable_drc(false)
{
}
@ -86,6 +86,11 @@ offs_t adsp21062_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8
return CPU_DISASSEMBLE_NAME(sharc)(this, buffer, pc, oprom, opram, options);
}
void adsp21062_device::enable_recompiler()
{
m_enable_drc = true;
}
void adsp21062_device::CHANGE_PC(UINT32 newpc)
{
@ -892,45 +897,48 @@ void adsp21062_device::check_interrupts()
void adsp21062_device::execute_run()
{
#if ENABLE_DRC
if (m_core->irq_pending != 0)
if (m_enable_drc)
{
m_core->idle = 0;
}
execute_run_drc();
return;
#else
if (m_core->idle && m_core->irq_pending == 0)
{
m_core->icount = 0;
debugger_instruction_hook(this, m_core->daddr);
}
if (m_core->irq_pending != 0)
{
check_interrupts();
m_core->idle = 0;
}
while (m_core->icount > 0 && !m_core->idle)
{
m_core->pc = m_core->daddr;
m_core->daddr = m_core->faddr;
m_core->faddr = m_core->nfaddr;
m_core->nfaddr++;
m_core->astat_old_old_old = m_core->astat_old_old;
m_core->astat_old_old = m_core->astat_old;
m_core->astat_old = m_core->astat;
debugger_instruction_hook(this, m_core->pc);
m_core->opcode = ROPCODE(m_core->pc);
// handle looping
if (m_core->pc == m_core->laddr.addr)
if (m_core->irq_pending != 0)
{
switch (m_core->laddr.loop_type)
m_core->idle = 0;
}
execute_run_drc();
return;
}
else
{
if (m_core->idle && m_core->irq_pending == 0)
{
m_core->icount = 0;
debugger_instruction_hook(this, m_core->daddr);
}
if (m_core->irq_pending != 0)
{
check_interrupts();
m_core->idle = 0;
}
while (m_core->icount > 0 && !m_core->idle)
{
m_core->pc = m_core->daddr;
m_core->daddr = m_core->faddr;
m_core->faddr = m_core->nfaddr;
m_core->nfaddr++;
m_core->astat_old_old_old = m_core->astat_old_old;
m_core->astat_old_old = m_core->astat_old;
m_core->astat_old = m_core->astat;
debugger_instruction_hook(this, m_core->pc);
m_core->opcode = ROPCODE(m_core->pc);
// handle looping
if (m_core->pc == m_core->laddr.addr)
{
switch (m_core->laddr.loop_type)
{
case 0: // arithmetic condition-based
{
int condition = m_core->laddr.code;
@ -980,27 +988,27 @@ void adsp21062_device::execute_run()
CHANGE_PC(TOP_PC());
}
}
}
}
}
(this->*m_sharc_op[(m_core->opcode >> 39) & 0x1ff])();
(this->*m_sharc_op[(m_core->opcode >> 39) & 0x1ff])();
// System register latency effect
if (m_core->systemreg_latency_cycles > 0)
{
--m_core->systemreg_latency_cycles;
if (m_core->systemreg_latency_cycles <= 0)
// System register latency effect
if (m_core->systemreg_latency_cycles > 0)
{
systemreg_write_latency_effect();
--m_core->systemreg_latency_cycles;
if (m_core->systemreg_latency_cycles <= 0)
{
systemreg_write_latency_effect();
}
}
}
--m_core->icount;
};
#endif
--m_core->icount;
};
}
}
bool adsp21062_device::memory_read(address_spacenum spacenum, offs_t offset, int size, UINT64 &value)

View File

@ -168,6 +168,8 @@ public:
void sharc_cfunc_unimplemented_shiftimm();
void sharc_cfunc_write_snoop();
void enable_recompiler();
enum ASTAT_FLAGS
{
// ASTAT flags
@ -452,6 +454,8 @@ private:
UINT16 m_internal_ram[2 * 0x10000]; // 2x 128KB
bool m_enable_drc;
inline void CHANGE_PC(UINT32 newpc);
inline void CHANGE_PC_DELAYED(UINT32 newpc);
void sharc_iop_delayed_w(UINT32 reg, UINT32 data, int cycles);

View File

@ -272,7 +272,7 @@ public:
required_device<ppc_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<adsp21062_device> m_dsp;
optional_device<cpu_device> m_dsp2;
optional_device<adsp21062_device> m_dsp2;
required_device<k056800_device> m_k056800;
required_device<adc1038_device> m_adc1038;
required_device<eeprom_serial_93cxx_device> m_eeprom;
@ -1402,6 +1402,8 @@ ROM_END
DRIVER_INIT_MEMBER(gticlub_state,gticlub)
{
m_sharc_dataram_0 = std::make_unique<UINT32[]>(0x100000/4);
m_dsp->enable_recompiler();
}
void gticlub_state::init_hangplt_common()

View File

@ -369,8 +369,8 @@ public:
required_device<cpu_device> m_audiocpu;
required_device<k056800_device> m_k056800;
optional_device<cpu_device> m_gn680;
required_device<cpu_device> m_dsp;
optional_device<cpu_device> m_dsp2;
required_device<adsp21062_device> m_dsp;
optional_device<adsp21062_device> m_dsp2;
optional_device<k037122_device> m_k037122_1;
optional_device<k037122_device> m_k037122_2;
required_device<adc12138_device> m_adc12138;
@ -423,6 +423,9 @@ public:
DECLARE_DRIVER_INIT(hornet);
DECLARE_DRIVER_INIT(hornet_2board);
DECLARE_DRIVER_INIT(gradius4);
DECLARE_DRIVER_INIT(nbapbp);
DECLARE_DRIVER_INIT(terabrst);
virtual void machine_start() override;
virtual void machine_reset() override;
DECLARE_MACHINE_RESET(hornet_2board);
@ -1118,7 +1121,7 @@ static MACHINE_CONFIG_DERIVED( hornet_2board, hornet )
MCFG_KONPPC_CGBOARD_TYPE(CGBOARD_TYPE_HORNET)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( terabrst, hornet_2board )
static MACHINE_CONFIG_DERIVED( terabrst, hornet )
MCFG_CPU_ADD("gn680", M68000, XTAL_32MHz/2) /* 16MHz */
MCFG_CPU_PROGRAM_MAP(gn680_memmap)
@ -1307,6 +1310,24 @@ DRIVER_INIT_MEMBER(hornet_state,hornet_2board)
m_maincpu->ppc4xx_spu_set_tx_handler(write8_delegate(FUNC(hornet_state::jamma_jvs_w), this));
}
DRIVER_INIT_MEMBER(hornet_state, gradius4)
{
DRIVER_INIT_CALL(hornet);
m_dsp->enable_recompiler();
}
DRIVER_INIT_MEMBER(hornet_state, nbapbp)
{
DRIVER_INIT_CALL(hornet);
m_dsp->enable_recompiler();
}
DRIVER_INIT_MEMBER(hornet_state, terabrst)
{
DRIVER_INIT_CALL(hornet);
m_dsp->enable_recompiler();
}
/*****************************************************************************/
ROM_START(sscope)
@ -1540,10 +1561,10 @@ ROM_END
/*************************************************************************/
GAME( 1998, gradius4, 0, hornet, hornet, hornet_state, hornet, ROT0, "Konami", "Gradius 4: Fukkatsu", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1998, nbapbp, 0, hornet, hornet, hornet_state, hornet, ROT0, "Konami", "NBA Play By Play", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAMEL( 1998, terabrst, 0, terabrst, hornet, hornet_state, hornet_2board, ROT0, "Konami", "Teraburst (1998/07/17 ver UEL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE, layout_dualhsxs )
GAMEL( 1998, terabrsta, terabrst, terabrst, hornet, hornet_state, hornet_2board, ROT0, "Konami", "Teraburst (1998/02/25 ver AAA)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE, layout_dualhsxs )
GAME( 1998, gradius4, 0, hornet, hornet, hornet_state, gradius4, ROT0, "Konami", "Gradius 4: Fukkatsu", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1998, nbapbp, 0, hornet, hornet, hornet_state, nbapbp, ROT0, "Konami", "NBA Play By Play", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1998, terabrst, 0, terabrst, hornet, hornet_state, terabrst, ROT0, "Konami", "Teraburst (1998/07/17 ver UEL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1998, terabrsta, terabrst, terabrst, hornet, hornet_state, terabrst, ROT0, "Konami", "Teraburst (1998/02/25 ver AAA)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
// The region comes from the Timekeeper NVRAM, without a valid default all sets except 'xxD, Ver 1.33' will init their NVRAM to UAx versions, the xxD set seems to incorrectly init it to JXD, which isn't a valid
// version, and thus can't be booted. If you copy the NVRAM from another already initialized set, it will boot as UAD.

View File

@ -216,7 +216,7 @@ public:
required_device<ppc_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<cpu_device> m_dsp;
required_device<adsp21062_device> m_dsp;
required_device<watchdog_timer_device> m_watchdog;
optional_device<k001604_device> m_k001604;
required_device<k056800_device> m_k056800;
@ -911,6 +911,8 @@ DRIVER_INIT_MEMBER(zr107_state,common)
m_sharc_dataram = std::make_unique<UINT32[]>(0x100000/4);
m_led_reg0 = m_led_reg1 = 0x7f;
m_ccu_vcth = m_ccu_vctl = 0;
m_dsp->enable_recompiler();
}
DRIVER_INIT_MEMBER(zr107_state,zr107)