VDC Made Easy

Started by commodorejohn, September 19, 2008, 09:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

commodorejohn

At the request of someone on comp.sys.cbm and upon my own realization that there isn't much good VDC documentation out there, I aim to write a document that clearly explains how to use the VDC, since most of the existing documentation is heavily technical in nature. I've tried to explain things clearly, using my best approximation of the cheerily informal style featured in all those great '80s home-computer magazines (but especially Compute.) This is an early version, submitted for your perusal. Please tell me if I'm explaining things clearly enough.

Here is the document: http://john.seikdel.net/vdcmadeeasy01.htm

What I've got:
* Basic VDC register access, using the WRITEREG routine
* Documentation on text mode

What I need to do:
* Everything else, but especially bitmap graphics (coming next)

What I need:
* I need to either figure out how all the different screen-resizing registers work or have someone explain them to me.

Questions? Comments? Smart remarks?

BigDumbDinosaur

QuoteAt the request of someone on comp.sys.cbm and upon my own realization that there isn't much good VDC documentation out there, I aim to write a document that clearly explains how to use the VDC, since most of the existing documentation is heavily technical in nature.

The "heavily technical...nature" of VDC documentation is unavoidable.  It is, after all, a fairly complicated I/O chip.  Less you think the VDC is complicated, try boning up on the 16550 ACIA used in PC serial interfaces.  Even more interesting is something like the old NCR 53C90A SCSI ASIC or the Signetics SCC2698B octart (octal ACIA).

QuoteWhat I need to do:
* Everything else, but especially bitmap graphics (coming next)

Strangely enough, the VDC's bitmap mode is fairly easy to work with, unlike the VIC's.  In bitmap mode, image addressing is linear X,Y, with simple bit masking.  Of course, the need to indirectly control the VDC makes rapid bitmap manipulation difficult, but as BASIC 8 demonstrates, possible.

QuoteWhat I need:
* I need to either figure out how all the different screen-resizing registers work or have someone explain them to me.

Mapping the Commodore 128 actually explains the registers fairly well, but assumes (unavoidably) that the reader already has some hardware level assembly language expertise.  It's definitely a chicken and egg situation.

Incidentally, monkeying with the VDC from BASIC is a time-waster, in my opinion (true of controlling any I/O device, for that matter).  SYS is one of the slowest instructions in BASIC, especially on the C-128.  If you are serious about doing VDC programming you better fire up your assembler.
x86?  We ain't got no x86.  We don't need no stinking x86!

hydrophilic

Fantastic!  A few random observations.

I believe the VDC was designed to be register compatible with a popular CRT controller, that's why 16-bit values are big-endian format.  I think it was 6545 CRT.  According to Wikipedia, the MOS 6545 was actually made to be compatible with the Motorolla 6845 CRTC.  A register map is available here.  Note the 6845 has fewer registers, but the ones it does have map to the VDCs.  Also the 6845 and 6545 use the 2 address scheme (register/data) like the VDC.  I never owned anything with a 6545 so I'm quite amazed I know this!  Obviously I've spent too much time reading Commodore literature  :-[

On your example program for writing to VDC RAM, you end with REM about that's how you write to VDC RAM, but you never made a call to write to RAM... you only set the address register pair.  I'd add a line or two to actualy write register 31 for completeness.

Can't wait 'till you get to the screen dimension registers.  The two I'm not clear about is display enable begin and end... Also the vertical total adjust when in interlace mode.  I have my theories, but am anxious to see your description.

Anyway, keep it at.  I like it so far!

commodorejohn

Quote from: BigDumbDinosaurThe "heavily technical...nature" of VDC documentation is unavoidable.  It is, after all, a fairly complicated I/O chip.  Less you think the VDC is complicated, try boning up on the 16550 ACIA used in PC serial interfaces.  Even more interesting is something like the old NCR 53C90A SCSI ASIC or the Signetics SCC2698B octart (octal ACIA).
It is fairly complicated, but since the harder part in using it is figuring out the documentation, my aim here is to clearly explain things as I figure it out. I'm not trying to pile on the writers, I just want a document out there that makes things as clear as possible without the need for reading and re-reading to piece together the different aspects of the chip.

Quote from: BigDumbDinosaurStrangely enough, the VDC's bitmap mode is fairly easy to work with, unlike the VIC's.  In bitmap mode, image addressing is linear X,Y, with simple bit masking.  Of course, the need to indirectly control the VDC makes rapid bitmap manipulation difficult, but as BASIC 8 demonstrates, possible.
Yeah, bitmap mode itself is a piece o' pie compared to VIC bitmaps. It's more the necessity of resizing the screen in order to get in both the bitmap and attribute memory on a 16KB VDC that's confusing me, as the process for resizing the display area is freakin' complicated, and not very easy to deduce by experimentation. I have a general idea of how things are supposed to work, I think, but my attempts to verify my understanding on my 128 result in a bunch of crazy few-pixels-short-of-a-scanline snow. If you understand how to manage this, could you explain it or at least direct me to some sample code?

Quote from: BigDumbDinosaurIncidentally, monkeying with the VDC from BASIC is a time-waster, in my opinion (true of controlling any I/O device, for that matter).  SYS is one of the slowest instructions in BASIC, especially on the C-128.  If you are serious about doing VDC programming you better fire up your assembler.
Indeed it is, and I'm doing my tests via the monitor; I'm just including the BASIC examples because I know someone's going to ask for them (most likely that Harry Potter kid on comp.sys.cbm and comp.sys.apple2.)

Quote from: hydrophilicOn your example program for writing to VDC RAM, you end with REM about that's how you write to VDC RAM, but you never made a call to write to RAM... you only set the address register pair.
Good point. My main intent there was to show how to set the write address, since I'd already shown how to write to a register, but I'll toss that in for the sake of completion.

BigDumbDinosaur

QuoteI believe the VDC was designed to be register compatible with a popular CRT controller, that's why 16-bit values are big-endian format.  I think it was 6545 CRT.

Actually, it was the Motorola 6845 that was the ancestor of the 8563/8568.  The MOS 6545E was the model on which the VDC was based, the 6545 being a pin-compatible version of the 6845.  One thing the 8568 had that the 8563 didn't was an active-low interrupt line that was asserted when the "update ready" bit in the status register was set.
x86?  We ain't got no x86.  We don't need no stinking x86!

xlar54

Thanks BDD.. this is good stuff.  Copy and pasted to my little private CBM archive of stuff :)  Let us know when its updated!