mirror of
https://github.com/andwati/mos-6502.git
synced 2026-11-07 12:22:17 +00:00
Implement state saving and loading for CPU and Bus, add tests for various functionalities
- Added `state.c` to handle saving and loading the state of the CPU and Bus. - Implemented CRC32 checksum for data integrity verification during state operations. - Enhanced `README.md` in tests/roms to document new test commands for decimal, interrupt, Apple I, and nestest. - Created new test files: `run_apple1.c`, `run_decimal.c`, `run_interrupt.c`, `run_nestest.c`, and `run_vectors.c` to validate the new features. - Updated `run_tests.c` to include tests for state saving/loading and other functionalities. - Introduced `test_vectors.py` to facilitate downloading and running JSON test vectors for opcode verification.
This commit is contained in:
+11
-2
@@ -5,13 +5,20 @@
|
||||
#include <stdint.h>
|
||||
#include "memory.h"
|
||||
|
||||
typedef struct Bus6502 {
|
||||
typedef struct Bus6502 Bus6502;
|
||||
typedef bool (*bus_read_hook_t)(void *userdata,uint16_t addr,uint8_t *value);
|
||||
typedef bool (*bus_write_hook_t)(void *userdata,uint16_t addr,uint8_t value);
|
||||
|
||||
struct Bus6502 {
|
||||
Memory memory;
|
||||
uint8_t keyboard;
|
||||
uint32_t rng_state;
|
||||
bool easy6502_io;
|
||||
bool framebuffer_dirty;
|
||||
} Bus6502;
|
||||
bus_read_hook_t read_hook;
|
||||
bus_write_hook_t write_hook;
|
||||
void *hook_userdata;
|
||||
};
|
||||
|
||||
void bus_init(Bus6502 *bus);
|
||||
uint8_t bus_read(Bus6502 *bus, uint16_t addr);
|
||||
@@ -20,5 +27,7 @@ uint16_t bus_read16(Bus6502 *bus, uint16_t addr);
|
||||
void bus_write16(Bus6502 *bus, uint16_t addr, uint16_t value);
|
||||
void bus_set_keyboard(Bus6502 *bus, uint8_t key);
|
||||
void bus_seed_rng(Bus6502 *bus, uint32_t seed);
|
||||
void bus_set_hooks(Bus6502 *bus,bus_read_hook_t read_hook,
|
||||
bus_write_hook_t write_hook,void *userdata);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user