Home |
Projects | SoftVGA
SoftVGA - AVR based Software-only VGA Display Generator
Project Basics
Project Status
Hardware Description
Code Download
Auxillary Documents
Photos of the Project
Other Websites of Interest
Project Basics
This project is aimed at generating an VGA monitor (basic 31.5kHz
horizontal, 70Hz/400line or 60Hz/480line vertical) compatible video
signal, without using an specialised hardware VLSI video generator chip
(hardwired limited, not available any more), nor 100s of TTL chips (lots
of space and soldering), nor an CPLD or FPGA chip (awfull software tools,
no bitfile docs for making usable ones). All is done in software, running
as vertical "microcode" on an single Atmel AVR microcontroller chip
(currently an ATmega32, 16MHz, 32k Flash, 2k SRAM, 40pin, 32IOs). The small
amount of external analog-only hardware consists of only 6 resistors which
(together with the 75ohm input resistance of the monitor) make 3 2bit DACs
for converting 6 bits of PIO port 5V digital TTL output to 3 0.7V analog
video signals for the VGA monitor. Also further 2 bits of PIO are used for
the sync signals. And it obviously also requires an VGA HD15 connector.
Target is to make an pixture that is good enough for an late 1970s or early
1980s home computer or game console. That requires an at least 32x16 and
preferable 40x25 (Apple II, Commodore PET or C64, Atari 800) text output,
suitable for an machine code monitor or Basic interpreter, and at least
low resolution colour graphics (bitmap or character cell) suitable for
standard genre defining games such as Pong, Breakout, car race, Space
Invaders, Pacman, Frogger, and similar classics.
For more info on this project read the README file.
For some questions people have asked or may ask read the FAQ
list.
Project Status
For the full details of done/doing/todo of the project best read the
Logfile. A short excerpt from it is here:
Done are:
Current (= development, = may be fantastic, may be broken):
- Built an STK200 compatible PC parallel port flashing device
- Build an 3-wire RS232 based extension to above, for debugging
- Built an generic 40pin analog pinout AVR prototyping board
- Built an PIO to VGA adaptor, including 3 2bit DACs
- Wrote m32def.inc to define ATmega32 resources, ports and bits
- Wrote blink_test.asm, blinks TxD on RS232 extension
- Wrote vga_static.asm, static pattern test picture generator
- Evolve software until it can generate live-action text
- Wrote various demos to show off that it is dynamically generated
- Switched to indirect thread drawing, font of indexes, save Flash
- Switched to using font indexes in SRAM, allows soft font
Todo are:
- Write terminal style RS232 to frame buffer processing
Hardware Description
Unfortunately there exists no real hardware documentation. Here I have
collected the best info that exists:
Code Download
Current (= development, = may be fantastic, may be broken):
-
Installation Guide
- entire project:
SoftVGA.tar.gz (without large Photo files)
- single files:
-
Makefile, control processing
-
avr_registers.inc, define my AVR register usage and naming
-
m32def.inc, define ATmega32 resources, memories, ports, bits
-
blink_test/, AVR test program, blink RS232 TxD, debug IF LED
-
vga_static/, static pattern test picture generator
-
vga_text_static/, static text screen generator
-
vga_threaded/, threaded text screen generator
-
vga_indirect/, space saving table indirect font jumping
Auxillary Documents
These are files I made while investigating various aspects of VGA:
- Older font with 3x5 pixel
characters (no underlines), fits in 4x8 character cells. Base for
selecting 8 linepairs of 4 pixels display format
- Newer font with 3x6
pixel characters (3x7 with underlines), fits in 4x8 character cells.
Base for selecting 8 linepairs of 4 pixels display format. In meantime
improved by feedback from seeing them running in this project
- Signals and timing data for various
video standards. Also what various types of monitor will require. Base
for selecting VGA as target monitor
- What sort of abilities an
controller needs to fullfill for this project to work on it
- Looked at a selection of
various microcontrollers, features, speed, pinouts, etc. Base for
selecting the AVR family
- Colour range
generateable by various bit-sizes and types of DACs. Base for selecting
6bit (3 times 2bit) DAC for 64 colours. In meantime improved with
detailed 8bit, RGB 3+3+2bit (awfull grays) and 3*3 G+B merged LSB (more
colours and no downside), of which I may switch to the later
- Detailed analysis of VGA timing
and various algorithms for drawing text fast enough, while fitting in
AVR Flash and SRAM memory
- VCFe 10
(2009) lecture script. Theme of this VCFe was computer architectures.
I presented SoftVGA (and generally using AVRs for emulation) as
architecture for implementing small and cheap own design systems, as
fourth alternative to lots of TTL logic or expensive ASICes or
difficult FPGAs (in german)
Photos of the Project
These are photos (and some videos) I made while working on the project:
- The first vga_static display. Near
correct, but colours green/cyan/red/magenta are wrong. This was due to
solder bridge between red bit 0 and green bit 0
- The first fully correct vga_static
display, after solder bridge was removed
- The second revision vga_static display,
after adding second drawing routine (SHLINE) was added, which uses all
64 possible colours
- The first run vga_text_static display,
show 25 rows of 10 times repeat of 4 characters, 1 shifted, but only
lines 0,1,2,4,6 of 0..7 drawn, and horizontal timing trouble
- The second run vga_text_static display,
missing lines control flow, and horizontal timing fixed
- The third run vga_text_static display,
entire line-in-row algorithm replaced, no unroll, all 16 lines
- The fourth run vga_text_static display,
at long last entirely correct timing, no frayed out lines
- Reworked vga_text_static display,
new loop subroutines, sync timing problem and orange "comb"
- Extended vga_text_static display,
added support for row specific colours, here cyan to white
- Extended vga_text_static font,
added support for old style TTY 64 ASCII chars 32 to 95
- More extended vga_text_static font,
added support for rest of ASCII chars 96 to 126, 127 as point
- X/Y based vga_text_static display,
misscomputation of +XYCOL, overwrites abort pseudo-chars
- X/Y based vga_text_static display,
allowing far more expressive demo, real text and colours
- Colour exchanges vga_text_static
display, allowing even more expressive demo with effects
- 2x2pixel block graphics vga_threaded
display, allowing low-res bitmaps, such as an SoftVGA logo
- state machine graphics vga_threaded
display, misscomputation of row/segment/line counting
- video, animated vga_threaded display,
colour rotate, video snail, lissajou ASCII+block graphics ball
- video, animated vga_threaded display,
colour rotate, snail, lissajou hollow ball, cursor in announce
- scrambled YH:YL vga_indirect display,
changed XH:XL and ,X+ to YH:YL and ,Y+ but specials still ,X+
- first non-scrambled vga_indirect
display, font mess, all characters shifted by one character
- working indirect jumped vga_indirect
display, only 30char/row because lpm needs 3*(3+1)clocks/char
- graphic char demo vga_indirect display,
frame-round ball, frame-square frame, block cursor (text uC)
- SRAM indirect vga_indirect display,
frame buffer and demo reduced to 36x23char screen size
- SRAM indirect vga_indirect display,
invert/underline at mid-space, 3 foregr and 2 backgr colours
- video, animated vga_indirect display,
colour rot, snail, framed round linedraw ball, announce cursor
- video, animated vga_indirect display,
colour rot, snail, real circle ball, cursor, square font digit
Other Websites of Interest
These sites all contributed some input to this project:
- Rickard Gunee PIC
B&W and SX NTSC video, original inspiration for this
- The
xgamestation, an commercial system similar to Gunees SX NTSC
- Minimal B&W 8pin
PIC12 for Pong, even with Paddles, not joystick
-
Robert Greene attempts PIC VGA video and its difficult fast timing, has
space problems because using bitmap representation, 64x44x4bpp
-
Atmel AVR Chips, model overview and data sheets
-
Atmel AVR instruction set documentation
-
AVR Assembler User Guide
-
STK200 Parallel Port Starter Kit User Guide
-
STK500 Serial Port Starter Kit User Guide
-
STK500 Serial Port Starter Kit Hardware
- STK200
compatible parport programming adaptor, one of various
descriptions (in german)
- STK200 compatible
parport programming adaptor, a slightly differing description
(in german)
-
R.G. Keen electronic building technique without etching boards
- VCFe (Vintage Computer Festival europe),
where I got the last push to start this project in earnest
-
AVR-ChipBasic2 AVR SCART RGB video, text mode 30x23 cells, and Basic
interpreter. The project at VCFe that gave me that last push
Home |
Projects | SoftVGA
This page is by Neil Franklin, last modification 2010.10.17