mirror of
https://github.com/rkujawa/rk65c02.git
synced 2025-01-31 06:29:46 +00:00
Doxify more.
This commit is contained in:
parent
901e9626d5
commit
f0471947fc
@ -6,39 +6,52 @@
|
||||
|
||||
#include "bus.h"
|
||||
|
||||
/**
|
||||
* @brief Current state of the emulator.
|
||||
*/
|
||||
typedef enum {
|
||||
STOPPED,
|
||||
RUNNING,
|
||||
STEPPING /* XXX: how to implement? */
|
||||
STOPPED, /**< Stopped. */
|
||||
RUNNING, /**< Running. */
|
||||
STEPPING /**< Stepping. */
|
||||
} emu_state_t;
|
||||
|
||||
/**
|
||||
* @brief Enum describing why emulation stopped.
|
||||
*/
|
||||
typedef enum {
|
||||
STP, /* due to 65C02 STP instruction */
|
||||
WAI, /* waiting for interrupt */
|
||||
BREAKPOINT, /* due to breakpoint set */
|
||||
WATCHPOINT, /* due to watchpoint set */
|
||||
STEPPED, /* stepped appropriate number of instructions */
|
||||
HOST, /* due to host stop function called */
|
||||
EMUERROR /* due to emulator error */
|
||||
STP, /**< Due to 65C02 STP instruction. */
|
||||
WAI, /**< Waiting for interrupt (WAI instruction). */
|
||||
BREAKPOINT, /**< Due to breakpoint set. */
|
||||
WATCHPOINT, /**< Due to watchpoint set (not implemented). */
|
||||
STEPPED, /**< Stepped appropriate number of instructions. */
|
||||
HOST, /**< Due to host stop function called. */
|
||||
EMUERROR /**< Due to emulator error. */
|
||||
} emu_stop_reason_t;
|
||||
|
||||
/**
|
||||
* @brief Current state of emulated CPU registers.
|
||||
*/
|
||||
struct reg_state {
|
||||
uint8_t A; /* accumulator */
|
||||
uint8_t X; /* index X */
|
||||
uint8_t Y; /* index Y */
|
||||
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 */
|
||||
uint16_t PC; /**< Program counter. */
|
||||
uint8_t SP; /**< Stack pointer. */
|
||||
uint8_t P; /**< Status. */
|
||||
};
|
||||
|
||||
typedef struct reg_state reg_state_t;
|
||||
|
||||
#define P_CARRY 0x1
|
||||
#define P_ZERO 0x2
|
||||
/** Status register flag: IRQ disabled */
|
||||
#define P_IRQ_DISABLE 0x4
|
||||
/** Status register flag: BCD mode */
|
||||
#define P_DECIMAL 0x8
|
||||
/** Status register flag: BRK was the cause of interrupt */
|
||||
#define P_BREAK 0x10
|
||||
/** Status register flag: Undefined (always 1) */
|
||||
#define P_UNDEFINED 0x20
|
||||
#define P_SIGN_OVERFLOW 0x40
|
||||
#define P_NEGATIVE 0x80
|
||||
@ -64,17 +77,20 @@ typedef struct trace_t {
|
||||
struct trace_t *prev,*next;
|
||||
} trace_t;
|
||||
|
||||
/**
|
||||
* @brief Instance of the emulator.
|
||||
*/
|
||||
struct rk65c02emu {
|
||||
emu_state_t state;
|
||||
bus_t *bus;
|
||||
reg_state_t regs;
|
||||
emu_stop_reason_t stopreason;
|
||||
bool irq; /* interrupt request line state, true is asserted */
|
||||
bool irq; /**< Interrupt request line state, true is asserted. */
|
||||
|
||||
breakpoint_t *bps_head; /* pointer to linked list with breakpoints */
|
||||
bool runtime_disassembly; /* disassemble code when emulator is running */
|
||||
bool trace; /* tracing mode enable/disable */
|
||||
trace_t *trace_head; /* pointer to linked list with trace log */
|
||||
breakpoint_t *bps_head; /**< Pointer to linked list with breakpoints. */
|
||||
bool runtime_disassembly; /**< Disassemble code when emulator is running. */
|
||||
bool trace; /**< Tracing mode enable/disable. */
|
||||
trace_t *trace_head; /**< Pointer to linked list with trace log. */
|
||||
};
|
||||
|
||||
typedef struct rk65c02emu rk65c02emu_t;
|
||||
@ -93,11 +109,12 @@ void rk65c02_start(rk65c02emu_t *);
|
||||
* @brief Execute as many instructions as specified in steps argument.
|
||||
*/
|
||||
void rk65c02_step(rk65c02emu_t *, uint16_t);
|
||||
|
||||
char *rk65c02_regs_string_get(reg_state_t);
|
||||
void rk65c02_dump_regs(reg_state_t);
|
||||
void rk65c02_dump_stack(rk65c02emu_t *, uint8_t);
|
||||
|
||||
/*
|
||||
/**
|
||||
* @brief Assert the IRQ line.
|
||||
*/
|
||||
void rk65c02_assert_irq(rk65c02emu_t *);
|
||||
|
Loading…
x
Reference in New Issue
Block a user