Commit graph

593 commits

Author SHA1 Message Date
JetSetIlly
669ff5bdad stepping over WSYNC is correctly implemented again
I think originally, after the debugging loop refactor, I was planning on
implementing this as STEP OVER and allowing a regular STEP (even in
instruction quantum) to advance to the next clock. but it proved to be
annoying and confusing
2021-11-21 07:41:13 +00:00
JetSetIlly
113e915cd3 pause indicator was lingering after a new ROM was loaded and started playing
setState() function was filtering when existing state was emulation.Initialising
it should have been filtering on emulation.EmulatorStart
2021-11-20 16:46:12 +00:00
JetSetIlly
08a3adb69a the 'ejected' cartridge retuns NOP rather an error
fixed corner case caused by RSYNC being triggered on the first scanline

fixed some presentational issues (Nan and Inf floats) caused by running
an ejected ROM

possible to switch from playmode to debugger when ROM selector is active
in all situations.
2021-11-20 14:37:09 +00:00
JetSetIlly
682c918ce2 made audio tracker available in playmode (F10)
this means that playmode now uses the lazy system. it's only loading
what it needs so as not to use too much memory. the good news is that it
doesn't seem to take any significant CPU time

tracker reset on debugger/emulation reset

piano keys window is now part of the tracker window

updated README indicating new hotkey
2021-11-19 22:15:00 +00:00
JetSetIlly
1e8e9dd005 removed -display option from performance mode
added -fpscap to emulate() function (used by both playmode and the
debugger) making it a good alternative to the -display option

getting performance mode to work with an increasingly complex
gui-emulation communication just isn't worth it. it would make the code
too complex.

this paves the way for removing the Emulation interface and using a
straight-forward Emulation type, which will be current Debugger type
renamd. the Debugger type is currently handling the playmode, performing
well and allowing tighter integration of the debugger and playmode.
2021-11-19 21:43:22 +00:00
JetSetIlly
68da3c95ea prefs window fully working in playmode
removed PREFS command. rewind preferences in their own tab. increased
default rewind to 250 and extended range of rewind prefs slider
2021-11-19 19:22:20 +00:00
JetSetIlly
9c59dea5e0 fixed interrupt handling when in playmode/debugger probably broken during 13aa07b
added terminal.UserQuit sentinal error to better handle quit events.
future versions should probably remove 'running' variable and rely on
this error and filter accordingly
2021-11-19 18:13:28 +00:00
JetSetIlly
2348faf319 improved ROM selector. updated CARTRIDGE command
double-click in ROM selector loads the cartridge. cartridgine
information below thumbnail. save ROM selection to preferences.
automatically select previous ROM on next session.
2021-11-19 16:44:10 +00:00
JetSetIlly
eb6578185a changed quantum "video" to "clock"
spruced up control window
2021-11-18 10:44:08 +00:00
JetSetIlly
219ffa58c5 playmode will always show ROM selector if cartridge is ejected
this works even when starting in debugmode and switching to playmode
before choosing a cartridge. before it would exit with a command line
error.
2021-11-18 10:29:33 +00:00
JetSetIlly
405689299d switching from debugger correctly leaves emulation on an instruction boundary
although playmode always stops on an instruction boundary, the
RewindNFrames() function left the debugger's input loop in the video
cycle input. this is okay but it led to instruction information saying,
for example, "3 of 3 cycles" instead of "3 cycles". this was confusing
and misleading
2021-11-18 10:29:33 +00:00
JetSetIlly
8a8a306670 corrected rewind splicing point
rewind.String() now produces correct summary in all instances

rewind reset on frequency change (in addition to the existing rule about
number of states). timeline no longer reset on this type of rewind
reset.

adjust coordinates function uses the correct zero value for color
clocks. the error could be seen on STEP BACK FRAME when the execution
would stop near clock 0 rathre than clock -68

