Live data from Hacker News

Secret colours of the Commodore 64

aaronbell.com

51–60 of 100 posts

Re: Secret colours of the Commodore 64

#51

If using composite video and a PAL TV, you can also blend colors by using alternating horizontal stripes because PAL TVs use a delay line to cancel the chroma information with the line above it. Exactly what color you got would depend on the specifics of your TV's decoding.

Yes. I believe the term was a "raster split". There was a limitation to how many colours you could use for your sprites, and using this technique you could effectively double-it. As long as your characters were on different horizontal portions of the screen. The bitmap brothers (Creatures, Mayhem in Monster Land) were notorious for this and other sweet tricks. Remember how there used to be a border? They figured out how to get sprites in there. Amazing towards the end of its life all the ways developers found to squeeze out those extra tricks from the ageing hardware.

Re: Secret colours of the Commodore 64

#52
post #49

> Sidebar: A note on frames per second. The European PAL C64 updated at 50fps, whereas the US NTSC systems updated at 60fps This is because alternating current is 50Hz in PAL countries (eg Europe), and 60Hz in NTSC countries (eg America). Analogue TVs vertical refresh rate was synced to the AC frequency for a bunch of practical reasons, which meant gaming consoles had to send signals to the television at either 50Hz…

> for a bunch of practical reasons Basically makes it cheaper to build. You have a natural frequency there to use, and you don't have to come up with all this additional hardware to smooth out the existing frequency and come up with a new one. I think there was a flip-side to this ... though NTSC had faster refresh, PAL had a higher resolution (more lines). I'm not sure, but I think this may have been a tradeoff.

You are correct. A black bar at the bottom of the screen is a nostalgic trigger for me! (When playing games which were designed for NTSC resolution on PAL screen. This was a generation later on the Amiga)

Re: Secret colours of the Commodore 64

#53

This is cool, but I've never understood why people like the C64 palette. It looked washed out to me. I guess people grow to like the look of the machines they have fond memories of. (Apple II, Coco, Sinclair) The Amiga was the first machine to really impress me with its pallete.

The Amiga was really the first home computer to have a truly impressive palette. It got the jump on the PC mainstream by a good few years. I don't think it was until sVGA happened that the PCs caught up again ...

Re: Secret colours of the Commodore 64

#54
post #49

> Sidebar: A note on frames per second. The European PAL C64 updated at 50fps, whereas the US NTSC systems updated at 60fps This is because alternating current is 50Hz in PAL countries (eg Europe), and 60Hz in NTSC countries (eg America). Analogue TVs vertical refresh rate was synced to the AC frequency for a bunch of practical reasons, which meant gaming consoles had to send signals to the television at either 50Hz…

> for a bunch of practical reasons Basically makes it cheaper to build. You have a natural frequency there to use, and you don't have to come up with all this additional hardware to smooth out the existing frequency and come up with a new one. I think there was a flip-side to this ... though NTSC had faster refresh, PAL had a higher resolution (more lines). I'm not sure, but I think this may have been a tradeoff.

> Basically makes it cheaper to build. You have a natural frequency there to use, and you don't have to come up with all this additional hardware to smooth out the existing frequency and come up with a new one.

I'm not an expert, but I read that it was the idea but it was never implemented and TVs used independent generators.

Re: Secret colours of the Commodore 64

#55
post #6

This overlooks a key detail, namely interlacing. The C64 wasn't producing 60 frames per second, but rather 60 fields : sets of odd or even scanlines. So on the CRT TVs of the time, you'd get one colour on the odd scanlines, and another on the even scanlines. Scanline striping, essentially.

I was under the impression that there must have been some additional signaling to make interlacing happen. If for no other reason than the display would need to know which frame was the upper scanline and which was the lower. Apart from the fact that they would have advertised the increased resolution (albeit flickery). On the Amiga, which did do interlaced modes. you could tell on a screen showing a single colour wh…

It's not an additional signaling.

TVs were designed in the 30's, where electronics were extremely primitive and expensive. You wanted the consumer device to be as simple as possible so it could be within the consumer price range. So TVs were little more than a Radio receiver hooked up to a cathode ray tube (CRT).

To drive a CRT you need 3 signals: X position, Y position and brightness. The dumbest possible design is to have 3 radio receivers and transmit all 3 signals over the air. But the extra receivers are expensive and besides the X and Y signals are very repetitive, which would be a waste of bandwidth.

So two flyback transformers were added to the design of the TV, which generate a saw wave pattern. Starting at 0% they would consistently increase power until 100% before rapidly snapping back to 0. One would run at the vertical refresh rate to drive the CRT's Y signal and the other would run at the horizontal refresh rate to drive the CRT's X signal. The Brightness would come from the radio receiver.

With this design, you just need a way of synchronizing the TV studio's cameras and all the TVs in the area to the same horizontal and vertical refresh rates. You might think: Easy, we just use the mains power frequency for vertical and then divide it by 525 to get the horizontal frequency.

