mirror of https://github.com/snes9xgit/snes9x.git
Fix HIRQ
This commit is contained in:
parent
45ca5f3eb6
commit
2f167567f5
|
@ -425,7 +425,6 @@ static const int ptrspeeds[4] = { 1, 1, 4, 8 };
|
||||||
S(ToggleBG2), \
|
S(ToggleBG2), \
|
||||||
S(ToggleBG3), \
|
S(ToggleBG3), \
|
||||||
S(ToggleEmuTurbo), \
|
S(ToggleEmuTurbo), \
|
||||||
S(ToggleHDMA), \
|
|
||||||
S(ToggleSprites), \
|
S(ToggleSprites), \
|
||||||
S(ToggleTransparency) \
|
S(ToggleTransparency) \
|
||||||
|
|
||||||
|
@ -2454,11 +2453,6 @@ void S9xApplyCommand (s9xcommand_t cmd, int16 data1, int16 data2)
|
||||||
DisplayStateChange("Sprites", !(Settings.BG_Forced & 16));
|
DisplayStateChange("Sprites", !(Settings.BG_Forced & 16));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ToggleHDMA:
|
|
||||||
Settings.DisableHDMA = !Settings.DisableHDMA;
|
|
||||||
DisplayStateChange("HDMA emulation", !Settings.DisableHDMA);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ToggleTransparency:
|
case ToggleTransparency:
|
||||||
Settings.Transparency = !Settings.Transparency;
|
Settings.Transparency = !Settings.Transparency;
|
||||||
DisplayStateChange("Transparency effects", Settings.Transparency);
|
DisplayStateChange("Transparency effects", Settings.Transparency);
|
||||||
|
|
2
cpu.cpp
2
cpu.cpp
|
@ -217,7 +217,7 @@ static void S9xSoftResetCPU (void)
|
||||||
CPU.IRQTransition = FALSE;
|
CPU.IRQTransition = FALSE;
|
||||||
CPU.IRQLastState = FALSE;
|
CPU.IRQLastState = FALSE;
|
||||||
CPU.IRQExternal = FALSE;
|
CPU.IRQExternal = FALSE;
|
||||||
CPU.IRQPending = 0;
|
CPU.IRQPending = Timings.IRQPendCount;
|
||||||
CPU.MemSpeed = SLOW_ONE_CYCLE;
|
CPU.MemSpeed = SLOW_ONE_CYCLE;
|
||||||
CPU.MemSpeedx2 = SLOW_ONE_CYCLE * 2;
|
CPU.MemSpeedx2 = SLOW_ONE_CYCLE * 2;
|
||||||
CPU.FastROMSpeed = SLOW_ONE_CYCLE;
|
CPU.FastROMSpeed = SLOW_ONE_CYCLE;
|
||||||
|
|
39
cpuexec.cpp
39
cpuexec.cpp
|
@ -187,6 +187,8 @@
|
||||||
#include "missing.h"
|
#include "missing.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static inline void S9xReschedule (void);
|
||||||
|
|
||||||
|
|
||||||
void S9xMainLoop (void)
|
void S9xMainLoop (void)
|
||||||
{
|
{
|
||||||
|
@ -221,6 +223,7 @@ void S9xMainLoop (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
CPU.IRQTransition = FALSE;
|
CPU.IRQTransition = FALSE;
|
||||||
|
CPU.IRQPending = Timings.IRQPendCount;
|
||||||
|
|
||||||
if (!CheckFlag(IRQ))
|
if (!CheckFlag(IRQ))
|
||||||
S9xOpcode_IRQ();
|
S9xOpcode_IRQ();
|
||||||
|
@ -306,6 +309,42 @@ void S9xMainLoop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void S9xReschedule (void)
|
||||||
|
{
|
||||||
|
switch (CPU.WhichEvent)
|
||||||
|
{
|
||||||
|
case HC_HBLANK_START_EVENT:
|
||||||
|
CPU.WhichEvent = HC_HDMA_START_EVENT;
|
||||||
|
CPU.NextEvent = Timings.HDMAStart;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HC_HDMA_START_EVENT:
|
||||||
|
CPU.WhichEvent = HC_HCOUNTER_MAX_EVENT;
|
||||||
|
CPU.NextEvent = Timings.H_Max;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HC_HCOUNTER_MAX_EVENT:
|
||||||
|
CPU.WhichEvent = HC_HDMA_INIT_EVENT;
|
||||||
|
CPU.NextEvent = Timings.HDMAInit;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HC_HDMA_INIT_EVENT:
|
||||||
|
CPU.WhichEvent = HC_RENDER_EVENT;
|
||||||
|
CPU.NextEvent = Timings.RenderPos;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HC_RENDER_EVENT:
|
||||||
|
CPU.WhichEvent = HC_WRAM_REFRESH_EVENT;
|
||||||
|
CPU.NextEvent = Timings.WRAMRefreshPos;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HC_WRAM_REFRESH_EVENT:
|
||||||
|
CPU.WhichEvent = HC_HBLANK_START_EVENT;
|
||||||
|
CPU.NextEvent = Timings.HBlankStart;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void S9xDoHEventProcessing (void)
|
void S9xDoHEventProcessing (void)
|
||||||
{
|
{
|
||||||
#ifdef DEBUGGER
|
#ifdef DEBUGGER
|
||||||
|
|
44
cpuexec.h
44
cpuexec.h
|
@ -270,42 +270,6 @@ static inline void S9xFixCycles (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void S9xReschedule (void)
|
|
||||||
{
|
|
||||||
switch (CPU.WhichEvent)
|
|
||||||
{
|
|
||||||
case HC_HBLANK_START_EVENT:
|
|
||||||
CPU.WhichEvent = HC_HDMA_START_EVENT;
|
|
||||||
CPU.NextEvent = Timings.HDMAStart;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HC_HDMA_START_EVENT:
|
|
||||||
CPU.WhichEvent = HC_HCOUNTER_MAX_EVENT;
|
|
||||||
CPU.NextEvent = Timings.H_Max;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HC_HCOUNTER_MAX_EVENT:
|
|
||||||
CPU.WhichEvent = HC_HDMA_INIT_EVENT;
|
|
||||||
CPU.NextEvent = Timings.HDMAInit;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HC_HDMA_INIT_EVENT:
|
|
||||||
CPU.WhichEvent = HC_RENDER_EVENT;
|
|
||||||
CPU.NextEvent = Timings.RenderPos;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HC_RENDER_EVENT:
|
|
||||||
CPU.WhichEvent = HC_WRAM_REFRESH_EVENT;
|
|
||||||
CPU.NextEvent = Timings.WRAMRefreshPos;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HC_WRAM_REFRESH_EVENT:
|
|
||||||
CPU.WhichEvent = HC_HBLANK_START_EVENT;
|
|
||||||
CPU.NextEvent = Timings.HBlankStart;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void S9xCheckInterrupts (void)
|
static inline void S9xCheckInterrupts (void)
|
||||||
{
|
{
|
||||||
bool8 thisIRQ = PPU.HTimerEnabled || PPU.VTimerEnabled;
|
bool8 thisIRQ = PPU.HTimerEnabled || PPU.VTimerEnabled;
|
||||||
|
@ -315,7 +279,11 @@ static inline void S9xCheckInterrupts (void)
|
||||||
|
|
||||||
if (PPU.HTimerEnabled)
|
if (PPU.HTimerEnabled)
|
||||||
{
|
{
|
||||||
if (CPU.PrevCycles >= PPU.HTimerPosition || CPU.Cycles < PPU.HTimerPosition)
|
int32 htimepos = PPU.HTimerPosition;
|
||||||
|
if (CPU.Cycles >= Timings.H_Max)
|
||||||
|
htimepos += Timings.H_Max;
|
||||||
|
|
||||||
|
if (CPU.PrevCycles >= htimepos || CPU.Cycles < htimepos)
|
||||||
thisIRQ = FALSE;
|
thisIRQ = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +292,7 @@ static inline void S9xCheckInterrupts (void)
|
||||||
int32 vcounter = CPU.V_Counter;
|
int32 vcounter = CPU.V_Counter;
|
||||||
if (CPU.Cycles >= Timings.H_Max)
|
if (CPU.Cycles >= Timings.H_Max)
|
||||||
vcounter++;
|
vcounter++;
|
||||||
|
|
||||||
if (vcounter != PPU.VTimerPosition)
|
if (vcounter != PPU.VTimerPosition)
|
||||||
thisIRQ = FALSE;
|
thisIRQ = FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -872,7 +872,7 @@ static uint8 debug_cpu_op_print (char *Line, uint8 Bank, uint16 Address)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(Line, "%-44s A:%04X X:%04X Y:%04X D:%04X DB:%02X S:%04X P:%c%c%c%c%c%c%c%c%c HC:%04ld VC:%03ld FC:%02d %02x",
|
sprintf(Line, "%-44s A:%04X X:%04X Y:%04X D:%04X DB:%02X S:%04X P:%c%c%c%c%c%c%c%c%c HC:%04ld VC:%03ld FC:%02d %03x",
|
||||||
Line, Registers.A.W, Registers.X.W, Registers.Y.W,
|
Line, Registers.A.W, Registers.X.W, Registers.Y.W,
|
||||||
Registers.D.W, Registers.DB, Registers.S.W,
|
Registers.D.W, Registers.DB, Registers.S.W,
|
||||||
CheckEmulation() ? 'E' : 'e',
|
CheckEmulation() ? 'E' : 'e',
|
||||||
|
@ -887,7 +887,7 @@ static uint8 debug_cpu_op_print (char *Line, uint8 Bank, uint16 Address)
|
||||||
(long) CPU.Cycles,
|
(long) CPU.Cycles,
|
||||||
(long) CPU.V_Counter,
|
(long) CPU.V_Counter,
|
||||||
IPPU.FrameCount,
|
IPPU.FrameCount,
|
||||||
(PPU.HTimerEnabled ? 0x10 : 0) | (PPU.VTimerEnabled ? 0x01 : 0));
|
(CPU.IRQExternal ? 0x100 : 0) | (PPU.HTimerEnabled ? 0x10 : 0) | (PPU.VTimerEnabled ? 0x01 : 0));
|
||||||
|
|
||||||
return (Size);
|
return (Size);
|
||||||
}
|
}
|
||||||
|
|
14
dma.cpp
14
dma.cpp
|
@ -741,9 +741,6 @@ bool8 S9xDoDMA (uint8 Channel)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x18: // VMDATAL
|
case 0x18: // VMDATAL
|
||||||
#ifndef CORRECT_VRAM_READS
|
|
||||||
IPPU.FirstVRAMRead = TRUE;
|
|
||||||
#endif
|
|
||||||
if (!PPU.VMA.FullGraphicCount)
|
if (!PPU.VMA.FullGraphicCount)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
@ -766,9 +763,6 @@ bool8 S9xDoDMA (uint8 Channel)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x19: // VMDATAH
|
case 0x19: // VMDATAH
|
||||||
#ifndef CORRECT_VRAM_READS
|
|
||||||
IPPU.FirstVRAMRead = TRUE;
|
|
||||||
#endif
|
|
||||||
if (!PPU.VMA.FullGraphicCount)
|
if (!PPU.VMA.FullGraphicCount)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
@ -837,9 +831,6 @@ bool8 S9xDoDMA (uint8 Channel)
|
||||||
if (d->BAddress == 0x18)
|
if (d->BAddress == 0x18)
|
||||||
{
|
{
|
||||||
// VMDATAL
|
// VMDATAL
|
||||||
#ifndef CORRECT_VRAM_READS
|
|
||||||
IPPU.FirstVRAMRead = TRUE;
|
|
||||||
#endif
|
|
||||||
if (!PPU.VMA.FullGraphicCount)
|
if (!PPU.VMA.FullGraphicCount)
|
||||||
{
|
{
|
||||||
switch (b)
|
switch (b)
|
||||||
|
@ -1373,10 +1364,7 @@ static inline bool8 HDMAReadLineCount (int d)
|
||||||
|
|
||||||
void S9xStartHDMA (void)
|
void S9xStartHDMA (void)
|
||||||
{
|
{
|
||||||
if (Settings.DisableHDMA)
|
PPU.HDMA = Memory.FillRAM[0x420c];
|
||||||
PPU.HDMA = 0;
|
|
||||||
else
|
|
||||||
PPU.HDMA = Memory.FillRAM[0x420c];
|
|
||||||
|
|
||||||
#ifdef DEBUGGER
|
#ifdef DEBUGGER
|
||||||
missing.hdma_this_frame = PPU.HDMA;
|
missing.hdma_this_frame = PPU.HDMA;
|
||||||
|
|
|
@ -67,8 +67,6 @@ Justifier2Crosshair = 4 MagicPink/Black
|
||||||
EnableGameSpecificHacks = TRUE
|
EnableGameSpecificHacks = TRUE
|
||||||
AllowInvalidVRAMAccess = FALSE
|
AllowInvalidVRAMAccess = FALSE
|
||||||
SpeedHacks = FALSE
|
SpeedHacks = FALSE
|
||||||
DisableIRQ = FALSE
|
|
||||||
DisableHDMA = FALSE
|
|
||||||
HDMATiming = 100
|
HDMATiming = 100
|
||||||
|
|
||||||
[Netplay]
|
[Netplay]
|
||||||
|
@ -231,7 +229,6 @@ K00:4 = ToggleBG3
|
||||||
K00:5 = ToggleSprites
|
K00:5 = ToggleSprites
|
||||||
K00:9 = ToggleTransparency
|
K00:9 = ToggleTransparency
|
||||||
K00:BackSpace = ClipWindows
|
K00:BackSpace = ClipWindows
|
||||||
K00:0 = ToggleHDMA
|
|
||||||
K00:A+Escape = Debugger
|
K00:A+Escape = Debugger
|
||||||
M00:Pointer = Pointer Mouse1+Superscope+Justifier1
|
M00:Pointer = Pointer Mouse1+Superscope+Justifier1
|
||||||
M00:B0 = {Mouse1 L,Superscope Fire,Justifier1 Trigger}
|
M00:B0 = {Mouse1 L,Superscope Fire,Justifier1 Trigger}
|
||||||
|
|
|
@ -200,7 +200,6 @@
|
||||||
#define JMA_SUPPORT
|
#define JMA_SUPPORT
|
||||||
#define USE_OPENGL
|
#define USE_OPENGL
|
||||||
#define RIGHTSHIFT_IS_SAR
|
#define RIGHTSHIFT_IS_SAR
|
||||||
#define CORRECT_VRAM_READS
|
|
||||||
#define HAVE_STDINT_H
|
#define HAVE_STDINT_H
|
||||||
#define DEBUGGER
|
#define DEBUGGER
|
||||||
|
|
||||||
|
|
|
@ -197,7 +197,7 @@
|
||||||
|
|
||||||
#define kMacS9XCFString CFSTR("Snes9x")
|
#define kMacS9XCFString CFSTR("Snes9x")
|
||||||
|
|
||||||
#define MAC_VERSION "100"
|
#define MAC_VERSION "102"
|
||||||
|
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
|
|
||||||
|
|
70
ppu.cpp
70
ppu.cpp
|
@ -275,6 +275,11 @@ void S9xUpdateHVTimerPosition (void)
|
||||||
if (PPU.VTimerPosition >= Timings.V_Max)
|
if (PPU.VTimerPosition >= Timings.V_Max)
|
||||||
PPU.VTimerPosition = 0;
|
PPU.VTimerPosition = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUGGER
|
||||||
|
S9xTraceFormattedMessage("--- IRQ Timer set HTimer:%d Pos:%04d VTimer:%d Pos:%03d",
|
||||||
|
PPU.HTimerEnabled, PPU.HTimerPosition, PPU.VTimerEnabled, PPU.VTimerPosition);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void S9xFixColourBrightness (void)
|
void S9xFixColourBrightness (void)
|
||||||
|
@ -618,7 +623,7 @@ void S9xSetPPU (uint8 Byte, uint16 Address)
|
||||||
case 0x2116: // VMADDL
|
case 0x2116: // VMADDL
|
||||||
PPU.VMA.Address &= 0xff00;
|
PPU.VMA.Address &= 0xff00;
|
||||||
PPU.VMA.Address |= Byte;
|
PPU.VMA.Address |= Byte;
|
||||||
#ifdef CORRECT_VRAM_READS
|
|
||||||
if (PPU.VMA.FullGraphicCount)
|
if (PPU.VMA.FullGraphicCount)
|
||||||
{
|
{
|
||||||
uint32 addr = PPU.VMA.Address;
|
uint32 addr = PPU.VMA.Address;
|
||||||
|
@ -628,15 +633,13 @@ void S9xSetPPU (uint8 Byte, uint16 Address)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
IPPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((PPU.VMA.Address << 1) & 0xffff));
|
IPPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((PPU.VMA.Address << 1) & 0xffff));
|
||||||
#else
|
|
||||||
IPPU.FirstVRAMRead = TRUE;
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x2117: // VMADDH
|
case 0x2117: // VMADDH
|
||||||
PPU.VMA.Address &= 0x00ff;
|
PPU.VMA.Address &= 0x00ff;
|
||||||
PPU.VMA.Address |= Byte << 8;
|
PPU.VMA.Address |= Byte << 8;
|
||||||
#ifdef CORRECT_VRAM_READS
|
|
||||||
if (PPU.VMA.FullGraphicCount)
|
if (PPU.VMA.FullGraphicCount)
|
||||||
{
|
{
|
||||||
uint32 addr = PPU.VMA.Address;
|
uint32 addr = PPU.VMA.Address;
|
||||||
|
@ -646,22 +649,14 @@ void S9xSetPPU (uint8 Byte, uint16 Address)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
IPPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((PPU.VMA.Address << 1) & 0xffff));
|
IPPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((PPU.VMA.Address << 1) & 0xffff));
|
||||||
#else
|
|
||||||
IPPU.FirstVRAMRead = TRUE;
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x2118: // VMDATAL
|
case 0x2118: // VMDATAL
|
||||||
#ifndef CORRECT_VRAM_READS
|
|
||||||
IPPU.FirstVRAMRead = TRUE;
|
|
||||||
#endif
|
|
||||||
REGISTER_2118(Byte);
|
REGISTER_2118(Byte);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x2119: // VMDATAH
|
case 0x2119: // VMDATAH
|
||||||
#ifndef CORRECT_VRAM_READS
|
|
||||||
IPPU.FirstVRAMRead = TRUE;
|
|
||||||
#endif
|
|
||||||
REGISTER_2119(Byte);
|
REGISTER_2119(Byte);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1213,7 +1208,6 @@ uint8 S9xGetPPU (uint16 Address)
|
||||||
return (PPU.OpenBus1 = byte);
|
return (PPU.OpenBus1 = byte);
|
||||||
|
|
||||||
case 0x2139: // VMDATALREAD
|
case 0x2139: // VMDATALREAD
|
||||||
#ifdef CORRECT_VRAM_READS
|
|
||||||
byte = IPPU.VRAMReadBuffer & 0xff;
|
byte = IPPU.VRAMReadBuffer & 0xff;
|
||||||
if (!PPU.VMA.High)
|
if (!PPU.VMA.High)
|
||||||
{
|
{
|
||||||
|
@ -1229,33 +1223,13 @@ uint8 S9xGetPPU (uint16 Address)
|
||||||
|
|
||||||
PPU.VMA.Address += PPU.VMA.Increment;
|
PPU.VMA.Address += PPU.VMA.Increment;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (IPPU.FirstVRAMRead)
|
|
||||||
byte = Memory.VRAM[(PPU.VMA.Address << 1) & 0xffff];
|
|
||||||
else
|
|
||||||
if (PPU.VMA.FullGraphicCount)
|
|
||||||
{
|
|
||||||
uint32 addr = PPU.VMA.Address - 1;
|
|
||||||
uint32 rem = addr & PPU.VMA.Mask1;
|
|
||||||
uint32 address = (addr & ~PPU.VMA.Mask1) + (rem >> PPU.VMA.Shift) + ((rem & (PPU.VMA.FullGraphicCount - 1)) << 3);
|
|
||||||
byte = Memory.VRAM[((address << 1) - 2) & 0xffff];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
byte = Memory.VRAM[((PPU.VMA.Address << 1) - 2) & 0xffff];
|
|
||||||
|
|
||||||
if (!PPU.VMA.High)
|
|
||||||
{
|
|
||||||
PPU.VMA.Address += PPU.VMA.Increment;
|
|
||||||
IPPU.FirstVRAMRead = FALSE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef DEBUGGER
|
#ifdef DEBUGGER
|
||||||
missing.vram_read = 1;
|
missing.vram_read = 1;
|
||||||
#endif
|
#endif
|
||||||
return (PPU.OpenBus1 = byte);
|
return (PPU.OpenBus1 = byte);
|
||||||
|
|
||||||
case 0x213a: // VMDATAHREAD
|
case 0x213a: // VMDATAHREAD
|
||||||
#ifdef CORRECT_VRAM_READS
|
|
||||||
byte = (IPPU.VRAMReadBuffer >> 8) & 0xff;
|
byte = (IPPU.VRAMReadBuffer >> 8) & 0xff;
|
||||||
if (PPU.VMA.High)
|
if (PPU.VMA.High)
|
||||||
{
|
{
|
||||||
|
@ -1271,26 +1245,6 @@ uint8 S9xGetPPU (uint16 Address)
|
||||||
|
|
||||||
PPU.VMA.Address += PPU.VMA.Increment;
|
PPU.VMA.Address += PPU.VMA.Increment;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (IPPU.FirstVRAMRead)
|
|
||||||
byte = Memory.VRAM[((PPU.VMA.Address << 1) + 1) & 0xffff];
|
|
||||||
else
|
|
||||||
if (PPU.VMA.FullGraphicCount)
|
|
||||||
{
|
|
||||||
uint32 addr = PPU.VMA.Address - 1;
|
|
||||||
uint32 rem = addr & PPU.VMA.Mask1;
|
|
||||||
uint32 address = (addr & ~PPU.VMA.Mask1) + (rem >> PPU.VMA.Shift) + ((rem & (PPU.VMA.FullGraphicCount - 1)) << 3);
|
|
||||||
byte = Memory.VRAM[((address << 1) - 1) & 0xffff];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
byte = Memory.VRAM[((PPU.VMA.Address << 1) - 1) & 0xffff];
|
|
||||||
|
|
||||||
if (PPU.VMA.High)
|
|
||||||
{
|
|
||||||
PPU.VMA.Address += PPU.VMA.Increment;
|
|
||||||
IPPU.FirstVRAMRead = FALSE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef DEBUGGER
|
#ifdef DEBUGGER
|
||||||
missing.vram_read = 1;
|
missing.vram_read = 1;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1657,8 +1611,6 @@ void S9xSetCPU (uint8 Byte, uint16 Address)
|
||||||
case 0x420c: // HDMAEN
|
case 0x420c: // HDMAEN
|
||||||
if (CPU.InDMAorHDMA)
|
if (CPU.InDMAorHDMA)
|
||||||
return;
|
return;
|
||||||
if (Settings.DisableHDMA)
|
|
||||||
Byte = 0;
|
|
||||||
Memory.FillRAM[0x420c] = Byte;
|
Memory.FillRAM[0x420c] = Byte;
|
||||||
// Yoshi's Island, Genjyu Ryodan, Mortal Kombat, Tales of Phantasia
|
// Yoshi's Island, Genjyu Ryodan, Mortal Kombat, Tales of Phantasia
|
||||||
PPU.HDMA = Byte & ~PPU.HDMAEnded;
|
PPU.HDMA = Byte & ~PPU.HDMAEnded;
|
||||||
|
@ -2005,11 +1957,7 @@ void S9xSoftResetPPU (void)
|
||||||
ZeroMemory(IPPU.TileCached[TILE_2BIT_ODD], MAX_2BIT_TILES);
|
ZeroMemory(IPPU.TileCached[TILE_2BIT_ODD], MAX_2BIT_TILES);
|
||||||
ZeroMemory(IPPU.TileCached[TILE_4BIT_EVEN], MAX_4BIT_TILES);
|
ZeroMemory(IPPU.TileCached[TILE_4BIT_EVEN], MAX_4BIT_TILES);
|
||||||
ZeroMemory(IPPU.TileCached[TILE_4BIT_ODD], MAX_4BIT_TILES);
|
ZeroMemory(IPPU.TileCached[TILE_4BIT_ODD], MAX_4BIT_TILES);
|
||||||
#ifdef CORRECT_VRAM_READS
|
|
||||||
IPPU.VRAMReadBuffer = 0; // XXX: FIXME: anything better?
|
IPPU.VRAMReadBuffer = 0; // XXX: FIXME: anything better?
|
||||||
#else
|
|
||||||
IPPU.FirstVRAMRead = FALSE;
|
|
||||||
#endif
|
|
||||||
IPPU.Interlace = FALSE;
|
IPPU.Interlace = FALSE;
|
||||||
IPPU.InterlaceOBJ = FALSE;
|
IPPU.InterlaceOBJ = FALSE;
|
||||||
IPPU.DoubleWidthPixels = FALSE;
|
IPPU.DoubleWidthPixels = FALSE;
|
||||||
|
|
4
ppu.h
4
ppu.h
|
@ -213,11 +213,7 @@ struct InternalPPU
|
||||||
bool8 DirectColourMapsNeedRebuild;
|
bool8 DirectColourMapsNeedRebuild;
|
||||||
uint8 *TileCache[7];
|
uint8 *TileCache[7];
|
||||||
uint8 *TileCached[7];
|
uint8 *TileCached[7];
|
||||||
#ifdef CORRECT_VRAM_READS
|
|
||||||
uint16 VRAMReadBuffer;
|
uint16 VRAMReadBuffer;
|
||||||
#else
|
|
||||||
bool8 FirstVRAMRead;
|
|
||||||
#endif
|
|
||||||
bool8 Interlace;
|
bool8 Interlace;
|
||||||
bool8 InterlaceOBJ;
|
bool8 InterlaceOBJ;
|
||||||
bool8 PseudoHires;
|
bool8 PseudoHires;
|
||||||
|
|
79
snapshot.cpp
79
snapshot.cpp
|
@ -342,7 +342,7 @@ struct SnapshotScreenshotInfo
|
||||||
|
|
||||||
static struct Obsolete
|
static struct Obsolete
|
||||||
{
|
{
|
||||||
uint8 reserved;
|
uint8 CPU_IRQActive;
|
||||||
} Obsolete;
|
} Obsolete;
|
||||||
|
|
||||||
#define STRUCT struct SCPUState
|
#define STRUCT struct SCPUState
|
||||||
|
@ -353,7 +353,7 @@ static FreezeData SnapCPU[] =
|
||||||
INT_ENTRY(6, PrevCycles),
|
INT_ENTRY(6, PrevCycles),
|
||||||
INT_ENTRY(6, V_Counter),
|
INT_ENTRY(6, V_Counter),
|
||||||
INT_ENTRY(6, Flags),
|
INT_ENTRY(6, Flags),
|
||||||
// INT_ENTRY(6, IRQActive),
|
OBSOLETE_INT_ENTRY(6, 7, CPU_IRQActive),
|
||||||
INT_ENTRY(6, IRQPending),
|
INT_ENTRY(6, IRQPending),
|
||||||
INT_ENTRY(6, MemSpeed),
|
INT_ENTRY(6, MemSpeed),
|
||||||
INT_ENTRY(6, MemSpeedx2),
|
INT_ENTRY(6, MemSpeedx2),
|
||||||
|
@ -366,9 +366,14 @@ static FreezeData SnapCPU[] =
|
||||||
INT_ENTRY(6, WhichEvent),
|
INT_ENTRY(6, WhichEvent),
|
||||||
INT_ENTRY(6, NextEvent),
|
INT_ENTRY(6, NextEvent),
|
||||||
INT_ENTRY(6, WaitingForInterrupt),
|
INT_ENTRY(6, WaitingForInterrupt),
|
||||||
// INT_ENTRY(6, WaitAddress),
|
DELETED_INT_ENTRY(6, 7, WaitAddress, 4),
|
||||||
// INT_ENTRY(6, WaitCounter),
|
DELETED_INT_ENTRY(6, 7, WaitCounter, 4),
|
||||||
// INT_ENTRY(6, PBPCAtOpcodeStart)
|
DELETED_INT_ENTRY(6, 7, PBPCAtOpcodeStart, 4),
|
||||||
|
INT_ENTRY(7, NMILine),
|
||||||
|
INT_ENTRY(7, IRQLine),
|
||||||
|
INT_ENTRY(7, IRQTransition),
|
||||||
|
INT_ENTRY(7, IRQLastState),
|
||||||
|
INT_ENTRY(7, IRQExternal)
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
|
@ -576,7 +581,9 @@ static FreezeData SnapTimings[] =
|
||||||
INT_ENTRY(6, DMACPUSync),
|
INT_ENTRY(6, DMACPUSync),
|
||||||
INT_ENTRY(6, NMIDMADelay),
|
INT_ENTRY(6, NMIDMADelay),
|
||||||
INT_ENTRY(6, IRQPendCount),
|
INT_ENTRY(6, IRQPendCount),
|
||||||
INT_ENTRY(6, APUSpeedup)
|
INT_ENTRY(6, APUSpeedup),
|
||||||
|
INT_ENTRY(7, IRQTriggerCycles),
|
||||||
|
INT_ENTRY(7, APUAllowTimeOverflow)
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef ZSNES_FX
|
#ifndef ZSNES_FX
|
||||||
|
@ -649,17 +656,17 @@ static FreezeData SnapFX[] =
|
||||||
|
|
||||||
static FreezeData SnapSA1[] =
|
static FreezeData SnapSA1[] =
|
||||||
{
|
{
|
||||||
// INT_ENTRY(6, CPUExecuting),
|
DELETED_INT_ENTRY(6, 7, CPUExecuting, 1),
|
||||||
INT_ENTRY(6, ShiftedPB),
|
INT_ENTRY(6, ShiftedPB),
|
||||||
INT_ENTRY(6, ShiftedDB),
|
INT_ENTRY(6, ShiftedDB),
|
||||||
INT_ENTRY(6, Flags),
|
INT_ENTRY(6, Flags),
|
||||||
// INT_ENTRY(6, IRQActive),
|
DELETED_INT_ENTRY(6, 7, IRQActive, 1),
|
||||||
// INT_ENTRY(6, Waiting),
|
DELETED_INT_ENTRY(6, 7, Waiting, 1),
|
||||||
INT_ENTRY(6, WaitingForInterrupt),
|
INT_ENTRY(6, WaitingForInterrupt),
|
||||||
// INT_ENTRY(6, WaitAddress),
|
DELETED_INT_ENTRY(6, 7, WaitAddress, 4),
|
||||||
// INT_ENTRY(6, WaitCounter),
|
DELETED_INT_ENTRY(6, 7, WaitCounter, 4),
|
||||||
// INT_ENTRY(6, PBPCAtOpcodeStart),
|
DELETED_INT_ENTRY(6, 7, PBPCAtOpcodeStart, 4),
|
||||||
// INT_ENTRY(6, Executing),
|
DELETED_INT_ENTRY(6, 7, Executing, 1),
|
||||||
INT_ENTRY(6, overflow),
|
INT_ENTRY(6, overflow),
|
||||||
INT_ENTRY(6, in_char_dma),
|
INT_ENTRY(6, in_char_dma),
|
||||||
INT_ENTRY(6, op1),
|
INT_ENTRY(6, op1),
|
||||||
|
@ -667,7 +674,17 @@ static FreezeData SnapSA1[] =
|
||||||
INT_ENTRY(6, arithmetic_op),
|
INT_ENTRY(6, arithmetic_op),
|
||||||
INT_ENTRY(6, sum),
|
INT_ENTRY(6, sum),
|
||||||
INT_ENTRY(6, VirtualBitmapFormat),
|
INT_ENTRY(6, VirtualBitmapFormat),
|
||||||
INT_ENTRY(6, variable_bit_pos)
|
INT_ENTRY(6, variable_bit_pos),
|
||||||
|
INT_ENTRY(7, Cycles),
|
||||||
|
INT_ENTRY(7, PrevCycles),
|
||||||
|
INT_ENTRY(7, TimerIRQLastState),
|
||||||
|
INT_ENTRY(7, HTimerIRQPos),
|
||||||
|
INT_ENTRY(7, VTimerIRQPos),
|
||||||
|
INT_ENTRY(7, HCounter),
|
||||||
|
INT_ENTRY(7, VCounter),
|
||||||
|
INT_ENTRY(7, PrevHCounter),
|
||||||
|
INT_ENTRY(7, MemSpeed),
|
||||||
|
INT_ENTRY(7, MemSpeedx2)
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
|
@ -1686,6 +1703,40 @@ int S9xUnfreezeFromStream (STREAM stream)
|
||||||
if (local_bsx_data)
|
if (local_bsx_data)
|
||||||
UnfreezeStructFromCopy(&BSX, SnapBSX, COUNT(SnapBSX), local_bsx_data, version);
|
UnfreezeStructFromCopy(&BSX, SnapBSX, COUNT(SnapBSX), local_bsx_data, version);
|
||||||
|
|
||||||
|
if (version < SNAPSHOT_VERSION)
|
||||||
|
{
|
||||||
|
printf("Converting old snapshot version %d to %d\n...", version, SNAPSHOT_VERSION);
|
||||||
|
|
||||||
|
CPU.NMILine = (CPU.Flags & (1 << 7)) ? TRUE : FALSE;
|
||||||
|
CPU.IRQLine = (CPU.Flags & (1 << 11)) ? TRUE : FALSE;
|
||||||
|
CPU.IRQTransition = FALSE;
|
||||||
|
CPU.IRQLastState = FALSE;
|
||||||
|
CPU.IRQExternal = (Obsolete.CPU_IRQActive & ~(1 << 1)) ? TRUE : FALSE;
|
||||||
|
|
||||||
|
switch (CPU.WhichEvent)
|
||||||
|
{
|
||||||
|
case 12: case 1: CPU.WhichEvent = 1; break;
|
||||||
|
case 2: case 3: CPU.WhichEvent = 2; break;
|
||||||
|
case 4: case 5: CPU.WhichEvent = 3; break;
|
||||||
|
case 6: case 7: CPU.WhichEvent = 4; break;
|
||||||
|
case 8: case 9: CPU.WhichEvent = 5; break;
|
||||||
|
case 10: case 11: CPU.WhichEvent = 6; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (local_sa1) // FIXME
|
||||||
|
{
|
||||||
|
SA1.Cycles = SA1.PrevCycles = 0;
|
||||||
|
SA1.TimerIRQLastState = FALSE;
|
||||||
|
SA1.HTimerIRQPos = Memory.FillRAM[0x2212] | (Memory.FillRAM[0x2213] << 8);
|
||||||
|
SA1.VTimerIRQPos = Memory.FillRAM[0x2214] | (Memory.FillRAM[0x2215] << 8);
|
||||||
|
SA1.HCounter = 0;
|
||||||
|
SA1.VCounter = 0;
|
||||||
|
SA1.PrevHCounter = 0;
|
||||||
|
SA1.MemSpeed = SLOW_ONE_CYCLE;
|
||||||
|
SA1.MemSpeedx2 = SLOW_ONE_CYCLE * 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CPU.Flags |= old_flags & (DEBUG_MODE_FLAG | TRACE_FLAG | SINGLE_STEP_FLAG | FRAME_ADVANCE_FLAG);
|
CPU.Flags |= old_flags & (DEBUG_MODE_FLAG | TRACE_FLAG | SINGLE_STEP_FLAG | FRAME_ADVANCE_FLAG);
|
||||||
ICPU.ShiftedPB = Registers.PB << 16;
|
ICPU.ShiftedPB = Registers.PB << 16;
|
||||||
ICPU.ShiftedDB = Registers.DB << 16;
|
ICPU.ShiftedDB = Registers.DB << 16;
|
||||||
|
|
|
@ -179,7 +179,7 @@
|
||||||
#define _SNAPSHOT_H_
|
#define _SNAPSHOT_H_
|
||||||
|
|
||||||
#define SNAPSHOT_MAGIC "#!s9xsnp"
|
#define SNAPSHOT_MAGIC "#!s9xsnp"
|
||||||
#define SNAPSHOT_VERSION 6
|
#define SNAPSHOT_VERSION 7
|
||||||
|
|
||||||
#define SUCCESS 1
|
#define SUCCESS 1
|
||||||
#define WRONG_FORMAT (-1)
|
#define WRONG_FORMAT (-1)
|
||||||
|
|
10
snes9x.cpp
10
snes9x.cpp
|
@ -466,8 +466,6 @@ void S9xLoadConfigFiles (char **argv, int argc)
|
||||||
|
|
||||||
Settings.DisableGameSpecificHacks = !conf.GetBool("Hack::EnableGameSpecificHacks", true);
|
Settings.DisableGameSpecificHacks = !conf.GetBool("Hack::EnableGameSpecificHacks", true);
|
||||||
Settings.BlockInvalidVRAMAccessMaster = !conf.GetBool("Hack::AllowInvalidVRAMAccess", false);
|
Settings.BlockInvalidVRAMAccessMaster = !conf.GetBool("Hack::AllowInvalidVRAMAccess", false);
|
||||||
Settings.DisableIRQ = conf.GetBool("Hack::DisableIRQ", false);
|
|
||||||
Settings.DisableHDMA = conf.GetBool("Hack::DisableHDMA", false);
|
|
||||||
Settings.HDMATimingHack = conf.GetInt ("Hack::HDMATiming", 100);
|
Settings.HDMATimingHack = conf.GetInt ("Hack::HDMATiming", 100);
|
||||||
|
|
||||||
// Netplay
|
// Netplay
|
||||||
|
@ -585,8 +583,6 @@ void S9xUsage (void)
|
||||||
S9xMessage(S9X_INFO, S9X_USAGE, "-debug Set the Debugger flag");
|
S9xMessage(S9X_INFO, S9X_USAGE, "-debug Set the Debugger flag");
|
||||||
S9xMessage(S9X_INFO, S9X_USAGE, "-trace Begin CPU instruction tracing");
|
S9xMessage(S9X_INFO, S9X_USAGE, "-trace Begin CPU instruction tracing");
|
||||||
#endif
|
#endif
|
||||||
S9xMessage(S9X_INFO, S9X_USAGE, "-noirq (Not recommended) Disable IRQ emulation");
|
|
||||||
S9xMessage(S9X_INFO, S9X_USAGE, "-nohdma (Not recommended) Disable HDMA emulation");
|
|
||||||
S9xMessage(S9X_INFO, S9X_USAGE, "-hdmatiming <1-199> (Not recommended) Changes HDMA transfer timings");
|
S9xMessage(S9X_INFO, S9X_USAGE, "-hdmatiming <1-199> (Not recommended) Changes HDMA transfer timings");
|
||||||
S9xMessage(S9X_INFO, S9X_USAGE, " event comes");
|
S9xMessage(S9X_INFO, S9X_USAGE, " event comes");
|
||||||
S9xMessage(S9X_INFO, S9X_USAGE, "-invalidvramaccess (Not recommended) Allow invalid VRAM access");
|
S9xMessage(S9X_INFO, S9X_USAGE, "-invalidvramaccess (Not recommended) Allow invalid VRAM access");
|
||||||
|
@ -850,12 +846,6 @@ char * S9xParseArgs (char **argv, int argc)
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!strcasecmp(argv[i], "-noirq"))
|
|
||||||
Settings.DisableIRQ = TRUE;
|
|
||||||
else
|
|
||||||
if (!strcasecmp(argv[i], "-nohdma"))
|
|
||||||
Settings.DisableHDMA = TRUE;
|
|
||||||
else
|
|
||||||
if (!strcasecmp(argv[i], "-hdmatiming"))
|
if (!strcasecmp(argv[i], "-hdmatiming"))
|
||||||
{
|
{
|
||||||
if (i + 1 < argc)
|
if (i + 1 < argc)
|
||||||
|
|
2
snes9x.h
2
snes9x.h
|
@ -399,8 +399,6 @@ struct SSettings
|
||||||
bool8 DisableGameSpecificHacks;
|
bool8 DisableGameSpecificHacks;
|
||||||
bool8 BlockInvalidVRAMAccessMaster;
|
bool8 BlockInvalidVRAMAccessMaster;
|
||||||
bool8 BlockInvalidVRAMAccess;
|
bool8 BlockInvalidVRAMAccess;
|
||||||
bool8 DisableIRQ;
|
|
||||||
bool8 DisableHDMA;
|
|
||||||
int32 HDMATimingHack;
|
int32 HDMATimingHack;
|
||||||
|
|
||||||
bool8 ForcedPause;
|
bool8 ForcedPause;
|
||||||
|
|
|
@ -10,7 +10,7 @@ OS = `uname -s -r -m|sed \"s/ /-/g\"|tr \"[A-Z]\" \"[a-z]\"|tr \"/()\" \
|
||||||
BUILDDIR = .
|
BUILDDIR = .
|
||||||
|
|
||||||
OBJECTS = ../apu/apu.o ../apu/SNES_SPC.o ../apu/SNES_SPC_misc.o ../apu/SNES_SPC_state.o ../apu/SPC_DSP.o ../apu/SPC_Filter.o ../bsx.o ../cheats.o ../cheats2.o ../clip.o ../conffile.o ../controls.o ../cpu.o ../cpuexec.o ../cpuops.o ../crosshairs.o ../dma.o ../dsp.o ../dsp1.o ../dsp2.o ../dsp3.o ../dsp4.o ../gfx.o ../globals.o ../logger.o ../memmap.o ../movie.o ../obc1.o ../ppu.o ../reader.o ../sa1.o ../sa1cpu.o ../screenshot.o ../sdd1.o ../sdd1emu.o ../seta.o ../seta010.o ../seta011.o ../seta018.o ../snapshot.o ../snes9x.o ../spc7110.o ../srtc.o ../tile.o ../filter/2xsai.o ../filter/blit.o ../filter/epx.o ../filter/hq2x.o ../filter/snes_ntsc.o unix.o x11.o
|
OBJECTS = ../apu/apu.o ../apu/SNES_SPC.o ../apu/SNES_SPC_misc.o ../apu/SNES_SPC_state.o ../apu/SPC_DSP.o ../apu/SPC_Filter.o ../bsx.o ../cheats.o ../cheats2.o ../clip.o ../conffile.o ../controls.o ../cpu.o ../cpuexec.o ../cpuops.o ../crosshairs.o ../dma.o ../dsp.o ../dsp1.o ../dsp2.o ../dsp3.o ../dsp4.o ../gfx.o ../globals.o ../logger.o ../memmap.o ../movie.o ../obc1.o ../ppu.o ../reader.o ../sa1.o ../sa1cpu.o ../screenshot.o ../sdd1.o ../sdd1emu.o ../seta.o ../seta010.o ../seta011.o ../seta018.o ../snapshot.o ../snes9x.o ../spc7110.o ../srtc.o ../tile.o ../filter/2xsai.o ../filter/blit.o ../filter/epx.o ../filter/hq2x.o ../filter/snes_ntsc.o unix.o x11.o
|
||||||
DEFS = -DMITSHM -DCPU_SHUTDOWN -DSPC700_SHUTDOWN -DCORRECT_VRAM_READS
|
DEFS = -DMITSHM
|
||||||
|
|
||||||
ifdef S9XZSNESFX
|
ifdef S9XZSNESFX
|
||||||
OBJECTS += ../i386/fxemu2.o ../i386/fxemu2b.o ../i386/fxemu2c.o ../i386/fxtable.o ../i386/sfxproc.o ../i386/zsnes.o
|
OBJECTS += ../i386/fxemu2.o ../i386/fxemu2b.o ../i386/fxemu2c.o ../i386/fxtable.o ../i386/sfxproc.o ../i386/zsnes.o
|
||||||
|
|
|
@ -451,7 +451,6 @@ const char * S9xParseDisplayConfig (ConfigFile &conf, int pass)
|
||||||
keymaps.push_back(strpair_t("K00:3", "ToggleBG2"));
|
keymaps.push_back(strpair_t("K00:3", "ToggleBG2"));
|
||||||
keymaps.push_back(strpair_t("K00:4", "ToggleBG3"));
|
keymaps.push_back(strpair_t("K00:4", "ToggleBG3"));
|
||||||
keymaps.push_back(strpair_t("K00:5", "ToggleSprites"));
|
keymaps.push_back(strpair_t("K00:5", "ToggleSprites"));
|
||||||
keymaps.push_back(strpair_t("K00:0", "ToggleHDMA"));
|
|
||||||
keymaps.push_back(strpair_t("K00:9", "ToggleTransparency"));
|
keymaps.push_back(strpair_t("K00:9", "ToggleTransparency"));
|
||||||
keymaps.push_back(strpair_t("K00:BackSpace", "ClipWindows"));
|
keymaps.push_back(strpair_t("K00:BackSpace", "ClipWindows"));
|
||||||
keymaps.push_back(strpair_t("K00:A+Escape", "Debugger"));
|
keymaps.push_back(strpair_t("K00:A+Escape", "Debugger"));
|
||||||
|
|
Loading…
Reference in New Issue