I generally use counters and strings and the F11 menu to do debugging. I just set a bunch of debug counters and strings (typically with names preceded with underscores so they appear at the top) with whatever data I feel I might need and use that to try and work out what's going wrong.
This is partly because I'm often working in an area that makes stuff hard to trivially display on the screen and partly because I generally want to output a ton of information, more than could really be displayed on the message row. I can also export the counter set from the F11 menu and look at both my debug counters + strings and the actual counters + strings in a text editor while editing the suspect code, so I can attempt to work out the ways in which the current program state is inconsistent with what the code should be doing.
For particularly hardcore tasks I will sometimes write out logging data to a file; I'll typically have a log.txt that I erase at the start in the global robot:
set "log.txt" "fwrite_open"
set "" "fwrite_open
and then I'll just write out anything that happens to it with fwrite_append so I can close the file each time so that it doesn't interfere with any actual file writing my game might do:
set "log.txt" "fwrite_append"
set "$_dbg" "d &loopcount& &local2&\n"
set "$_dbg" "fwrite&$_dbg.length&"
set "" "fwrite_append"
I also tend to throw in the occasional assertion, although usually not too many because they take up space and can't be automatically removed in a trivial fashion. For me an assertion is usually something like:
if "(('local2'<0)o('local2'>150))" = 1 "wtf"
...
: "wtf"
ask "WTF"
end
if local2 will always be between 0 and 150. I tend to use the "wtf" label for all assertions, so this doesn't tell you which one triggered, but at least you know something is up and can dig into it later. The reason I use ask is because the 'ask' dialogue uses the protected palette and charset (or just charset in SMZX mode) so you can actually see the message. Not that it really matters because it's not a very descriptive message, but still!