20 GOTO 10,20goto10 | Steven Goodwin | undefined

From 0 supporters to 255 of them in less than two months - what an amazing thing you've all done to help raise the profile of retrocomputing even further!

As most of you will know 8-bit machines can stored 256 distinct values, usually numbered 0 to 255. (Although this range can also be interpreted as -128 to 127, but we'll cover that in the book.) For this update, I'll merely point out that an 8-bit value can not store the number 256.

"So what?" you might ask.

Well, since 8-bit machines would often store data in CPU registers with only 8 bits they couldn't represent the numbers 256 or higher. So the number 256 would simply "wrap-around" to 0. And 257 would appear as 1. And 258 would be 2. And so on.

So if this value represented the level in a computer game, for example, and the player was never expected to reach level 256, then there would be no problem. But even if they did reach that level, the programmer might believe the game would function as it normally did on level 0. But if that game was Pac-Man, and the first level was 1, not 0, then something beautiful happened...
 

...this is the infamous “Pac-Man kill screen” and I'll talk more about it in the book, as an excuse to uncover other technical quirks and bugs. (Some with numbers as low as 13)

But for now let's just say that it isn't the level data which corrupts the screen, it's the level counter! Pac-Man described each level by a row of (up to seven) fruits, drawn in the bottom right corner of the screen. If that level was 256, the level counter would draw fruits from 1 to 256, which it would view as being from 1 to 0. Since the program code that drew these fruits didn't consider this possibility it didn't stop at seven fruits, and kept going until all 256 were drawn. Because of this, and quirks in the way the fruit graphics were stored, and the way the screen memory is positioned, meant that non-fruit graphics were used and drawn vertically down the screen, from right to left.

What a mess!

So please share this update with your friends, social media contacts, and on any forums to which you belong to remind everyone of the content they're missing, and to help get us closer to our target so we can all have the book with this (and many other) stories from the retro computing era.

 

p.s. even the best programmers I know have, at least once in their lives, tried to fit the number 256 into 8 bits. Yours truly, among them!

 

Next Article >

Your Bag