From faec05b87ede65c13ddc5abf420c5fae76163f79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kujawa?= Date: Tue, 10 Apr 2018 12:17:59 +0200 Subject: [PATCH] Start doxifying the documentation. --- src/rk65c02.c | 45 --------------------------------------------- src/rk65c02.h | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 45 deletions(-) diff --git a/src/rk65c02.c b/src/rk65c02.c index a2055f7..4294ff7 100644 --- a/src/rk65c02.c +++ b/src/rk65c02.c @@ -18,12 +18,6 @@ void rk65c02_exec(rk65c02emu_t *); -/** - * \brief Prep the emulator, load code from file, pass bus config optionally. - * \param path Path to ROM file to be loaded. - * \param load_addr Address on the bus where ROM should be loaded. - * \param b Pre-existing bus configuration, pass NULL if default requested. - */ rk65c02emu_t rk65c02_load_rom(const char *path, uint16_t load_addr, bus_t *b) { @@ -42,9 +36,6 @@ rk65c02_load_rom(const char *path, uint16_t load_addr, bus_t *b) return e; } -/* - * Prepare the emulator for use, set initial CPU state. - */ rk65c02emu_t rk65c02_init(bus_t *b) { @@ -69,9 +60,6 @@ rk65c02_init(bus_t *b) return e; } -/* - * Assert the IRQ line. - */ void rk65c02_assert_irq(rk65c02emu_t *e) { @@ -87,9 +75,6 @@ rk65c02_assert_irq(rk65c02emu_t *e) rk65c02_start(e); } -/* - * Respond to interrupt and start the interrupt service routine. - */ void rk65c02_irq(rk65c02emu_t *e) { @@ -163,9 +148,6 @@ rk65c02_exec(rk65c02emu_t *e) } -/* - * Start the emulator. - */ void rk65c02_start(rk65c02emu_t *e) { @@ -177,9 +159,6 @@ rk65c02_start(rk65c02emu_t *e) { } } -/* - * Execute as many instructions as specified in steps argument. - */ void rk65c02_step(rk65c02emu_t *e, uint16_t steps) { @@ -273,27 +252,3 @@ rk65c02_panic(rk65c02emu_t *e, const char* fmt, ...) /* TODO: run some UI callback. */ } -/* -int -main(void) -{ - bus_t b; - - b = bus_init(); - - bus_write_1(&b, 0, OP_INX); - bus_write_1(&b, 1, OP_NOP); - bus_write_1(&b, 2, OP_LDY_IMM); - bus_write_1(&b, 3, 0x1); - bus_write_1(&b, 4, OP_TSB_ZP); - bus_write_1(&b, 5, 0x3); - bus_write_1(&b, 6, OP_JSR); - bus_write_1(&b, 7, 0x09); - bus_write_1(&b, 8, 0x0); - bus_write_1(&b, 9, OP_STP); - - rk65c02_start(&b, 0); - - bus_finish(&b); -} -*/ diff --git a/src/rk65c02.h b/src/rk65c02.h index 4d624df..0370181 100644 --- a/src/rk65c02.h +++ b/src/rk65c02.h @@ -1,3 +1,6 @@ +/** @file rk65c02.h + * @brief Public functions for managing rk65c02 emulator. + */ #ifndef _RK6502_H_ #define _RK6502_H_ @@ -76,14 +79,43 @@ struct rk65c02emu { typedef struct rk65c02emu rk65c02emu_t; +/** + * @brief Initialize the new emulator instance. Set initial CPU state. + */ rk65c02emu_t rk65c02_init(bus_t *); + +/** + * @brief Start the emulator. + */ 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 *); + +/** + * @brief Respond to interrupt and start the interrupt service routine. + */ void rk65c02_irq(rk65c02emu_t *); + void rk65c02_panic(rk65c02emu_t *, const char*, ...); + +/** + * @brief Prep the emulator, load code from file, pass bus config optionally. + * @param path Path to ROM file to be loaded. + * @param load_addr Address on the bus where ROM should be loaded. + * @param b Pre-existing bus configuration, pass NULL if default requested. + * @return New instance of the emulator prepared to run the ROM. + */ rk65c02emu_t rk65c02_load_rom(const char *, uint16_t, bus_t *); #endif