/// <summary> /// Decodes the operations at the specific address. /// </summary> /// <param name="address">The address.</param> /// <returns></returns> private IEnumerable <Operation> DecodeOperations(ushort address) { _halt = _stop = false; _timer.Reset(); _index = _indexRegisterOperands[IndexRegister.HL]; _prefetch.ReBuildCache(address); while (true) { // Reset _operand1 = Operand.None; _operand2 = Operand.None; _flagTest = FlagTest.None; _opCodeMeta = OpCodeMeta.None; _decodeMeta = DecodeMeta.None; _byteLiteral = 0x00; _wordLiteral = 0x0000; _displacement = 0x00; var opCode = DecodeNextOpCode(); if (!opCode.HasValue) { continue; } if (_decodeMeta.HasFlag(DecodeMeta.Displacement)) { _displacement = _prefetch.NextByte(); } if (_decodeMeta.HasFlag(DecodeMeta.ByteLiteral)) { _byteLiteral = _prefetch.NextByte(); } if (_decodeMeta.HasFlag(DecodeMeta.WordLiteral)) { _wordLiteral = _prefetch.NextWord(); } yield return(new Operation(address, opCode.Value, _operand1, _operand2, _flagTest, _opCodeMeta, _byteLiteral, _wordLiteral, (sbyte)_displacement)); if (_decodeMeta.HasFlag(DecodeMeta.EndBlock)) { yield break; } _index = _indexRegisterOperands[IndexRegister.HL]; address = unchecked ((ushort)(_prefetch.BaseAddress + _prefetch.TotalBytesRead)); } }
/// <summary> /// Initializes a new instance of the <see cref="Operation"/> struct. /// </summary> /// <param name="address">The address.</param> /// <param name="opCode">The op code.</param> /// <param name="operand1">The operand1.</param> /// <param name="operand2">The operand2.</param> /// <param name="flagTest">The flag test.</param> /// <param name="opCodeMeta">The op code meta.</param> /// <param name="byteLiteral">The byte literal.</param> /// <param name="wordLiteral">The word literal.</param> /// <param name="displacement">The displacement.</param> public Operation(ushort address, OpCode opCode, Operand operand1, Operand operand2, FlagTest flagTest, OpCodeMeta opCodeMeta, byte byteLiteral, ushort wordLiteral, sbyte displacement) : this() { Address = address; OpCode = opCode; Operand1 = operand1; Operand2 = operand2; FlagTest = flagTest; OpCodeMeta = opCodeMeta; ByteLiteral = byteLiteral; WordLiteral = wordLiteral; Displacement = displacement; }
public OperationFactory AutoCopy(bool enabled = true) { _opCodeMeta = enabled ? OpCodeMeta.AutoCopy : OpCodeMeta.None; return(this); }
public OperationFactory UseAlternativeFlagAffection(bool enabled = true) { _opCodeMeta = enabled ? OpCodeMeta.UseAlternativeFlagAffection : OpCodeMeta.None; return(this); }