gbemu/lib/instructions.c

75 lines
1.0 KiB
C
Raw Normal View History

2025-01-30 16:27:27 -07:00
#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},
2025-01-30 18:38:29 -07:00
[0xF3] = {IN_DI},
2025-01-30 16:27:27 -07:00
};
instruction *instruction_by_opcode(u8 opcode) {
return &instructions[opcode];
2025-01-30 17:03:56 -07:00
}
char *inst_lookup[] = {
"<NONE>",
"NOP",
"LD",
"INC",
"DEC",
"RLCA",
"ADD",
"RRCA",
"STOP",
"RLA",
"JR",
"RRA",
"DAA",
"CPL",
"SCF",
"CCF",
"HALT",
"ADC",
"SUB",
"SBC",
"AND",
"XOR",
"OR",
"CP",
"POP",
"JP",
"PUSH",
"RET",
"CB",
"CALL",
"RETI",
"LDH",
"JPHL",
"DI",
"EI",
"RST",
"IN_ERR",
"IN_RLC",
"IN_RRC",
"IN_RL",
"IN_RR",
"IN_SLA",
"IN_SRA",
"IN_SWAP",
"IN_SRL",
"IN_BIT",
"IN_RES",
"IN_SET"
};
char *inst_name(in_type t) {
return inst_lookup[t];
2025-01-30 16:27:27 -07:00
}