mirror of
https://github.com/libretro/beetle-wswan-libretro.git
synced 2024-11-26 17:50:32 +00:00
Remove WANT_DEBUGGER
This commit is contained in:
parent
f427a9c21d
commit
e84294919d
5
Makefile
5
Makefile
@ -412,7 +412,6 @@ else ifneq (,$(findstring windows_msvc2017,$(platform)))
|
|||||||
export INCLUDE := $(INCLUDE);$(WindowsSDKSharedIncludeDir);$(WindowsSDKUCRTIncludeDir);$(WindowsSDKUMIncludeDir)
|
export INCLUDE := $(INCLUDE);$(WindowsSDKSharedIncludeDir);$(WindowsSDKUCRTIncludeDir);$(WindowsSDKUMIncludeDir)
|
||||||
export LIB := $(LIB);$(WindowsSDKUCRTLibDir);$(WindowsSDKUMLibDir)
|
export LIB := $(LIB);$(WindowsSDKUCRTLibDir);$(WindowsSDKUMLibDir)
|
||||||
TARGET := $(TARGET_NAME)_libretro.dll
|
TARGET := $(TARGET_NAME)_libretro.dll
|
||||||
PSS_STYLE :=2
|
|
||||||
LDFLAGS += -DLL
|
LDFLAGS += -DLL
|
||||||
|
|
||||||
# Windows MSVC 2010 x64
|
# Windows MSVC 2010 x64
|
||||||
@ -499,7 +498,6 @@ LD = lib.exe
|
|||||||
export INCLUDE := $(XDK)/xbox/include
|
export INCLUDE := $(XDK)/xbox/include
|
||||||
export LIB := $(XDK)/xbox/lib
|
export LIB := $(XDK)/xbox/lib
|
||||||
PATH := $(call unixcygpath,$(XDK)/xbox/bin/vc71):$(PATH)
|
PATH := $(call unixcygpath,$(XDK)/xbox/bin/vc71):$(PATH)
|
||||||
PSS_STYLE :=2
|
|
||||||
CFLAGS += -D_XBOX -D_XBOX1
|
CFLAGS += -D_XBOX -D_XBOX1
|
||||||
CXXFLAGS += -D_XBOX -D_XBOX1
|
CXXFLAGS += -D_XBOX -D_XBOX1
|
||||||
STATIC_LINKING=1
|
STATIC_LINKING=1
|
||||||
@ -520,7 +518,6 @@ WindowsSdkDir := $(INETSDK)
|
|||||||
export INCLUDE := $(INCLUDE);$(INETSDK)/Include;libretro-common/include/compat/msvc
|
export INCLUDE := $(INCLUDE);$(INETSDK)/Include;libretro-common/include/compat/msvc
|
||||||
export LIB := $(LIB);$(WindowsSdkDir);$(INETSDK)/Lib
|
export LIB := $(LIB);$(WindowsSdkDir);$(INETSDK)/Lib
|
||||||
TARGET := $(TARGET_NAME)_libretro.dll
|
TARGET := $(TARGET_NAME)_libretro.dll
|
||||||
PSS_STYLE :=2
|
|
||||||
LDFLAGS += -DLL
|
LDFLAGS += -DLL
|
||||||
CFLAGS += -D_CRT_SECURE_NO_DEPRECATE
|
CFLAGS += -D_CRT_SECURE_NO_DEPRECATE
|
||||||
WINDOWS_VERSION=1
|
WINDOWS_VERSION=1
|
||||||
@ -578,7 +575,7 @@ LDFLAGS += $(fpic) $(SHARED)
|
|||||||
FLAGS += $(fpic) $(NEW_GCC_FLAGS)
|
FLAGS += $(fpic) $(NEW_GCC_FLAGS)
|
||||||
FLAGS += $(INCFLAGS) $(INCFLAGS_PLATFORM)
|
FLAGS += $(INCFLAGS) $(INCFLAGS_PLATFORM)
|
||||||
|
|
||||||
FLAGS += $(ENDIANNESS_DEFINES) -DSIZEOF_DOUBLE=8 $(WARNINGS) -DMEDNAFEN_VERSION=\"0.9.31\" -DPACKAGE=\"mednafen\" -DMEDNAFEN_VERSION_NUMERIC=931 -DPSS_STYLE=1 -DMPC_FIXED_POINT -DSTDC_HEADERS -D__STDC_LIMIT_MACROS -D__LIBRETRO__ -D_LOW_ACCURACY_ $(EXTRA_INCLUDES)
|
FLAGS += $(ENDIANNESS_DEFINES) -DSIZEOF_DOUBLE=8 $(WARNINGS) -DMEDNAFEN_VERSION_NUMERIC=931 -DMPC_FIXED_POINT -DSTDC_HEADERS -D__STDC_LIMIT_MACROS -D__LIBRETRO__ -D_LOW_ACCURACY_ $(EXTRA_INCLUDES)
|
||||||
|
|
||||||
ifneq (,$(findstring msvc,$(platform)))
|
ifneq (,$(findstring msvc,$(platform)))
|
||||||
FLAGS += -DINLINE="_inline"
|
FLAGS += -DINLINE="_inline"
|
||||||
|
@ -48,7 +48,7 @@ endif
|
|||||||
LDFLAGS += $(fpic) $(SHARED)
|
LDFLAGS += $(fpic) $(SHARED)
|
||||||
FLAGS += $(fpic) $(NEW_GCC_FLAGS) $(INCFLAGS)
|
FLAGS += $(fpic) $(NEW_GCC_FLAGS) $(INCFLAGS)
|
||||||
|
|
||||||
FLAGS += $(ENDIANNESS_DEFINES) -DSIZEOF_DOUBLE=8 $(WARNINGS) -DMEDNAFEN_VERSION=\"0.9.26\" -DPACKAGE=\"mednafen\" -DMEDNAFEN_VERSION_NUMERIC=926 -DPSS_STYLE=1 -DMPC_FIXED_POINT -DSTDC_HEADERS -D__STDC_LIMIT_MACROS -D__LIBRETRO__ -DNDEBUG -D_LOW_ACCURACY_ -DINLINE="inline"
|
FLAGS += $(ENDIANNESS_DEFINES) -DSIZEOF_DOUBLE=8 $(WARNINGS) -DMEDNAFEN_VERSION_NUMERIC=926 -DMPC_FIXED_POINT -DSTDC_HEADERS -D__STDC_LIMIT_MACROS -D__LIBRETRO__ -DNDEBUG -D_LOW_ACCURACY_ -DINLINE="inline"
|
||||||
|
|
||||||
LOCAL_CFLAGS = $(FLAGS)
|
LOCAL_CFLAGS = $(FLAGS)
|
||||||
LOCAL_CXXFLAGS += $(FLAGS) -fexceptions
|
LOCAL_CXXFLAGS += $(FLAGS) -fexceptions
|
||||||
|
14
libretro.c
14
libretro.c
@ -424,7 +424,6 @@ static void Reset(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static uint8 *chee;
|
static uint8 *chee;
|
||||||
static uint64_t video_frames, audio_frames;
|
|
||||||
|
|
||||||
static void Emulate(EmulateSpecStruct *espec,
|
static void Emulate(EmulateSpecStruct *espec,
|
||||||
int skip_frame, int update_sample_rate)
|
int skip_frame, int update_sample_rate)
|
||||||
@ -438,7 +437,6 @@ static void Emulate(EmulateSpecStruct *espec,
|
|||||||
espec->DisplayRect.h = 144;
|
espec->DisplayRect.h = 144;
|
||||||
espec->skip = skip_frame;
|
espec->skip = skip_frame;
|
||||||
espec->SoundBufSize = 0;
|
espec->SoundBufSize = 0;
|
||||||
espec->MasterCycles = 0;
|
|
||||||
|
|
||||||
if (update_sample_rate)
|
if (update_sample_rate)
|
||||||
WSwan_SetSoundRate(RETRO_SAMPLE_RATE);
|
WSwan_SetSoundRate(RETRO_SAMPLE_RATE);
|
||||||
@ -458,11 +456,7 @@ static void Emulate(EmulateSpecStruct *espec,
|
|||||||
audio_low_pass_apply(audio_samples_buf,
|
audio_low_pass_apply(audio_samples_buf,
|
||||||
espec->SoundBufSize);
|
espec->SoundBufSize);
|
||||||
|
|
||||||
espec->MasterCycles = v30mz_timestamp;
|
|
||||||
v30mz_timestamp = 0;
|
v30mz_timestamp = 0;
|
||||||
|
|
||||||
video_frames++;
|
|
||||||
audio_frames += espec->SoundBufSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -1461,14 +1455,6 @@ void retro_deinit(void)
|
|||||||
retro_60hz_deinit();
|
retro_60hz_deinit();
|
||||||
retro_60hz_enabled = false;
|
retro_60hz_enabled = false;
|
||||||
|
|
||||||
if (log_cb)
|
|
||||||
{
|
|
||||||
log_cb(RETRO_LOG_INFO, "[%s]: Samples / Frame: %.5f\n",
|
|
||||||
MEDNAFEN_CORE_NAME, (double)audio_frames / video_frames);
|
|
||||||
log_cb(RETRO_LOG_INFO, "[%s]: Estimated FPS: %.5f\n",
|
|
||||||
MEDNAFEN_CORE_NAME, (double)video_frames * RETRO_SAMPLE_RATE / audio_frames);
|
|
||||||
}
|
|
||||||
|
|
||||||
libretro_supports_bitmasks = false;
|
libretro_supports_bitmasks = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,11 +48,6 @@ void WSwan_GfxWSCPaletteRAMWrite(uint32 ws_offset, uint8 data);
|
|||||||
|
|
||||||
void WSwan_SetLayerEnableMask(uint64 mask);
|
void WSwan_SetLayerEnableMask(uint64 mask);
|
||||||
|
|
||||||
#ifdef WANT_DEBUGGER
|
|
||||||
void WSwan_GfxSetGraphicsDecode(MDFN_Surface *surface, int line, int which, int xscroll, int yscroll, int pbn);
|
|
||||||
uint32 WSwan_GfxGetRegister(const std::string &oname, std::string *special);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -90,45 +90,6 @@ void WSwan_InterruptReset(void)
|
|||||||
RecalcInterrupt();
|
RecalcInterrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WANT_DEBUGGER
|
|
||||||
static const char *PrettyINames[8] = { "Serial Send", "Key Press", "RTC Alarm", "Serial Recv", "Line Hit", "VBlank Timer", "VBlank", "HBlank Timer" };
|
|
||||||
|
|
||||||
uint32 WSwan_InterruptGetRegister(const unsigned int id, char *special, const uint32 special_len)
|
|
||||||
{
|
|
||||||
switch(id)
|
|
||||||
{
|
|
||||||
case INT_GSREG_ISTATUS:
|
|
||||||
return IStatus;
|
|
||||||
case INT_GSREG_IENABLE:
|
|
||||||
return IEnable;
|
|
||||||
case INT_GSREG_IVECTORBASE:
|
|
||||||
return IVectorBase;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WSwan_InterruptSetRegister(const unsigned int id, uint32 value)
|
|
||||||
{
|
|
||||||
switch(id)
|
|
||||||
{
|
|
||||||
case INT_GSREG_ISTATUS:
|
|
||||||
IStatus = value;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case INT_GSREG_IENABLE:
|
|
||||||
IEnable = value;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case INT_GSREG_IVECTORBASE:
|
|
||||||
IVectorBase = value;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
RecalcInterrupt();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int WSwan_InterruptStateAction(StateMem *sm, int load, int data_only)
|
int WSwan_InterruptStateAction(StateMem *sm, int load, int data_only)
|
||||||
{
|
{
|
||||||
SFORMAT StateRegs[] =
|
SFORMAT StateRegs[] =
|
||||||
|
@ -28,18 +28,6 @@ int WSwan_InterruptStateAction(StateMem *sm, int load, int data_only);
|
|||||||
void WSwan_InterruptReset(void);
|
void WSwan_InterruptReset(void);
|
||||||
void WSwan_InterruptDebugForce(unsigned int level);
|
void WSwan_InterruptDebugForce(unsigned int level);
|
||||||
|
|
||||||
#ifdef WANT_DEBUGGER
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
INT_GSREG_ISTATUS = 0,
|
|
||||||
INT_GSREG_IENABLE,
|
|
||||||
INT_GSREG_IVECTORBASE
|
|
||||||
};
|
|
||||||
uint32 WSwan_InterruptGetRegister(const unsigned int id, char *special, const uint32 special_len);
|
|
||||||
void WSwan_InterruptSetRegister(const unsigned int id, uint32 value);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -58,15 +58,9 @@ static uint16 old_CS, old_IP;
|
|||||||
I.regs.w[SP]+=2; \
|
I.regs.w[SP]+=2; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WANT_DEBUGGER
|
#define ADDBRANCHTRACE(x,y) { }
|
||||||
#define ADDBRANCHTRACE(x,y) { if(branch_trace_hook) branch_trace_hook(old_CS, old_IP, x, y, false); }
|
#define ADDBRANCHTRACE_INT(x,y) { }
|
||||||
#define ADDBRANCHTRACE_INT(x,y) { if(branch_trace_hook) branch_trace_hook(old_CS, old_IP, x,y, true); }
|
#define SETOLDCSIP() { }
|
||||||
#define SETOLDCSIP() { old_CS = I.sregs[PS]; old_IP = I.pc; }
|
|
||||||
#else
|
|
||||||
#define ADDBRANCHTRACE(x,y) { }
|
|
||||||
#define ADDBRANCHTRACE_INT(x,y) { }
|
|
||||||
#define SETOLDCSIP() { }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef union
|
typedef union
|
||||||
{ /* eight general registers */
|
{ /* eight general registers */
|
||||||
@ -104,16 +98,6 @@ static bool InHLT;
|
|||||||
static uint32 prefix_base; /* base address of the latest prefix segment */
|
static uint32 prefix_base; /* base address of the latest prefix segment */
|
||||||
static char seg_prefix; /* prefix segment indicator */
|
static char seg_prefix; /* prefix segment indicator */
|
||||||
|
|
||||||
#ifdef WANT_DEBUGGER
|
|
||||||
static void (*cpu_hook)(uint32) = NULL;
|
|
||||||
static uint8 (*read_hook)(uint32) = NULL;
|
|
||||||
static void (*write_hook)(uint32, uint8) = NULL;
|
|
||||||
static uint8 (*port_read_hook)(uint32) = NULL;
|
|
||||||
static void (*port_write_hook)(uint32, uint8) = NULL;
|
|
||||||
static bool hookie_hickey = 0;
|
|
||||||
static void (*branch_trace_hook)(uint16 from_CS, uint16 from_IP, uint16 to_CS, uint16 to_IP, bool interrupt) = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "v30mz-ea.inc"
|
#include "v30mz-ea.inc"
|
||||||
#include "v30mz-modrm.inc"
|
#include "v30mz-modrm.inc"
|
||||||
|
|
||||||
@ -1039,41 +1023,6 @@ void v30mz_set_reg(int regnum, unsigned val)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WANT_DEBUGGER
|
|
||||||
static void (*save_cpu_writemem20)(uint32,uint8);
|
|
||||||
static uint8 (*save_cpu_readport)(uint32);
|
|
||||||
static void (*save_cpu_writeport)(uint32, uint8);
|
|
||||||
static uint8 (*save_cpu_readmem20)(uint32);
|
|
||||||
|
|
||||||
static void test_cpu_writemem20(uint32 A, uint8 V)
|
|
||||||
{
|
|
||||||
if(write_hook)
|
|
||||||
write_hook(A, V);
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint8 test_cpu_readmem20(uint32 A)
|
|
||||||
{
|
|
||||||
if(read_hook)
|
|
||||||
return(read_hook(A));
|
|
||||||
else
|
|
||||||
return(save_cpu_readmem20(A));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void test_cpu_writeport(uint32 A, uint8 V)
|
|
||||||
{
|
|
||||||
if(port_write_hook)
|
|
||||||
port_write_hook(A, V);
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint8 test_cpu_readport(uint32 A)
|
|
||||||
{
|
|
||||||
if(port_read_hook)
|
|
||||||
return(port_read_hook(A));
|
|
||||||
else
|
|
||||||
return(save_cpu_readport(A));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void v30mz_execute(int cycles)
|
void v30mz_execute(int cycles)
|
||||||
{
|
{
|
||||||
v30mz_ICount += cycles;
|
v30mz_ICount += cycles;
|
||||||
@ -1089,10 +1038,6 @@ void v30mz_execute(int cycles)
|
|||||||
if(tmp > 0)
|
if(tmp > 0)
|
||||||
CLK(tmp);
|
CLK(tmp);
|
||||||
|
|
||||||
#ifdef WANT_DEBUGGER
|
|
||||||
if(cpu_hook)
|
|
||||||
cpu_hook(I.pc);
|
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1103,47 +1048,6 @@ void v30mz_execute(int cycles)
|
|||||||
|
|
||||||
WSwan_InterruptCheck();
|
WSwan_InterruptCheck();
|
||||||
|
|
||||||
#ifdef WANT_DEBUGGER
|
|
||||||
if(hookie_hickey)
|
|
||||||
{
|
|
||||||
uint32 save_timestamp = v30mz_timestamp;
|
|
||||||
int32 save_ICount = v30mz_ICount;
|
|
||||||
v30mz_regs_t save_I = I;
|
|
||||||
uint32 save_prefix_base = prefix_base;
|
|
||||||
char save_seg_prefix = seg_prefix;
|
|
||||||
void (*save_branch_trace_hook)(uint16 from_CS, uint16 from_IP, uint16 to_CS, uint16 to_IP, bool interrupt) = branch_trace_hook;
|
|
||||||
|
|
||||||
branch_trace_hook = NULL;
|
|
||||||
|
|
||||||
save_cpu_writemem20 = cpu_writemem20;
|
|
||||||
save_cpu_readport = cpu_readport;
|
|
||||||
save_cpu_writeport = cpu_writeport;
|
|
||||||
save_cpu_readmem20 = cpu_readmem20;
|
|
||||||
|
|
||||||
cpu_writemem20 = test_cpu_writemem20;
|
|
||||||
cpu_readmem20 = test_cpu_readmem20;
|
|
||||||
cpu_writeport = test_cpu_writeport;
|
|
||||||
cpu_readport = test_cpu_readport;
|
|
||||||
|
|
||||||
DoOP(FETCHOP);
|
|
||||||
|
|
||||||
branch_trace_hook = save_branch_trace_hook;
|
|
||||||
v30mz_timestamp = save_timestamp;
|
|
||||||
v30mz_ICount = save_ICount;
|
|
||||||
I = save_I;
|
|
||||||
prefix_base = save_prefix_base;
|
|
||||||
seg_prefix = save_seg_prefix;
|
|
||||||
cpu_readmem20 = save_cpu_readmem20;
|
|
||||||
cpu_writemem20 = save_cpu_writemem20;
|
|
||||||
cpu_readport = save_cpu_readport;
|
|
||||||
cpu_writeport = save_cpu_writeport;
|
|
||||||
InHLT = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(cpu_hook)
|
|
||||||
cpu_hook(I.pc);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DoOP(FETCHOP);
|
DoOP(FETCHOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,11 +41,6 @@ void v30mz_reset(void);
|
|||||||
void v30mz_int(uint32 vector, bool IgnoreIF);
|
void v30mz_int(uint32 vector, bool IgnoreIF);
|
||||||
int v30mz_StateAction(StateMem *sm, int load, int data_only);
|
int v30mz_StateAction(StateMem *sm, int load, int data_only);
|
||||||
|
|
||||||
#ifdef WANT_DEBUGGER
|
|
||||||
void v30mz_debug(void (*CPUHook)(uint32), uint8 (*ReadHook)(uint32), void (*WriteHook)(uint32, uint8), uint8 (*PortReadHook)(uint32), void (*PortWriteHook)(uint32, uint8),
|
|
||||||
void (*BranchTraceHook)(uint16 from_CS, uint16 from_IP, uint16 to_CS, uint16 to_IP, bool interrupt) );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -321,178 +321,6 @@ void WSwan_writeport(uint32 IOPort, uint8 V)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WANT_DEBUGGER
|
|
||||||
static void GetAddressSpaceBytes(const char *name, uint32 Address, uint32 Length, uint8 *Buffer)
|
|
||||||
{
|
|
||||||
if(!strcmp(name, "ram"))
|
|
||||||
{
|
|
||||||
while(Length--)
|
|
||||||
{
|
|
||||||
Address &= wsRAMSize - 1;
|
|
||||||
*Buffer = wsRAM[Address];
|
|
||||||
Address++;
|
|
||||||
Buffer++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(!strcmp(name, "physical"))
|
|
||||||
{
|
|
||||||
while(Length--)
|
|
||||||
{
|
|
||||||
Address &= 0xFFFFF;
|
|
||||||
*Buffer = WSwan_readmem20(Address);
|
|
||||||
Address++;
|
|
||||||
Buffer++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(!strcmp(name, "cs") || !strcmp(name, "ds") || !strcmp(name, "ss") || !strcmp(name, "es"))
|
|
||||||
{
|
|
||||||
uint32 segment;
|
|
||||||
uint32 phys_address;
|
|
||||||
|
|
||||||
if(!strcmp(name, "cs"))
|
|
||||||
segment = v30mz_get_reg(NEC_PS);
|
|
||||||
else if(!strcmp(name, "ss"))
|
|
||||||
segment = v30mz_get_reg(NEC_SS);
|
|
||||||
else if(!strcmp(name, "ds"))
|
|
||||||
segment = v30mz_get_reg(NEC_DS0);
|
|
||||||
else if(!strcmp(name, "es"))
|
|
||||||
segment = v30mz_get_reg(NEC_DS1);
|
|
||||||
|
|
||||||
phys_address = (Address + (segment << 4)) & 0xFFFFF;
|
|
||||||
|
|
||||||
GetAddressSpaceBytes("physical", phys_address, Length, Buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void PutAddressSpaceBytes(const char *name, uint32 Address, uint32 Length, uint32 Granularity, bool hl, const uint8 *Buffer)
|
|
||||||
{
|
|
||||||
if(!strcmp(name, "ram"))
|
|
||||||
{
|
|
||||||
while(Length--)
|
|
||||||
{
|
|
||||||
Address &= wsRAMSize - 1;
|
|
||||||
wsRAM[Address] = *Buffer;
|
|
||||||
WSWan_TCacheInvalidByAddr(Address);
|
|
||||||
if(Address >= 0xfe00)
|
|
||||||
WSwan_GfxWSCPaletteRAMWrite(Address, *Buffer);
|
|
||||||
|
|
||||||
Address++;
|
|
||||||
Buffer++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(!strcmp(name, "physical"))
|
|
||||||
{
|
|
||||||
while(Length--)
|
|
||||||
{
|
|
||||||
uint32 offset, bank;
|
|
||||||
|
|
||||||
Address &= 0xFFFFF;
|
|
||||||
|
|
||||||
offset = Address & 0xFFFF;
|
|
||||||
bank = (Address >> 16) & 0xF;
|
|
||||||
|
|
||||||
switch(bank)
|
|
||||||
{
|
|
||||||
case 0: wsRAM[offset & (wsRAMSize - 1)] = *Buffer;
|
|
||||||
WSWan_TCacheInvalidByAddr(offset & (wsRAMSize - 1));
|
|
||||||
if(Address >= 0xfe00)
|
|
||||||
WSwan_GfxWSCPaletteRAMWrite(offset & (wsRAMSize - 1), *Buffer);
|
|
||||||
break;
|
|
||||||
case 1: if(sram_size)
|
|
||||||
wsSRAM[(offset | (BankSelector[1] << 16)) & (sram_size - 1)] = *Buffer;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
case 3: wsCartROM[offset+((BankSelector[bank]&((rom_size>>16)-1))<<16)] = *Buffer;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
uint8 bank_num = ((BankSelector[0] & 0xF) << 4) | (bank & 0xf);
|
|
||||||
bank_num &= (rom_size >> 16) - 1;
|
|
||||||
wsCartROM[(bank_num << 16) | offset] = *Buffer;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Address++;
|
|
||||||
Buffer++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(!strcmp(name, "cs") || !strcmp(name, "ds") || !strcmp(name, "ss") || !strcmp(name, "es"))
|
|
||||||
{
|
|
||||||
uint32 segment;
|
|
||||||
uint32 phys_address;
|
|
||||||
|
|
||||||
if(!strcmp(name, "cs"))
|
|
||||||
segment = v30mz_get_reg(NEC_PS);
|
|
||||||
else if(!strcmp(name, "ss"))
|
|
||||||
segment = v30mz_get_reg(NEC_SS);
|
|
||||||
else if(!strcmp(name, "ds"))
|
|
||||||
segment = v30mz_get_reg(NEC_DS0);
|
|
||||||
else if(!strcmp(name, "es"))
|
|
||||||
segment = v30mz_get_reg(NEC_DS1);
|
|
||||||
|
|
||||||
phys_address = (Address + (segment << 4)) & 0xFFFFF;
|
|
||||||
|
|
||||||
PutAddressSpaceBytes("physical", phys_address, Length, Granularity, hl, Buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 WSwan_MemoryGetRegister(const unsigned int id, char *special, const uint32 special_len)
|
|
||||||
{
|
|
||||||
uint32 ret = 0;
|
|
||||||
|
|
||||||
switch(id)
|
|
||||||
{
|
|
||||||
case MEMORY_GSREG_ROMBBSLCT:
|
|
||||||
ret = BankSelector[0];
|
|
||||||
|
|
||||||
if(special)
|
|
||||||
{
|
|
||||||
snprintf(special, special_len, "((0x%02x * 0x100000) %% 0x%08x) + 20 bit address = 0x%08x + 20 bit address", BankSelector[0], rom_size, (BankSelector[0] * 0x100000) & (rom_size - 1));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MEMORY_GSREG_BNK1SLCT:
|
|
||||||
ret = BankSelector[1];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MEMORY_GSREG_BNK2SLCT:
|
|
||||||
ret = BankSelector[2];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MEMORY_GSREG_BNK3SLCT:
|
|
||||||
ret = BankSelector[3];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WSwan_MemorySetRegister(const unsigned int id, uint32 value)
|
|
||||||
{
|
|
||||||
switch(id)
|
|
||||||
{
|
|
||||||
case MEMORY_GSREG_ROMBBSLCT:
|
|
||||||
BankSelector[0] = value;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MEMORY_GSREG_BNK1SLCT:
|
|
||||||
BankSelector[1] = value;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MEMORY_GSREG_BNK2SLCT:
|
|
||||||
BankSelector[2] = value;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MEMORY_GSREG_BNK3SLCT:
|
|
||||||
BankSelector[3] = value;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void WSwan_MemoryKill(void)
|
void WSwan_MemoryKill(void)
|
||||||
{
|
{
|
||||||
if(wsSRAM)
|
if(wsSRAM)
|
||||||
@ -514,18 +342,6 @@ void WSwan_MemoryInit(bool lang, bool IsWSC, uint32 ssize, bool SkipSaveLoad)
|
|||||||
wsRAMSize = 65536;
|
wsRAMSize = 65536;
|
||||||
sram_size = ssize;
|
sram_size = ssize;
|
||||||
|
|
||||||
#ifdef WANT_DEBUGGER
|
|
||||||
{
|
|
||||||
ASpace_Add(GetAddressSpaceBytes, PutAddressSpaceBytes, "physical", "CPU Physical", 20);
|
|
||||||
ASpace_Add(GetAddressSpaceBytes, PutAddressSpaceBytes, "ram", "RAM", (int)(log(wsRAMSize) / log(2)));
|
|
||||||
|
|
||||||
ASpace_Add(GetAddressSpaceBytes, PutAddressSpaceBytes, "cs", "Code Segment", 16);
|
|
||||||
ASpace_Add(GetAddressSpaceBytes, PutAddressSpaceBytes, "ss", "Stack Segment", 16);
|
|
||||||
ASpace_Add(GetAddressSpaceBytes, PutAddressSpaceBytes, "ds", "Data Segment", 16);
|
|
||||||
ASpace_Add(GetAddressSpaceBytes, PutAddressSpaceBytes, "es", "Extra Segment", 16);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// WSwan_EEPROMInit() will also clear wsEEPROM
|
// WSwan_EEPROMInit() will also clear wsEEPROM
|
||||||
WSwan_EEPROMInit(MDFN_GetSettingS("wswan.name"), byear, bmonth, bday, sex, blood);
|
WSwan_EEPROMInit(MDFN_GetSettingS("wswan.name"), byear, bmonth, bday, sex, blood);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user