80 column VGA text driver in one cog - 60/48/40/32/30/24/20...rows! (beta test)
Bill Henning
Posts: 6,445
80 column VGA text driver in one cog - 60/48/40/32/30/24/20...rows! (beta test)
This is the third driver in my high resolution, single cog flexible VGA text driver series.
MikronautsVGA80 - 80 column driver, requires 6.25MHz crystal for 100MHz prop clock speed
(It would also work at 150MHz)
As far as a monitor is concerned, it is VESA 640x480 60Hz timing.
(runs at 25MHz dot clock instead of 25.175, but that is within the tolerance of monitors)
I added VGA_Text like methods, so it should be a drop in replacement (except for palette handling).
The archive contains five fonts, and the number of times each scan line is displayed can be set in the driver, so this one driver provides the following text modes:
80x60, 80x48, 80x40, 80x32, 80x30, 80x24, 80x20
80x16, 80x15, 80x12, 80x10, 80x8, 80x6, 80x5
It is a regular "text mode" driver, and as such, uses one byte per character in the screen buffer.
The first 128 characters contain 32 graphic elements, then 96 ASCII characters, and the second 128 characters normally contain the inverse of the first 128 characters. The font is interleaved - this was the only way I could get the driver to work fast enough to get 50 columns!
Currently the horizontal timing is configured as:
hf = 16 'horizontal front porch pixels org 40
hs = 48 'horizontal sync pixels
hb = 96 'horizontal back porch pixels
because that works better with my test monitor.
The "official" VESA timing would be:
hf = 16 'horizontal front porch pixels org 40
hs = 96 'horizontal sync pixels
hb = 48 'horizontal back porch pixels
so if the default timing has issues with your monitor, try the official timing.
You may need to tweak hf/hs/hb to get the driver to work with your monitor.
I am MIT licensing the driver. Please don't change the file names so at least I get some exposure out of it
UPDATE:
I got kuroneko's patch integrated and working, it should now work without sync issues (famous last words, it is possible some monitors won't like the 59Hz refresh instead of 60Hz)
This is the third driver in my high resolution, single cog flexible VGA text driver series.
MikronautsVGA80 - 80 column driver, requires 6.25MHz crystal for 100MHz prop clock speed
(It would also work at 150MHz)
As far as a monitor is concerned, it is VESA 640x480 60Hz timing.
(runs at 25MHz dot clock instead of 25.175, but that is within the tolerance of monitors)
I added VGA_Text like methods, so it should be a drop in replacement (except for palette handling).
The archive contains five fonts, and the number of times each scan line is displayed can be set in the driver, so this one driver provides the following text modes:
80x60, 80x48, 80x40, 80x32, 80x30, 80x24, 80x20
80x16, 80x15, 80x12, 80x10, 80x8, 80x6, 80x5
It is a regular "text mode" driver, and as such, uses one byte per character in the screen buffer.
The first 128 characters contain 32 graphic elements, then 96 ASCII characters, and the second 128 characters normally contain the inverse of the first 128 characters. The font is interleaved - this was the only way I could get the driver to work fast enough to get 50 columns!
Currently the horizontal timing is configured as:
hf = 16 'horizontal front porch pixels org 40
hs = 48 'horizontal sync pixels
hb = 96 'horizontal back porch pixels
because that works better with my test monitor.
The "official" VESA timing would be:
hf = 16 'horizontal front porch pixels org 40
hs = 96 'horizontal sync pixels
hb = 48 'horizontal back porch pixels
so if the default timing has issues with your monitor, try the official timing.
You may need to tweak hf/hs/hb to get the driver to work with your monitor.
I am MIT licensing the driver. Please don't change the file names so at least I get some exposure out of it
UPDATE:
I got kuroneko's patch integrated and working, it should now work without sync issues (famous last words, it is possible some monitors won't like the 59Hz refresh instead of 60Hz)
Comments
The version above, with frequent sync problems still works for me most of the time
The version with kuroneko's fix does not sync for me yet - no idea why.
I am working on it (now that I've sent all the PCB's for UPEW off to production)
I will keep updating this thread with my progress.
BTW I didn't know there was a process of "MIT licensing", I just thought you pasted the license at the foot of your code. Shows what I know...
The process is... sticking the license at the end, and saying "MIT licensed" on top, so you were basically correct
Don't be too surprised if it does not work for you yet, but I am sure that it will be fixed soon.
Kuroneko's patch integrated, and now working with the 80 column driver!!!!!!!!!!!!!!!!!!!!
New archive uploaded to the first post.
Microcontrolled, this one should work for you :-)
Kind Regards
ApteryxOz
Thanks,
Microcontrolled
After activating it it does work.
Andy
Not knowing a thing about this VGA stuff, why can't the VGA80 be run at 5MHz crystal? I am not trying to insult anybody, but just curious.
Ray
I must have an incredibly forgiving monitor!
The whole reason I built the one cog drivers was to free up a cog. Part of my future "Save A Cog Foundation" (LOL)
A 6Mhz crystal will work as long as your monitor can sync to a 57.2Hz Vsync.
Just try it - if you are lucky, your LCD monitor will sync to it - however it is more likely that it won't.
Your C3 should be able to run it fine with a 6.25MHz crystal, with the latest patches - but don't forget to do:
dira[15]~~
outa[15]~
before vga.start, otherwise it cannot work.
There is simply not enough hub bandwidth with a single cog to refresh the 640x480 VGA video at 60Hz with a single cog with a 5Mhz crystal - which is why Chip's drivers take two cogs. (well, I did figure out one theoretical way, but it needs the font to be kept in the cog, and cannot have graphics characters that touch ie vertical lines, I have not tested that driver yet)
My drivers were meant to sync waitvid's to the hub cycle, which allows 640x480 @ 60Hz with my font table trick. The initial versions only synced some of the time, but kuroneko was kind enough to figure out and provide a patch that gave hard synced the VGA pixel clock to the hub cycles.
ALL:
I've updated the archive in post#1, includes the line with the corrected calculation as per kuroneko's post
I was trying to get VGA80 demo running on my TriBlade which happens to have a 6.5536MHz XTAL. installed. Is this likely to work?
Also can we verify the pinout. The TriBlade has VGA pins from P8 upwards.
So far there is no sign of output on my LCD monitor.
It should work with your 6.5536MHz xtal's, but will refresh at higher than 59Hz... you may need to play with the front/back/sync horiz/vert timings. A quick and dirty test is lie to the driver, run it configured for 6.25MHz, and it should display at roughly 62Hz, most monitors should sync to it.
It should be easy to switch to work off P8-P15; just change the VCFG initializations; it is configured for P16-P23
Thanks... good info.
I have not looked at it so long I forgot I used basepin
Now that I have Obex access again (Thanks Matt!) I'll post it there soon.
There is not enough hub bandwidth.
I might be able to do it with two cogs... or if I go back to my original ugly hack design that required at least one blank scan line between each character row - which makes vertical graphics lines, boxes, text-gui etc ugly. If there was about twice as much cog ram, I could do it as there is another hack that wastes memory... but not in 496 longs.