From 4884a8861f576f5cd49320229263c4c9131477c4 Mon Sep 17 00:00:00 2001 From: Ivan Izaguirre Date: Sun, 25 Jul 2021 23:16:32 +0200 Subject: [PATCH] Show the filenames of MOS saves log --- traceApplecorn.go | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/traceApplecorn.go b/traceApplecorn.go index fb88e7b..4ffe800 100644 --- a/traceApplecorn.go +++ b/traceApplecorn.go @@ -120,7 +120,10 @@ func (t *traceApplecorn) inspect() { case 0xffda: s = "OSARGS(?)" case 0xffdd: - s = "OSFILE(?)" + controlBlock := uint16(regX) + uint16(regY)<<8 + filenameAddress := t.a.mmu.peekWord(controlBlock) + filename := t.getTerminatedString(filenameAddress, 0x0d) + s = fmt.Sprintf("OSFILE(A=%02x,FILE=%s)", regA, filename) case 0xffe0: s = fmt.Sprintf("OSRDCH()") skip = t.skipConsole @@ -156,6 +159,11 @@ func (t *traceApplecorn) inspect() { s = "OSCLI(?)" } + if s == "UNKNOWN" && t.skipConsole { + // Let's also skip not known calls + skip = true + } + t.call.api = pc t.call.a = regA t.call.x = regX @@ -178,9 +186,6 @@ func (t *traceApplecorn) inspect() { lineAddress := t.a.mmu.peekWord(cbAddress) line := t.getString(lineAddress, regY) s = fmt.Sprintf(",line='%s'", line) - - t.a.cpu.SetTrace(true) - } } @@ -199,6 +204,19 @@ func (t *traceApplecorn) getString(address uint16, length uint8) string { return s } +func (t *traceApplecorn) getTerminatedString(address uint16, terminator uint8) string { + s := "" + for { + ch := t.a.mmu.Peek(address) + if ch == terminator { + break + } + s += string(ch) + address++ + } + return s +} + func (t *traceApplecorn) vector(address uint16) uint16 { return t.a.mmu.peekWord(address) }