diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2020-11-28 11:20:03 +0100 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2020-11-28 11:20:03 +0100 |
commit | aca930d803177cb6ea8ebadd77b6ef09ab2b5b49 (patch) | |
tree | e35da8c68588a28534ae51c47025214fe5450e17 /emu/6502.c | |
parent | f829f6893d94ed52044bf007bc447526c9d5e653 (diff) | |
download | 6502-aca930d803177cb6ea8ebadd77b6ef09ab2b5b49.tar.gz 6502-aca930d803177cb6ea8ebadd77b6ef09ab2b5b49.tar.bz2 |
addressed initializiation of components and valgrindified
Diffstat (limited to 'emu/6502.c')
-rw-r--r-- | emu/6502.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -8,10 +8,19 @@ static const uint16_t reset_vector = 0xFFFC; static const uint16_t ZP_base = 0x0; static const uint16_t SP_base = 0x100; -void cpu_6502_init( cpu_6502_t *cpu, bus_t *bus ) +void cpu_6502_init( cpu_6502_t *cpu, bus_t *bus, bool initialize ) { cpu->bus = bus; cpu->debug_flags = 0; + cpu->steps = 0; + + if( initialize ) { + cpu->PC = 0x0000; + cpu->SP = 0x00; + cpu->A = 0x00; + cpu->X = 0x00; + cpu->Y = 0x00; + } } uint16_t cpu_6502_read_word( cpu_6502_t *cpu, uint16_t addr ) |