6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Mon Apr 29, 2024 12:06 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Jun 01, 2021 3:59 am 
Offline

Joined: Wed Jun 17, 2020 10:51 am
Posts: 60
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
vga_text_counter.jpg [ 36.38 KiB | Viewed 379 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

_________________
No simulation survives contact with reality!


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 03, 2021 6:48 pm 
Offline

Joined: Wed Feb 12, 2014 1:39 am
Posts: 172
Location: Sweden
That sounds pretty much the same as how I did things, there are schematics and my horrible code here for reference: https://github.com/LIV2/VGA-6502


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Yuri and 26 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: