Archive for April, 2007

Geeky video timing stuff

Wednesday, April 4th, 2007

You might know that according to the NTSC standard for TV signals in the USA, the display is updated 60 times per second. But did you know that it's not exactly 60 - it's actually closer to 59.94 (60000/1001, to be exact). This Wikipedia article explains why.

Early microcomputers (including early PCs), which were designed to be plugged into TVs, didn't have exactly the same frame rate as TV pictures - most of them used 1640625/27379 (which is closer to 59.92) instead because it was slightly easier to build that way (fortunately TVs have enough tolerance to display the slightly out-of-spec pictures correctly). I wrote this to explain (amongst other things) the origins of these "magic" numbers.

This 59.92Hz number turned out to be very important for finding an obscure bug in California Games that I was hitting whilst trying to get the "CGA MORE-color mode" working on MESS. There is a routine to determine if the frame rate is close enough to 60Hz for it to be likely that this effect would work. The routine seems to be trying to determine if the frame time is in the range (1/60)s +/- 500us (presumably the authors didn't know that it was actually supposed to be closer to 59.92 than 60). However, it puts the timer chip in the wrong mode, causing it to count down twice as fast. So in fact it is instead determining if the frame time is either in the range (1/60)s-500us to (1/60)s or in a similar 500us range at around 1/120s. The "normal" value lies right on the edge of the range it's actually measuring. Of course, because on real hardware the rate is 22us less than (1/60)s (pretty reliably so, since they are based on the same clock signal) this works fine in practice, but I'm sure it's not what the authors meant!

This bug was preventing the mode from working on MESS because the MESS frame rate was set to exactly 1/60s (slightly too fast) and frame rate test was failing (but only just). The fix is for MESS to use 59.92Hz frame rate instead - by making the emulator almost imperceptibly more accurate, the effect works!

Quantum Computers and Magic

Tuesday, April 3rd, 2007

The interesting thing about quantum computers is that they perform very complex calculations, but the answers that they give are relatively short. For example, one important application of quantum computers is likely to be factoring large numbers. The calculation is very difficult but the answer is just the factors.

A quantum computer would be useless for a task like sorting a large list, though, because the calculation involved in doing such a thing is not much more difficult than printing out the answer.

This makes me think of magic tricks. Stage magicians appear to be able to do all sorts of clever things as long as you the audience member can't see what's going on. For example, they can make people disappear or saw them in half, as long as the real business of doing such is hidden away inside a special box. It is beyond the capability of any magician to saw someone in half in such a way that you can see exactly what's going on, or make something in direct view disappear.

The similarity is quite shallow because in quantum computing things are hidden away for very different reasons than they are hidden away in magic - in magic, things are hidden because what the magician is trying to make you believe is happening isn't really happening. In quantum computing, things are hidden away because they are happening in other universes.

Concepts I have got mixed up in the past

Monday, April 2nd, 2007

Frank Lloyd Wright and Frank Gehry
Macrame and Macaroni
Valium and Vaseline

I'm sure there are others, but those are all I can think of right now.

Back to the past

Sunday, April 1st, 2007

Let's see if I can get back into this blogging thing again - I know you've all been missing me. I have been writing all day and have almost 3 weeks worth of posts in the queue - some geeky, some funny and some though-provoking (I hope).

To start with, here's a strange idea I had a while ago. Normally when we think of the past, we think of it as pretty well fixed. We can argue about whether some particular event happened or not but we generally agree that it either happened or it didn't - that there is a right and a wrong answer to any question we can ask about past events. The future, on the other hand, is a lot more debatable. It may be fixed (our free will may be an illusion) or maybe there are many possible futures.

This seems to be a curious asymmetry between past and future. As far as the fundamental laws of physics are concerned, the past and the future are on an equal footing mathmatically. This suggests that either we have no free will or that our ideas about the past are incorrect. Maybe there is more than one past. Maybe the past isn't fixed at all but in fact is actually a superposition of all possible pasts that are compatible with the present.

Furthermore, perhaps the reason that the beginning of the universe is so mysterious is just that if you go back far enough, any possible sequence of events could have resulted in the current universe, so the distant past is a superposition of everything (which carries no information).

This isn't a scientific theory because it doesn't make any predictions, but it might be an interesting philosophical idea to explore.