示例#1
0
        /// <summary>
        /// Performs a single processor step.
        /// </summary>
        private int Step()
        {
            reader.Address     = machine.PC;
            currentInstruction = reader.NextInstruction();

            var oldPC = machine.PC;

            OnStepping(oldPC);

            var newPC = machine.Step();

            // If the instruction just executed was a call, we should add the address to the
            // routine table. The address is packed inside the first operand value. Note that
            // we need to do this prior to calling firing the ProcessorStepped event to ensure
            // that the disassembly view gets updated with the new routine before attempting
            // to set the new IP.
            if (currentInstruction.Opcode.IsCall)
            {
                var callOpValue = machine.GetOperandValue(0);
                var callAddress = storyService.Story.UnpackRoutineAddress(callOpValue);
                if (callAddress != 0)
                {
                    routineService.Add(callAddress);
                }
            }

            OnStepped(oldPC, newPC);

            hasStepped = true;

            return(newPC);
        }