- reverted motion clock timings from 480ff22670eb8898b0d15d5f884257232db584bf
    - this visually breaks Keystone Kapers ROM again but this was
    definitely not the right solution because the fix broke both Yar's
    Revenge and the stress-test-cards.

* I really now need to implement automatic regression tests

o debugger
    - implemented grepping of disassembly
This commit is contained in:
steve 2018-12-22 21:32:37 +00:00
parent 5b2f51197a
commit 37aeb96bfe
4 changed files with 38 additions and 1 deletions

View file

@ -53,6 +53,7 @@ const (
KeywordMouse = "MOUSE"
KeywordScript = "SCRIPT"
KeywordDisassemble = "DISASSEMBLE"
KeywordGrep = "GREP"
)
// Help contains the help text for the debugger's top level commands
@ -94,6 +95,7 @@ var Help = map[string]string{
KeywordMouse: "Return the coordinates of the last mouse press",
KeywordScript: "Run commands from specified file",
KeywordDisassemble: "Print the full cartridge disassembly",
KeywordGrep: "Simple string search (case insensitive) of the disassembly",
}
var commandTemplate = input.CommandTemplate{
@ -133,6 +135,7 @@ var commandTemplate = input.CommandTemplate{
KeywordMouse: "[|X|Y]",
KeywordScript: "%F",
KeywordDisassemble: "",
KeywordGrep: "%S %*",
}
// notes
@ -222,6 +225,16 @@ func (dbg *Debugger) parseCommand(userInput string) (bool, error) {
case KeywordDisassemble:
dbg.disasm.Dump(os.Stdout)
case KeywordGrep:
search := tokens.Remainder()
output := strings.Builder{}
dbg.disasm.Grep(search, &output, false)
if output.Len() == 0 {
dbg.print(ui.Error, "%s not found in disassembly", search)
} else {
dbg.print(ui.Feedback, output.String())
}
case KeywordSymbol:
// TODO: change this so that it uses debugger.memory front-end
symbol, _ := tokens.Get()

View file

@ -9,6 +9,7 @@ import (
"gopher2600/hardware/memory"
"gopher2600/symbols"
"io"
"strings"
)
// Disassembly represents the annotated disassembly of a 6502 binary
@ -126,3 +127,26 @@ func (dsm *Disassembly) Dump(output io.Writer) {
output.Write([]byte("\n"))
}
}
// Grep searches the disassembly dump for search string. case sensitive
func (dsm *Disassembly) Grep(search string, output io.Writer, caseSensitive bool) {
var s, m string
if !caseSensitive {
search = strings.ToUpper(search)
}
for _, pc := range dsm.SequencePoints {
s = dsm.Program[pc].GetString(dsm.Symtable, result.StyleBrief)
if !caseSensitive {
m = strings.ToUpper(s)
} else {
m = s
}
if strings.Contains(m, search) {
output.Write([]byte(s))
output.Write([]byte("\n"))
}
}
}

View file

@ -151,7 +151,7 @@ func (tia *TIA) StepVideoCycle() bool {
// motion clock is an out-of-phase color clock. note that the motion clock
// does not care about HMOVE.
if tia.colorClock.MatchEnd(8) {
if tia.colorClock.MatchEnd(15) {
tia.motionClock = true
} else if tia.colorClock.MatchEnd(56) {
tia.motionClock = false

Binary file not shown.