LAST command updates live bank and disam info when in CLOCK quantum

updating live information is expensive and we only do it after every
instruction normally. however, for the LAST command we need that
information to be current
This commit is contained in:
JetSetIlly 2023-11-06 12:53:14 +00:00
parent 8a243c7e95
commit f60c88fe55
2 changed files with 14 additions and 3 deletions

View file

@ -923,6 +923,15 @@ func (dbg *Debugger) processTokens(tokens *commandline.Tokens) error {
return nil
case cmdLast:
// if debugger is running in clock quantum then the live disasm
// information will not have been updated. for the purposes of the last
// instruction however, we definitely do want that information to be
// current
if dbg.running && dbg.quantum.Load() == govern.QuantumClock {
dbg.liveBankInfo = dbg.vcs.Mem.Cart.GetBank(dbg.vcs.CPU.PC.Address())
dbg.liveDisasmEntry = dbg.Disasm.ExecutedEntry(dbg.liveBankInfo, dbg.vcs.CPU.LastResult, true, dbg.vcs.CPU.PC.Value())
}
if dbg.liveDisasmEntry == nil || dbg.liveDisasmEntry.Result.Defn == nil {
dbg.printLine(terminal.StyleFeedback, "no instruction decoded yet")
return nil

View file

@ -131,7 +131,8 @@ type Debugger struct {
CoProcDev coproc_dev.Developer
// the live disassembly entry. updated every CPU step or on halt (which may
// be mid instruction)
// be mid instruction). it is also updated by the LAST command when the
// debugger is in the CLOCK quantum
//
// we use this so that we can display the instruction as it exists in the
// CPU at any given time, which means we can see the partially decoded
@ -145,8 +146,9 @@ type Debugger struct {
// function in the disassembly package
liveDisasmEntry *disassembly.Entry
// the live bank information. updated every CPU step or on halt (which may
// be mid instruction)
// the live disassembly entry. updated every CPU step or on halt (which may
// be mid instruction). it is also updated by the LAST command when the
// debugger is in the CLOCK quantum
liveBankInfo mapper.BankInfo
// the television coords of the last CPU instruction