From 51093f364cd76b9febc790d57946245fa87b2cc6 Mon Sep 17 00:00:00 2001 From: Stefan Arentz Date: Sat, 12 Nov 2016 22:14:09 -0500 Subject: [PATCH] Fixes #1 - Properly reset the cpu --- cpu.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cpu.c b/cpu.c index daddf78..0e71064 100644 --- a/cpu.c +++ b/cpu.c @@ -306,6 +306,16 @@ void cpu_trace(struct cpu_t *cpu, uint8_t trace) { void cpu_reset(struct cpu_t *cpu) { cpu->state.pc = _mem_get_word(cpu, 0xfffc); + cpu->state.a = 0x00; + cpu->state.x = 0x00; + cpu->state.y = 0x00; + cpu->state.n = 0; + cpu->state.v = 0; + cpu->state.b = 0; + cpu->state.d = 0; + cpu->state.i = 1; + cpu->state.z = 0; + cpu->state.c = 0; cpu->state.sp = 0x01ff; }