bizswan: add cpu flags and registers, memory domains
This commit is contained in:
parent
fb4bd18fe1
commit
63c361f4e2
|
@ -93,6 +93,48 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
|||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern void bizswan_putsettings(IntPtr core, [In] ref Settings settings);
|
||||
|
||||
/// <summary>
|
||||
/// get a memory area
|
||||
/// </summary>
|
||||
/// <param name="core"></param>
|
||||
/// <param name="index">start at 0, increment until return is false</param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="size"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern bool bizswan_getmemoryarea(IntPtr core, int index, out IntPtr name, out int size, out IntPtr data);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// return a CPU register
|
||||
/// </summary>
|
||||
/// <param name="core"></param>
|
||||
/// <param name="which"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern uint bizswan_getnecreg(IntPtr core, NecRegs which);
|
||||
|
||||
public const NecRegs NecRegsMin = NecRegs.PC;
|
||||
public const NecRegs NecRegsMax = NecRegs.DS0;
|
||||
|
||||
public enum NecRegs : int
|
||||
{
|
||||
PC = 1,
|
||||
AW = 2,
|
||||
CW = 3,
|
||||
DW = 4,
|
||||
BW = 5,
|
||||
SP = 6,
|
||||
BP = 7,
|
||||
IX = 8,
|
||||
IY = 9,
|
||||
FLAGS = 10,
|
||||
DS1 = 11,
|
||||
PS = 12,
|
||||
SS = 13,
|
||||
DS0 = 14
|
||||
};
|
||||
|
||||
[Flags]
|
||||
public enum Buttons : ushort
|
||||
|
|
|
@ -7,6 +7,7 @@ using BizHawk.Emulation.Common;
|
|||
using System.IO;
|
||||
using System.ComponentModel;
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.WonderSwan
|
||||
{
|
||||
|
@ -68,6 +69,7 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
|||
|
||||
InitVideo(rotate);
|
||||
PutSettings(_Settings);
|
||||
SetMemoryDomains();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -185,14 +187,52 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
|||
|
||||
#region Debugging
|
||||
|
||||
public MemoryDomainList MemoryDomains
|
||||
unsafe void SetMemoryDomains()
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
var mmd = new List<MemoryDomain>();
|
||||
for (int i = 0; ; i++)
|
||||
{
|
||||
IntPtr name;
|
||||
int size;
|
||||
IntPtr data;
|
||||
if (!BizSwan.bizswan_getmemoryarea(Core, i, out name, out size, out data))
|
||||
break;
|
||||
if (size == 0)
|
||||
continue;
|
||||
string sname = Marshal.PtrToStringAnsi(name);
|
||||
byte *p = (byte*)data;
|
||||
mmd.Add(new MemoryDomain(
|
||||
sname,
|
||||
size,
|
||||
MemoryDomain.Endian.Little,
|
||||
delegate(int addr)
|
||||
{
|
||||
if (addr < 0 || addr >= size)
|
||||
throw new ArgumentOutOfRangeException();
|
||||
return p[addr];
|
||||
},
|
||||
delegate(int addr, byte value)
|
||||
{
|
||||
if (addr < 0 || addr >= size)
|
||||
throw new ArgumentOutOfRangeException();
|
||||
p[addr] = value;
|
||||
}));
|
||||
}
|
||||
MemoryDomains = new MemoryDomainList(mmd, 0);
|
||||
}
|
||||
|
||||
public MemoryDomainList MemoryDomains { get; private set; }
|
||||
|
||||
public Dictionary<string, int> GetCpuFlagsAndRegisters()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var ret = new Dictionary<string, int>();
|
||||
for (int i = (int)BizSwan.NecRegsMin; i <= (int)BizSwan.NecRegsMax; i++)
|
||||
{
|
||||
BizSwan.NecRegs en = (BizSwan.NecRegs)i;
|
||||
uint val = BizSwan.bizswan_getnecreg(Core, en);
|
||||
ret[Enum.GetName(typeof(BizSwan.NecRegs), en)] = (int)val;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Binary file not shown.
|
@ -74,7 +74,6 @@
|
|||
<ClCompile Include="..\eeprom.cpp" />
|
||||
<ClCompile Include="..\gfx.cpp" />
|
||||
<ClCompile Include="..\interrupt.cpp" />
|
||||
<ClCompile Include="..\main.cpp" />
|
||||
<ClCompile Include="..\memory.cpp" />
|
||||
<ClCompile Include="..\rtc.cpp" />
|
||||
<ClCompile Include="..\sound.cpp" />
|
||||
|
|
|
@ -36,9 +36,6 @@
|
|||
<ClCompile Include="..\interrupt.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\memory.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -1,94 +0,0 @@
|
|||
/* Cygne
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Dox dox@space.pl
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
//#include <mednafen/md5.h>
|
||||
//#include <mednafen/mempatcher.h>
|
||||
//#include <mednafen/player.h>
|
||||
|
||||
//#include <fcntl.h>
|
||||
//#include <sys/types.h>
|
||||
//#include <sys/stat.h>
|
||||
#include <math.h>
|
||||
//#include <zlib.h>
|
||||
|
||||
namespace MDFN_IEN_WSWAN
|
||||
{
|
||||
#if 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
using namespace MDFN_IEN_WSWAN;
|
||||
|
||||
MDFNGI EmulatedWSwan =
|
||||
{
|
||||
"wswan",
|
||||
"WonderSwan",
|
||||
KnownExtensions,
|
||||
MODPRIO_INTERNAL_HIGH,
|
||||
#ifdef WANT_DEBUGGER
|
||||
&DBGInfo,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
&InputInfo,
|
||||
Load,
|
||||
TestMagic,
|
||||
NULL,
|
||||
NULL,
|
||||
CloseGame,
|
||||
WSwan_SetLayerEnableMask,
|
||||
"Background\0Foreground\0Sprites\0",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
false,
|
||||
StateAction,
|
||||
Emulate,
|
||||
SetInput,
|
||||
DoSimpleCommand,
|
||||
WSwanSettings,
|
||||
MDFN_MASTERCLOCK_FIXED(3072000),
|
||||
0,
|
||||
FALSE, // Multires possible?
|
||||
|
||||
224, // lcm_width
|
||||
144, // lcm_height
|
||||
NULL, // Dummy
|
||||
|
||||
224, // Nominal width
|
||||
144, // Nominal height
|
||||
|
||||
224, // Framebuffer width
|
||||
144, // Framebuffer height
|
||||
|
||||
2, // Number of output sound channels
|
||||
};
|
||||
*/
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
#include "system.h"
|
||||
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
|
|
|
@ -274,6 +274,26 @@ namespace MDFN_IEN_WSWAN
|
|||
gfx.SetLayerEnableMask(s.LayerMask);
|
||||
}
|
||||
|
||||
uint32 System::GetNECReg(int which) const
|
||||
{
|
||||
return cpu.get_reg(which);
|
||||
}
|
||||
|
||||
bool System::GetMemoryArea(int index, const char *&name, int &size, uint8 *&data)
|
||||
{
|
||||
bool ret = true;
|
||||
switch (index)
|
||||
{
|
||||
case 0: name = "RAM"; size = 65536; data = memory.wsRAM; break;
|
||||
case 1: name = "ROM"; size = memory.rom_size; data = memory.wsCartROM; break;
|
||||
case 2: name = "SRAM"; size = memory.sram_size; data = memory.wsSRAM; break;
|
||||
case 3: name = "iEEPROM"; size = eeprom.ieeprom_size; data = eeprom.iEEPROM; break;
|
||||
case 4: name = "EEPROM"; size = eeprom.eeprom_size; data = eeprom.wsEEPROM; break;
|
||||
default: ret = false; break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
EXPORT System *bizswan_new()
|
||||
{
|
||||
|
@ -322,4 +342,14 @@ namespace MDFN_IEN_WSWAN
|
|||
s->PutSettings(*settings);
|
||||
}
|
||||
|
||||
EXPORT uint32 bizswan_getnecreg(System *s, int which)
|
||||
{
|
||||
return s->GetNECReg(which);
|
||||
}
|
||||
|
||||
EXPORT int bizswan_getmemoryarea(System *s, int index, const char **name, int *size, uint8 **data)
|
||||
{
|
||||
return s->GetMemoryArea(index, *name, *size, *data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,6 +38,10 @@ public:
|
|||
bool SaveRamLoad(const uint8 *data, int size);
|
||||
bool SaveRamSave(uint8 *dest, int maxsize) const;
|
||||
|
||||
uint32 GetNECReg(int which) const;
|
||||
|
||||
bool GetMemoryArea(int index, const char *&name, int &size, uint8 *&data);
|
||||
|
||||
public:
|
||||
GFX gfx;
|
||||
Memory memory;
|
||||
|
|
|
@ -957,7 +957,7 @@ namespace MDFN_IEN_WSWAN
|
|||
/*****************************************************************************/
|
||||
|
||||
|
||||
unsigned V30MZ::get_reg(int regnum)
|
||||
unsigned V30MZ::get_reg(int regnum) const
|
||||
{
|
||||
switch( regnum )
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
void execute(int cycles);
|
||||
void set_reg(int, unsigned);
|
||||
unsigned get_reg(int regnum);
|
||||
unsigned get_reg(int regnum) const;
|
||||
void reset();
|
||||
|
||||
void interrupt(uint32 vector, bool IgnoreIF = FALSE);
|
||||
|
@ -81,10 +81,6 @@ private:
|
|||
} Mod_RM;
|
||||
|
||||
private:
|
||||
//void (*cpu_writemem20)(uint32,uint8);// = NULL;
|
||||
//uint8 (*cpu_readport)(uint32);// = NULL;
|
||||
//void (*cpu_writeport)(uint32, uint8);// = NULL;
|
||||
//uint8 (*cpu_readmem20)(uint32);// = NULL;
|
||||
|
||||
private:
|
||||
void nec_interrupt(unsigned int_num);
|
||||
|
@ -153,13 +149,6 @@ enum {
|
|||
NEC_FLAGS, NEC_DS1, NEC_PS, NEC_SS, NEC_DS0
|
||||
};
|
||||
|
||||
/* Public variables */
|
||||
//extern int v30mz_ICount;
|
||||
//extern uint32 v30mz_timestamp;
|
||||
|
||||
|
||||
/* Public functions */
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -10,24 +10,6 @@ namespace MDFN_IEN_WSWAN
|
|||
|
||||
#define mBCD(value) (((value)/10)<<4)|((value)%10)
|
||||
|
||||
//extern uint32 rom_size;
|
||||
//extern int wsc;
|
||||
|
||||
/*
|
||||
enum
|
||||
{
|
||||
WSWAN_SEX_MALE = 1,
|
||||
WSWAN_SEX_FEMALE = 2
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
WSWAN_BLOOD_A = 1,
|
||||
WSWAN_BLOOD_B = 2,
|
||||
WSWAN_BLOOD_O = 3,
|
||||
WSWAN_BLOOD_AB = 4
|
||||
};
|
||||
*/
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue