Emulator with debugger which updates screen on single step

Struggling with Fuse or trying to find an emulator with a specific feature. Ask your questions here.
Post Reply
dfzx
Manic Miner
Posts: 673
Joined: Mon Nov 13, 2017 6:55 pm
Location: New Forest, UK
Contact:

Emulator with debugger which updates screen on single step

Post 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. :)
Derek Fountain, author of the ZX Spectrum C Programmer's Getting Started Guide and various open source games, hardware and other projects, including an IF1 and ZX Microdrive emulator.
User avatar
bob_fossil
Manic Miner
Posts: 654
Joined: Mon Nov 13, 2017 6:09 pm

Re: Emulator with debugger which updates screen on single step

Post 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
Hikaru
Microbot
Posts: 100
Joined: Mon Nov 13, 2017 1:42 pm
Location: Russia
Contact:

Re: Emulator with debugger which updates screen on single step

Post 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.
Inactive account
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2640
Joined: Mon Nov 13, 2017 3:16 pm

Re: Emulator with debugger which updates screen on single step

Post 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.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2640
Joined: Mon Nov 13, 2017 3:16 pm

Re: Emulator with debugger which updates screen on single step

Post 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
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Ralf
Rick Dangerous
Posts: 2279
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: Emulator with debugger which updates screen on single step

Post 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 ;)
dfzx
Manic Miner
Posts: 673
Joined: Mon Nov 13, 2017 6:55 pm
Location: New Forest, UK
Contact:

Re: Emulator with debugger which updates screen on single step

Post 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.
Derek Fountain, author of the ZX Spectrum C Programmer's Getting Started Guide and various open source games, hardware and other projects, including an IF1 and ZX Microdrive emulator.
AndyC
Dynamite Dan
Posts: 1386
Joined: Mon Nov 13, 2017 5:12 am

Re: Emulator with debugger which updates screen on single step

Post 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.
User avatar
Woodster
Drutt
Posts: 47
Joined: Mon Nov 13, 2017 12:17 pm

Re: Emulator with debugger which updates screen on single step

Post 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.
Post Reply