From 2ae87bf12ef9fbdff4bc7f95d40a3ce4577d919a Mon Sep 17 00:00:00 2001 From: Rob McMullen Date: Mon, 18 Dec 2017 22:50:41 -0800 Subject: [PATCH] Fixed cycle timing for multi-byte NOP instructions --- 6502.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/6502.c b/6502.c index 74e4f4b..49da8e3 100644 --- a/6502.c +++ b/6502.c @@ -316,7 +316,9 @@ static void inst_LSR() static void inst_NOP() { - // nothing + // thrown away, just used to compute any extra cycles for the multi-byte + // NOP statements + read_ptr(); } static void inst_ORA() @@ -483,6 +485,13 @@ static void inst_TYA() /* Addressing Implementations */ +uint8_t * get_IMPL() +{ + // dummy implementation; for completeness necessary for cycle counting NOP + // instructions + return &memory[0]; +} + uint8_t * get_IMM() { return &memory[(uint16_t) (PC+1)]; @@ -627,6 +636,7 @@ void init_tables() // this is only done at runtime to improve code readability. get_ptr[ABSX] = get_ABSX; get_ptr[ABSY] = get_ABSY; get_ptr[IMM] = get_IMM; + get_ptr[IMPL] = get_IMPL; get_ptr[IND] = get_IND; get_ptr[XIND] = get_XIND; get_ptr[INDY] = get_INDY;