Esempio n. 1
0
        public void SetPCToSelect(string fileName, int lineNumber)
        {
            if (!this.debugTableReverse.Contains(fileName.ToLower() + ":" + (lineNumber + 1)))
            {
                MessageBox.Show("Unable to set statement here!");
                return;
            }

            string newPC = this.debugTableReverse[fileName.ToLower() + ":" + (lineNumber + 1)].ToString();
            Emulator.Z80_State state = this.emulatorWindow.emulator.GetState();
            Emulator.MEMSTATE memState = this.emulatorWindow.emulator.GetMemState();

            state.PC = UInt16.Parse(newPC.Substring(3, 4), NumberStyles.HexNumber);
            byte page = byte.Parse(newPC.Substring(0, 2), NumberStyles.HexNumber);
            if (this.isAnApp)
            {
                page = (byte)(this.apppage - page);
                memState.page1 = page;
                memState.ram1 = 0;
            }
            else
            {
                memState.page2 = 1;
                memState.ram2 = 1;
            }

            this.removeHighlight();
            this.highlightLine(lineNumber + 1);

            this.emulatorWindow.emulator.SetState(state);
            this.emulatorWindow.emulator.SetMemState(memState);
            GlobalClass.debugPanel.updateRegisters();
        }
Esempio n. 2
0
 private bool evalCondition(GlobalClass.BreakCondition condition)
 {
     bool isTrue = true;
     Emulator.Z80_State state = GlobalClass.emulator.GetState();
     if (condition.a >= 0xFFFF)
     {
         isTrue &= (state.AF >> 16) == (ushort)(condition.a >> 8);
     }
     if (condition.b >= 0xFFFF)
     {
         isTrue &= (state.BC >> 16) == (ushort)(condition.b >> 8);
     }
     if (condition.c >= 0xFFFF)
     {
         isTrue &= (state.BC & 0xFF) == (ushort)(condition.c >> 16);
     }
     if (condition.d >= 0xFFFF)
     {
         isTrue &= (state.DE >> 16) == (ushort)(condition.d >> 8);
     }
     if (condition.e >= 0xFFFF)
     {
         isTrue &= (state.DE & 0xFF) == (ushort)(condition.e >> 16);
     }
     if (condition.h >= 0xFFFF)
     {
         isTrue &= state.HL >> 8 == (ushort)(condition.h >> 16);
     }
     if (condition.l >= 0xFFFF)
     {
         isTrue &= (state.HL & 0xFF) == (ushort)(condition.l >> 16);
     }
     if (condition.ix >= 0xFFFF)
     {
         isTrue &= state.IX == (ushort)condition.ix;
     }
     if (condition.iy >= 0xFFFF)
     {
         isTrue &= state.IY == (ushort)(condition.iy >> 16);
     }
     if (condition.sp >= 0xFFFF)
     {
         isTrue &= state.SP == (ushort)(condition.sp >> 16);
     }
     if (condition.cFlag > 2)
     {
         isTrue &= (state.AF & 1) == condition.cFlag;
     }
     if (condition.nFlag >= 2)
     {
         isTrue &= (state.AF & 2) == condition.nFlag;
     }
     if (condition.pvFlag >= 2)
     {
         isTrue &= (state.AF & 4) == condition.pvFlag;
     }
     if (condition.hFlag >= 2)
     {
         isTrue &= (state.AF & 16) == condition.hFlag;
     }
     if (condition.zFlag >= 2)
     {
         isTrue &= (state.AF & 64) == condition.zFlag;
     }
     if (condition.sFlag >= 2)
     {
         isTrue &= (state.AF & 128) == condition.sFlag;
     }
     return isTrue;
 }