I’ve been working on several areas on Y Ddraig the last couple of months and I have been making some good progress. I’ll be posting some updates on some of the areas of the project that I’ve been working on over the next few weeks. For now, I will be focusing on the changes I’ve made to the VGA card.
I’ve previously posted a little bit of information of the VGA card when getting the VGA output working and then testing the CPU interface and the onboard RAM. While these tests were useful in the fact they demonstrated that the hardware itself was working, it didn’t really show that this was going to be a viable solution. There’s been some slow progress since then. One of the big issues I faced involved RAM access timings that caused glitches to show up constantly when writing anything to the video RAM. The issue has now been solved and I think the video card is in a state where I can show what it’s currently capable of.
Now that I’m happy that the concept is working, I think it’s time to share a bit more of the details of the video card.
The FPGA used is a Xilinx Spartan-6, more specifically the XC6SLX9-2TQG144C which was chosen as it was available in a 144 pin QFP package so I could avoid having to go down the BGA route. It has 9152 logic elements and 576kbit of memory. 576kbit is insufficient for a decent video buffer so a IS61WV102416FBLL SRAM is added which is a 1 M x 16 device giving a total of 2MB of Video RAM. It has a 10ns access time so it’s running at 100Mhz. The VGA video output is done through 12-bit (4-4-4) resistor DAC to provide the VGA output.
Here is a brief summary of the current features:
- 80x30 text mode
- 640x480@60Hz – 4096 color mode
- Hardware acceleration
- Line drawing
- Filled rectangles
- Bitmap mode with text overlay
The text mode is using an 8x16 pixel font to give the 80x30 character display. When in bitmap with text overlay mode, the text window can be set to display text in specific areas of the screen rather than full screen.
While it’s possible to write data directly to the Video RAM in 128K pages, control of the card is mainly done through the registers. All the registers are 16-bit wide. Here are the currently available registers and commands. These are preliminary values and liable to change.
|0x04||Interrupt Control (currently unused)|
|0x0A||Command Parameter 0|
|0x0C||Command Parameter 1|
|0x0E||Command Parameter 2|
|0x10||Command Parameter 3|
|0x12||Command Parameter 4|
|0x14||Command Parameter 5|
|0x16||Command Parameter 6|
|0x18||Command Parameter 7|
|0x0002||Draw Filled Rectangle|
|0x0010||Set Text Character|
|0x0011||Set Text Color|
|0x0012||Set Text Area|
|0x0020||Set Memory Access Address|
The Status Register currently only returns the ready status of the drawing functions and the Vertical Blank status, and the Control Register is only used to select the current video mode.
The Command Register will execute the specified command and works in tandem with the Parameter registers. For example, to draw a pixel on screen the Color is written to Param0, X coordinate to Param1 and Y coordinate to Param2. When the draw pixel command is written to the Command register it will use those values to draw the pixel on screen.
The Data Register is currently only used with the Set Memory command. A memory address in the Video RAM and the CPU can use the Data Register to read/write the contents of RAM. The address pointer is auto incremented so it doesn’t have to be updated for every access. This will be the method for updating Palette data and others.
Next step now will be to add some new features. While initially I had planned on a lot of different bitmap video modes, for now I will mainly focus on a cut down list. The current plan is to have a 640x480 and a 320x240 mode in both 12-bit and 8-bit color. More hardware acceleration features are planned such as a blitter mode and hardware sprites.
More updates to follow…