Example #1
0
        public static bool ParseOoRrrMmm(FAsmCommand cmd, int w, int code, FBytes memory, int offset)
        {
            int oo  = (code & 0xC0) >> 6;
            int rrr = (code & 0x38) >> 3;
            int mmm = (code & 0x07);

            switch (oo)
            {
            case 0x00:
                if (mmm == 0x06)
                {
                    cmd.Size      += RInt.BYTE_SIZE;
                    cmd.Attributes = new object[] { memory.GetInt32(offset) };
                }
                return(true);

            case 0x01:
                cmd.Size      += RByte.BYTE_SIZE;
                cmd.Attributes = new object[] { RAsm.RegName(w, rrr), memory[offset] };
                return(true);

            case 0x02:
                cmd.Size      += RInt.BYTE_SIZE;
                cmd.Attributes = new object[] { RAsm.RegName(w, rrr), memory.GetInt32(offset) };
                return(true);

            case 0x03:
                string des = RAsm.RegName(w, rrr);
                string src = RAsm.FuncName(w, oo, mmm);
                cmd.Attributes = new object[] { des, src };
                return(true);
            }
            return(false);
        }
Example #2
0
        public const int REG_EDI = 0x07; // BH, DI, EDI

        public static bool ParseOoMmm(FAsmCommand cmd, int w, int oo, int mmm, FBytes memory, int offset)
        {
            switch (oo)
            {
            case 0x00:
                if (mmm == 0x06)
                {
                    cmd.Size      += RInt.BYTE_SIZE;
                    cmd.Attributes = new object[] { memory.GetInt32(offset) };
                }
                return(true);

            case 0x01:
                cmd.Size      += RByte.BYTE_SIZE;
                cmd.Attributes = new object[] { memory[offset] };
                return(true);

            case 0x02:
                cmd.Size      += RInt.BYTE_SIZE;
                cmd.Attributes = new object[] { memory.GetInt32(offset) };
                return(true);

            case 0x03:
                cmd.Size += RByte.BYTE_SIZE;
                string des = RAsm.RegName(w, mmm);
                cmd.Attributes = new object[] { des, memory[offset] };
                return(true);
            }
            return(false);
        }
Example #3
0
 public override bool Parse(FAsmCommand cmd, FBytes bytes, int offset, int bits)
 {
     cmd.Code = this;
     cmd.Size = 1;
     if (Parse(cmd, bytes, offset))
     {
         cmd.Memory = bytes.ToArray(offset, cmd.Size);
         return(true);
     }
     return(false);
 }
Example #4
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);
        }
Example #5
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);
        }
Example #6
0
 public abstract bool Parse(FAsmCommand cmd, FBytes bytes, int offset, int bits);