Beta stage reached.
This can be usable object now. Please download and test it.
I leaved a high _clkfreq defined in spin file. Please, comment this out, and uncomment or add line with your clk frequency.
I have tested this at all these frequencies - 80, 100, 118 MHz
(I didn't test it @ 64 MHz but I think it will not work.)
2 cogs used
80x30 text, 8x16 font with semigraphic and redefinable character definitions
Individual color set for every 4 character group (20x30 color tiles)
Individual border color for every line
Color buffer in cog ram
Standard timed 800x600 @ 60Hz resolution at every clock speed (80..118 MHz tested)
640x480 text window with border
Text cursor with definable shape and blink rate. Cursor and blinking can be disabled
High level function set:
pub cursoron - switch cursor on
pub cursoroff - switch cursor off
pub setcursor(x,y,on) - set x,y position of cursor and switch it off/on
pub setcursorx(x) - set x position of cursor
pub setcursory(y) - set y position of cursor
pub setcursorxy(x,y) - set x and y position of cursor
pub setcursorshape(l1,l2,l3,l4) - define a cursor shape (16 bytes = 4 longs)
pub setblinkrate(rate) - Define a cursor blink rate (in 1/30th of second)
pub setscreencolors(fr,fg,fb,br,bg,bb) - Set font and back colors for all screen
pub setbordcolors(r,g,b) - Set border color for all screen
pub setfontcolor(line,pos,r,g,b) - set color for text at line (0..29) and position (0..19)
pub setbackcolor(line,pos,r,g,b) - set color for background at line (0..29) and position (0..19)
pub setbordcolor(line,r,g,b) - set border color for line (0..29, 30 and 31 - upper and lower border)r
pub outtextxy(x,y,text) - Output string at position x,y
pub putchar(x,y,charcode) - Output a character at position x,y
pub box(x1,y1,x2,y2) - Draw a semigraphic box at position x1,y1,x2,y2
pub write(text) - Output string at cursor position, set new cursor position at the end of string
pub writeln(text) - Output string at cursor position, set new cursor position at the beginning of new line
pub inttostr(j) - Convert integer to dec string, return a pointer to string
pub hextostr(j) - Convert integer to hex string, return a pointer to string
pub cls - Clear screen, filling it with spaces and not touching any colors, set cursor at 0,0
pub scrollup - Scrolls screen one line up
pub scrolldown - Scrolls screen one line down
pub defchr(code,b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,ba,bb,bc,bd,be,bf) - redefine a character
First alpha to test with some high level functions available to download. See end of this topic
Attached zip contains two versions of it:
- 2 cogs, for 80..100 MHz Propeller (you can use it over 100 MHz if your monitor can sync over 75 Hz)
- 1 cog for 100 or more MHz (you can use it @ 80 MHz if your monitor can sync @43
2 cogs version displays 800x600 @60
Hz (80 MHz Prop) or 75 Hz (100 MHz Prop) at standard 800x600@60 Hz timings
1 cog version works @ 53 Hz (100 MHz Prop) or 63 Hz (118 MHz Prop); timings are out of standards, but it was tested on 4 different monitors, 3 LCD and 1 CRT, all of them can display proper picture.
Please download and test
To do: cursor, and more high level functions (write, writeln, setcursor)
Planned in future: one color set for 8 characters, color buffer in cog instead of hub.
Edit: added 2 cogs version with proper header.
It is my first working attempt to write a vga driver. This is stil beginner's unoptimized code. Version 0.01 Alpha
I called it nostalgic, because it uses Atari ST mono font and it has a border.
You can change bacgkround color, font color and border color in realtime
You can attach any 128-chars 8x16 font definition. Simply replace a font definition file name in spin code. 8th bit is "reverse color" bit
It uses 800x600 resolution @ 50 Hz. Inside it, there is active display area, 672x480 pixels, 84x30 chars
This driver uses 2 cogs. First cog displays scanlines from 8-line long buffer. Second cog gets a charcodes from main buffer, gets bytes from font definition, then feeds the line buffer in real time.
Newest version here: All history below