#pragma once typedef enum { Z_FLAG = 0x00, /* zero flag */ C_FLAG = 0x01, /* carry flag */ V_FLAG = 0x02 /* overflow flag */ } CCRFlag; typedef struct Cpu { int PC; /* program counter */ int AX; /* accumulator register */ int BX; /* base register */ int CX; /* counter register */ int DX; /* data register */ int SP; /* stack register holding address to top of stack */ int CCR; /* condition code register */ struct Memory *memory; int stopped; int error; int debug; } Cpu; void cpu_init( Cpu *cpu, struct Memory *memory ); void cpu_done( Cpu *cpu ); void cpu_reset( Cpu *cpu ); void cpu_step( Cpu *cpu ); int cpu_stopped( Cpu *cpu ); int cpu_has_errors( Cpu *cpu ); void cpu_debug( Cpu *cpu, int enable ); void cpu_print_dump( Cpu *cpu );