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 > Controlling that colour change bug thing
2010-08-13 19:36
Conrad

Registered: Nov 2006
Posts: 849
Controlling that colour change bug thing



Would any hardware gurus/coders care to explain what causes this bug to appear and is it possible to control its visibility, code wise?

Thanks.
2010-08-13 19:46
tlr

Registered: Sep 2003
Posts: 1790
The way to control it is stable rasters...

On 856x based machines (i.e newer C64s and C128s) when writing a color register ($D020-$D02E) currently being used to display graphics a grey dot (color 15) appears at the first pixel of the cycle.

The reason for the grey dot appears to be a glitch in the color register bank itself, not in the mapping from color enables to actual 4-bit color. This effect is thus independent of the previous color register displayed.

It has been reported that the dot can be smaller than 1 pixel, and that it does not show or randomly appears on some machines.
2010-08-13 19:56
Conrad

Registered: Nov 2006
Posts: 849
Thanks tlr for explaining that.

Control it by stable rasters? Well sure, that would help stop it from jittering :) but I kinda meant how to switch the grey dot on/off, i.e. to do with the glitch in the colour register bank as you mentioned.
2010-08-13 20:02
tlr

Registered: Sep 2003
Posts: 1790
The way to avoid the dots is to only update a color register in a cycle where that register is _not_ used to display the first pixel.

The way to force them is to do the exact opposite, only update a color register at a cycle where it _is_ used to display the first pixel.
2010-08-13 20:19
WVL

Registered: Mar 2002
Posts: 902
Best controlled use of the grey-pixel ever is in Risen From Oblivion, the VIC part. Xbow made a scroller using the light grey pixel bug. Pretty neat, except it doesnt work on my c128 at all.. Pixels are very unsteady and are constantly flickering.

Anyway, I think the whole grey pixel thing is very annoying and it's the biggest reason not to use a c64 with a newer VIC.

BTW, in your picture the vertical lines have gaps because of the badlines.
2010-08-13 20:38
Conrad

Registered: Nov 2006
Posts: 849
WVL: On my C64C the grey dots only appear occasionally. When switching the machine off/on, those dots are either visible or gone. It seems bizarre to me why this happens and just wondered if those dots can be forced to be visible or hidden via some machine code, but in any case I'll try what tlr mentioned. I agree it is annoying to see these grey dots in demos that make use of $d020-$d02e for raster colour splits and stuff similar to that, but I plan to use them for something useful (even it it's pointless for people with an old VIC or emulator ;))
2010-08-13 21:02
Ninja

Registered: Jan 2002
Posts: 411
I have one C128 where those dots are usually(!) stable when the machine is cold. After some minutes they start flickering and sometimes they disappear completely after some more time. All too random for my taste...
2010-08-13 21:43
TPM

Registered: Jan 2004
Posts: 110
Very annoying indeed..
On my c64 the dots/stripes appeared and were increasingly present more and more when the VIC got warm, usually after a couple of hours or so. Cool down the c64 for an hour and it was okay again.
2010-08-14 06:59
Ed

Registered: May 2004
Posts: 173
Grey dots for the emulator would be nice!

