Hayling Island

Hayling Island

Tuesday, November 12, 2013

Text mode VGA+

Just in case anyone is interested, I developed a text-mode VGA controller for the modular synth. I decided that I wanted some way of displaying activity on the midi to cv interface, and a way of controlling any other groovy things I plugged in. I had a 12 inch IBM monitor from a retail POS. It seems capable of running at 800 x 600 60Hz, which is a dot rate of about 40MHz.

I bought a logic analyser from Seeed Studios - Jack Gasset's Open Logic Sniffer, and for some reason I had decided to buy two. So, I had an FPGA development board, kind of. It uses a Xilinx Spartan-3 xc3s250e-4vq100 chip, which has plenty of capability.

By the by, OLS makes an excellent logic analyser. I bought it to fix an HP1630G logic analyser with .. that had a dead CRT, and the cheapest CRT I could find was 150 Euro for this peculiar vertically scanning beast. So I decided to knock up a converter in a CPLD to take the twisted old signals from the scope, convert it into VGA form and drive an LCD. I found some fast cache memory from an old motherboard for the RAM, and I was well into it. However, I came across a nasty timing issue, and decided to buy an OLS to help me find it. Of course the OLS has far more capabilities than the HP1630G, so my enthusiasm for fixing noisy, huge old HP engine faded slightly. 

I started by designing a Johnson Ring - old school to the core. I drove that with a DCM, and fed that into a brief emulation of a 6845 CRTC; really just a bunch of counters with pre-determined reset points. I found a base ROM font from the internet, and downloaded that into one of the RAM blocks.

// ROM with synchonous read (inferring Block RAM)
// character ROM
//  - 8-by-16 (8-by-2^4) font
//  - 128 (2^7) characters
//  - ROM size: 512-by-8 (2^11-by-8) bits
//              16K bits: 1 BRAM

I used four of the other blocks for a large character memory and an attribute memory - so each text position on the screen has a byte for a character code, and another for how the character should be displayed. Four bits for the colour, one bit each for reverse video, underscore and column separator (Ah, can't forget that wonderful little addition from the 5250 - very useful for continuous underscore) and one bit for a 'big character' using four character cells on even boundaries.
800 x 600 works out at 88 columns by 37 rows plus a bit of spacing.

I knocked up a colour serialiser which feeds two bits per colour going out, and I knocked up a quick buffered wing that has a 15-pin connector on it. After a bit of hacking of Verilog - my first time out for any serious stuff - it works.

Next steps are to add a bus controller on it, and some way of feeding data in to it. Since it really is for text mode, I can use something simple like USB 2.0 ... or even serial to be honest. I'll only be driving it from an AVR.


No comments:

Post a Comment