New mystery iCC display mode

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andrew Davie

This was an accidental 'discovery' actually.

Earlier today I thought I'd sit outside in the shade and do some programming. My laptop had "auto brightness" set, and since it was bright outside, the laptop cranked the brightness right up on my display. And it turned out that the game flickered horribly. I knew iCC could flicker (I call it shimmer) but this was the worst I'd seen.

So I've rather gotten used to things looking OK in the darker environment in which I normally develop. iCC has always required some adjustment of brightness and contrast on a TV to get the balance just right - reducing both of those will optimise the phosphor persistance effect somewhat. I've read one person who stated that iCC worked beautifully on their Toshiba CRT TV.  And me, I've seen it work brilliantly, too.

Recently I put in the dynamic brightness, and that worked rather well. But it also allowed me to explore the effect of brightness and shimmer/flicker. Definitely when you crank the dynamic brightness way up, the shimmer becomes much more apparent.

So I got to thinking about iCC; in particular that it's a 3-line system (one line "red", the next "green", the next "blue") with a rolling of those colours in successive frames. That's explained elsewhere on this forum.  I thought well, let's have a look at a 2-line system - that is, 4 virtual colours instead of 8.  In prep for that I modified a core routine to increment the colours - and I changed that from "3" to "2".  And, strike me dead, it actually produces a viable display even though I don't have a clue (yet) how it's actually working.

Whereas with iCC we get a single line rolling through the 3 colours, and in chrnonocolour we get 3 lines each with 1 of the 3 colours (ie. not shimmering)... in this new mode we get... I'm not sure what's happening actually. 2 lines rolling through 3 colours?  It's weird. We get the best of both, basically. It shouldn't work, but it does.

I did a video where I toggle through the 3 options -- the shimmer/flicker of course does not happen with chronocolour, but the display is sparse (venetian-blinds).  In iCC the display is solid, but shimmers/flickers. But in this new mode it's halfway between the two. I'm hard pressed to find any shimmer/flicker, and it's not quite solid but 2x more solid than the chronocolour. It looks pretty good to my eye.

It's a marvel, actually - a fluke that it gives a good display. I'll have to figure out how on earth it's actually managing to do what it's doing.  In the attached binary, hit F5 on the emulator to toggle between the three display options. I'm finding it hard to decide for sure if it's less shimmery or not.

Note: when you startup you'll be in the new mode.  On Gopher you just Hit F5 to go to iCC, and f5 again to go to chronocolour. On Stella the switches are slightly different; you need to toggle the switches so pressing F5 and then F6 and then F5 etc. should do it.


Bomberman94

Am i able to toggle the different modes on my ,,real" Atari, too? I'm curious to see this and can do a video if you like.

Andrew Davie

Quote from: Bomberman94 on 10 Sep 2025, 01:52 AMAm i able to toggle the different modes on my ,,real" Atari, too? I'm curious to see this and can do a video if you like.

Yes!

JetSetIlly

I like this variation a lot.
https://github.com/JetSetIlly/Gopher2600
@JetSetIlly@mastodon.gamedev.place
@jetsetilly.bsky.social

Andrew Davie

#4
Quote from: JetSetIlly on 10 Sep 2025, 04:50 AMI like this variation a lot.

Me, too. It's the new default for all my games/demos. Watching the YouTube videos of screen grabs, it's clearly 25Hz 'shimmer', but that's kinda right on the limit of it being really noticeable. Whereas the iCC was 20Hz and that makes all the difference. It also appears to "pair" lines rather than individual ones, and that adds to the impression of solidity.

Andrew Davie

I think the best way to think of this mode is this way:

In ChronoColour variants so far, we have up to three scanlines per 'trixel'; the different RGB values on each line and on/off pixels give us 8 combinations. The eye blends them together to form one of 8 colours. The original ChronoColour changes the RGB across three consecutive scanlines. The iCC variant comes in iCC1, iCC2 and iCC3 which take 1, 2 and 3 scanlines to form a trixel - but in all of these, they take 3 frames to complete the trixel 'draw'.  So the refresh rate of trixel changes is 60/3 --> 20Hz.  It's that 20Hz 'shimmer' that we see in iCC games/videos. It's not terrible, but requires appropriate colours (not too bright), and emulator/TV settings (brightness low, contrast low).  When all these align nicely, it's awesome because it gives us 8-colours to play with.

What this new pCC mode (phased ChronoColour) does is effectively the same thing, but at 25 Hz.  So it 'somehow' manages to get 3 colour changes into 2 frames for each line. How? What's really happening is that we see separation (scanlines) in the colours. Rather than all lines being capable of displaying RGB we actually have the RGB 'usage' divided differently. One way of thinking of this is that the RGB colour changes are happening across 3 frames, but the RGB changes down scanlines are now happening in 2 lines (instead of 3).

The guts of this is an extremely small routine that increments a 'roller' value. In iCC this roller is continually going 0 1 2 0 1 2 0 1 2 as things are being drawn scanline by scanline. It's used as an offset for retrieving appropriate graphics data within a trixel. So when the roller is 0 at the start of a screen draw, then the bytes from data are received in order (0 1 2) (3 4 5) (6 7 8) etc.  Each bracketed group is a trixel. So the base for each trixel is 0 3 6 etc. Stepping 3. and the offset is added to the base to get the address of the data.

So roller starts at 0 in frame 0. In the next frame it starts at 1.  So the data is now retrieved in order (1 2 0) (4 5 3) (7 8 6) etc.  The base for each trixel is still the same, but the ofset has changed. The bytes within the trixel have "rolled" between frames. 