Eventhough they could be a pain in the arse (Microtop's Starion demos) or beautiful (Wizball loading screen) I never experienced them as unstable. Well, not more unstable than a unstable rasterbar for example.

2010-08-14 07:01
Martin Piper

Registered: Nov 2007
Posts: 722
It is bus timing bug in the VIC hardware where it can output the wrong signal and the wrong time for a very short amount of time. It depends on the exact hardware version of the VIC, how hot it is etc.
2010-08-14 08:29
tlr

Registered: Sep 2003
Posts: 1790
Quote: Grey dots for the emulator would be nice!

Eventhough they could be a pain in the arse (Microtop's Starion demos) or beautiful (Wizball loading screen) I never experienced them as unstable. Well, not more unstable than a unstable rasterbar for example.



Grey dots have been emulated in x64sc since r22786.

Note that the grey dot is not the only thing that differs color reg-wise between a 656x and a 856x.
On a 656x (the one without the grey dots) color changes appear one pixel later than on a 856x, i.e one pixel into the cycle.
To avoid differences between the machines you should never change a color register when it's visible in the first pixel.
2010-09-02 20:52
Skoe
Account closed

Registered: Jan 2008
Posts: 34
tlr, I don't know how well the reason for the grey dot effect is known already. I'm sorry if I repeat known facts here.

Segher is working on reversing the VIC-II photos. We discussed about how the color registers work today.

I can't explain the exact technical background, would be full of mistakes if I did it with my words :) As far as I understood, the registers are only simple latches made of two inverters. When the register is written, the (VIC internal) data bus is connected to the first gate.

Apparently the address decoding and R/W stuff seems to be faster then the data bus drivers. There for an undriven databus (all 1s) is put to the latch. After a while the data bus gets its final state and the right color appears.

With this explanation we had the idea to delay the CS line a bit to make it slower than the data bus. I brutally took a 10 nF capacitor (don't try this at home!) and really: The grey dots can be made disappear. If I put the capacitor there or remove it while the C64 is running I can switch the dots on and off easily.

Segher will try to write it down more detailed or possibly make a drawing later.
2010-09-02 21:17
Devia

Registered: Oct 2004
Posts: 401
interresting..
2010-09-02 21:53
Mr. SID

Registered: Jan 2003
Posts: 424
Awesome!
2010-09-03 11:27
Krill

Registered: Apr 2002
Posts: 2980
There's no way to turn it off by software.
2010-09-03 15:45
tlr

Registered: Sep 2003
Posts: 1790
Quote: tlr, I don't know how well the reason for the grey dot effect is known already. I'm sorry if I repeat known facts here.

Segher is working on reversing the VIC-II photos. We discussed about how the color registers work today.

I can't explain the exact technical background, would be full of mistakes if I did it with my words :) As far as I understood, the registers are only simple latches made of two inverters. When the register is written, the (VIC internal) data bus is connected to the first gate.

Apparently the address decoding and R/W stuff seems to be faster then the data bus drivers. There for an undriven databus (all 1s) is put to the latch. After a while the data bus gets its final state and the right color appears.

With this explanation we had the idea to delay the CS line a bit to make it slower than the data bus. I brutally took a 10 nF capacitor (don't try this at home!) and really: The grey dots can be made disappear. If I put the capacitor there or remove it while the C64 is running I can switch the dots on and off easily.

Segher will try to write it down more detailed or possibly make a drawing later.


The exact implementation on the silicon is not currently known AFAIK.

To do the VIC-II improvements in x64sc we've written numerous test programs.
For my parts of the implementation I've then inferred as much as possible of the (non-known)
behaviour using the results on different chips combined with my electronics expertise.
I've focused on the pixel generation (graphics/sprites/border) parts and differences between the chips.

Reverse-engineered parts of the 656xR* and 856xR* chips will obviously be very helpful in improving emulation further.

Although to get much further temperature and process variation will eventually have to find it's way into the equation... ;)
2010-09-03 19:44
Skoe
Account closed

Registered: Jan 2008
Posts: 34
Quote:
Reverse-engineered parts of the 656xR* and 856xR* chips will obviously be very helpful in improving emulation further.

I wanted to ask him to have a closer look at the sprite pointers. groepaz told me that there are still open questions. Can somebody explain what exactly can be done with it and what is not know about the implementation? (Possibly it's written somewhere here in the forum, mhh.)

Quote:
There's no way to turn it off by software.

No, since it is a glitch in the hardware. The only thing one can do is to try to avoid the situation as somebody has written above already.

2010-09-03 19:59
tlr

Registered: Sep 2003
Posts: 1790
Quoting Skoe
Quote:
Reverse-engineered parts of the 656xR* and 856xR* chips will obviously be very helpful in improving emulation further.

I wanted to ask him to have a closer look at the sprite pointers. groepaz told me that there are still open questions. Can somebody explain what exactly can be done with it and what is not know about the implementation? (Possibly it's written somewhere here in the forum, mhh.)

I'm not sure what he ment. He'll have to elaborate himself.
I would like a full trace of the chips if possible. :)
Feel free to discuss this on #vice-dev @freenode.net.

One thing I found out during analysis is that MCBASE is not being reset at the start of sprite DMA, it is reset at the _end_ of sprite DMA.
Now you may ask if that even matters...

Actually it does on 656x because MCBASE is not reset at power up.
On my 6569R3 it seems to be 63 (all ones) mostly. On the 8565R2's I've gotten reports from it is 0.
This means the sprites will glitch the first time a sprite is enabled after power up, i.e one frame only, and only after a power cycle. ;)

In Box Check "Sprite A" I had to include a MCBASE reset, otherwise it would fail on a 6569 if run as the first program after a power on.
2012-04-01 12:34
Zer0-X
Account closed

Registered: Aug 2008
Posts: 78
Wouldn't this be fitting for April 1st?

Grounding VIC /CS line with 10nF cap didn't work for here, C64C wouldn't start. But 1nF cap works ok. No stripes.

I've only been running few demos so far but I've yet to see a VSP effect crash this C64C. And many of those used to crash this fast'n'quick...

Humm...
2012-04-23 21:56
JAC

Registered: Aug 2002
Posts: 57
Quote: Very annoying indeed..
On my c64 the dots/stripes appeared and were increasingly present more and more when the VIC got warm, usually after a couple of hours or so. Cool down the c64 for an hour and it was okay again.


Then how about putting a sprite above the pixel and use collision registers to count and implement a CPU temperature display for C64 :-)
2012-04-24 06:05
Mr. SID

Registered: Jan 2003
Posts: 424
VIC doesn't think that those pixels are set, so it will not report a collision...
2012-04-24 07:49
ready.

Registered: Feb 2003
Posts: 441
CPU temperature monitoring was done already using adresses $00 or $01, can't remember exaclty.
2012-04-24 07:53
yago

Registered: May 2002
Posts: 333
Measuring CPU tempereature is already possible.

Its done via $00/$01.

Set up the DDR ($00) as output for unused (upper) bits, then to input, and measure the Time it takes to discharge the bits at $01.

Repeat this often, and you will see clear difference between cold and hot CPU.
2012-04-24 08:36
JAC

Registered: Aug 2002
Posts: 57
That's the cool thing about coder forums. Even if you post complete nonsense or jokes you get a proper answer stating it has already been implemented :-)
2012-04-24 14:23
chatGPZ

Registered: Dec 2001
Posts: 11386
Quote:
Measuring CPU tempereature is already possible.

well, not at all. you can read some value which somehow changes over time, in a completely non predictable way. this is far away from "measuring temperature".
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
cba
Epyx/TSA
Case/Padua
Stone/Prosonix/Offence
Steffan/BOOM!
MCM/ONSLAUGHT
Guests online: 99
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Original Suppliers
1 Derbyshire Ram  (9.7)
2 Fungus  (9.3)
3 Black Beard  (9.2)
4 Baracuda  (9.2)
5 hedning  (9.1)

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