gtag('config', 'AW-10816673336'); Boot Sector Games

Ad Code

Responsive Advertisement

Boot Sector Games



 I’ve always been fascinated by very efficiently programmed games or demos.

The Atari 2600 is an interesting example on its own since the early games like Pac-Man

had to fit in 4K of ROM.

While later cartridges ended up using bank switching to get 8K or even more, the early

games really had to be coded very efficiently, and often meant sacrificing complex features

of the game.

But if you think 4K would be tough to code for, how about 2K?

My friend Robin Harbron coded this little game called Minima, which is a play on words

for the Ultima games.

It’s a little role playing game that fits in 2K of code.

Very impressive.

But can you go even smaller?

Well, yeah.

Here’s another one.

This is called “SPlatform” and fits in a meager 1K of RAM.

So, to put things into perspective, how much is 1K exactly?

Well, each of these dots represents a single byte.

And here’s 1,024 of them.

Now, you’re typical assembly language instruction takes up anywhere from 1 to 3 bytes.

So, you could probably have a total of around 400 actual instructions.

But that wouldn’t leave any room for data, graphics, sound, or even text.

So, it would be a very delicate balance between instructions and data.

But what about even smaller than this?

Indeed, could games be written in just 512 bytes of RAM?

It turns out, yes they can.

In fact, 512 bytes is a magic number because that means it can fit into a boot sector!

So, just a refresher here from my floppy disk documentary from a couple of years ago.

Your typical 360K floppy disk for an IBM or compatible has 40 tracks starting from the

outer rim to the inner core.

And then the disk is divided up into 9 sectors like this.

The boot sector is the first sector of track zero.

And as you can see, it’s a very small portion of the disk surface.

Of course, that’s a 360K disk.

What about the more common 1.44 MB floppy disk that most people are familiar with?

That format has twice as many tracks, and twice as many sectors.

But a single sector is still just 512 bytes, so that means it is an even smaller portion

of the disk surface.

So, what does this boot sector do?

Well, the BIOS is in a ROM chip on the motherboard, but that’s not really an operating system.

So, the BIOS has just enough code to read the boot sector into RAM and then execute

it.

But the boot sector isn’t big enough to contain a whole operating system, so it’s

purpose is to load the real operating system into RAM, such as DOS, Windows, or Linux.

You might be surprised to find that, at least on the IBM PC and compatible computers, every

floppy disk and hard disk has a boot sector.

And, there’s a program installed on every boot sector, even if the disk is blank.

Have you ever accidentally left a floppy disk in the drive during boot and see the message

that says “Invalid System Disk.

Replace the disk, then press any key.”

Now, you might think this message is coming from the BIOS ROM.

And that would be a good guess.

But if that were the case, then how would you explain this.

When I put a different blank disk in, the message changes.

Now it says “non system disk or disk error.”

What’s the difference?

Well, the first disk was formatted with Windows 95, the second disk was formatted with MS-DOS.

And that message you seen the screen is actually a small program in the boot sector of an otherwise

blank disk, which displays this message.

Using a sector editor, you could actually change this message to anything.

For example, I changed the message on the Planet X3 disk so that it says a custom message,

and then continues to boot to your hard drive if you have one.

Boot sectors were also historically targeted by viruses.

The viruses were just small programs that lived in the boot sector and then they would

load the operating system afterwords.

And then, they would copy themselves to either the boot sector on your hard drive or other

floppy disks and because the virus loaded in the boot sector, that means it loaded before

the operating system, giving it a higher level of control.

Now that you definitely know what a boot sector is, can you imagine how hard it would be to

write an actual game that fits in just 512 bytes?

Well, what I have here is a space invaders game written by Oscar Toledo.

And the whole thing is on the boot sector.

And I want you to watch how quickly this boots up.

Keep in mind it hasn’t even finished the power on self test yet.

And there it is.

I want to illustrate this from a different angle.

See there, that’s the floppy disk light during the test cycle.

The next time you see that light, that means it’s trying to boot, so watch how quickly

the game starts after you see the light.

Its super fast, not only because there is no operating system to load first, but because

the drive’s head doesn’t even have to seek.

Literally, all it takes is a single revolution of the disk to get the boot sector read into

system RAM.

Of course, this isn’t the best version of space invaders ever.

Its very clear that many concessions were made.

For example, there is no score board, no UFO across the top, and all of the aliens look

exactly the same.

Oh, and there are no sound effects or music either.

But still, you can’t deny the skill involved to make this fit in a boot sector.

So, besides space invaders, what other games are out there?

This is another one.

Post a Comment

0 Comments

Ad Code

Responsive Advertisement
View My Stats