Sabtu, 14 September 2019

How a basement hacker transformed Donkey Kong for the Atari 2600 - Ars Technica

[UNVERIFIED CONTENT] Atari CX2600A from the year 1980 made in Hong Kong.
Enlarge / If you're unfamiliar with the name, "Atari 2600," fellow kids, have a gander at this piece of hardware. (It actually worked, promise.)
Wahyu Ichwandardi / Getty Images
The following excerpt comes from Arcade Perfect: How Pac-Man, Mortal Kombat, and Other Coin-Op Classics Invaded the Living Room by David L. Craddock.

Sickly green light washed over the stubble and pale complexion of the man hunched in front of his computer monitor. Beside it sat a television, black except for five horizontal, crimson-colored bands running from top to bottom like lines on notebook paper.

Garry Kitchen closed his eyes, but the straight red lines were burned into the backs of his eyelids. Behind him came a steady pounding: poundpound-pound-pound. He didn’t rise to the bait. He knew what he’d see. On the arcade cabinet’s screen, a giant ape the size of King Kong had just scaled a construction site made of straight red girders. With every stomp, the platforms had twisted and bent until they were slanted like ramps. Standing tall at the top, the ape intoned his grating, mechanical laugh.

Kitchen gritted his teeth. His replica of the construction site was almost perfect. Steel girders, a flaming barrel, a little man in red-and-blue overalls, an ape at the top.

There was just one glaring, maddening difference. His platforms refused to bend. That was going to be a problem.

Garry Kitchen watched the success of Mattel’s electronic games with interest. Just a few years ago he’d been a college kid chasing an art degree and working part-time at Wickstead Design Associates, a firm that built consumer products like calculators and other digital electronics.

“I ended up getting involved in microprocessor engineering because I kind of had to,” Kitchen recalled. “During this time period, I'd switched from art in school to electrical engineering. I was learning engineering on the job, so why not finish my degree in engineering? We were a small company, I got dragged into doing work of a much higher caliber out of necessity. There was one guy who could, but he wasn't available.”

By 1978, consumer electronics were evolving from handheld electronics to Atari’s 2600 machine. While Atari had started out as the sole manufacturer of games for its console, Activision opened that December and developed games for personal computers and the 2600—a tacit admission to developers everywhere that anyone could write games for Atari hardware. Kitchen went to his bosses at Wickstead Design Associates and made his case.

“Look, electronic toys are being hurt in the marketplace by video games,” he said. They stared blankly. Video games? Kitchen pressed on: “Everybody’s jumping on this Atari thing. We should look into it.”

Kitchen asked around and received little feedback. Atari couldn’t stop Activision and other studios from making games for its device, but it didn’t have to help. There was no software development kit, no prototype console designed to write and test code. Activision’s founders only knew how to make games for the 2600 because they’d worked with it while at the company.

By that time, Kitchen had flipped his schedule, working at WDA full-time and taking engineering classes at night. He wasn’t making much money, pulling in $11,000 a year, but he enjoyed waking up every morning to solve new problems. Developing games for the 2600 was his latest and greatest challenge. Kitchen scraped together $1200 for an Apple II—the most expensive of 1977’s “holy trinity” of personal computers, including the Commodore PET and Radio Shack TRS-80—and dissected his new machine to learn its ins and outs. It ran on a 6502 8-bit processor, which he picked up on quickly having worked with microprocessors on electronic toys.

Once he wrote code, he knew he’d have to find a way to put it on an Atari 2600 cartridge. His solution was a custom-made board with a chip he’d soldered on to play Atari ROMs. Testing code required him to run a ribbon cable from the chip on his board to the teeth in the 2600’s cartridge slot.

Some vintage techie posing with an Apple II computer.(Credit: Ted Thai/The LIFE Picture Collection via Getty Images)
Enlarge / Some vintage techie posing with an Apple II computer.(Credit: Ted Thai/The LIFE Picture Collection via Getty Images)
Six months later, he’d completely reverse-engineered the 2600 using his jerry-rigged setup and written a game, Space Jockey. The program weighed in at two kilobytes, four times the size of Mark Lesser’s 511-byte handheld games, and was much more complex. A shooter, Space Jockey scrolled the screen to the right as the player shot down enemy ships. Kitchen took his creation to his bosses at WDA. He had daydreamed about Atari and Activision getting into a bidding war over Space Jockey, one of the first Atari games written outside either studio’s walled garden. Instead, Donald Yu, one of his bosses, published it through US Games, a separate entity they’d founded to publish electronic toys. Yu licensed Space Jockey to his company and prepared to put it on the market.