Now in ChronoColour, the roll value doesn't change between frames. It's always 0.  So the data is always displayed the same every frame, in definition order.  (0 1 2) (3 4 5) (6 7 8) etc.  Also note the colours for those lines are always (R G B) (R G B) (R G B) etc.  If, then, we are drawing something that's pure red, then the on-pixels will be every 3 scanlines... (R - -) (R - -) (R - -).  This is the cause of the 'sparse' look of ChronoColour. Some colours are only seen 33% of the lines - colour 1, 2 and 4 corresponding to bit patterns 001, 010, 101 in the (R G B) trixel. Some are seen 66% of the time (colours 3, 5, 6) and of course one colour is seen on every line (white) colour 7.

iCC 'fixes' this sparseness by changing roll between frames, as mentioned earlier.  A red trixel (we'll consider just one trixel from now on) will display in 3 successive frames like this... frame 0: (R - -) frame 1: (- - R), frame 2: (- R -) and then repeat.  That is, all three of the 3 scanlines forming the trixel are at one point or another displayed as red. We just have changed the spatial 33% seen with a temporal 33% seen.  But to the eye we now have a less sparse visual - no always-black scanlines. Instead three always-red scanlines, but shimmering and somewhat dimmer. That's where/why the phosphor effect is important; this system relies on some decay and eye persistance of vision to blend that red across frames. Instead of seeing a really obvious 20 Hz flickering red scaline, we see a kind of shimmering scanline which is pulsing at 20Hz but in fact never gets fully black before it's red again. So the flicker is somewhat reduced.

iCC is really 'icc3' which is just a way of saying that that particular mode represents trixels as being 3 scanlines tall. in iCC modes (1,2,3) the trixels can be either 1, 2 or 3 scanlines high - because the trixel is formed across 3 frames as well as vertically across scanlines. It's possible to group the RGB changes down the screen and across frames so that those 3 modes all work fine. But, as noted, all with 20Hz shimmer.

And now we get to pCC. What's different?

Well, the only change I actually made (seriously, this is the ONLY change)... well, first let's look at the routine...

void interleaveColour(int *r) {
if (++*r > 3)
*r = 0;
}


Essentially this little helper routine does that 0 1 2 0 1 2 thing for a variable. The roller, in other words. In ChronoColour it always starts at 0, as mentioned. But in iCC, the routine is also used across frames to roll the starting value for screen draw (so that also goes 0 1 2) across successive frames, as explained.

So when I was annoyed at the flicker in iCC the other day, when my screen turned the brightness way up because it was on auto-brightness mode and I was outside in bright sunlight... I thought 'mmh, well maybe people don't like iCC because they have their brightness settings way up like this'.  And that got me to thinking, well... what would a 2-line iCC look like.  The thinking was that this would reduce the available colours to 4-colours, since we now only have two colours across 2 scanlines.

So the first thing I did was simply change the ">3" to ">2". That was to get the roller going (0 1) (0 1) (0 1) as the screen was being drawn. I thought it would all be garbled, but fun to see and confirm that change was doing what I thought. So when I ran that (with that single change), the screen displayed perfectly but with the new display mode, so to speak. All colours were good, flicker/shimmer was almost completely un-noticeable, and I was totally nonplussed/surprised.

So, what's happening here?
Essentially, though, the roller is now cycling (0 1) (0 1) (0 1) when changed through that routine. But as it happened, I was only partway using that standardised routine; because I had some code I wanted fast... I had copied the contents of the routine into those draw loops (e.g., the palette). So when I changed the roll sequencing in the routine I caused disparate sequencing between the screen data, and the colours.  The colours were being drawn in the original way (RGB) (RGB) etc.. and rolling across frames as expected (GBR) (GBR)... but now the data (graphics) fetch was happening on a 2line basis instead of 3.  In other words, one system was running a cycle length of 2, the other a cycle length of 3. Completely inadertently and although I kind of knew the change from 3 to 2 was going to break things, I did not expect it to break it beneficially.

That's the fundamental gist of things. I'm still wrapping my head around exactly how it all fits together and works so nicely. But basically we have two cycling systems going - one for data and one for colour. In iCC they were the same cycles (0 1 2). In pCC they are different (0 1 2) for colour, and (0 1) for graphics data. 

What an unexpected outcome!


Andrew Davie

... ahd... aha!  Now that I've sussed all that out, a weird and unexpected bug is now found/fixed. I have a particle system draw. And I use that system at the start of each level to draw a circle of particles rotating around the player position. But for some reason some pixels weren't being drawn in colour It turns out I was calling the helper function to do the roll increment, whereas changing to the manual (3-line) version for the particle draw function brings back the colour as expected. Awesome.

Andrew Davie

I got to thinking:  part of the reason that pCC (phased ChronoColour) is pleasing to the eye is that it effectively uses a 25Hz alternating field display - and we're used to that with TVs. But TVs also interlace these frames to display nicely on a TV.

Previous work has been done to interlace a '2600 display, and it's been shown to be do-able. I wonder if it might be worth doing some experiments with pCC to provide an interlaced version. 

Could be interesting!

Bomberman94

Can you describe what changes if you use pCC interlaced - does it double the resolution or something else?

Andrew Davie

Quote from: Bomberman94 on 29 Sep 2025, 04:23 AMCan you describe what changes if you use pCC interlaced - does it double the resolution or something else?

In theory it would shift alternate frames by 1/2 scanline vertically. It *might* spread out the coloured lines a little and reduce the spacing between coloured lines. Maybe.