While waiting for PCB and parts I started to think about the next stage of my VGA card - a pure text mode. I'd like 80*25 characters, which fits nicely into 2k of memory. I'm thinking of using a 4k dual port ram - 2k for characters and 2k for color information. But there is a catch - if I put 2000 characters in a continuous memory space - how can I map that into the 640x400 VGA screen?
Math quickly tells me that I'm going to need 8x19 pixel per cell, accounting for space between characters that means something like an 8x16 font. That's the easy part. But somehow I need to generate an 11bit address from VGA data pointing to the dual port memory. As I did not find anything in my googling around I came up with this scheme on my own:
Attachment:
vga_text_counter.jpg [ 36.38 KiB | Viewed 495 times ]
On VSYNC the whole system is reset, all counters go to zero as well as the register.
The 25 MHz pixel clock feeds into a 4 bit counter "Row Counter A" going from 0 to 7. This essentially converts each line into 80 "characters" with one pixel height. "Row counter B" keeps track of the characters and is incremented in sync with "Counter Ram". Both counters load the start value on HSYNC. But while "Row Counter A" and "Row Counter B" always start from 0, "Counter Ram" get's it's start value from a (12 bit) "Register".
A fourth counter keeps tracks of the lines (up to 16 lines per character). Whenever we are at the last pixel line for each line of characters displayed, AND the character counter "Row Counter B" hits 80, the current value of "Counter Ram" is copied to the "Register".
On the next pixel line we are also on the next character line, but "Counter Ram" now has an updated base address pointing to the next row in the character ram.
any comments appreciated, especially if someone knows a better scheme
thanks
Michael