public int GetCurrentInstructionLength() { var fetcher = new Fetcher8086(_cpu); var instruction = OpCodeManager.Decode(fetcher); return(fetcher.GetBytesFetched()); }
public int ProcessSingleInstruction(bool debug = false) { var i = _pic.GetNextInterrupt(); if (i != null) { Interrupt((byte)i.Value, false); } var fetcher = new Fetcher8086(this); var instruction = OpCodeManager.Decode(fetcher); IncRegister(Register.IP, fetcher.GetBytesFetched()); if (instruction.Type == OpCodeManager.InstructionType.Invalid) { return(0); } if (debug) { string instructionText = $"{GetRegister(Register.CS):X4}:{GetRegister(Register.IP):X4} "; instructionText += InstructionStringHelper.OutputInstruction(instruction); DebugLineEmitted?.Invoke(instructionText); Console.WriteLine(instructionText); } instructions[(int)instruction.Type].Dispatch(this, instruction); return(instruction.Clocks); }
public string GetCurrentInstructionString() { var fetcher = new Fetcher8086(_cpu); var instruction = OpCodeManager.Decode(fetcher); var instructionText = $"{_cpu.GetRegister(Register.CS):X4}:{_cpu.GetRegister(Register.IP):X4} "; instructionText += InstructionStringHelper.OutputInstruction(instruction); return(instructionText); }