Updated lazyusf

CQTexperiment
Chris Moeller 2014-04-07 12:46:26 -07:00
parent 0a4046f2bf
commit a9eb5760ec
11 changed files with 50 additions and 26 deletions

View File

@ -732,7 +732,7 @@ void StartInterpreterCPU (usf_state_t * state) {
ExecuteInterpreterOpCode(state);
if (!--safety_count) {
if (last_sample_buffer_count == state->sample_buffer_count) {
DisplayError( state, "Emulator core is not generating any samples after 400 million instructions" );
DisplayError( state, "Emulator core is not generating any samples after 20 million instructions" );
break;
} else {
safety_count = safety_count_max;

View File

@ -191,15 +191,19 @@ int32_t r4300i_LB_NonMemory ( usf_state_t * state, uint32_t PAddr, uint32_t * Va
}
uint32_t r4300i_LB_VAddr ( usf_state_t * state, uint32_t VAddr, uint8_t * Value ) {
if (state->TLB_Map[VAddr >> 12] == 0) { return 0; }
*Value = *(uint8_t *)(state->TLB_Map[VAddr >> 12] + (VAddr ^ 3));
uintptr_t address;
address = state->TLB_Map[VAddr >> 12];
if (address == 0) { return 0; }
*Value = *(uint8_t *)(address + (VAddr ^ 3));
return 1;
}
uint32_t r4300i_LD_VAddr ( usf_state_t * state, uint32_t VAddr, uint64_t * Value ) {
if (state->TLB_Map[VAddr >> 12] == 0) { return 0; }
*((uint32_t *)(Value) + 1) = *(uint32_t *)(state->TLB_Map[VAddr >> 12] + VAddr);
*((uint32_t *)(Value)) = *(uint32_t *)(state->TLB_Map[VAddr >> 12] + VAddr + 4);
uintptr_t address;
address = state->TLB_Map[VAddr >> 12];
if (address == 0) { return 0; }
*((uint32_t *)(Value) + 1) = *(uint32_t *)(address + VAddr);
*((uint32_t *)(Value)) = *(uint32_t *)(address + VAddr + 4);
return 1;
}
@ -216,8 +220,11 @@ int32_t r4300i_LH_NonMemory ( usf_state_t * state, uint32_t PAddr, uint32_t * Va
}
uint32_t r4300i_LH_VAddr ( usf_state_t * state, uint32_t VAddr, uint16_t * Value ) {
if (state->TLB_Map[VAddr >> 12] == 0) { return 0; }
*Value = *(uint16_t *)(state->TLB_Map[VAddr >> 12] + (VAddr ^ 2));
uintptr_t address;
address = state->TLB_Map[VAddr >> 12];
if (address == 0)
return 0;
*Value = *(uint16_t *)(address + (VAddr ^ 2));
return 1;
}
@ -383,9 +390,11 @@ void r4300i_LW_PAddr ( usf_state_t * state, uint32_t PAddr, uint32_t * Value ) {
}
uint32_t r4300i_LW_VAddr ( usf_state_t * state, uint32_t VAddr, uint32_t * Value ) {
uintptr_t address = (state->TLB_Map[VAddr >> 12] + VAddr);
uintptr_t address = state->TLB_Map[VAddr >> 12];
if (address == 0)
return 0;
if (state->TLB_Map[VAddr >> 12] == 0) { return 0; }
address += VAddr;
if((address - (uintptr_t)state->RDRAM) > state->RdramSize) {
address = address - (uintptr_t)state->RDRAM;
@ -417,8 +426,11 @@ int32_t r4300i_SB_NonMemory ( usf_state_t * state, uint32_t PAddr, uint8_t Value
}
uint32_t r4300i_SB_VAddr ( usf_state_t * state, uint32_t VAddr, uint8_t Value ) {
if (state->TLB_Map[VAddr >> 12] == 0) { return 0; }
*(uint8_t *)(state->TLB_Map[VAddr >> 12] + (VAddr ^ 3)) = Value;
uintptr_t address;
address = state->TLB_Map[VAddr >> 12];
if (address == 0) { return 0; }
*(uint8_t *)(address + (VAddr ^ 3)) = Value;
return 1;
}
@ -445,15 +457,20 @@ int32_t r4300i_SH_NonMemory ( usf_state_t * state, uint32_t PAddr, uint16_t Valu
}
uint32_t r4300i_SD_VAddr ( usf_state_t * state, uint32_t VAddr, uint64_t Value ) {
if (state->TLB_Map[VAddr >> 12] == 0) { return 0; }
*(uint32_t *)(state->TLB_Map[VAddr >> 12] + VAddr) = *((uint32_t *)(&Value) + 1);
*(uint32_t *)(state->TLB_Map[VAddr >> 12] + VAddr + 4) = *((uint32_t *)(&Value));
uintptr_t address;
address = state->TLB_Map[VAddr >> 12];
if (address == 0) { return 0; }
*(uint32_t *)(address + VAddr) = *((uint32_t *)(&Value) + 1);
*(uint32_t *)(address + VAddr + 4) = *((uint32_t *)(&Value));
return 1;
}
uint32_t r4300i_SH_VAddr ( usf_state_t * state, uint32_t VAddr, uint16_t Value ) {
if (state->TLB_Map[VAddr >> 12] == 0) { return 0; }
*(uint16_t *)(state->TLB_Map[VAddr >> 12] + (VAddr ^ 2)) = Value;
uintptr_t address;
address = state->TLB_Map[VAddr >> 12];
if (address == 0) { return 0; }
*(uint16_t *)(address + (VAddr ^ 2)) = Value;
return 1;
}
@ -766,10 +783,13 @@ int32_t r4300i_SW_NonMemory ( usf_state_t * state, uint32_t PAddr, uint32_t Valu
}
uint32_t r4300i_SW_VAddr ( usf_state_t * state, uint32_t VAddr, uint32_t Value ) {
uintptr_t address = (state->TLB_Map[VAddr >> 12] + VAddr);
if (state->TLB_Map[VAddr >> 12] == 0) { return 0; }
uintptr_t address;
address = state->TLB_Map[VAddr >> 12];
if (address == 0) { return 0; }
address = (address + VAddr);
if((address - (uintptr_t)state->RDRAM) > state->RdramSize) {
address = address - (uintptr_t)state->RDRAM;
return r4300i_SW_NonMemory(state, (uint32_t) address, Value);

View File

@ -58,10 +58,12 @@ NOINLINE static void message(usf_state_t * state, const char* body, int priority
*/
#define CHARACTERS_PER_LINE (80)
/* typical standard DOS text file limit per line */
#if 0
NOINLINE static void update_conf(const char* source)
{
(void)source;
}
#endif
#ifdef SP_EXECUTE_LOG
extern void step_SP_commands(usf_state_t * state, int PC, uint32_t inst);

View File

@ -53,7 +53,7 @@ static void set_PC(usf_state_t * state, int address)
return;
}
#if (0)
#if ANDROID
#define MASK_SA(sa) (sa & 31)
/* Force masking in software. */
#else

View File

@ -180,6 +180,7 @@ void set_VCC(usf_state_t * state, unsigned short VCC)
state->clip[i] = (VCC >> (i + 0x8)) & 1;
return; /* Little endian becomes big. */
}
#if 0
void set_VCE(usf_state_t * state, unsigned char VCE)
{
register int i;
@ -189,3 +190,4 @@ void set_VCE(usf_state_t * state, unsigned char VCE)
return; /* Little endian becomes big. */
}
#endif
#endif

View File

@ -13,7 +13,7 @@
\******************************************************************************/
#include "vu.h"
INLINE void do_and(usf_state_t * state, short* VD, short* VS, short* VT)
static INLINE void do_and(usf_state_t * state, short* VD, short* VS, short* VT)
{
register int i;

View File

@ -13,7 +13,7 @@
\******************************************************************************/
#include "vu.h"
INLINE void do_nand(usf_state_t * state, short* VD, short* VS, short* VT)
static INLINE void do_nand(usf_state_t * state, short* VD, short* VS, short* VT)
{
register int i;

View File

@ -13,7 +13,7 @@
\******************************************************************************/
#include "vu.h"
INLINE void do_nor(usf_state_t * state, short* VD, short* VS, short* VT)
static INLINE void do_nor(usf_state_t * state, short* VD, short* VS, short* VT)
{
register int i;

View File

@ -13,7 +13,7 @@
\******************************************************************************/
#include "vu.h"
INLINE void do_nxor(usf_state_t * state, short* VD, short* VS, short* VT)
static INLINE void do_nxor(usf_state_t * state, short* VD, short* VS, short* VT)
{
register int i;

View File

@ -13,7 +13,7 @@
\******************************************************************************/
#include "vu.h"
INLINE void do_or(usf_state_t * state, short* VD, short* VS, short* VT)
static INLINE void do_or(usf_state_t * state, short* VD, short* VS, short* VT)
{
register int i;

View File

@ -13,7 +13,7 @@
\******************************************************************************/
#include "vu.h"
INLINE void do_xor(usf_state_t * state, short* VD, short* VS, short* VT)
static INLINE void do_xor(usf_state_t * state, short* VD, short* VS, short* VT)
{
register int i;