Exemple #1
0
        public void FocusPC()
        {
            if (myNewRegisters == null)
            {
                return;
            }

            int pc   = myNewRegisters.GetRegisterValueint(Registers.Z80Register.pc);
            int bank = MainForm.banks[TraceFile.GetBankIndex(pc)];

            TraceFile.SetPC(pc, bank, true);
        }
Exemple #2
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary> Gets function with offset banked. </summary>
        ///
        /// <remarks> 18/09/2018. </remarks>
        ///
        /// <param name="addr">   The address. </param>
        /// <param name="lab">    [out] The lab. </param>
        /// <param name="offset"> [out] The offset. </param>
        ///
        /// <returns> True if it succeeds, false if it fails. </returns>
        /// -------------------------------------------------------------------------------------------------
        public static bool GetFunctionWithOffsetBanked(int addr, out Label lab, out int offset)
        {
            lab    = null;
            offset = 0;

            int best      = int.MaxValue;
            int bestindex = -1;
            int index     = 0;

            foreach (Label l in labels)
            {
                if (l.bank == MainForm.banks[TraceFile.GetBankIndex(l.address)])
                {
                    if (addr >= l.address && l.function)
                    {
                        int off = addr - l.address;
                        if (off < best)
                        {
                            best      = off;
                            bestindex = index;
                        }
                    }
                }


                index++;
            }


            if (bestindex < 0)
            {
                return(false);
            }

            lab    = labels[bestindex];
            offset = best;

            return(true);
        }