ChronoColour/Interleaved Playfield code example availabe?

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Al_Nafuur

Is there example code for a ChronoColour/Interleaved Playfield?

I found this here:
https://www.randomterrain.com/atari-2600-memories-tutorial-andrew-davie-20.html 

but I am not sure if it is single or multi colour

Andrew Davie

Quote from: Al_Nafuur on 22 Feb 2025, 03:38 AMIs there example code for a ChronoColour/Interleaved Playfield?


No, I don't think so. But I will make one for you ASAP. The code is elegant.

Andrew Davie

I'll add some notes/thoughts.

ChronoColour changes the playfield colour over successive scanlines. R then G then B (i.e., triplets of lines). This RGB triple occupies the whole screen and is static. That is, line 0, 3, 6, 9.... always R and 1, 4, 7, 10... always G etc. When drawing pixels, one must only draw the red components on red lines, green on green, etc. This gives a completely non-flickery/non-shimmery colour screen, but it looks a little "sparse" in that the red pixels, for example, only appear on every third scanline. Even if we had solid red, 2 out of 3 scanlines for that pixel would show black.

ICC (interleaved chronocolour) operates by dynamically changing colours and on/off pixels on every scanline of every frame. It cycles colours between scanlines in groups of 3.  So, assuming red/green/blue (actually any 3 colours will do but typically these three), then any group of 3 scanlines is R/G/B on first frame, then G/B/R on second frame, then B/R/G on third frame, and then repeating that sequence. The colours effectively "roll" up the screen (or down, if you cycle the other way).  When drawing the actual playfield pixels, then, each scanline must turn on the pixels only for the colour that scanline is displaying.

It all sounds a bit complex, but the code to do it turns out to be relatively simple.

A "trixel" is my term for a unit of graphics (like a pixel) having a certain colour. In ChronoColour, there are 8 possible "colours" formed by R/G/B combination (plus black) over 3 scanlines. Thus, a single playfield pixel wide by 3 scanlines deep forms a "trixel" in ChronoColour. In ICC, a trixel is one scanline deep but spread over 3 frames. Thus, a trixel in ICC is interleaved over time (1 scanline, 3 frames), whereas in ChronoColour it is interleaved over space (3 scanlines, 1 frame).  Thus, ICC tends to "shimmer", but the effect is somewhat mitigated/blended by normal CRT persistence.

ICC can have triple the resolution of ChronoColour, because trixels are a minimum of 1 scanline high, rather than 3. On the other hand, there are considerations as to how much memory is available for the background bitmap, so typically I implement ICC as having 3-line-deep trixels; the same resolution as ChronoColour. This has the advantage of using the same memory/bitmap organisation for ICC and ChronoColour - and allowing switching between the two easily. So I'll go with that for now - both ICC and ChronoColour trixels being 3 scanlines high, but ICC dynamically rolling the colours (RGB, GBR, BRG) over those scanlines and ChronoColour having static colours (RGB, RGB, RGB).  Notation is (line1, line2, line3). Within each line, RGB -> this line is red on the first frame, green on the 2nd, blue on the third.

So, it's actually quite simple to write a single block of code that handles ICC and ChronoColour at the same time. There are two basic parts - setting up the colours, and setting up the pixels. I'll do some work on a stand-alone this weekend, if I can find some motivation.