Added SA-1 NMI and fixed its override mode. (zones)

This commit is contained in:
dborth 2010-11-02 19:14:13 +00:00
parent 63e1f9c391
commit df7be8626c
4 changed files with 6064 additions and 6052 deletions

View File

@ -400,7 +400,7 @@ void S9xDoHEventProcessing (void)
if (PPU.HDMA && CPU.V_Counter <= PPU.ScreenHeight) if (PPU.HDMA && CPU.V_Counter <= PPU.ScreenHeight)
{ {
#ifdef DEBUGGER #ifdef DEBUGGER
S9xTraceFormattedMessage("*** HDMA HC:%04d, Channel:%02x", CPU.Cycles, PPU.HDMA); S9xTraceFormattedMessage("*** HDMA Transfer HC:%04d, Channel:%02x", CPU.Cycles, PPU.HDMA);
#endif #endif
PPU.HDMA = S9xDoHDMA(PPU.HDMA); PPU.HDMA = S9xDoHDMA(PPU.HDMA);
} }
@ -595,3 +595,4 @@ void S9xDoHEventProcessing (void)
eventname[CPU.WhichEvent], CPU.NextEvent, CPU.Cycles); eventname[CPU.WhichEvent], CPU.NextEvent, CPU.Cycles);
#endif #endif
} }

View File

@ -2857,8 +2857,12 @@ void S9xOpcode_IRQ (void)
{ {
#ifdef DEBUGGER #ifdef DEBUGGER
if (CPU.Flags & TRACE_FLAG) if (CPU.Flags & TRACE_FLAG)
#ifdef SA1_OPCODES
S9xTraceMessage("*** SA1 IRQ");
#else
S9xTraceMessage("*** IRQ"); S9xTraceMessage("*** IRQ");
#endif #endif
#endif
// IRQ and NMI do an opcode fetch as their first "IO" cycle. // IRQ and NMI do an opcode fetch as their first "IO" cycle.
AddCycles(CPU.MemSpeed + ONE_CYCLE); AddCycles(CPU.MemSpeed + ONE_CYCLE);
@ -2928,8 +2932,12 @@ void S9xOpcode_NMI (void)
{ {
#ifdef DEBUGGER #ifdef DEBUGGER
if (CPU.Flags & TRACE_FLAG) if (CPU.Flags & TRACE_FLAG)
#ifdef SA1_OPCODES
S9xTraceMessage("*** SA1 NMI");
#else
S9xTraceMessage("*** NMI"); S9xTraceMessage("*** NMI");
#endif #endif
#endif
// IRQ and NMI do an opcode fetch as their first "IO" cycle. // IRQ and NMI do an opcode fetch as their first "IO" cycle.
AddCycles(CPU.MemSpeed + ONE_CYCLE); AddCycles(CPU.MemSpeed + ONE_CYCLE);
@ -2949,7 +2957,7 @@ void S9xOpcode_NMI (void)
AddCycles(2 * SLOW_ONE_CYCLE); AddCycles(2 * SLOW_ONE_CYCLE);
S9xSA1SetPCBase(Memory.FillRAM[0x2205] | (Memory.FillRAM[0x2206] << 8)); S9xSA1SetPCBase(Memory.FillRAM[0x2205] | (Memory.FillRAM[0x2206] << 8));
#else #else
if (Settings.SA1 && (Memory.FillRAM[0x2209] & 0x20)) if (Settings.SA1 && (Memory.FillRAM[0x2209] & 0x10))
{ {
OpenBus = Memory.FillRAM[0x220d]; OpenBus = Memory.FillRAM[0x220d];
AddCycles(2 * SLOW_ONE_CYCLE); AddCycles(2 * SLOW_ONE_CYCLE);
@ -4016,3 +4024,4 @@ struct SOpcodes S9xOpcodesSlow[256] =
{ OpFASlow }, { OpFB }, { OpFCSlow }, { OpFDSlow }, { OpFESlow }, { OpFASlow }, { OpFB }, { OpFCSlow }, { OpFDSlow }, { OpFESlow },
{ OpFFSlow } { OpFFSlow }
}; };

View File

@ -361,7 +361,7 @@ uint8 S9xGetSA1 (uint32 address)
} }
default: default:
printf("R: %04x\n", address); //printf("R: %04x\n", address);
break; break;
} }
@ -393,12 +393,10 @@ void S9xSetSA1 (uint8 byte, uint32 address)
if (byte & 0x10) if (byte & 0x10)
{ {
Memory.FillRAM[0x2301] |= 0x10; Memory.FillRAM[0x2301] |= 0x10;
#ifdef DEBUGGER
printf("###SA1 NMI\n");
#endif
if (Memory.FillRAM[0x220a] & 0x10) if (Memory.FillRAM[0x220a] & 0x10)
{ {
// SA1.Flags |= NMI_FLAG;
SA1.Executing = !SA1.Waiting && SA1.S9xOpcodes;
} }
} }
@ -487,9 +485,8 @@ void S9xSetSA1 (uint8 byte, uint32 address)
if (((byte ^ Memory.FillRAM[0x220a]) & 0x10) && (Memory.FillRAM[0x2301] & byte & 0x10)) if (((byte ^ Memory.FillRAM[0x220a]) & 0x10) && (Memory.FillRAM[0x2301] & byte & 0x10))
{ {
#ifdef DEBUGGER SA1.Flags |= NMI_FLAG;
printf("###SA1 NMI\n"); //SA1.Executing = !SA1.Waiting;
#endif
} }
break; break;
@ -513,7 +510,7 @@ void S9xSetSA1 (uint8 byte, uint32 address)
Memory.FillRAM[0x2301] &= ~0x20; Memory.FillRAM[0x2301] &= ~0x20;
} }
if (byte & 0x10) // Clear NMI if (byte & 0x10)
Memory.FillRAM[0x2301] &= ~0x10; Memory.FillRAM[0x2301] &= ~0x10;
if (!SA1.IRQActive) if (!SA1.IRQActive)
@ -1136,3 +1133,4 @@ void S9xSA1SetPCBase (uint32 address)
return; return;
} }
} }

View File

@ -229,10 +229,13 @@
void S9xSA1MainLoop (void) void S9xSA1MainLoop (void)
{ {
#if 0
if (SA1.Flags & NMI_FLAG) if (SA1.Flags & NMI_FLAG)
{
if (Memory.FillRAM[0x2200] & 0x10)
{ {
SA1.Flags &= ~NMI_FLAG; SA1.Flags &= ~NMI_FLAG;
Memory.FillRAM[0x2301] |= 0x10;
if (SA1.WaitingForInterrupt) if (SA1.WaitingForInterrupt)
{ {
SA1.WaitingForInterrupt = FALSE; SA1.WaitingForInterrupt = FALSE;
@ -241,7 +244,7 @@ void S9xSA1MainLoop (void)
S9xSA1Opcode_NMI(); S9xSA1Opcode_NMI();
} }
#endif }
if (SA1.Flags & IRQ_FLAG) if (SA1.Flags & IRQ_FLAG)
{ {
@ -297,3 +300,4 @@ void S9xSA1MainLoop (void)
(*Opcodes[Op].S9xOpcode)(); (*Opcodes[Op].S9xOpcode)();
} }
} }