Page 1 of 1

Emulator with debugger which updates screen on single step

Posted: Sat Dec 23, 2017 10:15 am
by dfzx
I use Linux, and Fuse is my emulator of choice. Its debugger isn't great, however, and has a significant issue which bugs me: if I single step code which writes into screen memory, Fuse doesn't update the main display window. It's not until you click the Continue button that the display updates.

What I want is to see how patterns of bits being written into screen memory affect the display, byte by byte. That would allow me to see masking and ORing at work, which I have trouble visualising in my head.

Does anyone know of an emulator with a debugger which supports this? Ideally Linux, but I can use Winders at a push. :)

Re: Emulator with debugger which updates screen on single step

Posted: Sat Dec 23, 2017 10:37 am
by bob_fossil
I run SpecEmu on Ubuntu Mate 16.04 with WINE and that seems to update the screen when you step through the code using it's debugger. I just tried it with the following bit of code:

Code: Select all

ld a,255
ld hl,16384
ld (hl),a
ret
Doing step on the ld (hl),a makes a black horizontal line appear in the top left corner of the screen.

Bob Fossil

Re: Emulator with debugger which updates screen on single step

Posted: Sat Dec 23, 2017 10:44 am
by Hikaru
If you mean like masked sprites and whatnot, you won't be able to see the individual steps of AND and OR that way, since typically each byte is only written back once with the combined result:

Code: Select all

	pop de
	ld a,(hl)
	and e
	or d
	ld (hl),a
	inc l
	...
Think of it like this: masking puts the 'black' parts of the sprite, ORing puts the 'white' parts of the sprite.

Re: Emulator with debugger which updates screen on single step

Posted: Sat Dec 23, 2017 10:48 am
by Ast A. Moore
dfzx wrote: Sat Dec 23, 2017 10:15 am Fuse doesn't update the main display window. It's not until you click the Continue button that the display updates.
Well, not quite. Your hitting Continue has nothing to do with screen updates per se. What does is the interrupt timing (as on a real machine). So if you continue stepping through your code long enough for an interrupt to trigger, the screen will update.

It would be great if it could be switching to a “virtual display update” mode to see exactly “what would have happened if the screen had updated at arbitrary times.” Alternatively, it would be nice to see a slowed down “virtual electron beam” as it passes through the entire screen area. Unfortunately, that’s just a coulda-shoulda-woulda kind of thing. But yes, Fuse does update the screen when you step through.

Re: Emulator with debugger which updates screen on single step

Posted: Sat Dec 23, 2017 10:53 am
by Ast A. Moore
dfzx wrote: Sat Dec 23, 2017 10:15 am That would allow me to see masking and ORing at work, which I have trouble visualising in my head.
Use a programmer’s calculator (they have commands for most Boolean operators) switched to display binary:
Image

Re: Emulator with debugger which updates screen on single step

Posted: Sat Dec 23, 2017 11:17 am
by Ralf
I remember having similar discussion on WOS some years ago.

I was asking for the same - you write a byte to screen memory and you see it on the screen. Unfortunately in many emulators you won't see it.

I was told by some guys it would be very wrong request as real Spectrum doesn't work this way and emulators should behave like real Spectrum ;)

Explanation for less technically experienced people:

Spectrum refreshes screens 50 times per second at the beggining of each display frame. It doesn't do it immediately but row by row from top to bottom which lasts for a while. It executes code at the same time so you can for example replace some attributes on the fly and get multicolor effect

So if you write some byte to screen memory in debugger, you want it to appear on screen and you want it all kosher, in theory you should click through thousands of instructions until you reach refresh of this particular pixel line ;)


But now I hear that it is possible in some emulator and I'm quite happy about it ;)

Re: Emulator with debugger which updates screen on single step

Posted: Sat Dec 23, 2017 11:48 am
by dfzx
Ast A. Moore wrote: Sat Dec 23, 2017 10:48 am Well, not quite. Your hitting Continue has nothing to do with screen updates per se. What does is the interrupt timing (as on a real machine). So if you continue stepping through your code long enough for an interrupt to trigger, the screen will update.
Oh, I see. Yes, that's clearly how it should work. Doesn't quite help for what I want though.

Bob says SpecEmu does what I want, which presumably would have to be interpreted as a weakness of the emulator.

Re: Emulator with debugger which updates screen on single step

Posted: Sat Dec 23, 2017 12:59 pm
by AndyC
You could get the best of both if the emulator has a "graphics ripper" view that lets you directly inspect memory as a screen bitmap, if it updated live. I tried Spin but that doesn't seem to refresh that view unless you change one of the settings. It might be worth seeing how other emulators handle it though.

Re: Emulator with debugger which updates screen on single step

Posted: Sat Dec 23, 2017 1:02 pm
by Woodster
dfzx wrote: Sat Dec 23, 2017 11:48 am
Ast A. Moore wrote: Sat Dec 23, 2017 10:48 am Well, not quite. Your hitting Continue has nothing to do with screen updates per se. What does is the interrupt timing (as on a real machine). So if you continue stepping through your code long enough for an interrupt to trigger, the screen will update.
Oh, I see. Yes, that's clearly how it should work. Doesn't quite help for what I want though.

Bob says SpecEmu does what I want, which presumably would have to be interpreted as a weakness of the emulator.
SpecEmu updates the entire display by default in the debugger and optionally can be switched to the cycle-accurate update.