43 lines
699 B
C
43 lines
699 B
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "instruction.h"
|
|
|
|
extern uint8_t cpu_memory[];
|
|
|
|
void cpu_reset(void);
|
|
|
|
void cpu_step(void);
|
|
|
|
typedef struct cpu_state {
|
|
uint8_t a;
|
|
uint8_t y;
|
|
uint8_t x;
|
|
uint16_t pc;
|
|
uint8_t sp;
|
|
uint8_t status;
|
|
} cpu_state_t;
|
|
|
|
typedef struct cpu_history {
|
|
cpu_state_t state;
|
|
uint8_t pc_mem[3];
|
|
uint16_t value;
|
|
} cpu_history_t;
|
|
|
|
extern cpu_history_t cpu_history[];
|
|
extern int cpu_history_len;
|
|
extern int cpu_history_ix;
|
|
|
|
typedef uint16_t (* mode_value_t)(uint16_t);
|
|
|
|
typedef struct addressing_mode {
|
|
int alen;
|
|
int olen;
|
|
mode_value_t func;
|
|
} addressing_mode_t;
|
|
|
|
extern addressing_mode_t addressing_modes[16];
|
|
|
|
void cpu_get_state(cpu_state_t * state);
|