My first computer was a BBC Model B micro-computer.
Sexy looking thing isn’t it? The baby had 32K of memory, could support 8 colours ( slightly more with various tricks ) and came installed with BBC Basic, my first programming language. In the dreamy days of the 1980s there were a lot of computer magazines – most of which featured source code listings of programs you could type in into your home computer and play with. This was very cool – however, the drawback was a lot of these programs where quite long – and typing them into the computer had all sorts of issues ( no copy and paste for one thing ). So, my Dad, upon seeing a program that he really wanted to type in decided to stick me in front of the computer and get me typing it out for him. I remember him telling Mum that it will teach me how to use a keyboard, which will be a valuable life lesson. How right he was. Personally, however, I think he was just being lazy
I became fascinated with typing in the programs I found in magazines and how by changing the code I could change the program ( and more often than not break it completely ). This of course started my life long love of coding. Recently, I’ve decided to learn HTML5, a far cry from BBC Basic, but I was feeling nostalgic and decided my first HTML5 game would actually be a remake of the first game I ever played – The Tomb of Tutankhamen. I remember spending many hours with my brother and sister playing this game. As an explorer you had to collect crowns, avoid spiders and escape a 16 room pyramid. Thanks to the wonders of the internet, I managed to find a copy of a magazine which contained the full source code of the game. The magazine was called Beebug ( might see a connection with my twitter name there ) and was a long running magazine aimed at people with BBC Microcomputers.
So I sat down one snowy night and decided to try and extract the level data from the source code. After much consulting of very old manuals I managed to decode the game, and lots of it really, really impressed me. Without such structured programming as we have today and with such a small amount of memory, so many neat tricks and techniques were used. The one that I thought was uber cool was how the level data was saved.
The game has 16 rooms, the code for one the rooms look like this :
2850 DATA 2,2,2,2,2,6,0,16 2860 DATA FF09ED21BD01FF01F5C511DD
The first number, believe it or not, was the line number DATA is the command to indicate that you are storing, well, data. Now the first numbers represent things like the colour used to draw the screen, where the enemy was on the screen, things like that. The actual structure of the level was stored in the long hex string.
By looping through the hex string two at a time, you get the following :
How does that help us? Well, what if we converted these hex values to decimals ?
Hmmmmm, still doesn’t look like a level to me – lets try converting it into binary and pad out all strings with 0 where they are not 8 long
Looks like a bunch of 1′s and 0′s. Here is a screenshot of a page I used as a programming jotter, to check my theory :
We have a level! now, piecing together all these DATA strings gives you a view of the entire map :
Now, I have no idea why the levels were encoded like this. Maybe it was to protect the level data, maybe it was to save space or memory, maybe it was to stop children from making mistakes typing in long lines of 1s and 0s when they had been sat infront of a computer by their father. But either way, I thought this was a very nifty and cool way of solving the problem of level storage