Pacman in 512 bytes

Originally published at: https://boingboing.net/2019/07/09/nanochess.html

6 Likes

written in 8088 assembler.

Often imitated, never duplicated.

9 Likes

So, no cherries, no high score, no screen wrap-around, no power pellets, no ghost graveyard/regeneration zone. Hmmmm, even with all that missing, the 512 bytes is impressive.

5 Likes

Being a computer geek in collage in the late 90’s I used to download these assembly challenge projects people had completed and some were mind bendingly amazing at the time. This was at the time when a 3D graphics card with 4MB of RAM was only for the high end 3D animators or CAD users. Yet somehow these guys programming in assembly could create 3D worlds that were completely proceduraly generated and blew away what you saw in games at that time, but were like 5kb in size. It’s kind of eye opening to see what a computer is capable of when you’re efficient in assembly.

I’m not 100% on this, but someone told me the old “Magic Carpet” demo that wowed everyone running a 386 way back in the day was based off an assembly project originally.

2 Likes

A classmate wrote his own Pacman for the C64 in assembler, way back when.
Simply deceided that it was too expensive to buy and just sat down and wrote the code over two or three weeks after school.
Pretty close to the original, too.

8 Likes

I remember the demos that came on a disk with my now long, long gone Gravis Ultrasound card. It just floored me what they could do in so little space.

1 Like

Still, to this day, I’m wowed by Rollercoaster Tycoon (written in x86 assembly). Chris Sawyer is a wizard with no equal.

2 Likes

how large was the z80 original?

1 Like

Google leads us to Mike’s Arcade, which has a PDF manual with schematic. There are four 2532 ROMs on the board, which adds up to 16k bytes total. I don’t know how full they are, but an enterprising person could look for the hex files and read the address of the last line.

Edited to add that the ROMs contain 15k of code, 1k of empty space.

9 Likes

Just curious because I fiddled around with it on the Apple II+, how did 8088 assembler compare with 6502?

1 Like

The 8088 is an 8-bit bus version of an 8086, which is a 16 bit machine with 16 bit instructions, I guess. I have never programmed one. I went straight from Z80 to 680x0. In our shop, we used the Intel data books as stacking spacers for equipment.

5 Likes

If I was looking for the smallest minimal Pacman, I’d check the ZX-81. With 2k ram, and part of that used by the system, there wasn’t much headroom.

3 Likes

You don’t write in assembler any more than you write in compiler. So sayeth Pedantic-Man™!

5 Likes

And still manages to be better than the Atari 2600 version. Well done.

4 Likes

Ms. Pacman can be written in only 410 bytes.

2 Likes

FeminineBewitchedBlackfish-small

4 Likes

I am reminded of HQ9+ (see also esolangs page).

The logical extension is a language wherein the operation “P” generates a Pac-Man installation. And the rest can just be implemented in hardware.

2 Likes

It depends on what you want to do… the 8088 has 16-bit registers, so if you’re dealing with things bigger than 8-bits (tables > 256 bytes), it’s going to be more efficient. It also has some cool instructions for loops and repeat. For a game like this that is pretty simple and runs in a fixed location (zero page!), I’d say its pretty similar in code density. Differences in how the video works will make a difference, too - the Apple II had a hard-to-address scheme that required more computation; I’m not sure of the complexity of the PC graphics mode being used.

And STILL better than the Atari 2600 port.

3 Likes

2 Likes