25 lines
707 B
C
25 lines
707 B
C
#include "instructions.h"
|
|
|
|
const Instruction instructions[] = {
|
|
Instruction_construct(NOP),
|
|
Instruction_construct(PUSH),
|
|
Instruction_construct(MOV),
|
|
Instruction_construct(ADD),
|
|
Instruction_construct(SUB),
|
|
Instruction_construct(MUL),
|
|
Instruction_construct(DIV),
|
|
Instruction_construct(MOD),
|
|
Instruction_construct(SYS),
|
|
Instruction_construct(EXIT),
|
|
// Instruction_construct(JMP),
|
|
// Instruction_construct(CALL),
|
|
};
|
|
const size_t instructions_count = sizeof(instructions)/sizeof(instructions[0]);
|
|
|
|
const Instruction* NULLABLE(Instruction_getFromOpcode)(u8 opcode){
|
|
if(opcode >= instructions_count)
|
|
return NULL;
|
|
|
|
return instructions + opcode;
|
|
}
|