now I got this problem
proc dbsn { count } { debug step incr count -1 if {$count > 0 } { after realtime 0 "dbsn $count" } else { after realtime 0 "puts [disasm]" } return } namespace export dbsn
getting an error
I thought with another after the disasm might be in sync
ok I needed another bracket. but display is still one instruction behind.
What display is behind exactly? can you give an example what you expected and what is happening instead?
proc dbsn { count } { debug step incr count -1 if {$count > 0 } { after realtime 0 "dbsn $count" } #else { after realtime 0 "[puts [disasm]]" } if {$count == 0 } { puts [disasm] } return } namespace export dbsn
then use it with
debug break reset dbsn 4 disasm
the script disasm is a step behind
Remember that we introduced the 'after realtime 0' construction to allow openMSX to execute emulation for the 'debug step' command. So that command is only executed after this proc ends.
I solved it quickly in this version:
proc dbsn { count } { debug step incr count -1 if {$count > 0 } { after realtime 0 "dbsn $count" } #else { after realtime 0 "[puts [disasm]]" } if {$count == 0 } { after realtime 0 "puts \[disasm\]" } return } namespace export dbsn
Note the escaping of the []. That's because I do not want it to have it executed when I make the 'after realtime 0' command, but when the argument of 'after realtime 0' is executed.
ah. the debug step is like just sending a signal.
then after the last "debug step" one needs another "after 0" to give the other thread a timeslice to update the variables.
Yes. I'd describe it like: "when a Tcl script is running, no emulation is running". So make sure that the Tcl scripts stop running to let emulation run.