mirror of
https://github.com/JetSetIlly/Gopher2600.git
synced 2025-04-02 11:02:17 -04:00
o debugger
- renamed CurrentValue to TargetValue() in Target interface
This commit is contained in:
parent
f39d1d33e3
commit
485b8c5fe5
6 changed files with 15 additions and 14 deletions
|
@ -85,7 +85,7 @@ func (bk breaker) id() int {
|
|||
// check checks the specific break condition with the current value of
|
||||
// the break target
|
||||
func (bk *breaker) check() bool {
|
||||
currVal := bk.target.CurrentValue()
|
||||
currVal := bk.target.TargetValue()
|
||||
m := currVal == bk.value
|
||||
if !m {
|
||||
bk.ignoreValue = nil
|
||||
|
@ -225,7 +225,7 @@ func (bp *breakpoints) parseBreakpoint(tokens *commandline.Tokens) error {
|
|||
|
||||
// try to interpret the token depending on the type of value the target
|
||||
// expects
|
||||
switch tgt.CurrentValue().(type) {
|
||||
switch tgt.TargetValue().(type) {
|
||||
case int:
|
||||
var v int64
|
||||
v, err = strconv.ParseInt(tok, 0, 32)
|
||||
|
@ -242,7 +242,7 @@ func (bp *breakpoints) parseBreakpoint(tokens *commandline.Tokens) error {
|
|||
err = errors.New(errors.CommandError, fmt.Sprintf("invalid value (%s) for target (%s)", tok, tgt.Label()))
|
||||
}
|
||||
default:
|
||||
return errors.New(errors.CommandError, fmt.Sprintf("unsupported value type (%T) for target (%s)", tgt.CurrentValue(), tgt.Label()))
|
||||
return errors.New(errors.CommandError, fmt.Sprintf("unsupported value type (%T) for target (%s)", tgt.TargetValue(), tgt.Label()))
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
|
@ -281,7 +281,7 @@ func (bp *breakpoints) parseBreakpoint(tokens *commandline.Tokens) error {
|
|||
}
|
||||
|
||||
if !resolvedTarget {
|
||||
return errors.New(errors.CommandError, fmt.Sprintf("need a value (%T) to break on (%s)", tgt.CurrentValue(), tgt.Label()))
|
||||
return errors.New(errors.CommandError, fmt.Sprintf("need a value (%T) to break on (%s)", tgt.TargetValue(), tgt.Label()))
|
||||
}
|
||||
|
||||
return bp.checkNewBreakers(newBreaks)
|
||||
|
|
|
@ -14,7 +14,7 @@ type target interface {
|
|||
|
||||
// the current value of the target. should return a value of type int or
|
||||
// bool.
|
||||
CurrentValue() interface{}
|
||||
TargetValue() interface{}
|
||||
|
||||
// format an arbitrary value using suitable formatting method for the target
|
||||
FormatValue(val interface{}) string
|
||||
|
@ -31,7 +31,7 @@ func (trg genericTarget) Label() string {
|
|||
return trg.label
|
||||
}
|
||||
|
||||
func (trg genericTarget) CurrentValue() interface{} {
|
||||
func (trg genericTarget) TargetValue() interface{} {
|
||||
switch v := trg.currentValue.(type) {
|
||||
case func() interface{}:
|
||||
return v()
|
||||
|
|
|
@ -39,6 +39,7 @@ func (tr *traps) clear() {
|
|||
tr.traps = make([]trapper, 0, 10)
|
||||
}
|
||||
|
||||
// drop the numbered trap from the list
|
||||
func (tr *traps) drop(num int) error {
|
||||
if len(tr.traps)-1 < num {
|
||||
return errors.New(errors.CommandError, fmt.Sprintf("trap #%d is not defined", num))
|
||||
|
@ -59,7 +60,7 @@ func (tr *traps) check(previousResult string) string {
|
|||
checkString := strings.Builder{}
|
||||
checkString.WriteString(previousResult)
|
||||
for i := range tr.traps {
|
||||
trapValue := tr.traps[i].target.CurrentValue()
|
||||
trapValue := tr.traps[i].target.TargetValue()
|
||||
|
||||
if trapValue != tr.traps[i].origValue {
|
||||
checkString.WriteString(fmt.Sprintf("trap on %s [%v->%v]\n", tr.traps[i].target.Label(), tr.traps[i].origValue, trapValue))
|
||||
|
@ -98,7 +99,7 @@ func (tr *traps) parseTrap(tokens *commandline.Tokens) error {
|
|||
}
|
||||
|
||||
if addNewTrap {
|
||||
tr.traps = append(tr.traps, trapper{target: tgt, origValue: tgt.CurrentValue()})
|
||||
tr.traps = append(tr.traps, trapper{target: tgt, origValue: tgt.TargetValue()})
|
||||
}
|
||||
|
||||
_, present = tokens.Peek()
|
||||
|
|
|
@ -31,8 +31,8 @@ func (pc ProgramCounter) FormatValue(val interface{}) string {
|
|||
return fmt.Sprintf("%#04x", val)
|
||||
}
|
||||
|
||||
// CurrentValue returns the current value of the PC as an integer (wrapped as a generic value)
|
||||
func (pc ProgramCounter) CurrentValue() interface{} {
|
||||
// TargetValue returns the current value of the PC as an integer (wrapped as a generic value)
|
||||
func (pc ProgramCounter) TargetValue() interface{} {
|
||||
return int(pc.value)
|
||||
}
|
||||
|
||||
|
|
|
@ -62,8 +62,8 @@ func (r Register) Label() string {
|
|||
return r.label
|
||||
}
|
||||
|
||||
// CurrentValue implements the target interface
|
||||
func (r Register) CurrentValue() interface{} {
|
||||
// TargetValue implements the target interface
|
||||
func (r Register) TargetValue() interface{} {
|
||||
return int(r.value)
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ func (cart *Cartridge) Attach(cartload cartridgeloader.Loader) error {
|
|||
case "FA":
|
||||
cart.mapper, err = newCBS(data)
|
||||
case "FE":
|
||||
// TODO
|
||||
// !!TODO: FE cartridge format
|
||||
case "E0":
|
||||
cart.mapper, err = newparkerBros(data)
|
||||
case "E7":
|
||||
|
@ -146,7 +146,7 @@ func (cart *Cartridge) Attach(cartload cartridgeloader.Loader) error {
|
|||
case "3F":
|
||||
cart.mapper, err = newTigervision(data)
|
||||
case "AR":
|
||||
// TODO
|
||||
// !!TODO: AR cartridge format
|
||||
}
|
||||
|
||||
if addSuperchip {
|
||||
|
|
Loading…
Add table
Reference in a new issue