Before, when Atari had employed the only engineers capable of writing software for its console, games had appeared at a steady drip. The advent of Activision and engineers such as Kitchen increased the drip to a steady flow. Consumers, thirsty for new titles, lapped them up, but Garry Kitchen wouldn’t see a penny from any sales of Space Jockey when it released. His bosses, as the game’s publisher, would reap any rewards.

“You know,” he said to Yu and the others, “I should be making more money than $11,000.” Bankshot and Space Jockey had become two of WDA’s biggest products.

“We don’t think you’re worth that much,” they replied.

Kitchen quit in early 1982. He didn’t leave Wickstead Design Associates alone. His brother, Dan, went with him. They threw in with a couple of other engineers and set up shop in Garry’s basement. Within a few hours of their first meeting, it resembled a mad scientist’s lab.

The owner of the house Kitchen was renting had left the basement unfinished. Exposed pipes and wiring hung from the open ceiling. Several workbenches had been shoved against the walls, and the four engineers spread out, cluttering every surface with computers and other equipment. Everyone did their own thing. Some guys experimented with the Apple II. Others tinkered with Atari’s 2600. As yet, no one had a contract to develop anything. They were just tooling around until something came up. Coleco was the first to offer up something.

Founded in 1932 as the Connecticut Leather Company, Coleco pivoted to toys in the 1980s with Cabbage Patch Kids dolls. Now the owners were eyeing video games. Kitchen was confused when he received a call from a contract company offering him a deal with Coleco. “We have an in there,” the recruiter said, and explained that word had gotten around about Kitchen’s aptitude for programming 2600 software. “They’re looking for somebody to do a port of Donkey Kong on the Atari. Are you interested?”

Kitchen brightened. “Sure.”

The terms of Kitchen’s partnership with the contract company dictated that they would split their share of the profits down the middle. Coleco wanted to ship Donkey Kong for the Atari in September. That meant production had to be finished by May to leave time for production and shipping.

Landing the deal made Kitchen’s day twice over. It meant steady work and steady pay, and it meant an opportunity to work on something red-hot. “It was the best one out at that point, head-and-shoulders above anything else in the marketplace,” he said of Donkey Kong. “It had a backstory, it had beautiful animation, and it wasn't blobs of unrecognizable graphics on the screen, unlike a bunch of other arcade games. There was a guy who ran around and jumped, and it looked very nice. I was aware it was a very high-profile adaptation.”

The guy who ran around and jumped was aptly named Jumpman, and a few years later would be rebranded as Mario. In Donkey Kong, Mario/Jumpman was a carpenter—later plumber-turned-rescuer-of-princesses—whose girlfriend Pauline had been abducted by the titular ape and hauled up to the top of one of Mario’s construction sites. The player’s goal was to guide Mario across four levels, or boards, each a single screen consisting of platforms and obstacles like rolling barrels, fireballs, gaps in floors, ladders, and lifts. Falling too far would kill Mario in cartoonish fashion, so precise jumps and careful timing were key.

Donkey Kong had been released in 1981 by a Japanese coin-op manufacturer called Nintendo. The game had single-handedly made the career both of its creator, a young industrial designer named Shigeru Miyamoto, and Nintendo, which had been struggling to get a foot in the door of the coin-op business with colorful but derivative rip-offs of shooters like Space Invaders and Galaxian. Kitchen had gravitated to the game’s colorful graphics and unique gameplay, setting it apart from the droves of shooters popular in arcades in the early eighties, as well as storytelling segments such as the cutscene that showed Donkey Kong climbing to the top of the construction site, Pauline clutched under one arm, and stomping the platforms to shatter and tilt them. Nintendo of America, the marketing arm of Osaka, Japan-based Nintendo Company Limited, sold through its initial run of Donkey Kong machines shortly after the game’s premiere in July. By October, NOA was shipping out 4,000 cabinets a week and still barely keeping up with demand.

Kitchen received a Donkey Kong coin-op to reference the game’s graphics and gameplay as he worked. “Since I was primarily concerned with the iconic first level with the slanted ramps and rolling barrels, that's the one I focused on first. It's also the level that was hardest to do, and took up the majority of my time.”

