Merge branch 'master' of https://github.com/TASVideos/BizHawk
This commit is contained in:
commit
389e1000da
|
@ -159,6 +159,14 @@ namespace BizHawk.Emulation.Cores.Components.CP1610
|
|||
TotalExecutedCycles += cycles;
|
||||
return cycles;
|
||||
}
|
||||
|
||||
// This simulates the Halting caused by the STIC during visible frame using SR2
|
||||
if (BusRq && Interruptible) {// && !IntRM && !Interrupted) {
|
||||
PendingCycles--;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (Logging)
|
||||
{
|
||||
int addrToAdvance;
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace BizHawk.Emulation.Cores.Components.CP1610
|
|||
|
||||
public void SetBusRq(bool value)
|
||||
{
|
||||
BusRq = value;
|
||||
BusRq = !value;
|
||||
}
|
||||
|
||||
public int GetPendingCycles()
|
||||
|
|
|
@ -28,6 +28,9 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
// read the controller state here for now
|
||||
get_controller_state();
|
||||
|
||||
// this timer tracks cycles stolen by the STIC during the visible part of the frame, quite a large number of them actually
|
||||
int delay_cycles = 0;
|
||||
int delay_timer = -1;
|
||||
|
||||
_cpu.AddPendingCycles(14934 - 3791 - _cpu.GetPendingCycles());
|
||||
_stic.Sr1 = true;
|
||||
|
@ -36,6 +39,27 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
{
|
||||
int cycles = _cpu.Execute();
|
||||
_psg.generate_sound(cycles);
|
||||
|
||||
if (delay_cycles>=0)
|
||||
delay_cycles += cycles;
|
||||
|
||||
if (delay_timer>0)
|
||||
{
|
||||
delay_timer -= cycles;
|
||||
if (delay_timer<=0)
|
||||
{
|
||||
_stic.ToggleSr2();
|
||||
delay_cycles = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (delay_cycles>=800)
|
||||
{
|
||||
delay_cycles = -1;
|
||||
delay_timer = 110;
|
||||
_stic.ToggleSr2();
|
||||
}
|
||||
|
||||
Connect();
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,11 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
return Sr2;
|
||||
}
|
||||
|
||||
public void ToggleSr2()
|
||||
{
|
||||
Sr2 = !Sr2;
|
||||
}
|
||||
|
||||
public void SetSst(bool value)
|
||||
{
|
||||
Sst = value;
|
||||
|
@ -277,10 +282,25 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
{
|
||||
// Colored Squares Mode.
|
||||
int[] colors = new int[4];
|
||||
int[] square_col = new int[4];
|
||||
colors[0] = fg;
|
||||
colors[1] = (card >> 3) & 0x0007;
|
||||
colors[2] = (card >> 6) & 0x0007;
|
||||
colors[3] = ((card >> 11) & 0x0004) | ((card >> 9) & 0x0003);
|
||||
|
||||
for (int z=0;z<4;z++)
|
||||
{
|
||||
if (colors[z]==7)
|
||||
{
|
||||
colors[z] = ReadMemory(ColorSP) & 0x000F;
|
||||
square_col[z] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
square_col[z] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (int squares_row = 0; squares_row < 8; squares_row++)
|
||||
{
|
||||
for (int squares_col = 0; squares_col < 8; squares_col++)
|
||||
|
@ -316,6 +336,16 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
}
|
||||
}
|
||||
BGBuffer[pixel] = ColorToRGBA(colors[color]);
|
||||
|
||||
// also if the pixel is on set it in the collision matrix
|
||||
// note that the collision field is attached to the lower right corner of the BG
|
||||
// so we add 8 to x and 16 to y here
|
||||
// also notice the extra condition attached to colored squares mode
|
||||
if ((card_col * 8 + (7 - squares_col) + 8) < 167 && square_col[color]==1)
|
||||
{
|
||||
Collision[card_col * 8 + (7 - squares_col) + 8, (card_row * 8 + squares_row) * 2 + 16] = 1 << 8;
|
||||
Collision[card_col * 8 + (7 - squares_col) + 8, (card_row * 8 + squares_row) * 2 + 16 + 1] = 1 << 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue