Intellivision implement BackTab calls

Correct timing for background drawing, not sure if any game uses it though
This commit is contained in:
alyosha-tas 2016-12-23 20:07:12 -05:00 committed by GitHub
parent 35d86388a4
commit 585f35b29e
3 changed files with 77 additions and 69 deletions

View File

@ -25,11 +25,12 @@ namespace BizHawk.Emulation.Cores.Intellivision
_psg.sample_count = 0; _psg.sample_count = 0;
_frame++; _frame++;
stic_row = -1;
// read the controller state here for now // read the controller state here for now
get_controller_state(); 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 // 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_cycles = 600;
int delay_timer = -1; int delay_timer = -1;
_cpu.PendingCycles = (14934 - 3791 + _cpu.GetPendingCycles()); _cpu.PendingCycles = (14934 - 3791 + _cpu.GetPendingCycles());
@ -53,13 +54,19 @@ namespace BizHawk.Emulation.Cores.Intellivision
} }
} }
if (delay_cycles>= 800 && _stic.active_display) if (delay_cycles>= 750 && _stic.active_display)
{ {
delay_cycles = -1; delay_cycles = -1;
delay_timer = 110; delay_timer = 110;
_stic.ToggleSr2(); _stic.ToggleSr2();
if (stic_row >= 0)
{
_stic.in_vb_2 = true;
_stic.Background(stic_row);
_stic.in_vb_2 = false;
}
stic_row++;
} }
Connect(); Connect();
} }
@ -69,7 +76,6 @@ namespace BizHawk.Emulation.Cores.Intellivision
if (_stic.active_display) if (_stic.active_display)
{ {
_stic.Background();
_stic.Mobs(); _stic.Mobs();
} }
@ -100,6 +106,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
} }
private int _frame; private int _frame;
private int stic_row;
public int Frame { get { return _frame; } } public int Frame { get { return _frame; } }
public string SystemId public string SystemId

View File

@ -1,56 +1,57 @@
using System.IO; using System.IO;
using BizHawk.Common; using BizHawk.Common;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Intellivision namespace BizHawk.Emulation.Cores.Intellivision
{ {
public partial class Intellivision : IStatable public partial class Intellivision : IStatable
{ {
public bool BinarySaveStatesPreferred public bool BinarySaveStatesPreferred
{ {
get { return true; } get { return true; }
} }
public void SaveStateText(TextWriter writer) public void SaveStateText(TextWriter writer)
{ {
SyncState(Serializer.CreateTextWriter(writer)); SyncState(Serializer.CreateTextWriter(writer));
} }
public void LoadStateText(TextReader reader) public void LoadStateText(TextReader reader)
{ {
SyncState(Serializer.CreateTextReader(reader)); SyncState(Serializer.CreateTextReader(reader));
SetupMemoryDomains(); // resync the memory domains SetupMemoryDomains(); // resync the memory domains
} }
public void SaveStateBinary(BinaryWriter bw) public void SaveStateBinary(BinaryWriter bw)
{ {
SyncState(Serializer.CreateBinaryWriter(bw)); SyncState(Serializer.CreateBinaryWriter(bw));
} }
public void LoadStateBinary(BinaryReader br) public void LoadStateBinary(BinaryReader br)
{ {
SyncState(Serializer.CreateBinaryReader(br)); SyncState(Serializer.CreateBinaryReader(br));
SetupMemoryDomains(); // resync the memory domains SetupMemoryDomains(); // resync the memory domains
} }
public byte[] SaveStateBinary() public byte[] SaveStateBinary()
{ {
MemoryStream ms = new MemoryStream(); MemoryStream ms = new MemoryStream();
BinaryWriter bw = new BinaryWriter(ms); BinaryWriter bw = new BinaryWriter(ms);
SaveStateBinary(bw); SaveStateBinary(bw);
bw.Flush(); bw.Flush();
return ms.ToArray(); return ms.ToArray();
} }
private void SyncState(Serializer ser) private void SyncState(Serializer ser)
{ {
int version = 1; int version = 1;
ser.BeginSection("Intellivision"); ser.BeginSection("Intellivision");
ser.Sync("version", ref version); ser.Sync("version", ref version);
ser.Sync("Frame", ref _frame); ser.Sync("Frame", ref _frame);
ser.Sync("stic_row", ref stic_row);
ser.Sync("ScratchpadRam", ref ScratchpadRam, false); ser.Sync("ScratchpadRam", ref ScratchpadRam, false);
ser.Sync("SystemRam", ref SystemRam, false); ser.Sync("SystemRam", ref SystemRam, false);
ser.Sync("ExecutiveRom", ref ExecutiveRom, false); ser.Sync("ExecutiveRom", ref ExecutiveRom, false);
@ -59,13 +60,13 @@ namespace BizHawk.Emulation.Cores.Intellivision
_cpu.SyncState(ser); _cpu.SyncState(ser);
_stic.SyncState(ser); _stic.SyncState(ser);
_psg.SyncState(ser); _psg.SyncState(ser);
_cart.SyncState(ser); _cart.SyncState(ser);
ControllerDeck.SyncState(ser); ControllerDeck.SyncState(ser);
ser.EndSection(); ser.EndSection();
} }
} }
} }

View File

@ -319,7 +319,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
throw new ArgumentException("Specified color does not exist."); throw new ArgumentException("Specified color does not exist.");
} }
public void Background() public void Background(int input_row)
{ {
// here we will also need to apply the 'delay' register values. // here we will also need to apply the 'delay' register values.
// this shifts the background portion of the screen relative to the mobs // this shifts the background portion of the screen relative to the mobs
@ -328,7 +328,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
ColorSP = 0x0028; ColorSP = 0x0028;
// The background is a 20x12 grid of "cards". // The background is a 20x12 grid of "cards".
for (int card_row = 0; card_row < 12; card_row++) for (int card_row = input_row; card_row < (input_row+1); card_row++)
{ {
for (int card_col = 0; card_col < 20; card_col++) for (int card_col = 0; card_col < 20; card_col++)
{ {