Initial cpu and instruction parsing

This commit is contained in:
2025-01-30 16:27:27 -07:00
parent 945b82a3ca
commit cd588671c4
12 changed files with 303 additions and 11 deletions

22
lib/instructions.c Normal file
View File

@ -0,0 +1,22 @@
#include <instructions.h>
#include <cpu.h>
instruction instructions[0x100] = {
[0x00] = {IN_NOP, AM_IMP},
[0x05] = {IN_DEC, AM_R, RT_B},
[0x0E] = {IN_LD, AM_R_D8, RT_C},
[0xAF] = {IN_XOR, AM_R, RT_A},
[0xC3] = {IN_JP, AM_D16},
};
instruction *instruction_by_opcode(u8 opcode) {
if (instructions[opcode].type == IN_NONE) {
return NULL;
}
return &instructions[opcode];
}