//ADC A,d8 2 8 Z 0 H C public void AddImmediateWithCarry(R8Bit A, R16Bit PC, MappedMemory memory, R8BitFlag flag) { byte immediate = memory.ReadByte(PC); byte carry = (byte)(flag.CarryFlag ? 1 : 0); flag.HalfCarryFlag = ((A.Value & 0x0F) + (B.Value & 0x0F) + carry) > 0x0F; var result = A.Value + B.Value + carry; flag.CarryFlag = result > 255; A.Value = (byte)result; flag.SubFlag = false; flag.ZeroFlag = A.Value == 0; }
public CPU(MappedMemory memory) { _memory = memory; //Create Registers A = new R8Bit("a"); F = new R8BitFlag("f"); AF = new R16Bit(A, F); B = new R8Bit("b"); C = new R8Bit("c"); BC = new R16Bit(B, C); D = new R8Bit("d"); E = new R8Bit("e"); DE = new R16Bit(D, E); H = new R8Bit("h"); L = new R8Bit("l"); HL = new R16Bit(H, L); PC = new R16Bit("pc"); SP = new R16Bit("sp"); }
public void LD_RRrec_r(R16Bit HL, R8Bit A, R8BitFlag flag) { throw new NotImplementedException(); }
public void LD_RR_SP_r8(R16Bit HL, R16Bit SP, R16Bit r8, R8BitFlag flag) { throw new NotImplementedException(); }
//LD (BC),A 1 8 - - - - public void LD_RR_r(R16Bit BC, R8Bit A) { _memory.WriteByte(BC, A); }
//LD BC,d16 3 12 - - - - public void LD_RR_d16(R16Bit BC, R16Bit PC) { BC.Value = _memory.ReadHalfWord(PC); }
public void PUSH_RR(R16Bit AF, R8BitFlag flag) { throw new NotImplementedException(); }
public void OR_d8(R16Bit d8, R8BitFlag flag) { throw new NotImplementedException(); }
public void JP_Z_a16(bool Z, R16Bit a16, R8BitFlag flag) { throw new NotImplementedException(); }
public void INC_SP(R16Bit SP, R8BitFlag flag) { throw new NotImplementedException(); }
//INC BC 1 8 - - - - public void INC_RR(R16Bit BC) { BC++; }
public void DEC_RR(R16Bit BC, R8BitFlag flag) { throw new NotImplementedException(); }
public void CALL_Nr_a16(bool NC, R16Bit a16, R8BitFlag flag) { throw new NotImplementedException(); }
public void ADD_r_d8(R8Bit A, R16Bit d8, R8BitFlag flag) { throw new NotImplementedException(); }
//ADC A,(HL) 1 8 Z 0 H C public void AddWithCarryHL(R8Bit A, R16Bit HL, MappedMemory memory, R8BitFlag flag) { AddImmediateWithCarry(A, HL, memory, flag); }
public void LD_SP_d16(R16Bit SP, R16Bit d16, R8BitFlag flag) { throw new NotImplementedException(); }
public void LDH_r_a8(R8Bit A, R16Bit a8, R8BitFlag flag) { throw new NotImplementedException(); }
public void JR_Z_r8(bool Z, R16Bit r8, R8BitFlag flag) { throw new NotImplementedException(); }
public void OR_RR(R16Bit HL, R8BitFlag flag) { throw new NotImplementedException(); }
public void LD_a16_SP(R16Bit a16, R16Bit SP, R8BitFlag flag) { throw new NotImplementedException(); }
public void SBC_r_RR(R8Bit A, R16Bit HL, R8BitFlag flag) { throw new NotImplementedException(); }
public void LD_r_a16(R8Bit A, R16Bit a16, R8BitFlag flag) { throw new NotImplementedException(); }