He scrutinized every pixel of DK, studying how characters and objects such as barrels and fireballs moved to recreate them on the 2600. He even took photographs of the screen and placed them by the Apple II keyboard. As he’d done for Space Jockey, Kitchen wrote code for Donkey Kong on his Apple. He’d left his custom-made board and ribbon cable at Wickstead Design Associates, but he whipped up another in a month, one-sixth of the time he’d needed to build the first one.

Kitchen had more wiggle room on Donkey Kong than he’d had on Space Jockey, but only just. Instead of having to constrain his design to fit a two-kilobyte cartridge, he had double that amount. The rest of his toolset was just as spacious: Merlin, an assembler on Apple II that turned out a program in a few seconds, and a homemade chunk of 6502 assembly for the Apple II that took the binary file Merlin spit out and copied it into the memory on his 2600-compatible board. “I would assemble, wait thirty seconds, flip on the Atari, and there was the code, running on the Atari,” he said.

He delved into particulars. The 2600’s screen, which the system’s engineers had designated the playfield, functioned like a container. It could display scenery against a colored background, and hold five moveable objects named by Atari’s engineers: two players, two missiles, and a ball. Player objects served as avatars of sorts. They could be tanks as in Atari’s Combat, paddles like in Pong, spaceships as seen in Space Invaders—anything an artist could draw and a programmer could fit in memory. The missile, player, and ball objects could be moved around the screen as the programmer manipulated data held in the system’s memory registers.

Each of the five moveable objects had predefined capabilities. For example, it only took a single instruction in code to move a player object, but the playfield had to be completely redrawn to reflect movement. Redrawing an object meant clearing every scan line, defined as one row of pixels. This, Kitchen knew, was where drawing Donkey Kong’s first level got tricky.

Working with the Atari 2600 was difficult because of the timing and handling engineers had to exert over its resources, as well as those of the television to which it output graphics and sound. Upon booting a game, programming routines synchronized the 2600 with the television set. The processor allocated memory for the five moveable objects, and each object consumed one bit of memory. The playfield took up forty bits, twenty for each half of the screen. Each slate of twenty bits could be told to duplicate or mirror the opposite side, and every individual pixel on the screen stored color information so the screen knew what color to put there. (The two missile objects assumed the color of their respective player objects.)

A raster television’s electron beam could be thought of as a paintbrush, and the pixels in each memory register as colors of paint on the artist’s palette. The brush started in the upper-left corner of the screen and, dabbing its bristles into the paint colors stored at each pixel’s position in memory, colored them in from left to right. When it finished with the first row, the brush moved down to the leftmost position of the next line and painted pixels again one by one, zooming across to the right.

Over and over, down and down it went until it reached the bottom-right corner. At that location, the electron beam—the brush—shut off and moved back up to the top-left corner. During that brief interim, routines written by programmers could reload memory registers with the next set of graphics data. Then the whole process started again. Any objects that had moved—say, the positions of the square ball and rectangular paddles in Pong—were redrawn. The entire process was blink-and-you’ll-miss-it fast, so that players never detected so much as a flicker.

Where Kitchen and other programmers ran into trouble, and what separated the good Atari 2600 developers from the bad, was in figuring out how to multiply those five moveable objects. Most games involved more than five on-screen elements, and DK was no exception. The first level called for Mario, a fireball or two, barrels rolling down the spaced stack of slanted horizontal platforms, and Pauline and Donkey Kong standing at the top, each waiting for Mario to ascend. “Combat and Pong,” Kitchen said. “Those were the only two games that chip was meant to do. Pong was two paddles—player one and player two—and a ball, which was a one-bit object that bounced between them. That was all of it. Now, based on all of that, how do you do more? You come up with tricks.”

Kitchen knew, for example, that every time a player object rotated or moved, the code pointed to a different block of graphics data so the object would be drawn at the correct orientation: facing right, or lower-right, or left, and so on. Each object consisted of pixels drawn over multiple scan lines. The Atari allowed programmers to designate which set of graphics an object could use on which lines, repeated two or three times. To duplicate any object, all he had to do was write code that told the game to reuse one object over and over.

