Fixed update_handler for the dsp56k and polygonet. [Andrew Gardner]

(The driver more or less works again.  And holy moly is this thing fast with my crazy interleave values!)
This commit is contained in:
Andrew Gardner 2008-12-21 08:21:34 +00:00
parent f5ca4e1d0e
commit c17377e8a9
2 changed files with 40 additions and 7 deletions

View File

@ -39,12 +39,15 @@
***************************************************************************/
static CPU_RESET( dsp56k );
/***************************************************************************
ONBOARD MEMORY ALLOCATION
***************************************************************************/
// TODO: Put these in the cpustate!!!
static UINT16 *dsp56k_peripheral_ram;
static UINT16 *dsp56k_program_ram;
/***************************************************************************
COMPONENT FUNCTIONALITY
***************************************************************************/
@ -63,6 +66,22 @@ static UINT16 *dsp56k_program_ram;
// 4-8 Memory handlers for on-chip peripheral memory.
#include "dsp56mem.c"
/***************************************************************************
Direct Update Handler
***************************************************************************/
static DIRECT_UPDATE_HANDLER( dsp56k_direct_handler )
{
if (address >= (0x0000<<1) && address <= (0x07ff<<1))
{
direct->raw = direct->decrypted = (void*)(dsp56k_program_ram - (0x0000<<1));
return ~0;
}
return address;
}
/***************************************************************************
MEMORY ACCESSORS
***************************************************************************/
@ -172,6 +191,10 @@ static CPU_INIT( dsp56k )
cpustate->device = device;
cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
cpustate->data = memory_find_address_space(device, ADDRESS_SPACE_DATA);
/* Setup the direct memory handler for this CPU */
/* NOTE: Be sure to grab this guy and call him if you ever install another direct_update_hander in a driver! */
memory_set_direct_update_handler(cpustate->program, dsp56k_direct_handler);
}
static void agu_reset(dsp56k_core* cpustate)

View File

@ -105,6 +105,8 @@ static const UINT16 dsp56k_bank02_size = 0x4000; static UINT16* dsp56k_bank02_r
static const UINT16 dsp56k_shared_ram_16_size = 0x2000; static UINT16* dsp56k_shared_ram_16;
static const UINT16 dsp56k_bank04_size = 0x1fc0; static UINT16* dsp56k_bank04_ram;
static direct_update_func dsp56k_update_handler = NULL;
static const eeprom_interface eeprom_intf =
{
7, /* address bits */
@ -230,7 +232,7 @@ static READ32_HANDLER( dsp_host_interface_r )
if (mem_mask == 0x0000ff00) { hi_addr++; } /* Low byte */
if (mem_mask == 0xff000000) {} /* High byte */
value = dsp56k_host_interface_read((device_config*)space->cpu, hi_addr);
value = dsp56k_host_interface_read((device_config*)cputag_get_cpu(space->machine, "dsp"), hi_addr);
if (mem_mask == 0x0000ff00) { value <<= 8; }
if (mem_mask == 0xff000000) { value <<= 24; }
@ -300,7 +302,7 @@ static WRITE32_HANDLER( dsp_host_interface_w )
if (mem_mask == 0xff000000) { hi_data = (data & 0xff000000) >> 24; }
logerror("write (host-side) %08x %08x %08x (HI %04x)\n", offset, mem_mask, data, hi_addr);
dsp56k_host_interface_write((device_config*)space->cpu, hi_addr, hi_data);
dsp56k_host_interface_write((device_config*)cputag_get_cpu(space->machine, "dsp"), hi_addr, hi_data);
}
@ -321,14 +323,22 @@ static READ16_HANDLER( dsp56k_bootload_r )
static DIRECT_UPDATE_HANDLER( plygonet_dsp56k_direct_handler )
{
if (address >= 0x7000 && address <= 0x7fff)
/* Call the dsp's update handler first */
if (dsp56k_update_handler != NULL)
{
direct->raw = direct->decrypted = (void*)(dsp56k_p_mirror - 0x7000);
if ((*dsp56k_update_handler)(space, address, direct) == ~0)
return ~0;
}
else if (address >= 0x8000 && address <= 0x87ff)
/* If the requested region wasn't in there, see if it needs to be caught driver-side */
if (address >= (0x7000<<1) && address <= (0x7fff<<1))
{
direct->raw = direct->decrypted = (void*)(dsp56k_p_8000 - 0x8000);
direct->raw = direct->decrypted = (UINT8*)(dsp56k_p_mirror) - (0x7000<<1);
return ~0;
}
else if (address >= (0x8000<<1) && address <= (0x87ff<<1))
{
direct->raw = direct->decrypted = (UINT8*)(dsp56k_p_8000) - (0x8000<<1);
return ~0;
}
@ -715,7 +725,7 @@ static DRIVER_INIT(polygonet)
memset(dsp56k_bank04_ram, 0, 2 * 8 * dsp56k_bank04_size * sizeof(UINT16));
/* The dsp56k occasionally executes out of mapped memory */
memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), plygonet_dsp56k_direct_handler);
dsp56k_update_handler = memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), plygonet_dsp56k_direct_handler);
}
ROM_START( plygonet )