Intellivision more cleanup

This commit is contained in:
alyosha-tas 2016-12-27 09:50:14 -05:00 committed by GitHub
parent 46966ef7c9
commit c61a15458c
2 changed files with 32 additions and 72 deletions

View File

@ -5,7 +5,6 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Intellivision
{
// Sound refactor todo: Implement ISoundProvider, and register _psg in the Intellivision core
public sealed class PSG : ISoundProvider
{
public ushort[] Register = new ushort[16];
@ -66,12 +65,8 @@ namespace BizHawk.Emulation.Cores.Intellivision
for (int i = 0; i < samples.Length / 2; i++)
{
samples[i * 2] = (short)(audio_samples[(int)Math.Floor(3.7904 * i)]);
//samples[i * 2] = (short)(audio_samples[(int)Math.Floor(4.0 * i)]);
//samples[i * 2] = (short)(audio_samples[i*5]);
samples[(i * 2) + 1] = samples[i * 2];
}
}
// There is one audio clock for every 4 cpu clocks, and ~15000 cycles per frame
@ -231,14 +226,6 @@ namespace BizHawk.Emulation.Cores.Intellivision
E_up_down = 1;
}
}
/*
if (reg == 0 || reg == 4)
clock_A = sq_per_A;
if (reg == 1 || reg == 5)
clock_A = sq_per_A;
if (reg == 2 || reg == 6)
clock_A = sq_per_A;
*/
return true;
}
return false;
@ -299,12 +286,12 @@ namespace BizHawk.Emulation.Cores.Intellivision
{
if (env_E == 16)
{
env_E = 14;
env_E = 15;
E_up_down = -1;
}
else
{
env_E = 1;
env_E = 0;
E_up_down = 1;
}
}

View File

@ -179,9 +179,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
switch (addr & 0xF000)
{
case 0x0000:
if (addr <= 0x003F)
{
if (in_vb_1 | !active_display)
if (addr <= 0x003F && (in_vb_1 | !active_display))
{
if (addr == 0x0021)
{
@ -189,50 +187,37 @@ namespace BizHawk.Emulation.Cores.Intellivision
}
return Register[addr];
}
}
else if (addr <= 0x007F)
{
if (in_vb_2 | !active_display)
else if (addr>= 0x0040 && addr <= 0x007F && (in_vb_2 | !active_display))
{
return Register[addr - 0x0040];
}
}
break;
case 0x4000:
if (addr <= 0x403F)
{
if (in_vb_1 | !active_display)
if ((addr <= 0x403F) && (in_vb_1 | !active_display))
{
if (addr == 0x4021)
{
Fgbg = false;
}
}
}
break;
case 0x8000:
if (addr <= 0x803F)
{
if (in_vb_1 | !active_display)
if ((addr <= 0x803F) && (in_vb_1 | !active_display))
{
if (addr == 0x8021)
{
Fgbg = false;
}
}
}
break;
case 0xC000:
if (addr <= 0xC03F)
{
if (in_vb_1 | !active_display)
if ((addr <= 0xC03F) && (in_vb_1 | !active_display))
{
if (addr == 0xC021)
{
Fgbg = false;
}
}
}
break;
}
return null;
@ -243,44 +228,32 @@ namespace BizHawk.Emulation.Cores.Intellivision
switch (addr & 0xF000)
{
case 0x0000:
if (addr <= 0x003F)
{
if (in_vb_1 | !active_display)
if (addr <= 0x003F && (in_vb_1 | !active_display))
{
write_reg(addr, value);
return true;
}
}
break;
case 0x4000:
if (addr <= 0x403F)
{
if (in_vb_1 | !active_display)
if (addr <= 0x403F && (in_vb_1 | !active_display))
{
write_reg(addr-0x4000, value);
return true;
}
}
break;
case 0x8000:
if (addr <= 0x803F)
{
if (in_vb_1 | !active_display)
if (addr <= 0x803F && (in_vb_1 | !active_display))
{
write_reg(addr-0x8000, value);
return true;
}
}
break;
case 0xC000:
if (addr <= 0xC03F)
{
if (in_vb_1 | !active_display)
if (addr <= 0xC03F && (in_vb_1 | !active_display))
{
write_reg(addr-0xC000, value);
return true;
}
}
break;
}
return false;