aboutsummaryrefslogtreecommitdiff
path: root/source/sa1.c
diff options
context:
space:
mode:
authorJoão Silva2017-01-14 23:08:50 +0000
committerJoão Silva2017-01-14 23:08:50 +0000
commit3b8323853f4eeddb61398e77c51bb2349f430227 (patch)
tree55cb980be4bf5bf93041392470637d78c73b4854 /source/sa1.c
parentd59c856fbf576daa91fa4a8bade38d97b4edbbe4 (diff)
downloadsnes9x2005-3b8323853f4eeddb61398e77c51bb2349f430227.tar.gz
snes9x2005-3b8323853f4eeddb61398e77c51bb2349f430227.tar.bz2
snes9x2005-3b8323853f4eeddb61398e77c51bb2349f430227.zip
Removed a LOT of useless stuff.
Diffstat (limited to 'source/sa1.c')
-rw-r--r--source/sa1.c113
1 files changed, 2 insertions, 111 deletions
diff --git a/source/sa1.c b/source/sa1.c
index 2644606..18540fb 100644
--- a/source/sa1.c
+++ b/source/sa1.c
@@ -262,20 +262,6 @@ void S9xSA1SetPCBase(uint32_t address)
}
}
-void S9xSA1ExecuteDuringSleep()
-{
-#if 0
- if (SA1.Executing)
- {
- while (CPU.Cycles < CPU.NextEvent)
- {
- S9xSA1MainLoop();
- CPU.Cycles += TWO_CYCLES * 2;
- }
- }
-#endif
-}
-
void S9xSetSA1MemMap(uint32_t which1, uint8_t map)
{
int c;
@@ -306,7 +292,6 @@ void S9xSetSA1MemMap(uint32_t which1, uint8_t map)
uint8_t S9xGetSA1(uint32_t address)
{
- // printf ("R: %04x\n", address);
switch (address)
{
case 0x2300:
@@ -344,12 +329,10 @@ uint8_t S9xGetSA1(uint32_t address)
void S9xSetSA1(uint8_t byte, uint32_t address)
{
- //printf ("W: %02x -> %04x\n", byte, address);
switch (address)
{
case 0x2200:
SA1.Waiting = (byte & 0x60) != 0;
- // SA1.Executing = !SA1.Waiting && SA1.S9xOpcodes;
if (!(byte & 0x20) && (Memory.FillRAM [0x2200] & 0x20))
S9xSA1Reset();
@@ -366,9 +349,6 @@ void S9xSetSA1(uint8_t byte, uint32_t address)
if (byte & 0x10)
{
Memory.FillRAM [0x2301] |= 0x10;
- if (Memory.FillRAM [0x220a] & 0x10)
- {
- }
}
break;
@@ -392,25 +372,13 @@ void S9xSetSA1(uint8_t byte, uint32_t address)
S9xClearIRQ(SA1_DMA_IRQ_SOURCE);
}
break;
+
case 0x2203:
- // printf ("SA1 reset vector: %04x\n", byte | (Memory.FillRAM [0x2204] << 8));
- break;
case 0x2204:
- // printf ("SA1 reset vector: %04x\n", (byte << 8) | Memory.FillRAM [0x2203]);
- break;
-
case 0x2205:
- // printf ("SA1 NMI vector: %04x\n", byte | (Memory.FillRAM [0x2206] << 8));
- break;
case 0x2206:
- // printf ("SA1 NMI vector: %04x\n", (byte << 8) | Memory.FillRAM [0x2205]);
- break;
-
case 0x2207:
- // printf ("SA1 IRQ vector: %04x\n", byte | (Memory.FillRAM [0x2208] << 8));
- break;
case 0x2208:
- // printf ("SA1 IRQ vector: %04x\n", (byte << 8) | Memory.FillRAM [0x2207]);
break;
case 0x2209:
@@ -427,28 +395,18 @@ void S9xSetSA1(uint8_t byte, uint32_t address)
{
SA1.Flags |= IRQ_PENDING_FLAG;
SA1.IRQActive |= SNES_IRQ_SOURCE;
- // SA1.Executing = !SA1.Waiting;
}
if (((byte ^ Memory.FillRAM [0x220a]) & 0x40) &&
(Memory.FillRAM [0x2301] & byte & 0x40))
{
SA1.Flags |= IRQ_PENDING_FLAG;
SA1.IRQActive |= TIMER_IRQ_SOURCE;
- // SA1.Executing = !SA1.Waiting;
}
if (((byte ^ Memory.FillRAM [0x220a]) & 0x20) &&
(Memory.FillRAM [0x2301] & byte & 0x20))
{
SA1.Flags |= IRQ_PENDING_FLAG;
SA1.IRQActive |= DMA_IRQ_SOURCE;
- // SA1.Executing = !SA1.Waiting;
- }
- if (((byte ^ Memory.FillRAM [0x220a]) & 0x10) &&
- (Memory.FillRAM [0x2301] & byte & 0x10))
- {
-#if 0
- printf("###SA1 NMI\n");
-#endif
}
break;
case 0x220b:
@@ -476,26 +434,12 @@ void S9xSetSA1(uint8_t byte, uint32_t address)
SA1.Flags &= ~IRQ_PENDING_FLAG;
break;
case 0x220c:
- // printf ("SNES NMI vector: %04x\n", byte | (Memory.FillRAM [0x220d] << 8));
- break;
case 0x220d:
- // printf ("SNES NMI vector: %04x\n", (byte << 8) | Memory.FillRAM [0x220c]);
- break;
-
case 0x220e:
- // printf ("SNES IRQ vector: %04x\n", byte | (Memory.FillRAM [0x220f] << 8));
- break;
case 0x220f:
- // printf ("SNES IRQ vector: %04x\n", (byte << 8) | Memory.FillRAM [0x220e]);
- break;
-
case 0x2210:
-#if 0
- printf("Timer %s\n", (byte & 0x80) ? "linear" : "HV");
- printf("Timer H-IRQ %s\n", (byte & 1) ? "enabled" : "disabled");
- printf("Timer V-IRQ %s\n", (byte & 2) ? "enabled" : "disabled");
-#endif
break;
+
case 0x2211:
printf("Timer reset\n");
break;
@@ -516,62 +460,28 @@ void S9xSetSA1(uint8_t byte, uint32_t address)
case 0x2222:
case 0x2223:
S9xSetSA1MemMap(address - 0x2220, byte);
- // printf ("MMC: %02x\n", byte);
break;
case 0x2224:
- // printf ("BWRAM image SNES %02x -> 0x6000\n", byte);
Memory.BWRAM = Memory.SRAM + (byte & 7) * 0x2000;
break;
case 0x2225:
- // printf ("BWRAM image SA1 %02x -> 0x6000 (%02x)\n", byte, Memory.FillRAM [address]);
if (byte != Memory.FillRAM [address])
S9xSA1SetBWRAMMemMap(byte);
break;
case 0x2226:
- // printf ("BW-RAM SNES write %s\n", (byte & 0x80) ? "enabled" : "disabled");
- break;
case 0x2227:
- // printf ("BW-RAM SA1 write %s\n", (byte & 0x80) ? "enabled" : "disabled");
- break;
-
case 0x2228:
- // printf ("BW-RAM write protect area %02x\n", byte);
- break;
case 0x2229:
- // printf ("I-RAM SNES write protect area %02x\n", byte);
- break;
case 0x222a:
- // printf ("I-RAM SA1 write protect area %02x\n", byte);
- break;
case 0x2230:
-#if 0
- printf("SA1 DMA %s\n", (byte & 0x80) ? "enabled" : "disabled");
- printf("DMA priority %s\n", (byte & 0x40) ? "DMA" : "SA1");
- printf("DMA %s\n", (byte & 0x20) ? "char conv" : "normal");
- printf("DMA type %s\n", (byte & 0x10) ? "BW-RAM -> I-RAM" : "SA1 -> I-RAM");
- printf("DMA distination %s\n", (byte & 4) ? "BW-RAM" : "I-RAM");
- printf("DMA source %s\n", DMAsource [byte & 3]);
-#endif
break;
case 0x2231:
if (byte & 0x80)
SA1.in_char_dma = false;
-#if 0
- printf("CHDEND %s\n", (byte & 0x80) ? "complete" : "incomplete");
- printf("DMA colour mode %d\n", byte & 3);
- printf("virtual VRAM width %d\n", (byte >> 2) & 7);
-#endif
break;
case 0x2232:
case 0x2233:
case 0x2234:
- Memory.FillRAM [address] = byte;
-#if 0
- printf("DMA source start %06x\n",
- Memory.FillRAM [0x2232] | (Memory.FillRAM [0x2233] << 8) |
- (Memory.FillRAM [0x2234] << 16));
-#endif
- break;
case 0x2235:
Memory.FillRAM [address] = byte;
break;
@@ -597,23 +507,13 @@ void S9xSetSA1(uint8_t byte, uint32_t address)
// Normal DMA to BW-RAM
S9xSA1DMA();
}
-#if 0
- printf("DMA dest address %06x\n",
- Memory.FillRAM [0x2235] | (Memory.FillRAM [0x2236] << 8) |
- (Memory.FillRAM [0x2237] << 16));
-#endif
break;
case 0x2238:
case 0x2239:
Memory.FillRAM [address] = byte;
-#if 0
- printf("DMA length %04x\n",
- Memory.FillRAM [0x2238] | (Memory.FillRAM [0x2239] << 8));
-#endif
break;
case 0x223f:
SA1.VirtualBitmapFormat = (byte & 0x80) ? 2 : 4;
- //printf ("virtual VRAM depth %d\n", (byte & 0x80) ? 2 : 4);
break;
case 0x2240:
@@ -631,13 +531,6 @@ void S9xSetSA1(uint8_t byte, uint32_t address)
case 0x224c:
case 0x224d:
case 0x224e:
-#if 0
- if (!(SA1.Flags & TRACE_FLAG))
- {
- TraceSA1();
- Trace();
- }
-#endif
Memory.FillRAM [address] = byte;
break;
@@ -706,7 +599,6 @@ void S9xSetSA1(uint8_t byte, uint32_t address)
S9xSA1ReadVariableLengthData(false, true);
return;
default:
- // printf ("W: %02x->%04x\n", byte, address);
break;
}
if (address >= 0x2200 && address <= 0x22ff)
@@ -807,7 +699,6 @@ static void S9xSA1DMA()
{
SA1.Flags |= IRQ_PENDING_FLAG;
SA1.IRQActive |= DMA_IRQ_SOURCE;
- // SA1.Executing = !SA1.Waiting;
}
}