Exemplo n.º 1
0
        private static string DisassembleLoadStore(ushort address, ushort instructionWord)
        {
            StringBuilder d = new StringBuilder();

            // Accumulator
            int ac = (instructionWord & 0x1800) >> 11;

            // Indirect bit
            bool indirect = (instructionWord & 0x400) != 0;

            // Indexing mode
            MemIndex index = (MemIndex)(instructionWord & 0x300);

            // Displacement
            int disp = (instructionWord & 0xff);

            // instruction (LDA or STA)
            string inst = (InstructionClass)(instructionWord & 0x6000) == InstructionClass.LDA ? "LDA" : "STA";

            switch (index)
            {
            case MemIndex.PageZero:
                d.AppendFormat("{0}{1} {2},{3}",
                               inst,
                               indirect ? "@" : String.Empty,
                               ac,
                               Conversion.ToOctal(disp));
                break;

            case MemIndex.PCRelative:
                d.AppendFormat("{0}{1} {2},.+{3}    ;({4})",
                               inst,
                               indirect ? "@" : String.Empty,
                               ac,
                               Conversion.ToOctal((sbyte)disp),
                               Conversion.ToOctal((sbyte)disp + address));
                break;

            case MemIndex.AC2Relative:
                d.AppendFormat("{0}{1} {2},AC2+{3}",
                               inst,
                               indirect ? "@" : String.Empty,
                               ac,
                               Conversion.ToOctal((sbyte)disp));
                break;

            case MemIndex.AC3Relative:
                d.AppendFormat("{0}{1} {2},AC3+{3}",
                               inst,
                               indirect ? "@" : String.Empty,
                               ac,
                               Conversion.ToOctal((sbyte)disp));
                break;

            default:
                throw new InvalidOperationException("unexpected index type.");
            }

            return(d.ToString());
        }
        private void Init()
        {
            m_faceRecogniser = FaceRecogniser.Build(ServiceOption.ModelPath);
            m_logger.LogInformation($"Init face recogniser success");

            m_index = MemIndex.Create(ServiceOption.FeaturePath);
            m_logger.LogInformation($"Init index success");

            m_faceInfo = LevelFaceInfo.Create(ServiceOption.DBName);
            m_logger.LogInformation($"Init faceInfo database success");
        }
Exemplo n.º 3
0
        private static string DisassembleMem(ushort address, ushort instructionWord)
        {
            StringBuilder d = new StringBuilder();

            // Function
            MemFunction func = (MemFunction)(instructionWord & 0x1800);

            // Indirect bit
            bool indirect = (instructionWord & 0x400) != 0;

            // Indexing mode
            MemIndex index = (MemIndex)(instructionWord & 0x300);

            // Displacement
            int disp = (instructionWord & 0xff);

            switch (index)
            {
            case MemIndex.PageZero:
                d.AppendFormat("{0}{1} {2}",
                               func,
                               indirect ? "@" : String.Empty,
                               Conversion.ToOctal(disp));
                break;

            case MemIndex.PCRelative:
                d.AppendFormat("{0}{1} .+{2}    ;({3})",
                               func,
                               indirect ? "@" : String.Empty,
                               Conversion.ToOctal((sbyte)disp),
                               Conversion.ToOctal((sbyte)disp + address));
                break;

            case MemIndex.AC2Relative:
                d.AppendFormat("{0}{1} AC2+{2}",
                               func,
                               indirect ? "@" : String.Empty,
                               Conversion.ToOctal((sbyte)disp));
                break;

            case MemIndex.AC3Relative:
                d.AppendFormat("{0}{1} AC3+{2}",
                               func,
                               indirect ? "@" : String.Empty,
                               Conversion.ToOctal((sbyte)disp));
                break;

            default:
                throw new InvalidOperationException("unexpected index type.");
            }

            return(d.ToString());
        }