IBM wanted Microsoft to provide games for its original PC — so Bill Gates took the task upon himself, working late into the night to produce the first PC game ever.

The game Gates and company came up with was "DONKEY.BAS," an extremely simple and silly game about a car dodging donkeys in the road.

When Apple got their first look at the IBM PC, they thought "DONKEY.BAS" was particularly embarrassing, to the point where they couldn't believe Gates put his name on it.

It's the stuff of Silicon Valley legend: In 1980, a young Bill Gates convinced IBM that his tiny startup, Microsoft, was the perfect choice to provide the operating system for its new PC.

The problem was that Microsoft didn't actually have an operating system to sell. So Gates scrambled to buy one from a startup working on an operating system called 86-DOS, or "disk operating system." It renamed the software PC DOS and sold it to IBM for $430,000 total.

As part of the deal, though, IBM wanted Microsoft to provide a version of BASIC, a programming language for beginners, along with a few simple games to show it off. What it came up with was "DONKEY.BAS," a silly game about a car that has to avoid donkeys in the road.

It also happens to be the first PC game ever developed. Behold:

(The ".BAS" part just means that it was written in BASIC.)

Here's how Gates described the process of building "DONKEY.BAS" in a 2001 keynote:

"Actually, it was myself and Neil Konzen at four in the morning with this prototype IBM PC sitting in this small room. IBM insisted that we had to have a lock on the door, and we only had this closet that had a lock on it, so we had to do all our development in there, and it was always over 100 degrees, but we wrote late at night a little application to show what the BASIC built into the IBM PC could do. And so that was DONKEY.BAS. It was, at the time, very thrilling."

Andy Hertzfeld, an early Apple employee, memorably recalled the first time the Macintosh team saw an IBM PC and being especially unimpressed with the selection of games onboard. He singled out "DONKEY.BAS" as the "most embarrassing game," saying that "the concept of the game was as bad the crude graphics that it used."

Hertzfeld said of discovering this terrible game was made by none other than Gates:

"We were surprised to see that the comments at the top of the game proudly proclaimed the authors: Bill Gates and Neil Konzen. Neil was a bright teenage hacker who I knew from his work on the Apple II (who would later become Microsoft's technical lead on the Mac project) but we were amazed that such a thoroughly bad game could be coauthored by Microsoft's cofounder, and that he would actually want to take credit for it in the comments."

In 2001, to show off how far the company had come, Microsoft built a 3D version of "DONKEY.BAS," called "DONKEY.NET," where the aim is to hit donkeys with a car. You can download a version of it, but it's difficult to get running on modern systems.

The IBM PC. Wikimedia Commons

But if you want to play the original "DONKEY.BAS," you're in luck. MIT is hosting a browser-based version, while an enterprising developer built an iPhone and Apple Watch version that you can buy for 99 cents. You can also play another early DOS game, "GORILLAS.BAS," in the browser.

Gates became a massive fan of another classic Microsoft game: He was such a fan of Minesweeper that he had to delete it from his computer to stay productive — still, he would end up sneaking into his executives' offices to play it.