summaryrefslogtreecommitdiff
path: root/emu/6502.c
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2020-11-28 11:20:03 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2020-11-28 11:20:03 +0100
commitaca930d803177cb6ea8ebadd77b6ef09ab2b5b49 (patch)
treee35da8c68588a28534ae51c47025214fe5450e17 /emu/6502.c
parentf829f6893d94ed52044bf007bc447526c9d5e653 (diff)
download6502-aca930d803177cb6ea8ebadd77b6ef09ab2b5b49.tar.gz
6502-aca930d803177cb6ea8ebadd77b6ef09ab2b5b49.tar.bz2
addressed initializiation of components and valgrindified
Diffstat (limited to 'emu/6502.c')
-rw-r--r--emu/6502.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/emu/6502.c b/emu/6502.c
index dbdf5a1..e39dc38 100644
--- a/emu/6502.c
+++ b/emu/6502.c
@@ -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 )