> That took around 14 min 12 sec to plot.
OK. I need to find some time and test my eZ80's performance. (I thought the rule was, if you are old like me, you get lots of free time!)
> check to see if the FPGA is ready for the next command as the plotting froze after a few dozen pixels on the first line.
Yep - I am not sure what version of my C/ASM code you based this on - but yep - there is a status flag you need to test to confirm the previous command has completed. The FPGA implementation of the V9958, is faster than the real chip, but it still only running at 27Mhz - and various VDP commands can still require a few cycles to complete -- its further complicated by the need for the VDP to wait for access to the DRAM, to avoid contention when it's reading the memory for the HDMI output)
> Is there a way to expand (stretch?) the 512x212 image size of graphic mode 6 (or any of the other modes) so that the image output occupies the whole width and/or height of the panel (keeping the aspect ratio).
Thats a good question - simple answer no - but my extended screen modes are the way to get a full screen fill.
Let me try and explain the operation and challenge to achieve full screen fill. It can get a bit complicated.....
As HDMI only supports a fixed set of resolutions, with the lowest being 640x480, and given that highest resolution of a V9958 chip is 512x212, we will need some upscaling to be implemented.
To fully and accurately upscale 512x212 to one of the standard HDMI video modes, we needs a real fancy upscaler, like the RetroTINK. Those devices, have very fast and capable FPGAs and support circuits to do true partial pixel interpolated upscaling. The little Tang Nano FPGA cant really compete with that.
The first issue for the module, is its ability to generate HDMI signals in the first place. The HDMI video modes it can generate, are dependant on having an appropriate pixel-clock frequency. The Tang Nano is configured to use a 27Mhz signal for the pixel-clock.
If we look at the list of the HDMI video modes, that use a 27Mhz pixel clock - (ignoring modes requiring a higher clock - I dont think the FPGA could go much higher than 27Mhz), we can see that there are really only 2 modes that make sense -- one for 60Hz (480p) and one for 50Hz (576p).
The other challenge, is the rate of access to the DRAM of the module. If the FPGA logic is running at 27Mhz (and the onboard DRAM is overclocked a bit), we need 4 cycles to read/write a 32 bit word of memory. We need to read all of the bytes of the screen image at 50 or 60 times a second to keep up with the required HDMI data stream rate. We also need time to actually squeeze in some writes to the memory (as directed by commands from the CPU). Thus, to populate the full 720x576 pixels, can quickly become a bit of a performance challenge.
The upstream developers of the V9958 emulation, choose a simple pixel doubling technique - every line is repeated - and pixels widths are stretch proportionally if required. But any upscaling is pixel aligned - no partial pixel interpolation.
The original resolutions of the V9958, even when doubled, are still short of the HDMI resolutions - hence the borders around the image.
For my extended modes, I tried to utilise the full pixel area of the specific modes - eg 720x576 or 720x480, with different pixel doubling in the vertical and horizontal directions. Some modes are line doubled - halving the effective resolution, and some have their width doubles, halving the horizontal resolution. My modes are detailed here:
https://github.com/dinoboards/V9958-Super/blob/main/docs/vdp_super_res.md
But in all VDP graphics modes, the HDMI signal is still going to be mapped and output in HDMI mode 2 or 17.
Additionally, you will notice in the table above, modes 2 & 17 have equivalent modes for widescreen (3 & 18) - these are essentially the same modes (just different meta data in the header of the HDMI signal). I am not sure monitors will adjust appropriately - I think most monitors may have menu options to override the displayed aspect ratio.
I honestly cant remember where I left my mbrot c implementation at -- need to revisit it - and then confirm or adapt it to work in my extended modes -- will do that as soon as I find that free time I was promised!

Cheers
Dean