The roots of the iPhone can be traced to many corners of Apple's campus in Cupertino, California, but a Silicon Valley courtroom heard Friday heard how some of the most recognizable software features came from a team working in a dark, dirty, windowless room with special security to keep others out.

The story of the iPhone's software design was related by Greg Christie, an Apple vice president and software designer, as part of Apple's patent infringement case against Samsung. Christie is one of the inventors listed on the patent for the "slide to unlock" function, which is one of the patents in question in Apple's lawsuit against Samsung, on trial in the U.S. District Court in San Jose, California.

Christie engaged the jury and courtroom with his behind-the-scenes tale of his part in the development of the phone, which began with a knock on his office door.

"One day, I was sitting in my office, and Scott Forstall came in, shut the door, and he asked me, 'How would you like to do a phone?'" Christie recalled of the first time he heard of Apple's ambitious plan. Forstall was leading some of Apple's OS X design at the time.

"I said, 'Sure, you bet,' and we started to discuss it a bit further," he said "It was a pretty general description at the time, but it would be touch-based, have a large screen for a phone, but a very small screen for a desktop computer, and my team should start working on designs for it."

Over the next few months, Christie's team would demonstrate ideas they had for elements of the iPhone software at the end of meetings focused on OS X design that took place every couple of weeks.

"We'd work on small designs, brainstorm, demonstrate them and review. That went on for a few months," he said.

The meetings took place in a room on the second floor of the building where Christie worked that was reserved for meetings with Steve Jobs.

"It had special security, a PIN code to open the door, there were no windows," Christie said of the room.

At the start, everything seemed to be going well, but that changed in January 2005, just after the Macworld conference.

"Steve was pretty frustrated by what he perceived as a lack of progress on the work," said Christie. "He made himself pretty clear."

Christie's team was given an ultimatum: They had until the next meeting to put together an end-to-end demonstration that showed all of the disconnected experiences working together, or the project would be given to another team at Apple.

"I felt a little angry. I felt we had been making progress," he said. "I felt very competitive, I didn't want to lose this project to another team. I really wanted to do a good job on this."

What followed was two weeks of almost continuous work.

"Pretty much nothing else mattered over the next two weeks," he said.

The demonstration in front of Jobs took place in the same, windowless room the team had been using all along. A tower Mac computer was running the software connected to a small LCD screen with touch interface to provide Apple's founder a taster of what consumers wouldn't see for the next two years.

It was a success.

"This was clearly what he was looking for and that he had been asking for. He thought it was great work," said Christie.

Before long, additional security was added and keycards were required to access the corridor where Christie and his team worked. Similar measures were taking place across Apple as other teams began working on different aspects of the iPhone.

It was to be a long, tough two years.

"It was exhausting and it was exciting. From 2005 through to the announcement in January and sale in June 2007, it was pretty much nonstop. You had to be prepared to discuss what you were working on at anytime of the day, any day of the week, any week of the year," he said.

When the day of the unveiling came, Christie was in the audience at Macworld Expo 2007 in San Francisco. Apple's phone had become the subject of considerable speculation and anticipation in the months leading up to the event.

"It was nerve-wracking, we all wanted it to go perfectly. There was a lot of anticipation, we were hoping we were right and that people would get it," Christie said of the feeling among his team.

And consumers did get it.

As soon as the iPhone was launched, Apple saw massive interest. People camped outside stores to buy it and lines stretched around the block at many AT&T stores.

Christie says he went to work that day, stopping at the supermarket to buy "a few bottles of decent champagne" and then celebrated with workers in the office. In the evening, he went for dinner with his family and then drove around to AT&T stores to look at the long lines of people waiting to buy the phone.

"It was astonishing. We knew for at least one day we were a huge success and it had hopefully all been worth it," he said.

Christie came to Apple in 1996 after software he had written for the company's Newton Messagepad, a personal digital assistant, came to the attention of Apple executives. He'd posted some of his applications on a Newton discussion board on CompuServe, one of the online bulletin board systems that predated widespread Internet access, and that led to a couple of contracts at Apple and eventually a job offer.

Christie's interest in programming began when he was around 8 years old. Dartmouth College in Hanover, New Hampshire, had public terminals available for its mainframe computer and Christie would go there and use one.

"When it was rainy or I was bored, I would go to the computer center and get a temporary login and work on the computers there," he said. "They had little games like backgammon, hangman and a simulation of the 1975 World Series, and a tutorial on how to program, and that's when I started."

Despite teaching himself the BASIC programming language at a young age, Christie wouldn't have his own computer for many years. "The first time I heard of Apple was in junior high," he said.

"Some friend's families bought it or talked about having a computer, but for me, with all of my experience as a 13 year old, computers were old hat. It wasn't a mainframe and I wasn't impressed," Christie said. "But I guess I underestimated the strength of the personal computer."

He owned his first PC in college, when he put one together himself.

"I was into the idea of having a Mac for a while, but it wasn't for a while until I could afford one," he told the court.

That moment came in 1991 when he bought a PowerBook 140 -- one of the first PowerBook laptop computers sold by Apple.

"I found their computing experience superior to Windows at the time," he said.

When the Newton was announced in 1992, Christie said he read about it in the newspaper and was really excited by Apple's vision of the future of computing. So in 1993, when the Newton Messagepad went on sale at the Macworld expo in Boston, Christie drove the 210 kilometers (130 miles) from his home in Litchfield, Connecticut, to be among the first in the world to buy one.

"I brought my checkbook with me and spent our last $700 we had on one of the first ones," he said, referring to his joint checking account with his wife. "I also borrowed $700 for the software development kit so I could learn how to program. It was an expensive day for me."

Martyn Williams covers mobile telecoms, Silicon Valley and general technology breaking news for The IDG News Service. Follow Martyn on Twitter at @martyn_williams. Martyn's e-mail address is martyn_williams@idg.com