But a 525 frequency divider way too expensive to put in every TV. Instead, they only put one divider in the studio to calculate the horizontal refresh rate and transmit a synchronization pulse embedded into the brightness signal. A simple circuit in the TV detects the synchronization pulse and nudges the flyback transformer to match. A second, longer synchronization pulse is transmitted between every field for the TV to synchronize the vertical flyback transformer.

So a basic Black and White TV is just a radio receiver, two flyback transformers and two synchronization detectors hooked up to a CRT. It doesn't know anything about interlacing or even how many lines there should be in every frame. Back then, a TV studio could theoretically start transmitting at 61 Hz or with a few extra lines per frame and every TV would follow along, right up until the point where the horizontal or vertical refresh rates went out of the spec of the shittest flyback transformers in consumer TVs.

Interlacing is a brilliant hack that is 100% done at the studio end. All they do is pick a horizontal and vertical refresh rate that don't divide into each other a whole number of times. 60 hz divided by 15.750 kHz is 262.5 lines. This means that when the TV's vertical flyback transformer reverts to zero (putting the CRT's Y position back to zero), every second frame, the X position of the CRT will be halfway along the screen.

One thing you might have noticed is that the Y position is constantly incrementing, it doesn't step down by one line worth of y position at the end of each line. This means that the TV signal is actually rotated slightly, with the end of each line having almost the same Y position as the start of the next line.

Which means if the field starts halfway through a line, the start of the first full line on that field (and every line after that) will be half a line lower than it was on the previous field.

Other interlacing schemes are theoretically possible, just by picking appropriate horizontal and vertical refresh rates. You could have Triple interlacing or quadruple interlacing (though I doubt either would be pleasing to look at). But most early game consoles and computers pick a horizontal and vertical refresh rate which divide into each other with a whole number of lines, resulting in a progressive display.

Re: Secret colours of the Commodore 64

#56
post #8

Earlier quoted context omitted.

If the TV displays N fields per second, and the C64 produces N fields per second, then you'll see one at a time. The only effect of the interlace is to shift alternate frames down by 0.5 scanlines. TV phosphor decay is too rapid for anything else to happen. By the time the next field starts the previous one is already gone. (I took some short-exposure shots with my camera and it looks like the phosphor decays from wh…

You are accounting for phosphor decay but not persistence of vision.

If you use an Amiga, which has interlaced graphics modes, you see very easily that persistence of vision is too short to make those images seem stable unless the colours on each pair of lines are very close to each other. It works quite well for photos etc., but is awful for e.g. text or graphics with sharp lines at high contrast.

Re: Secret colours of the Commodore 64

#57
post #51

If using composite video and a PAL TV, you can also blend colors by using alternating horizontal stripes because PAL TVs use a delay line to cancel the chroma information with the line above it. Exactly what color you got would depend on the specifics of your TV's decoding.

Yes. I believe the term was a "raster split". There was a limitation to how many colours you could use for your sprites, and using this technique you could effectively double-it. As long as your characters were on different horizontal portions of the screen. The bitmap brothers (Creatures, Mayhem in Monster Land) were notorious for this and other sweet tricks. Remember how there used to be a border? They figured out…

The border was "opened" for sprites by the crack group 1001 Crew in the beginning of 1986.

Re: Secret colours of the Commodore 64

#58
post #39

I would think answer is NO, but (why not) is there a way to synchronize painting of the picture with the vertical synchronization of the screen in modern browsers, to prevent flickering?

That's `requestAnimationFrame` - it will lock at 60hz if possible, though I believe 60fps is not enough to get rid of the flickering.

Re: Secret colours of the Commodore 64

#59
post #33

Off topic-ish: There was a trick you could use on the Atari ST to display more than the allowed number of colours - you reloaded the palette data on each horizontal interrupt. Could this have been used on the C64 also?

"Raster bar" type graphics were a specialty of the Atari 2600 and 800, and the Commodore Amiga(all Jay Miner-led designs), and starting with the 800, they had programmable "display list interrupts" built into their graphics chips which would let you switch between the various graphics modes and scroll, as well as change the palette. This effect is used all over the place to make nice sky and horizon gradients, to make text and objects look shiny, or to do fades.

The C64 missed out on some of this programmability, but had other goodies to compensate(more sophisticated sprite hardware, a really solid default palette).

Re: Secret colours of the Commodore 64

#60
post #33

Off topic-ish: There was a trick you could use on the Atari ST to display more than the allowed number of colours - you reloaded the palette data on each horizontal interrupt. Could this have been used on the C64 also?

Absolutely. The c64 had a bunch of things that was global, but could be changed per scanline, like graphics mode, border color, background color, sprite positions/bitmaps/colors, character offset, etc.

You could actually change them mid scanline too, but it was tricky to get the timing right, so the exact pixel of the change would be a bit random.

Post reply on HN