aboutsummaryrefslogtreecommitdiff
path: root/source
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
parentd59c856fbf576daa91fa4a8bade38d97b4edbbe4 (diff)
downloadsnesemu-3b8323853f4eeddb61398e77c51bb2349f430227.tar.gz
snesemu-3b8323853f4eeddb61398e77c51bb2349f430227.tar.bz2
snesemu-3b8323853f4eeddb61398e77c51bb2349f430227.zip
Removed a LOT of useless stuff.
Diffstat (limited to 'source')
-rw-r--r--source/apu.c17
-rw-r--r--source/apu.h39
-rw-r--r--source/apu_blargg.c16
-rw-r--r--source/apumem.h16
-rw-r--r--source/c4emu.c14
-rw-r--r--source/clip.c1
-rw-r--r--source/cpu.c5
-rw-r--r--source/cpuaddr.h7
-rw-r--r--source/cpuexec.c18
-rw-r--r--source/cpumacro.h8
-rw-r--r--source/cpuops.c198
-rw-r--r--source/dma.c17
-rw-r--r--source/dsp1.c53
-rw-r--r--source/dsp1.h2
-rw-r--r--source/dsp1emu.c14
-rw-r--r--source/dsp2emu.c42
-rw-r--r--source/dsp4emu.c169
-rw-r--r--source/fxemu.c181
-rw-r--r--source/fxemu.h4
-rw-r--r--source/fxinst.c33
-rw-r--r--source/getset.h9
-rw-r--r--source/gfx.c51
-rw-r--r--source/gfx.h4
-rw-r--r--source/memmap.c483
-rw-r--r--source/memmap.h5
-rw-r--r--source/messages.h1
-rw-r--r--source/obc1.h2
-rw-r--r--source/port.h3
-rw-r--r--source/ppu.c80
-rw-r--r--source/sa1.c113
-rw-r--r--source/sa1.h5
-rw-r--r--source/sa1cpu.c13
-rw-r--r--source/sdd1emu.h2
-rw-r--r--source/seta010.c6
-rw-r--r--source/seta011.c19
-rw-r--r--source/seta018.c34
-rw-r--r--source/soundux.c4
-rw-r--r--source/soundux.h1
-rw-r--r--source/spc700.c4
-rw-r--r--source/spc700.h2
-rw-r--r--source/spc7110.c14
41 files changed, 34 insertions, 1675 deletions
diff --git a/source/apu.c b/source/apu.c
index b8b7eae..1ee1013 100644
--- a/source/apu.c
+++ b/source/apu.c
@@ -38,7 +38,6 @@ uint8_t APUROM [64];
void S9xResetAPU()
{
-
int i, j;
Settings.APUEnabled = Settings.NextAPUEnabled;
@@ -186,7 +185,6 @@ void S9xSetAPUDSP(uint8_t byte)
break;
case APU_KOFF:
- // if (byte)
{
int c;
uint8_t mask = 1;
@@ -200,7 +198,6 @@ void S9xSetAPUDSP(uint8_t byte)
KeyOnPrev &= ~mask;
APU.KeyedChannels &= ~mask;
APU.DSP [APU_KON] &= ~mask;
- //APU.DSP [APU_KOFF] |= mask;
S9xSetSoundKeyOff(c);
}
}
@@ -209,14 +206,12 @@ void S9xSetAPUDSP(uint8_t byte)
{
KeyOnPrev &= ~mask;
APU.KeyedChannels |= mask;
- //APU.DSP [APU_KON] |= mask;
APU.DSP [APU_KOFF] &= ~mask;
APU.DSP [APU_ENDX] &= ~mask;
S9xPlaySample(c);
}
}
}
- //KeyOnPrev=0;
APU.DSP [APU_KOFF] = byte;
return;
case APU_KON:
@@ -234,8 +229,6 @@ void S9xSetAPUDSP(uint8_t byte)
{
KeyOnPrev &= ~mask;
APU.KeyedChannels |= mask;
- //APU.DSP [APU_KON] |= mask;
- //APU.DSP [APU_KOFF] &= ~mask;
APU.DSP [APU_ENDX] &= ~mask;
S9xPlaySample(c);
}
@@ -253,8 +246,6 @@ void S9xSetAPUDSP(uint8_t byte)
case APU_VOL_LEFT + 0x50:
case APU_VOL_LEFT + 0x60:
case APU_VOL_LEFT + 0x70:
- // At Shin Megami Tensei suggestion 6/11/00
- // if (byte != APU.DSP [reg])
{
S9xSetSoundVolume(reg >> 4, (signed char) byte,
(signed char) APU.DSP [reg + 1]);
@@ -268,8 +259,6 @@ void S9xSetAPUDSP(uint8_t byte)
case APU_VOL_RIGHT + 0x50:
case APU_VOL_RIGHT + 0x60:
case APU_VOL_RIGHT + 0x70:
- // At Shin Megami Tensei suggestion 6/11/00
- // if (byte != APU.DSP [reg])
{
S9xSetSoundVolume(reg >> 4, (signed char) APU.DSP [reg - 1],
(signed char) byte);
@@ -418,8 +407,6 @@ void S9xSetAPUDSP(uint8_t byte)
S9xSetFilterCoefficient(reg >> 4, (signed char) byte);
break;
default:
- // XXX
- //printf ("Write %02x to unknown APU register %02x\n", byte, reg);
break;
}
@@ -524,8 +511,6 @@ void S9xFixEnvelope(int channel, uint8_t gain, uint8_t adsr1, uint8_t adsr2)
void S9xSetAPUControl(uint8_t byte)
{
- //if (byte & 0x40)
- //printf ("*** Special SPC700 timing enabled\n");
if ((byte & 1) != 0 && !APU.TimerEnabled [0])
{
APU.Timer [0] = 0;
@@ -639,8 +624,6 @@ uint8_t S9xGetAPUDSP()
return ((uint8_t) S9xGetEnvelopeHeight(reg >> 4));
case APU_ENDX:
- // To fix speech in Magical Drop 2 6/11/00
- // APU.DSP [APU_ENDX] = 0;
break;
default:
break;
diff --git a/source/apu.h b/source/apu.h
index b44cbb5..d5cdc78 100644
--- a/source/apu.h
+++ b/source/apu.h
@@ -129,44 +129,5 @@ extern void (*S9xApuOpcodes [256])(void);
#define APU_EXECUTE1() do{}while(0)
#define APU_EXECUTE() do{}while(0)
-//typedef struct
-//{
-// uint8_t* PC;
-// SAPURegisters Registers;
-// uint8_t* RAM;
-// uint8_t* DirectPage;
-// bool APUExecuting;
-// uint8_t Bit;
-// uint32_t Address;
-// uint8_t* WaitAddress1;
-// uint8_t* WaitAddress2;
-// uint32_t WaitCounter;
-// uint8_t _Carry;
-// uint8_t _Zero;
-// uint8_t _Overflow;
-// uint32_t TimerErrorCounter;
-// uint32_t Scanline;
-// int32_t OneCycle;
-// int32_t TwoCycles;
-//} SIAPU;
-
-//typedef struct
-//{
-// int32_t Cycles;
-// bool ShowROM;
-// uint8_t Flags;
-// uint8_t KeyedChannels;
-// uint8_t OutPorts [4];
-// uint8_t DSP [0x80];
-// uint8_t ExtraRAM [64];
-// uint16_t Timer [3];
-// uint16_t TimerTarget [3];
-// bool TimerEnabled [3];
-// bool TimerValueWritten [3];
-//} SAPU;
-
-//SAPU APU;
-//SIAPU IAPU;
-
#endif
diff --git a/source/apu_blargg.c b/source/apu_blargg.c
index c2c3718..b6188bc 100644
--- a/source/apu_blargg.c
+++ b/source/apu_blargg.c
@@ -20,7 +20,6 @@
#include "apu_blargg.h"
#include "snes9x.h"
-//#include "snapshot.h"
#include "display.h"
@@ -1285,7 +1284,6 @@ static INLINE void spc_dsp_write( int data, int time )
}
break;
}
- /* dprintf( "SPC wrote to DSP register > $7F\n" ); */
}
@@ -1327,8 +1325,6 @@ static void spc_cpu_write_smp_reg_( int data, int time, int addr )
case R_T0OUT:
case R_T1OUT:
case R_T2OUT:
- /* dprintf( "SPC wrote to counter %d\n", (int) addr - R_T0OUT ); */
-
if ( data < NO_READ_BEFORE_WRITE_DIVIDED_BY_TWO)
{
if ( (time - 1) >= m.timers[addr - R_T0OUT].next_time )
@@ -1345,10 +1341,6 @@ static void spc_cpu_write_smp_reg_( int data, int time, int addr )
break;
case R_TEST:
-#if 0
- if ( (uint8_t) data != 0x0A )
- dprintf( "SPC wrote to test register\n" );
-#endif
break;
case R_CONTROL:
@@ -1687,7 +1679,6 @@ loop:
m.smp_regs[0][i] = (uint8_t) data;
/* Registers other than $F2 and $F4-$F7 */
- /* if ( i != 2 && i != 4 && i != 5 && i != 6 && i != 7 ) */
if ( ((~0x2F00 << (bits_in_int - 16)) << i) < 0 ) /* 12% */
{
if ( i == R_DSPDATA ) /* 99% */
@@ -1816,7 +1807,6 @@ loop:
temp = GET_LE16( pc );
pc += 2;
READ_TIMER( 0, temp, y = nz );
- /* y = nz = SPC_CPU_READ( 0, temp ); */
goto loop;
}
@@ -2608,10 +2598,6 @@ out_of_time:
stop:
/* Uncache registers */
-#if 0
- if ( GET_PC() >= 0x10000 )
- dprintf( "SPC: PC wrapped around\n" );
-#endif
m.cpu_regs.pc = (uint16_t) GET_PC();
m.cpu_regs.sp = ( uint8_t) GET_SP();
m.cpu_regs.a = ( uint8_t) a;
@@ -3060,8 +3046,6 @@ static INLINE bool resampler_push(int16_t *src, int num_samples)
static INLINE void resampler_resize (int num_samples)
{
- /* int size; */
- /* size = num_samples << 1; */
free(rb_buffer);
rb_buffer_size = rb_size;
rb_buffer = (unsigned char*)malloc(rb_buffer_size);
diff --git a/source/apumem.h b/source/apumem.h
index 661fdf7..c86b8c0 100644
--- a/source/apumem.h
+++ b/source/apumem.h
@@ -121,22 +121,6 @@ INLINE void S9xAPUSetByte(uint8_t byte, uint32_t Address)
}
else
{
-#if 0
- if (Address >= 0x2500 && Address <= 0x2504)
- printf("%06d %04x <- %02x\n", ICPU.Scanline, Address, byte);
- if (Address == 0x26c6)
- {
- extern FILE* apu_trace;
- extern FILE* trace;
- APU.Flags |= TRACE_FLAG;
- CPU.Flags |= TRACE_FLAG;
- if (apu_trace == NULL)
- apu_trace = fopen("aputrace.log", "wb");
- if (trace == NULL)
- trace = fopen("trace.log", "wb");
- printf("TRACING SWITCHED ON\n");
- }
-#endif
if (Address < 0xffc0)
IAPU.RAM [Address] = byte;
else
diff --git a/source/c4emu.c b/source/c4emu.c
index 924afa2..6fce00f 100644
--- a/source/c4emu.c
+++ b/source/c4emu.c
@@ -12,9 +12,6 @@
void S9xInitC4()
{
- // Stupid zsnes code, we can't do the logical thing without breaking
- // savestates
- // Memory.C4RAM = &Memory.FillRAM [0x6000];
memset(Memory.C4RAM, 0, 0x2000);
}
@@ -190,10 +187,6 @@ static void C4DoScaleRotate(int row_padding)
uint8_t w = Memory.C4RAM[0x1f89] & ~7;
uint8_t h = Memory.C4RAM[0x1f8c] & ~7;
- // printf("%dx%d XScale=%04x YScale=%04x angle=%03x\n", w, h, XScale, YScale, READ_WORD(Memory.C4RAM+0x1f80)&0x1ff);
- // printf("Matrix: [%10g %10g] [%04x %04x]\n", A/4096.0, B/4096.0, A&0xffff, B&0xffff);
- // printf(" [%10g %10g] [%04x %04x]\n", C/4096.0, D/4096.0, C&0xffff, D&0xffff);
-
// Clear the output RAM
memset(Memory.C4RAM, 0, (w + row_padding / 4)*h / 2);
@@ -292,9 +285,8 @@ static void C4DrawLine(int32_t X1, int32_t Y1, int16_t Z1,
//.loop
if (X1 > 0xff && Y1 > 0xff && X1 < 0x6000 && Y1 < 0x6000)
{
- uint16_t addr = ((X1 & ~0x7ff) + (Y1 & ~0x7ff) * 12 + (Y1 & 0x700)) >> 7;
- addr = (((Y1 >> 8) >> 3) << 8) - (((Y1 >> 8) >> 3) << 6) + (((
- X1 >> 8) >> 3) << 4) + ((Y1 >> 8) & 7) * 2;
+ uint16_t addr = (((Y1 >> 8) >> 3) << 8) - (((Y1 >> 8) >> 3) << 6) + (((
+ X1 >> 8) >> 3) << 4) + ((Y1 >> 8) & 7) * 2;
uint8_t bit = 0x80 >> ((X1 >> 8) & 7);
Memory.C4RAM[addr + 0x300] &= ~bit;
Memory.C4RAM[addr + 0x301] &= ~bit;
@@ -699,9 +691,7 @@ void S9xSetC4(uint8_t byte, uint16_t Address)
case 0x54: // Square
{
int64_t a = SAR64((int64_t)READ_3WORD(Memory.C4RAM + 0x1f80) << 40, 40);
- // printf("%08X%08X\n", (uint32_t)(a>>32), (uint32_t)(a&0xFFFFFFFF));
a *= a;
- // printf("%08X%08X\n", (uint32_t)(a>>32), (uint32_t)(a&0xFFFFFFFF));
WRITE_3WORD(Memory.C4RAM + 0x1f83, a);
WRITE_3WORD(Memory.C4RAM + 0x1f86, (a >> 24));
}
diff --git a/source/clip.c b/source/clip.c
index e8c501c..94ecbd6 100644
--- a/source/clip.c
+++ b/source/clip.c
@@ -99,7 +99,6 @@ void ComputeClipWindows()
}
}
- // if (!Settings.DisableGraphicWindows)
{
if (w == 5 || pClip->Count [5] ||
(Memory.FillRAM [0x212c + c] & Memory.FillRAM [0x212e + c] & (1 << w)))
diff --git a/source/cpu.c b/source/cpu.c
index 850b408..14695e6 100644
--- a/source/cpu.c
+++ b/source/cpu.c
@@ -21,7 +21,7 @@ extern struct FxInit_s SuperFX;
void S9xResetSuperFX()
{
- SuperFX.vFlags = 0; //FX_FLAG_ROM_BUFFER;// | FX_FLAG_ADDRESS_CHECKING;
+ SuperFX.vFlags = 0;
FxReset(&SuperFX);
}
@@ -62,9 +62,7 @@ void S9xResetCPU()
CPU.FastROMSpeed = SLOW_ONE_CYCLE;
CPU.AutoSaveTimer = 0;
CPU.SRAMModified = false;
- // CPU.NMITriggerPoint = 4; // Set when ROM image loaded
CPU.BRKTriggered = false;
- //CPU.TriedInterleavedMode2 = false; // Reset when ROM image loaded
CPU.NMICycleCount = 0;
CPU.IRQCycleCount = 0;
S9xSetPCBase(ICPU.Registers.PC);
@@ -113,7 +111,6 @@ void S9xSoftReset(void)
memset(Memory.FillRAM, 0, 0x8000);
memset(Memory.VRAM, 0x00, 0x10000);
- // memset (Memory.RAM, 0x55, 0x20000);
if (Settings.SPC7110)
S9xSpc7110Reset();
diff --git a/source/cpuaddr.h b/source/cpuaddr.h
index 2479f96..21ce254 100644
--- a/source/cpuaddr.h
+++ b/source/cpuaddr.h
@@ -13,7 +13,6 @@ typedef enum
} AccessMode;
// The type for a function that can run after the addressing mode is resolved:
-// void NAME (long Addr) {...}
typedef void (*InternalOp)(long);
static void Immediate8(AccessMode a, InternalOp op)
@@ -136,7 +135,6 @@ static void Direct(AccessMode a, InternalOp op)
{
if (a & READ) OpenBus = *CPU.PC;
long Addr = (*CPU.PC++ + ICPU.Registers.D.W) & 0xffff;
- // if (ICPU.Registers.DL != 0) CPU.Cycles += ONE_CYCLE;
(*op)(Addr);
}
@@ -149,7 +147,6 @@ static void DirectIndirectIndexed(AccessMode a, InternalOp op)
if (a & READ) OpenBus = (uint8_t)(Addr >> 8);
Addr += ICPU.ShiftedDB + ICPU.Registers.Y.W;
- // if (ICPU.Registers.DL != 0) CPU.Cycles += ONE_CYCLE;
// XXX: always add one if STA
// XXX: else Add one cycle if crosses page boundary
(*op)(Addr);
@@ -165,7 +162,6 @@ static void DirectIndirectIndexedLong(AccessMode a, InternalOp op)
ICPU.Registers.Y.W;
else
Addr = S9xGetWord(Addr) + (S9xGetByte(Addr + 2) << 16) + ICPU.Registers.Y.W;
- // if (ICPU.Registers.DL != 0) CPU.Cycles += ONE_CYCLE;
(*op)(Addr);
}
@@ -257,8 +253,6 @@ static void DirectIndirect(AccessMode a, InternalOp op)
Addr = S9xGetWord(Addr);
if (a & READ) OpenBus = (uint8_t)(Addr >> 8);
Addr += ICPU.ShiftedDB;
-
- // if (ICPU.Registers.DL != 0) CPU.Cycles += ONE_CYCLE;
(*op)(Addr);
}
@@ -270,7 +264,6 @@ static void DirectIndirectLong(AccessMode a, InternalOp op)
Addr = S9xGetWord(Addr) + ((OpenBus = S9xGetByte(Addr + 2)) << 16);
else
Addr = S9xGetWord(Addr) + (S9xGetByte(Addr + 2) << 16);
- // if (ICPU.Registers.DL != 0) CPU.Cycles += ONE_CYCLE;
(*op)(Addr);
}
diff --git a/source/cpuexec.c b/source/cpuexec.c
index dc6b399..6b1896c 100644
--- a/source/cpuexec.c
+++ b/source/cpuexec.c
@@ -33,13 +33,13 @@ void S9xMainLoop(void)
{
if (Settings.SA1)
{
- if (Settings.SuperFX) S9xMainLoop_SA1_SFX();
- else /* if (!Settings.SuperFX) */ S9xMainLoop_SA1_NoSFX();
+ if (Settings.SuperFX) S9xMainLoop_SA1_SFX();
+ else S9xMainLoop_SA1_NoSFX();
}
- else /* if (!Settings.SA1) */
+ else
{
- if (Settings.SuperFX) S9xMainLoop_NoSA1_SFX();
- else /* if (!Settings.SuperFX) */ S9xMainLoop_NoSA1_NoSFX();
+ if (Settings.SuperFX) S9xMainLoop_NoSA1_SFX();
+ else S9xMainLoop_NoSA1_NoSFX();
}
}
@@ -506,10 +506,6 @@ void S9xDoHBlankProcessing_SFX()
// once every emulated 63.5 microseconds, which coresponds to
// 15.750KHz, but the SPC700 timers need to be updated at multiples
// of 8KHz, hence the error correction.
- // IAPU.TimerErrorCounter++;
- // if (IAPU.TimerErrorCounter >= )
- // IAPU.TimerErrorCounter = 0;
- // else
{
if (APU.TimerEnabled [2])
{
@@ -686,10 +682,6 @@ void S9xDoHBlankProcessing_NoSFX()
// once every emulated 63.5 microseconds, which coresponds to
// 15.750KHz, but the SPC700 timers need to be updated at multiples
// of 8KHz, hence the error correction.
- // IAPU.TimerErrorCounter++;
- // if (IAPU.TimerErrorCounter >= )
- // IAPU.TimerErrorCounter = 0;
- // else
#ifndef USE_BLARGG_APU
{
if (APU.TimerEnabled [2])
diff --git a/source/cpumacro.h b/source/cpumacro.h
index 1b2564b..5539445 100644
--- a/source/cpumacro.h
+++ b/source/cpumacro.h
@@ -178,7 +178,6 @@ static void ASL16(long Addr)
uint16_t Work16 = S9xGetWord(Addr);
ICPU._Carry = (Work16 & 0x8000) != 0;
Work16 <<= 1;
- //S9xSetWord (Work16, Addr);
S9xSetByte(Work16 >> 8, Addr + 1);
S9xSetByte(Work16 & 0xFF, Addr);
SetZN16(Work16);
@@ -290,7 +289,6 @@ static void DEC16(long Addr)
#endif
uint16_t Work16 = S9xGetWord(Addr) - 1;
- //S9xSetWord (Work16, Addr);
S9xSetByte(Work16 >> 8, Addr + 1);
S9xSetByte(Work16 & 0xFF, Addr);
SetZN16(Work16);
@@ -352,7 +350,6 @@ static void INC16(long Addr)
#endif
uint16_t Work16 = S9xGetWord(Addr) + 1;
- //S9xSetWord (Work16, Addr);
S9xSetByte(Work16 >> 8, Addr + 1);
S9xSetByte(Work16 & 0xFF, Addr);
SetZN16(Work16);
@@ -430,7 +427,6 @@ static void LSR16(long Addr)
uint16_t Work16 = S9xGetWord(Addr);
ICPU._Carry = Work16 & 1;
Work16 >>= 1;
- //S9xSetWord (Work16, Addr);
S9xSetByte(Work16 >> 8, Addr + 1);
S9xSetByte(Work16 & 0xFF, Addr);
SetZN16(Work16);
@@ -487,7 +483,6 @@ static void ROL16(long Addr)
Work32 <<= 1;
Work32 |= CheckCarry();
ICPU._Carry = Work32 >= 0x10000;
- //S9xSetWord ((uint16_t) Work32, Addr);
S9xSetByte((Work32 >> 8) & 0xFF, Addr + 1);
S9xSetByte(Work32 & 0xFF, Addr);
SetZN16((uint16_t) Work32);
@@ -534,7 +529,6 @@ static void ROR16(long Addr)
Work32 |= (int) CheckCarry() << 16;
ICPU._Carry = (uint8_t)(Work32 & 1);
Work32 >>= 1;
- //S9xSetWord ((uint16_t) Work32, Addr);
S9xSetByte((Work32 >> 8) & 0x00FF, Addr + 1);
S9xSetByte(Work32 & 0x00FF, Addr);
SetZN16((uint16_t) Work32);
@@ -714,7 +708,6 @@ static void TSB16(long Addr)
uint16_t Work16 = S9xGetWord(Addr);
ICPU._Zero = (Work16 & ICPU.Registers.A.W) != 0;
Work16 |= ICPU.Registers.A.W;
- //S9xSetWord (Work16, Addr);
S9xSetByte(Work16 >> 8, Addr + 1);
S9xSetByte(Work16 & 0xFF, Addr);
}
@@ -732,7 +725,6 @@ static void TRB16(long Addr)
uint16_t Work16 = S9xGetWord(Addr);
ICPU._Zero = (Work16 & ICPU.Registers.A.W) != 0;
Work16 &= ~ICPU.Registers.A.W;
- //S9xSetWord (Work16, Addr);
S9xSetByte(Work16 >> 8, Addr + 1);
S9xSetByte(Work16 & 0xFF, Addr);
}
diff --git a/source/cpuops.c b/source/cpuops.c
index 093007c..302a17f 100644
--- a/source/cpuops.c
+++ b/source/cpuops.c
@@ -58,10 +58,6 @@ static void Op75M1(void)
DirectIndexedX(READ, ADC8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -70,10 +66,6 @@ static void Op75M0(void)
DirectIndexedX(READ, ADC16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -316,10 +308,6 @@ static void Op35M1(void)
DirectIndexedX(READ, AND8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -328,10 +316,6 @@ static void Op35M0(void)
DirectIndexedX(READ, AND16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -647,10 +631,6 @@ static void Op34M1(void)
DirectIndexedX(READ, BIT8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -659,10 +639,6 @@ static void Op34M0(void)
DirectIndexedX(READ, BIT16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -748,10 +724,6 @@ static void OpD5M1(void)
DirectIndexedX(READ, CMP8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -760,10 +732,6 @@ static void OpD5M0(void)
DirectIndexedX(READ, CMP16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -1117,10 +1085,6 @@ static void OpD6M1(void)
DirectIndexedX(MODIFY, DEC8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -1129,10 +1093,6 @@ static void OpD6M0(void)
DirectIndexedX(MODIFY, DEC16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -1215,10 +1175,6 @@ static void Op55M1(void)
DirectIndexedX(READ, EOR8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -1227,10 +1183,6 @@ static void Op55M0(void)
DirectIndexedX(READ, EOR16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -1460,10 +1412,6 @@ static void OpF6M1(void)
DirectIndexedX(MODIFY, INC8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -1472,10 +1420,6 @@ static void OpF6M0(void)
DirectIndexedX(MODIFY, INC16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -1558,10 +1502,6 @@ static void OpB5M1(void)
DirectIndexedX(READ, LDA8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -1570,10 +1510,6 @@ static void OpB5M0(void)
DirectIndexedX(READ, LDA16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -1816,10 +1752,6 @@ static void OpB6X1(void)
DirectIndexedY(READ, LDX8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -1828,10 +1760,6 @@ static void OpB6X0(void)
DirectIndexedY(READ, LDX16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -1914,10 +1842,6 @@ static void OpB4X1(void)
DirectIndexedX(READ, LDY8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -1926,10 +1850,6 @@ static void OpB4X0(void)
DirectIndexedX(READ, LDY16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -1998,10 +1918,6 @@ static void Op56M1(void)
DirectIndexedX(MODIFY, LSR8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -2010,10 +1926,6 @@ static void Op56M0(void)
DirectIndexedX(MODIFY, LSR16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -2096,10 +2008,6 @@ static void Op15M1(void)
DirectIndexedX(READ, ORA8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -2108,10 +2016,6 @@ static void Op15M0(void)
DirectIndexedX(READ, ORA16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -2341,10 +2245,6 @@ static void Op36M1(void)
DirectIndexedX(MODIFY, ROL8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -2353,10 +2253,6 @@ static void Op36M0(void)
DirectIndexedX(MODIFY, ROL16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -2425,10 +2321,6 @@ static void Op76M1(void)
DirectIndexedX(MODIFY, ROR8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -2437,10 +2329,6 @@ static void Op76M0(void)
DirectIndexedX(MODIFY, ROR16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -2509,10 +2397,6 @@ static void OpF5M1(void)
DirectIndexedX(READ, SBC8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -2521,10 +2405,6 @@ static void OpF5M0(void)
DirectIndexedX(READ, SBC16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -2743,10 +2623,6 @@ static void Op95M1(void)
DirectIndexedX(WRITE, STA8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -2755,10 +2631,6 @@ static void Op95M0(void)
DirectIndexedX(WRITE, STA16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -2985,10 +2857,6 @@ static void Op96X1(void)
DirectIndexedY(WRITE, STX8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -2997,10 +2865,6 @@ static void Op96X0(void)
DirectIndexedY(WRITE, STX16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -3043,10 +2907,6 @@ static void Op94X1(void)
DirectIndexedX(WRITE, STY8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -3055,10 +2915,6 @@ static void Op94X0(void)
DirectIndexedX(WRITE, STY16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -3101,10 +2957,6 @@ static void Op74M1(void)
DirectIndexedX(WRITE, STZ8);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -3113,10 +2965,6 @@ static void Op74M0(void)
DirectIndexedX(WRITE, STZ16);
#ifndef SA1_OPCODES
CPU.Cycles += CPU.MemSpeed + ONE_CYCLE;
- // if (ICPU.Registers.DL != 0)
- // CPU.Cycles += TWO_CYCLES;
- // else
- // CPU.Cycles += ONE_CYCLE;
#endif
}
@@ -3294,8 +3142,6 @@ static inline void CPUShutdown()
!(CPU.Flags & (IRQ_PENDING_FLAG | NMI_FLAG)))
{
CPU.WaitAddress = NULL;
- if (Settings.SA1)
- S9xSA1ExecuteDuringSleep();
#ifndef USE_BLARGG_APU
CPU.Cycles = CPU.NextEvent;
if (IAPU.APUExecuting)
@@ -3341,8 +3187,6 @@ static inline void ForceShutdown()
#ifdef CPU_SHUTDOWN
#ifndef SA1_OPCODES
CPU.WaitAddress = NULL;
- if (Settings.SA1)
- S9xSA1ExecuteDuringSleep ();
CPU.Cycles = CPU.NextEvent;
if (IAPU.APUExecuting)
{
@@ -3683,10 +3527,7 @@ static void OpEA(void)
/**********************************************************************************************/
/* PUSH Instructions ************************************************************************* */
-/* #define PushW(w) \
- * S9xSetWord (w, ICPU.Registers.S.W - 1);\
- * ICPU.Registers.S.W -= 2;
- */
+
#define PushB(b)\
S9xSetByte (b, ICPU.Registers.S.W--);
@@ -3919,10 +3760,6 @@ static void Op5AX0(void)
w = S9xGetByte (++ICPU.Registers.S.W); \
w |= (S9xGetByte (++ICPU.Registers.S.W)<<8);
-/* w = S9xGetWord (ICPU.Registers.S.W + 1); \
- ICPU.Registers.S.W += 2;
-*/
-
#define PullB(b)\
b = S9xGetByte (++ICPU.Registers.S.W);
@@ -4027,7 +3864,6 @@ static void Op28E1(void)
ICPU.Registers.YH = 0;
}
S9xFixCycles();
- /* CHECK_FOR_IRQ();*/
}
static void Op28(void)
@@ -4044,7 +3880,6 @@ static void Op28(void)
ICPU.Registers.YH = 0;
}
S9xFixCycles();
- /* CHECK_FOR_IRQ();*/
}
//PLX
@@ -4802,7 +4637,6 @@ static void OpC2(void)
ICPU.Registers.YH = 0;
}
S9xFixCycles();
- /* CHECK_FOR_IRQ(); */
}
static void OpE2(void)
@@ -4871,7 +4705,6 @@ static void Op40(void)
CPU.Cycles += TWO_CYCLES;
#endif
S9xFixCycles();
- /* CHECK_FOR_IRQ(); */
}
/**********************************************************************************************/
@@ -4880,39 +4713,10 @@ static void Op40(void)
// WAI
static void OpCB(void)
{
-
- // Ok, let's just C-ify the ASM versions separately.
#ifdef SA1_OPCODES
SA1.WaitingForInterrupt = true;
SA1.PC--;
-#if 0
- // XXX: FIXME
- if (Settings.Shutdown)
- {
- SA1.Cycles = SA1.NextEvent;
- if (IAPU.APUExecuting)
- {
- SA1.Executing = false;
- do
- {
- APU_EXECUTE1(,
- }
- while (APU.Cycles < SA1.NextEvent, SA1.Executing = true;
- }
-}
-#endif
#else // SA1_OPCODES
-#if 0
-
-
- if (CPU.IRQActive)
- {
-#ifndef SA1_OPCODES
- CPU.Cycles += TWO_CYCLES;
-#endif
- }
- else
-#endif
{
CPU.WaitingForInterrupt = true;
CPU.PC--;
diff --git a/source/dma.c b/source/dma.c
index e86d17a..c0956c4 100644
--- a/source/dma.c
+++ b/source/dma.c
@@ -28,8 +28,6 @@ extern int HDMA_ModeByteCounts [8];
extern uint8_t* HDMAMemPointers [8];
extern uint8_t* HDMABasePointers [8];
-// #define SETA010_HDMA_FROM_CART
-
#ifdef SETA010_HDMA_FROM_CART
uint32_t HDMARawPointers[8]; // Cart address space pointer
#endif
@@ -110,18 +108,17 @@ void S9xDoDMA(uint8_t Channel)
#endif
if (Settings.SPC7110 && (d->AAddress == 0x4800 || d->ABank == 0x50))
{
- uint32_t i, j;
+ uint32_t i;
i = (s7r.reg4805 | (s7r.reg4806 << 8));
i *= s7r.AlignBy;
i += s7r.bank50Internal;
i %= DECOMP_BUFFER_SIZE;
- j = 0;
if ((i + d->TransferBytes) < DECOMP_BUFFER_SIZE)
spc7110_dma = &s7r.bank50[i];
else
{
spc7110_dma = (uint8_t*)malloc(d->TransferBytes);
- j = DECOMP_BUFFER_SIZE - i;
+ uint32_t j = DECOMP_BUFFER_SIZE - i;
memcpy(spc7110_dma, &s7r.bank50[i], j);
memcpy(&spc7110_dma[j], s7r.bank50, d->TransferBytes - j);
s7_wrap = true;
@@ -155,10 +152,6 @@ void S9xDoDMA(uint8_t Channel)
uint32_t char_count = inc / bytes_per_char;
in_sa1_dma = true;
-
- //printf ("%08x,", base); fflush (stdout);
- //printf ("depth = %d, count = %d, bytes_per_char = %d, bytes_per_line = %d, num_chars = %d, char_line_bytes = %d\n",
- //depth, count, bytes_per_char, bytes_per_line, num_chars, char_line_bytes);
int i;
switch (depth)
@@ -419,7 +412,6 @@ void S9xDoDMA(uint8_t Channel)
{
Work = *(base + p);
REGISTER_2118_linear(Work);
- p += inc;
}
}
else
@@ -439,7 +431,6 @@ void S9xDoDMA(uint8_t Channel)
{
Work = *(base + p);
REGISTER_2118_tile(Work);
- p += inc;
}
}
}
@@ -461,7 +452,6 @@ void S9xDoDMA(uint8_t Channel)
{
Work = *(base + p);
S9xSetPPU(Work, 0x2100 + d->BAddress);
- p += inc;
}
}
}
@@ -778,9 +768,6 @@ uint8_t S9xDoHDMA(uint8_t byte)
byte &= ~mask;
continue;
}
- // Uncommenting the following line breaks Punchout - it starts
- // H-DMA during the frame.
- //p->FirstLine = true;
}
if (p->Repeat && !p->FirstLine)
{
diff --git a/source/dsp1.c b/source/dsp1.c
index 7c50acc..cccae23 100644
--- a/source/dsp1.c
+++ b/source/dsp1.c
@@ -40,22 +40,18 @@ uint8_t S9xGetDSP(uint16_t address)
uint8_t t;
t = (*GetDSP)(address);
- //DSP1GetByte(address);
return (t);
}
void S9xSetDSP(uint8_t byte, uint16_t address)
{
(*SetDSP)(byte, address);
- //DSP1SetByte(byte, address);
}
void DSP1SetByte(uint8_t byte, uint16_t address)
{
if ((address & 0xf000) == 0x6000 || (address & 0x7fff) < 0x4000)
{
- // if ((address & 1) == 0)
- // {
if ((DSP1.command == 0x0A || DSP1.command == 0x1A) && DSP1.out_count != 0)
{
DSP1.out_count--;
@@ -68,7 +64,6 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
DSP1.in_index = 0;
DSP1.waiting4command = false;
DSP1.first_parameter = true;
- // printf("Op%02X\n",byte);
// Mario Kart uses 0x00, 0x02, 0x06, 0x0c, 0x28, 0x0a
switch (byte)
{
@@ -200,9 +195,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
case 0x1f:
DSP1.in_count = 1;
break;
- // case 0x80: DSP1.in_count = 2; break;
default:
- //printf("Op%02X\n",byte);
case 0x80:
DSP1.in_count = 0;
DSP1.waiting4command = true;
@@ -228,14 +221,10 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
&& DSP1.in_index == 0)))
{
}
- // else if (DSP1.first_parameter)
- // {
- // }
else
{
if (DSP1.in_count)
{
- //DSP1.parameters [DSP1.in_index] |= (byte << 8);
if (--DSP1.in_count == 0)
{
// Actually execute the command
@@ -325,7 +314,6 @@ void DSP1SetByte(uint8_t byte, uint16_t address)
break;
case 0x38: // Range
-
Op38X = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8));
Op38Y = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8));
Op38Z = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8));
@@ -694,16 +682,11 @@ uint8_t DSP1GetByte(uint16_t address)
{
uint8_t t;
if ((address & 0xf000) == 0x6000 ||
- // (address >= 0x8000 && address < 0xc000))
(address & 0x7fff) < 0x4000)
{
if (DSP1.out_count)
{
- //if ((address & 1) == 0)
t = (uint8_t) DSP1.output [DSP1.out_index];
- //else
- //{
- // t = (uint8_t) (DSP1.output [DSP1.out_index] >> 8);
DSP1.out_index++;
if (--DSP1.out_count == 0)
{
@@ -730,15 +713,10 @@ uint8_t DSP1GetByte(uint16_t address)
}
}
DSP1.waiting4command = true;
- //}
}
else
{
- // Top Gear 3000 requires this value....
- // if(4==Settings.DSPVersion)
t = 0xff;
- //Ballz3d requires this one:
- // else t = 0x00;
}
}
else t = 0x80;
@@ -755,8 +733,6 @@ void DSP2SetByte(uint8_t byte, uint16_t address)
DSP1.command = byte;
DSP1.in_index = 0;
DSP1.waiting4command = false;
- // DSP1.first_parameter = true;
- // printf("Op%02X\n",byte);
switch (byte)
{
case 0x01:
@@ -787,13 +763,11 @@ void DSP2SetByte(uint8_t byte, uint16_t address)
else
{
DSP1.parameters [DSP1.in_index] = byte;
- // DSP1.first_parameter = false;
DSP1.in_index++;
}
if (DSP1.in_count == DSP1.in_index)
{
- //DSP1.parameters [DSP1.in_index] |= (byte << 8);
// Actually execute the command
DSP1.waiting4command = true;
DSP1.out_index = 0;
@@ -877,7 +851,6 @@ void DSP2SetByte(uint8_t byte, uint16_t address)
case 0x03:
DSP2Op05Transparent = DSP1.parameters[0];
- //DSP2Op03();
break;
case 0x0f:
default:
@@ -909,7 +882,6 @@ uint8_t DSP2GetByte(uint16_t address)
//Disable non-working chips?
#ifdef DSP_DUMMY_LOOPS
-//static const uint16_t DSP1ROM[1024] from SNES9X v1.53
uint16_t Dsp3Rom[1024] =
{
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@@ -1053,8 +1025,6 @@ void DSP3SetByte(uint8_t byte, uint16_t address)
DSP1.command = byte;
DSP1.in_index = 0;
DSP1.waiting4command = false;
- // DSP1.first_parameter = true;
- // printf("Op%02X\n",byte);
switch (byte)
{
case 0x2F:
@@ -1070,20 +1040,17 @@ void DSP3SetByte(uint8_t byte, uint16_t address)
DSP1.in_count = 4;
break;
default:
- // printf("Op%02X\n",byte);
break;
}
}
else
{
DSP1.parameters [DSP1.in_index] = byte;
- // DSP1.first_parameter = false;
DSP1.in_index++;
}
if (DSP1.in_count == DSP1.in_index)
{
- //DSP1.parameters [DSP1.in_index] |= (byte << 8);
// Actually execute the command
DSP1.waiting4command = true;
DSP1.out_index = 0;
@@ -1133,7 +1100,6 @@ uint8_t DSP3GetByte(uint16_t address)
t = (uint8_t)Dsp3Rom[DSP1.out_index >> 1];
else
t = Dsp3Rom[DSP1.out_index >> 1] >> 8;
- // t=Dsp3Rom[DSP1.out_index];
DSP1.out_index++;
}
else
@@ -1151,18 +1117,6 @@ uint8_t DSP3GetByte(uint16_t address)
else
{
t = 0x80;
- /* if(DSP1.command=0x38&&DSP1.out_count==0)
- {
- t=0xC0;
- static int Op38c;
- if(Op38c==14)
- {
- Op38c=0;
- t=0x80;
- DSP1.in_count=4;
- }
- Op38c++;
- }*/
}
return t;
}
@@ -1213,7 +1167,6 @@ void DSP4SetByte(uint8_t byte, uint16_t address)
DSP4.command |= (byte << 8);
DSP4.in_index = 0;
DSP4.waiting4command = false;
- // DSP4.first_parameter = true;
DSP4.half_command = 0;
DSP4.out_count = 0;
DSP4.out_index = 0;
@@ -1262,7 +1215,6 @@ void DSP4SetByte(uint8_t byte, uint16_t address)
break;
default:
DSP4.waiting4command = true;
- //printf("(line %d) Unknown Op%02X\n",line,DSP4.command);
break;
}
}
@@ -1275,13 +1227,11 @@ void DSP4SetByte(uint8_t byte, uint16_t address)
else
{
DSP4.parameters [DSP4.in_index] = byte;
- // DSP4.first_parameter = false;
DSP4.in_index++;
}
if (!DSP4.waiting4command && DSP4.in_count == DSP4.in_index)
{
- //DSP4.parameters [DSP4.in_index] |= (byte << 8);
// Actually execute the command
DSP4.waiting4command = true;
DSP4.out_index = 0;
@@ -1388,9 +1338,6 @@ void DSP4SetByte(uint8_t byte, uint16_t address)
// unknown
case 0x000A:
{
- int16_t in1a = DSP4_READ_WORD(0);
- int16_t in2a = DSP4_READ_WORD(2);
- int16_t in3a = DSP4_READ_WORD(4);
int16_t out1a, out2a;
out1a = (int16_t)0xff40;
diff --git a/source/dsp1.h b/source/dsp1.h
index e4b066b..0c18155 100644
--- a/source/dsp1.h
+++ b/source/dsp1.h
@@ -37,7 +37,5 @@ uint8_t S9xGetDSP(uint16_t Address);
void S9xSetDSP(uint8_t Byte, uint16_t Address);
extern SDSP1 DSP1;
-//extern struct SDSP1 DSP1;
-
#endif
diff --git a/source/dsp1emu.c b/source/dsp1emu.c
index 2acc085..3999d5d 100644
--- a/source/dsp1emu.c
+++ b/source/dsp1emu.c
@@ -683,15 +683,12 @@ void DSPOp06()
// rotate around Z
tanval2 = Angle(-Op02AAS + 32768);
- // tanval2 = (-Op02AAS+32768)/(65536/INCR);
ObjPX1 = (ObjPX * Cos(tanval2) + ObjPY * -Sin(tanval2));
ObjPY1 = (ObjPX * Sin(tanval2) + ObjPY * Cos(tanval2));
ObjPZ1 = ObjPZ;
// rotate around X
- // tanval2 = (-Op02AZS/(65536/INCR)) & 1023;
tanval2 = Angle(-Op02AZS);
- // tanval2 = (-Op02AZS)/256;
ObjPX2 = ObjPX1;
ObjPY2 = (ObjPY1 * Cos(tanval2) + ObjPZ1 * -Sin(tanval2));
ObjPZ2 = (ObjPY1 * Sin(tanval2) + ObjPZ1 * Cos(tanval2));
@@ -701,8 +698,8 @@ void DSPOp06()
if (ObjPZ2 < 0)
{
double d;
- Op06H = (int16_t)(-ObjPX2 * Op02LES / -(ObjPZ2)); //-ObjPX2*256/-ObjPZ2;
- Op06V = (int16_t)(-ObjPY2 * Op02LES / -(ObjPZ2)); //-ObjPY2*256/-ObjPZ2;
+ Op06H = (int16_t)(-ObjPX2 * Op02LES / -(ObjPZ2));
+ Op06V = (int16_t)(-ObjPY2 * Op02LES / -(ObjPZ2));
d = (double)Op02LES;
d *= 256.0;
d /= (-ObjPZ2);
@@ -711,8 +708,6 @@ void DSPOp06()
else if (d < 0.0)
d = 0.0;
Op06S = (uint16_t)d;
- //Op06S=(uint16_t)(256*(double)Op02LES/-ObjPZ2);
- //Op06S=(uint16_t)((double)(256.0*((double)Op02LES)/(-ObjPZ2)));
}
else
{
@@ -747,8 +742,8 @@ void DSPOp06()
if (ObjPZ2 < 0)
{
- Op06H = (int16_t)(-ObjPX2 * Op02LES / -(ObjPZ2)); //-ObjPX2*256/-ObjPZ2;
- Op06V = (int16_t)(-ObjPY2 * Op02LES / -(ObjPZ2)); //-ObjPY2*256/-ObjPZ2;
+ Op06H = (int16_t)(-ObjPX2 * Op02LES / -(ObjPZ2));
+ Op06V = (int16_t)(-ObjPY2 * Op02LES / -(ObjPZ2));
double d = (double)Op02LES;
d *= 256.0;
d /= (-ObjPZ2);
@@ -757,7 +752,6 @@ void DSPOp06()
else if (d < 0.0)
d = 0.0;
Op06S = (uint16_t)d;
- // Op06S=(uint16_t)(256*(double)Op02LES/-ObjPZ2);
}
else
{
diff --git a/source/dsp2emu.c b/source/dsp2emu.c
index 453ab6a..d5a9855 100644
--- a/source/dsp2emu.c
+++ b/source/dsp2emu.c
@@ -208,45 +208,3 @@ void DSP2_Op0D()
}
#endif
-
-#if 0 // Probably no reason to use this code - it's not quite bit accurate and it doesn't look as good as Overload's algorithm
-
-void DSP2_Op0D()
-{
- // Float implementation of Neviksti's algorithm
- // This is the right algorithm to match the DSP2 bits but the precision
- // of the PC float does not match the precision of the fixed point math
- // on the DSP2 causing occasional one off data mismatches (which should
- // be no problem because its just a one pixel difference in a scaled image
- // to be displayed).
-
- float multiplier;
- float pixloc;
- int i, j;
- uint8_t pixelarray[512];
-
- if (DSP2Op0DInLen <= DSP2Op0DOutLen)
- multiplier = (float) 1.0;
- else
- multiplier = (float)((DSP2Op0DInLen * 2.0) / (DSP2Op0DOutLen * 2.0 + 1.0));
-
- pixloc = 0.0;
- for (i = 0; i < DSP2Op0DOutLen * 2; i++)
- {
- // j = (int)(i * multiplier);
- j = (int) pixloc;
-
- if (j & 1)
- pixelarray[i] = DSP1.parameters[j >> 1] & 0x0f;
- else
- pixelarray[i] = (DSP1.parameters[j >> 1] & 0xf0) >> 4;
-
- pixloc += multiplier; // use an add in the loop instead of multiply to increase loop speed
- }
-
- for (i = 0; i < DSP2Op0DOutLen; i++)
- DSP1.output[i] = (pixelarray[i << 1] << 4) | pixelarray[(i << 1) + 1];
-}
-
-#endif
-
diff --git a/source/dsp4emu.c b/source/dsp4emu.c
index d3c85f8..4ea8fcb 100644
--- a/source/dsp4emu.c
+++ b/source/dsp4emu.c
@@ -45,10 +45,6 @@ void DSP4_Op06(bool size, bool msb)
}
}
-#if OP==0x0001
-#define PRINT
-#endif
-
void DSP4_Op01()
{
uint16_t command;
@@ -70,7 +66,6 @@ void DSP4_Op01()
// process initial inputs
// sort inputs
- // 0x00 = DSP4_READ_WORD(0x00);
project_focaly = DSP4_READ_WORD(0x02);
raster = DSP4_READ_WORD(0x04);
viewport_top = DSP4_READ_WORD(0x06);
@@ -80,13 +75,11 @@ void DSP4_Op01()
project_focalx = DSP4_READ_WORD(0x0e);
project_centerx = DSP4_READ_WORD(0x10);
project_ptr = DSP4_READ_WORD(0x12);
- // (envelope?) 0xc0 = DSP4_READ_WORD(0x14);
project_pitchylow = DSP4_READ_WORD(0x16);
project_pitchy = DSP4_READ_WORD(0x18);
project_pitchxlow = DSP4_READ_WORD(0x1a);
project_pitchx = DSP4_READ_WORD(0x1c);
far_plane = DSP4_READ_WORD(0x1e);
- // ? = DSP4_READ_WORD(0x20);
project_y1low = DSP4_READ_WORD(0x22);
// pre-compute
@@ -138,7 +131,6 @@ DSP4_WAIT(1) resume1:
resume2:
plane = DSP4_READ_WORD(0);
- py_dy = 0;
px_dx = 0;
// ignore invalid data
@@ -186,10 +178,6 @@ resume2:
// debug
++block;
-#ifdef PRINT
- printf("(line %d) Op01 check %02X, plane %04X, focal_y %04X, y2 %04X\n", c,
- (uint16_t)segments, (uint16_t)(plane), (uint16_t)project_focaly, (uint16_t)project_y2);
-#endif
// prepare output
DSP4.out_count = 8 + 2 + 6 * segments;
@@ -201,14 +189,6 @@ resume2:
DSP4_WRITE_WORD(6, project_y2);
DSP4_WRITE_WORD(8, segments);
-#if 0
- DSP4_WRITE_WORD(0, -1);
- DSP4_WRITE_WORD(2, -1);
- DSP4_WRITE_WORD(4, -1);
- DSP4_WRITE_WORD(6, -1);
- DSP4_WRITE_WORD(8, -1);
-#endif
-
index = 10;
// iterate through each point
@@ -218,12 +198,6 @@ resume2:
y_out = project_y + ((py_dy * lcv) >> 8);
x_out = project_x + ((px_dx * lcv) >> 8);
-#if 0
- project_ptr = -1;
- y_out = -1;
- x_out = -1;
-#endif
-
// data
DSP4_WRITE_WORD(index + 0, project_ptr);
DSP4_WRITE_WORD(index + 2, y_out);
@@ -264,12 +238,6 @@ resume2:
DSP4.out_count = 0;
}
-#undef PRINT
-
-#if OP==0x0007
-#define PRINT
-#endif
-
void DSP4_Op07()
{
uint16_t command;
@@ -316,10 +284,6 @@ void DSP4_Op07()
// debug
block = 0;
-#ifdef PRINT
- printf("(line %d) Op07 data %04X\n", c, (uint16_t)project_y1);
-#endif
-
////////////////////////////////////////////////////
// command check
@@ -351,7 +315,6 @@ DSP4_WAIT(1) resume1:
int16_t py_dy, px_dx;
resume2:
- py_dy = 0;
px_dx = 0;
// debug
@@ -394,11 +357,6 @@ resume2:
px_dx = ((project_x2 - project_x1) << 8) / segments;
}
-#ifdef PRINT
- printf("(line %d) Op07 block %d, loc %04X, out %02X, project_x2 %04X\n", c,
- block, plane, segments, (uint16_t)project_x2);
-#endif
-
// prepare pre-output
DSP4.out_count = 4 + 2 + 6 * segments;
@@ -406,12 +364,6 @@ resume2:
DSP4_WRITE_WORD(2, project_y2);
DSP4_WRITE_WORD(4, segments);
-#if 0
- DSP4_WRITE_WORD(0, -1);
- DSP4_WRITE_WORD(2, -1);
- DSP4_WRITE_WORD(4, -1);
-#endif
-
index = 6;
for (lcv = 0; lcv < segments; lcv++)
{
@@ -419,12 +371,6 @@ resume2:
y_out = project_y + ((py_dy * lcv) >> 8);
x_out = project_x + ((px_dx * lcv) >> 8);
-#if 0
- project_ptr = -1;
- //y_out = -1;
- x_out = -1;
-#endif
-
// data
DSP4_WRITE_WORD(index + 0, project_ptr);
DSP4_WRITE_WORD(index + 2, y_out);
@@ -455,12 +401,6 @@ resume2:
DSP4.out_count = 0;
}
-#undef PRINT
-
-#if OP==0x0008
-#define PRINT
-#endif
-
void DSP4_Op08()
{
uint16_t command;
@@ -599,11 +539,6 @@ DSP4_WAIT(2) resume2:
if (pos2 < path_clipLeft[1]) pos2 = path_clipLeft[1];
if (pos2 > path_clipRight[1]) pos2 = path_clipRight[1];
-#if 0
- pos1 = -1;
- //pos2=-1;
-#endif
-
path_plane[0] = plane;
path_plane[1] = plane;
@@ -611,10 +546,6 @@ DSP4_WAIT(2) resume2:
DSP4.out_count = 2;
DSP4.output[0] = pos1 & 0xFF;
DSP4.output[1] = pos2 & 0xFF;
-
-#ifdef PRINT
- printf("(line %d) Op08 x_left %04X\n", c, (uint16_t)x_left);
-#endif
}
// proceed with projection
else
@@ -661,11 +592,6 @@ DSP4_WAIT(2) resume2:
path_plane[0] = plane;
}
-#ifdef PRINT
- printf("(line %d) Op08 block %d, out %02X, raster %02X\n", c, block, segments,
- (uint16_t)y_left);
-#endif
-
// zone 1
DSP4.out_count = (2 + 4 * segments);
DSP4_WRITE_WORD(index, segments);
@@ -685,14 +611,6 @@ DSP4_WAIT(2) resume2:
if (pos2 < path_clipLeft[1]) pos2 = path_clipLeft[1];
if (pos2 > path_clipRight[1]) pos2 = path_clipRight[1];
-#if 0
- if (pos1 == 0x00ff) pos1 = 0;
- if (pos2 == 0x00ff) pos2 = 0;
- path_ptr[0] = -1;
- pos1 = -1;
- pos2 = -1;
-#endif
-
// data
DSP4_WRITE_WORD(index, path_ptr[0]);
index += 2;
@@ -776,14 +694,6 @@ DSP4_WAIT(2) resume2:
if (pos2 < path_clipLeft[3]) pos2 = path_clipLeft[3];
if (pos2 > path_clipRight[3]) pos2 = path_clipRight[3];
-#if 0
- if (pos1 == 0x00ff) pos1 = 0;
- if (pos2 == 0x00ff) pos2 = 0;
- path_ptr[2] = -1;
- //pos1 = -1;
- pos2 = -1;
-#endif
-
// data
DSP4_WRITE_WORD(index, path_ptr[2]);
index += 2;
@@ -817,12 +727,6 @@ DSP4_WAIT(2) resume2:
DSP4_WRITE_WORD(0, 0);
}
-#undef PRINT
-
-#if OP==0x000D
-#define PRINT
-#endif
-
void DSP4_Op0D()
{
uint16_t command;
@@ -844,7 +748,6 @@ void DSP4_Op0D()
// process initial inputs
// sort inputs
- // 0x00 = DSP4_READ_WORD(0x00);
project_focaly = DSP4_READ_WORD(0x02);
raster = DSP4_READ_WORD(0x04);
viewport_top = DSP4_READ_WORD(0x06);
@@ -855,13 +758,11 @@ void DSP4_Op0D()
project_focalx = DSP4_READ_WORD(0x0e);
project_centerx = DSP4_READ_WORD(0x10);
project_ptr = DSP4_READ_WORD(0x12);
- // 0xc0 = DSP4_READ_WORD(0x14);
project_pitchylow = DSP4_READ_WORD(0x16);
project_pitchy = DSP4_READ_WORD(0x18);
project_pitchxlow = DSP4_READ_WORD(0x1a);
project_pitchx = DSP4_READ_WORD(0x1c);
far_plane = DSP4_READ_WORD(0x1e);
- // ? = DSP4_READ_WORD(0x20);
// multi-op storage
multi_index1++;
@@ -932,7 +833,6 @@ DSP4_WAIT(1) resume1:
resume2:
plane = DSP4_READ_WORD(0);
- py_dy = 0;
px_dx = 0;
@@ -982,11 +882,6 @@ resume2:
// debug
++block;
-#ifdef PRINT
- printf("(line %d) Op0D check %02X, plane %04X\n", c, (uint16_t)segments,
- (uint16_t)(plane));
-#endif
-
// prepare output
DSP4.out_count = 8 + 2 + 6 * segments;
@@ -995,13 +890,6 @@ resume2:
DSP4_WRITE_WORD(4, project_focaly);
DSP4_WRITE_WORD(6, project_y2);
DSP4_WRITE_WORD(8, segments);
-#if 0
- DSP4_WRITE_WORD(0, -1);
- DSP4_WRITE_WORD(2, -1);
- DSP4_WRITE_WORD(4, -1);
- DSP4_WRITE_WORD(6, -1);
- DSP4_WRITE_WORD(8, -1);
-#endif
index = 10;
@@ -1012,12 +900,6 @@ resume2:
y_out = project_y + ((py_dy * lcv) >> 8);
x_out = project_x + ((px_dx * lcv) >> 8);
-#if 0
- project_ptr = -1;
- //y_out=-1;
- x_out = -1;
-#endif
-
// data
DSP4_WRITE_WORD(index + 0, project_ptr);
DSP4_WRITE_WORD(index + 2, y_out);
@@ -1055,16 +937,6 @@ resume2:
DSP4.out_count = 0;
}
-#undef PRINT
-
-#if OP==0x0009
-#define PRINT
-#endif
-
-#if OP==0x0006
-#define PRINT
-#endif
-
void DSP4_Op09()
{
uint16_t command;
@@ -1107,17 +979,11 @@ void DSP4_Op09()
view_plane = PLANE_START;
center_x = DSP4_READ_WORD(0x00);
center_y = DSP4_READ_WORD(0x02);
- // 0x00 = DSP4_READ_WORD(0x04);
viewport_left = DSP4_READ_WORD(0x06);
viewport_right = DSP4_READ_WORD(0x08);
viewport_top = DSP4_READ_WORD(0x0a);
viewport_bottom = DSP4_READ_WORD(0x0c);
-#ifdef PRINT2
- printf("Window: (%04X,%04X) (%04X,%04X)\n",
- viewport_left, viewport_right, viewport_top, viewport_bottom);
-#endif
-
// expand viewport dimensions
viewport_left -= 8;
@@ -1125,12 +991,10 @@ void DSP4_Op09()
multi_index1++;
multi_index1 %= 4;
-#if 1
// convert track line to the window region
project_y2 = center_y + multi_raster[multi_index1] *
(viewport_bottom - center_y) / (0x33 - 0);
if (op09_mode == 0) project_y2 -= 2;
-#endif
goto no_sprite;
@@ -1189,9 +1053,7 @@ sprite_found:
{
int16_t plane;
int16_t car_left, car_right;
- // int16_t car_left_a;
int16_t focal_back;
-// int16_t focal_front;
// we already have 4 bytes we want
DSP4.in_count = 6 + 12;
@@ -1202,8 +1064,6 @@ DSP4_WAIT(3) resume3:
// filter inputs
project_y1 = DSP4_READ_WORD(0x00);
focal_back = DSP4_READ_WORD(0x06);
- // focal_front = DSP4_READ_WORD(0x08);
- // car_left_a = DSP4_READ_WORD(0x0a);
car_left = DSP4_READ_WORD(0x0c);
plane = DSP4_READ_WORD(0x0e);
car_right = DSP4_READ_WORD(0x10);
@@ -1259,7 +1119,6 @@ DSP4_WAIT(5) resume5:
project_y1 = DSP4_READ_WORD(0x00);
plane = DSP4_READ_WORD(0x02);
project_centerx = DSP4_READ_WORD(0x04);
- //project_y1 = DSP4_READ_WORD(0x06);
project_focalx = DSP4_READ_WORD(0x08);
project_focaly = DSP4_READ_WORD(0x0a);
sprite_offset = DSP4_READ_WORD(0x0c);
@@ -1298,9 +1157,6 @@ DSP4_WAIT(6) resume6:
if (command == 0x0000)
{
sprite_size = !sprite_size;
-#ifdef PRINT
- printf("TOGGLE=%02X\n", (uint8_t)sprite_size);
-#endif
continue;
}
@@ -1342,12 +1198,6 @@ resume7:
if (far_plane <= multi_farplane[multi_index1] &&
sp_y >= project_y2) clip = true;
-#ifdef PRINT2
- printf("(line %d) %04X, %04X, %04X / %04X %04X\n", line,
- (uint16_t)sp_x, (uint16_t)sp_y, (uint16_t)far_plane,
- (uint16_t)multi_farplane[multi_index1], (uint16_t)project_y2);
-#endif
-
// don't draw offscreen coordinates
DSP4.out_count = 0;
if (!clip)
@@ -1359,12 +1209,6 @@ resume7:
sp_oam = sprite_offset + offset;
sp_msb = (sp_x < 0 || sp_x > 255);
-#ifdef PRINT
- printf("(line %d) %04X, %04X, %04X, %04X, %04X\n", line,
- (uint16_t)sp_oam, (uint16_t)sprite_offset, (uint16_t)offset,
- (uint16_t)sp_x, (uint16_t)sp_y);
-#endif
-
// emit transparency information
if (
(sprite_offset & 0x08) &&
@@ -1404,16 +1248,6 @@ resume7:
// OAM: size,msb data
DSP4_Op06(sprite_size, (char) sp_msb);
-
-#if 0
- DSP4_WRITE_WORD(0, -1);
- DSP4_WRITE_WORD(2, -1);
- DSP4_WRITE_WORD(4, -1);
- DSP4_WRITE_WORD(6, -1);
- DSP4_WRITE_WORD(8, -1);
- DSP4_WRITE_WORD(10, -1);
- DSP4_WRITE_WORD(12, -1);
-#endif
}
// no sprite information
@@ -1461,6 +1295,3 @@ terminate:
DSP4.waiting4command = true;
DSP4.out_count = 0;
}
-
-#undef PRINT
-
diff --git a/source/fxemu.c b/source/fxemu.c
index ffb82be..c16ee58 100644
--- a/source/fxemu.c
+++ b/source/fxemu.c
@@ -13,133 +13,21 @@ uint32_t(**fx_ppfFunctionTable)(uint32_t) = 0;
void (**fx_ppfPlotTable)() = 0;
void (**fx_ppfOpcodeTable)() = 0;
-#if 0
-void fx_setCache()
-{
- uint32_t c;
- GSU.bCacheActive = true;
- GSU.pvRegisters[0x3e] &= 0xf0;
- c = (uint32_t)GSU.pvRegisters[0x3e];
- c |= ((uint32_t)GSU.pvRegisters[0x3f]) << 8;
- if (c == GSU.vCacheBaseReg)
- return;
- GSU.vCacheBaseReg = c;
- GSU.vCacheFlags = 0;
- if (c < (0x10000 - 512))
- {
- uint8_t const* t = &ROM(c);
- memcpy(GSU.pvCache, t, 512);
- }
- else
- {
- uint8_t const* t1;
- uint8_t const* t2;
- uint32_t i = 0x10000 - c;
- t1 = &ROM(c);
- t2 = &ROM(0);
- memcpy(GSU.pvCache, t1, i);
- memcpy(&GSU.pvCache[i], t2, 512 - i);
- }
-}
-#endif
-
void FxCacheWriteAccess(uint16_t vAddress)
{
-#if 0
- if (!GSU.bCacheActive)
- {
- uint8_t v = GSU.pvCache[GSU.pvCache[vAddress & 0x1ff];
- fx_setCache();
- GSU.pvCache[GSU.pvCache[vAddress & 0x1ff] = v;
- }
-#endif
- if ((vAddress & 0x00f) == 0x00f)
- GSU.vCacheFlags |= 1 << ((vAddress & 0x1f0) >> 4);
+ if ((vAddress & 0x00f) == 0x00f)
+ GSU.vCacheFlags |= 1 << ((vAddress & 0x1f0) >> 4);
}
- void FxFlushCache()
+void FxFlushCache()
{
GSU.vCacheFlags = 0;
GSU.vCacheBaseReg = 0;
GSU.bCacheActive = false;
- // GSU.vPipe = 0x1;
-}
-
-static void fx_backupCache()
-{
-#if 0
- uint32_t i;
- uint32_t v = GSU.vCacheFlags;
- uint32_t c = USEX16(GSU.vCacheBaseReg);
- if (v)
- for (i = 0; i < 32; i++)
- {
- if (v & 1)
- {
- if (c < (0x10000 - 16))
- {
- uint8_t* t = &GSU.pvPrgBank[c];
- memcpy(&GSU.avCacheBackup[i << 4], t, 16);
- memcpy(t, &GSU.pvCache[i << 4], 16);
- }
- else
- {
- uint8_t* t1;
- uint8_t* t2;
- uint32_t a = 0x10000 - c;
- t1 = &GSU.pvPrgBank[c];
- t2 = &GSU.pvPrgBank[0];
- memcpy(&GSU.avCacheBackup[i << 4], t1, a);
- memcpy(t1, &GSU.pvCache[i << 4], a);
- memcpy(&GSU.avCacheBackup[(i << 4) + a], t2, 16 - a);
- memcpy(t2, &GSU.pvCache[(i << 4) + a], 16 - a);
- }
- }
- c = USEX16(c + 16);
- v >>= 1;
- }
-#endif
-}
-
-static void fx_restoreCache()
-{
-#if 0
- uint32_t i;
- uint32_t v = GSU.vCacheFlags;
- uint32_t c = USEX16(GSU.vCacheBaseReg);
- if (v)
- for (i = 0; i < 32; i++)
- {
- if (v & 1)
- {
- if (c < (0x10000 - 16))
- {
- uint8_t* t = &GSU.pvPrgBank[c];
- memcpy(t, &GSU.avCacheBackup[i << 4], 16);
- memcpy(&GSU.pvCache[i << 4], t, 16);
- }
- else
- {
- uint8_t* t1;
- uint8_t* t2;
- uint32_t a = 0x10000 - c;
- t1 = &GSU.pvPrgBank[c];
- t2 = &GSU.pvPrgBank[0];
- memcpy(t1, &GSU.avCacheBackup[i << 4], a);
- memcpy(&GSU.pvCache[i << 4], t1, a);
- memcpy(t2, &GSU.avCacheBackup[(i << 4) + a], 16 - a);
- memcpy(&GSU.pvCache[(i << 4) + a], t2, 16 - a);
- }
- }
- c = USEX16(c + 16);
- v >>= 1;
- }
-#endif
}
void fx_flushCache()
{
- fx_restoreCache();
GSU.vCacheFlags = 0;
GSU.bCacheActive = false;
}
@@ -197,10 +85,6 @@ static void fx_readRegisterSpace()
i |= ((int)(!!(p[GSU_SCMR] & 0x20))) << 1;
GSU.vScreenHeight = GSU.vScreenRealHeight = avHeight[i];
GSU.vMode = p[GSU_SCMR] & 0x03;
-#if 0
- if (GSU.vMode == 2)
- error illegal color depth GSU.vMode;
-#endif
if (i == 3)
GSU.vScreenSize = (256 / 8) * (256 / 8) * 32;
else
@@ -210,14 +94,9 @@ static void fx_readRegisterSpace()
/* OBJ Mode (for drawing into sprites) */
GSU.vScreenHeight = 256;
}
-#if 0
- if (GSU.pvScreenBase + GSU.vScreenSize > GSU.pvRam + (GSU.nRamBanks * 65536))
- error illegal address for screen base register
-#else
if (GSU.pvScreenBase + GSU.vScreenSize > GSU.pvRam + (GSU.nRamBanks * 65536))
GSU.pvScreenBase = GSU.pvRam + (GSU.nRamBanks * 65536) - GSU.vScreenSize;
-#endif
- GSU.pfPlot = fx_apfPlotTable[GSU.vMode];
+ GSU.pfPlot = fx_apfPlotTable[GSU.vMode];
GSU.pfRpix = fx_apfPlotTable[GSU.vMode + 5];
fx_ppfOpcodeTable[0x04c] = GSU.pfPlot;
@@ -226,8 +105,6 @@ static void fx_readRegisterSpace()
fx_ppfOpcodeTable[0x34c] = GSU.pfRpix;
fx_computeScreenPointers();
-
- fx_backupCache();
}
void fx_dirtySCBR()
@@ -395,8 +272,6 @@ static void fx_writeRegisterSpace()
p[GSU_RAMBR] = (uint8_t)GSU.vRamBankReg;
p[GSU_CBR] = (uint8_t)GSU.vCacheBaseReg;
p[GSU_CBR + 1] = (uint8_t)(GSU.vCacheBaseReg >> 8);
-
- fx_restoreCache();
}
/* Reset the FxChip */
@@ -405,30 +280,15 @@ void FxReset(struct FxInit_s* psFxInfo)
int i;
static uint32_t(**appfFunction[])(uint32_t) =
{
- &fx_apfFunctionTable[0],
-#if 0
- &fx_a_apfFunctionTable[0],
- &fx_r_apfFunctionTable[0],
- &fx_ar_apfFunctionTable[0],
-#endif
+ &fx_apfFunctionTable[0]
};
static void (**appfPlot[])() =
{
- &fx_apfPlotTable[0],
-#if 0
- &fx_a_apfPlotTable[0],
- &fx_r_apfPlotTable[0],
- &fx_ar_apfPlotTable[0],
-#endif
+ &fx_apfPlotTable[0]
};
static void (**appfOpcode[])() =
{
- &fx_apfOpcodeTable[0],
-#if 0
- &fx_a_apfOpcodeTable[0],
- &fx_r_apfOpcodeTable[0],
- &fx_ar_apfOpcodeTable[0],
-#endif
+ &fx_apfOpcodeTable[0]
};
/* Get function pointers for the current emulation mode */
@@ -536,22 +396,12 @@ int FxEmulate(uint32_t nInstructions)
{
CF(G);
fx_writeRegisterSpace();
-#if 0
- GSU.vIllegalAddress = (GSU.vPrgBankReg << 24) | R15;
- return FX_ERROR_ILLEGAL_ADDRESS;
-#else
return 0;
-#endif
}
/* Execute GSU session */
CF(IRQ);
- /*
- if (GSU.bBreakPoint)
- vCount = fx_ppfFunctionTable[FX_FUNCTION_RUN_TO_BREAKPOINT](nInstructions);
- else
- */
vCount = fx_ppfFunctionTable[FX_FUNCTION_RUN](nInstructions);
/* Store GSU registers */
@@ -564,18 +414,6 @@ int FxEmulate(uint32_t nInstructions)
return vCount;
}
-/* Breakpoints */
-/*
-void FxBreakPointSet(uint32_t vAddress)
-{
- GSU.bBreakPoint = true;
- GSU.vBreakPoint = USEX16(vAddress);
-}
-void FxBreakPointClear()
-{
- GSU.bBreakPoint = false;
-}*/
-
/* Step by step execution */
int FxStepOver(uint32_t nInstructions)
{
@@ -586,12 +424,7 @@ int FxStepOver(uint32_t nInstructions)
if (!fx_checkStartAddress())
{
CF(G);
-#if 0
- GSU.vIllegalAddress = (GSU.vPrgBankReg << 24) | R15;
- return FX_ERROR_ILLEGAL_ADDRESS;
-#else
return 0;
-#endif
}
if (PIPE >= 0xf0)
diff --git a/source/fxemu.h b/source/fxemu.h
index 8826edf..5b1efac 100644
--- a/source/fxemu.h
+++ b/source/fxemu.h
@@ -26,10 +26,6 @@ extern int FxEmulate(uint32_t nInstructions);
extern void FxCacheWriteAccess(uint16_t vAddress);
extern void FxFlushCache(); /* Callled when the G flag in SFR is set to zero */
-/* Breakpoint */
-//extern void FxBreakPointSet(uint32_t vAddress);
-//extern void FxBreakPointClear();
-
/* Step by step execution */
extern int FxStepOver(uint32_t nInstructions);
diff --git a/source/fxinst.c b/source/fxinst.c
index b0fa0d3..05ebba2 100644
--- a/source/fxinst.c
+++ b/source/fxinst.c
@@ -60,23 +60,6 @@ static void fx_cache()
fx_flushCache();
GSU.vCacheBaseReg = c;
GSU.bCacheActive = true;
-#if 0
- if (c < (0x10000 - 512))
- {
- uint8_t const* t = &ROM(c);
- memcpy(GSU.pvCache, t, 512);
- }
- else
- {
- uint8_t const* t1;
- uint8_t const* t2;
- uint32_t i = 0x10000 - c;
- t1 = &ROM(c);
- t2 = &ROM(0);
- memcpy(GSU.pvCache, t1, i);
- memcpy(&GSU.pvCache[i], t2, 512 - i);
- }
-#endif
}
R15++;
CLRFLAGS;
@@ -3261,11 +3244,6 @@ static uint32_t fx_run(uint32_t nInstructions)
READR14;
while (TF(G) && (GSU.vCounter-- > 0))
FX_STEP;
- /*
- #ifndef FX_ADDRESS_CHECK
- GSU.vPipeAdr = USEX16(R15-1) | (USEX8(GSU.vPrgBankReg)<<16);
- #endif
- */
return (nInstructions - GSU.vInstCount);
}
@@ -3282,11 +3260,6 @@ static uint32_t fx_run_to_breakpoint(uint32_t nInstructions)
break;
}
}
- /*
- #ifndef FX_ADDRESS_CHECK
- GSU.vPipeAdr = USEX16(R15-1) | (USEX8(GSU.vPrgBankReg)<<16);
- #endif
- */
return vCounter;
}
@@ -3305,11 +3278,6 @@ static uint32_t fx_step_over(uint32_t nInstructions)
if (USEX16(R15) == GSU.vStepPoint)
break;
}
- /*
- #ifndef FX_ADDRESS_CHECK
- GSU.vPipeAdr = USEX16(R15-1) | (USEX8(GSU.vPrgBankReg)<<16);
- #endif
- */
return vCounter;
}
@@ -3555,4 +3523,3 @@ void (*fx_apfOpcodeTable[])() =
&fx_lm_r0, &fx_lm_r1, &fx_lm_r2, &fx_lm_r3, &fx_lm_r4, &fx_lm_r5, &fx_lm_r6, &fx_lm_r7,
&fx_lm_r8, &fx_lm_r9, &fx_lm_r10, &fx_lm_r11, &fx_lm_r12, &fx_lm_r13, &fx_lm_r14, &fx_lm_r15,
};
-
diff --git a/source/getset.h b/source/getset.h
index 813703f..8939e76 100644
--- a/source/getset.h
+++ b/source/getset.h
@@ -50,7 +50,6 @@ INLINE uint8_t S9xGetByte(uint32_t Address)
//unbound & SRAMMask = Sram offset
return (*(Memory.SRAM + ((((Address & 0xFF0000) >> 1) |
(Address & 0x7FFF)) &Memory.SRAMMask)));
- // return (*(Memory.SRAM + ((Address & Memory.SRAMMask))));
case MAP_RONLY_SRAM:
case MAP_HIROM_SRAM:
@@ -153,9 +152,6 @@ INLINE uint16_t S9xGetWord(uint32_t Address)
((*(Memory.SRAM + (((((Address + 1) & 0xFF0000) >> 1) | ((
Address + 1) & 0x7FFF)) &Memory.SRAMMask))) << 8);
- //return (*(uint16_t*)(Memory.SRAM + ((((Address&0xFF0000)>>1)|(Address&0x7FFF)) & Memory.SRAMMask));// |
- // (*(Memory.SRAM + ((Address + 1) & Memory.SRAMMask)) << 8));
-
case MAP_RONLY_SRAM:
case MAP_HIROM_SRAM:
/* BJ: no FAST_LSB_WORD_ACCESS here, since if Memory.SRAMMask=0x7ff
@@ -261,7 +257,6 @@ INLINE void S9xSetByte(uint8_t Byte, uint32_t Address)
{
*(Memory.SRAM + ((((Address & 0xFF0000) >> 1) | (Address & 0x7FFF))&
Memory.SRAMMask)) = Byte;
- // *(Memory.SRAM + (Address & Memory.SRAMMask)) = Byte;
CPU.SRAMModified = true;
}
return;
@@ -395,8 +390,6 @@ INLINE void S9xSetWord(uint16_t Word, uint32_t Address)
*(Memory.SRAM + (((((Address + 1) & 0xFF0000) >> 1) | ((
Address + 1) & 0x7FFF))& Memory.SRAMMask)) = Word >> 8;
- // *(Memory.SRAM + (Address & Memory.SRAMMask)) = (uint8_t) Word;
- // *(Memory.SRAM + ((Address + 1) & Memory.SRAMMask)) = Word >> 8;
CPU.SRAMModified = true;
}
return;
@@ -488,11 +481,9 @@ INLINE uint8_t* GetBasePointer(uint32_t Address)
case MAP_PPU:
//just a guess, but it looks like this should match the CPU as a source.
return (Memory.FillRAM);
- // return (Memory.FillRAM - 0x2000);
case MAP_CPU:
//fixes Ogre Battle's green lines
return (Memory.FillRAM);
- // return (Memory.FillRAM - 0x4000);
case MAP_DSP:
return (Memory.FillRAM - 0x6000);
case MAP_SA1RAM:
diff --git a/source/gfx.c b/source/gfx.c
index bc6edbc..bf018b7 100644
--- a/source/gfx.c
+++ b/source/gfx.c
@@ -266,8 +266,6 @@ bool S9xInitGFX()
GFX.ZPitch >>= 1;
GFX.Delta = (GFX.SubScreen - GFX.Screen) >> 1;
GFX.DepthDelta = GFX.SubZBuffer - GFX.ZBuffer;
- //GFX.InfoStringTimeout = 0;
- //GFX.InfoString = NULL;
PPU.BG_Forced = 0;
IPPU.OBJChanged = true;
@@ -854,13 +852,11 @@ void S9xSetupOBJ()
/* First, find out which sprites are on which lines */
uint8_t OBJOnLine[SNES_HEIGHT_EXTENDED][128];
- // memset(OBJOnLine, 0, sizeof(OBJOnLine));
- /* Hold on here, that's a lot of bytes to initialise at once!
- * So we only initialise them per line, as needed. [Neb]
+ /* We only initialise this per line, as needed. [Neb]
* Bonus: We can quickly avoid looping if a line has no OBJs.
*/
bool AnyOBJOnLine[SNES_HEIGHT_EXTENDED];
- memset(AnyOBJOnLine, false, sizeof(AnyOBJOnLine)); // better
+ memset(AnyOBJOnLine, false, sizeof(AnyOBJOnLine));
for (S = 0; S < 128; S++)
{
@@ -1515,7 +1511,6 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
for (Y = GFX.StartY; Y <= GFX.EndY; Y++)
{
uint32_t VOff = LineData [Y].BG[2].VOffset - 1;
- // uint32_t VOff = LineData [Y].BG[2].VOffset;
uint32_t HOff = LineData [Y].BG[2].HOffset;
int VirtAlign;
@@ -1573,7 +1568,6 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
uint32_t VOffset;
uint32_t HOffset;
- //added:
uint32_t LineHOffset = LineData [Y].BG[bg].HOffset;
uint32_t Offset;
@@ -1606,8 +1600,6 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
VOffset = LineData [Y].BG[bg].VOffset;
//MKendora; use temp var to reduce memory accesses
- //HOffset = LineData [Y].BG[bg].HOffset;
-
HOffset = LineHOffset;
//End MK
@@ -1632,8 +1624,7 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
{
VOffset = LineData [Y].BG[bg].VOffset;
- //MKendora another mem access hack
- //HOffset = LineData [Y].BG[bg].HOffset;
+ //MKendora; use temp var to reduce memory accesses
HOffset = LineHOffset;
//end MK
@@ -1655,17 +1646,9 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
//MKendora Strike Gunner fix
if ((HCellOffset & OffsetEnableMask))
- {
- //HOffset= HCellOffset;
-
HOffset = (HCellOffset & ~7) | (LineHOffset & 7);
- //HOffset |= LineData [Y].BG[bg].HOffset&7;
- }
else
HOffset = LineHOffset;
- //HOffset = LineData [Y].BG[bg].HOffset -
- //Settings.StrikeGunnerOffsetHack;
- //HOffset &= (~7);
//end MK
}
}
@@ -1715,7 +1698,6 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8
Offset = HPos & 7;
- //Count =1;
Count = 8 - Offset;
if (Count > MaxCount)
Count = MaxCount;
@@ -1816,19 +1798,12 @@ static void DrawBackgroundMode5(uint32_t bg, uint8_t Z1, uint8_t Z2)
int Lines;
-// int VOffsetMask;
int VOffsetShift;
if (BG.TileSize == 16)
- {
-// VOffsetMask = 0x3ff;
VOffsetShift = 4;
- }
else
- {
-// VOffsetMask = 0x1ff;
VOffsetShift = 3;
- }
int endy = IPPU.Interlace ? 1 + (GFX.EndY << 1) : GFX.EndY;
int Y;
@@ -2095,7 +2070,6 @@ static void DrawBackgroundMode5(uint32_t bg, uint8_t Z1, uint8_t Z2)
}
GFX.Pitch = IPPU.DoubleHeightPixels ? GFX.RealPitch * 2 : GFX.RealPitch;
GFX.PPL = IPPU.DoubleHeightPixels ? GFX.PPLx2 : (GFX.PPLx2 >> 1);
-
}
static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
@@ -2129,14 +2103,10 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2)
case 5:
case 6: // XXX: is also offset per tile.
- // if (Settings.SupportHiRes)
- // {
if (!Settings.SupportHiRes)
SelectTileRenderer(true /* normal */);
DrawBackgroundMode5(bg, Z1, Z2);
return;
- // }
- break;
}
uint32_t Tile;
@@ -3297,20 +3267,7 @@ void DisplayChar(uint8_t* Screen, uint8_t c)
uint8_t p = font [line][offset + w];
if (p == '#')
- {
- /*
- if(Memory.Hacked)
- *s= BUILD_PIXEL(31,0,0);
- else if(Memory.Iffy)
- *s= BUILD_PIXEL(31,31,0);
- else if(Memory.Iformat==1)
- *s= BUILD_PIXEL(0,31,0);
- else if(Memory.Iformat==2)
- *s= BUILD_PIXEL(0,31,31);
- else *s = 0xffff;
- */
*s = Settings.DisplayColor;
- }
else if (p == '.')
*s = BLACK;
}
@@ -3885,5 +3842,3 @@ void S9xUpdateScreen(void)
IPPU.PreviousLine = IPPU.CurrentLine;
}
-
-
diff --git a/source/gfx.h b/source/gfx.h
index 33e1747..663a4c3 100644
--- a/source/gfx.h
+++ b/source/gfx.h
@@ -21,11 +21,7 @@ extern struct SGFX GFX;
bool S9xInitGFX();
void S9xDeinitGFX();
bool S9xInitUpdate(void);
-#if 0
-void S9xSyncSpeed();
-#else
#define S9xSyncSpeed()
-#endif
struct SGFX
diff --git a/source/memmap.c b/source/memmap.c
index d4071fb..a24b2cd 100644
--- a/source/memmap.c
+++ b/source/memmap.c
@@ -24,12 +24,6 @@
#include "spc7110.h"
#include "seta.h"
-#ifdef DS2_DMA
-//#include "ds2_cpu.h"
-//#include "ds2_dma.h"
-//#include "dma_adj.h"
-#endif
-
#ifdef __W32_HEAP
#include <malloc.h>
#endif
@@ -347,9 +341,7 @@ bool S9xInitMemory()
memset(Memory.RAM, 0, 0x20000);
memset(Memory.SRAM, 0, 0x20000);
memset(Memory.VRAM, 0, 0x10000);
- // This needs to be initialised with a ROM first anyway, so don't
- // bother memsetting. [Neb]
- // memset (ROM, 0, MAX_ROM_SIZE + 0x200 + 0x8000);
+ // Don't bother memsetting ROM, we will load a game anyway. [Neb]
Memory.BSRAM = (uint8_t*) malloc(0x80000);
memset(Memory.BSRAM, 0, 0x80000);
@@ -954,8 +946,6 @@ again:
hi_score = hiromscore;
RomHeader = Memory.ROM;
}
-
-
}
Interleaved = Settings.ForceInterleaved || Settings.ForceInterleaved2;
@@ -1272,7 +1262,6 @@ void InitROM(bool Interleaved)
memset(Memory.BlockIsRAM, 0, MEMMAP_NUM_BLOCKS);
memset(Memory.BlockIsROM, 0, MEMMAP_NUM_BLOCKS);
- Memory.SRAM = Memory.SRAM;
memset(Memory.ROMId, 0, 5);
memset(Memory.CompanyId, 0, 3);
@@ -1356,11 +1345,8 @@ void InitROM(bool Interleaved)
SetaDSPMap();
else if (Settings.SuperFX)
{
- //::SRAM = ROM + 1024 * 1024 * 4;
SuperFXROMMap();
Settings.MultiPlayer5Master = false;
- //Settings.MouseMaster = false;
- //Settings.SuperScopeMaster = false;
Settings.DSP1Master = false;
Settings.SA1 = false;
Settings.C4 = false;
@@ -1371,9 +1357,6 @@ void InitROM(bool Interleaved)
(Memory.ROMType & 0xf) > 3 && (Memory.ROMType & 0xf0) == 0x30))
{
Settings.SA1 = true;
- // Settings.MultiPlayer5Master = false;
- //Settings.MouseMaster = false;
- //Settings.SuperScopeMaster = false;
Settings.DSP1Master = false;
Settings.C4 = false;
Settings.SDD1 = false;
@@ -1997,16 +1980,11 @@ void BSLoROMMap()
Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) Memory.RAM;
- // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t *) Memory.SRAM;
Memory.BlockIsRAM [c + 5] = Memory.BlockIsRAM [c + 0x805] = true;
- // Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t *)MAP_NONE;
- // Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t *)MAP_NONE;
Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) Memory.RAM;
- // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t *) SRAM;
Memory.BlockIsRAM [c + 6] = Memory.BlockIsRAM [c + 0x806] = true;
Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) Memory.RAM;
- // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t *) Memory.SRAM;
Memory.BlockIsRAM [c + 7] = Memory.BlockIsRAM [c + 0x807] = true;
for (i = c + 8; i < c + 16; i++)
{
@@ -2023,22 +2001,6 @@ void BSLoROMMap()
Memory.BlockIsRAM [(c << 4) + 0x105] = true;
}
-
- /* // Banks 40->7f and c0->ff
- for (c = 0; c < 0x400; c += 16)
- {
- for (i = c; i < c + 8; i++)
- Map [i + 0x400] = Map [i + 0xc00] = &ROM [(c << 11) % CalculatedSize];
-
- for (i = c + 8; i < c + 16; i++)
- Map [i + 0x400] = Map [i + 0xc00] = &ROM [((c << 11) + 0x200000) % CalculatedSize - 0x8000];
-
- for (i = c; i < c + 16; i++)
- {
- BlockIsROM [i + 0x400] = BlockIsROM [i + 0xc00] = true;
- }
- }
- */
for (c = 1; c <= 4; c++)
{
for (i = 0; i < 16; i++)
@@ -2074,8 +2036,6 @@ void BSLoROMMap()
}
MapRAM();
WriteProtectROM();
-
-
}
void HiROMMap()
@@ -2690,407 +2650,6 @@ void SufamiTurboLoROMMap()
WriteProtectROM();
}
-#if 0
-
-//untested!!
-void SameGameMap()
-{
- int i;
- int c;
- int j;
-
- int mask[4];
- int mask2[4];
- for (j = 0; j < 4; j++)
- mask[j] = mask2[j] = 0x00ff;
-
- mask[0] = (CalculatedSize / 0x10000) - 1;
- mask2[0] = (Slot1Size / 0x10000) - 1;
-
- int x;
- bool foundZeros;
- bool pastZeros;
-
- for (j = 0; j < 3; j++)
- {
- x = 1;
- foundZeros = false;
- pastZeros = false;
-
- mask[j + 1] = mask[j];
-
- while (x > 0x100 && !pastZeros)
- {
- if (mask[j]&x)
- {
- x <<= 1;
- if (foundZeros)
- pastZeros = true;
- }
- else
- {
- foundZeros = true;
- pastZeros = false;
- mask[j + 1] |= x;
- x <<= 1;
- }
- }
- }
-
- for (j = 0; j < 3; j++)
- {
- x = 1;
- foundZeros = false;
- pastZeros = false;
-
- mask2[j + 1] = mask2[j];
-
- while (x > 0x100 && !pastZeros)
- {
- if (mask2[j]&x)
- {
- x <<= 1;
- if (foundZeros)
- pastZeros = true;
- }
- else
- {
- foundZeros = true;
- pastZeros = false;
- mask2[j + 1] |= x;
- x <<= 1;
- }
- }
- }
-
-
- // Banks 00->3f and 80->bf
- for (c = 0; c < 0x400; c += 16)
- {
- Memory.Map [c + 0] = Memory.Map [c + 0x800] = RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
- Memory.Map [c + 1] = Memory.Map [c + 0x801] = RAM;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
-
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
-
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_NONE;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_NONE;
- }
-
- // Banks 30->3f and b0->bf, address ranges 6000->7fff is S-RAM.
- for (c = 0; c < 16; c++)
- {
- Memory.Map [0x306 + (c << 4)] = (uint8_t*) MAP_HIROM_SRAM;
- Memory.Map [0x307 + (c << 4)] = (uint8_t*) MAP_HIROM_SRAM;
- Memory.Map [0xb06 + (c << 4)] = (uint8_t*) MAP_HIROM_SRAM;
- Memory.Map [0xb07 + (c << 4)] = (uint8_t*) MAP_HIROM_SRAM;
- Memory.BlockIsRAM [0x306 + (c << 4)] = true;
- Memory.BlockIsRAM [0x307 + (c << 4)] = true;
- Memory.BlockIsRAM [0xb06 + (c << 4)] = true;
- Memory.BlockIsRAM [0xb07 + (c << 4)] = true;
- }
-
- for c = 0;
-c < 0x200;
-c += 16)
-{
- for (i = 0; i < 8; i++)
- {
- int e = 3;
- int d = c >> 4;
- while (d > mask[0])
- {
- d &= mask[e];
- e--;
- }
-
- int f = 3;
- int g = c >> 4;
- while (g > mask2[0])
- {
- g &= mask2[f];
- f--;
- }
-
- //stuff in HiROM areas
- Memory.Map[c + 0x400 + i] = &ROM[d * 0x10000];
- Memory.Map[c + 0xC00 + i] = &ROM[d * 0x10000];
- //MINI
- Memory.Map[c + 0x600 + i] = &ROMOffset1[g * 0x10000];
- Memory.Map[c + 0xE00 + i] = &ROMOffset1[g * 0x10000];
-
- }
- for (i = 8; i < 16; i++)
- {
- int e = 3;
- int d = c >> 4;
- while (d > mask[0])
- {
- d &= mask[e];
- e--;
- }
-
- int f = 3;
- int g = c >> 4;
- while (g > mask2[0])
- {
- g &= mask2[f];
- f--;
- }
-
-
- //all stuff
- //BASE
- Memory.Map[c + i] = &ROM[d * 0x10000];
- Memory.Map[c + 0x800 + i] = &ROM[d * 0x10000];
- Memory.Map[c + 0x400 + i] = &ROM[d * 0x10000];
- Memory.Map[c + 0xC00 + i] = &ROM[d * 0x10000];
- //MINI
- Memory.Map[c + 0x200 + i] = &ROMOffset1[g * 0x10000];
- Memory.Map[c + 0xA00 + i] = &ROMOffset1[g * 0x10000];
- Memory.Map[c + 0x600 + i] = &ROMOffset1[g * 0x10000];
- Memory.Map[c + 0xE00 + i] = &ROMOffset1[g * 0x10000];
- }
-
- }
-
- int bankmax = 0x40 + (1 << (ROMSize - 6));
- //safety for corrupt headers
- if (bankmax > 128)
- bankmax = 0x80;
- int sum = 0;
- for (i = 0x40; i < bankmax; i++)
-{
- uint8_t* bank_low = (uint8_t*)Memory.Map[i << 4];
- for (c = 0; c < 0x10000; c++)
- sum += bank_low[c];
- }
- CalculatedChecksum = sum & 0xFFFF;
-
- MapRAM();
- WriteProtectROM();
-}
-
-
-//Untested!!
-void GNextROMMap()
-{
- int c;
- int i;
-
- // Banks 00->3f and 80->bf
- for (c = 0; c < 0x400; c += 16)
- {
- Memory.Map [c + 0] = Memory.Map [c + 0x800] = RAM;
- Memory.Map [c + 1] = Memory.Map [c + 0x801] = RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
-
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) &Memory.FillRAM [0x3000]
- - 0x3000;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_BWRAM;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_BWRAM;
- for (i = c + 8; i < c + 16; i++)
- {
- Memory.Map [i] = Memory.Map [i + 0x800] = &ROM [c << 11] - 0x8000;
- BlockIsROM [i] = BlockIsROM [i + 0x800] = true;
- }
- }
-
-
- // Banks 40->4f (was 7f, but SNES docs and GNext overdumping shows nothing here.)
- for (c = 0; c < 0x100; c += 16)
- {
- for (i = c; i < c + 16; i++)
- Memory.Map [i + 0x400] = (uint8_t*) &SRAM [(c << 12) & 0x1ffff];
-
- for (i = c; i < c + 16; i++)
- BlockIsROM [i + 0x400] = false;
- }
-
- for (c = 0; c < 0x100; c += 16)
- {
- for (i = c; i < c + 16; i++)
- Memory.Map [i + 0x700] = (uint8_t*) &ROMOffset1 [(c << 12) & (Slot1Size - 1)];
- }
-
- // c0->ff
- for (c = 0; c < 0x400; c += 16)
- {
- for (i = c; i < c + 16; i++)
- {
- Memory.Map [i + 0xc00] = &ROM [(c << 12) % CalculatedSize];
- BlockIsROM [i + 0xc00] = true;
- }
- }
-
- for (c = 0; c < 16; c++)
- {
- Memory.Map [c + 0x7e0] = RAM;
- Memory.Map [c + 0x7f0] = RAM + 0x10000;
- Memory.BlockIsRAM [c + 0x7e0] = true;
- Memory.BlockIsRAM [c + 0x7f0] = true;
- BlockIsROM [c + 0x7e0] = false;
- BlockIsROM [c + 0x7f0] = false;
- }
- WriteProtectROM();
-
- // Now copy the map and correct it for the SA1 CPU.
- // memmove converted: Different mallocs [Neb]
- memcpy((void*) SA1.WriteMap, (void*) WriteMap, sizeof(WriteMap));
- // memmove converted: Different mallocs [Neb]
- memcpy((void*) SA1.Map, (void*) Memory.Map, sizeof(Memory.Map));
-
- // Banks 00->3f and 80->bf
- for (c = 0; c < 0x400; c += 16)
- {
- SA1.Map [c + 0] = SA1.Map [c + 0x800] = &Memory.FillRAM [0x3000];
- SA1.Map [c + 1] = SA1.Map [c + 0x801] = (uint8_t*) MAP_NONE;
- SA1.WriteMap [c + 0] = SA1.WriteMap [c + 0x800] = &Memory.FillRAM [0x3000];
- SA1.WriteMap [c + 1] = SA1.WriteMap [c + 0x801] = (uint8_t*) MAP_NONE;
- }
-
- // Banks 60->6f
- for (c = 0; c < 0x100; c++)
- SA1.Map [c + 0x600] = SA1.WriteMap [c + 0x600] = (uint8_t*) MAP_BWRAM_BITMAP;
-
- BWRAM = SRAM;
-}
-
-void SufamiTurboAltROMMap()
-{
- int c;
- int i;
-
- if (Slot1Size != 0)
- Slot1SRAMSize = (1 << ((uint8_t)ROMOffset1[0x32])) * 1024;
- else Slot1Size = 0x8000;
- if (Slot2Size != 0)
- Slot2SRAMSize = (1 << ((uint8_t)ROMOffset2[0x32])) * 1024;
- else Slot2Size = 0x8000;
-
- // Banks 00->3f and 80->bf
- for (c = 0; c < 0x400; c += 16)
- {
- Memory.Map [c + 0] = Memory.Map [c + 0x800] = RAM;
- Memory.Map [c + 1] = Memory.Map [c + 0x801] = RAM;
- Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true;
- Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true;
-
- Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU;
- Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU;
- Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
- Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
- Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_NONE;
- Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_NONE;
-
- // for (i = c + 8; i < c + 16; i++)
- // {
- // Memory.Map [i] = Memory.Map [i + 0x800] = &ROM [c << 11] - 0x8000;
- // BlockIsROM [i] = BlockIsROM [i + 0x800] = true;
- // }
-
- }
-
- //Map Bios
-
- for (c = 0; c < 0x200; c += 16)
- {
- for (i = c + 8; i < c + 16; i++)
- {
- Memory.Map [i] = Memory.Map [i + 0x800] = &ROM [((c >> 4) * 0x8000) %
- CalculatedSize] - 0x8000;
- BlockIsROM [i] = BlockIsROM [i + 0x800] = true;
- }
-
- }
-
-
- for (c = 0x200; c < 0x400; c += 16)
- {
- for (i = c + 8; i < c + 16; i++)
- {
- if (Slot1Size != 0)
- {
- Memory.Map [i] = Memory.Map [i + 0x800] = &ROMOffset1 [(((
- c >> 4) * 0x8000) % Slot1Size)] - 0x8000;
- BlockIsROM [i] = BlockIsROM [i + 0x800] = true;
- }
- else Memory.Map [i] = Memory.Map [i + 0x800] = (uint8_t*)MAP_NONE;
- }
-
- }
-
- for (c = 0x400; c < 0x600; c += 16)
- {
- for (i = c; i < c + 8; i++)
- {
- if (Slot2Size != 0)
- {
- Memory.Map [i] = Memory.Map [i + 0x800] = &ROMOffset2[(((
- c >> 4) * 0x8000) % Slot2Size)];
- BlockIsROM [i] = BlockIsROM [i + 0x800] = true;
- }
- else Memory.Map [i] = Memory.Map [i + 0x800] = (uint8_t*)MAP_NONE;
-
- }
- for (i = c + 8; i < c + 16; i++)
- {
- if (Slot2Size != 0)
- {
- Memory.Map [i] = Memory.Map [i + 0x800] = &ROMOffset2[(((
- c >> 4) * 0x8000) % Slot2Size)] - 0x8000;
- BlockIsROM [i] = BlockIsROM [i + 0x800] = true;
- }
- else Memory.Map [i] = Memory.Map [i + 0x800] = (uint8_t*)MAP_NONE;
-
- }
-
- }
-
- // Banks 60->67 (7F?), S-RAM
- if (Slot1SRAMSize != 0)
- {
- for (c = 0; c < 0x100; c++)
- {
- Memory.Map [c + 0xE00] = Memory.Map [c + 0x600] = (uint8_t*) MAP_LOROM_SRAM;
- Memory.BlockIsRAM [c + 0xE00] = Memory.BlockIsRAM [c + 0x600] = true;
- BlockIsROM [c + 0xE00] = BlockIsROM [c + 0x600] = false;
- }
- }
- if (Slot2SRAMSize != 0)
- {
- for (c = 0; c < 0x100; c++)
- {
- Memory.Map [c + 0xF00] = Memory.Map [c + 0x700] = (uint8_t*) MAP_LOROM_SRAM;
- Memory.BlockIsRAM [c + 0xF00] = Memory.BlockIsRAM [c + 0x700] = true;
- BlockIsROM [c + 0xF00] = BlockIsROM [c + 0x700] = false;
- }
- }
-
- // Banks 7e->7f, RAM
- for (c = 0; c < 16; c++)
- {
- Memory.Map [c + 0x7e0] = RAM;
- Memory.Map [c + 0x7f0] = RAM + 0x10000;
- Memory.BlockIsRAM [c + 0x7e0] = true;
- Memory.BlockIsRAM [c + 0x7f0] = true;
- BlockIsROM [c + 0x7e0] = false;
- BlockIsROM [c + 0x7f0] = false;
- }
-
- WriteProtectROM();
-}
-#endif
-
-
void SRAM512KLoROMMap()
{
int c;
@@ -3157,16 +2716,11 @@ void BSHiROMMap()
Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
// XXX: How large is SRAM??
Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) Memory.RAM;
- // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t *) SRAM;
Memory.BlockIsRAM [c + 5] = Memory.BlockIsRAM [c + 0x805] = true;
- // Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t *) MAP_NONE;
- // Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t *) MAP_NONE;
Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) Memory.RAM;
- // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t *) SRAM;
Memory.BlockIsRAM [c + 6] = Memory.BlockIsRAM [c + 0x806] = true;
Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) Memory.RAM;
- // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t *) Memory.SRAM;
Memory.BlockIsRAM [c + 7] = Memory.BlockIsRAM [c + 0x807] = true;
for (i = c + 8; i < c + 16; i++)
@@ -3233,13 +2787,11 @@ void JumboLoROMMap(bool Interleaved)
int i;
uint32_t OFFSET0 = 0x400000;
-// uint32_t OFFSET1 = 0x400000;
uint32_t OFFSET2 = 0x000000;
if (Interleaved)
{
OFFSET0 = 0x000000;
-// OFFSET1 = 0x000000;
OFFSET2 = Memory.CalculatedSize -
0x400000; //changed to work with interleaved DKJM2.
}
@@ -3350,8 +2902,8 @@ void SPC7110HiROMMap()
Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU;
Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU;
- Memory.Map [c + 6] /*= Memory.Map [c + 0x806]*/ = (uint8_t*) MAP_HIROM_SRAM;
- Memory.Map [c + 7] /*= Memory.Map [c + 0x807]*/ = (uint8_t*) MAP_HIROM_SRAM;
+ Memory.Map [c + 6] = (uint8_t*) MAP_HIROM_SRAM;
+ Memory.Map [c + 7] = (uint8_t*) MAP_HIROM_SRAM;
Memory.Map [c + 0x806] = Memory.Map [c + 0x807] = (uint8_t*) MAP_NONE;
for (i = c + 8; i < c + 16; i++)
@@ -3371,8 +2923,6 @@ void SPC7110HiROMMap()
Memory.Map [0xb07 + (c << 4)] = (uint8_t*) MAP_NONE;
Memory.BlockIsRAM [0x306 + (c << 4)] = true;
Memory.BlockIsRAM [0x307 + (c << 4)] = true;
- // Memory.BlockIsRAM [0xb06 + (c << 4)] = true;
- // Memory.BlockIsRAM [0xb07 + (c << 4)] = true;
}
// Banks 40->7f and c0->ff
@@ -3422,8 +2972,6 @@ void SPC7110Sram(uint8_t newstate)
Memory.Map[7] = (uint8_t*)MAP_HIROM_SRAM;
Memory.Map[0x306] = (uint8_t*)MAP_HIROM_SRAM;
Memory.Map[0x307] = (uint8_t*)MAP_HIROM_SRAM;
-
-
}
else
{
@@ -3796,9 +3344,6 @@ void ApplyROMFixes()
Settings.H_Max = (SNES_CYCLES_PER_SCANLINE *
Settings.CyclesPercentage) / 100;
- //no need to ifdef for right now...
- //#ifdef HDMA_HACKS
-
// A Couple of HDMA related hacks - Lantus
if ((strcmp(Memory.ROMName, "SFX SUPERBUTOUDEN2") == 0) ||
(strcmp(Memory.ROMName, "ALIEN vs. PREDATOR") == 0) ||
@@ -3809,10 +3354,6 @@ void ApplyROMFixes()
if (strcmp(Memory.ROMName, "HOME IMPROVEMENT") == 0)
Settings.H_Max = (SNES_CYCLES_PER_SCANLINE * 200) / 100;
- // End HDMA hacks
- //#endif
-
-
if (strcmp(Memory.ROMId, "ASRJ") == 0 && Settings.CyclesPercentage == 100)
// Street Racer
Settings.H_Max = (SNES_CYCLES_PER_SCANLINE * 95) / 100;
@@ -4048,27 +3589,10 @@ void ApplyROMFixes()
strcmp(Memory.ROMName, "goemon 4") == 0)
SNESGameFixes.SRAMInitialValue = 0x00;
-#if 0
- if (strcmp(Memory.ROMName, "XBAND JAPANESE MODEM") == 0)
- {
- for (c = 0x200; c < 0x400; c += 16)
- {
- for (int i = c; i < c + 16; i++)
- {
- Memory.Map [i + 0x400] = Memory.Map [i + 0xc00] = &ROM[c * 0x1000];
- Memory.BlockIsRAM [i + 0x400] = Memory.BlockIsRAM [i + 0xc00] = true;
- BlockIsROM [i + 0x400] = BlockIsROM [i + 0xc00] = false;
- }
- }
- WriteProtectROM();
- }
-#endif
-
#define RomPatch(adr,ov,nv) \
if (Memory.ROM [adr] == ov) \
Memory.ROM [adr] = nv
-
// Love Quest
if (strcmp(Memory.ROMName, "LOVE QUEST") == 0)
{
@@ -4196,4 +3720,3 @@ void ParseSNESHeader(uint8_t* RomHeader)
#undef INLINE
#define INLINE
#include "getset.h"
-
diff --git a/source/memmap.h b/source/memmap.h
index be69556..788c30a 100644
--- a/source/memmap.h
+++ b/source/memmap.h
@@ -70,7 +70,6 @@ void JumboLoROMMap(bool);
void LoROMMap();
void LoROM24MBSMap();
void SRAM512KLoROMMap();
-// void SRAM1024KLoROMMap ();
void SufamiTurboLoROMMap();
void HiROMMap();
void SuperFXROMMap();
@@ -144,9 +143,6 @@ typedef struct
uint32_t ROMCRC32;
uint8_t ExtendedFormat;
uint8_t* BSRAM;
-#if 0
- bool LoadMulti(const char*, const char*, const char*);
-#endif
} CMemory;
void ResetSpeedMap();
@@ -173,4 +169,3 @@ extern uint8_t OpenBus;
#endif // NO_INLINE_SET_GET
#endif // _memmap_h_
-
diff --git a/source/messages.h b/source/messages.h
index c343894..00776ca 100644
--- a/source/messages.h
+++ b/source/messages.h
@@ -49,4 +49,3 @@ enum
};
#endif
-
diff --git a/source/obc1.h b/source/obc1.h
index aa5ecd6..7d478f0 100644
--- a/source/obc1.h
+++ b/source/obc1.h
@@ -7,7 +7,7 @@ uint8_t GetOBC1(uint16_t Address);
void SetOBC1(uint8_t Byte, uint16_t Address);
uint8_t* GetBasePointerOBC1(uint32_t Address);
uint8_t* GetMemPointerOBC1(uint32_t Address);
-void ResetOBC1();//bool full);
+void ResetOBC1();
#endif
diff --git a/source/port.h b/source/port.h
index 2844e06..125d656 100644
--- a/source/port.h
+++ b/source/port.h
@@ -52,9 +52,6 @@ void S9xGenerateSound(void);
// On little-endian MIPS, a 16-bit word can be read directly from an address
// only if it's aligned.
#define FAST_ALIGNED_LSB_WORD_ACCESS
-#else
-//#define MSB_FIRST
-//#define FAST_LSB_WORD_ACCESS
#endif
#include <libretro.h>
diff --git a/source/ppu.c b/source/ppu.c
index 1b56bd7..8d66685 100644
--- a/source/ppu.c
+++ b/source/ppu.c
@@ -27,19 +27,11 @@ void S9xLatchCounters(bool force)
{
if (!force && !(Memory.FillRAM[0x4213] & 0x80)) return;
-#if 0
-# ifdef CPU_SHUTDOWN
- CPU.WaitAddress = CPU.PCAtOpcodeStart;
-# endif
-#endif
PPU.HVBeamCounterLatched = 1;
PPU.VBeamPosLatched = (uint16_t) CPU.V_Counter;
PPU.HBeamPosLatched = (uint16_t)((CPU.Cycles * SNES_HCOUNTER_MAX) /
Settings.H_Max);
- // Causes screen flicker for Yoshi's Island if uncommented
- //CLEAR_IRQ_SOURCE (PPU_V_BEAM_IRQ_SOURCE | PPU_H_BEAM_IRQ_SOURCE);
-
Memory.FillRAM [0x213F] |= 0x40;
}
@@ -173,7 +165,6 @@ static void S9xSetSuperFX(uint8_t Byte, uint16_t Address)
/******************************************************************************/
void S9xSetPPU(uint8_t Byte, uint16_t Address)
{
- // fprintf(stderr, "%03d: %02x to %04x\n", CPU.V_Counter, Byte, Address);
if (Address <= 0x2183)
{
switch (Address)
@@ -325,49 +316,41 @@ void S9xSetPPU(uint8_t Byte, uint16_t Address)
//TEST9 if(last_written != 0x210d) PPU.BGnxOFSbyte = 0;
PPU.BG[0].HOffset = (Byte << 8) | PPU.BGnxOFSbyte;
PPU.BGnxOFSbyte = Byte;
- // fprintf(stderr, "%02x to %04x (PPU.BG[0].HOffset = %04x %d)\n", Byte, Address, PPU.BG[0].HOffset, CPU.V_Counter);
break;
case 0x210E:
PPU.BG[0].VOffset = (Byte << 8) | PPU.BGnxOFSbyte;
PPU.BGnxOFSbyte = Byte;
- // fprintf(stderr, "%02x to %04x (PPU.BG[0].VOffset = %04x %d)\n", Byte, Address, PPU.BG[0].VOffset, CPU.V_Counter);
break;
case 0x210F:
PPU.BG[1].HOffset = (Byte << 8) | PPU.BGnxOFSbyte;
PPU.BGnxOFSbyte = Byte;
- // fprintf(stderr, "%02x to %04x (PPU.BG[1].HOffset = %04x %d)\n", Byte, Address, PPU.BG[1].HOffset, CPU.V_Counter);
break;
case 0x2110:
PPU.BG[1].VOffset = (Byte << 8) | PPU.BGnxOFSbyte;
PPU.BGnxOFSbyte = Byte;
- // fprintf(stderr, "%02x to %04x (PPU.BG[1].VOffset = %04x %d)\n", Byte, Address, PPU.BG[1].VOffset, CPU.V_Counter);
break;
case 0x2111:
PPU.BG[2].HOffset = (Byte << 8) | PPU.BGnxOFSbyte;
PPU.BGnxOFSbyte = Byte;
- // fprintf(stderr, "%02x to %04x (PPU.BG[2].HOffset = %04x %d)\n", Byte, Address, PPU.BG[2].HOffset, CPU.V_Counter);
break;
case 0x2112:
PPU.BG[2].VOffset = (Byte << 8) | PPU.BGnxOFSbyte;
PPU.BGnxOFSbyte = Byte;
- // fprintf(stderr, "%02x to %04x (PPU.BG[2].VOffset = %04x %d)\n", Byte, Address, PPU.BG[2].VOffset, CPU.V_Counter);
break;
case 0x2113:
PPU.BG[3].HOffset = (Byte << 8) | PPU.BGnxOFSbyte;
PPU.BGnxOFSbyte = Byte;
- // fprintf(stderr, "%02x to %04x (PPU.BG[3].HOffset = %04x %d)\n", Byte, Address, PPU.BG[3].HOffset, CPU.V_Counter);
break;
case 0x2114:
PPU.BG[3].VOffset = (Byte << 8) | PPU.BGnxOFSbyte;
PPU.BGnxOFSbyte = Byte;
- // fprintf(stderr, "%02x to %04x (PPU.BG[3].VOffset = %04x %d)\n", Byte, Address, PPU.BG[3].VOffset, CPU.V_Counter);
break;
//end Theme Park
@@ -392,7 +375,6 @@ void S9xSetPPU(uint8_t Byte, uint16_t Address)
{
static uint16_t IncCount [4] = { 0, 32, 64, 128 };
static uint16_t Shift [4] = { 0, 5, 6, 7 };
- // PPU.VMA.Increment = 1;
uint8_t i = (Byte & 0x0c) >> 2;
PPU.VMA.FullGraphicCount = IncCount [i];
PPU.VMA.Mask1 = IncCount [i] * 8 - 1;
@@ -692,8 +674,6 @@ void S9xSetPPU(uint8_t Byte, uint16_t Address)
}
else PPU.ScreenHeight = SNES_HEIGHT;
- //if((Byte & 1)&&(PPU.BGMode==5||PPU.BGMode==6))
- //IPPU.Interlace=1;
if ((Memory.FillRAM [0x2133] ^ Byte) & 3)
{
FLUSH_REDRAW();
@@ -702,7 +682,6 @@ void S9xSetPPU(uint8_t Byte, uint16_t Address)
if (PPU.BGMode == 5 || PPU.BGMode == 6)
IPPU.Interlace = Byte & 1;
IPPU.InterlaceSprites = 0;
- // IPPU.InterlaceSprites = (Byte&2)>>1;
}
}
@@ -803,7 +782,6 @@ void S9xSetPPU(uint8_t Byte, uint16_t Address)
#ifdef SPCTOOL
_SPCInPB(Address & 3, Byte);
#else
- // CPU.Flags |= DEBUG_MODE_FLAG;
Memory.FillRAM [Address] = Byte;
IAPU.RAM [(Address & 3) + 0xf4] = Byte;
#ifdef SPC700_SHUTDOWN
@@ -865,7 +843,7 @@ void S9xSetPPU(uint8_t Byte, uint16_t Address)
/******************************************************************************/
uint8_t S9xGetPPU(uint16_t Address)
{
- uint8_t byte = OpenBus;
+ uint8_t byte;
if (Address < 0x2100) //not a real PPU reg
return OpenBus; //treat as unmapped memory returning last byte on the bus
if (Address <= 0x2190)
@@ -1190,16 +1168,12 @@ uint8_t S9xGetPPU(uint16_t Address)
#ifdef SPCTOOL
return ((uint8_t) _SPCOutP [Address & 3]);
#else
- // CPU.Flags |= DEBUG_MODE_FLAG;
#ifdef SPC700_SHUTDOWN
IAPU.APUExecuting = Settings.APUEnabled;
IAPU.WaitCounter++;
#endif
if (Settings.APUEnabled)
{
-#ifdef CPU_SHUTDOWN
- // CPU.WaitAddress = CPU.PCAtOpcodeStart;
-#endif
if (SNESGameFixes.APU_OutPorts_ReturnValueFix &&
Address >= 0x2140 && Address <= 0x2143 && !CPU.V_Counter)
{
@@ -1267,13 +1241,10 @@ uint8_t S9xGetPPU(uint16_t Address)
case 0x21c2:
if (Model->_5C77 == 2)
return (0x20);
-
- // fprintf(stderr, "Read from $21c2!\n");
return OpenBus;
case 0x21c3:
if (Model->_5C77 == 2)
return (0);
- // fprintf(stderr, "Read from $21c3!\n");
return OpenBus;
case 0x2800:
// For Dai Kaijyu Monogatari II
@@ -1291,8 +1262,6 @@ uint8_t S9xGetPPU(uint16_t Address)
byte = Memory.FillRAM [Address];
- //if (Address != 0x3030 && Address != 0x3031)
- //printf ("%04x\n", Address);
#ifdef CPU_SHUTDOWN
if (Address == 0x3030)
CPU.WaitAddress = CPU.PCAtOpcodeStart;
@@ -1305,7 +1274,6 @@ uint8_t S9xGetPPU(uint16_t Address)
}
return (byte);
}
- // fprintf(stderr, "%03d: %02x from %04x\n", CPU.V_Counter, byte, Address);
return (byte);
}
@@ -1316,7 +1284,6 @@ uint8_t S9xGetPPU(uint16_t Address)
void S9xSetCPU(uint8_t byte, uint16_t Address)
{
int d;
- // fprintf(stderr, "%03d: %02x to %04x\n", CPU.V_Counter, byte, Address);
if (Address < 0x4200)
{
@@ -1345,7 +1312,6 @@ void S9xSetCPU(uint8_t byte, uint16_t Address)
// NMI, V & H IRQ and joypad reading enable flags
if (byte & 0x20)
{
- //if(!SNESGameFixes.umiharakawaseFix && PPU.IRQVBeamPos==262) fprintf(stderr, "PPU.IRQVBeamPos = %d, CPU.V_Counter = %d\n", PPU.IRQVBeamPos, CPU.V_Counter);
if (!PPU.VTimerEnabled)
{
PPU.VTimerEnabled = true;
@@ -1358,8 +1324,6 @@ void S9xSetCPU(uint8_t byte, uint16_t Address)
else
{
PPU.VTimerEnabled = false;
- // if (SNESGameFixes.umiharakawaseFix)
- // byte &= ~0x20;
}
if (byte & 0x10)
@@ -1736,11 +1700,7 @@ void S9xSetCPU(uint8_t byte, uint16_t Address)
case 0x435B:
case 0x436B:
case 0x437B:
-
// Unknown, but they seem to be RAM-ish
-#if 0
- fprintf(stderr, "Write %02x to %04x!\n", byte, Address);
-#endif
break;
//These registers are used by both the S-DD1 and the SPC7110
@@ -1750,14 +1710,12 @@ void S9xSetCPU(uint8_t byte, uint16_t Address)
case 0x4803:
if (Settings.SPC7110)
S9xSetSPC7110(byte, Address);
- //printf ("%02x->%04x\n", byte, Address);
break;
case 0x4804:
case 0x4805:
case 0x4806:
case 0x4807:
- //printf ("%02x->%04x\n", byte, Address);
if (Settings.SPC7110)
S9xSetSPC7110(byte, Address);
else S9xSetSDD1MemoryMap(Address - 0x4804, byte & 7);
@@ -1822,7 +1780,6 @@ void S9xSetCPU(uint8_t byte, uint16_t Address)
uint8_t S9xGetCPU(uint16_t Address)
{
uint8_t byte;
- // fprintf(stderr, "read from %04x\n", Address);
if (Address < 0x4200)
{
@@ -1845,9 +1802,7 @@ uint8_t S9xGetCPU(uint16_t Address)
}
int ind = Settings.SwapJoypads ? 1 : 0;
- byte = IPPU.Joypads[ind] >> (PPU.Joypad1ButtonReadPos ^ 15);
- PPU.Joypad1ButtonReadPos++;
- return (byte & 1);
+ return (IPPU.Joypads[ind] >> (PPU.Joypad1ButtonReadPos++ ^ 15)) & 1;
}
case 0x4017:
{
@@ -1890,8 +1845,7 @@ uint8_t S9xGetCPU(uint16_t Address)
return (byte);
}
}
- else if (IPPU.Controller == SNES_JUSTIFIER
- || IPPU.Controller == SNES_JUSTIFIER_2)
+ else if (IPPU.Controller == SNES_JUSTIFIER || IPPU.Controller == SNES_JUSTIFIER_2)
{
uint8_t rv;
rv = (1 & (justifiers >> in_bit));
@@ -1904,7 +1858,6 @@ uint8_t S9xGetCPU(uint16_t Address)
default:
return OpenBus;
}
- // return (Memory.FillRAM [Address]);
}
else
switch (Address)
@@ -2107,7 +2060,6 @@ uint8_t S9xGetCPU(uint16_t Address)
case 0x435B:
case 0x436B:
case 0x437B:
-
// Unknown, but they seem to be RAM-ish
return (Memory.FillRAM[Address]);
@@ -2120,7 +2072,6 @@ uint8_t S9xGetCPU(uint16_t Address)
return OpenBus;
}
- // return (Memory.FillRAM[Address]);
}
static void CommonPPUReset()
@@ -2330,16 +2281,6 @@ void S9xResetPPU()
void S9xSoftResetPPU()
{
CommonPPUReset();
- // PPU.Joypad1ButtonReadPos = 0;
- // PPU.Joypad2ButtonReadPos = 0;
- // PPU.Joypad3ButtonReadPos = 0;
-
- // IPPU.Joypads[0] = IPPU.Joypads[1] = IPPU.Joypads[2] = 0;
- // IPPU.Joypads[3] = IPPU.Joypads[4] = 0;
- // IPPU.SuperScope = 0;
- // IPPU.Mouse[0] = IPPU.Mouse[1] = 0;
- // IPPU.PrevMouseX[0] = IPPU.PrevMouseX[1] = 256 / 2;
- // IPPU.PrevMouseY[0] = IPPU.PrevMouseY[1] = 224 / 2;
int c;
for (c = 0; c < 0x8000; c += 0x100)
@@ -2508,18 +2449,12 @@ void S9xUpdateJustifiers()
{
static bool last_p1;
in_bit = 0;
- // static int p1count;
justifiers = 0xFFFF00AA;
bool offscreen = JustifierOffscreen();
JustifierButtons(&justifiers);
- // if(p1count==32)
- // {
last_p1 = !last_p1;
- // p1count=0;
- // }
- // p1count++;
if (!last_p1)
justifiers |= 0x1000;
@@ -2617,8 +2552,6 @@ void S9xUpdateJoypads()
for (i = 0; i < 5; i++)
IPPU.Joypads [i] = S9xReadJoypad(i);
- // S9xMovieUpdate();
-
for (i = 0; i < 5; i++)
{
if ((IPPU.Joypads [i] & (SNES_LEFT_MASK | SNES_RIGHT_MASK)) ==
@@ -2851,7 +2784,6 @@ void REGISTER_2118(uint8_t Byte)
IPPU.TileCached [TILE_8BIT][address >> 6] = false;
if (!PPU.VMA.High)
PPU.VMA.Address += PPU.VMA.Increment;
- // Memory.FillRAM [0x2118] = Byte;
}
void REGISTER_2118_tile(uint8_t Byte)
@@ -2867,7 +2799,6 @@ void REGISTER_2118_tile(uint8_t Byte)
IPPU.TileCached [TILE_8BIT][address >> 6] = false;
if (!PPU.VMA.High)
PPU.VMA.Address += PPU.VMA.Increment;
- // Memory.FillRAM [0x2118] = Byte;
}
void REGISTER_2118_linear(uint8_t Byte)
@@ -2879,7 +2810,6 @@ void REGISTER_2118_linear(uint8_t Byte)
IPPU.TileCached [TILE_8BIT][address >> 6] = false;
if (!PPU.VMA.High)
PPU.VMA.Address += PPU.VMA.Increment;
- // Memory.FillRAM [0x2118] = Byte;
}
void REGISTER_2119(uint8_t Byte)
@@ -2900,7 +2830,6 @@ void REGISTER_2119(uint8_t Byte)
IPPU.TileCached [TILE_8BIT][address >> 6] = false;
if (PPU.VMA.High)
PPU.VMA.Address += PPU.VMA.Increment;
- // Memory.FillRAM [0x2119] = Byte;
}
void REGISTER_2119_tile(uint8_t Byte)
@@ -2915,7 +2844,6 @@ void REGISTER_2119_tile(uint8_t Byte)
IPPU.TileCached [TILE_8BIT][address >> 6] = false;
if (PPU.VMA.High)
PPU.VMA.Address += PPU.VMA.Increment;
- // Memory.FillRAM [0x2119] = Byte;
}
void REGISTER_2119_linear(uint8_t Byte)
@@ -2927,7 +2855,6 @@ void REGISTER_2119_linear(uint8_t Byte)
IPPU.TileCached [TILE_8BIT][address >> 6] = false;
if (PPU.VMA.High)
PPU.VMA.Address += PPU.VMA.Increment;
- // Memory.FillRAM [0x2119] = Byte;
}
void REGISTER_2122(uint8_t Byte)
@@ -2966,7 +2893,6 @@ void REGISTER_2122(uint8_t Byte)
}
}
PPU.CGFLIP ^= 1;
- // Memory.FillRAM [0x2122] = Byte;
}
void REGISTER_2180(uint8_t Byte)
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;
}
}
diff --git a/source/sa1.h b/source/sa1.h
index bb79a53..84ec94a 100644
--- a/source/sa1.h
+++ b/source/sa1.h
@@ -35,7 +35,6 @@ typedef struct
uint8_t IRQActive;
bool WaitingForInterrupt;
bool Waiting;
- // uint8_t WhichEvent;
uint8_t* PC;
uint8_t* PCBase;
uint8_t* BWRAM;
@@ -44,9 +43,6 @@ typedef struct
uint32_t WaitCounter;
uint8_t* WaitByteAddress1;
uint8_t* WaitByteAddress2;
- // long Cycles;
- // long NextEvent;
- // long V_Counter;
uint8_t* Map [MEMMAP_NUM_BLOCKS];
uint8_t* WriteMap [MEMMAP_NUM_BLOCKS];
int16_t op1;
@@ -92,7 +88,6 @@ extern SSA1 SA1;
void S9xSA1MainLoop();
void S9xSA1Init();
void S9xFixSA1AfterSnapshotLoad();
-void S9xSA1ExecuteDuringSleep();
#define SNES_IRQ_SOURCE (1 << 7)
#define TIMER_IRQ_SOURCE (1 << 6)
diff --git a/source/sa1cpu.c b/source/sa1cpu.c
index 2579be8..40cbd0e 100644
--- a/source/sa1cpu.c
+++ b/source/sa1cpu.c
@@ -109,7 +109,6 @@
#define TRB16 SA1TRB16
#define TRB8 SA1TRB8
-//#undef CPU_SHUTDOWN
#undef VAR_CYCLES
#define SA1_OPCODES
@@ -119,18 +118,6 @@ void S9xSA1MainLoop()
{
int i;
-#if 0
- if (SA1.Flags & NMI_FLAG)
- {
- SA1.Flags &= ~NMI_FLAG;
- if (SA1.WaitingForInterrupt)
- {
- SA1.WaitingForInterrupt = false;
- SA1.PC++;
- }
- S9xSA1Opcode_NMI();
- }
-#endif
if (SA1.Flags & IRQ_PENDING_FLAG)
{
if (SA1.IRQActive)
diff --git a/source/sdd1emu.h b/source/sdd1emu.h
index 0f58938..a968f7d 100644
--- a/source/sdd1emu.h
+++ b/source/sdd1emu.h
@@ -3,8 +3,6 @@
#ifndef SDD1EMU_H
#define SDD1EMU_H
-//#include "port.h"
-
void SDD1_decompress(uint8_t* out, uint8_t* in, int output_length);
#endif
diff --git a/source/seta010.c b/source/seta010.c
index bfa094d..856e700 100644
--- a/source/seta010.c
+++ b/source/seta010.c
@@ -291,7 +291,6 @@ void ST010_Rotate(int16_t Theta, int16_t X0, int16_t Y0, int16_t* X1, int16_t* Y
void SETA_Distance(int16_t Y0, int16_t X0, int16_t* Distance)
{
if (X0 < 0) X0 = -X0;
- if (Y0 < 0) Y0 = -Y0;
*Distance = ((X0 * 0x7af0) + 0x4000) >> 15;
}
@@ -637,17 +636,12 @@ void S9xSetST010(uint32_t Address, uint8_t Byte)
ST010_OP01(dy, dx, &a1, &b1, &c1, (int16_t*)&o1);
// check for wrapping
- //if((o1<0x6000 && rot>0xA000) ||
- // (rot<0x6000 && o1>0xA000))
- //if(o1<rot)
if (abs(o1 - rot) > 0x8000)
{
o1 += 0x8000;
rot += 0x8000;
wrap = true;
}
- //o1=0x0000;
- //rot=0xFF00;
uint16_t old_speed;
diff --git a/source/seta011.c b/source/seta011.c
index f369bc8..ef49c21 100644
--- a/source/seta011.c
+++ b/source/seta011.c
@@ -27,10 +27,6 @@ uint8_t S9xGetST011(uint32_t Address)
else
t = Memory.SRAM[address];
- // debug
- // if(address<0x150)
- // printf( "ST011 R: %06X %02X\n", Address, t);
-
return t;
}
@@ -49,10 +45,6 @@ void S9xSetST011(uint32_t Address, uint8_t Byte)
reset = true;
}
- // debug
- // if(address<0x150)
- // printf( "ST011 W: %06X %02X\n", Address, Byte );
-
Memory.SRAM[address] = Byte;
// op commands/data goes through this address
@@ -124,27 +116,16 @@ void S9xSetST011(uint32_t Address, uint8_t Byte)
// unknown
case 0x04:
- {
- // outputs
- Memory.SRAM[0x12C] = 0x00;
- //Memory.SRAM[0x12D] = 0x00;
- Memory.SRAM[0x12E] = 0x00;
- }
- break;
-
- // unknown
case 0x05:
{
// outputs
Memory.SRAM[0x12C] = 0x00;
- //Memory.SRAM[0x12D] = 0x00;
Memory.SRAM[0x12E] = 0x00;
}
break;
// unknown
case 0x06:
- break;
case 0x07:
break;
diff --git a/source/seta018.c b/source/seta018.c
index b11cbed..2ae40c0 100644
--- a/source/seta018.c
+++ b/source/seta018.c
@@ -110,35 +110,6 @@ void S9xSetST018(uint8_t Byte, uint32_t Address)
{
// hardware check?
case 0x0100:
- ST018.waiting4command = false;
- ST018.pass++;
- if (ST018.pass == 1)
- {
- ST018.in_count = 1;
- ST018.out_count = 2;
-
- // Overload's research
- ST018.output[0x00] = 0x81;
- ST018.output[0x01] = 0x81;
- }
- else
- {
- //ST018.in_count = 1;
- ST018.out_count = 3;
-
- // no reason to change this
- //ST018.output[0x00] = 0x81;
- //ST018.output[0x01] = 0x81;
- ST018.output[0x02] = 0x81;
-
- // done processing requests
- if (ST018.pass == 3)
- ST018.waiting4command = true;
- }
- break;
-
- // unknown: feels like a security detection
- // format identical to 0x0100
case 0xFF00:
ST018.waiting4command = false;
ST018.pass++;
@@ -153,12 +124,7 @@ void S9xSetST018(uint8_t Byte, uint32_t Address)
}
else
{
- //ST018.in_count = 1;
ST018.out_count = 3;
-
- // no reason to change this
- //ST018.output[0x00] = 0x81;
- //ST018.output[0x01] = 0x81;
ST018.output[0x02] = 0x81;
// done processing requests
diff --git a/source/soundux.c b/source/soundux.c
index dd86493..9a6c304 100644
--- a/source/soundux.c
+++ b/source/soundux.c
@@ -74,7 +74,6 @@ void DecodeBlockAsm2(int8_t*, int16_t*, int32_t*, int32_t*);
// F is channel's current frequency and M is the 16-bit modulation waveform
// from the previous channel multiplied by the current envelope volume level.
#define PITCH_MOD(F,M) ((F) * ((((uint32_t) (M)) + 0x800000) >> 16) >> 7)
-//#define PITCH_MOD(F,M) ((F) * ((((M) & 0x7fffff) >> 14) + 1) >> 8)
#define LAST_SAMPLE 0xffffff
#define JUST_PLAYED_LAST_SAMPLE(c) ((c)->sample_pointer >= LAST_SAMPLE)
@@ -417,7 +416,6 @@ void DecodeBlock(Channel* ch)
uint8_t interim_byte = 0;
compressed++;
- int16_t* raw = ch->block = ch->decoded;
// Seperate out the header parts used for decoding
@@ -988,8 +986,6 @@ void S9xMixSamples(uint8_t* buffer, int sample_count)
MixStereo(sample_count);
/* Mix and convert waveforms */
- int byte_count = sample_count << 1;
-
if (SoundData.echo_enable && SoundData.echo_buffer_size)
{
// 16-bit stereo sound with echo enabled ...
diff --git a/source/soundux.h b/source/soundux.h
index f36d45f..45c177e 100644
--- a/source/soundux.h
+++ b/source/soundux.h
@@ -100,7 +100,6 @@ typedef struct
// Just incase they are needed in the future, for snapshot compatibility.
uint32_t dummy [3];
Channel channels [NUM_CHANNELS];
- // bool no_filter;
int16_t master_volume [2]; /* range is -128 .. 127 */
int16_t echo_volume [2]; /* range is -128 .. 127 */
int noise_hertz;
diff --git a/source/spc700.c b/source/spc700.c
index baf5255..d152bd1 100644
--- a/source/spc700.c
+++ b/source/spc700.c
@@ -1023,7 +1023,6 @@ void Apu7A()
// XXX: BJ: i think the old HalfCarry behavior was wrong...
// XXX: Or is it between bits 7 and 8 for ADDW/SUBW?
-// XXX: Used Work32 instead of Int32 before. Fixed? [Neb]
void Apu9A()
{
// SUBW YA,dp
@@ -1036,9 +1035,6 @@ void Apu9A()
APUSetOverflow();
else
APUClearOverflow();
- if (((IAPU.Registers.YA.W ^ Work16) & 0x0080) &&
- ((IAPU.Registers.YA.W ^ (uint16_t) Int32) & 0x0080))
- APUSetHalfCarry();
APUSetHalfCarry();
if ((IAPU.Registers.YA.W ^ Work16 ^ (uint16_t) Int32) & 0x10)
APUClearHalfCarry();
diff --git a/source/spc700.h b/source/spc700.h
index 9af2d77..1012f2d 100644
--- a/source/spc700.h
+++ b/source/spc700.h
@@ -73,11 +73,9 @@ typedef struct
} SAPURegisters;
// Needed by ILLUSION OF GAIA
-//#define ONE_APU_CYCLE 14
#define ONE_APU_CYCLE 21
// Needed by all games written by the software company called Human
-//#define ONE_APU_CYCLE_HUMAN 17
#define ONE_APU_CYCLE_HUMAN 21
// 1.953us := 1.024065.54MHz
diff --git a/source/spc7110.c b/source/spc7110.c
index d7a5c79..acc4666 100644
--- a/source/spc7110.c
+++ b/source/spc7110.c
@@ -208,7 +208,6 @@ void MovePackData()
FILE* fp = fopen("sp7err.out", "a");
#endif
- // fprintf(fp, "Table Entry %06X:%02X not found\n", table, s7r.reg4804);
fclose(fp);
return;
}
@@ -294,7 +293,6 @@ void ReadPackData()
if (i == MAX_TABLES)
{
FILE* fp = fopen("sp7err.out", "a");
- // fprintf(fp, "Table Entry %06X:%02X not found\n", table, s7r.reg4804);
fclose(fp);
return;
}
@@ -319,7 +317,6 @@ void ReadPackData()
splitpath(Memory.ROMFilename, drive, dir, fname, ext);
strcpy(name, drive);
- //strcat(filename, "\\");
strcat(name, dir);
strcat(name, pfold);
@@ -420,7 +417,6 @@ void GetPackData()
if (i == MAX_TABLES)
{
FILE* fp = fopen("sp7err.out", "a");
- // fprintf(fp, "Table Entry %06X:%02X not found\n", table, s7r.reg4804);
fclose(fp);
return;
}
@@ -703,7 +699,6 @@ uint8_t S9xGetSPC7110(uint16_t Address)
i %= s7r.DataRomSize;
i += s7r.DataRomOffset;
uint8_t tmp = Memory.ROM[i];
- i = ((s7r.reg4813 << 16) | (s7r.reg4812 << 8) | s7r.reg4811);
if (0x60 == (s7r.reg4818 & 0x60))
{
i = ((s7r.reg4813 << 16) | (s7r.reg4812 << 8) | s7r.reg4811);
@@ -935,7 +930,6 @@ void S9xSetSPC7110(uint8_t data, uint16_t Address)
break;
}
}
- // s7r.decomp_set=true;
}
break;
//$4810 is probably read only.
@@ -1243,13 +1237,10 @@ void S9xSetSPC7110(uint8_t data, uint16_t Address)
if (0 == data)
{
S9xUpdateRTC();
- // rtc_f9.init=false;
- // rtc_f9.index=-1;
}
if (data & 0x01)
{
s7r.reg4842 = 0x80;
- //rtc_f9.last_used=time(NULL);//????
rtc_f9.init = false;
rtc_f9.index = -1;
}
@@ -1338,7 +1329,6 @@ void S9xSetSPC7110(uint8_t data, uint16_t Address)
break;
//writes to RTC status register aren't expected to be meaningful
default:
- Address -= 0x4800;
break;
//16 BIT MULTIPLIER: ($FF00) high byte, defval:00
}
@@ -1577,7 +1567,6 @@ bool Load7110Index(char* filename)
return false;
int f_len;
- //do
while (1)
{
i = 0;
@@ -1602,7 +1591,6 @@ bool Load7110Index(char* filename)
decompack->tableEnts[i].location[index].used_offset = 0;
}
- //while(!feof(fp));
fclose(fp);
return true;
}
@@ -1984,7 +1972,6 @@ void Do7110Logging()
fseek(flog, 35, 0);
int f_len;
- //do
while (1)
{
int i = 0;
@@ -2009,7 +1996,6 @@ void Do7110Logging()
i++;
}
}
- //while(!feof(flog));
fclose(flog);
}