wonderswan: grab changes from mednafen 0.9.36.5 release. includes sound, sram, changes. not included now: rtc, comm port changes

This commit is contained in:
goyuken 2014-11-10 01:01:01 +00:00
parent b0eb4ee791
commit f5d9de5178
8 changed files with 60 additions and 45 deletions

View File

@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
namespace BizHawk.Emulation.Cores.WonderSwan
{
[CoreAttributes("Cygne/Mednafen", "Dox", true, true, "0.9.34.1", "http://mednafen.sourceforge.net/")]
[CoreAttributes("Cygne/Mednafen", "Dox", true, true, "0.9.36.5", "http://mednafen.sourceforge.net/")]
public class WonderSwan : IEmulator, IVideoProvider, ISyncSoundProvider, IMemoryDomains,
IDebuggable, ISettable<WonderSwan.Settings, WonderSwan.SyncSettings>
{

Binary file not shown.

View File

@ -5,13 +5,15 @@ namespace MDFN_IEN_WSWAN
{
void Interrupt::Recalc()
{
IOn_Cache = FALSE;
IStatus |= (IAsserted & LevelTriggeredMask) & IEnable;
IOn_Cache = false;
IOn_Which = 0;
IVector_Cache = 0;
for(int i = 0; i < 8; i++)
{
if(IStatus & IEnable & (1 << i))
if(IStatus & IEnable & (1U << i))
{
IOn_Cache = TRUE;
IOn_Which = i;
@ -21,17 +23,21 @@ namespace MDFN_IEN_WSWAN
}
}
void Interrupt::DebugForce(unsigned int level)
void Interrupt::AssertInterrupt(unsigned which, bool asserted)
{
const uint8 prev_IAsserted = IAsserted;
IAsserted &= ~(1U << which);
IAsserted |= (unsigned)asserted << which;
IStatus |= ((prev_IAsserted ^ IAsserted) & IAsserted) & IEnable;
Recalc();
}
void Interrupt::DoInterrupt(unsigned which)
{
sys->cpu.interrupt((IVectorBase + level) * 4, TRUE);
}
void Interrupt::DoInterrupt(int which)
{
if(IEnable & (1 << which))
IStatus |= 1 << which;
//printf("Interrupt: %d\n", which);
IStatus |= (1U << which) & IEnable;
Recalc();
}
@ -42,7 +48,7 @@ namespace MDFN_IEN_WSWAN
{
case 0xB0: IVectorBase = V; Recalc(); break;
case 0xB2: IEnable = V; IStatus &= IEnable; Recalc(); break;
case 0xB6: /*printf("IStatus: %02x\n", V);*/ IStatus &= ~V; Recalc(); break;
case 0xB6: IStatus &= ~V; Recalc(); break;
}
}
@ -68,6 +74,7 @@ namespace MDFN_IEN_WSWAN
void Interrupt::Reset()
{
IAsserted = 0x00;
IEnable = 0x00;
IStatus = 0x00;
IVectorBase = 0x00;
@ -76,6 +83,7 @@ namespace MDFN_IEN_WSWAN
SYNCFUNC(Interrupt)
{
NSS(IAsserted);
NSS(IStatus);
NSS(IEnable);
NSS(IVectorBase);

View File

@ -5,30 +5,30 @@
namespace MDFN_IEN_WSWAN
{
enum
{
WSINT_SERIAL_SEND = 0,
WSINT_KEY_PRESS,
WSINT_RTC_ALARM,
WSINT_SERIAL_RECV,
WSINT_LINE_HIT,
WSINT_VBLANK_TIMER,
WSINT_VBLANK,
WSINT_HBLANK_TIMER
WSINT_SERIAL_SEND = 0,
WSINT_KEY_PRESS,
WSINT_RTC_ALARM,
WSINT_SERIAL_RECV,
WSINT_LINE_HIT,
WSINT_VBLANK_TIMER,
WSINT_VBLANK,
WSINT_HBLANK_TIMER
};
class Interrupt
{
public:
void DoInterrupt(int);
void DoInterrupt(unsigned);
void AssertInterrupt(unsigned which, bool asserted);
void Write(uint32 A, uint8 V);
uint8 Read(uint32 A);
void Check();
void Reset();
void DebugForce(unsigned int level);
private:
uint8 IAsserted;
uint8 IStatus;
uint8 IEnable;
uint8 IVectorBase;
@ -37,6 +37,8 @@ private:
uint32 IOn_Which;
uint32 IVector_Cache;
static const uint8 LevelTriggeredMask = (1U << WSINT_SERIAL_RECV);
private:
void Recalc();
public:

View File

@ -23,6 +23,9 @@
namespace MDFN_IEN_WSWAN
{
// TODO: replace all use of libc time functions with internal stuff for movie recording
// (when userealtime == true, OK to use libc stuff)
static void GMTime(uint64 ticks, tm &time)
{
time_t t = ticks;

View File

@ -15,12 +15,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
Noise emulation is almost certainly wrong wrong wrong. Testing on a real system is needed to determine LFSR(assuming it uses an LFSR) taps.
*/
#include "system.h"
#include <cstring>
@ -134,12 +129,9 @@ namespace MDFN_IEN_WSWAN
period_counter[ch] -= run_time;
while(period_counter[ch] <= 0)
{
// Yay, random numbers, so let's use totally wrong numbers to make them!
const int bstab1[8] = { 14, 13, 12, 14, 12, 13, 14, 14 };
const int bstab2[8] = { 13, 12, 9, 12, 1, 1, 5, 11 };
//const int bstab1[8] = { 14, 13, 12, 14, 10, 9, 8, 13 };
//const int bstab2[8] = { 13, 12, 9, 12, 1, 6, 4, 11 };
nreg = (~((nreg << 1) | ( ((nreg >> bstab1[noise_control & 0x7]) & 1) ^ ((nreg >> bstab2[noise_control & 0x7]) & 1)))) & 0x7FFF;
static const uint8 stab[8] = { 14, 10, 13, 4, 8, 6, 9, 11 };
nreg = ((nreg << 1) | ((1 ^ (nreg >> 7) ^ (nreg >> stab[noise_control & 0x7])) & 1)) & 0x7FFF;
if(control & 0x80)
{
MK_SAMPLE_CACHE_NOISE;
@ -213,20 +205,23 @@ namespace MDFN_IEN_WSWAN
}
else if(A == 0x8E)
{
noise_control = V;
if(V & 0x8) nreg = 1;
if(V & 0x8)
nreg = 0;
noise_control = V & 0x17;
//printf("NOISECONTROL: %02x\n", V);
}
else if(A == 0x90)
{
for(int n = 0; n < 4; n++)
{
if(!(control & (1 << n)) && (V & (1 << n)))
{
period_counter[n] = 0;
sample_pos[n] = 0x1F;
}
control = V;
//printf("Sound Control: %02x\n", V);
}
control = V;
//printf("Sound Control: %02x\n", V);
}
else if(A == 0x91)
{
@ -366,7 +361,7 @@ namespace MDFN_IEN_WSWAN
SampleRAMPos = 0;
std::memset(period_counter, 0, sizeof(period_counter));
std::memset(sample_pos, 0, sizeof(sample_pos));
nreg = 1;
nreg = 0;
std::memset(sample_cache, 0, sizeof(sample_cache));
std::memset(last_val, 0, sizeof(last_val));

View File

@ -304,13 +304,19 @@ static const DLEntry Developers[] =
{ 0x1F, "Emotion" }, // Bandai Visual??
{ 0x20, "Athena" },
{ 0x21, "KID" },
{ 0x22, "HAL" },
{ 0x23, "Yuki-Enterprise" },
{ 0x24, "Omega Micott" },
{ 0x25, "Upstar" },
{ 0x26, "Kadokawa/Megas" },
{ 0x27, "Cocktail Soft" },
{ 0x28, "Squaresoft" },
{ 0x2A, "NTT DoCoMo" },
{ 0x2B, "TomCreate" },
{ 0x2D, "Namco" },
{ 0x2F, "Gust" },
{ 0x31, "Vanguard" }, // or Elorg?
{ 0x32, "Megatron" },
{ 0x33, "WiZ" },
{ 0x36, "Capcom" },
};

View File

@ -153,10 +153,11 @@ namespace MDFN_IEN_WSWAN
switch(header[5])
{
case 0x01: memory.sram_size = 8*1024; break;
case 0x02: memory.sram_size = 32*1024; break;
case 0x03: memory.sram_size = 16 * 65536; break;
case 0x04: memory.sram_size = 32 * 65536; break; // Dicing Knight!
case 0x01: memory.sram_size = 8 * 1024; break;
case 0x02: memory.sram_size = 32 * 1024; break;
case 0x03: memory.sram_size = 128 * 1024; break; // Taikyoku Igo. Maybe it should only be 65536 bytes?
case 0x04: memory.sram_size = 256 * 1024; break; // Dicing Knight, Judgement Silversword
case 0x05: memory.sram_size = 512 * 1024; break; // Wonder Gate
case 0x10: eeprom.eeprom_size = 128; break;
case 0x20: eeprom.eeprom_size = 2*1024; break;