static VMDisassembler()
        {
            for (int i = 0; i < OpCodeTable.Length; i++)
            {
                OpCodeTable[i] = new EmbeddedOpCodeInfo((byte)i, $"db 0x{i:X2}", 0);
            }

            OpCodeTable[0x10] = new EmbeddedOpCodeInfo(0x10, "push 0x{0:X8}", 1);
            OpCodeTable[0x15] = new EmbeddedOpCodeInfo(0x15, "mov r7, [r5 + 0x{0:X8}]; push r7", 1);
            OpCodeTable[0x36] = new EmbeddedOpCodeInfo(0x36, "mov [r5 + 0x{0:X8}], r7; pop r7", 1);
            OpCodeTable[0x57] = new EmbeddedOpCodeInfo(0x57, "push r7", 0);
            OpCodeTable[0x59] = new EmbeddedOpCodeInfo(0x59, "pop r7", 0);
            OpCodeTable[0x5C] = new EmbeddedOpCodeInfo(0x5C, "sub r7", 0);
            OpCodeTable[0x5F] = new EmbeddedOpCodeInfo(0x5F, "xchg r7", 0);
            OpCodeTable[0x65] = new EmbeddedOpCodeInfo(0x65, "add r7", 0);
            OpCodeTable[0x84] = new EmbeddedOpCodeInfo(0x84, "add [r5 + 0x{0:X8}], 0x{1:X8}", 2);
            OpCodeTable[0xB6] = new EmbeddedOpCodeInfo(0xB6, "or r7", 0);
            OpCodeTable[0xA7] = new EmbeddedOpCodeInfo(0xA7, "halt", 0);
            OpCodeTable[0xAD] = new EmbeddedOpCodeInfo(0xAD, "ret", 0);
            OpCodeTable[0xB9] = new EmbeddedOpCodeInfo(0xB9, "call index [r6 + 0x{0:X8}{1:X8}]", 2);
        }
Beispiel #2
0
 public EmbeddedInstruction(int offset, EmbeddedOpCodeInfo opCode, byte[] operandBytes)
 {
     Offset       = offset;
     OpCode       = opCode;
     OperandBytes = operandBytes;
 }