GBHawk: minor optimizatiosn
This commit is contained in:
parent
96d4b17056
commit
ea085255c1
|
@ -145,11 +145,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkNew
|
||||||
|
|
||||||
#region Audio
|
#region Audio
|
||||||
|
|
||||||
public BlipBuffer blip_L = new BlipBuffer(9000);
|
public BlipBuffer blip_L = new BlipBuffer(25000);
|
||||||
public BlipBuffer blip_R = new BlipBuffer(9000);
|
public BlipBuffer blip_R = new BlipBuffer(25000);
|
||||||
|
|
||||||
public int[] Aud_L = new int[9000];
|
public int[] Aud_L = new int[25000];
|
||||||
public int[] Aud_R = new int[9000];
|
public int[] Aud_R = new int[25000];
|
||||||
public uint num_samp_L;
|
public uint num_samp_L;
|
||||||
public uint num_samp_R;
|
public uint num_samp_R;
|
||||||
|
|
||||||
|
|
|
@ -159,18 +159,18 @@ namespace GBHawk
|
||||||
if (!MemMap.HDMA_transfer)
|
if (!MemMap.HDMA_transfer)
|
||||||
{
|
{
|
||||||
// These things all tick twice as fast in GBC double speed mode
|
// These things all tick twice as fast in GBC double speed mode
|
||||||
ppu->DMA_tick();
|
if (ppu->DMA_start && !cpu.halted) { ppu->DMA_tick(); }
|
||||||
timer.tick_1();
|
timer.tick_1();
|
||||||
serialport.serial_transfer_tick();
|
serialport.serial_transfer_tick();
|
||||||
cpu.ExecuteOne(&MemMap.REG_FF0F, MemMap.REG_FFFF);
|
cpu.ExecuteOne(&MemMap.REG_FF0F, &MemMap.REG_FFFF);
|
||||||
timer.tick_2();
|
timer.tick_2();
|
||||||
|
|
||||||
if (MemMap.double_speed)
|
if (MemMap.double_speed)
|
||||||
{
|
{
|
||||||
ppu->DMA_tick();
|
if (ppu->DMA_start && !cpu.halted) { ppu->DMA_tick(); }
|
||||||
timer.tick_1();
|
timer.tick_1();
|
||||||
serialport.serial_transfer_tick();
|
serialport.serial_transfer_tick();
|
||||||
cpu.ExecuteOne(&MemMap.REG_FF0F, MemMap.REG_FFFF);
|
cpu.ExecuteOne(&MemMap.REG_FF0F, &MemMap.REG_FFFF);
|
||||||
timer.tick_2();
|
timer.tick_2();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,18 +236,19 @@ namespace GBHawk
|
||||||
if (!MemMap.HDMA_transfer)
|
if (!MemMap.HDMA_transfer)
|
||||||
{
|
{
|
||||||
// These things all tick twice as fast in GBC double speed mode
|
// These things all tick twice as fast in GBC double speed mode
|
||||||
ppu->DMA_tick();
|
// Note that DMA is halted when the CPU is halted
|
||||||
|
if (ppu->DMA_start && !cpu.halted) { ppu->DMA_tick(); }
|
||||||
timer.tick_1();
|
timer.tick_1();
|
||||||
serialport.serial_transfer_tick();
|
serialport.serial_transfer_tick();
|
||||||
cpu.ExecuteOne(&MemMap.REG_FF0F, MemMap.REG_FFFF);
|
cpu.ExecuteOne(&MemMap.REG_FF0F, &MemMap.REG_FFFF);
|
||||||
timer.tick_2();
|
timer.tick_2();
|
||||||
|
|
||||||
if (MemMap.double_speed)
|
if (MemMap.double_speed)
|
||||||
{
|
{
|
||||||
ppu->DMA_tick();
|
if (ppu->DMA_start && !cpu.halted) { ppu->DMA_tick(); }
|
||||||
timer.tick_1();
|
timer.tick_1();
|
||||||
serialport.serial_transfer_tick();
|
serialport.serial_transfer_tick();
|
||||||
cpu.ExecuteOne(&MemMap.REG_FF0F, MemMap.REG_FFFF);
|
cpu.ExecuteOne(&MemMap.REG_FF0F, &MemMap.REG_FFFF);
|
||||||
timer.tick_2();
|
timer.tick_2();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,8 @@ namespace GBHawk
|
||||||
uint32_t* timer_div_reg = nullptr;
|
uint32_t* timer_div_reg = nullptr;
|
||||||
|
|
||||||
uint32_t num_samples_L, num_samples_R;
|
uint32_t num_samples_L, num_samples_R;
|
||||||
int32_t samples_L[9000] = {};
|
int32_t samples_L[25000] = {};
|
||||||
int32_t samples_R[9000] = {};
|
int32_t samples_R[25000] = {};
|
||||||
|
|
||||||
bool DUTY_CYCLES[32] = {false, false, false, false, false, false, false, true,
|
bool DUTY_CYCLES[32] = {false, false, false, false, false, false, false, true,
|
||||||
true, false, false, false, false, false, false, true,
|
true, false, false, false, false, false, false, true,
|
||||||
|
|
|
@ -197,7 +197,7 @@ namespace GBHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute instructions
|
// Execute instructions
|
||||||
void ExecuteOne(uint8_t* interrupt_src, uint8_t interrupt_enable)
|
void ExecuteOne(uint8_t* interrupt_src, uint8_t* interrupt_enable)
|
||||||
{
|
{
|
||||||
switch (instr_table[instr_pntr++])
|
switch (instr_table[instr_pntr++])
|
||||||
{
|
{
|
||||||
|
@ -554,7 +554,7 @@ namespace GBHawk
|
||||||
instr_pntr++;
|
instr_pntr++;
|
||||||
//Console.WriteLine(interrupt_src + " " + interrupt_enable + " " + TotalExecutedCycles);
|
//Console.WriteLine(interrupt_src + " " + interrupt_enable + " " + TotalExecutedCycles);
|
||||||
|
|
||||||
if (((interrupt_src[0] & (1 << bit_check)) > 0) && ((interrupt_enable & (1 << bit_check)) > 0)) { int_src = bit_check; int_clear = (uint8_t)(1 << bit_check); }
|
if (((interrupt_src[0] & (1 << bit_check)) > 0) && ((interrupt_enable[0] & (1 << bit_check)) > 0)) { int_src = bit_check; int_clear = (uint8_t)(1 << bit_check); }
|
||||||
/*
|
/*
|
||||||
if (interrupt_src.Bit(0) && interrupt_enable.Bit(0)) { int_src = 0; int_clear = 1; }
|
if (interrupt_src.Bit(0) && interrupt_enable.Bit(0)) { int_src = 0; int_clear = 1; }
|
||||||
else if (interrupt_src.Bit(1) && interrupt_enable.Bit(1)) { int_src = 1; int_clear = 2; }
|
else if (interrupt_src.Bit(1) && interrupt_enable.Bit(1)) { int_src = 1; int_clear = 2; }
|
||||||
|
@ -581,7 +581,7 @@ namespace GBHawk
|
||||||
case IRQ_CLEAR:
|
case IRQ_CLEAR:
|
||||||
if ((interrupt_src[0] & (1 << int_src)) > 0) { interrupt_src[0] -= int_clear; }
|
if ((interrupt_src[0] & (1 << int_src)) > 0) { interrupt_src[0] -= int_clear; }
|
||||||
|
|
||||||
if ((interrupt_src[0] & interrupt_enable) == 0) { FlagI = false; }
|
if ((interrupt_src[0] & interrupt_enable[0]) == 0) { FlagI = false; }
|
||||||
|
|
||||||
// reset back to default state
|
// reset back to default state
|
||||||
int_src = 5;
|
int_src = 5;
|
||||||
|
|
Loading…
Reference in New Issue