The Geeks Who Saved <cite>Prince of Persia</cite>&apos;s Source Code From Digital Death - Wired News

Jordan Mechner
Jordan Mechner, center, takes a photo of the source code of Prince of Persia as Jason Scott (L) and Tony Diaz (R) look on. Photo: Dan Krauss/Wired

Wired correspondent Gus Mastrapa was on the scene in Los Angeles to witness the recovery of a piece of gaming history.

LOS ANGELES — Jordan Mechner saved everything.

He saved all the videotape he took in October 1985 of his brother running and jumping around their old neighborhood, footage that he rotoscoped into the animations for his Apple II game Prince of Persia. He saved all of the meticulous journals he kept of the production process, documenting each tiny step of the creation of the landmark hit game.

When he was working on Prince of Persia: The Sands of Time in 2002, the new game’s programmers wanted to add Mechner’s classic to their PlayStation 2 update as an Easter Egg, and asked if he had the source code.

No problem, Mechner thought. I saved everything.

The finished Apple II game was easy to find on the internet, but the source code — the original program that Mechner had written himself on his old Apple II — was nowhere to be found. Mechner looked everywhere, asked anyone who might have ever had their hands on it, to no avail.

A decade later, Mechner’s dad sent him a box of old stuff that was buried in one of his closets. There, stuck in between in piles of still-shrinkwrapped European editions of Prince of Persia and covered in dust, were floppy disks that read: “PRINCE OF PERSIA Source Code (Apple). ©1989 Jordan Mechner (ORIGINAL).”

Disks: found. But what about the data?

When Fox Mulder, X-Files agent, had a technical problem, he called in his cadre of geeks, The Lone Gunmen. Mechner followed his lead and dialed up his own personal geek squad, calling them to his Los Angeles home one Monday morning in April.

Jordan Mechner’s house is nestled at the base of the Hollywood hills on one of those Los Angeles streets so verdant and well-maintained that you’d never know that the smoggy grime of Hollywood Boulevard was mere blocks away.

A white pickup truck pulls up and parks on the street; enter vintage computer collector Tony Diaz. He made the 80-mile drive up from Oceanside to help Mechner mine his old floppies for their lost treasures. From the bed of his pickup, he unloads crate after crate of old Apple II computers, drives and cable. He’s brought everything that might possibly be necessary today. If those disks have information on them, he’s going to extract it.

The metal on the top of some of the gear is rusty and weathered. But Diaz knows what he’s doing; the man can field strip an Apple II floppy drive and refurbish the thing in under an hour. Some of his equipment may not look pretty, but thanks to his expertise it’s all in working order after all these years.

Jason Scott, an archivist from The Internet Archive, has flown out from New York City with a KryoFlux disk reader, a piece of kit popular with software preservationists for making images of old magnetically stored data.

The disks were covered with dust when he found them.

The designers of classic games don’t always realize that they’re sitting on treasure. Scott’s goal is to help them figure this out and save their pioneering work from bit rot.

“To them, it’s just old stuff,” Scott says. “You help them realize its value.” Organizations like Stanford University, the Library of Congress and the Strong Museum of Play have departments dedicated to preserving software. Scott’s presence here today underlines his commitment to rescuing old games and production materials from their dusty, magnetic tombs.

Mechner, Scott and Diaz haul the gear from the truck around the back of Mechner’s house. Nestled in the backyard is a small guest cottage. Like any good Hollywood writer (in addition to working on games, Mechner is writing graphic novels and screenplays these days), he’s converted the guest house into a home office. Inside, there’s a leather couch for entertaining clients, surrounded by bookshelves stacked high with screenplays and awards.

Mechner’s work space sits in one corner, an orderly desk with a large Apple monitor. On the wall nearby, someone has taped up a sign: “Don’t sit at the computer thinking of what to do next.”

Diaz begins to set up his gear on a broad, wooden table. He begins conjoining the beige plastic cases of Apple II computers, disk drives and monitors into an impressive stack of near-ancient technology.

The geek squad’s goal is not simply to find out if Mechner’s old disks work. Today is about getting that old code out of its magnetic tomb and getting it onto the internet. That’s why they need Diaz’s Gordian knot of boxes and cables and not just any old Apple II — because Diaz has wired his computers into a network via Ethernet cable. Underneath, he plugs in a modern Dell laptop to serve as the receptacle for whatever treasures the crew manages to unearth.

Before the team tackles the big question of the Prince of Persia source code disks, they start with some lighter warm-ups. Mechner has another shoebox full of floppies that he wants to try out. The labels on these disks suggest that they contain early Mechner work that has not seen the light of day in decades.

First, Diaz tests a couple of non-critical disks to make sure that his setup is working up to snuff. He’s running software called Locksmith 6.0, a vintage utility used for duplicating copy-protected disks. The first couple of floppies aren’t in the best shape. The scans are visualized on the monitor in ASCII text. Dots represent a successfully scanned sector. Numbers denote a sector that took a while to read. The letter D represents a chunk of data that has been lost to time. There are a few D’s. The results are not entirely encouraging.

Mechner begins to pull disks out of his old shoebox, which he has reinforced with transparent packing tape to hold the weight of the floppies. The tops of the disks clear the rim of the box by half an inch, so it was impossible to put a lid over them. The disks were covered with dust when he found them, Mechner says.

