Commit 6e3f4bc0 authored by Libretro-Admin's avatar Libretro-Admin
Browse files

Add HAVE_DEBUG ifdefs

parent 8215a92f
......@@ -266,10 +266,12 @@ INLINE void SS_SCSP::RW(uint32 A, T& DBV)
break;
case 0x05:
#ifdef HAVE_DEBUG
if(SRV & 0x8000)
{
//SS_DBG(SS_DBG_WARNING | SS_DBG_SCSP, "[SCSP] Unknown bits non-zero in slot %u, register %u\n", slotnum, (A >> 1) & 0xF);
}
#endif
s->ReleaseRate = SRV & 0x1F;
s->DecayLevel = (SRV >> 5) & 0x1F;
......@@ -279,10 +281,12 @@ INLINE void SS_SCSP::RW(uint32 A, T& DBV)
case 0x06:
SRV &= 0x0FFF;
#ifdef HAVE_DEBUG
if(SRV & 0x0C00)
{
//SS_DBG(SS_DBG_WARNING | SS_DBG_SCSP, "[SCSP] Unknown bits non-zero in slot %u, register %u\n", slotnum, (A >> 1) & 0xF);
}
#endif
s->TotalLevel = SRV & 0xFF;
s->SoundDirect = (SRV >> 8) & 0x1;
......@@ -296,10 +300,12 @@ INLINE void SS_SCSP::RW(uint32 A, T& DBV)
break;
case 0x08:
#ifdef HAVE_DEBUG
if(SRV & 0x8400)
{
//SS_DBG(SS_DBG_WARNING | SS_DBG_SCSP, "[SCSP] Unknown bits non-zero in slot %u, register %u\n", slotnum, (A >> 1) & 0xF);
}
#endif
s->FreqNum = SRV & 0x7FF;
s->Octave = (SRV >> 11) & 0xF;
......@@ -316,10 +322,12 @@ INLINE void SS_SCSP::RW(uint32 A, T& DBV)
case 0x0A:
SRV &= 0x00FF;
#ifdef HAVE_DEBUG
if(SRV & 0x0080)
{
//SS_DBG(SS_DBG_WARNING | SS_DBG_SCSP, "[SCSP] Unknown bits non-zero in slot %u, register %u\n", slotnum, (A >> 1) & 0xF);
}
#endif
s->ToDSPLevel = SRV & 0x7;
s->ToDSPSelect = (SRV >> 3) & 0xF;
break;
......
......@@ -200,10 +200,12 @@ static uint8 SCU_MSH2VectorFetch(void)
{
uint8 ret = IVec;
#ifdef HAVE_DEBUG
if(MDFN_UNLIKELY(ILevel == 0))
{
SS_DBG(SS_DBG_WARNING | SS_DBG_SCU, "[SCU] [MSH2] [BUG] SCU_MSH2VectorFetch() called when ILevel == 0\n");
}
#endif
if(MDFN_UNLIKELY(IVec == 0x40 /* || IVec == 0x41 */)) // VB In, apply cheats.
MDFNMP_ApplyPeriodicCheats();
......@@ -401,7 +403,9 @@ static INLINE void SCU_RegRW_DB(uint32 A, uint32* DB)
if(IsWrite)
{
#ifdef HAVE_DEBUG
SS_DBGTI(SS_DBG_SCU_REGW, "[SCU] %zu-byte write to 0x%02x, DB=0x%08x", sizeof(T), A & 0xFC, *DB);
#endif
switch(A & 0xFC)
{
......@@ -462,10 +466,12 @@ static INLINE void SCU_RegRW_DB(uint32 A, uint32* DB)
case 0xC4:
RSEL = (RSEL &~ mask) | (*DB & mask & 0x1);
#ifdef HAVE_DEBUG
if(MDFN_UNLIKELY(!RSEL))
{
SS_DBG(SS_DBG_WARNING | SS_DBG_SCU, "[SCU] Write to RSEL, RSEL=0\n");
}
#endif
break;
case 0x00:
......@@ -922,10 +928,12 @@ static INLINE void ABusRW_DB(uint32 A, uint16* DB, int32* time_thing, int32* dma
*dma_time_thing -= 16;
}
#ifdef HAVE_DEBUG
if(IsWrite)
SS_DBG(SS_DBG_WARNING | SS_DBG_SCU, "[A-Bus CSD] Unknown %zu-byte write to 0x%08x(DB=0x%04x)\n", sizeof(T), A, *DB);
else
SS_DBG(SS_DBG_WARNING | SS_DBG_SCU, "[A-Bus CSD] Unknown %zu-byte read from 0x%08x\n", sizeof(T), A);
#endif
return;
}
......@@ -969,10 +977,12 @@ static INLINE void ABusRW_DB(uint32 A, uint16* DB, int32* time_thing, int32* dma
return;
}
#ifdef HAVE_DEBUG
if(IsWrite)
SS_DBG(SS_DBG_WARNING | SS_DBG_SCU, "[A-Bus CS2] Unknown %zu-byte write to 0x%08x(DB=0x%04x)\n", sizeof(T), A, *DB);
else
SS_DBG(SS_DBG_WARNING | SS_DBG_SCU, "[A-Bus CS2] Unknown %zu-byte read from 0x%08x\n", sizeof(T), A);
#endif
return;
}
......@@ -983,10 +993,12 @@ static INLINE void ABusRW_DB(uint32 A, uint16* DB, int32* time_thing, int32* dma
if(dma_time_thing != NULL)
*dma_time_thing -= 1;
#ifdef HAVE_DEBUG
if(IsWrite)
SS_DBG(SS_DBG_WARNING | SS_DBG_SCU, "[A-Bus] Unknown %zu-byte write to 0x%08x(DB=0x%04x)\n", sizeof(T), A, *DB);
else
SS_DBG(SS_DBG_WARNING | SS_DBG_SCU, "[A-Bus] Unknown %zu-byte read from 0x%08x\n", sizeof(T), A);
#endif
}
template<typename T>
......@@ -1105,10 +1117,12 @@ static INLINE void SCU_FromSH2_BusRW_DB(uint32 A, uint32* DB, int32* SH2DMAHax)
// return 0;
//}
#ifdef HAVE_DEBUG
if(IsWrite)
SS_DBG(SS_DBG_WARNING | SS_DBG_SCU, "[SH2->SCU BUS] Unknown %zu-byte write to 0x%08x(DB=0x%08x)\n", sizeof(T), A, *DB);
else
SS_DBG(SS_DBG_WARNING | SS_DBG_SCU, "[SH2->SCU BUS] Unknown %zu-byte read from 0x%08x\n", sizeof(T), A);
#endif
if(!SH2DMAHax)
SH7095_mem_timestamp += IsWrite ? 4 : 7;
......@@ -1170,7 +1184,9 @@ static bool StartDMATransfer(DMALevelS* d, const uint32 ra, const uint32 wa, con
rb = AddressToBus(ra);
wb = AddressToBus(wa);
#ifdef HAVE_DEBUG
SS_DBG(SS_DBG_SCU, "[SCU] Starting DMA level %d transfer; ra=0x%08x wa=0x%08x bc=0x%08x - read_inc=%d, write_inc=0x%02x -- indirect=%d %d\n", (int)(d - DMALevel), ra, wa, bc, d->ReadAdd, d->WriteAdd, d->Indirect, d->SF);
#endif
if(MDFN_UNLIKELY(rb == -1))
{
......@@ -1193,6 +1209,7 @@ static bool StartDMATransfer(DMALevelS* d, const uint32 ra, const uint32 wa, con
//
//
//
#ifdef HAVE_DEBUG
if((wa & 0x1) && wb == 1 && d->WriteAdd != 0x1)
{
//
......@@ -1205,6 +1222,7 @@ static bool StartDMATransfer(DMALevelS* d, const uint32 ra, const uint32 wa, con
{
SS_DBG(SS_DBG_WARNING | SS_DBG_SCU, "[SCU] Possibly sketchy DMA of 0x%08x bytes from 0x%08x to A-bus address 0x%08x\n", bc, ra, wa);
}
#endif
d->CurReadBase = ra &~ 0x3;
d->CurReadSub = ra & 0x3;
......@@ -1231,7 +1249,9 @@ static bool NextIndirect(DMALevelS* d)
// count, dest, src
uint32 tmp[3];
#ifdef HAVE_DEBUG
SS_DBG(SS_DBG_SCU, "[SCU] DMA level %d reading indirect table entries @ 0x%08x\n", (int)(d - DMALevel), d->CurTableAddr);
#endif
for(unsigned i = 0; i < 3; i++)
{
......@@ -1270,10 +1290,12 @@ static void RecalcDMAHalt(void)
for(int sl = level - 1; sl >= 0; sl--)
{
DMALevelS* sld = &DMALevel[sl];
#ifdef HAVE_DEBUG
if(sld->Active && (sld->WriteBus == 2 || sld->ReadFunc == DMA_ReadCBus))
{
SS_DBG(SS_DBG_WARNING | SS_DBG_SCU, "[SCU] Higher priority A-bus<->B-bus DMA(level %d) running while lower-priority A-/B-bus<->C-bus DMA(level %d) is pending.\n", level, sl);
}
#endif
}
}
#endif
......@@ -1698,8 +1720,10 @@ static NO_INLINE void DMAInstr(void)
return;
}
#ifdef HAVE_DEBUG
if(drw & 0x4)
SS_DBG(SS_DBG_WARNING | SS_DBG_SCU, "[SCU] DSP DMA from 0x%08x to %s --- Instr=0x%08x, Next_Instr=0x%08x, PC=0x%02x\n", addr, ((drw == 0x4) ? "program RAM" : "unknown"), instr, (unsigned)(DSP.NextInstr >> 32), DSP.PC);
#endif
// Read from external bus, write to data RAM or program RAM
do
......
......@@ -448,28 +448,34 @@ void SMPC_Write(const sscpu_timestamp_t timestamp, uint8 A, uint8 V)
switch(A)
{
case 0x00 ... 0x06:
#ifdef HAVE_DEBUG
if(MDFN_UNLIKELY(PendingCommand >= 0))
{
SS_DBGTI(SS_DBG_WARNING | SS_DBG_SMPC, "[SMPC] Input register %u port written with 0x%02x while command 0x%02x is executing.", A, V, PendingCommand);
}
#endif
IREG[A] = V;
break;
case 0x0F:
#ifdef HAVE_DEBUG
if(MDFN_UNLIKELY(PendingCommand >= 0))
{
SS_DBGTI(SS_DBG_WARNING | SS_DBG_SMPC, "[SMPC] Command port written with 0x%02x while command 0x%02x is still executing.", V, PendingCommand);
}
#endif
PendingCommand = V;
break;
case 0x31:
#ifdef HAVE_DEBUG
if(MDFN_UNLIKELY(SF))
{
SS_DBGTI(SS_DBG_WARNING | SS_DBG_SMPC, "[SMPC] SF port written while SF is 1.");
}
#endif
SF = true;
break;
......@@ -535,19 +541,23 @@ uint8 SMPC_Read(const sscpu_timestamp_t timestamp, uint8 A)
break;
case 0x10 ... 0x2F:
#ifdef HAVE_DEBUG
if(MDFN_UNLIKELY(PendingCommand >= 0))
{
//SS_DBG(SS_DBG_WARNING | SS_DBG_SMPC, "[SMPC] Output register %u port read while command 0x%02x is executing.\n", A - 0x10, PendingCommand);
}
#endif
ret = (OREG - 0x10)[A];
break;
case 0x30:
#ifdef HAVE_DEBUG
if(MDFN_UNLIKELY(PendingCommand >= 0))
{
//SS_DBG(SS_DBG_WARNING | SS_DBG_SMPC, "[SMPC] SR port read while command 0x%02x is executing.\n", PendingCommand);
}
#endif
ret = SR;
break;
......@@ -777,7 +787,9 @@ sscpu_timestamp_t SMPC_Update(sscpu_timestamp_t timestamp)
{
OREG[0x1F] = PendingCommand;
#ifdef HAVE_DEBUG
SS_DBGTI(SS_DBG_SMPC, "[SMPC] Command 0x%02x --- 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x", PendingCommand, IREG[0], IREG[1], IREG[2], IREG[3], IREG[4], IREG[5], IREG[6]);
#endif
if(PendingCommand == CMD_MSHON)
{
......
......@@ -460,10 +460,12 @@ sscpu_timestamp_t Update(sscpu_timestamp_t timestamp)
static void StartDrawing(void)
{
#ifdef HAVE_DEBUG
if(DrawingActive)
{
SS_DBGTI(SS_DBG_WARNING | SS_DBG_VDP1, "[VDP1] Drawing interrupted by new drawing start request.");
}
#endif
// On draw start, clear CEF.
EDSR &= ~0x2;
......@@ -528,7 +530,9 @@ void SetHBVB(const sscpu_timestamp_t event_timestamp, const bool new_hb_status,
{
if(DrawingActive)
{
#ifdef HAVE_DEBUG
SS_DBGTI(SS_DBG_WARNING | SS_DBG_VDP1, "[VDP1] Drawing aborted by framebuffer swap.");
#endif
DrawingActive = false;
}
......@@ -676,7 +680,9 @@ static INLINE void WriteReg(const unsigned which, const uint16 value)
SS_SetEventNT(SS_EVENT_VDP2, VDP2::Update(SH7095_mem_timestamp));
sscpu_timestamp_t nt = Update(SH7095_mem_timestamp);
#ifdef HAVE_DEBUG
SS_DBGTI(SS_DBG_VDP1_REGW, "[VDP1] Register write: 0x%02x: 0x%04x", which << 1, value);
#endif
switch(which)
{
......@@ -773,7 +779,9 @@ void Write8_DB(uint32 A, uint16 DB)
return;
}
#ifdef HAVE_DEBUG
SS_DBGTI(SS_DBG_WARNING | SS_DBG_VDP1, "[VDP1] 8-bit write to 0x%08x(DB=0x%04x)", A, DB);
#endif
WriteReg((A - 0x100000) >> 1, DB);
}
......
......@@ -311,10 +311,12 @@ static INLINE int32 PlotPixel(int32 x, int32 y, uint16 pix, bool transparent, Go
static INLINE void CheckUndefClipping(void)
{
#ifdef HAVE_DEBUG
if(SysClipX < UserClipX1 || SysClipY < UserClipY1 || UserClipX0 > UserClipX1 || UserClipY0 > UserClipY1)
{
//SS_DBG(SS_DBG_WARNING, "[VDP1] Illegal clipping windows; Sys=%u:%u -- User=%u:%u - %u:%u\n", SysClipX, SysClipY, UserClipX0, UserClipY0, UserClipX1, UserClipY1);
}
#endif
}
......
......@@ -502,7 +502,9 @@ static INLINE void RegsWrite(uint32 A, uint16 V)
RawRegs[A >> 1] = V;
#ifdef HAVE_DEBUG
SS_DBGTI(SS_DBG_VDP2_REGW, "[VDP2] Register write 0x%03x: 0x%04x", A, V);
#endif
switch(A)
{
......@@ -535,8 +537,10 @@ static INLINE void RegsWrite(uint32 A, uint16 V)
case 0x06:
VRAMSize = (V >> 15) & 0x1;
#ifdef HAVE_DEBUG
if(VRAMSize)
SS_DBGTI(SS_DBG_WARNING | SS_DBG_VDP2, "[VDP2] VRAMSize=%d (unemulated)", VRAMSize);
#endif
break;
case 0x0E:
......@@ -709,8 +713,10 @@ static INLINE void RW(uint32 A, uint16* DB)
{
if(IsWrite)
{
#ifdef HAVE_DEBUG
if(sizeof(T) == 1)
SS_DBGTI(SS_DBG_WARNING | SS_DBG_VDP2, "[VDP2] Byte-write to register at 0x%08x(DB=0x%04x)", A, *DB);
#endif
RegsWrite(A, *DB);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment