Added TAP file injection. Still incomplete.
This commit is contained in:
@@ -14,6 +14,7 @@ namespace Desktop
|
||||
private Z80 _cpu = null!;
|
||||
private MemoryBus _memoryBus = null!;
|
||||
private IO_Bus _simpleIoBus = null!;
|
||||
private TapManager _tapManager = null!;
|
||||
private int _ulaFrameCount = 0;
|
||||
|
||||
// The 16 physical colors of the ZX Spectrum (ARGB format)
|
||||
@@ -52,12 +53,12 @@ namespace Desktop
|
||||
{
|
||||
_memoryBus = new MemoryBus();
|
||||
_simpleIoBus = new IO_Bus();
|
||||
|
||||
_tapManager = new TapManager();
|
||||
_memoryBus.CrapRAMData();
|
||||
byte[] romData = RomLoader.Load("48.rom");
|
||||
_memoryBus.LoadRom(romData);
|
||||
|
||||
_cpu = new Z80(_memoryBus, _simpleIoBus);
|
||||
_cpu = new Z80(_memoryBus, _simpleIoBus, _tapManager);
|
||||
|
||||
// Pass 'this' so the DebuggerForm can talk back to this main window
|
||||
DebuggerForm debugger = new DebuggerForm(_cpu, _memoryBus, this);
|
||||
@@ -69,6 +70,25 @@ namespace Desktop
|
||||
}
|
||||
}
|
||||
|
||||
// Inside Desktop/Form1.cs
|
||||
private void loadTAPToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (OpenFileDialog ofd = new OpenFileDialog())
|
||||
{
|
||||
ofd.Filter = "Spectrum TAP Files|*.tap";
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
// The Desktop UI reads the file from the hard drive
|
||||
byte[] tapBytes = System.IO.File.ReadAllBytes(ofd.FileName);
|
||||
|
||||
// The pure Core logic processes the bytes
|
||||
_cpu._tapManager.LoadTapData(tapBytes);
|
||||
|
||||
MessageBox.Show("Tape inserted! Type LOAD \"\" and press Enter.", "Tape Deck");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Public so the Debugger's background thread can call it 50 times a second
|
||||
public void RenderScreen()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user