misc cleanups in Emulation.Cores

This commit is contained in:
adelikat 2017-04-17 15:23:04 -05:00
parent 28da1e215f
commit 94f152d1d1
7 changed files with 253 additions and 211 deletions

View File

@ -120,16 +120,19 @@ namespace BizHawk.Emulation.Cores.Calculators
}
}
public IMemoryCallbackSystem MemoryCallbacks { get; private set; }
public IMemoryCallbackSystem MemoryCallbacks { get; }
[FeatureNotImplemented]
public void Step(StepType type) { throw new NotImplementedException(); }
public bool CanStep(StepType type) { return false; }
public int TotalExecutedCycles
public void Step(StepType type)
{
get { return Cpu.TotalExecutedCycles; }
throw new NotImplementedException();
}
public bool CanStep(StepType type)
{
return false;
}
public int TotalExecutedCycles => Cpu.TotalExecutedCycles;
}
}

View File

@ -14,7 +14,7 @@ namespace BizHawk.Emulation.Cores.Calculators
set { _lagCount = value; }
}
public IInputCallbackSystem InputCallbacks { get; private set; }
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
public bool IsLagFrame
{

View File

@ -2,13 +2,13 @@
namespace BizHawk.Emulation.Cores.Calculators
{
public partial class TI83 : IVideoProvider
public partial class TI83 : IVideoProvider
{
public int VirtualWidth{ get { return 96; } }
public int VirtualHeight { get { return 64; } }
public int BufferWidth { get { return 96; } }
public int BufferHeight { get { return 64; } }
public int BackgroundColor { get { return 0; } }
public int VirtualWidth => 96;
public int VirtualHeight => 64;
public int BufferWidth => 96;
public int BufferHeight => 64;
public int BackgroundColor => 0;
public int[] GetVideoBuffer()
{
@ -19,19 +19,21 @@ namespace BizHawk.Emulation.Cores.Calculators
{
for (int x = 0; x < 96; x++)
{
int offset = y * 96 + x;
int offset = (y * 96) + x;
int bufbyte = offset >> 3;
int bufbit = offset & 7;
int bit = ((_vram[bufbyte] >> (7 - bufbit)) & 1);
int bit = (_vram[bufbyte] >> (7 - bufbit)) & 1;
if (bit == 0)
{
unchecked { pixels[i++] = (int)Settings.BGColor; }
unchecked
{
pixels[i++] = (int)Settings.BGColor;
}
}
else
{
pixels[i++] = (int)Settings.ForeColor;
}
}
}

View File

@ -5,7 +5,6 @@ using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Components.Z80;
// http://www.ticalc.org/pub/text/calcinfo/
namespace BizHawk.Emulation.Cores.Calculators
{
[CoreAttributes(
@ -21,8 +20,6 @@ namespace BizHawk.Emulation.Cores.Calculators
public TI83(CoreComm comm, GameInfo game, byte[] rom, object Settings)
{
ServiceProvider = new BasicServiceProvider(this);
InputCallbacks = new InputCallbackSystem();
MemoryCallbacks = new MemoryCallbackSystem();
PutSettings((TI83Settings)Settings ?? new TI83Settings());
CoreComm = comm;
@ -57,7 +54,7 @@ namespace BizHawk.Emulation.Cores.Calculators
serviceProvider.Register<IDisassemblable>(new Disassembler());
}
private readonly ITraceable Tracer;
private readonly TraceBuffer Tracer;
// hardware
private const ushort RamSizeMask = 0x7FFF;
@ -83,24 +80,23 @@ namespace BizHawk.Emulation.Cores.Calculators
private ushort _startPC;
// Link Cable
public TI83LinkPort LinkPort { get; private set; }
public TI83LinkPort LinkPort { get; }
internal bool LinkActive;
internal int LinkOutput, LinkInput;
internal int LinkState
{
get { return (LinkOutput | LinkInput) ^ 3; }
}
internal int LinkState => (LinkOutput | LinkInput) ^ 3;
private static readonly ControllerDefinition TI83Controller =
new ControllerDefinition
{
Name = "TI83 Controller",
BoolButtons = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9","DOT",
"ON","ENTER",
"DOWN","LEFT","UP","RIGHT",
"PLUS","MINUS","MULTIPLY","DIVIDE",
BoolButtons =
{
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9","DOT",
"ON", "ENTER",
"DOWN", "LEFT", "UP", "RIGHT",
"PLUS", "MINUS", "MULTIPLY", "DIVIDE",
"CLEAR", "EXP", "DASH", "PARACLOSE", "TAN", "VARS", "PARAOPEN",
"COS", "PRGM", "STAT", "COMMA", "SIN", "MATRIX", "X",
"STO", "LN", "LOG", "SQUARED", "NEG1", "MATH", "ALPHA",
@ -112,14 +108,14 @@ namespace BizHawk.Emulation.Cores.Calculators
{
byte ret;
int romPage = _romPageLow3Bits | (_romPageHighBit << 3);
//Console.WriteLine("read memory: {0:X4}", addr);
if (addr < 0x4000)
{
ret = Rom[addr]; //ROM zero-page
ret = Rom[addr]; // ROM zero-page
}
else if (addr < 0x8000)
{
ret = Rom[romPage * 0x4000 + addr - 0x4000]; //other rom page
ret = Rom[(romPage * 0x4000) + addr - 0x4000]; // other rom page
}
else
{
@ -133,11 +129,11 @@ namespace BizHawk.Emulation.Cores.Calculators
{
if (addr < 0x4000)
{
return; //ROM zero-page
return; // ROM zero-page
}
else if (addr < 0x8000)
{
return; //other rom page
return; // other rom page
}
else
{
@ -149,35 +145,38 @@ namespace BizHawk.Emulation.Cores.Calculators
{
switch (addr)
{
case 0: //PORT_LINK
case 0: // PORT_LINK
_romPageHighBit = (value >> 4) & 1;
LinkOutput = value & 3;
if (LinkActive)
{
//Prevent rom calls from disturbing link port activity
// Prevent rom calls from disturbing link port activity
if (LinkActive && Cpu.RegisterPC < 0x4000)
{
return;
}
LinkPort.Update();
}
break;
case 1: //PORT_KEYBOARD:
case 1: // PORT_KEYBOARD:
_lagged = false;
_keyboardMask = value;
//Console.WriteLine("write PORT_KEYBOARD {0:X2}",value);
break;
case 2: //PORT_ROMPAGE
case 2: // PORT_ROMPAGE
_romPageLow3Bits = value & 0x7;
break;
case 3: //PORT_STATUS
case 3: // PORT_STATUS
_maskOn = (byte)(value & 1);
break;
case 16: //PORT_DISPCTRL
case 16: // PORT_DISPCTRL
//Console.WriteLine("write PORT_DISPCTRL {0}",value);
WriteDispCtrl(value);
break;
case 17: //PORT_DISPDATA
case 17: // PORT_DISPDATA
//Console.WriteLine("write PORT_DISPDATA {0}",value);
WriteDispData(value);
break;
@ -188,17 +187,17 @@ namespace BizHawk.Emulation.Cores.Calculators
{
switch (addr)
{
case 0: //PORT_LINK
case 0: // PORT_LINK
LinkPort.Update();
return (byte)((_romPageHighBit << 4) | (LinkState << 2) | LinkOutput);
case 1: //PORT_KEYBOARD:
case 1: // PORT_KEYBOARD:
//Console.WriteLine("read PORT_KEYBOARD");
return ReadKeyboard();
case 2: //PORT_ROMPAGE
case 2: // PORT_ROMPAGE
return (byte)_romPageLow3Bits;
case 3: //PORT_STATUS
case 3: // PORT_STATUS
{
//Console.WriteLine("read PORT_STATUS");
// Console.WriteLine("read PORT_STATUS");
// Bits:
// 0 - Set if ON key is down and ON key is trapped
// 1 - Update things (keyboard etc)
@ -210,15 +209,15 @@ namespace BizHawk.Emulation.Cores.Calculators
return (byte)((Controller.IsPressed("ON") ? _maskOn : 8) | (LinkActive ? 0 : 2));
}
case 4: //PORT_INTCTRL
case 4: // PORT_INTCTRL
//Console.WriteLine("read PORT_INTCTRL");
return 0xFF;
case 16: //PORT_DISPCTRL
case 16: // PORT_DISPCTRL
//Console.WriteLine("read DISPCTRL");
break;
case 17: //PORT_DISPDATA
case 17: // PORT_DISPDATA
return ReadDispData();
}
return 0xFF;
@ -238,6 +237,7 @@ namespace BizHawk.Emulation.Cores.Calculators
if (Controller.IsPressed("RIGHT")) ret ^= 4;
if (Controller.IsPressed("UP")) ret ^= 8;
}
if ((_keyboardMask & 2) == 0)
{
if (Controller.IsPressed("ENTER")) ret ^= 1;
@ -248,6 +248,7 @@ namespace BizHawk.Emulation.Cores.Calculators
if (Controller.IsPressed("EXP")) ret ^= 32;
if (Controller.IsPressed("CLEAR")) ret ^= 64;
}
if ((_keyboardMask & 4) == 0)
{
if (Controller.IsPressed("DASH")) ret ^= 1;
@ -258,6 +259,7 @@ namespace BizHawk.Emulation.Cores.Calculators
if (Controller.IsPressed("TAN")) ret ^= 32;
if (Controller.IsPressed("VARS")) ret ^= 64;
}
if ((_keyboardMask & 8) == 0)
{
if (Controller.IsPressed("DOT")) ret ^= 1;
@ -269,6 +271,7 @@ namespace BizHawk.Emulation.Cores.Calculators
if (Controller.IsPressed("PRGM")) ret ^= 64;
if (Controller.IsPressed("STAT")) ret ^= 128;
}
if ((_keyboardMask & 16) == 0)
{
if (Controller.IsPressed("0")) ret ^= 1;
@ -313,13 +316,13 @@ namespace BizHawk.Emulation.Cores.Calculators
if (_cursorMoved)
{
_cursorMoved = false;
return 0x00; //not accurate this should be stale data or something
return 0x00; // not accurate this should be stale data or something
}
byte ret;
if (_displayMode == 1)
{
ret = _vram[_displayY * 12 + _displayX];
ret = _vram[(_displayY * 12) + _displayX];
}
else
{
@ -349,8 +352,8 @@ namespace BizHawk.Emulation.Cores.Calculators
{
int shift = column & 7;
int mask = ~(252 >> shift);
int Data = value << 2;
_vram[offset] = (byte)(_vram[offset] & mask | (Data >> shift));
int data = value << 2;
_vram[offset] = (byte)(_vram[offset] & mask | (data >> shift));
if (shift > 2 && offset < 0x2ff)
{
offset++;
@ -358,7 +361,7 @@ namespace BizHawk.Emulation.Cores.Calculators
shift = 8 - shift;
mask = ~(252 << shift);
_vram[offset] = (byte)(_vram[offset] & mask | (Data << shift));
_vram[offset] = (byte)(_vram[offset] & mask | (data << shift));
}
}
}
@ -376,7 +379,7 @@ namespace BizHawk.Emulation.Cores.Calculators
case 3: _displayX++; break;
}
_displayX &= 0xF; //0xF or 0x1F? dunno
_displayX &= 0xF; // 0xF or 0x1F? dunno
_displayY &= 0x3F;
}
@ -392,7 +395,7 @@ namespace BizHawk.Emulation.Cores.Calculators
}
else if ((value & 0xC0) == 0x40)
{
//hardware scroll
// hardware scroll
}
else if ((value & 0xE0) == 0x20)
{
@ -406,7 +409,7 @@ namespace BizHawk.Emulation.Cores.Calculators
}
else if ((value & 0xC0) == 0xC0)
{
//contrast
// contrast
}
else if (value == 2)
{
@ -421,7 +424,7 @@ namespace BizHawk.Emulation.Cores.Calculators
private void IRQCallback()
{
//Console.WriteLine("IRQ with vec {0} and cpu.InterruptMode {1}", cpu.RegisterI, cpu.InterruptMode);
// Console.WriteLine("IRQ with vec {0} and cpu.InterruptMode {1}", cpu.RegisterI, cpu.InterruptMode);
Cpu.Interrupt = false;
}
@ -436,7 +439,10 @@ namespace BizHawk.Emulation.Cores.Calculators
Cpu.Reset();
_ram = new byte[0x8000];
for (int i = 0; i < 0x8000; i++)
{
_ram[i] = 0xFF;
}
Cpu.RegisterPC = _startPC;
Cpu.IFF1 = false;

View File

@ -10,20 +10,20 @@ namespace BizHawk.Emulation.Cores.Calculators
// See http://www.ticalc.org/archives/files/fileinfo/294/29418.html for documentation
// Note: Each hardware read/write to the link port calls tthe update method.
readonly TI83 Parent;
private readonly TI83 Parent;
private readonly Queue<byte> CurrentData = new Queue<byte>();
private FileStream CurrentFile;
//private int FileBytesLeft;
private byte[] VariableData;
private FileStream _currentFile;
private byte[] _variableData;
private Action NextStep;
private Queue<byte> CurrentData = new Queue<byte>();
private ushort BytesToSend;
private byte BitsLeft;
private byte CurrentByte;
private byte StepsLeft;
private Action _nextStep;
private ushort _bytesToSend;
private byte _bitsLeft;
private byte _currentByte;
private byte _stepsLeft;
private Status CurrentStatus = Status.Inactive;
private Status _currentStatus = Status.Inactive;
private enum Status
{
@ -34,226 +34,252 @@ namespace BizHawk.Emulation.Cores.Calculators
Send
}
public TI83LinkPort(TI83 Parent)
public TI83LinkPort(TI83 parent)
{
this.Parent = Parent;
Parent = parent;
}
public void Update()
{
if (CurrentStatus == Status.PrepareReceive)
if (_currentStatus == Status.PrepareReceive)
{
//Get the first byte, and start sending it.
CurrentByte = CurrentData.Dequeue();
CurrentStatus = Status.Receive;
BitsLeft = 8;
StepsLeft = 5;
// Get the first byte, and start sending it.
_currentByte = CurrentData.Dequeue();
_currentStatus = Status.Receive;
_bitsLeft = 8;
_stepsLeft = 5;
}
if (CurrentStatus == Status.PrepareSend && Parent.LinkState != 3)
if (_currentStatus == Status.PrepareSend && Parent.LinkState != 3)
{
CurrentStatus = Status.Send;
BitsLeft = 8;
StepsLeft = 5;
CurrentByte = 0;
_currentStatus = Status.Send;
_bitsLeft = 8;
_stepsLeft = 5;
_currentByte = 0;
}
if (CurrentStatus == Status.Receive)
if (_currentStatus == Status.Receive)
{
switch (StepsLeft)
switch (_stepsLeft)
{
case 5:
//Receive step 1: Lower the other device's line.
Parent.LinkInput = ((CurrentByte & 1) == 1) ? 2 : 1;
CurrentByte >>= 1;
StepsLeft--;
// Receive step 1: Lower the other device's line.
Parent.LinkInput = ((_currentByte & 1) == 1) ? 2 : 1;
_currentByte >>= 1;
_stepsLeft--;
break;
case 4:
//Receive step 2: Wait for the calc to lower the other line.
// Receive step 2: Wait for the calc to lower the other line.
if ((Parent.LinkState & 3) == 0)
StepsLeft--;
{
_stepsLeft--;
}
break;
case 3:
//Receive step 3: Raise the other device's line back up.
// Receive step 3: Raise the other device's line back up.
Parent.LinkInput = 0;
StepsLeft--;
_stepsLeft--;
break;
case 2:
//Receive step 4: Wait for the calc to raise its line back up.
// Receive step 4: Wait for the calc to raise its line back up.
if ((Parent.LinkState & 3) == 3)
StepsLeft--;
{
_stepsLeft--;
}
break;
case 1:
//Receive step 5: Finish.
BitsLeft--;
// Receive step 5: Finish.
_bitsLeft--;
if (BitsLeft == 0)
if (_bitsLeft == 0)
{
if (CurrentData.Count > 0)
CurrentStatus = Status.PrepareReceive;
{
_currentStatus = Status.PrepareReceive;
}
else
{
CurrentStatus = Status.Inactive;
if (NextStep != null)
NextStep();
_currentStatus = Status.Inactive;
_nextStep?.Invoke();
}
}
else
//next bit in the current byte.
StepsLeft = 5;
{
// Next bit in the current byte.
_stepsLeft = 5;
}
break;
}
}
else if (CurrentStatus == Status.Send)
else if (_currentStatus == Status.Send)
{
switch (StepsLeft)
switch (_stepsLeft)
{
case 5:
//Send step 1: Calc lowers a line.
// Send step 1: Calc lowers a line.
if (Parent.LinkState != 3)
{
int Bit = Parent.LinkState & 1;
int Shift = 8 - BitsLeft;
CurrentByte |= (byte)(Bit << Shift);
StepsLeft--;
int bit = Parent.LinkState & 1;
int shift = 8 - _bitsLeft;
_currentByte |= (byte)(bit << shift);
_stepsLeft--;
}
break;
case 4:
//send step 2: Lower our line.
// Send step 2: Lower our line.
Parent.LinkInput = Parent.LinkOutput ^ 3;
StepsLeft--;
_stepsLeft--;
break;
case 3:
//Send step 3: wait for the calc to raise its line.
// Send step 3: wait for the calc to raise its line.
if ((Parent.LinkOutput & 3) == 0)
StepsLeft--;
{
_stepsLeft--;
}
break;
case 2:
//Send step 4: raise the other devices lines.
// Send step 4: raise the other devices lines.
Parent.LinkInput = 0;
StepsLeft--;
_stepsLeft--;
break;
case 1:
//Send step 5: Finish
BitsLeft--;
// Send step 5: Finish
_bitsLeft--;
if (BitsLeft == 0)
if (_bitsLeft == 0)
{
BytesToSend--;
CurrentData.Enqueue(CurrentByte);
_bytesToSend--;
CurrentData.Enqueue(_currentByte);
if (BytesToSend > 0)
CurrentStatus = Status.PrepareSend;
if (_bytesToSend > 0)
{
_currentStatus = Status.PrepareSend;
}
else
{
CurrentStatus = Status.Inactive;
if (NextStep != null)
NextStep();
_currentStatus = Status.Inactive;
_nextStep?.Invoke();
}
}
else
{
//next bit in the current byte.
StepsLeft = 5;
// Next bit in the current byte.
_stepsLeft = 5;
}
break;
}
}
}
public void SendFileToCalc(FileStream FS, bool Verify)
public void SendFileToCalc(FileStream fs, bool verify)
{
if (Verify)
VerifyFile(FS);
if (verify)
{
VerifyFile(fs);
}
FS.Seek(55, SeekOrigin.Begin);
CurrentFile = FS;
fs.Seek(55, SeekOrigin.Begin);
_currentFile = fs;
SendNextFile();
}
private void VerifyFile(FileStream FS)
private void VerifyFile(FileStream fs)
{
//Verify the file format.
byte[] Expected = new byte[] { 0x2a, 0x2a, 0x54, 0x49, 0x38, 0x33, 0x2a, 0x2a, 0x1a, 0x0a, 0x00 };
byte[] Actual = new byte[11];
// Verify the file format.
byte[] expected = { 0x2a, 0x2a, 0x54, 0x49, 0x38, 0x33, 0x2a, 0x2a, 0x1a, 0x0a, 0x00 };
byte[] actual = new byte[11];
FS.Seek(0, SeekOrigin.Begin);
FS.Read(Actual, 0, 11);
fs.Seek(0, SeekOrigin.Begin);
fs.Read(actual, 0, 11);
//Check the header.
// Check the header.
for (int n = 0; n < 11; n++)
if (Expected[n] != Actual[n])
{
if (expected[n] != actual[n])
{
FS.Close();
fs.Close();
throw new IOException("Invalid Header.");
}
}
//Seek to the end of the comment.
FS.Seek(53, SeekOrigin.Begin);
// Seek to the end of the comment.
fs.Seek(53, SeekOrigin.Begin);
int Size = FS.ReadByte() + FS.ReadByte() * 256;
int size = fs.ReadByte() + (fs.ReadByte() * 256);
if (FS.Length != Size + 57)
if (fs.Length != size + 57)
{
FS.Close();
fs.Close();
throw new IOException("Invalid file length.");
}
//Verify the checksum.
ushort Checksum = 0;
for (int n = 0; n < Size; n++)
Checksum += (ushort)FS.ReadByte();
ushort ActualChecksum = (ushort)(FS.ReadByte() + FS.ReadByte() * 256);
if (Checksum != ActualChecksum)
// Verify the checksum.
ushort checksum = 0;
for (int n = 0; n < size; n++)
{
FS.Close();
checksum += (ushort)fs.ReadByte();
}
ushort actualChecksum = (ushort)(fs.ReadByte() + (fs.ReadByte() * 256));
if (checksum != actualChecksum)
{
fs.Close();
throw new IOException("Invalid Checksum.");
}
}
private void SendNextFile()
{
byte[] Header = new byte[13];
if (!CurrentFile.CanRead || CurrentFile.Read(Header, 0, 13) != 13)
byte[] header = new byte[13];
if (!_currentFile.CanRead || _currentFile.Read(header, 0, 13) != 13)
{
//End of file.
CurrentFile.Close();
// End of file.
_currentFile.Close();
return;
}
int Size = Header[2] + Header[3] * 256;
VariableData = new byte[Size + 2];
CurrentFile.Read(VariableData, 0, Size + 2);
int size = header[2] + (header[3] * 256);
_variableData = new byte[size + 2];
_currentFile.Read(_variableData, 0, size + 2);
//Request to send the file.
// Request to send the file.
CurrentData.Clear();
CurrentData.Enqueue(0x03);
CurrentData.Enqueue(0xC9);
foreach (byte B in Header)
CurrentData.Enqueue(B);
foreach (byte b in header)
{
CurrentData.Enqueue(b);
}
//Calculate the checksum for the command.
ushort Checksum = 0;
for (int n = 2; n < Header.Length; n++)
Checksum += Header[n];
// Calculate the checksum for the command.
ushort checksum = 0;
for (int n = 2; n < header.Length; n++)
{
checksum += header[n];
}
CurrentData.Enqueue((byte)(Checksum % 256));
CurrentData.Enqueue((byte)(Checksum / 256));
CurrentData.Enqueue((byte)(checksum % 256));
CurrentData.Enqueue((byte)(checksum / 256));
//Finalize the command.
CurrentStatus = Status.PrepareReceive;
NextStep = ReceiveReqAck;
// Finalize the command.
_currentStatus = Status.PrepareReceive;
_nextStep = ReceiveReqAck;
Parent.LinkActive = true;
}
@ -263,9 +289,9 @@ namespace BizHawk.Emulation.Cores.Calculators
CurrentData.Clear();
// Prepare to receive the Aknowledgement response from the calculator.
BytesToSend = 8;
CurrentStatus = Status.PrepareSend;
NextStep = SendVariableData;
_bytesToSend = 8;
_currentStatus = Status.PrepareSend;
_nextStep = SendVariableData;
}
private void SendVariableData()
@ -293,20 +319,24 @@ namespace BizHawk.Emulation.Cores.Calculators
CurrentData.Enqueue(0x03);
CurrentData.Enqueue(0x15);
//Add variable data.
foreach (byte B in VariableData)
CurrentData.Enqueue(B);
// Add variable data.
foreach (byte b in _variableData)
{
CurrentData.Enqueue(b);
}
//Calculate the checksum.
ushort Checksum = 0;
for (int n = 2; n < VariableData.Length; n++)
Checksum += VariableData[n];
// Calculate the checksum.
ushort checksum = 0;
for (int n = 2; n < _variableData.Length; n++)
{
checksum += _variableData[n];
}
CurrentData.Enqueue((byte)(Checksum % 256));
CurrentData.Enqueue((byte)(Checksum / 256));
CurrentData.Enqueue((byte)(checksum % 256));
CurrentData.Enqueue((byte)(checksum / 256));
CurrentStatus = Status.PrepareReceive;
NextStep = ReceiveDataAck;
_currentStatus = Status.PrepareReceive;
_nextStep = ReceiveDataAck;
Parent.LinkActive = true;
}
}
@ -317,9 +347,9 @@ namespace BizHawk.Emulation.Cores.Calculators
CurrentData.Clear();
// Prepare to receive the Aknowledgement response from the calculator.
BytesToSend = 4;
CurrentStatus = Status.PrepareSend;
NextStep = EndTransmission;
_bytesToSend = 4;
_currentStatus = Status.PrepareSend;
_nextStep = EndTransmission;
}
private void EndTransmission()
@ -332,21 +362,21 @@ namespace BizHawk.Emulation.Cores.Calculators
CurrentData.Enqueue(0x00);
CurrentData.Enqueue(0x00);
CurrentStatus = Status.PrepareReceive;
NextStep = FinalizeFile;
_currentStatus = Status.PrepareReceive;
_nextStep = FinalizeFile;
Parent.LinkActive = true;
}
private void OutOfMemory()
{
CurrentFile.Close();
_currentFile.Close();
Parent.LinkActive = false;
CurrentData.Clear();
// Prepare to receive the Aknowledgement response from the calculator.
BytesToSend = 3;
CurrentStatus = Status.PrepareSend;
NextStep = EndOutOfMemory;
_bytesToSend = 3;
_currentStatus = Status.PrepareSend;
_nextStep = EndOutOfMemory;
}
private void EndOutOfMemory()
@ -359,8 +389,8 @@ namespace BizHawk.Emulation.Cores.Calculators
CurrentData.Enqueue(0x01);
CurrentData.Enqueue(0x00);
CurrentStatus = Status.PrepareReceive;
NextStep = FinalizeFile;
_currentStatus = Status.PrepareReceive;
_nextStep = FinalizeFile;
Parent.LinkActive = true;
}
@ -369,7 +399,7 @@ namespace BizHawk.Emulation.Cores.Calculators
// Resets the link software, and checks to see if there is an additional file to send.
CurrentData.Clear();
Parent.LinkActive = false;
NextStep = null;
_nextStep = null;
SendNextFile();
}
}

View File

@ -51,8 +51,8 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
_machine.BizInitialize();
//make a writeable memory stream cloned from the rom.
//for junk.dsk the .dsk is important because it determines the format from that
// make a writeable memory stream cloned from the rom.
// for junk.dsk the .dsk is important because it determines the format from that
InitDisk();
ser.Register<ITraceable>(Tracer);
@ -64,14 +64,13 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
PutSettings(settings ?? new Settings());
}
public List<GameInfo> GameInfoSet { get; private set; }
private List<GameInfo> GameInfoSet { get; set; }
private readonly List<byte[]> RomSet = new List<byte[]>();
public int CurrentDisk { get; private set; }
public int DiskCount { get { return RomSet.Count; } }
public int DiskCount => RomSet.Count;
private ITraceable Tracer { get; set; }
private ITraceable Tracer { get; }
public void SetDisk(int discNum)
{
@ -106,8 +105,8 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
{
_disk1 = RomSet[CurrentDisk];
//make a writeable memory stream cloned from the rom.
//for junk.dsk the .dsk is important because it determines the format from that
// make a writeable memory stream cloned from the rom.
// for junk.dsk the .dsk is important because it determines the format from that
_machine.BootDiskII.Drives[0].InsertDisk("junk.dsk", (byte[])_disk1.Clone(), false);
}

View File

@ -29,7 +29,9 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=II/@EntryIndexedValue">II</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IO/@EntryIndexedValue">IO</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IPS/@EntryIndexedValue">IPS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IRQ/@EntryIndexedValue">IRQ</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NES/@EntryIndexedValue">NES</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NMI/@EntryIndexedValue">NMI</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OR/@EntryIndexedValue">OR</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PC/@EntryIndexedValue">PC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PCECD/@EntryIndexedValue">PCECD</s:String>