Commodore 128 Alive!

Commodore 128 => 128 programmers => VDC Programming => Topic started by: MIRKOSOFT on November 02, 2010, 10:08 AM

Title: How to activate GRAPHIC mode for VDC?
Post by: MIRKOSOFT on November 02, 2010, 10:08 AM
Hi!


I want to programming graphics in 80 columns mode (VDC).
I have VDC8568 chip with 64kB RAM.
I want to use standard resolution 640x200, but with most of colors in one 8*8 cell.
Can anybody explain me how to set graphic mode of VDC with best color possibilities in resolution 640x200 in assembler?
Also: where to store bitmap and where color attributes...


Many thanks for every reply.


Miro
Title: Re: How to activate GRAPHIC mode for VDC?
Post by: saehn on November 03, 2010, 02:19 AM
If I were you, I'd stick with the BASIC 8 package:

http://en.wikipedia.org/wiki/BASIC_8 (http://en.wikipedia.org/wiki/BASIC_8)
http://project64.c64.org/misc/basic8.txt (http://project64.c64.org/misc/basic8.txt)

But if you want to do it "by hand", here's some info:
http://commodore64.wikispaces.com/Simple+Hires+Line+Drawing+Package+for+the+C-128+80-Column+Screen (http://commodore64.wikispaces.com/Simple+Hires+Line+Drawing+Package+for+the+C-128+80-Column+Screen)
Title: Re: How to activate GRAPHIC mode for VDC?
Post by: MIRKOSOFT on November 03, 2010, 02:29 AM
Many thanks!


But I want to really programming graphics on VDC without external additions like BASIC8, this I know also have internal EPROM, but don't want to use.


I need independent code....
Title: Re: How to activate GRAPHIC mode for VDC?
Post by: BigDumbDinosaur on November 03, 2010, 09:43 AM
Quote from: MIRKOSOFT on November 03, 2010, 02:29 AM
Many thanks!


But I want to really programming graphics on VDC without external additions like BASIC8, this I know also have internal EPROM, but don't want to use.


I need independent code....
Then start typing!  Everything that you need to know to drive the VDC in hires mode is available online, much of it right here.  Geesh!
Title: Re: How to activate GRAPHIC mode for VDC?
Post by: Hydrophilic on November 04, 2010, 06:33 PM
Set bit 7 of register 25 to enable bitmap mode.  I know you said you have 64k VRAM, but for anyone with 16k VRAM, you also need to disable color(attributes).  Do this by clearing bit 6 of register 25.  Register 25 is pretty important, huh?

With 64k VRAM, you should put your bitmap above the standard text screen and font to avoid re-loading the text/font data after exiting bitmap mode.  Because the standard location for text/font data is below $4000, I suggest putting the color at $4800 and the bitmap at $8000.  For anyone with 16k VRAM, you have to put the bitmap at $0000.

Set the color(attributes) address via registers 20 (adrs high) and 21 (adrs low).

Set the bitmap address via register 28.  The high 3 bits specifiy the address high byte.  It's kind of confusing to explain in words, so...

;assumes bank 15
bmadrs = $8000
ldx #28
jsr $cdda ;read register
and #$1f ;clear high 3 bits
ora #$e0 & >bmadrs
jsr $cdcc ;write register


That should get you started.  I recommend reading the C128 Programmer's Reference Guide, in particular pages 314 to 318 which explain VDC bitmap mode and include an ML program example.
EhPortal 1.34 © 2025, WebDev