For Donkey Kong, Kitchen designated Jumpman as the player one object. Every girder was a horizontal band. The barrels were player two objects repeated as needed, and represented one of Kitchen’s coding tricks. Unlike the cars in Freeway, which flowed from left to right but never moved up or down to switch lanes, the barrels in DK rolled from higher horizontal bands to lower rows. The code he wrote was dynamic, so the band that held a barrel could move down while never overlapping with another barrel.

“There were times you could have three barrels rolling down the screen, and they were relatively close to each other because one of them may have taken a shortcut and rolled down a ladder, while another one was near the edge of a ramp, and the third was near that same edge of the ramp but below it,” he explained. “Those barrels were really close to each other, but they never overlapped horizontally. They rolled down the screen in dynamic bands that moved and changed in height, but I always made sure the game logic kept them apart vertically so they never overlapped. They couldn't overlap, because those barrels were all the same object.”

Kitchen was proud of his first trick, but it was a mere hack compared to his second. He knew how to split the Atari’s playfield down the middle, and how to duplicate or mirror one side of the screen based on the other. He had done so to make the ramps in Donkey Kong’s first level. The problem was the two sides were not supposed to be symmetrical. Every ramp was slanted, some sloping down to the right, others drooping to the left so that barrels rolled down them like marbles rolling through chutes in a Rube Goldberg-like device.

Recorded on an emulator, but here's a look at Donkey Kong for the Atari 2600 in action

He’d been hammering at the problem for weeks and had finally reached a breaking point.

“The ramps can’t be slanted,” he told his brother and fellow engineers. “I’m going to do them flat, just like level two.”

By early April, he estimated he was 70% through the project with five or six weeks to spare. It was time to think about what came next. Donkey Kong’s high-profile conversion would open doors anywhere he wanted to go. His first thought was Activision. One afternoon he called the company and got their main switchboard.

“Can you give me the guy in charge of product development?” he asked. The receptionist admitted she had no idea who that would be, and put Kitchen on hold. Half an hour ticked by. Kitchen was ready to try back later when another woman picked up. She was secretary to the vice president of product development, Tom Lopez.

“Can I talk to him?” Kitchen asked. She checked to see if he was busy. He wasn’t, so she put the call through.

“I write Atari games,” Kitchen said when Lopez picked up. “Are you interested in having me write games for you?”

“Nobody writes Atari games,” Lopez responded immediately, automatically. “Only Activision and Atari can do that.”

“There’s a game coming out from US Games,” Kitchen replied. “Space Jockey. I did it. I reverse-engineered the machine, and right now, I’m working on Donkey Kong for Coleco.”

Lopez’s breath caught. This was too good to be true. A game programmer, self-taught, who knew the inner secrets of Atari’s black box, and was about to drop possibly the biggest arcade-to-living-room conversion to date.

“Where are you?” Lopez asked.

“New Jersey.”

“I’ll be there tomorrow.”

Kitchen estimated that maybe fifteen people in the world outside of programmers at Activision or Atari knew how to program the 2600. He was one of them, and was determined to prove it to Tom Lopez.

Lopez caught a flight to New Jersey and showed up at Kitchen’s the next afternoon. They exchanged pleasantries, and then Kitchen took him down to his mad scientist’s lab and showed him Donkey Kong. The first level played nearly identically to the arcade. Lopez picked up the Atari’s one-button joystick and guided Jumpman/Mario up ladders and over barrels.

He set the joystick down and admitted he was impressed. The game checked almost all the boxes. Almost? Kitchen’s brow furrowed. Lopez smiled, gathered his things, and made his way up the stairs and to the front door. Kitchen followed and asked about plans for the future. Lopez said he’d think about it, and shook Kitchen’s hand.

“One more thing,” Lopez said, pausing in the front doorway. “If you were working for Activision, you’d figure out how to make those ramps slanted.”

Then he left.

Let's block ads! (Why?)


https://arstechnica.com/gaming/2019/09/how-a-basement-hacker-transformed-donkey-kong-for-the-atari-2600/

2019-09-14 13:00:00Z
CBMiaGh0dHBzOi8vYXJzdGVjaG5pY2EuY29tL2dhbWluZy8yMDE5LzA5L2hvdy1hLWJhc2VtZW50LWhhY2tlci10cmFuc2Zvcm1lZC1kb25rZXkta29uZy1mb3ItdGhlLWF0YXJpLTI2MDAv0gEA

Tidak ada komentar:

Posting Komentar