diff options
author | 2009-03-15 17:12:40 +0000 | |
---|---|---|
committer | 2009-03-15 17:12:40 +0000 | |
commit | 46494694d15ba7ced83782fb385ee1474d8b882a (patch) | |
tree | 590cad40562178523ff8b41986b3ee9f69be3663 /src/emu/cpu/dsp56k | |
parent | d0527ba566044a695b2da07d108c892d0949159a (diff) |
CPU cores now compile cleanly.
Diffstat (limited to 'src/emu/cpu/dsp56k')
-rw-r--r-- | src/emu/cpu/dsp56k/dsp56def.h | 9 | ||||
-rw-r--r-- | src/emu/cpu/dsp56k/dsp56k.c | 12 | ||||
-rw-r--r-- | src/emu/cpu/dsp56k/dsp56mem.c | 6 | ||||
-rw-r--r-- | src/emu/cpu/dsp56k/dsp56ops.c | 4 |
4 files changed, 20 insertions, 11 deletions
diff --git a/src/emu/cpu/dsp56k/dsp56def.h b/src/emu/cpu/dsp56k/dsp56def.h index 43f2cc922c9..5b4973e9ea5 100644 --- a/src/emu/cpu/dsp56k/dsp56def.h +++ b/src/emu/cpu/dsp56k/dsp56def.h @@ -393,3 +393,12 @@ static void PCDDR_set(dsp56k_core* cpustate, UINT16 value); /* Port C Dtaa Register (PCD) */ static void PCD_set(dsp56k_core* cpustate, UINT16 value); + +INLINE dsp56k_core *get_safe_token(const device_config *device) +{ + assert(device != NULL); + assert(device->token != NULL); + assert(device->type == CPU); + assert(cpu_get_type(device) == CPU_DSP56156); + return (dsp56k_core *)device->token; +} diff --git a/src/emu/cpu/dsp56k/dsp56k.c b/src/emu/cpu/dsp56k/dsp56k.c index 057106aed20..22ab1be1515 100644 --- a/src/emu/cpu/dsp56k/dsp56k.c +++ b/src/emu/cpu/dsp56k/dsp56k.c @@ -74,7 +74,7 @@ static DIRECT_UPDATE_HANDLER( dsp56k_direct_handler ) { if (address >= (0x0000<<1) && address <= (0x07ff<<1)) { - direct->raw = direct->decrypted = (void*)(dsp56k_program_ram - (0x0000<<1)); + direct->raw = direct->decrypted = (UINT8 *)(dsp56k_program_ram - (0x0000<<1)); return ~0; } @@ -166,7 +166,7 @@ static void set_irq_line(dsp56k_core* cpustate, int irqline, int state) ***************************************************************************/ static CPU_INIT( dsp56k ) { - dsp56k_core* cpustate = device->token; + dsp56k_core* cpustate = get_safe_token(device); // Call specific module inits pcu_init(cpustate); @@ -228,7 +228,7 @@ static void alu_reset(dsp56k_core* cpustate) static CPU_RESET( dsp56k ) { - dsp56k_core* cpustate = device->token; + dsp56k_core* cpustate = get_safe_token(device); logerror("Dsp56k reset\n"); cpustate->interrupt_cycles = 0; @@ -266,7 +266,7 @@ static CPU_EXIT( dsp56k ) static CPU_EXECUTE( dsp56k ) { - dsp56k_core* cpustate = device->token; + dsp56k_core* cpustate = get_safe_token(device); /* If reset line is asserted, do nothing */ if (cpustate->reset_state) @@ -320,7 +320,7 @@ ADDRESS_MAP_END static CPU_SET_INFO( dsp56k ) { - dsp56k_core* cpustate = device->token; + dsp56k_core* cpustate = get_safe_token(device); switch (state) { @@ -388,7 +388,7 @@ static CPU_SET_INFO( dsp56k ) CPU_GET_INFO( dsp56k ) { - dsp56k_core* cpustate = (device != NULL) ? device->token : NULL; + dsp56k_core* cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL; switch (state) { diff --git a/src/emu/cpu/dsp56k/dsp56mem.c b/src/emu/cpu/dsp56k/dsp56mem.c index b3375aaaf06..fac1b2f89ed 100644 --- a/src/emu/cpu/dsp56k/dsp56mem.c +++ b/src/emu/cpu/dsp56k/dsp56mem.c @@ -612,7 +612,7 @@ static void dsp56k_host_interface_reset(dsp56k_core* cpustate) /* They represent the host side of the dsp56k's host interface */ void dsp56k_host_interface_write(device_config* device, UINT8 offset, UINT8 data) { - dsp56k_core* cpustate = device->token; + dsp56k_core* cpustate = get_safe_token(device); /* Not exactly correct since the bootstrap hack doesn't need this to be true */ /* @@ -708,7 +708,7 @@ void dsp56k_host_interface_write(device_config* device, UINT8 offset, UINT8 data UINT8 dsp56k_host_interface_read(device_config* device, UINT8 offset) { - dsp56k_core* cpustate = device->token; + dsp56k_core* cpustate = get_safe_token(device); /* Not exactly correct since the bootstrap hack doesn't need this to be true */ /* @@ -936,6 +936,6 @@ static void dsp56k_io_reset(dsp56k_core* cpustate) /* MISC*/ UINT16 dsp56k_get_peripheral_memory(device_config* device, UINT16 addr) { - // TODO // THIS COMES BACK dsp56k_core* cpustate = device->token; + // TODO // THIS COMES BACK dsp56k_core* cpustate = get_safe_token(device); return dsp56k_peripheral_ram[A2O(addr)]; } diff --git a/src/emu/cpu/dsp56k/dsp56ops.c b/src/emu/cpu/dsp56k/dsp56ops.c index fd8d25abdcd..f3064d5ddd9 100644 --- a/src/emu/cpu/dsp56k/dsp56ops.c +++ b/src/emu/cpu/dsp56k/dsp56ops.c @@ -1874,7 +1874,7 @@ static size_t dsp56k_op_cmpm(dsp56k_core* cpustate, const UINT16 op_byte, typed_ if (absS & U64(0x0000000080000000)) absS |= U64(0xffffffff80000000); } - absS = abs(absS); + absS = (absS < 0) ? -absS : absS; /* Sign extend and get absolute value of the destination */ if (D.addr == &A || D.addr == &B) @@ -1889,7 +1889,7 @@ static size_t dsp56k_op_cmpm(dsp56k_core* cpustate, const UINT16 op_byte, typed_ if (absS & U64(0x0000000080000000)) absS |= U64(0xffffffff80000000); } - absD = abs(absD); + absD = (absD < 0) ? -absD : absD; /* Compare */ absResult = absD - absS; |