mojo wrote:
I'm glad I'm not the only one who takes a little project on holiday with him!
I had an idea for a crazy video generator. Instead of bitmaps or tiles, run-length encode the display. It would be ideal for flat shaded 3D graphics like the Hard Drivin' era Atari stuff. Each scanline would be encoded as a series of colour+number_of_pixels pairs. Output code would just jump to the right place in a long strong of NOPs to create a row of pixels of the correct length. The only slightly tricky part is handling the end of the scanline, but you could do it with another interrupt that just changed the return address on the stack before returning.
Reminds me of C64 speed code. You could actually do it as self-modifying code if your MCU supports that.
Yeah, if I am not coding or laying down chips for at least an hour a day, I start to become sane, and that's not good!
Some like to watch TV to relax, other like to Design TV to relax!
Your RLE idea is a good one, and it does work well!
I did this in an ATtiny-45 once as the main driver, and in my current ATiny85 system, RLE is a storage option, with on-the-fly unpacking.
I use the following format... Start Position (8 Bits), Length (8 Bits), and Color (4+4 Bits).
Color only needs 4 Bits, so one Byte covers two lines worth for color.
This is great for packing solid shapes with minimal memory.
SpaceBalls Demo on an ATiny Processor anyone??
The Multimedia Converter I wrote for Vulcan also allows packing as RLE, with 1,2,3,4, and 8 bit palettes available.
I will post this program when it is more refined. It writes C or ASM data for any toolchain.
For those that want to mess around with bit-Banging VGA, here is a simple Timing Generator I wrote...
Download the Visual Basic EXE...
http://avrcade.com/temp/VGA.exeIt lets you alter the Pixel Clock for various standards to calculate Timing needed to keep close to the VGA Spec.
Default mode is the proper 25.175MHz Pixel Clock for the 640x480 @ 60Hz standard.
I plan to redo this program as well, and make it do a LOT more.
It was just a quick hack to show timings, so don't expect too much out of it!
The "RS" button Resets the timing to the proper spec for each standard.
The "HZ" button changes scan rate for some modes, but I plan to remove it, as 60Hz is all that is needed these days.
The "DV" numbers are what you get after dividing the clock. DV2 means your uC can set the address once every 2 cycles max.
For those just starting out in VGA signal generation, here is a legend...
Code:
HPX : Horizontal Active Pixels
HFP : Horizontal Front Porch
HSP : Horizontal Sync Pulse
HBP : Horizontal Back Porch
TOT : Horizontal Total Cycles
FRE : Horizontal Free Blanking Time
VPX : Vertical Active Lines
VFP : Vertical Front Porch
VSP : Vertical Sync Pulse
VBP : Vertical Back Porch
TOT : Vertical Total Lines
FRE : Horizontal Free Blanking Time
You can safely "fudge" the timings a bit by stealing and borrowing from the Porch area, but try to keep totals exact.
Older CRTs are more fussy, and newer LCD's can lock down as low as 53Hz sometimes.
I prefer to count every cycle and follow the standards exactly.
Cheers!
Radical Brad