Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Sprites at $d800 ?
2008-12-02 14:21
johncl

Registered: Aug 2007
Posts: 37
Sprites at $d800 ?

I was always under the impression that the screen color information was stored in ram at $d800. But while working on a Vice Snapshot File viewer I found a lot of sprites in RAM at $d800 for e.g. the game Great Giana Sisters (sprites start at $cc00).

So am I right to believe that when the IO/C rom is visible any sta/lda to/from $d800 is redirected to the vic in some sort of color ram it has? But if you point a sprite at $d800 the vic will see the data in the system RAM?

Sorry for the n00b question, but this was new info for me. :)
2008-12-02 14:55
johncl

Registered: Aug 2007
Posts: 37
Ok, googling a bit I found this hacking article that explains it:

http://codebase64.org/doku.php?id=magazines:chacking7#hiding_ki..

"Note that the VIC-II always fetches its information from the internal RAM, totally ignoring the memory configuration lines. There is only one exception to this rule: The character generator ROM."

So this means that it can always get access to sprite data in ram even if the IO/C rom is on. Also from another place in that article:

"D800-DBFF Color RAM (only lower nybbles are connected)"

Which indicates that the 4 lower bits of each byte is stored somewhere else in/around the vic chip to use as color information per char position. Obviously to get sprites into this area you have to turn off the IO/C rom (by setting address $01 accordingly), copy the sprite data into it and then turn it on again. I guess many games use this area for sprite data since its basically overshadowed by the rom (IO and Kernal) and you dont have to bother with any flip/flopping of them while your program is running.
2008-12-02 15:36
Oswald

Registered: Apr 2002
Posts: 5034
correct, also favorite place for 4x4x16 softmode bitmaps in demos as that bitmap doesnt changes, there's no need to take care of ram configuration in the irq handlers IO can be always on.
2008-12-03 09:45
Cruzer

Registered: Dec 2001
Posts: 1048
D800 colors are indeed some extra RAM of 1000 nybbles. So if you don't use D800 colors, there's actually about an extra half a K here that can be used for other things, e.g. raster colors.
2008-12-03 11:21
yago

Registered: May 2002
Posts: 332
Please note that RAM under I/O is best used for constant stuff (like oswald said) that needs not to be read by the CPU.

So, D000-DFFF is not good for Raster Colors, as you would need to change $01 for reading them (and you do want IO on all the time after init).
2008-12-03 11:24
johncl

Registered: Aug 2007
Posts: 37
Yes, I believe Cruzer meant that if you dont use the color memory in the VIC at $d800 you can store other data there, for example raster colors.

And yes you are right that the area under the IO and Kernal is best used for static stuff - especially since the VIC can see this memory - so excellent for sprites and a static charset (no good if you are updating it in realtime).
2008-12-03 11:28
yago

Registered: May 2002
Posts: 332
Ah, now i see... Well please note that the colorram is only usable for colors, since its not only 4 bits big, but the upper 4 bits behave kinda... strange :-)
2008-12-03 11:31
johncl

Registered: Aug 2007
Posts: 37
It will take some cpu time if you need that data as bytes (and, shift, or) so not terribly efficient, but nice to know if you are really down to your last bits. :)

I think I have read somewhere someone using those upper bits as a random generator.
2008-12-03 11:41
Cruzer

Registered: Dec 2001
Posts: 1048
Yeah, ofcoz you can only use the lower 4 bits. The upper 4 ones are junk, but not totally random. As far as I remember they are related to d012, which can be seen if you do something like:
loop:
	lda $d800
	lsr
	lsr
	lsr
	lsr
	sta $d020
	jmp loop

2008-12-03 11:48
johncl

Registered: Aug 2007
Posts: 37
Yes, tried that little routine you pasted in and I see that the contents change in a repetitive fashion once it drawing the character area. Interesting...
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Dr. Doom/RAD
stephan-a
Fred/Channel 4
JEZ
Nith/TRIÉ…D
Guests online: 69
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.6)
6 Comaland 100%  (9.6)
7 Uncensored  (9.6)
8 No Bounds  (9.6)
9 Aliens in Wonderland  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Cubic Dream  (9.6)
3 Party Elk 2  (9.6)
4 Copper Booze  (9.6)
5 Rainbow Connection  (9.5)
6 It's More Fun to Com..  (9.5)
7 Dawnfall V1.1  (9.5)
8 Birth of a Flower  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Nostalgia  (9.4)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Offence  (9.3)
Top Webmasters
1 Slaygon  (9.7)
2 Perff  (9.6)
3 Morpheus  (9.5)
4 Sabbi  (9.5)
5 CreaMD  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.043 sec.