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

View File

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

View File

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

View File

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