execution states are recorded and appended to the history every frame
regardless of the snapshot frequency schedule. they continue to be
trimmed in the usual way. on emulation halt meanwhile, the current
coordinates are recorded which is more flexible and allows for video
cycle granularity.
2021-11-18 10:29:33 +00:00
JetSetIlly
5cdbc53d00 debugger catchup loop exits correctly if machine has been reset (cartridge insert) 2021-11-16 21:55:41 +00:00
JetSetIlly
1ae6aff543 fixed crash caused when cartridge was changed mid CPU instruction
resetting the CPU when a new cartridge was inserted left the Defn field
of the LastResult type in a nil state. the CPU now checks for nil and
returns a sentinal error. error is caught in Start() function and
discarded
2021-11-15 22:33:08 +00:00
JetSetIlly
3f6bd5fccb preview thumbnails in ROM selector
added thumbnailer package to support thumbnailing
2021-11-15 13:37:50 +00:00
JetSetIlly
50434ae36b added Mode() to emulation interface 2021-11-14 09:16:56 +00:00
JetSetIlly
8a46ac5482 tidy up of rewind package. clarified some concepts and consolidated/removed dead functions
reoved GotoCoords() tempFrame in anticipation of a more flexible system.
GotoCoords() when snapshot frequency greater than one will be noticeably
slower in the meantime
2021-11-14 09:16:56 +00:00
JetSetIlly
f44707057b counting for the timeline removed from reflection package
new counter package added (sub-package of reflection)

this new counting method is fast enough to be run while in playmode,
which means that historical timeline information is immediately
available in the debugger
2021-11-13 10:21:45 +00:00
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
JetSetIlly
7af5af322c performance brake for hardware.Run() moved outside of Run() function
extensive commentary on how best to use hardware.Run()
2021-11-11 06:56:50 +00:00
JetSetIlly
32499606a3 WSYNC/Coproc aren't counted in playmode so timeline now shows dotted lines
dotted lines indicate that those counts haven't been made during the
period shown
2021-11-10 14:29:53 +00:00
JetSetIlly
bba5ff253e analog thumbstick will never unpause the game on thumbstick center
this prevents thumbsticks from interfering with rewind/pause when it is
in the deadzone but not perfectly centered

correct icon is shown when rewind reaches beginning of buffer. was
showing pause ||. now showing the rewind/pause |<<
2021-11-09 09:29:27 +00:00
JetSetIlly
e0d577589f rewind in playmode is more responsive - mousewheel and keyboard
added rewind via gamepad bumper

cleanup of rewind functions in debugger package
2021-11-09 08:40:45 +00:00
JetSetIlly
656c42bb2c CPU notes phantom memory access. watches and traps ingore phantom accesss 2021-11-07 21:54:04 +00:00
JetSetIlly
c2d6e4d214 userinput package returns whether a userinput was handled by the emulation
this allows more elegant handling of unpause on controller input - no
unpause unless the controller is plugged in. ie. paddle input won't
cause the game to unpause unless the paddle controller is "plugged in"

added gamepad bumper (rewind in playmode) and guide button
(debugger/playmode switcher)
2021-11-07 09:52:26 +00:00
JetSetIlly
b0e009565d added EmulatorStart state in addition to Initialising state
Initialising can be used for cartridge loading / hotloading but
EmulatorStart is the setup state of the emulator and gui. it is useful
for preventing some gui operations while emulator is starting up
2021-11-07 09:52:26 +00:00
JetSetIlly
aea9bc1340 readded plug monitor. removed and not reimplemented during playmode refactor 2021-11-06 16:27:17 +00:00
JetSetIlly
86940981a5 a controller input (including the panel) will unpause emulation (playmode)
better mousewheel support for rewind
2021-11-06 12:37:49 +00:00
JetSetIlly
68b35ac5e2 fix bug introduced in 92d96cc4e9
reflection resetting on NewFrame() *before* NewFrame() in rewind has
completed. rewind timeline relies on reflection

I managed to ignore a comment stipulating this requirement during the
refactor
2021-11-06 09:32:51 +00:00
JetSetIlly
cfb8d725fd playmode checks for halt conditions 2021-11-04 23:12:29 +00:00
JetSetIlly
92d96cc4e9 major refactor. amalgamated debugger/playmode emulations
switch between debugger and playmode with F6 or backtick key

pakage debugger remains for now but it will be renamed to emulator or
something like that. playmode package removed.

commandline options for both debugger and playmode are the same
currently, with some playmode features being lost (temporarily)
2021-11-04 09:38:35 +00:00
JetSetIlly
02f6e05f1e debug mode performance improvements (about 65%)
halting check performance efficiency

less string manipulation in disassembly package. disassembly entry.Label
performance efficiency

reflection gatherer performance efficiency

overlay plotting efficiency. small performance improvement in overlay
plotting. color lookup table is now a straight array not a map