Diaz isn’t worried about dust. “I’ve taken disks that were shotgunned full of errors,” he says, “because they were musty or moldy or crudded up.” He describes the process of cleaning an old floppy disk. As it turns out, you take it out of its case and wash it in the sink with Joy dish soap. This process makes Jason Scott, software preservationist, cringe. “It’s your right,” he says. Luckily, no measures this drastic are required.

Mechner’s copy of Apple DOS 3.3 copies in a heartbeat. “We’re ready for one that’s never been read before,” Mechner says. “Let’s start with Quadris.”

The game name sounds like an alternate-universe version of a familiar classic PC title. As it turns out, that’s almost exactly what it is. After Mechner graduated Yale, where he created his first game Karateka, he went to work at the game’s publisher Broderbund. During his first months with the company, a submission arrived for consideration — a game called Tetris.

“This disk went viral within the company,” Mechner said. “All the programmers, everybody became addicted to this game. We stopped working on our own projects so we could try to beat each others’ Tetris high scores.”

Despite all that, Broderbund passed on Tetris. Sure, thought the boss, our nerdy programmers dig this game, but the general public won’t want to play it.

“They had to send back the disks, and we all had to destroy our copies of Tetris,” Mechner says. “It would have been unethical to keep it.” But everyone at the company was so wrapped up in Tetris that programmer Roland Gustafsson took a day to reverse-engineer the game, naming his unauthorized clone Quadris.

The Apple II disk drive stutters and scrapes. The software loads and copies to Diaz’s drive. “Do you want to see it run?” he asks. Everybody nods their head yes.

Mechner takes the keyboard, selects the beginner level and starts it up. Blocks begin to fall down the screen, but he can’t remember what keys rotate and drop them. Mechner patiently searches the keys, pressing one at a time. When he strikes a certain key, the ersatz Tetris disappears from the screen, replaced by a boring-looking utility program.

Diaz is the first to figure out what just happened. “You found the boss key,” he says. “That makes it look like you’re working instead of playing.” Gustafsson, like many computer game programmers at the time, had covertly written in a panic button that would fill the screen with something that looked like work, just in case your boss walked by during a heated game of Quadris.

“Nice,” Mechner says.

Having safely obtained the Quadris data, Tony Diaz hands the disk off to Jason Scott. Whereas some might be happy just to have played a long-lost videogame, Scott has posterity to think of. A full magnetic read of the floppy will guarantee that there’s nothing else on there, no deleted data from another lost project.

“We’re like Indiana Jones,” Mechner says. “We just ran into the tomb, grabbed the idol and now we’re running out. We got the golden idol!”

Mechner keeps handing disks to Diaz, and more golden idols keep spilling out. Like many computer kids of his day, Mechner used old floppies and rewrote them with new data. One of them used to hold part of Roberta Williams’ early Sierra On-Line adventure game Time Zone. Now, Mechner says, it holds the only copy of one of his earliest games.

“This one is kind of precious,” he says. “This is the other game, besides Prince of Persia, that I thought I had completely lost.” Not just the source code, in this case, but the entire game. “I remember spending a year programming it,” he said, “but no proof that it actually existed.”

Diaz puts the disk into his time machine, and asks Mechner how it should be labeled.

“Asteroids,” he replies.

As a young programmer, Jordan Mechner was keen to create something marketable. He looked at the best-selling games for the Apple II and saw that a clone of the arcade game Space Invaders was doing particularly well. So he knocked up a version of Atari’s hit Asteroids. But by the time his version was ready, game publishers had begun to crack down on blatant copies, and he shelved the project.

The graphics aren’t rendering correctly.

The Asteroids restoration doesn’t go as smoothly as the rebirth of Quadris. When Diaz loads the game, Mechner notices that the graphics aren’t rendering correctly. The space rocks look glitchy and malformed. Is there an error in the original code? Is the configuration of Diaz’ machine different than Mechner’s college Apple II? Or has the disk just not held up well over time? Mechner’s version of Asteroids has been saved, but it will need restoration.

Finally, it’s time to raid the biggest golden idol of them all, the old disk labeled “PRINCE OF PERSIA Source Code (Apple).” Diaz inserts the disk. “I have a good feeling about this,” Mechner says.

Diaz’s computer gives a happy chirp: No errors. “There’s our copy,” he says. “Now, let’s see what’s on the disk.”

Diaz’s fingers, one adorned by a large class ring, dance across the beige keys of the old Apple II. He reads off the directory names on the disk, stopping at “Source images and levels.”

“Okay,” Mechner says, looking at the file names and the date stamps. “This actually means something to me. Those dates are correct. And those are, in fact, the names of the files.”

“This is 99 percent of what we were hoping for,” he says. “If this had turned out to be unreadable, we would have been bummed. It would have been lost forever.”

With the source code saved, what next? Mechner knows: Release it to the world.

“This means that anybody out there who is curious about the Prince of Persia source code can look into it,” he says. “They can dig into it, modify it.”

“However soon you’re comfortable with it, I can get it up,” says Jason Scott.

“Tonight,” Mechner says with zero hesitation.

But the day is still young and there are still boxes of old disks to fish through, copy and scan for hidden secrets. Mechner’s volunteer team of experts remain at his disposal and he plans to use them. It’ll be hours before their work is done. Mechner’s children await him in the main house. Screenplays beckon to be written, new games must be made. But right now, Mechner doesn’t need a motivational sign to shake him into being productive.

“I can’t think of anything more fun to do than this,” he says, and opens another old box.