256x224 video driver
Dr_Acula
Posts: 5,484
These are some photos of experiments with a 256x224 color driver.
This is using a propeller and an external sram chip on pins 0-23 with a HC374 latch.
The code is using three cogs and most of the hub memory is used for a video buffer.
It ought to be possible to move all the 'object' code such as the serial driver into the 'main' program and then put the cog code into the hub buffer. If this technique works then there would be enough room for code in all 8 cogs, including code to do things like "draw a line", "draw a box", "draw a button".
Code is in the second post - there is the propeller code and also the vb.net code to do the Floyd-Steinberg dithering and download the pictures via the serial port.
This is using a propeller and an external sram chip on pins 0-23 with a HC374 latch.
The code is using three cogs and most of the hub memory is used for a video buffer.
It ought to be possible to move all the 'object' code such as the serial driver into the 'main' program and then put the cog code into the hub buffer. If this technique works then there would be enough room for code in all 8 cogs, including code to do things like "draw a line", "draw a box", "draw a button".
Code is in the second post - there is the propeller code and also the vb.net code to do the Floyd-Steinberg dithering and download the pictures via the serial port.
Comments
I just got dithering working for my PTP2 image processing utility...
I'll try to add TV and VGA palettes to it today...
I'll tell you one trick I just learned... I call it "self-indexed" bitmaps. Basically, I create 8bpp Windows Bitmaps
where each byte of index data equals the actual 8 (or 6) bits we want to output on Prop pins.
This way, you can use actual Windows Bitmaps directly as image data files without any conversion required.
These self-indexed bitmaps can then be viewed both on a PC and a Prop board...
The ratios are slightly different than 16:9 (and 4:3) and have been determined by drawing circles and measuring them on the real screen.
Next step is moving sprites around on the screen.
1) Send a line of pixels
2) Capture a block of pixels and store to ram
3) Restore a block of pixels from ram to the screen
For instance, you can send all the letters of the alphabet in whatever font and capture these with little sprite blocks, then redraw those in any order to write text.
Or, capture a "checked" checkbox and an unchecked one, and print which ever one is relevant.
The control instructions become something that can be written in any language you like - C, Spin, Basic. Eg, this is the control instruction to click on a button. Store two images of the button - the normal one, and the 'pushed' one (which happens to be the normal one rotated 180 degrees). Each instruction is 8 bytes and then you can add a comment byte. CSV file. Bytes are 1=write/2=read then origin_x, origin_y, sizex, sizey, block (7 to 127), ram high byte and ram low byte.
Blocks of memory are 4096 long. The first 7 blocks are used by the ram buffer but the rest are free.
Attached is the spin program. Hardware is a propeller, 512k memory chip and a HC374 latch.
Then the GUI text box can retrieve these in any order and make up the text. I'm hoping to get around 64 sprites moved during the blanking period at the end of each screen. 30 frames a second = 1800 characters a second. Hopefully fast enough for a text editor. Scrolling should be faster because the sprite can be a line rather than a character.
Can we pull data out of a ram fast enough to bypass the hub?
I've been looking at the 74F series (F for Fast), eg the 74F161 counters. Put two in series and preload some latches for A8 to A18 on the ram and drive A0-A7 with the counter. Then clock 256 bytes in from the ram.
This is the current video loop:
Replace the rdlong with an ina
Relace the add with a pin going high to clock the counter
Replace the phaseflip with that pin going low
The ram /rd is held low through the entire 256 bytes so no toggling of the /rd or /wr or /cs pins on the ram.
And the ram outputs have time to settle while the waitvid happens.
Time to rejig the breadboard. And even if this doesn't work, it might find a use as a fast cache driver.