SDL polling efficiency for debug mode
2021-11-01 20:06:47 +00:00
JetSetIlly
b46dc6db58 added tracker package and audio tracking window 2021-10-28 19:49:15 +01:00
JetSetIlly
2834308791 tidy playmode/rewind packages 2021-10-28 12:24:54 +01:00
JetSetIlly
7629caf89d corrected how rewind package detects frames that don't exist yet
clarfied that the use of the Emulation type is for passive monitoring of
the underlying emulation. rewind package now monitors the emulation
passively.
2021-10-26 09:01:42 +01:00
JetSetIlly
31138f16f3 removed InstructionBoundary() interface and television.ReqState()
Instruction boundaries can be inferred by the debugging input loop,
which is the only place it is requred. reworked GetAdjustedCoords() in
the televsion package (now called AdjCoords()) to cope with this.

ReqState() is totally replaced by GetCoords()
2021-10-23 10:50:19 +01:00
JetSetIlly
63b188b997 moved TelevisionCoords from signal package to new package coords
Equals() and GreaterThanOrEqual() are no pacakge level functions (in the
coords package)
2021-10-22 20:23:55 +01:00
JetSetIlly
19dc94c192 added TelevisionCoords to signals package
makes it more convenient/clearer when working with all three coordinate
values (frame, scanline and clock)

changed all packages to GetCoords() where appropriate
2021-10-22 20:02:02 +01:00
JetSetIlly
a5b2c0101c coprocessor disassembly is disabled by default
renamed "last execution" window to "coprocessor disassembly" where
the actual name of the coprocessor is used

coproc disassembly window now shows an enable and a disable button. if
the emulation is paused the previous two frames of the emulation will be
rerun in order to generate a disassembly

coprocessor disassembly and last execution are shown in tabs. if
disassembly is disabled then the last execution tab will show nothing
but the disassembly tab will show what we have, with a note that it is
not bing udpated
2021-10-22 18:43:16 +01:00
JetSetIlly
64ab9e0be5 trying to record rewind state would panic on legitimate CPU error
legitimate errors include reading cartridge address with no cartridge
inserted. rewind will now check for CPU/Result state before logging and
returning before any recording has taken place

BRK instruction consumes two bytes but records only one. when
video-stepping over a BRK instruction this caused an error because the
adjustment to the number of bytes read value was done too late
2021-10-20 14:57:13 +01:00
JetSetIlly
0570ab4116 TimelineCounter interface. implemented by reflection.Gatherer
provides count information about the VCS system that would otherwise be
awkward to gather otherwise
2021-10-18 23:00:19 +01:00
JetSetIlly
5c75a68114 added timeline to rewind package and added rewind window 2021-10-16 18:35:20 +01:00
JetSetIlly
fcd7cfdccf updated windows version of Colorterm type
IsRealTerminal() was added some time ago but the windows build wasn't
tested. fixed build problems by adding missing function.
2021-10-15 19:06:56 +01:00
JetSetIlly
250dedcd2d moved debugger/memory.go to a new dbgmem package 2021-10-10 11:52:30 +01:00
JetSetIlly
d196e5a28e small reworking of breakpoint/trap targets, clarifying some concepts 2021-10-10 10:51:02 +01:00
JetSetIlly
0c1aa7041d debugger reset breakpoints, etc. for new cartridge insertion
breakpoints, watches, etc. were being preserved when a new cartridge was
being inserted. this is rarely required
2021-10-08 08:32:03 +01:00
JetSetIlly
d92aaad89d step back instruction always produces correct results
stepping back previously was "correct" but was confusing when looking at
the disassembly (rather than the debugging screen)

introduced the concept of a catchupQuantum. distinct from the existing
stepQuantum (renamed from 'quantum') but having the same underlying type

the catchupQuantum makes sure that the inputloop is left in the correct
state. in other words in an 'isVideoStep' version so of inputLoop(), or
not depending on how the catchup was initiated
2021-10-07 15:40:34 +01:00
JetSetIlly
7b2596d59d fixed how WATCH uses mapAddress()
TRACE command show read/write value in trace
2021-10-07 15:40:34 +01:00
JetSetIlly
d788fb46bb break/trap targets are now aware of CPU instruction boundaries
halting conditions are checked every video-cycle. this reverts a
temporary change made in a73dcae6dcc61e4ced03f23fe4df504cb966fb36

renamed files in debugger package for clarity
2021-10-07 15:40:34 +01:00
JetSetIlly
3f5923c358 implemented STEP OVER command
stepping by video does not now check for halting conditions. in some
cases halting on a target is confusing. for example break PC will break
too early if checked every video cycle. we could perhaps reintroduce it
but only when targets are aware of the current state of the machine
(ie. mid-CPU instruction or not)

similarly, halt on video-step will no longer decode the next instruction
at the current PC. the current PC will be in a misleading state between
CPU instruction boundaries

STEP OVER button. not finished yet just a placeholder really
2021-10-06 08:20:24 +01:00