コード例 #1
0
ファイル: GbaDebugConsole.cs プロジェクト: 5l1v3r1/Y2Gba
        // We are about to step
        public void OnPreBreakpointStep()
        {
            // Pop the current instruction and store it in our history
            executionHistory.Enqueue(new StoredInstruction(NextInstructions[0].RawInstruction, NextInstructions[0].FriendlyInstruction, NextInstructions[0].PC));
            NextInstructions.RemoveAt(0);

            // Only show last x instructions
            if (executionHistory.Count == Cpu.Pipeline_Size)
            {
                executionHistory.Dequeue();
            }
        }
コード例 #2
0
ファイル: DmgDebugConsole.cs プロジェクト: gb-archive/DMG
        // We are about to step
        public void OnPreBreakpointStep()
        {
            // Pop the current instruction and store it in our history
            executionHistory.Enqueue(StoredInstruction.DeepCopy(NextInstructions[0]));
            NextInstructions.RemoveAt(0);

            // Only show last x instructions
            if (executionHistory.Count == Instruction_Depth)
            {
                executionHistory.Dequeue();
            }
        }
コード例 #3
0
ファイル: GbaDebugConsole.cs プロジェクト: Y2JB/Y2Gba
        public void PeekSequentialInstructions()
        {
            NextInstructions.Clear();

            string            instructionText;
            UInt32            rawInstr;
            StoredInstruction newInstruction;

            UInt32 instrSize = (UInt32)(gba.Cpu.State == Cpu.CpuState.Arm ? 4 : 2);
            UInt32 adjust    = 0;

            int instructionPtr = gba.Cpu.NextPipelineInsturction;

            // Inefficient but we are not running at this point so what the hell
            rawInstr        = gba.Cpu.InstructionPipeline[instructionPtr];
            instructionText = gba.Cpu.State == Cpu.CpuState.Arm ? gba.Cpu.PeekArmInstruction(rawInstr) : gba.Cpu.PeekThumbInstruction((ushort)rawInstr);
            newInstruction  = new StoredInstruction(rawInstr, instructionText, gba.Cpu.PC_Adjusted);
            NextInstructions.Add(newInstruction);

            instructionPtr++;
            if (instructionPtr >= Cpu.Pipeline_Size)
            {
                instructionPtr = 0;
            }
            adjust += instrSize;

            rawInstr        = gba.Cpu.InstructionPipeline[instructionPtr];
            instructionText = gba.Cpu.State == Cpu.CpuState.Arm ? gba.Cpu.PeekArmInstruction(rawInstr) : gba.Cpu.PeekThumbInstruction((ushort)rawInstr);
            newInstruction  = new StoredInstruction(rawInstr, instructionText, (UInt32)(gba.Cpu.PC_Adjusted + adjust));
            NextInstructions.Add(newInstruction);

            instructionPtr++;
            if (instructionPtr >= Cpu.Pipeline_Size)
            {
                instructionPtr = 0;
            }
            adjust += instrSize;

            rawInstr        = gba.Cpu.InstructionPipeline[instructionPtr];
            instructionText = gba.Cpu.State == Cpu.CpuState.Arm ? gba.Cpu.PeekArmInstruction(rawInstr) : gba.Cpu.PeekThumbInstruction((ushort)rawInstr);
            newInstruction  = new StoredInstruction(rawInstr, instructionText, (UInt32)(gba.Cpu.PC_Adjusted + adjust));
            NextInstructions.Add(newInstruction);
        }
