mirror of
https://github.com/libretro/snes9x2005.git
synced 2025-03-02 13:45:39 +00:00
Permanently remove NO_OPEN_BUS hacks. It was a premature optimisation.
This commit is contained in:
parent
65f1ead0e7
commit
1896286ad5
@ -145,14 +145,10 @@ static void AbsoluteIndexedIndirect (AccessMode a, InternalOp op)
|
||||
#else
|
||||
Addr = (ICPU.Registers.X.W + *CPU.PC + (*(CPU.PC + 1) << 8)) & 0xffff;
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = *(CPU.PC + 1);
|
||||
#endif
|
||||
CPU.PC += 2;
|
||||
Addr = S9xGetWord (ICPU.ShiftedPB + Addr);
|
||||
#ifndef NO_OPEN_BUS
|
||||
if(a&READ) OpenBus = (uint8)(Addr>>8);
|
||||
#endif
|
||||
(*op)(Addr);
|
||||
}
|
||||
|
||||
@ -165,19 +161,13 @@ static void AbsoluteIndirectLong (AccessMode a, InternalOp op)
|
||||
Addr = *CPU.PC + (*(CPU.PC + 1) << 8);
|
||||
#endif
|
||||
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = *(CPU.PC + 1);
|
||||
#endif
|
||||
CPU.PC += 2;
|
||||
#ifndef NO_OPEN_BUS
|
||||
if(a&READ) {
|
||||
Addr = S9xGetWord (Addr) | ((OpenBus=S9xGetByte (Addr + 2)) << 16);
|
||||
} else {
|
||||
#endif
|
||||
Addr = S9xGetWord (Addr) | (S9xGetByte (Addr + 2) << 16);
|
||||
#ifndef NO_OPEN_BUS
|
||||
Addr = S9xGetWord (Addr) | (S9xGetByte (Addr + 2) << 16);
|
||||
}
|
||||
#endif
|
||||
(*op)(Addr);
|
||||
}
|
||||
|
||||
@ -190,14 +180,10 @@ static void AbsoluteIndirect (AccessMode a, InternalOp op)
|
||||
Addr = *CPU.PC + (*(CPU.PC + 1) << 8);
|
||||
#endif
|
||||
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = *(CPU.PC + 1);
|
||||
#endif
|
||||
CPU.PC += 2;
|
||||
Addr = S9xGetWord (Addr);
|
||||
#ifndef NO_OPEN_BUS
|
||||
if(a&READ) OpenBus = (uint8)(Addr>>8);
|
||||
#endif
|
||||
Addr += ICPU.ShiftedPB;
|
||||
(*op)(Addr);
|
||||
}
|
||||
@ -210,9 +196,7 @@ static void Absolute (AccessMode a, InternalOp op)
|
||||
#else
|
||||
Addr = *CPU.PC + (*(CPU.PC + 1) << 8) + ICPU.ShiftedDB;
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
if(a&READ) OpenBus = *(CPU.PC+1);
|
||||
#endif
|
||||
CPU.PC += 2;
|
||||
(*op)(Addr);
|
||||
}
|
||||
@ -230,18 +214,14 @@ static void AbsoluteLong (AccessMode a, InternalOp op)
|
||||
#else
|
||||
Addr = *CPU.PC + (*(CPU.PC + 1) << 8) + (*(CPU.PC + 2) << 16);
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
if(a&READ) OpenBus = *(CPU.PC+2);
|
||||
#endif
|
||||
CPU.PC += 3;
|
||||
(*op)(Addr);
|
||||
}
|
||||
|
||||
static void Direct(AccessMode a, InternalOp op)
|
||||
{
|
||||
#ifndef NO_OPEN_BUS
|
||||
if(a&READ) OpenBus = *CPU.PC;
|
||||
#endif
|
||||
long Addr = (*CPU.PC++ + ICPU.Registers.D.W) & 0xffff;
|
||||
// if (ICPU.Registers.DL != 0) CPU.Cycles += ONE_CYCLE;
|
||||
(*op)(Addr);
|
||||
@ -249,15 +229,11 @@ static void Direct(AccessMode a, InternalOp op)
|
||||
|
||||
static void DirectIndirectIndexed (AccessMode a, InternalOp op)
|
||||
{
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = *CPU.PC;
|
||||
#endif
|
||||
long Addr = (*CPU.PC++ + ICPU.Registers.D.W) & 0xffff;
|
||||
|
||||
Addr = S9xGetWord (Addr);
|
||||
#ifndef NO_OPEN_BUS
|
||||
if(a&READ) OpenBus = (uint8)(Addr>>8);
|
||||
#endif
|
||||
Addr += ICPU.ShiftedDB + ICPU.Registers.Y.W;
|
||||
|
||||
// if (ICPU.Registers.DL != 0) CPU.Cycles += ONE_CYCLE;
|
||||
@ -268,44 +244,32 @@ static void DirectIndirectIndexed (AccessMode a, InternalOp op)
|
||||
|
||||
static void DirectIndirectIndexedLong (AccessMode a, InternalOp op)
|
||||
{
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = *CPU.PC;
|
||||
#endif
|
||||
long Addr = (*CPU.PC++ + ICPU.Registers.D.W) & 0xffff;
|
||||
|
||||
#ifndef NO_OPEN_BUS
|
||||
if(a&READ){
|
||||
Addr = S9xGetWord (Addr) + ((OpenBus = S9xGetByte (Addr + 2)) << 16) + ICPU.Registers.Y.W;
|
||||
} else {
|
||||
#endif
|
||||
Addr = S9xGetWord (Addr) + (S9xGetByte (Addr + 2) << 16) + ICPU.Registers.Y.W;
|
||||
#ifndef NO_OPEN_BUS
|
||||
}
|
||||
#endif
|
||||
// if (ICPU.Registers.DL != 0) CPU.Cycles += ONE_CYCLE;
|
||||
(*op)(Addr);
|
||||
}
|
||||
|
||||
static void DirectIndexedIndirect(AccessMode a, InternalOp op)
|
||||
{
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = *CPU.PC;
|
||||
#endif
|
||||
long Addr = (*CPU.PC++ + ICPU.Registers.D.W + ICPU.Registers.X.W) & 0xffff;
|
||||
|
||||
Addr = S9xGetWord (Addr);
|
||||
#ifndef NO_OPEN_BUS
|
||||
if(a&READ) OpenBus = (uint8)(Addr>>8);
|
||||
#endif
|
||||
Addr += ICPU.ShiftedDB;
|
||||
(*op)(Addr);
|
||||
}
|
||||
|
||||
static void DirectIndexedX (AccessMode a, InternalOp op)
|
||||
{
|
||||
#ifndef NO_OPEN_BUS
|
||||
if(a&READ) OpenBus = *CPU.PC;
|
||||
#endif
|
||||
long Addr = (*CPU.PC++ + ICPU.Registers.D.W + ICPU.Registers.X.W);
|
||||
Addr &= CheckEmulation() ? 0xff : 0xffff;
|
||||
|
||||
@ -314,9 +278,7 @@ static void DirectIndexedX (AccessMode a, InternalOp op)
|
||||
|
||||
static void DirectIndexedY (AccessMode a, InternalOp op)
|
||||
{
|
||||
#ifndef NO_OPEN_BUS
|
||||
if(a&READ) OpenBus = *CPU.PC;
|
||||
#endif
|
||||
long Addr = (*CPU.PC++ + ICPU.Registers.D.W + ICPU.Registers.Y.W);
|
||||
Addr &= CheckEmulation() ? 0xff : 0xffff;
|
||||
(*op)(Addr);
|
||||
@ -331,9 +293,7 @@ static void AbsoluteIndexedX (AccessMode a, InternalOp op)
|
||||
Addr = ICPU.ShiftedDB + *CPU.PC + (*(CPU.PC + 1) << 8) +
|
||||
ICPU.Registers.X.W;
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
if(a&READ) OpenBus = *(CPU.PC+1);
|
||||
#endif
|
||||
CPU.PC += 2;
|
||||
// XXX: always add one cycle for ROL, LSR, etc
|
||||
// XXX: else is cross page boundary add one cycle
|
||||
@ -349,9 +309,7 @@ static void AbsoluteIndexedY (AccessMode a, InternalOp op)
|
||||
Addr = ICPU.ShiftedDB + *CPU.PC + (*(CPU.PC + 1) << 8) +
|
||||
ICPU.Registers.Y.W;
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
if(a&READ) OpenBus = *(CPU.PC+1);
|
||||
#endif
|
||||
CPU.PC += 2;
|
||||
// XXX: always add cycle for STA
|
||||
// XXX: else is cross page boundary add one cycle
|
||||
@ -371,23 +329,17 @@ static void AbsoluteLongIndexedX (AccessMode a, InternalOp op)
|
||||
#else
|
||||
Addr = (*CPU.PC + (*(CPU.PC + 1) << 8) + (*(CPU.PC + 2) << 16) + ICPU.Registers.X.W) & 0xffffff;
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
if(a&READ) OpenBus = *(CPU.PC+2);
|
||||
#endif
|
||||
CPU.PC += 3;
|
||||
(*op)(Addr);
|
||||
}
|
||||
|
||||
static void DirectIndirect (AccessMode a, InternalOp op)
|
||||
{
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = *CPU.PC;
|
||||
#endif
|
||||
long Addr = (*CPU.PC++ + ICPU.Registers.D.W) & 0xffff;
|
||||
Addr = S9xGetWord (Addr);
|
||||
#ifndef NO_OPEN_BUS
|
||||
if(a&READ) OpenBus = (uint8)(Addr>>8);
|
||||
#endif
|
||||
Addr += ICPU.ShiftedDB;
|
||||
|
||||
// if (ICPU.Registers.DL != 0) CPU.Cycles += ONE_CYCLE;
|
||||
@ -396,42 +348,30 @@ static void DirectIndirect (AccessMode a, InternalOp op)
|
||||
|
||||
static void DirectIndirectLong (AccessMode a, InternalOp op)
|
||||
{
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = *CPU.PC;
|
||||
#endif
|
||||
long Addr = (*CPU.PC++ + ICPU.Registers.D.W) & 0xffff;
|
||||
#ifndef NO_OPEN_BUS
|
||||
if(a&READ){
|
||||
Addr = S9xGetWord (Addr) + ((OpenBus=S9xGetByte (Addr + 2)) << 16);
|
||||
} else {
|
||||
#endif
|
||||
Addr = S9xGetWord (Addr) + (S9xGetByte (Addr + 2) << 16);
|
||||
#ifndef NO_OPEN_BUS
|
||||
}
|
||||
#endif
|
||||
// if (ICPU.Registers.DL != 0) CPU.Cycles += ONE_CYCLE;
|
||||
(*op)(Addr);
|
||||
}
|
||||
|
||||
static void StackRelative (AccessMode a, InternalOp op)
|
||||
{
|
||||
#ifndef NO_OPEN_BUS
|
||||
if(a&READ) OpenBus = *CPU.PC;
|
||||
#endif
|
||||
long Addr = (*CPU.PC++ + ICPU.Registers.S.W) & 0xffff;
|
||||
(*op)(Addr);
|
||||
}
|
||||
|
||||
static void StackRelativeIndirectIndexed (AccessMode a, InternalOp op)
|
||||
{
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = *CPU.PC;
|
||||
#endif
|
||||
long Addr = (*CPU.PC++ + ICPU.Registers.S.W) & 0xffff;
|
||||
Addr = S9xGetWord (Addr);
|
||||
#ifndef NO_OPEN_BUS
|
||||
if(a&READ) OpenBus = (uint8)(Addr>>8);
|
||||
#endif
|
||||
Addr = (Addr + ICPU.ShiftedDB +
|
||||
ICPU.Registers.Y.W) & 0xffffff;
|
||||
(*op)(Addr);
|
||||
|
@ -4431,9 +4431,7 @@ static void Op00 (void)
|
||||
PushW (CPU.PC - CPU.PCBase + 1);
|
||||
S9xPackStatus ();
|
||||
PushB (ICPU.Registers.PL);
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = ICPU.Registers.PL;
|
||||
#endif
|
||||
ClearDecimal ();
|
||||
SetIRQ ();
|
||||
|
||||
@ -4449,9 +4447,7 @@ static void Op00 (void)
|
||||
PushW (CPU.PC - CPU.PCBase);
|
||||
S9xPackStatus ();
|
||||
PushB (ICPU.Registers.PL);
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = ICPU.Registers.PL;
|
||||
#endif
|
||||
ClearDecimal ();
|
||||
SetIRQ ();
|
||||
|
||||
@ -4489,9 +4485,7 @@ void S9xOpcode_IRQ (void)
|
||||
PushW (CPU.PC - CPU.PCBase);
|
||||
S9xPackStatus ();
|
||||
PushB (ICPU.Registers.PL);
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = ICPU.Registers.PL;
|
||||
#endif
|
||||
ClearDecimal ();
|
||||
SetIRQ ();
|
||||
|
||||
@ -4514,9 +4508,7 @@ void S9xOpcode_IRQ (void)
|
||||
PushW (CPU.PC - CPU.PCBase);
|
||||
S9xPackStatus ();
|
||||
PushB (ICPU.Registers.PL);
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = ICPU.Registers.PL;
|
||||
#endif
|
||||
ClearDecimal ();
|
||||
SetIRQ ();
|
||||
|
||||
@ -4551,9 +4543,7 @@ void S9xOpcode_NMI (void)
|
||||
PushW (CPU.PC - CPU.PCBase);
|
||||
S9xPackStatus ();
|
||||
PushB (ICPU.Registers.PL);
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = ICPU.Registers.PL;
|
||||
#endif
|
||||
ClearDecimal ();
|
||||
SetIRQ ();
|
||||
|
||||
@ -4576,9 +4566,7 @@ void S9xOpcode_NMI (void)
|
||||
PushW (CPU.PC - CPU.PCBase);
|
||||
S9xPackStatus ();
|
||||
PushB (ICPU.Registers.PL);
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = ICPU.Registers.PL;
|
||||
#endif
|
||||
ClearDecimal ();
|
||||
SetIRQ ();
|
||||
|
||||
@ -4612,9 +4600,7 @@ static void Op02 (void)
|
||||
PushW (CPU.PC - CPU.PCBase + 1);
|
||||
S9xPackStatus ();
|
||||
PushB (ICPU.Registers.PL);
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = ICPU.Registers.PL;
|
||||
#endif
|
||||
ClearDecimal ();
|
||||
SetIRQ ();
|
||||
|
||||
@ -4630,9 +4616,7 @@ static void Op02 (void)
|
||||
PushW (CPU.PC - CPU.PCBase);
|
||||
S9xPackStatus ();
|
||||
PushB (ICPU.Registers.PL);
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = ICPU.Registers.PL;
|
||||
#endif
|
||||
ClearDecimal ();
|
||||
SetIRQ ();
|
||||
|
||||
@ -4806,10 +4790,7 @@ static void Op54X1 (void)
|
||||
|
||||
ICPU.Registers.DB = *CPU.PC++;
|
||||
ICPU.ShiftedDB = ICPU.Registers.DB << 16;
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus =
|
||||
#endif
|
||||
SrcBank = *CPU.PC++;
|
||||
OpenBus = SrcBank = *CPU.PC++;
|
||||
|
||||
S9xSetByte (S9xGetByte ((SrcBank << 16) + ICPU.Registers.X.W),
|
||||
ICPU.ShiftedDB + ICPU.Registers.Y.W);
|
||||
@ -4831,10 +4812,7 @@ static void Op54X0 (void)
|
||||
|
||||
ICPU.Registers.DB = *CPU.PC++;
|
||||
ICPU.ShiftedDB = ICPU.Registers.DB << 16;
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus =
|
||||
#endif
|
||||
SrcBank = *CPU.PC++;
|
||||
OpenBus = SrcBank = *CPU.PC++;
|
||||
|
||||
S9xSetByte (S9xGetByte ((SrcBank << 16) + ICPU.Registers.X.W),
|
||||
ICPU.ShiftedDB + ICPU.Registers.Y.W);
|
||||
@ -4855,10 +4833,7 @@ static void Op44X1 (void)
|
||||
#endif
|
||||
ICPU.Registers.DB = *CPU.PC++;
|
||||
ICPU.ShiftedDB = ICPU.Registers.DB << 16;
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus =
|
||||
#endif
|
||||
SrcBank = *CPU.PC++;
|
||||
OpenBus = SrcBank = *CPU.PC++;
|
||||
S9xSetByte (S9xGetByte ((SrcBank << 16) + ICPU.Registers.X.W),
|
||||
ICPU.ShiftedDB + ICPU.Registers.Y.W);
|
||||
|
||||
@ -4878,10 +4853,7 @@ static void Op44X0 (void)
|
||||
#endif
|
||||
ICPU.Registers.DB = *CPU.PC++;
|
||||
ICPU.ShiftedDB = ICPU.Registers.DB << 16;
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus =
|
||||
#endif
|
||||
SrcBank = *CPU.PC++;
|
||||
OpenBus = SrcBank = *CPU.PC++;
|
||||
S9xSetByte (S9xGetByte ((SrcBank << 16) + ICPU.Registers.X.W),
|
||||
ICPU.ShiftedDB + ICPU.Registers.Y.W);
|
||||
|
||||
|
@ -98,12 +98,10 @@
|
||||
#include "obc1.h"
|
||||
#include "seta.h"
|
||||
|
||||
#ifndef NO_OPEN_BUS
|
||||
extern "C"
|
||||
{
|
||||
extern uint8 OpenBus;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8 S9xGetByte (uint32 Address)
|
||||
{
|
||||
@ -180,11 +178,7 @@ uint8 S9xGetByte (uint32 Address)
|
||||
#ifdef DEBUGGER
|
||||
printf ("DEBUG R(B) %06x\n", Address);
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
return OpenBus;
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
|
||||
|
||||
default:
|
||||
@ -198,11 +192,7 @@ uint8 S9xGetByte (uint32 Address)
|
||||
#ifdef DEBUGGER
|
||||
printf ("R(B) %06x\n", Address);
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
return OpenBus;
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,13 +200,8 @@ uint16 S9xGetWord (uint32 Address)
|
||||
{
|
||||
if ((Address & 0x0fff) == 0x0fff)
|
||||
{
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = S9xGetByte (Address);
|
||||
return (OpenBus | (S9xGetByte (Address + 1) << 8));
|
||||
#else
|
||||
uint8 Split = S9xGetByte (Address);
|
||||
return (Split | (S9xGetByte (Address + 1) << 8));
|
||||
#endif
|
||||
}
|
||||
int block;
|
||||
uint8 *GetAddress = Memory.Map [block = (Address >> MEMMAP_SHIFT) & MEMMAP_MASK];
|
||||
@ -316,11 +301,7 @@ uint16 S9xGetWord (uint32 Address)
|
||||
#ifdef DEBUGGER
|
||||
printf ("DEBUG R(W) %06x\n", Address);
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
return (OpenBus | (OpenBus<<8));
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
|
||||
default:
|
||||
case CMemory::MAP_NONE:
|
||||
@ -333,11 +314,7 @@ uint16 S9xGetWord (uint32 Address)
|
||||
#ifdef DEBUGGER
|
||||
printf ("R(W) %06x\n", Address);
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
return (OpenBus | (OpenBus<<8));
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,21 +141,7 @@ CMemory Memory;
|
||||
|
||||
struct SSNESGameFixes SNESGameFixes;
|
||||
|
||||
#if 0
|
||||
uint8 A1 = 0, A2 = 0, A3 = 0, A4 = 0, W1 = 0, W2 = 0, W3 = 0, W4 = 0;
|
||||
uint8 Ans8 = 0;
|
||||
uint16 Ans16 = 0;
|
||||
uint32 Ans32 = 0;
|
||||
uint8 Work8 = 0;
|
||||
uint16 Work16 = 0;
|
||||
uint32 Work32 = 0;
|
||||
signed char Int8 = 0;
|
||||
short Int16 = 0;
|
||||
long Int32 = 0;
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
uint8 OpenBus = 0;
|
||||
#endif
|
||||
|
||||
|
||||
END_EXTERN_C
|
||||
|
@ -288,11 +288,9 @@ void S9xSetPCBase (uint32 Address);
|
||||
uint8 *S9xGetMemPointer (uint32 Address);
|
||||
uint8 *GetBasePointer (uint32 Address);
|
||||
|
||||
#ifndef NO_OPEN_BUS
|
||||
extern "C" {
|
||||
extern uint8 OpenBus;
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define INLINE inline
|
||||
|
125
source/ppu.cpp
125
source/ppu.cpp
@ -1030,17 +1030,9 @@ void S9xSetPPU (uint8 Byte, uint16 Address)
|
||||
/******************************************************************************/
|
||||
uint8 S9xGetPPU (uint16 Address)
|
||||
{
|
||||
#ifndef NO_OPEN_BUS
|
||||
uint8 byte = OpenBus;
|
||||
#else
|
||||
uint8 byte = 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
if(Address<0x2100)//not a real PPU reg
|
||||
#ifndef NO_OPEN_BUS
|
||||
return OpenBus; //treat as unmapped memory returning last byte on the bus
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
if (Address <= 0x2190)
|
||||
{
|
||||
switch (Address)
|
||||
@ -1052,11 +1044,7 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
#ifdef DEBUGGER
|
||||
missing.oam_address_read = 1;
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
return OpenBus;
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
|
||||
case 0x2104:
|
||||
case 0x2105:
|
||||
@ -1075,11 +1063,7 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
case 0x2128:
|
||||
case 0x2129:
|
||||
case 0x212a:
|
||||
#ifndef NO_OPEN_BUS
|
||||
return PPU.OpenBus1;
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
|
||||
case 0x2107:
|
||||
case 0x2117:
|
||||
@ -1096,11 +1080,7 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
case 0x2131:
|
||||
case 0x2132:
|
||||
case 0x2133:
|
||||
#ifndef NO_OPEN_BUS
|
||||
return OpenBus;
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
|
||||
case 0x210b:
|
||||
case 0x210c:
|
||||
@ -1114,11 +1094,7 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
#ifdef DEBUGGER
|
||||
missing.bg_offset_read = 1;
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
return OpenBus;
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
|
||||
case 0x2114:
|
||||
#ifdef DEBUGGER
|
||||
@ -1134,11 +1110,7 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
#ifdef DEBUGGER
|
||||
missing.matrix_read = 1;
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
return OpenBus;
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
|
||||
|
||||
case 0x2134:
|
||||
@ -1157,18 +1129,10 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
#ifdef DEBUGGER
|
||||
missing.matrix_multiply = 1;
|
||||
#endif
|
||||
return (
|
||||
#ifndef NO_OPEN_BUS
|
||||
PPU.OpenBus1 =
|
||||
#endif
|
||||
Memory.FillRAM[Address]);
|
||||
return (PPU.OpenBus1 = Memory.FillRAM[Address]);
|
||||
case 0x2137:
|
||||
S9xLatchCounters(0);
|
||||
#ifndef NO_OPEN_BUS
|
||||
return OpenBus;
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
|
||||
case 0x2138:
|
||||
// Read OAM (sprite) control data
|
||||
@ -1213,11 +1177,7 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
#ifdef DEBUGGER
|
||||
missing.oam_read = 1;
|
||||
#endif
|
||||
return (
|
||||
#ifndef NO_OPEN_BUS
|
||||
PPU.OpenBus1 =
|
||||
#endif
|
||||
byte);
|
||||
return (PPU.OpenBus1 = byte);
|
||||
|
||||
case 0x2139:
|
||||
// Read vram low byte
|
||||
@ -1262,9 +1222,7 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
IPPU.FirstVRAMRead = FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
PPU.OpenBus1 = byte;
|
||||
#endif
|
||||
break;
|
||||
case 0x213A:
|
||||
// Read vram high byte
|
||||
@ -1308,9 +1266,7 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
IPPU.FirstVRAMRead = FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
PPU.OpenBus1 = byte;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0x213B:
|
||||
@ -1324,11 +1280,7 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
byte = PPU.CGDATA [PPU.CGADD] & 0xff;
|
||||
|
||||
PPU.CGFLIPRead ^= 1;
|
||||
return (
|
||||
#ifndef NO_OPEN_BUS
|
||||
PPU.OpenBus2 =
|
||||
#endif
|
||||
byte);
|
||||
return (PPU.OpenBus2 = byte);
|
||||
|
||||
case 0x213C:
|
||||
// Horizontal counter value 0-339
|
||||
@ -1336,19 +1288,12 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
missing.h_counter_read = 1;
|
||||
#endif
|
||||
if (PPU.HBeamFlip)
|
||||
byte =
|
||||
#ifndef NO_OPEN_BUS
|
||||
(PPU.OpenBus2 & 0xfe)
|
||||
#else
|
||||
0 // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
byte = (PPU.OpenBus2 & 0xfe)
|
||||
| ((PPU.HBeamPosLatched >> 8) & 0x01);
|
||||
|
||||
else
|
||||
byte = (uint8)PPU.HBeamPosLatched;
|
||||
#ifndef NO_OPEN_BUS
|
||||
PPU.OpenBus2 = byte;
|
||||
#endif
|
||||
PPU.HBeamFlip ^= 1;
|
||||
break;
|
||||
|
||||
@ -1358,18 +1303,11 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
missing.v_counter_read = 1;
|
||||
#endif
|
||||
if (PPU.VBeamFlip)
|
||||
byte =
|
||||
#ifndef NO_OPEN_BUS
|
||||
(PPU.OpenBus2 & 0xfe)
|
||||
#else
|
||||
0 // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
byte = (PPU.OpenBus2 & 0xfe)
|
||||
| ((PPU.VBeamPosLatched >> 8) & 0x01);
|
||||
else
|
||||
byte = (uint8)PPU.VBeamPosLatched;
|
||||
#ifndef NO_OPEN_BUS
|
||||
PPU.OpenBus2 = byte;
|
||||
#endif
|
||||
PPU.VBeamFlip ^= 1;
|
||||
break;
|
||||
|
||||
@ -1378,22 +1316,14 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
FLUSH_REDRAW ();
|
||||
|
||||
//so far, 5c77 version is always 1.
|
||||
return (
|
||||
#ifndef NO_OPEN_BUS
|
||||
PPU.OpenBus1 =
|
||||
#endif
|
||||
(Model->_5C77 | PPU.RangeTimeOver));
|
||||
return (PPU.OpenBus1 = (Model->_5C77 | PPU.RangeTimeOver));
|
||||
|
||||
case 0x213F:
|
||||
// NTSC/PAL and which field flags
|
||||
PPU.VBeamFlip = PPU.HBeamFlip = 0;
|
||||
//neviksti found a 2 and a 3 here. SNEeSe uses a 3.
|
||||
//XXX: field flags not emulated
|
||||
return ((Settings.PAL ? 0x10 : 0) | (Memory.FillRAM[0x213f] & 0xc0)| Model->_5C78)
|
||||
#ifndef NO_OPEN_BUS
|
||||
| (~PPU.OpenBus2 & 0x20)
|
||||
#endif
|
||||
;
|
||||
return ((Settings.PAL ? 0x10 : 0) | (Memory.FillRAM[0x213f] & 0xc0)| Model->_5C78) | (~PPU.OpenBus2 & 0x20);
|
||||
|
||||
case 0x2140: case 0x2141: case 0x2142: case 0x2143:
|
||||
case 0x2144: case 0x2145: case 0x2146: case 0x2147:
|
||||
@ -1476,11 +1406,7 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
case 0x2182:
|
||||
case 0x2183:
|
||||
default:
|
||||
#ifndef NO_OPEN_BUS
|
||||
return OpenBus;
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1497,20 +1423,12 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
return (0x20);
|
||||
|
||||
// fprintf(stderr, "Read from $21c2!\n");
|
||||
#ifndef NO_OPEN_BUS
|
||||
return OpenBus;
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
case 0x21c3:
|
||||
if(Model->_5C77 ==2)
|
||||
return (0);
|
||||
// fprintf(stderr, "Read from $21c3!\n");
|
||||
#ifndef NO_OPEN_BUS
|
||||
return OpenBus;
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
case 0x2800:
|
||||
// For Dai Kaijyu Monogatari II
|
||||
if (Settings.SRTC)
|
||||
@ -1526,20 +1444,12 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
S9xMessage (S9X_TRACE, S9X_PPU_TRACE, String);
|
||||
}
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
return OpenBus;
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (!Settings.SuperFX)
|
||||
#ifndef NO_OPEN_BUS
|
||||
return OpenBus;
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
#ifdef ZSNES_FX
|
||||
if (Address < 0x3040)
|
||||
byte = S9xSuperFXReadReg (Address);
|
||||
@ -2221,12 +2131,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
S9xMessage (S9X_TRACE, S9X_PPU_TRACE, String);
|
||||
}
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
return OpenBus;
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
|
||||
}
|
||||
// return (Memory.FillRAM [Address]);
|
||||
}
|
||||
@ -2249,11 +2154,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
case 0x420d:
|
||||
case 0x420e:
|
||||
case 0x420f:
|
||||
#ifndef NO_OPEN_BUS
|
||||
return OpenBus;
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
|
||||
case 0x4210:
|
||||
#ifdef CPU_SHUTDOWN
|
||||
@ -2263,9 +2164,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
Memory.FillRAM[0x4210] = Model->_5A22;
|
||||
//SNEeSe returns 2 for 5A22 version.
|
||||
return ((byte&0x80)
|
||||
#ifndef NO_OPEN_BUS
|
||||
|(OpenBus&0x70)
|
||||
#endif
|
||||
|Model->_5A22);
|
||||
|
||||
case 0x4211:
|
||||
@ -2275,9 +2174,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
CLEAR_IRQ_SOURCE (PPU_V_BEAM_IRQ_SOURCE | PPU_H_BEAM_IRQ_SOURCE);
|
||||
|
||||
// Maybe? Register Scan indicated open bus...
|
||||
#ifndef NO_OPEN_BUS
|
||||
byte |= OpenBus&0x3f;
|
||||
#endif
|
||||
|
||||
return (byte);
|
||||
|
||||
@ -2287,9 +2184,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
CPU.WaitAddress = CPU.PCAtOpcodeStart;
|
||||
#endif
|
||||
return (REGISTER_4212()
|
||||
#ifndef NO_OPEN_BUS
|
||||
|(OpenBus&0x3E)
|
||||
#endif
|
||||
);
|
||||
|
||||
case 0x4213:
|
||||
@ -2465,11 +2360,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
return Memory.FillRAM[Address];
|
||||
}
|
||||
|
||||
#ifndef NO_OPEN_BUS
|
||||
return OpenBus;
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
}
|
||||
// return (Memory.FillRAM[Address]);
|
||||
}
|
||||
@ -2537,10 +2428,8 @@ static void CommonPPUReset ()
|
||||
PPU.OAMPriorityRotation = 0;
|
||||
PPU.OAMWriteRegister = 0;
|
||||
PPU.RangeTimeOver = 0;
|
||||
#ifndef NO_OPEN_BUS
|
||||
PPU.OpenBus1 = 0;
|
||||
PPU.OpenBus2 = 0;
|
||||
#endif
|
||||
|
||||
PPU.OAMFlip = 0;
|
||||
PPU.OAMTileAddress = 0;
|
||||
|
@ -270,10 +270,8 @@ struct SPPU {
|
||||
// XXX Do these need to be added to snapshot.cpp?
|
||||
uint16 OAMWriteRegister;
|
||||
uint8 BGnxOFSbyte;
|
||||
#ifndef NO_OPEN_BUS
|
||||
uint8 OpenBus1;
|
||||
uint8 OpenBus2;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define CLIP_OR 0
|
||||
|
@ -228,23 +228,14 @@ uint8 S9xSA1GetByte (uint32 address)
|
||||
#ifdef DEBUGGER
|
||||
// printf ("R(B) %06x\n", address);
|
||||
#endif
|
||||
#ifndef NO_OPEN_BUS
|
||||
return OpenBus;
|
||||
#else
|
||||
return 0; // Arbitrarily chosen value [Neb]
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
uint16 S9xSA1GetWord (uint32 address)
|
||||
{
|
||||
#ifndef NO_OPEN_BUS
|
||||
OpenBus = S9xSA1GetByte (address);
|
||||
return (OpenBus | (S9xSA1GetByte (address + 1) << 8));
|
||||
#else
|
||||
uint8 Split = S9xSA1GetByte (address);
|
||||
return (Split | (S9xSA1GetByte (address + 1) << 8));
|
||||
#endif
|
||||
}
|
||||
|
||||
void S9xSA1SetByte (uint8 byte, uint32 address)
|
||||
|
Loading…
x
Reference in New Issue
Block a user