Archive for June, 2004

Two posts in one day! You lucky, lucky people.

Tuesday, June 22nd, 2004

I had a meeting with my manager's manager today. Managers' managers at Microsoft like to have a chat with their direct reports' direct reports occasionally to make sure they're happy there, that everything is going to plan and to give them a chance to tell them anything they might not want to tell their managers directly.

(By the way, those of you who don't know where to put your apostrophies, or who get the words "their", "they're" and "there" mixed up might want to study the previous paragraph in detail and bookmark this post for future reference. You know who you are.)

Anyway, most of said meeting went very well - I talked about some of the features that I thought it was important that we implement, and justified these with my theories on how the uses of Pocket PCs and Smartphones will change in the future. However, at one point in the conversation I did a terrible thing - a thing of which I am greatly ashamed. I used the word "paradigm". I couldn't help it. Words were coming out of my mouth, and as the thought formed and turned into a sentence I could see that word coming but could do nothing to stop it. The good, decent part of my brain was screaming "find a synomym, quick, you moron" but I couldn't think of one before it was too late and the word was out there in the air like a particularly malodorous flatulation.

Please comment with your suggestions on how I should atone for this atrocity.

Geekism and gunkism

Tuesday, June 22nd, 2004

One of my ongoing projects is getting old computer games (particularly the old Windmill Software games) to run properly on modern hardware. One technique for doing this that I have recently been experimenting with is emulation - specifically, the Multiple Emulator Super System. This is almost there, as it features cycle-exact emulation of an 8088 processor and hardware-level emulation of a CGA card, thus getting the graphics and speed just right for these old games.

The one place MESS falls down is its emulation of the 8253 Programmable Interval Timer. This small but very important circuit exists almost unchanged in every PC ever made (as well as a number of other computers such as the Telenova Compis, the INDATA DAI, the Sharp MZ-700 and the Tesla PMD-85).

In modern operating systems, the 8253 is used by the task scheduler to interrupt whatever the machine is currently doing so that another program can get a chance at running, but these old games used it for advanced sound effects and "random" number generation. As such, they generally pushed it to the limits of its capabilities, so a very accurate emulation is needed to get these games to work properly.

The 8253 is well documented but unfortunately (though understandably) all the documentation available is written for people who want to program the thing or build a computer a which uses it, rather than for people who want to duplicate its functionality in an emulator. So there are a number of obscure edge-cases like "what happens if you do x, but half way through you do y" which aren't documented. In the interests of accuracy, I want to get these edge cases to work just as they would on the real hardware.

I'm finding myself having to do some real science to figure out the internals of this chip - formulating hypotheses and devising and running experiments to prove or disprove these hypotheses, and gradually constructing a "grand unified theory of the 8253" (if you will). Sometimes it's pretty straightforward, but other times tne observations must be made indirectly. For example, some of these experiments require timing as accurate as a millionth of a second, but this is a fraction of the time it takes to actually read data from or write data to the device in question. So the only way to do these experiments is to fire a whole load of data at the chip ("tuned" to maximize the probability of creating the desired event), record what comes back and then sort through the results (sometimes using statistical methods) to figure out if the edge case that I'm trying to reproduce actually happened, and if so what the result was. If the experiment is run enough times, hopefully the event I'm looking for will actually happen. It's quite a lot like doing high energy particle physics, except I'm searching for logic gates instead of Higgs bosons.


The bathroom sink was draining really slowly, so I decided to remove the U-bend and clean it out. You would not believe the evil things that lurked in there - a foul-smelling black, grey and green sludge held together with human hair. I would have taken a picture of it, but it was so unholy I doubt it would show up in photographs (like vampires in that respect). Hours and a long hot shower later, I still feel dirty.

Thought for the day

Wednesday, June 16th, 2004

When people buy houses and make improvements to them, invariably some walls are removed ("We'll knock through here" or "Let's pull this wall down and make this all one big space"). But you never hear of people putting up new walls as part of home improvements ("I think we need a wall here"). So either the average number of walls per house is falling rapidly (clearly an unsustainable situation) or new walls are creeping in from somewhere else. I suspect it is a bit like mould in some houses - "damn, another new wall has sprung up - we'll have to knock through here". I wonder how bad it gets - maybe some people have to keep a sledgehammer by the bed in order to be able to leave the bedroom in the morning.

Anyway, go and play this flash game. It will make you happy.