holmatic / video_if_ql_vga

Video-to-VGA converter for Sinclair QL
GNU General Public License v3.0
25 stars 5 forks source link

No issue, but rather a question #4

Open SM7I opened 7 months ago

SM7I commented 7 months ago

What would be needed to change to make this suitable for ZX Spectrum 128k (toastrack) ?

SM7I commented 7 months ago

Hi, do you have the time to explain how to calculate the timing parameters ? I want to try this with ZX Spectrum 128K as well....

gusmanb commented 7 months ago

Hi, do you have the time to explain how to calculate the timing parameters ? I want to try this with ZX Spectrum 128K as well....

I doubt to be possible to adapt this to the 128k, the QL outputs digital RGB, basically the signal is ON/OFF, that's why it has such a low color palette, but the spectrum outputs analog RGB, it has different video levels per channel and thus it can achieve the 15 color palette. Maybe using two schmitt triggers per color channel you could translate the video levels to digital signals but is not a trivial task. Also the output of the device is an on/off for each RGB channel so you will need to modify it and create some form of 2 bit DAC for each channel to reconstruct the analog output.

SimonGreenaway commented 6 months ago

The code is 100% C so it would compile for a Spectrum. The sprites would have to be redesigned, and the sprite engine re-written. It would also be VERY slow!

SimonGreenaway commented 6 months ago

The timings are based on the FRAMES counter (50 increments per second) which the speccy has. Events (e.g. an invaders movemement) have a time in the future in which they are performed. A loop checks all the possible items and moves those with the timeout fired. It also counts how many timeouts may have been missed and uses that as a multiple for movemement. E.g. if moving the player base has missed 5 timeouts, the base is moved 5 increments. This produces a clunky movement, but at least the timing is correct compared to a faster QL.

gusmanb commented 6 months ago

This is totally unrelated to how graphics are generated but rather to the video signals, the device samples the RGB lines based on the ql video timmings to get the pixel values, writes the sampled value to a buffer and repeats until a frame is completed and then that buffer is sent to the VGA output.

The ql generates digital video levels, very close to what cga did and so the RGB lines sampling is digital, the spectrum on the other side outputs analog rgb so it must be sampled using ADCs which are a lot slower, or doing some circuit that translates the two possible analog levels of the lines to digital.