Press F11 to toggle CPU execution trace to standard output
This commit is contained in:
parent
e14577d501
commit
c10a6f7e8a
|
@ -90,6 +90,7 @@ Line:
|
||||||
- F7: Save current state to disk
|
- F7: Save current state to disk
|
||||||
- F8: Restore state from disk
|
- F8: Restore state from disk
|
||||||
- F10: Cycle character generator codepages. Only if the character generator ROM has more than one 2Kb page.
|
- F10: Cycle character generator codepages. Only if the character generator ROM has more than one 2Kb page.
|
||||||
|
- F11: Toggle on and off the trace to console of the CPU execution
|
||||||
- F12: Save a screen snapshot to a file `snapshot.png`
|
- F12: Save a screen snapshot to a file `snapshot.png`
|
||||||
|
|
||||||
Only valid on SDL mode
|
Only valid on SDL mode
|
||||||
|
|
|
@ -86,6 +86,8 @@ const (
|
||||||
CommandDumpDebugInfo
|
CommandDumpDebugInfo
|
||||||
// CommandNextCharGenPage cycles the CharGen page if several
|
// CommandNextCharGenPage cycles the CharGen page if several
|
||||||
CommandNextCharGenPage
|
CommandNextCharGenPage
|
||||||
|
// CommandToggleCPUTrace toggle tracing of CPU execution
|
||||||
|
CommandToggleCPUTrace
|
||||||
)
|
)
|
||||||
|
|
||||||
// SendCommand enqueues a command to the emulator thread
|
// SendCommand enqueues a command to the emulator thread
|
||||||
|
@ -116,6 +118,8 @@ func (a *Apple2) executeCommand(command int) {
|
||||||
case CommandNextCharGenPage:
|
case CommandNextCharGenPage:
|
||||||
a.cg.nextPage()
|
a.cg.nextPage()
|
||||||
fmt.Printf("Chargen page %v\n", a.cg.page)
|
fmt.Printf("Chargen page %v\n", a.cg.page)
|
||||||
|
case CommandToggleCPUTrace:
|
||||||
|
a.cpu.SetTrace(!a.cpu.GetTrace())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,8 @@ func (k *sdlKeyboard) putKey(keyEvent *sdl.KeyboardEvent) {
|
||||||
k.a.SendCommand(apple2.CommandDumpDebugInfo)
|
k.a.SendCommand(apple2.CommandDumpDebugInfo)
|
||||||
case sdl.K_F10:
|
case sdl.K_F10:
|
||||||
k.a.SendCommand(apple2.CommandNextCharGenPage)
|
k.a.SendCommand(apple2.CommandNextCharGenPage)
|
||||||
|
case sdl.K_F11:
|
||||||
|
k.a.SendCommand(apple2.CommandToggleCPUTrace)
|
||||||
case sdl.K_F12:
|
case sdl.K_F12:
|
||||||
apple2.SaveSnapshot(k.a, "snapshot.png")
|
apple2.SaveSnapshot(k.a, "snapshot.png")
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,11 +44,6 @@ func (s *State) executeLine(line []uint8) {
|
||||||
opcode.action(s, line, opcode)
|
opcode.action(s, line, opcode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTrace activates tracing of the cpu execution
|
|
||||||
func (s *State) SetTrace(trace bool) {
|
|
||||||
s.trace = trace
|
|
||||||
}
|
|
||||||
|
|
||||||
// ExecuteInstruction transforms the state given after a single instruction is executed.
|
// ExecuteInstruction transforms the state given after a single instruction is executed.
|
||||||
func (s *State) ExecuteInstruction() {
|
func (s *State) ExecuteInstruction() {
|
||||||
pc := s.reg.getPC()
|
pc := s.reg.getPC()
|
||||||
|
@ -137,3 +132,13 @@ func lineString(line []uint8, opcode opcode) string {
|
||||||
}
|
}
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetTrace activates tracing of the cpu execution
|
||||||
|
func (s *State) SetTrace(trace bool) {
|
||||||
|
s.trace = trace
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTrace gets trhe tracing state of the cpu execution
|
||||||
|
func (s *State) GetTrace() bool {
|
||||||
|
return s.trace
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue