예제 #1
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);
        }
예제 #2
0
        public FAsmCommands Parse(uint address, byte[] memory, int offset, int length)
        {
            FBytes bytes = new FBytes();

            bytes.Append(memory, offset, length);
            FAsmCommands cmds = new FAsmCommands();
            int          end  = offset + length;

            for (int n = offset; n < end; n++)
            {
                FAsmCommand cmd = new FAsmCommand();
                cmd.Address = address;
                if (_codes.Parse(cmd, bytes, n, 0))
                {
                    address += (uint)cmd.Size;
                    n       += cmd.Size - 1;
                    cmds.Push(cmd);
                }
            }
            return(cmds);
        }