mirror of
https://github.com/libretro/beetle-pce-fast-libretro.git
synced 2024-11-23 07:50:03 +00:00
Commented out logging - can reenable by defining DEBUG
This commit is contained in:
parent
3eea3bb044
commit
0d54ef767c
@ -357,8 +357,10 @@ void PS_CDC::WriteResult(uint8 V)
|
||||
ResultsWP = (ResultsWP + 1) & 0xF;
|
||||
ResultsIn = (ResultsIn + 1) & 0x1F;
|
||||
|
||||
#ifdef DEBUG
|
||||
if(!ResultsIn)
|
||||
PSX_WARNING("[CDC] Results buffer overflow!");
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8 PS_CDC::ReadResult(void)
|
||||
@ -519,8 +521,10 @@ void PS_CDC::XA_ProcessSector(const uint8 *sdata, CD_Audio_Buffer *ab)
|
||||
uint8 ibuffer[28];
|
||||
int16 obuffer[2 + 28];
|
||||
|
||||
#ifdef DEBUG
|
||||
if(param != param_copy)
|
||||
printf("%d %02x %02x\n", unit, param, param_copy);
|
||||
#endif
|
||||
|
||||
for(unsigned i = 0; i < 28; i++)
|
||||
{
|
||||
@ -590,10 +594,12 @@ void PS_CDC::CheckAIP(void)
|
||||
|
||||
void PS_CDC::SetAIP(unsigned irq, unsigned result_count, uint8 *r)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if(AsyncIRQPending)
|
||||
{
|
||||
PSX_WARNING("***WARNING*** Previous notification skipped: CurSector=%d, old_notification=0x%02x", CurSector, AsyncIRQPending);
|
||||
}
|
||||
#endif
|
||||
ClearAIP();
|
||||
|
||||
AsyncResultsPendingCount = result_count;
|
||||
@ -717,7 +723,9 @@ pscpu_timestamp_t PS_CDC::Update(const pscpu_timestamp_t timestamp)
|
||||
{
|
||||
if(CurSector >= (int32)toc.tracks[100].lba)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[CDC] Beyond end!");
|
||||
#endif
|
||||
DriveStatus = DS_STOPPED;
|
||||
|
||||
SetAIP(CDCIRQ_DISC_ERROR, MakeStatus() | 0x04, 0x04);
|
||||
@ -747,8 +755,10 @@ pscpu_timestamp_t PS_CDC::Update(const pscpu_timestamp_t timestamp)
|
||||
}
|
||||
//else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if(AudioBuffer_ReadPos & 0xFFF)
|
||||
printf("readpos=%04x(rabl=%04x) writepos=%04x\n", AudioBuffer_ReadPos, AudioBuffer[AudioBuffer_ReadPos >> 12].Size, AudioBuffer_WritePos);
|
||||
#endif
|
||||
|
||||
//if(AudioBuffer_UsedCount == 0)
|
||||
// AudioBuffer_InPrebuffer = true;
|
||||
@ -774,8 +784,10 @@ pscpu_timestamp_t PS_CDC::Update(const pscpu_timestamp_t timestamp)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if(!(Mode & 0x30) && (buf[12 + 6] & 0x20))
|
||||
PSX_WARNING("BORK: %d", CurSector);
|
||||
#endif
|
||||
|
||||
{
|
||||
int32 offs = (Mode & 0x20) ? 0 : 12;
|
||||
@ -912,8 +924,10 @@ pscpu_timestamp_t PS_CDC::Update(const pscpu_timestamp_t timestamp)
|
||||
else
|
||||
CurSector++;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else
|
||||
PSX_WARNING("[CDC] BUG CDDA buffer full");
|
||||
#endif
|
||||
|
||||
}
|
||||
} // end if playing
|
||||
@ -946,7 +960,9 @@ pscpu_timestamp_t PS_CDC::Update(const pscpu_timestamp_t timestamp)
|
||||
}
|
||||
else if(PendingCommand >= 0x20 || !Commands[PendingCommand].func)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[CDC] Unknown command: 0x%02x", PendingCommand);
|
||||
#endif
|
||||
|
||||
WriteResult(MakeStatus(true));
|
||||
WriteResult(ERRCODE_BAD_COMMAND);
|
||||
@ -956,7 +972,9 @@ pscpu_timestamp_t PS_CDC::Update(const pscpu_timestamp_t timestamp)
|
||||
}
|
||||
else if(ArgsIn < Commands[PendingCommand].args_min || ArgsIn > Commands[PendingCommand].args_max)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[CDC] Bad number(%d) of args(first check) for command 0x%02x", ArgsIn, PendingCommand);
|
||||
#endif
|
||||
|
||||
WriteResult(MakeStatus(true));
|
||||
WriteResult(ERRCODE_BAD_NUMARGS);
|
||||
@ -969,10 +987,12 @@ pscpu_timestamp_t PS_CDC::Update(const pscpu_timestamp_t timestamp)
|
||||
const CDC_CTEntry *command = &Commands[PendingCommand];
|
||||
//PSX_WARNING("[CDC] Command: %s --- %d", command->name, Results.CanRead());
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("[CDC] Command: %s --- ", command->name);
|
||||
for(unsigned int i = 0; i < ArgsIn; i++)
|
||||
printf(" 0x%02x", ArgsBuf[i]);
|
||||
printf("\n");
|
||||
#endif
|
||||
next_time = (this->*(command->func))(ArgsIn, ArgsBuf);
|
||||
PendingCommandPhase = 1;
|
||||
ArgsIn = 0;
|
||||
@ -1015,10 +1035,13 @@ void PS_CDC::Write(const pscpu_timestamp_t timestamp, uint32 A, uint8 V)
|
||||
switch(reg_index)
|
||||
{
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[CDC] Unknown write to register 0x%02x: 0x%02x\n", reg_index, V);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0x00:
|
||||
#ifdef DEBUG
|
||||
if(PendingCommandCounter > 0)
|
||||
{
|
||||
PSX_WARNING("[CDC] WARNING: Interrupting command 0x%02x, phase=%d, timeleft=%d with command=0x%02x", PendingCommand, PendingCommandPhase,
|
||||
@ -1034,6 +1057,7 @@ void PS_CDC::Write(const pscpu_timestamp_t timestamp, uint32 A, uint8 V)
|
||||
{
|
||||
PSX_WARNING("[CDC] Attempting to start command(0x%02x) while command results(count=%d) still in buffer.", V, ResultsIn);
|
||||
}
|
||||
#endif
|
||||
|
||||
PendingCommandCounter = 8192; //1024; //128; //256; //16; //1024;
|
||||
PendingCommand = V;
|
||||
@ -1044,10 +1068,12 @@ void PS_CDC::Write(const pscpu_timestamp_t timestamp, uint32 A, uint8 V)
|
||||
ArgsBuf[ArgsIn & 0xF] = V;
|
||||
ArgsIn = (ArgsIn + 1) & 0x1F;
|
||||
|
||||
#ifdef DEBUG
|
||||
if(!(ArgsIn & 0x0F))
|
||||
{
|
||||
PSX_WARNING("[CDC] Argument buffer overflow");
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
@ -1057,7 +1083,9 @@ void PS_CDC::Write(const pscpu_timestamp_t timestamp, uint32 A, uint8 V)
|
||||
{
|
||||
if(!SB_In)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[CDC] Data read begin when no data to read!");
|
||||
#endif
|
||||
|
||||
DMABuffer.Write(SB, 2340);
|
||||
|
||||
@ -1087,7 +1115,9 @@ void PS_CDC::Write(const pscpu_timestamp_t timestamp, uint32 A, uint8 V)
|
||||
|
||||
if(V & 0x20)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[CDC] Mystery IRQ trigger bit set.");
|
||||
#endif
|
||||
IRQBuffer |= 0x10;
|
||||
}
|
||||
break;
|
||||
@ -1103,7 +1133,9 @@ void PS_CDC::Write(const pscpu_timestamp_t timestamp, uint32 A, uint8 V)
|
||||
|
||||
if(V & 0x80) // Forced CD hardware reset of some kind(interface, controller, and drive?) Seems to take a while(relatively speaking) to complete.
|
||||
{
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[CDC] Soft Reset");
|
||||
#endif
|
||||
SoftReset();
|
||||
}
|
||||
|
||||
@ -1134,6 +1166,7 @@ void PS_CDC::Write(const pscpu_timestamp_t timestamp, uint32 A, uint8 V)
|
||||
{
|
||||
memcpy(DecodeVolume, Pending_DecodeVolume, sizeof(DecodeVolume));
|
||||
|
||||
#ifdef DEBUG
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
for(int o = 0; o < 2; o++)
|
||||
@ -1141,6 +1174,7 @@ void PS_CDC::Write(const pscpu_timestamp_t timestamp, uint32 A, uint8 V)
|
||||
//fprintf(stderr, "Input Channel %d, Output Channel %d -- Volume=%d\n", i, o, DecodeVolume[i][o]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1182,10 +1216,12 @@ uint8 PS_CDC::Read(const pscpu_timestamp_t timestamp, uint32 A)
|
||||
case 0x02:
|
||||
if(DMABuffer.CanRead())
|
||||
ret = DMABuffer.ReadByte();
|
||||
#ifdef DEBUG
|
||||
else
|
||||
{
|
||||
PSX_WARNING("[CDC] CD data transfer port read, but no data present!");
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0x03:
|
||||
@ -1244,7 +1280,9 @@ bool PS_CDC::CommandCheckDiscPresent(void)
|
||||
|
||||
int32 PS_CDC::Command_Sync(const int arg_count, const uint8 *args)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[CDC] Unimplemented command: 0x%02x", PendingCommand);
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
@ -1290,7 +1328,9 @@ static int32 CalcSeekTime(int32 initial, int32 target, bool motor_on, bool pause
|
||||
else if(paused)
|
||||
ret += (int64)33868800 * 150 / 1000;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("%d\n", ret);
|
||||
#endif
|
||||
|
||||
return(ret);
|
||||
}
|
||||
@ -1341,12 +1381,16 @@ int32 PS_CDC::Command_Play(const int arg_count, const uint8 *args)
|
||||
|
||||
if(track < toc.first_track)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[CDC] Attempt to play track before first track.");
|
||||
#endif
|
||||
track = toc.first_track;
|
||||
}
|
||||
else if(track > toc.last_track)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[CDC] Attempt to play track before first track.");
|
||||
#endif
|
||||
track = toc.last_track;
|
||||
}
|
||||
|
||||
@ -1354,7 +1398,9 @@ int32 PS_CDC::Command_Play(const int arg_count, const uint8 *args)
|
||||
|
||||
PlayTrackMatch = track;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("[CDC] Play track: %d\n", track);
|
||||
#endif
|
||||
SeekTarget = toc.tracks[track].lba;
|
||||
PSRCounter = CalcSeekTime(CurSector, SeekTarget, DriveStatus != DS_STOPPED, DriveStatus == DS_PAUSED);
|
||||
PreSeekHack(SeekTarget);
|
||||
@ -1771,7 +1817,9 @@ int32 PS_CDC::Command_Test(const int arg_count, const uint8 *args)
|
||||
switch(args[0])
|
||||
{
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[CDC] Unknown Test command sub-operation: 0x%02x", args[0]);
|
||||
#endif
|
||||
WriteResult(MakeStatus(true));
|
||||
WriteResult(0x10);
|
||||
WriteIRQ(CDCIRQ_DISC_ERROR);
|
||||
@ -1792,7 +1840,9 @@ int32 PS_CDC::Command_Test(const int arg_count, const uint8 *args)
|
||||
case 0x18:
|
||||
case 0x19:
|
||||
case 0x1A:
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[CDC] Unknown Test command sub-operation: 0x%02x", args[0]);
|
||||
#endif
|
||||
WriteResult(MakeStatus());
|
||||
WriteIRQ(CDCIRQ_ACKNOWLEDGE);
|
||||
break;
|
||||
@ -1807,14 +1857,18 @@ int32 PS_CDC::Command_Test(const int arg_count, const uint8 *args)
|
||||
#endif
|
||||
|
||||
case 0x51: // *Need to retest this test command
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[CDC] Unknown Test command sub-operation: 0x%02x", args[0]);
|
||||
#endif
|
||||
WriteResult(0x01);
|
||||
WriteResult(0x00);
|
||||
WriteResult(0x00);
|
||||
break;
|
||||
|
||||
case 0x75: // *Need to retest this test command
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[CDC] Unknown Test command sub-operation: 0x%02x", args[0]);
|
||||
#endif
|
||||
WriteResult(0x00);
|
||||
WriteResult(0xC0);
|
||||
WriteResult(0x00);
|
||||
|
@ -209,6 +209,7 @@ uint32 PS_CPU::Exception(uint32 code, uint32 PC, const uint32 NPM)
|
||||
const bool InBDSlot = !(NPM & 0x3);
|
||||
uint32 handler = 0x80000080;
|
||||
|
||||
#ifdef DEBUG
|
||||
assert(code < 16);
|
||||
|
||||
if(code != EXCEPTION_INT && code != EXCEPTION_BP && code != EXCEPTION_SYSCALL)
|
||||
@ -217,6 +218,7 @@ uint32 PS_CPU::Exception(uint32 code, uint32 PC, const uint32 NPM)
|
||||
IRQ_GetRegister(IRQ_GSREG_STATUS, NULL, 0), IRQ_GetRegister(IRQ_GSREG_MASK, NULL, 0));
|
||||
//assert(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(CP0.SR & (1 << 22)) // BEV
|
||||
handler = 0xBFC00180;
|
||||
@ -411,7 +413,9 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in)
|
||||
|
||||
{
|
||||
BEGIN_OPF(ILL, 0, 0);
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[CPU] Unknown instruction @%08x = %08x, op=%02x, funct=%02x", PC, instr, instr >> 26, (instr & 0x3F));
|
||||
#endif
|
||||
DO_LDS();
|
||||
new_PC = Exception(EXCEPTION_RI, PC, new_PC_mask);
|
||||
new_PC_mask = 0;
|
||||
@ -598,7 +602,9 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in)
|
||||
// BREAK - Breakpoint
|
||||
//
|
||||
BEGIN_OPF(BREAK, 0, 0x0D);
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[CPU] BREAK BREAK BREAK BREAK DAAANCE -- PC=0x%08x", PC);
|
||||
#endif
|
||||
|
||||
DO_LDS();
|
||||
new_PC = Exception(EXCEPTION_BP, PC, new_PC_mask);
|
||||
@ -640,10 +646,12 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in)
|
||||
uint32 rd = (instr >> 11) & 0x1F;
|
||||
uint32 val = GPR[rt];
|
||||
|
||||
#ifdef DEBUG
|
||||
if(rd != CP0REG_CAUSE && rd != CP0REG_SR && val)
|
||||
{
|
||||
PSX_WARNING("[CPU] Unimplemented MTC0: rt=%d(%08x) -> rd=%d", rt, GPR[rt], rd);
|
||||
}
|
||||
#endif
|
||||
|
||||
switch(rd)
|
||||
{
|
||||
@ -681,8 +689,10 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in)
|
||||
CP0.SR = val & ~( (0x3 << 26) | (0x3 << 23) | (0x3 << 6));
|
||||
RecalcIPCache();
|
||||
|
||||
#ifdef DEBUG
|
||||
if(CP0.SR & 0x10000)
|
||||
PSX_WARNING("[CPU] IsC set");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -461,8 +461,11 @@ void DMA_Write(const pscpu_timestamp_t timestamp, uint32 A, uint32 V)
|
||||
RecalcIRQOut();
|
||||
break;
|
||||
|
||||
default: PSX_WARNING("[DMA] Unknown write: %08x %08x", A, V);
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[DMA] Unknown write: %08x %08x", A, V);
|
||||
assert(0);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return;
|
||||
@ -496,8 +499,10 @@ void DMA_Write(const pscpu_timestamp_t timestamp, uint32 A, uint32 V)
|
||||
GPU->Write(timestamp, 0x04, 0x01 << 24);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[DMA] Forced stop for channel %d -- scanline=%d", ch, GPU->GetScanlineNum());
|
||||
MDFN_DispMessage("[DMA] Forced stop for channel %d", ch);
|
||||
#endif
|
||||
}
|
||||
|
||||
if(ch == 6)
|
||||
@ -544,8 +549,11 @@ uint32 DMA_Read(const pscpu_timestamp_t timestamp, uint32 A)
|
||||
{
|
||||
switch(A & 0xC)
|
||||
{
|
||||
default: PSX_WARNING("[DMA] Unknown read: %08x", A);
|
||||
assert(0);
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[DMA] Unknown read: %08x", A);
|
||||
assert(0);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0x0: ret = DMAControl;
|
||||
|
@ -416,10 +416,12 @@ void MDEC_DMAWrite(uint32 V)
|
||||
InCounter--;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else
|
||||
{
|
||||
printf("MYSTERY1: %08x\n", V);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32 MDEC_DMARead(void)
|
||||
@ -444,7 +446,9 @@ bool MDEC_DMACanRead(void)
|
||||
|
||||
void MDEC_Write(const pscpu_timestamp_t timestamp, uint32 A, uint32 V)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[MDEC] Write: 0x%08x 0x%08x, %d", A, V, timestamp);
|
||||
#endif
|
||||
if(A & 4)
|
||||
{
|
||||
if(V & 0x80000000) // Reset?
|
||||
|
@ -499,12 +499,16 @@ template<typename T, bool IsWrite, bool Access24, bool Peek> static INLINE void
|
||||
{
|
||||
if(IsWrite)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[MEM] Unknown write%d to %08x at time %d, =%08x(%d)", (int)(sizeof(T) * 8), A, timestamp, V, V);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
V = 0;
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[MEM] Unknown read%d from %08x at time %d", (int)(sizeof(T) * 8), A, timestamp);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -45,7 +45,9 @@ uint32 SIO_Read(pscpu_timestamp_t timestamp, uint32 A)
|
||||
switch(A & 0xE)
|
||||
{
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[SIO] Unknown read: 0x%08x -- %d\n", A, timestamp);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0x0:
|
||||
@ -80,7 +82,9 @@ void SIO_Write(pscpu_timestamp_t timestamp, uint32 A, uint32 V)
|
||||
switch(A & 0xE)
|
||||
{
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
PSX_WARNING("[SIO] Unknown write: 0x%08x 0x%08x -- %d\n", A, V, timestamp);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0x0:
|
||||
|
@ -488,7 +488,10 @@ void PS_SPU::RunEnvelope(SPU_Voice *voice)
|
||||
//static INLINE void CalcVCDelta(const uint8 zs, uint8 speed, bool log_mode, bool decrement, int16 Current, int &increment, int &divinco)
|
||||
switch(ADSR->Phase)
|
||||
{
|
||||
default: assert(0);
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
assert(0);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case ADSR_ATTACK:
|
||||
@ -762,7 +765,9 @@ int32 PS_SPU::UpdateFromCDC(int32 clocks)
|
||||
phase_inc = voice->Pitch + (((int16)voice->Pitch * ((voice - 1)->PreLRSample)) >> 15);
|
||||
if(phase_inc < 0)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("phase_inc < 0 (THIS SHOULD NOT HAPPEN)\n");
|
||||
#endif
|
||||
phase_inc = 0;
|
||||
}
|
||||
}
|
||||
@ -883,7 +888,9 @@ int32 PS_SPU::UpdateFromCDC(int32 clocks)
|
||||
clamp(&output_l, -32768, 32767);
|
||||
clamp(&output_r, -32768, 32767);
|
||||
|
||||
#ifdef DEBUG
|
||||
assert(IntermediateBufferPos < 4096);
|
||||
#endif
|
||||
IntermediateBuffer[IntermediateBufferPos][0] = output_l;
|
||||
IntermediateBuffer[IntermediateBufferPos][1] = output_r;
|
||||
IntermediateBufferPos++;
|
||||
@ -1231,7 +1238,9 @@ int32 PS_SPU::EndFrame(int16 *SoundBuf)
|
||||
|
||||
speex_resampler_process_interleaved_int(resampler, (const spx_int16_t *)IntermediateBuffer, &in_len, (spx_int16_t *)SoundBuf, &out_len);
|
||||
|
||||
#ifdef DEBUG
|
||||
assert(in_len <= IntermediateBufferPos);
|
||||
#endif
|
||||
|
||||
if((IntermediateBufferPos - in_len) > 0)
|
||||
memmove(IntermediateBuffer, IntermediateBuffer + in_len, (IntermediateBufferPos - in_len) * sizeof(int16) * 2);
|
||||
|
@ -116,7 +116,9 @@ static int32 CalcNextEvent(int32 next_event)
|
||||
count_delta = target - Timers[i].Counter;
|
||||
if(count_delta <= 0)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "timer %d count_delta <= 0!!! %d %d\n", i, target, Timers[i].Counter);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -128,13 +130,17 @@ static int32 CalcNextEvent(int32 next_event)
|
||||
|
||||
if((i == 0x2) && (Timers[i].Mode & 0x200))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
assert(Timers[i].Div8Counter >= 0 && Timers[i].Div8Counter < 8);
|
||||
#endif
|
||||
tmp_clocks = ((count_delta - 1) * 8) + (8 - Timers[i].Div8Counter);
|
||||
}
|
||||
else
|
||||
tmp_clocks = count_delta;
|
||||
|
||||
#ifdef DEBUG
|
||||
assert(tmp_clocks > 0);
|
||||
#endif
|
||||
|
||||
if(next_event > tmp_clocks)
|
||||
next_event = tmp_clocks;
|
||||
@ -178,7 +184,7 @@ static void ClockTimer(int i, uint32 clocks)
|
||||
|
||||
if((before < target && Timers[i].Counter >= target) || zero_tm || Timers[i].Counter > 0xFFFF)
|
||||
{
|
||||
#if 1
|
||||
#ifdef DEBUG
|
||||
if(Timers[i].Mode & 0x10)
|
||||
{
|
||||
if((Timers[i].Counter - target) > 3)
|
||||
@ -255,9 +261,11 @@ void TIMER_Write(const pscpu_timestamp_t timestamp, uint32 A, uint16 V)
|
||||
|
||||
int which = (A >> 4) & 0x3;
|
||||
|
||||
#ifdef DEBUG
|
||||
assert(!(A & 3));
|
||||
|
||||
PSX_DBGINFO("[TIMER] Write: %08x %04x", A, V);
|
||||
#endif
|
||||
|
||||
if(which >= 3)
|
||||
return;
|
||||
@ -314,10 +322,12 @@ uint16 TIMER_Read(const pscpu_timestamp_t timestamp, uint32 A)
|
||||
uint16 ret = 0;
|
||||
int which = (A >> 4) & 0x3;
|
||||
|
||||
#ifdef DEBUG
|
||||
assert(!(A & 3));
|
||||
|
||||
if(which >= 3)
|
||||
assert(0);
|
||||
#endif
|
||||
|
||||
TIMER_Update(timestamp);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user