Allow the non-DRC RSP core to build again

(controlled by a #define like the SH-2 core) [Atari Ace]

---------- Forwarded message ----------
From: Atari Ace <atari_ace@verizon.net>

Date: Mon, Jul 5, 2010 at 3:50 PM
Subject: [patch] Fixup non-DRC rsp core
To: submit@mamedev.org
Cc: atariace@hotmail.com

Hi mamedev,

This patch fixes the non-DRC rsp core to be buildable again
(controlled by a #define like the sh2 core).  It also cleans up the
whitespace/commented-out code in that core as well.

~aa
This commit is contained in:
Phil Bennett 2010-07-15 11:22:07 +00:00
parent 84d2bf08e9
commit 5573c3f703
4 changed files with 243 additions and 209 deletions

View File

@ -1232,10 +1232,13 @@ $(CPUOBJ)/minx/minx.o: $(CPUSRC)/minx/minx.c \
ifneq ($(filter RSP,$(CPUS)),) ifneq ($(filter RSP,$(CPUS)),)
OBJDIRS += $(CPUOBJ)/rsp OBJDIRS += $(CPUOBJ)/rsp
CPUOBJS += $(CPUOBJ)/rsp/rspdrc.o $(CPUOBJ)/rsp/rspfe.o $(DRCOBJ) CPUOBJS += $(CPUOBJ)/rsp/rsp.o $(CPUOBJ)/rsp/rspdrc.o $(CPUOBJ)/rsp/rspfe.o $(DRCOBJ)
DASMOBJS += $(CPUOBJ)/rsp/rsp_dasm.o DASMOBJS += $(CPUOBJ)/rsp/rsp_dasm.o
endif endif
$(CPUOBJ)/rsp/rsp.o: $(CPUSRC)/rsp/rsp.c \
$(CPUSRC)/rsp/rsp.h
$(CPUOBJ)/rsp/rspdrc.o: $(CPUSRC)/rsp/rspdrc.c \ $(CPUOBJ)/rsp/rspdrc.o: $(CPUSRC)/rsp/rspdrc.c \
$(CPUSRC)/rsp/rsp.h \ $(CPUSRC)/rsp/rsp.h \
$(CPUSRC)/rsp/rspfe.h \ $(CPUSRC)/rsp/rspfe.h \

View File

@ -10,6 +10,8 @@
CPU_DISASSEMBLE( rsp ); CPU_DISASSEMBLE( rsp );
#ifndef USE_RSPDRC
#define LOG_INSTRUCTION_EXECUTION 0 #define LOG_INSTRUCTION_EXECUTION 0
#define SAVE_DISASM 0 #define SAVE_DISASM 0
#define SAVE_DMEM 0 #define SAVE_DMEM 0
@ -183,11 +185,11 @@ static UINT32 get_cop0_reg(rsp_state *rsp, int reg)
{ {
if (reg >= 0 && reg < 8) if (reg >= 0 && reg < 8)
{ {
return (rsp->config->sp_reg_r)(rsp->program, reg, 0x00000000); return (rsp->config->sp_reg_r)(rsp->device, reg, 0x00000000);
} }
else if (reg >= 8 && reg < 16) else if (reg >= 8 && reg < 16)
{ {
return (rsp->config->dp_reg_r)(rsp->program, reg - 8, 0x00000000); return (rsp->config->dp_reg_r)(rsp->device, reg - 8, 0x00000000);
} }
else else
{ {
@ -199,11 +201,11 @@ static void set_cop0_reg(rsp_state *rsp, int reg, UINT32 data)
{ {
if (reg >= 0 && reg < 8) if (reg >= 0 && reg < 8)
{ {
(rsp->config->sp_reg_w)(rsp->program, reg, data, 0x00000000); (rsp->config->sp_reg_w)(rsp->device, reg, data, 0x00000000);
} }
else if (reg >= 8 && reg < 16) else if (reg >= 8 && reg < 16)
{ {
(rsp->config->dp_reg_w)(rsp->program, reg - 8, data, 0x00000000); (rsp->config->dp_reg_w)(rsp->device, reg - 8, data, 0x00000000);
} }
else else
{ {
@ -2989,4 +2991,22 @@ CPU_GET_INFO( rsp )
} }
} }
void rspdrc_set_options(running_device *device, UINT32 options)
{
}
void rspdrc_add_imem(running_device *device, void *base)
{
}
void rspdrc_add_dmem(running_device *device, void *base)
{
}
void rspdrc_flush_drc_cache(running_device *device)
{
}
DEFINE_LEGACY_CPU_DEVICE(RSP, rsp); DEFINE_LEGACY_CPU_DEVICE(RSP, rsp);
#endif // USE_RSPDRC

View File

@ -16,7 +16,7 @@
#ifndef __RSP_H__ #ifndef __RSP_H__
#define __RSP_H__ #define __RSP_H__
#define USE_RSPDRC
/*************************************************************************** /***************************************************************************
REGISTER ENUMERATION REGISTER ENUMERATION

View File

@ -31,6 +31,8 @@ CPU_DISASSEMBLE( rsp );
extern offs_t rsp_dasm_one(char *buffer, offs_t pc, UINT32 op); extern offs_t rsp_dasm_one(char *buffer, offs_t pc, UINT32 op);
#ifdef USE_RSPDRC
/*************************************************************************** /***************************************************************************
DEBUGGING DEBUGGING
***************************************************************************/ ***************************************************************************/
@ -546,12 +548,14 @@ void rspdrc_add_dmem(running_device *device, void *base)
debugging debugging
-------------------------------------------------*/ -------------------------------------------------*/
//static void cfunc_printf_debug(void *param) #ifdef UNUSED_FUNCTION
//{ static void cfunc_printf_debug(void *param)
// rsp_state *rsp = (rsp_state *)param; {
// printf(rsp->impstate->format, rsp->impstate->arg0, rsp->impstate->arg1); rsp_state *rsp = (rsp_state *)param;
// logerror(rsp->impstate->format, rsp->impstate->arg0, rsp->impstate->arg1); printf(rsp->impstate->format, rsp->impstate->arg0, rsp->impstate->arg1);
//} logerror(rsp->impstate->format, rsp->impstate->arg0, rsp->impstate->arg1);
}
#endif
/*------------------------------------------------- /*-------------------------------------------------
@ -559,13 +563,14 @@ void rspdrc_add_dmem(running_device *device, void *base)
debugging 64-bit values debugging 64-bit values
-------------------------------------------------*/ -------------------------------------------------*/
//static void cfunc_printf_debug64(void *param) #ifdef UNUSED_FUNCTION
//{ static void cfunc_printf_debug64(void *param)
// rsp_state *rsp = (rsp_state *)param; {
// printf(rsp->impstate->format, (UINT32)(rsp->impstate->arg64 >> 32), (UINT32)(rsp->impstate->arg64 & 0x00000000ffffffff)); rsp_state *rsp = (rsp_state *)param;
// logerror(rsp->impstate->format, (UINT32)(rsp->impstate->arg64 >> 32), (UINT32)(rsp->impstate->arg64 & 0x00000000ffffffff)); printf(rsp->impstate->format, (UINT32)(rsp->impstate->arg64 >> 32), (UINT32)(rsp->impstate->arg64 & 0x00000000ffffffff));
//} logerror(rsp->impstate->format, (UINT32)(rsp->impstate->arg64 >> 32), (UINT32)(rsp->impstate->arg64 & 0x00000000ffffffff));
}
#endif
static void cfunc_get_cop0_reg(void *param) static void cfunc_get_cop0_reg(void *param)
{ {
@ -1452,14 +1457,14 @@ static int generate_lwc2(rsp_state *rsp, drcuml_block *block, compiler_state *co
#endif #endif
case 0x07: /* LUV */ case 0x07: /* LUV */
#if (DRC_LUV) #if (DRC_LUV)
/* #ifdef UNUSED_CODE
ea = (base) ? rsp->r[base] + (offset * 8) : (offset * 8); ea = (base) ? rsp->r[base] + (offset * 8) : (offset * 8);
for (i=0; i < 8; i++) for (i=0; i < 8; i++)
{ {
W_VREG_S(dest, i, READ8(rsp, ea + (((16-index) + i) & 0xf)) << 7); W_VREG_S(dest, i, READ8(rsp, ea + (((16-index) + i) & 0xf)) << 7);
} }
*/ #endif
offset <<= 3; offset <<= 3;
UML_ADD(block, IREG(2), R32(RSREG), IMM(offset)); // add i2,<rsreg>,offset UML_ADD(block, IREG(2), R32(RSREG), IMM(offset)); // add i2,<rsreg>,offset
@ -2115,7 +2120,7 @@ static int generate_swc2(rsp_state *rsp, drcuml_block *block, compiler_state *co
#if (DRC_VMADN) #if (DRC_VMADN)
static void generate_saturate_accum_unsigned(rsp_state *rsp, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, int accum) static void generate_saturate_accum_unsigned(rsp_state *rsp, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, int accum)
{ {
/* #ifdef UNUSED_CODE
int skip, skip2; int skip, skip2;
UML_CMP(block, VACCUMWMH(accum), IMM(-32768)); UML_CMP(block, VACCUMWMH(accum), IMM(-32768));
@ -2133,7 +2138,7 @@ static void generate_saturate_accum_unsigned(rsp_state *rsp, drcuml_block *block
UML_SEXT(block, IREG(0), VACCUMHL(accum), WORD); UML_SEXT(block, IREG(0), VACCUMHL(accum), WORD);
UML_AND(block, IREG(0), IREG(0), IMM(0x0000ffff)); UML_AND(block, IREG(0), IREG(0), IMM(0x0000ffff));
UML_LABEL(block, skip2); UML_LABEL(block, skip2);
*/ #endif
UML_SEXT(block, IREG(0), VACCUMHL(accum), WORD); UML_SEXT(block, IREG(0), VACCUMHL(accum), WORD);
UML_AND(block, IREG(0), IREG(0), IMM(0x0000ffff)); UML_AND(block, IREG(0), IREG(0), IMM(0x0000ffff));
UML_CMP(block, VACCUMWMH(accum), IMM(-32768)); UML_CMP(block, VACCUMWMH(accum), IMM(-32768));
@ -2865,7 +2870,7 @@ INLINE void cfunc_rsp_vmudm(void *param)
break; break;
} }
/* #ifdef UNUSED_CODE
for (i=0; i < 8; i++) for (i=0; i < 8; i++)
{ {
int del = VEC_EL_1(EL, i); int del = VEC_EL_1(EL, i);
@ -2881,7 +2886,7 @@ INLINE void cfunc_rsp_vmudm(void *param)
vres[del] = ACCUM(del).h.mid; vres[del] = ACCUM(del).h.mid;
} }
WRITEBACK_RESULT(); WRITEBACK_RESULT();
*/ #endif
} }
#endif #endif
@ -7306,10 +7311,12 @@ static void cfunc_unimplemented(void *param)
cfunc_fatalerror - a generic fatalerror call cfunc_fatalerror - a generic fatalerror call
-------------------------------------------------*/ -------------------------------------------------*/
//static void cfunc_fatalerror(void *param) #ifdef UNUSED_CODE
//{ static void cfunc_fatalerror(void *param)
//fatalerror("fatalerror"); {
//} fatalerror("fatalerror");
}
#endif
/*************************************************************************** /***************************************************************************
@ -7654,12 +7661,14 @@ static void generate_sequence_instruction(rsp_state *rsp, drcuml_block *block, c
} }
/* if we hit an unmapped address, fatal error */ /* if we hit an unmapped address, fatal error */
//if (desc->flags & OPFLAG_COMPILER_UNMAPPED) #if 0
//{ if (desc->flags & OPFLAG_COMPILER_UNMAPPED)
// UML_MOV(block, MEM(&rsp->pc), IMM(desc->pc)); // mov [pc],desc->pc {
// save_fast_iregs(rsp, block); UML_MOV(block, MEM(&rsp->pc), IMM(desc->pc)); // mov [pc],desc->pc
// UML_EXIT(block, IMM(EXECUTE_UNMAPPED_CODE)); // exit EXECUTE_UNMAPPED_CODE save_fast_iregs(rsp, block);
//} UML_EXIT(block, IMM(EXECUTE_UNMAPPED_CODE)); // exit EXECUTE_UNMAPPED_CODE
}
#endif
/* otherwise, unless this is a virtual no-op, it's a regular instruction */ /* otherwise, unless this is a virtual no-op, it's a regular instruction */
/*else*/ if (!(desc->flags & OPFLAG_VIRTUAL_NOOP)) /*else*/ if (!(desc->flags & OPFLAG_VIRTUAL_NOOP))
@ -8719,3 +8728,5 @@ CPU_GET_INFO( rsp )
} }
DEFINE_LEGACY_CPU_DEVICE(RSP, rsp); DEFINE_LEGACY_CPU_DEVICE(RSP, rsp);
#endif // USE_RSPDRC