コード例 #4
0
ファイル: DmgDebugConsole.cs プロジェクト: gb-archive/DMG
        public void PeekSequentialInstructions()
        {
            if (dmg.PoweredOn == false)
            {
                return;
            }

            NextInstructions.Clear();

            int lookAheadBytes = 0;

            for (int i = 0; i < Instruction_Depth; i++)
            {
                ushort pc     = (ushort)(dmg.cpu.PC + lookAheadBytes);
                byte   opCode = dmg.memory.ReadByte(pc);
                lookAheadBytes++;

                var newInstruction = StoredInstruction.DeepCopy(dmg.cpu.GetInstruction(opCode));
                NextInstructions.Add(newInstruction);

                ushort operandValue = 0;
                if (newInstruction.OperandLength == 1)
                {
                    operandValue = dmg.memory.ReadByte((ushort)(dmg.cpu.PC + lookAheadBytes));
                    lookAheadBytes++;
                }
                else if (newInstruction.OperandLength == 2)
                {
                    operandValue    = dmg.memory.ReadShort((ushort)(dmg.cpu.PC + lookAheadBytes));
                    lookAheadBytes += 2;
                }

                newInstruction.Operand = operandValue;
                newInstruction.PC      = pc;

                if (opCode == 0xCB && dmg.cpu.GetExtendedInstruction((byte)operandValue) != null)
                {
                    newInstruction.extendedInstruction = dmg.cpu.GetExtendedInstruction((byte)operandValue).DeepCopy();
                }
            }
        }
コード例 #5
0
ファイル: GbaDebugConsole.cs プロジェクト: 5l1v3r1/Y2Gba
        public void PeekSequentialInstructions()
        {
            NextInstructions.Clear();

            string            instructionText;
            UInt32            rawInstr;
            StoredInstruction newInstruction;

            UInt32 instrSize = (UInt32)(gba.Cpu.State == Cpu.CpuState.Arm ? 4 : 2);
            UInt32 adjust    = 0;

            int instructionPtr = gba.Cpu.NextPipelineInsturction;

            // Inefficient but we are not running at this point so what the hell
            rawInstr        = gba.Cpu.InstructionPipeline[instructionPtr];
            instructionText = gba.Cpu.State == Cpu.CpuState.Arm ? gba.Cpu.PeekArmInstruction(rawInstr) : gba.Cpu.PeekThumbInstruction((ushort)rawInstr);
            newInstruction  = new StoredInstruction(rawInstr, instructionText, gba.Cpu.PC_Adjusted);
            NextInstructions.Add(newInstruction);

            instructionPtr++;
            if (instructionPtr >= Cpu.Pipeline_Size)
            {
                instructionPtr = 0;
            }
            adjust += instrSize;

            rawInstr        = gba.Cpu.InstructionPipeline[instructionPtr];
            instructionText = gba.Cpu.State == Cpu.CpuState.Arm ? gba.Cpu.PeekArmInstruction(rawInstr) : gba.Cpu.PeekThumbInstruction((ushort)rawInstr);
            newInstruction  = new StoredInstruction(rawInstr, instructionText, (UInt32)(gba.Cpu.PC_Adjusted + adjust));
            NextInstructions.Add(newInstruction);

            instructionPtr++;
            if (instructionPtr >= Cpu.Pipeline_Size)
            {
                instructionPtr = 0;
            }
            adjust += instrSize;

            rawInstr        = gba.Cpu.InstructionPipeline[instructionPtr];
            instructionText = gba.Cpu.State == Cpu.CpuState.Arm ? gba.Cpu.PeekArmInstruction(rawInstr) : gba.Cpu.PeekThumbInstruction((ushort)rawInstr);
            newInstruction  = new StoredInstruction(rawInstr, instructionText, (UInt32)(gba.Cpu.PC_Adjusted + adjust));
            NextInstructions.Add(newInstruction);

            /*
             * UInt32 lookAheadBytes = 0;
             * for (int i = 0; i < Cpu.Pipeline_Size; i++)
             * {
             *  UInt32 pc = (UInt32)(gba.Cpu.PC_Adjusted + lookAheadBytes);
             *  UInt32 rawInstr = gba.Memory.ReadWord(pc);
             *  lookAheadBytes+= 4;
             *
             *  string instructionText;
             *  try
             *  {
             *      instructionText = gba.Cpu.PeekArmInstruction(rawInstr);
             *      var newInstruction = new StoredInstruction(instructionText, pc);
             *      NextInstructions.Add(newInstruction);
             *  }
             *  catch (ArgumentException) { }
             * }
             */
        }