FORTUNE — The complex relationship between Bill Gates and Steve Jobs began in the late 1970s, when Microsoft was making most of its money writing software for the Apple II. When Jobs began developing the original Macintosh in the early 1980s, he wanted Microsoft to create for it a version of BASIC, an easy-to-use programming language, as well as some application software, such as word processing, charts, and spreadsheet programs. So he flew up to visit Gates in his office near Seattle and spun an enticing vision of what the Macintosh would be: a computer for the masses, with a friendly graphical interface. Gates signed on to do graphical versions of a new spreadsheet called Excel, a word-processing program called Word, as well as BASIC.
Gates frequently went down to Cupertino for demonstrations of the Macintosh operating system, and he was not very impressed. “I remember the first time we went down, Steve had this app where it was just things bouncing around on the screen,” he told me. “That was the only app that ran.” Gates was also put off by Jobs’s attitude. “It was kind of a weird seduction visit where Steve was saying we don’t really need you and we’re doing this great thing, and it’s under the cover. He’s in his Steve Jobs sales mode, but kind of the sales mode that also says, ‘I don’t need you, but I might let you be involved.’”
Both men were excited by the prospect that Microsoft would create graphical software for the Macintosh that would take personal computing into a new realm, and Microsoft dedicated a large team to the task. “We had more people working on the Mac than he did,” Gates said. And even though Jobs felt that they didn’t exhibit much taste, the Microsoft programmers were persistent. “They came out with applications that were terrible,” Jobs recalled, “but they kept at it and they made them better.”
Gates enjoyed his visits to Cupertino, where he got to watch Jobs interact erratically with his employees and display his obsessions. “Steve was in his ultimate pied piper mode, proclaiming how the Mac will change the world and overworking people like mad, with incredible tensions and complex personal relationships.” Sometimes Jobs would begin on a high, then lapse into sharing his fears with Gates. “We’d go down Friday night, have dinner, and Steve would just be promoting that everything is great. Then the second day, without fail, he’d be kind of, ‘oh shit, is this thing going to sell, oh God, I have to raise the price, I’m sorry I did that to you, and my team is a bunch of idiots’.”
At the time, Microsoft was producing an operating system, known as DOS, which it licensed to IBM (IBM) and compatible computers. It was based on an old-fashioned command line interface that confronted users with surly little prompts such as C:>. As Jobs and his team began to work closely with Microsoft, they grew worried that it would copy Macintosh’s graphical user interface and make its own version. Andy Hertzfeld, a member of the original Macintosh team, noticed that his contact at Microsoft was asking too many detailed questions about how the Macintosh operating system worked. “I told Steve that I suspected that Microsoft was going to clone the Mac,” Hertzfeld recalled.
They were right to worry. Gates believed that graphical interfaces were the future and that Microsoft (MSFT) had just as much right as Apple (AAPL) did to pursue the desktop metaphor idea that had, after all, had been originally developed at Xerox PARC (XRX), not at Apple. As he freely admitted later, “We sort of say, ‘hey, we believe in graphics interfaces, we saw the Xerox Alto, too’.”
In their original deal, Jobs had convinced Gates to agree that Microsoft would not create graphical software for anyone other than Apple until a year after the Macintosh shipped in January 1983. Unfortunately for Apple, it did not provide for the possibility that the Macintosh launch would be delayed for a year. So Gates was within his rights when he revealed, in November 1983, that Microsoft planned to develop a new operating system for IBM PCs — featuring a graphical interface with windows, icons, and a mouse for point-and-click navigation — called Windows.
Jobs was furious. He knew there was little he could do about it, but he lashed out nonetheless. “Get Gates down here immediately,” he ordered Mike Boich, who was Apple’s evangelist to other software companies. Gates came down — alone and willing to discuss things with Jobs. “He called me down to get pissed off at me,” Gates recalled. “I went down to Cupertino, like a command performance. I told him, ‘we’re doing Windows.’ I said to him, ‘we’re betting our company on graphics interface’.”
Their meeting was in Jobs’s conference room, where Gates found himself surrounded by ten Apple employees who were eager to watch their boss assail him. Jobs didn’t disappoint his troops. “You’re ripping us off!” he shouted. “I trusted you, and now you’re stealing from us!” Gates just sat there coolly, looking Steve in the eye, before hurling back, in his squeaky voice, what became a classic zinger. “Well, Steve, I think there’s more than one way of looking at it. I think it’s more like we both had this rich neighbor named Xerox and I broke into his house to steal the TV set and found out that you had already stolen it.”
From Steve Jobs by Walter Isaacson Copyright © 2011 by Walter Isaacson. Reprinted by permission of Simon & Schuster Inc.
To read more about the fascinating Gates-Jobs relationship, and their poignant final hours together, pick up the November 7 issue of Fortune or purchase the iPad edition of the issue in the iTunes store.