From 1751a7af1fbaeba2c8a661b817e5df113135a421 Mon Sep 17 00:00:00 2001 From: Peter Evans Date: Tue, 23 Jan 2018 21:18:42 -0600 Subject: [PATCH] Don't try to call resolv() if resolv is NULL --- src/mos6502.dis.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mos6502.dis.c b/src/mos6502.dis.c index ea8af28..7f94ee7 100644 --- a/src/mos6502.dis.c +++ b/src/mos6502.dis.c @@ -96,11 +96,13 @@ mos6502_dis_operand(mos6502 *cpu, { int rel_address; int ind_address; - vm_8bit eff_value; + vm_8bit eff_value = 0; mos6502_address_resolver resolv; resolv = mos6502_get_address_resolver(addr_mode); - eff_value = resolv(cpu); + if (resolv) { + eff_value = resolv(cpu); + } switch (addr_mode) { case ACC: @@ -123,7 +125,7 @@ mos6502_dis_operand(mos6502 *cpu, snprintf(s_value, sizeof(s_value), "%02x", eff_value); break; case IMP: - snprintf(s_value, sizeof(s_value), "%02X", 0); + snprintf(s_value, sizeof(s_value), "%02x", 0); break; case IND: ind_address = mos6502_get(cpu, value + 1) << 8;