Exemple #1
0
 public LD(IByteRegister to, HalfAddress from, string opcodeStr, int cycles)
 {
     _executor = () =>
     {
         to.Set(Bus.MMU.GetByte((ushort)(0xFF00 + from.Value)).Data);
         Bus.CPU.Registers.PC.Increment((ushort)(from.Source == AddressSource.Register ? 1 : 2));
         opcodeStr = opcodeStr.Replace("a8", $"0x{from.Value:X}");
         return(new ExecutedOpcode(cycles, opcodeStr, OpcodeType.LD));
     };
 }
Exemple #2
0
 public LD(IByteRegister to, IByteRegister from, string opcodeStr, int cycles, Action customLogic = null)
 {
     _executor = () =>
     {
         to.Set(from.Get());
         customLogic?.Invoke();
         Bus.CPU.Registers.PC.Increment(1);
         return(new ExecutedOpcode(cycles, opcodeStr, OpcodeType.LD));
     };
 }
Exemple #3
0
 public LD(IByteRegister to, byte from, string opcodeStr, int cycles)
 {
     _executor = () =>
     {
         to.Set(from);
         Bus.CPU.Registers.PC.Increment(2);
         opcodeStr = opcodeStr.Replace("d8", $"0x{from:X}");
         return(new ExecutedOpcode(cycles, opcodeStr, OpcodeType.LD));
     };
 }
Exemple #4
0
 public LD(IByteRegister to, FullAddress from, string opcodeStr, int cycles, Action customLogic = null)
 {
     _executor = () =>
     {
         to.Set(Bus.MMU.GetByte(from.Value).Data);
         customLogic?.Invoke();
         Bus.CPU.Registers.PC.Increment((ushort)(from.Source == AddressSource.Register ? 1 : 3));
         opcodeStr = opcodeStr.Replace("a16", $"0x{from.Value:X}");
         return(new ExecutedOpcode(cycles, opcodeStr, OpcodeType.LD));
     };
 }
Exemple #5
0
 public void Set(ushort value)
 {
     _hi.Set((byte)(value >> 8));
     _lo.Set((byte)(value & 0x00FF));
 }