2017-01-16 18:35:28 +00:00
|
|
|
#ifndef _RK6502_H_
|
|
|
|
#define _RK6502_H_
|
|
|
|
|
2017-01-17 13:29:20 +00:00
|
|
|
#include "bus.h"
|
|
|
|
#include "instruction.h"
|
2017-01-16 23:42:31 +00:00
|
|
|
|
2017-01-17 10:28:42 +00:00
|
|
|
typedef enum {
|
|
|
|
STOPPED,
|
|
|
|
RUNNIG,
|
|
|
|
STEPPING
|
|
|
|
} emu_state_t;
|
|
|
|
|
2017-01-17 10:18:48 +00:00
|
|
|
struct reg_state {
|
|
|
|
uint8_t A; /* accumulator */
|
|
|
|
uint8_t X; /* index X */
|
|
|
|
uint8_t Y; /* index Y */
|
|
|
|
|
|
|
|
uint16_t PC; /* program counter */
|
|
|
|
uint8_t SP; /* stack pointer */
|
|
|
|
uint8_t P; /* status */
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct reg_state reg_state_t;
|
|
|
|
|
2017-01-17 10:28:42 +00:00
|
|
|
struct rk65c02emu {
|
|
|
|
emu_state_t state;
|
|
|
|
bus_t bus;
|
|
|
|
reg_state_t regs;
|
2017-01-16 18:35:28 +00:00
|
|
|
};
|
|
|
|
|
2017-01-17 13:29:20 +00:00
|
|
|
typedef struct rk65c02emu rk65c02emu_t;
|
2017-01-16 18:35:28 +00:00
|
|
|
|
2017-01-17 13:29:20 +00:00
|
|
|
#endif
|