typedef struct
{
    char inst_name[10];
    unsigned char opcode;
    unsigned char op1_type;
    unsigned char op2_type;

}  inst_type;


#define num_inst 44

#define N 0     // none
#define S 1     // source register
#define D 2     // dest register
#define I 3     // immdiate
#define A 4     // address to be filled in later
#define L 5     // relative address


// "name"  base opcode  operand1type  operand2type

inst_type inst_table[] = {
    {"NOP",     0x00, N, N},        
    {"HALT",    0x01, N, N},

    {"LDI",     0x10, D, I},
    {"LDR",     0x11, D, S},
    {"LDP",     0x12, D, S},
    {"LDA",     0x13, D, A},

    {"STA",     0x20, A, S},
    {"STP",     0x21, D, S},

    {"ADD",     0x30, D, S},
    {"SUB",     0x31, D, S},
    {"MUL",     0x32, D, S},
    {"DIV",     0x33, D, S},
    {"MOD",     0x34, D, S},

    {"SHR",     0x35, D, S},
    {"SHL",     0x36, D, S},
    {"AND",     0x37, D, S},
    {"OR",      0x38, D, S},
    {"XOR",     0x39, D, S},

    {"ADDI",    0x40, D, I},
    {"SUBI",    0x41, D, I},
    {"MULI",    0x42, D, I},
    {"DIVI",    0x43, D, I},
    {"MODI",    0x44, D, I},

    {"SHRI",    0x45, D, I},
    {"SHLI",    0x46, D, I},
    {"ANDI",    0x47, D, I},
    {"ORI",     0x48, D, I},
    {"XORI",    0x49, D, I},

    {"CALLA",   0x50, A, N},
    {"CALLP",   0x51, D, N},
    {"RET",     0x52, N, N},

    {"PUSH",    0x60, S, N},
    {"PULL",    0x61, D, N},

    {"CMP",     0x70, D, S},
    {"CMPI",    0x71, D, I},
    {"BE",      0x72, L, N},
    {"BL",      0x73, L, N},
    {"BLE",     0x74, L, N},
    {"BG",      0x75, L, N},
    {"BGE",     0x76, L, N},
    {"BAA",     0x77, A, N},
    {"BAP",     0x78, D, N},

    {"IN",      0x80, D, N},
    {"OUT",     0x81, S, N}};


