Hacker News new | ask | show | jobs
by TazeTSchnitzel 3382 days ago
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.
4 comments

That isn't quite correct. The C64 outputs a progressive-scan image, which is a hack on top of NTSC or PAL. In this configuration, there are only even or odd fields, which double-strike the same area. Thusly, it is 60 fields per second, and since only one field forms the full frame, it's 60 frames per second as well.

There is no scanline striping; that is strictly an artifact of poor NTSC capture devices (like most HDVTs) that naively assume the incoming signal is a 480i image with odd and even fields.

A progressive-scan image emitted as an interlaced image results in, well, an interlaced image. That the scanline pairs are usually identical merely means that it's wasting vertical resolution.

And nonetheless a CRT from the time would show these as different scanlines.

No, this isn't correct. The image isn't "progressive" or "interlaced" until the output stage. Whether or not they are identical is secondary to the timings, which is all that matters. If every frame has an integer number of scanlines (and VSYNC begins during H-blank), it's going to be a progressive scan image.

A "CRT from the time" - the things littered around my apartment that occupy a little too much of my time - can easily illustrate the effect I am describing of a progressive scan image without alternating scanline positions. Go grab almost any '90s game console, or have fun with the Sega Genesis, which supports 240p as well as 480i; Sonic 2 uses 480i to fit two viewports into the two-player mode, but uses 240p during a single-player game.

Well, alternate fields have a 0.5 scanline offset, so that's sort of true. But you definitely don't see them both at once. Are you sure you've ever used a proper CRT TV? ;) - you can get the alternating effect with LCD TVs, but that's because LCD TVs handle analogue input in a different way.

Justifications for this:

0. TV hblank rate is 15,625Hz - at 50 fields/sec, that's 312.5 lines/field, some way short of the 400 you'd need to display 2 fields

1. Out of the 312.5 lines/field, only 288 are booked for the visible area, and most TVs can barely resolve them precisely anyway

2. When the TV is displaying one field in one set of scanlines, and the previous in the other, where does the data for the previous field come from?

2.1. TVs of the period have no buffer

2.2. Computers of the period don't generally have the RAM (or sometimes the hardware) to double buffer

2.3. The image produced is based on more than just the contents of the RAM anyway, increasing the RAM requirements (if you were to try to do this)

2.3. Cheap DRAM of the period doesn't have the bandwidth to scan out two frames'-worth at once)

Here's a pic of my BBC Micro, with interlaced output, running a program that flashes the screen alternating red and white: http://i.imgur.com/1XvkRso.jpg - you can see that at the top it's scanning out an entirely white frame, and at the bottom there's the end of the previous entirely red frame that's in the process of decaying.

As an example of 2.3 - note that the difference between one frame and the next here is entirely the video registers - the RAM stays exactly the same. Only one of the palette registers changes (and the flashing cursor is added by the hardware as a sort of post process step).

(I suspect the red/green/blue blur at the bottom of the white region is an artefact of my phone's terrible camera. Photos from my (slightly) better camera don't have that, but they do look overall the same. However today only my phone is willing to play ball with my PC.)

Alternate fields have an offset, but only if the horizontal sync timings make it so. If a machine is built to output a progressive image, there aren't really "fields", or you can consider them "all odd" or "all even" fields. I don't know anything about the BBC micro, but the Commodore 64 outputs a progressive image.
It's definitely interlaced output, though in most display modes the content is progressive (i.e., both fields look the same) - which is a bit of a dumb arrangement, really, since you get all of the flicker and none of the benefit.

Fortunately there's a command to switch it off, and no TV seems to mind displaying 50.08Hz output rather than 50Hz...

Are you referring to the BBC Micro, or the Commodore 64?
No, the signal indicates whether a given field is for even or odd scanlines. I used plenty of computers and CRTs around that time and not one incorrectly displayed progressive as interlaced.
To clarify, I'm talking about CRT TVs, not computer monitors. The latter aren't (usually†) interlaced.

†There's some interesting exceptions!

Neither are most CRT TVs, if you keep feeding them the odd/even field repeatedly. I keep CRT TVs and monitors at home and can easily verify this. The effect is usually dark gaps between the lines or doubled lines (where the corresponding field would otherwise have been drawn). Doubled lines, as in the same as the previous line of the same field, not from the previous field. It's not a particularly obscure subject or uncommon trick, so I don't see why you would keep insisting that it isn't so when any source that possibly could have proven you right, if you were, will prove you wrong.
I think I misunderstood the responses I got at first, and I couldn't easily find a source. Now that I do understand, it's quite interesting.
I'm talking about televisions and similar. You are still simply wrong. Nearly all of the 8-bit and 16-bit consoles and computers that output to CRT default to non-interlaced, without the TV alternating fields.

Look at other responses in this thread to see how interlacing used to be achieved and the flexibility it had.

Ah, I see now. Your comment about the half-length scanline made me understand.
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 white to black in less than 1/6th of a frame.)

(Well... it's been a long time since I've seen a C64 plugged into a TV, but I don't see how anything else could happen! You definitely don't get an alternating effect from a BBC Micro.)

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.
Try it and see!
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 whether it was interlaced or not.

The difference in signaling is that in an interlaced mode, the final scanline is half-length - Vsync begins halfway through the line, causing the next frame to be offset by half a line vertically.

The monitor doesn't "know", in that case. The interlacing is simply a physical phenomenon. Later digital capture devices must recognize this situation and handle it appropriately. Many assume it's always happening, as progressive-scan 252-field NTSC is out of spec anyway.

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.

Amiga had the A2024 monitor and I always thought is was kind of quad interlace weird interlace for an exotic monitor with long afterglow.

However, the thruth is different but also strange. http://bboah.amiga-resistance.info/cgi-bin/showhardware_en.c...

Apparently, the monitor samples four frames, puts them in 4 frame buffers, then outputs a complete image to the CRT, each frame representing a quadrant on the screen. Must have been very expensive...

Great point.

I wonder how much better the modern version of this effect (as seen in the article) would be if they implemented this.