TCPU/src/instructions/instructions.c
2024-11-15 09:03:33 +05:00

25 lines
697 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* Instruction_getFromOpcode(u8 opcode){
if(opcode >= instructions_count)
return NULL;
return instructions + opcode;
}