Exemplo n.º 1
0
        protected FAsmOpCodes Sync(char[] path, int offset)
        {
            char ch = path[offset];

            if (ch == '0')
            {
                if (_object0 == null)
                {
                    _object0 = new FAsmOpPath();
                }
                if (offset == path.Length - 1)
                {
                    return(_object0._codes);
                }
                return(_object0.Sync(path, offset + 1));
            }
            else if (ch == '1')
            {
                if (_object1 == null)
                {
                    _object1 = new FAsmOpPath();
                }
                if (offset == path.Length - 1)
                {
                    return(_object1._codes);
                }
                return(_object1.Sync(path, offset + 1));
            }
            else
            {
                throw new FFatalException("Valid path char");
            }
        }
Exemplo n.º 2
0
        public void Dump(FString dump, FAsmOpPath opPath, string path, int deep)
        {
            if (opPath._object0 != null)
            {
                Dump(dump, opPath._object0, path + "0", deep + 1);
            }
            if (opPath._object1 != null)
            {
                Dump(dump, opPath._object1, path + "1", deep + 1);
            }
            int count = opPath._codes.Count;

            for (int n = 0; n < count; n++)
            {
                dump.Append(path.PadRight(24, ' '));
                dump.Append(n);
                dump.Append(": ");
                dump.AppendLine(opPath._codes[n].Name);
            }
        }
Exemplo n.º 3
0
        public override bool Parse(FAsmCommand cmd, FBytes memory, int offset, int bits)
        {
            byte       data     = memory[offset + bits / 8];
            bool       flag     = ((data & (0x01 << (7 - bits % 8))) == 0);
            FAsmOpPath opObject = flag ? _object0 : _object1;

            if (opObject != null)
            {
                return(opObject.Parse(cmd, memory, offset, bits + 1));
            }
            int count = _codes.Count;

            for (int n = 0; n < count; n++)
            {
                if (_codes[n].Parse(cmd, memory, offset, 0))
                {
                    return(true);
                }
            }
            return(false);
        }