示例#1
0
        //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;
        }
示例#2
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");
 }
示例#3
0
 public void LD_RRrec_r(R16Bit HL, R8Bit A, R8BitFlag flag)
 {
     throw new NotImplementedException();
 }
示例#4
0
 public void LD_RR_SP_r8(R16Bit HL, R16Bit SP, R16Bit r8, R8BitFlag flag)
 {
     throw new NotImplementedException();
 }
示例#5
0
 //LD (BC),A 1  8 - - - -
 public void LD_RR_r(R16Bit BC, R8Bit A)
 {
     _memory.WriteByte(BC, A);
 }
示例#6
0
 //LD BC,d16 3  12 - - - -
 public void LD_RR_d16(R16Bit BC, R16Bit PC)
 {
     BC.Value = _memory.ReadHalfWord(PC);
 }
示例#7
0
 public void PUSH_RR(R16Bit AF, R8BitFlag flag)
 {
     throw new NotImplementedException();
 }
示例#8
0
 public void OR_d8(R16Bit d8, R8BitFlag flag)
 {
     throw new NotImplementedException();
 }
示例#9
0
 public void JP_Z_a16(bool Z, R16Bit a16, R8BitFlag flag)
 {
     throw new NotImplementedException();
 }
示例#10
0
 public void INC_SP(R16Bit SP, R8BitFlag flag)
 {
     throw new NotImplementedException();
 }
示例#11
0
 //INC BC 1  8 - - - -
 public void INC_RR(R16Bit BC)
 {
     BC++;
 }
示例#12
0
 public void DEC_RR(R16Bit BC, R8BitFlag flag)
 {
     throw new NotImplementedException();
 }
示例#13
0
 public void CALL_Nr_a16(bool NC, R16Bit a16, R8BitFlag flag)
 {
     throw new NotImplementedException();
 }
示例#14
0
 public void ADD_r_d8(R8Bit A, R16Bit d8, R8BitFlag flag)
 {
     throw new NotImplementedException();
 }
示例#15
0
 //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);
 }
示例#16
0
 public void LD_SP_d16(R16Bit SP, R16Bit d16, R8BitFlag flag)
 {
     throw new NotImplementedException();
 }
示例#17
0
 public void LDH_r_a8(R8Bit A, R16Bit a8, R8BitFlag flag)
 {
     throw new NotImplementedException();
 }
示例#18
0
 public void JR_Z_r8(bool Z, R16Bit r8, R8BitFlag flag)
 {
     throw new NotImplementedException();
 }
示例#19
0
 public void OR_RR(R16Bit HL, R8BitFlag flag)
 {
     throw new NotImplementedException();
 }
示例#20
0
 public void LD_a16_SP(R16Bit a16, R16Bit SP, R8BitFlag flag)
 {
     throw new NotImplementedException();
 }
示例#21
0
 public void SBC_r_RR(R8Bit A, R16Bit HL, R8BitFlag flag)
 {
     throw new NotImplementedException();
 }
示例#22
0
 public void LD_r_a16(R8Bit A, R16Bit a16, R8BitFlag flag)
 {
     throw new NotImplementedException();
 }