blob: 7d1ca2dd4baeb84f89a7dccb8addcdbca60e9d37 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#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 );
|