From b9dbcc43a8d50fee411231b85fb273e21c3d19ae Mon Sep 17 00:00:00 2001 From: Ivan Izaguirre Date: Sat, 4 Apr 2020 20:13:53 +0200 Subject: [PATCH] Improve trace --- core6502/addressing.go | 4 ++-- core6502/registers.go | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core6502/addressing.go b/core6502/addressing.go index 7997a1f..6d2e63e 100644 --- a/core6502/addressing.go +++ b/core6502/addressing.go @@ -117,7 +117,7 @@ func lineString(line []uint8, opcode opcode) string { case modeAccumulator: t += fmt.Sprintf(" A") case modeImmediate: - t += fmt.Sprintf(" #%02x", line[1]) + t += fmt.Sprintf(" #$%02x", line[1]) case modeZeroPage: t += fmt.Sprintf(" $%02x", line[1]) case modeZeroPageX: @@ -144,7 +144,7 @@ func lineString(line []uint8, opcode opcode) string { case modeAbsoluteIndexedIndirectX: t += fmt.Sprintf(" ($%04x,X)", getWordInLine(line)) case modeZeroPageAndRelative: - t += fmt.Sprintf(" $%02x *%+x", line[1], int8(line[2])) + t += fmt.Sprintf(" $%02x %+x", line[1], int8(line[2])) default: t += "UNKNOWN MODE" } diff --git a/core6502/registers.go b/core6502/registers.go index 0eccee6..c6e9e26 100644 --- a/core6502/registers.go +++ b/core6502/registers.go @@ -87,6 +87,7 @@ func (r *registers) updateFlagZN(t uint8) { } func (r registers) String() string { - return fmt.Sprintf("A: %#02x, X: %#02x, Y: %#02x, SP: %#02x, PC: %#04x, P: %#02x, (NV-BDIZC): %08b", - r.getA(), r.getX(), r.getY(), r.getSP(), r.getPC(), r.getP(), r.getP()) + ch := (r.getA() & 0x3F) + 0x40 + return fmt.Sprintf("A: %#02x(%v), X: %#02x, Y: %#02x, SP: %#02x, PC: %#04x, P: %#02x, (NV-BDIZC): %08b", + r.getA(), string(ch), r.getX(), r.getY(), r.getSP(), r.getPC(), r.getP(), r.getP()) }