private void _sbc_hl_ss(RegisterPair source, string register) { if (DebugMode) { DebugOut("SBC", "HL, {0}", register); } TStates += 15; if (FCarry) { source.Word++; } ushort result = (ushort)(HL.Word - source.Word); FSign = StaticHelpers.TestBit(result, 15); FZero = result == 0; FHalfCarry = StaticHelpers.TestHalfCarry(HL.Word, source.Word, result); FPV = StaticHelpers.TestSubtractionOverflow(HL.Word, source.Word, result); FNegative = true; FCarry = (uint)(HL.Word - source.Word) > 0xFFFF; HL.Word = result; }
public byte this[RegisterPair index] { get { return this[index.Word]; } set { this[index.Word] = value; } }
public byte this[RegisterPair index] { get { return(this[index.Word]); } set { this[index.Word] = value; } }
// private void _dec_ss(ref RegisterPair source, string register) { if (DebugMode) { DebugOut("DEC", "{0}", register); } TStates += 6; source.Word--; }
private void _inc_ss(ref RegisterPair source, string register) { if (DebugMode) { DebugOut("INC", "{0}", register); } TStates += 6; source.Word++; }
private void _pop_qq(ref RegisterPair destination, string register) { if (DebugMode) { DebugOut("POP", "{0}", register); } TStates += 10; destination.LoByte = Memory[SP.Word++]; destination.HiByte = Memory[SP.Word++]; }
private void _push_qq(RegisterPair source, string register) { if (DebugMode) { DebugOut("PUSH", "{0}", register); } TStates += 11; SP.Word--; Memory[SP.Word] = source.HiByte; SP.Word--; Memory[SP.Word] = source.LoByte; }
private void _ex_de_hl() { if (DebugMode) { DebugOut("EX", "DE, HL"); } TStates += 4; RegisterPair tmp = DE; DE = HL; HL = tmp; }
private void _ld_dd_addr(ref RegisterPair destination, string register) { int addr = Memory[PC.Word++] + (Memory[PC.Word++] << 8); if (DebugMode) { DebugOut("LD", "{0}, (#0x{1:X4})", register, addr); } TStates += 20; destination.LoByte = Memory[addr]; destination.HiByte = Memory[addr + 1]; }
private void _ld_addr_dd(RegisterPair source, string register) { int addr = Memory[PC.Word++] + (Memory[PC.Word++] << 8); if (DebugMode) { DebugOut("LD", "(#0x{0:X4}), {1}", addr, register); } TStates += 20; Memory[addr] = source.LoByte; Memory[addr + 1] = source.HiByte; }
private void _ex_af_af_() { if (DebugMode) { DebugOut("EX", "AF, AF'"); } TStates += 4; RegisterPair tmp = AF; AF = AF_; AF_ = tmp; }
private void _ld_dd_nn(ref RegisterPair destination, string register) { byte loByte = Memory[PC.Word++]; byte hiByte = Memory[PC.Word++]; if (DebugMode) { DebugOut("LD", "{0}, #0x{1:X4}", register, loByte + (hiByte << 8)); } TStates += 10; destination.HiByte = hiByte; destination.LoByte = loByte; }
private void _add_iy_pp(RegisterPair source, string register) { if (DebugMode) { DebugOut("ADD", "IY, {0}", register); } TStates += 15; FHalfCarry = StaticHelpers.TestHalfCarry(IY.Word, source.Word, (ushort)(IY.Word + source.Word)); FNegative = false; FCarry = (IY.Word + source.Word > 0xFFFF); IY.Word += source.Word; }
private void _add_hl_ss(RegisterPair source, string register, bool carry) { if (DebugMode) { if (carry) { DebugOut("ADC", "HL, {0}", register); } else { DebugOut("ADD", "HL, {0}", register); } } TStates += 11; if (carry && FCarry) { source.Word++; } ushort result = (ushort)(HL.Word + source.Word); if (carry) { FSign = StaticHelpers.TestBit(result, 15); FZero = result == 0; FNegative = false; FPV = StaticHelpers.TestAdditionOverflow(HL.Word, source.Word, result); } FHalfCarry = StaticHelpers.TestHalfCarry(HL.Word, source.Word, result); FNegative = false; FCarry = (HL.Word + source.Word) > 0xFFFF; HL.Word = result; }
private void _exx() { if (DebugMode) { DebugOut("EXX", null); } TStates += 4; RegisterPair tmp = BC; BC = BC_; BC_ = tmp; tmp = DE; DE = DE_; DE_ = tmp; tmp = HL; HL = HL_; HL_ = tmp; }
private void _sbc_hl_ss(RegisterPair source, string register) { if (DebugMode) { DebugOut("SBC", "HL, {0}", register); } TStates += 15; if(FCarry) { source.Word++; } ushort result = (ushort)(HL.Word - source.Word); FSign = StaticHelpers.TestBit(result, 15); FZero = result == 0; FHalfCarry = StaticHelpers.TestHalfCarry(HL.Word, source.Word, result); FPV = StaticHelpers.TestSubtractionOverflow(HL.Word, source.Word, result); FNegative = true; FCarry = (uint)(HL.Word - source.Word) > 0xFFFF; HL.Word = result; }