Gopher2600/debugger/halt_watches_test.go
JetSetIlly c19a37a738 CLK breakpoints/targets will prevent debugger entering playmode
two reasons:

1) to keep performance acceptable playmode only checks halting
   conditions on a CPU instruction boundary. however a CLK changes many
   times during an instruction meaning it will never match.

2) a CLK breakpoint will always match within 228 emulation ticks so
   there is no point entering playmode at all because it will definitely
   drop back to the debugger (within microseconds)

added a range change check to SCANLINE and CLK targets in
breakpoints.parseCommand(). we know what the possible values are for
these targets so we can be helpful and inform the user the some values
will never match
2021-11-11 10:00:26 +00:00

72 lines
2.2 KiB
Go

// This file is part of Gopher2600.
//
// Gopher2600 is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Gopher2600 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Gopher2600. If not, see <https://www.gnu.org/licenses/>.
package debugger_test
func (trm *mockTerm) testWatches() {
// debugger starts off with no watches
trm.sndInput("LIST WATCHES")
trm.cmpOutput("no watches")
// add read watch. there should be no output.
trm.sndInput("WATCH READ 0x80")
trm.cmpOutput("")
// try to re-add the same watch
trm.sndInput("WATCH READ 0x80")
trm.cmpOutput("already being watched (0x0080 (RAM) read)")
// list watches
trm.sndInput("LIST WATCHES")
trm.cmpOutput(" 0: 0x0080 (RAM) read")
// try to re-add the same watch but with a different event selector
trm.sndInput("WATCH WRITE 0x80")
trm.cmpOutput("")
// list watches
trm.sndInput("LIST WATCHES")
trm.cmpOutput(" 1: 0x0080 (RAM) write")
// clear watches
trm.sndInput("CLEAR WATCHES")
trm.cmpOutput("watches cleared")
// no watches after successful clear
trm.sndInput("LIST WATCHES")
trm.cmpOutput("no watches")
// try adding an invalid read address by symbol
trm.sndInput("WATCH READ VSYNC")
trm.cmpOutput("invalid watch address (VSYNC) expecting 16-bit address or a read symbol")
// add address by symbol. no read/write modifier means it tries
trm.sndInput("WATCH WRITE VSYNC")
trm.cmpOutput("")
// last item in list watches should be the new entry
trm.sndInput("LIST WATCHES")
trm.cmpOutput(" 0: 0x0000 (VSYNC) (TIA) write")
// add address by symbol. no read/write modifier means it tries
// plus a specific value
trm.sndInput("WATCH WRITE VSYNC 0x1")
trm.cmpOutput("")
// last item in list watches should be the new entry
trm.sndInput("LIST WATCHES")
trm.cmpOutput(" 1: 0x0000 (VSYNC) (TIA) write (value=0x01)")
}