Show the filenames of MOS saves log

This commit is contained in:
Ivan Izaguirre 2021-07-25 23:16:32 +02:00
parent e47730e131
commit 4884a8861f
1 changed files with 22 additions and 4 deletions

View File

@ -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)
}