Close

CRTC Finished; First Pixels Displayed

A project log for VDC-II

Commodore 8568-inspired (and mostly compatible) video core for driving VGA-type displays.

samuel-a-falvo-iiSamuel A. Falvo II 04/26/2020 at 16:410 Comments

Treating the VDC as a superset of the 6545 CRTC chip has finally allowed me to complete both the horizontal and the vertical sync generators.  Additionally, both generators use the same subcircuit description.  You can see how I configure two instances of the SyncGen class to work together in the VDC module file.

After getting the sync generators working and bug-fixed, I was able to hook the RGBI outputs to various internal signals to see what is happening.  It was at this time that I wired up my first resistive DAC as well.

First, I hooked the RGBI outputs up to the vertical sync generator's character counter, to display horizontal color bars.  At first, the colors were distorted; I thought that my resistor values were off (I just grabbed the closest values I could find to the ideal resistors).  But, after fixing the hardware description to account for the display-enable signal, the colors fixed up nicely.  Lesson learned: even though an LCD doesn't sling electrons at a phosphor like a CRT, you still need to blank the outputs so that the monitor has a proper black reference level.

(without blanking the video)

(with blanking the video)

For funsies, I then rewired the RGBI outputs to show the horizontal character counter next.

Finally, I decided to show the "character matrix" of the VDC output by tieing the red signal to the HSYNC generator's xclken output, and green to VSYNC's xclken output.  The playfield will be illustrated by driving the intensity output.  This results in a nice graph paper-like effect and it visually shows how several of the VDC registers interact.  It's really neat to play with!

(80x30, using 16-pixel tall characters)

(80x60, using 8-pixel tall characters)

Sharp-eyed viewers might notice one final bug that needs squashing: notice the top row of characters is elongated?  That's because the vertical total adjust circuitry does not negate the display-enable signal while operating.  This is a very simple fix to implement.

BASIC Program to Initialize the CRTC

This program initializes the VDC's CRTC registers to produce an 80x30 character matrix display.

10 DATA 10
200 DATA 0,99
201 DATA 1,80
202 DATA 2,82
203 DATA 3,&h2C
204 DATA 4,31
205 DATA 5,13
206 DATA 6,30
207 DATA 7,31
209 DATA 9,15
222 DATA 22,&h78
1000 READ N
1100 FOR I=1 TO N
1200 PRINT I
1300 READ R,V
1400 OUT &H6E,R
1500 OUT &H6F,V
1600 NEXT I

 To produce an 80x60 display, change these lines:

204 DATA 4,64
205 DATA 5,5
206 DATA 6,60
207 DATA 7,61
209 DATA 9,7

So, what of things like horizontal and vertical smooth scrolling?

Sorry to say; but, these features will need to be considered at a later time.  Evidence now shows that Commodore engineers implemented these features outside the CRTC logic, so I'll have to also figure out how to do the same.

What's Next?

Right now, I think my next step is to implement the 16KB of memory needed to hold a character matrix or bitmap display, so that I can use that to start slinging pixels onto the display.  This means I'll need to implement the infamous "busy" flag, along with registers R18, R19, and R31.

Discussions