barnacle wrote:
Ah, I never got that far... I was generating a base non-interlaced pal with 1us per cell, so probably 256 vertical lines and 52 character cells across. Just enough time to read a byte from video ram, index into the character set, and output it. And as you say, little time for anything else.
I do recall that to avoid timing jitter, I put the processor to sleep at the end of each active line so it could wake up exactly to start the next sync. That was the only way to guarantee the timing; so the thing spent all its time either asleep or servicing the timer interrupt.
Neil
My strategy was to generate an interrupt every 64µS then use that 64µS to time each line. SPI clock being 8Mhz. This seemed to fit well with PAL timing - I had 64 byte times of horizontal time, so I could make up the line with the front/sync/back porch outputs then a potentially elongated back porch for picture left/right adjustment then the 40 bytes (320 bits/pixels) of data.
The more left the picture is, the more time at the end of each 64µS pulse for user programs to run.
That's then the end of the 64µS interrupt and the time left until the next one is left to the user program.
There is a line counter for each frame too for vSync and adjusting the image up/down within reason. vSync time is the biggest chunk of 'free' time for the user program to run - the interrupt is still taken but it can exit early when it's doing vsync. (or dummy lines top & bottom to make up your 312.5 lines)
My code was 100% C - looking back at it now, I can see where I might optimise it if I went to assembler but it's more or less locked into that 64µS window.
It worked very well and I was quite pleased with it, but as my 6502 project advanced I wasn't too happy with the lack of speed so decoded to go for a plan B.
A couple of videos I made of it:
https://www.youtube.com/watch?v=1Iv-bDmkW2Mhttps://www.youtube.com/watch?v=09zhGUbVxdUCheers,
-Gordon
_________________
--
Gordon Henderson.
See my
Ruby 6502 and 65816 SBC projects here:
https://projects.drogon.net/ruby/