From 95d9f250eef4f09e971e9269b4613c8caa9aab4e Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 7 Feb 2015 14:46:02 +0000 Subject: [PATCH] TI83 - nitpick refactor, nothing useful to see here --- .../Calculator/TI83.IDebuggable.cs | 104 ++++----- .../Calculator/TI83.IMemoryDomains.cs | 6 +- .../Calculator/TI83.IStatable.cs | 30 +-- .../Calculator/TI83.IVideoProvider.cs | 2 +- BizHawk.Emulation.Cores/Calculator/TI83.cs | 209 +++++++++--------- .../Calculator/TI83LinkPort.cs | 20 +- 6 files changed, 184 insertions(+), 187 deletions(-) diff --git a/BizHawk.Emulation.Cores/Calculator/TI83.IDebuggable.cs b/BizHawk.Emulation.Cores/Calculator/TI83.IDebuggable.cs index ac7da168e4..ff492b66ca 100644 --- a/BizHawk.Emulation.Cores/Calculator/TI83.IDebuggable.cs +++ b/BizHawk.Emulation.Cores/Calculator/TI83.IDebuggable.cs @@ -12,36 +12,36 @@ namespace BizHawk.Emulation.Cores.Calculators { return new Dictionary { - { "A", cpu.RegisterA }, - { "AF", cpu.RegisterAF }, - { "B", cpu.RegisterB }, - { "BC", cpu.RegisterBC }, - { "C", cpu.RegisterC }, - { "D", cpu.RegisterD }, - { "DE", cpu.RegisterDE }, - { "E", cpu.RegisterE }, - { "F", cpu.RegisterF }, - { "H", cpu.RegisterH }, - { "HL", cpu.RegisterHL }, - { "I", cpu.RegisterI }, - { "IX", cpu.RegisterIX }, - { "IY", cpu.RegisterIY }, - { "L", cpu.RegisterL }, - { "PC", cpu.RegisterPC }, - { "R", cpu.RegisterR }, - { "Shadow AF", cpu.RegisterShadowAF }, - { "Shadow BC", cpu.RegisterShadowBC }, - { "Shadow DE", cpu.RegisterShadowDE }, - { "Shadow HL", cpu.RegisterShadowHL }, - { "SP", cpu.RegisterSP }, - { "Flag C", cpu.RegisterF.Bit(0) }, - { "Flag N", cpu.RegisterF.Bit(1) }, - { "Flag P/V", cpu.RegisterF.Bit(2) }, - { "Flag 3rd", cpu.RegisterF.Bit(3) }, - { "Flag H", cpu.RegisterF.Bit(4) }, - { "Flag 5th", cpu.RegisterF.Bit(5) }, - { "Flag Z", cpu.RegisterF.Bit(6) }, - { "Flag S", cpu.RegisterF.Bit(7) } + { "A", Cpu.RegisterA }, + { "AF", Cpu.RegisterAF }, + { "B", Cpu.RegisterB }, + { "BC", Cpu.RegisterBC }, + { "C", Cpu.RegisterC }, + { "D", Cpu.RegisterD }, + { "DE", Cpu.RegisterDE }, + { "E", Cpu.RegisterE }, + { "F", Cpu.RegisterF }, + { "H", Cpu.RegisterH }, + { "HL", Cpu.RegisterHL }, + { "I", Cpu.RegisterI }, + { "IX", Cpu.RegisterIX }, + { "IY", Cpu.RegisterIY }, + { "L", Cpu.RegisterL }, + { "PC", Cpu.RegisterPC }, + { "R", Cpu.RegisterR }, + { "Shadow AF", Cpu.RegisterShadowAF }, + { "Shadow BC", Cpu.RegisterShadowBC }, + { "Shadow DE", Cpu.RegisterShadowDE }, + { "Shadow HL", Cpu.RegisterShadowHL }, + { "SP", Cpu.RegisterSP }, + { "Flag C", Cpu.RegisterF.Bit(0) }, + { "Flag N", Cpu.RegisterF.Bit(1) }, + { "Flag P/V", Cpu.RegisterF.Bit(2) }, + { "Flag 3rd", Cpu.RegisterF.Bit(3) }, + { "Flag H", Cpu.RegisterF.Bit(4) }, + { "Flag 5th", Cpu.RegisterF.Bit(5) }, + { "Flag Z", Cpu.RegisterF.Bit(6) }, + { "Flag S", Cpu.RegisterF.Bit(7) } }; } @@ -52,70 +52,70 @@ namespace BizHawk.Emulation.Cores.Calculators default: throw new InvalidOperationException(); case "A": - cpu.RegisterA = (byte)value; + Cpu.RegisterA = (byte)value; break; case "AF": - cpu.RegisterAF = (byte)value; + Cpu.RegisterAF = (byte)value; break; case "B": - cpu.RegisterB = (byte)value; + Cpu.RegisterB = (byte)value; break; case "BC": - cpu.RegisterBC = (byte)value; + Cpu.RegisterBC = (byte)value; break; case "C": - cpu.RegisterC = (byte)value; + Cpu.RegisterC = (byte)value; break; case "D": - cpu.RegisterD = (byte)value; + Cpu.RegisterD = (byte)value; break; case "DE": - cpu.RegisterDE = (byte)value; + Cpu.RegisterDE = (byte)value; break; case "E": - cpu.RegisterE = (byte)value; + Cpu.RegisterE = (byte)value; break; case "F": - cpu.RegisterF = (byte)value; + Cpu.RegisterF = (byte)value; break; case "H": - cpu.RegisterH = (byte)value; + Cpu.RegisterH = (byte)value; break; case "HL": - cpu.RegisterHL = (byte)value; + Cpu.RegisterHL = (byte)value; break; case "I": - cpu.RegisterI = (byte)value; + Cpu.RegisterI = (byte)value; break; case "IX": - cpu.RegisterIX = (byte)value; + Cpu.RegisterIX = (byte)value; break; case "IY": - cpu.RegisterIY = (byte)value; + Cpu.RegisterIY = (byte)value; break; case "L": - cpu.RegisterL = (byte)value; + Cpu.RegisterL = (byte)value; break; case "PC": - cpu.RegisterPC = (ushort)value; + Cpu.RegisterPC = (ushort)value; break; case "R": - cpu.RegisterR = (byte)value; + Cpu.RegisterR = (byte)value; break; case "Shadow AF": - cpu.RegisterShadowAF = (byte)value; + Cpu.RegisterShadowAF = (byte)value; break; case "Shadow BC": - cpu.RegisterShadowBC = (byte)value; + Cpu.RegisterShadowBC = (byte)value; break; case "Shadow DE": - cpu.RegisterShadowDE = (byte)value; + Cpu.RegisterShadowDE = (byte)value; break; case "Shadow HL": - cpu.RegisterShadowHL = (byte)value; + Cpu.RegisterShadowHL = (byte)value; break; case "SP": - cpu.RegisterSP = (byte)value; + Cpu.RegisterSP = (byte)value; break; } } diff --git a/BizHawk.Emulation.Cores/Calculator/TI83.IMemoryDomains.cs b/BizHawk.Emulation.Cores/Calculator/TI83.IMemoryDomains.cs index 85deb3bea7..d237669f21 100644 --- a/BizHawk.Emulation.Cores/Calculator/TI83.IMemoryDomains.cs +++ b/BizHawk.Emulation.Cores/Calculator/TI83.IMemoryDomains.cs @@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Calculators { var domains = new List { - MemoryDomain.FromByteArray("Main RAM", MemoryDomain.Endian.Little, ram) + MemoryDomain.FromByteArray("Main RAM", MemoryDomain.Endian.Little, _ram) }; var systemBusDomain = new MemoryDomain("System Bus", 0x10000, MemoryDomain.Endian.Little, @@ -19,13 +19,13 @@ namespace BizHawk.Emulation.Cores.Calculators { if (addr < 0 || addr >= 65536) throw new ArgumentOutOfRangeException(); - return cpu.ReadMemory((ushort)addr); + return Cpu.ReadMemory((ushort)addr); }, (addr, value) => { if (addr < 0 || addr >= 65536) throw new ArgumentOutOfRangeException(); - cpu.WriteMemory((ushort)addr, value); + Cpu.WriteMemory((ushort)addr, value); }); domains.Add(systemBusDomain); diff --git a/BizHawk.Emulation.Cores/Calculator/TI83.IStatable.cs b/BizHawk.Emulation.Cores/Calculator/TI83.IStatable.cs index ebcdebb58b..2eb6f0277a 100644 --- a/BizHawk.Emulation.Cores/Calculator/TI83.IStatable.cs +++ b/BizHawk.Emulation.Cores/Calculator/TI83.IStatable.cs @@ -58,21 +58,21 @@ namespace BizHawk.Emulation.Cores.Calculators private void SyncState(Serializer ser) { ser.BeginSection("TI83"); - cpu.SyncState(ser); - ser.Sync("RAM", ref ram, false); - ser.Sync("romPageLow3Bits", ref romPageLow3Bits); - ser.Sync("romPageHighBit", ref romPageHighBit); - ser.Sync("disp_mode", ref disp_mode); - ser.Sync("disp_move", ref disp_move); - ser.Sync("disp_x", ref disp_x); - ser.Sync("disp_y", ref disp_y); - ser.Sync("m_CursorMoved", ref m_CursorMoved); - ser.Sync("maskOn", ref maskOn); - ser.Sync("onPressed", ref onPressed); - ser.Sync("keyboardMask", ref keyboardMask); - ser.Sync("m_LinkOutput", ref m_LinkOutput); - ser.Sync("VRAM", ref vram, false); - ser.Sync("Frame", ref frame); + Cpu.SyncState(ser); + ser.Sync("RAM", ref _ram, false); + ser.Sync("romPageLow3Bits", ref _romPageLow3Bits); + ser.Sync("romPageHighBit", ref _romPageHighBit); + ser.Sync("disp_mode", ref _displayMode); + ser.Sync("disp_move", ref _displayMove); + ser.Sync("disp_x", ref _displayX); + ser.Sync("disp_y", ref _displayY); + ser.Sync("m_CursorMoved", ref _cursorMoved); + ser.Sync("maskOn", ref _maskOn); + ser.Sync("onPressed", ref _onPressed); + ser.Sync("keyboardMask", ref _keyboardMask); + ser.Sync("m_LinkOutput", ref LinkOutput); + ser.Sync("VRAM", ref _vram, false); + ser.Sync("Frame", ref _frame); ser.Sync("LagCount", ref _lagCount); ser.Sync("IsLag", ref _isLag); ser.EndSection(); diff --git a/BizHawk.Emulation.Cores/Calculator/TI83.IVideoProvider.cs b/BizHawk.Emulation.Cores/Calculator/TI83.IVideoProvider.cs index 6bef229abc..97d3822a27 100644 --- a/BizHawk.Emulation.Cores/Calculator/TI83.IVideoProvider.cs +++ b/BizHawk.Emulation.Cores/Calculator/TI83.IVideoProvider.cs @@ -22,7 +22,7 @@ namespace BizHawk.Emulation.Cores.Calculators 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; } diff --git a/BizHawk.Emulation.Cores/Calculator/TI83.cs b/BizHawk.Emulation.Cores/Calculator/TI83.cs index ea43999340..d723662d85 100644 --- a/BizHawk.Emulation.Cores/Calculator/TI83.cs +++ b/BizHawk.Emulation.Cores/Calculator/TI83.cs @@ -20,35 +20,8 @@ namespace BizHawk.Emulation.Cores.Calculators isReleased: true )] [ServiceNotApplicable(typeof(ISaveRam))] - public partial class TI83 : IEmulator, IStatable, IDebuggable, IInputPollable, ISettable + public partial class TI83 : IEmulator, IVideoProvider, IStatable, IDebuggable, IInputPollable, ISettable { - //hardware - private readonly Z80A cpu = new Z80A(); - private readonly byte[] rom; - private byte[] ram; - private int romPageLow3Bits; - private int romPageHighBit; - private byte maskOn; - private bool onPressed; - private int keyboardMask; - - private int disp_mode; - private int disp_move; - private uint disp_x, disp_y; - internal int m_LinkOutput, m_LinkInput; - - internal int m_LinkState - { - get - { - return (m_LinkOutput | m_LinkInput) ^ 3; - } - } - - internal bool LinkActive; - private bool m_CursorMoved; - private int frame; - [CoreConstructor("TI83")] public TI83(CoreComm comm, GameInfo game, byte[] rom, object Settings) { @@ -58,15 +31,15 @@ namespace BizHawk.Emulation.Cores.Calculators PutSettings((TI83Settings)Settings ?? new TI83Settings()); CoreComm = comm; - cpu.ReadMemory = ReadMemory; - cpu.WriteMemory = WriteMemory; - cpu.ReadHardware = ReadHardware; - cpu.WriteHardware = WriteHardware; - cpu.IRQCallback = IRQCallback; - cpu.NMICallback = NMICallback; - cpu.MemoryCallbacks = MemoryCallbacks; + Cpu.ReadMemory = ReadMemory; + Cpu.WriteMemory = WriteMemory; + Cpu.ReadHardware = ReadHardware; + Cpu.WriteHardware = WriteHardware; + Cpu.IRQCallback = IRQCallback; + Cpu.NMICallback = NMICallback; + Cpu.MemoryCallbacks = MemoryCallbacks; - this.rom = rom; + this.Rom = rom; LinkPort = new TI83LinkPort(this); //different calculators (different revisions?) have different initPC. we track this in the game database by rom hash @@ -81,6 +54,32 @@ namespace BizHawk.Emulation.Cores.Calculators (ServiceProvider as BasicServiceProvider).Register(new Disassembler()); } + // hardware + private readonly Z80A Cpu = new Z80A(); + private readonly byte[] Rom; + + private byte[] _ram; + private byte[] _vram = new byte[0x300]; + private int _romPageLow3Bits; + private int _romPageHighBit; + private byte _maskOn; + private bool _onPressed; + private int _keyboardMask; + + private int _displayMode; + private int _displayMove; + private uint _displayX, _displayY; + private bool _cursorMoved; + private int _frame; + + internal bool LinkActive; + internal int LinkOutput, LinkInput; + + internal int LinkState + { + get { return (LinkOutput | LinkInput) ^ 3; } + } + public IEmulatorServiceProvider ServiceProvider { get; private set; } //------- @@ -88,13 +87,13 @@ namespace BizHawk.Emulation.Cores.Calculators public byte ReadMemory(ushort addr) { byte ret; - int romPage = romPageLow3Bits | (romPageHighBit << 3); + 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 - else ret = ram[addr - 0x8000]; + ret = Rom[romPage * 0x4000 + addr - 0x4000]; //other rom page + else ret = _ram[addr - 0x8000]; return ret; } @@ -105,7 +104,7 @@ namespace BizHawk.Emulation.Cores.Calculators return; //ROM zero-page else if (addr < 0x8000) return; //other rom page - else ram[addr - 0x8000] = value; + else _ram[addr - 0x8000] = value; } public void WriteHardware(ushort addr, byte value) @@ -113,13 +112,13 @@ namespace BizHawk.Emulation.Cores.Calculators switch (addr) { case 0: //PORT_LINK - romPageHighBit = (value >> 4) & 1; - m_LinkOutput = value & 3; + _romPageHighBit = (value >> 4) & 1; + LinkOutput = value & 3; if (LinkActive) { //Prevent rom calls from disturbing link port activity - if (LinkActive && cpu.RegisterPC < 0x4000) + if (LinkActive && Cpu.RegisterPC < 0x4000) return; LinkPort.Update(); @@ -127,14 +126,14 @@ namespace BizHawk.Emulation.Cores.Calculators break; case 1: //PORT_KEYBOARD: _lagged = false; - keyboardMask = value; + _keyboardMask = value; //Console.WriteLine("write PORT_KEYBOARD {0:X2}",value); break; case 2: //PORT_ROMPAGE - romPageLow3Bits = value & 0x7; + _romPageLow3Bits = value & 0x7; break; case 3: //PORT_STATUS - maskOn = (byte)(value & 1); + _maskOn = (byte)(value & 1); break; case 16: //PORT_DISPCTRL //Console.WriteLine("write PORT_DISPCTRL {0}",value); @@ -153,12 +152,12 @@ namespace BizHawk.Emulation.Cores.Calculators { case 0: //PORT_LINK LinkPort.Update(); - return (byte)((romPageHighBit << 4) | (m_LinkState << 2) | m_LinkOutput); + return (byte)((_romPageHighBit << 4) | (LinkState << 2) | LinkOutput); case 1: //PORT_KEYBOARD: //Console.WriteLine("read PORT_KEYBOARD"); return ReadKeyboard(); case 2: //PORT_ROMPAGE - return (byte)romPageLow3Bits; + return (byte)_romPageLow3Bits; case 3: //PORT_STATUS { //Console.WriteLine("read PORT_STATUS"); @@ -170,7 +169,7 @@ namespace BizHawk.Emulation.Cores.Calculators // 4-7 - Unknown //if (onPressed && maskOn) ret |= 1; //if (!onPressed) ret |= 0x8; - return (byte)((Controller.IsPressed("ON") ? maskOn : 8) | (LinkActive ? 0 : 2)); + return (byte)((Controller.IsPressed("ON") ? _maskOn : 8) | (LinkActive ? 0 : 2)); } case 4: //PORT_INTCTRL @@ -194,14 +193,14 @@ namespace BizHawk.Emulation.Cores.Calculators int ret = 0xFF; //Console.WriteLine("keyboardMask: {0:X2}",keyboardMask); - if ((keyboardMask & 1) == 0) + if ((_keyboardMask & 1) == 0) { if (Controller.IsPressed("DOWN")) ret ^= 1; if (Controller.IsPressed("LEFT")) ret ^= 2; if (Controller.IsPressed("RIGHT")) ret ^= 4; if (Controller.IsPressed("UP")) ret ^= 8; } - if ((keyboardMask & 2) == 0) + if ((_keyboardMask & 2) == 0) { if (Controller.IsPressed("ENTER")) ret ^= 1; if (Controller.IsPressed("PLUS")) ret ^= 2; @@ -211,7 +210,7 @@ namespace BizHawk.Emulation.Cores.Calculators if (Controller.IsPressed("EXP")) ret ^= 32; if (Controller.IsPressed("CLEAR")) ret ^= 64; } - if ((keyboardMask & 4) == 0) + if ((_keyboardMask & 4) == 0) { if (Controller.IsPressed("DASH")) ret ^= 1; if (Controller.IsPressed("3")) ret ^= 2; @@ -221,7 +220,7 @@ namespace BizHawk.Emulation.Cores.Calculators if (Controller.IsPressed("TAN")) ret ^= 32; if (Controller.IsPressed("VARS")) ret ^= 64; } - if ((keyboardMask & 8) == 0) + if ((_keyboardMask & 8) == 0) { if (Controller.IsPressed("DOT")) ret ^= 1; if (Controller.IsPressed("2")) ret ^= 2; @@ -232,7 +231,7 @@ namespace BizHawk.Emulation.Cores.Calculators if (Controller.IsPressed("PRGM")) ret ^= 64; if (Controller.IsPressed("STAT")) ret ^= 128; } - if ((keyboardMask & 16) == 0) + if ((_keyboardMask & 16) == 0) { if (Controller.IsPressed("0")) ret ^= 1; if (Controller.IsPressed("1")) ret ^= 2; @@ -244,7 +243,7 @@ namespace BizHawk.Emulation.Cores.Calculators if (Controller.IsPressed("X")) ret ^= 128; } - if ((keyboardMask & 32) == 0) + if ((_keyboardMask & 32) == 0) { if (Controller.IsPressed("STO")) ret ^= 2; if (Controller.IsPressed("LN")) ret ^= 4; @@ -256,7 +255,7 @@ namespace BizHawk.Emulation.Cores.Calculators if (Controller.IsPressed("ALPHA")) ret ^= 128; } - if ((keyboardMask & 64) == 0) + if ((_keyboardMask & 64) == 0) { if (Controller.IsPressed("GRAPH")) ret ^= 1; if (Controller.IsPressed("TRACE")) ret ^= 2; @@ -274,23 +273,23 @@ namespace BizHawk.Emulation.Cores.Calculators private byte ReadDispData() { - if (m_CursorMoved) + if (_cursorMoved) { - m_CursorMoved = false; + _cursorMoved = false; return 0x00; //not accurate this should be stale data or something } byte ret; - if (disp_mode == 1) + if (_displayMode == 1) { - ret = vram[disp_y * 12 + disp_x]; + ret = _vram[_displayY * 12 + _displayX]; } else { - int column = 6 * (int)disp_x; - int offset = (int)disp_y * 12 + (column >> 3); + int column = 6 * (int)_displayX; + int offset = (int)_displayY * 12 + (column >> 3); int shift = 10 - (column & 7); - ret = (byte)(((vram[offset] << 8) | vram[offset + 1]) >> shift); + ret = (byte)(((_vram[offset] << 8) | _vram[offset + 1]) >> shift); } doDispMove(); @@ -300,21 +299,21 @@ namespace BizHawk.Emulation.Cores.Calculators private void WriteDispData(byte value) { int offset; - if (disp_mode == 1) + if (_displayMode == 1) { - offset = (int)disp_y * 12 + (int)disp_x; - vram[offset] = value; + offset = (int)_displayY * 12 + (int)_displayX; + _vram[offset] = value; } else { - int column = 6 * (int)disp_x; - offset = (int)disp_y * 12 + (column >> 3); + int column = 6 * (int)_displayX; + offset = (int)_displayY * 12 + (column >> 3); if (offset < 0x300) { int shift = column & 7; int mask = ~(252 >> shift); int Data = value << 2; - vram[offset] = (byte)(vram[offset] & mask | (Data >> shift)); + _vram[offset] = (byte)(_vram[offset] & mask | (Data >> shift)); if (shift > 2 && offset < 0x2ff) { offset++; @@ -322,7 +321,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)); } } } @@ -332,37 +331,37 @@ namespace BizHawk.Emulation.Cores.Calculators private void doDispMove() { - switch (disp_move) + switch (_displayMove) { - case 0: disp_y--; break; - case 1: disp_y++; break; - case 2: disp_x--; break; - case 3: disp_x++; break; + case 0: _displayY--; break; + case 1: _displayY++; break; + case 2: _displayX--; break; + case 3: _displayX++; break; } - disp_x &= 0xF; //0xF or 0x1F? dunno - disp_y &= 0x3F; + _displayX &= 0xF; //0xF or 0x1F? dunno + _displayY &= 0x3F; } private void WriteDispCtrl(byte value) { if (value <= 1) - disp_mode = value; + _displayMode = value; else if (value >= 4 && value <= 7) - disp_move = value - 4; + _displayMove = value - 4; else if ((value & 0xC0) == 0x40) { //hardware scroll } else if ((value & 0xE0) == 0x20) { - disp_x = (uint)(value & 0x1F); - m_CursorMoved = true; + _displayX = (uint)(value & 0x1F); + _cursorMoved = true; } else if ((value & 0xC0) == 0x80) { - disp_y = (uint)(value & 0x3F); - m_CursorMoved = true; + _displayY = (uint)(value & 0x3F); + _cursorMoved = true; } else if ((value & 0xC0) == 0xC0) { @@ -382,19 +381,17 @@ namespace BizHawk.Emulation.Cores.Calculators private void IRQCallback() { //Console.WriteLine("IRQ with vec {0} and cpu.InterruptMode {1}", cpu.RegisterI, cpu.InterruptMode); - cpu.Interrupt = false; + Cpu.Interrupt = false; } private void NMICallback() { Console.WriteLine("NMI"); - cpu.NonMaskableInterrupt = false; + Cpu.NonMaskableInterrupt = false; } public CoreComm CoreComm { get; private set; } - private byte[] vram = new byte[0x300]; - public ISoundProvider SoundProvider { get { return NullSound.SilenceProvider; } } public ISyncSoundProvider SyncSoundProvider { get { return new FakeSyncSound(NullSound.SilenceProvider, 735); } } public bool StartAsyncSound() { return true; } @@ -428,10 +425,10 @@ namespace BizHawk.Emulation.Cores.Calculators //I eyeballed this speed for (int i = 0; i < 5; i++) { - onPressed = Controller.IsPressed("ON"); + _onPressed = Controller.IsPressed("ON"); //and this was derived from other emus - cpu.ExecuteCycles(10000); - cpu.Interrupt = true; + Cpu.ExecuteCycles(10000); + Cpu.Interrupt = true; } Frame++; @@ -448,27 +445,27 @@ namespace BizHawk.Emulation.Cores.Calculators public void HardReset() { - cpu.Reset(); - ram = new byte[0x8000]; + Cpu.Reset(); + _ram = new byte[0x8000]; for (int i = 0; i < 0x8000; i++) - ram[i] = 0xFF; - cpu.RegisterPC = startPC; + _ram[i] = 0xFF; + Cpu.RegisterPC = startPC; - cpu.IFF1 = false; - cpu.IFF2 = false; - cpu.InterruptMode = 2; + Cpu.IFF1 = false; + Cpu.IFF2 = false; + Cpu.InterruptMode = 2; - maskOn = 1; - romPageHighBit = 0; - romPageLow3Bits = 0; - keyboardMask = 0; + _maskOn = 1; + _romPageHighBit = 0; + _romPageLow3Bits = 0; + _keyboardMask = 0; - disp_mode = 0; - disp_move = 0; - disp_x = disp_y = 0; + _displayMode = 0; + _displayMove = 0; + _displayX = _displayY = 0; } - public int Frame { get { return frame; } set { frame = value; } } + public int Frame { get { return _frame; } set { _frame = value; } } public void ResetCounters() { diff --git a/BizHawk.Emulation.Cores/Calculator/TI83LinkPort.cs b/BizHawk.Emulation.Cores/Calculator/TI83LinkPort.cs index 2349622cf8..73fa2dd3ba 100644 --- a/BizHawk.Emulation.Cores/Calculator/TI83LinkPort.cs +++ b/BizHawk.Emulation.Cores/Calculator/TI83LinkPort.cs @@ -50,7 +50,7 @@ namespace BizHawk.Emulation.Cores.Calculators StepsLeft = 5; } - if (CurrentStatus == Status.PrepareSend && Parent.m_LinkState != 3) + if (CurrentStatus == Status.PrepareSend && Parent.LinkState != 3) { CurrentStatus = Status.Send; BitsLeft = 8; @@ -64,26 +64,26 @@ namespace BizHawk.Emulation.Cores.Calculators { case 5: //Receive step 1: Lower the other device's line. - Parent.m_LinkInput = ((CurrentByte & 1) == 1) ? 2 : 1; + 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. - if ((Parent.m_LinkState & 3) == 0) + if ((Parent.LinkState & 3) == 0) StepsLeft--; break; case 3: //Receive step 3: Raise the other device's line back up. - Parent.m_LinkInput = 0; + Parent.LinkInput = 0; StepsLeft--; break; case 2: //Receive step 4: Wait for the calc to raise its line back up. - if ((Parent.m_LinkState & 3) == 3) + if ((Parent.LinkState & 3) == 3) StepsLeft--; break; @@ -114,9 +114,9 @@ namespace BizHawk.Emulation.Cores.Calculators { case 5: //Send step 1: Calc lowers a line. - if (Parent.m_LinkState != 3) + if (Parent.LinkState != 3) { - int Bit = Parent.m_LinkState & 1; + int Bit = Parent.LinkState & 1; int Shift = 8 - BitsLeft; CurrentByte |= (byte)(Bit << Shift); StepsLeft--; @@ -125,19 +125,19 @@ namespace BizHawk.Emulation.Cores.Calculators case 4: //send step 2: Lower our line. - Parent.m_LinkInput = Parent.m_LinkOutput ^ 3; + Parent.LinkInput = Parent.LinkOutput ^ 3; StepsLeft--; break; case 3: //Send step 3: wait for the calc to raise its line. - if ((Parent.m_LinkOutput & 3) == 0) + if ((Parent.LinkOutput & 3) == 0) StepsLeft--; break; case 2: //Send step 4: raise the other devices lines. - Parent.m_LinkInput = 0; + Parent.LinkInput = 0; StepsLeft--; break;