2025-01-30 14:30:19 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <common.h>
|
2025-01-30 16:27:27 -07:00
|
|
|
#include <instructions.h>
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
u8 a;
|
|
|
|
u8 f;
|
|
|
|
u8 b;
|
|
|
|
u8 c;
|
|
|
|
u8 d;
|
|
|
|
u8 e;
|
|
|
|
u8 h;
|
|
|
|
u8 l;
|
|
|
|
u16 pc;
|
|
|
|
u16 sp;
|
|
|
|
} cpu_registers;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
cpu_registers regs;
|
|
|
|
|
|
|
|
//current fetch...
|
|
|
|
u16 fetched_data;
|
|
|
|
u16 mem_dest;
|
|
|
|
bool dest_is_mem;
|
|
|
|
u8 cur_opcode;
|
|
|
|
instruction *cur_inst;
|
|
|
|
|
|
|
|
bool halted;
|
|
|
|
bool stepping;
|
|
|
|
} cpu_context;
|
2025-01-30 14:30:19 -07:00
|
|
|
|
|
|
|
void cpu_init();
|
|
|
|
bool cpu_step();
|