Historians Recreate Source Code of First 4004 Application 159
mcpublic writes "The team of 'digital archaeologists' who developed the technology behind the Intel Museum's 4004 microprocessor exhibit have done it again. 36 years after Intel introduced their first microprocessor on November 15, 1971, these computer historians have turned the spotlight on the first application software ever written for a general-purpose microprocessor: the Busicom 141-PF calculator. At the team's web site you can download and play with an authentic calculator simulator that sports a cool animated flowchart. Want to find out how Busicom's Masatoshi Shima compressed an entire four-function, printing calculator into only 1,024 bytes of ROM? Check out the newly recreated assembly language "source code," extensively analyzed, documented, and commented by the team's newest member: Hungary's Lajos Kintli. 'He is an amazing reverse-engineer,' recounts team leader Tim McNerney, 'We understood the disassembled calculator code well enough to simulate it, but Lajos really turned it into "source code" of the highest standards.'"
Those were fun (Score:5, Interesting)
Re:Only 1024? (Score:3, Interesting)
And scientific functions.
And the ability to convert hex.
And store/recall.
The original had 4 functions. This one has at least 40. Would you rather the MS guys spend time seeing if they can force their 114k application down into 10k, or perhaps writing an operating system that doesn't suck?
Commander Keen (Score:5, Interesting)
For anyone who would like to take a look, I've put the re-engineered source code [insomnia.org] up.
Re:Only 1024? (Score:1, Interesting)
Try that in 1024 bytes
Re:Commander Keen (Score:5, Interesting)
The loop is drawing columns (vertical slivers of wall). It needs to interpolate between two things: the input wall texture, and the output part of the screen. Carmack uses something like Bresenham's line drawing algorithm to do this, but because the 386 has such a limited register set, he stores the fractional increment in an immediate attached to the "addl" instruction: and elsewhere...
Re:Those were fun (Score:3, Interesting)
Re:Amazing! (Score:4, Interesting)
Re:Only 1024? (Score:5, Interesting)
Asimov's The Feeling of Power (Score:3, Interesting)
The Feeling Of Power
by Isaac Asimov
Jehan Shuman was used to dealing with the men in authority on long-embattled earth. He was only a civilian but he originated programming patterns that resulted in self-directing war computers of the highest sort. Generals, consequently listened to him. Heads of congressional committees too.
There was one of each in the special lounge of New Pentagon. General Weider was space-burned and had a small mouth puckered almost into a cipher. He smoked Denebian tobacco with the air of one whose patriotism was so notorious, he could be allowed such liberties.
Shuman, tall, distinguished, and Programmer-first-class, faced them fearlessly.
He said, "This, gentlemen, is Myron Aub."
"The one with the unusual gift that you discovered quite by accident," said Congressman Brant placidly. "Ah." He inspected the little man with the egg-bald head with amiable curiosity.
The little man, in return, twisted the fingers of his hands anxiously. He had never been near such great men before. He was only an aging low-grade technician who had long ago failed all tests designed to smoke out the gifted ones among mankind and had settled into the rut of unskilled labor. There was just this hobby of his that the great Programmer had found out about and was now making such a frightening fuss over.
General Weider said, "I find this atmosphere of mystery childish."
"You won't in a moment," said Shuman. "This is not something we can leak to the firstcomer. Aub!" There was something imperative about his manner of biting off that one-syllable name, but then he was a great Programmer speaking to a mere technician. "Aub! How much is nine times seven?"
Aub hesitated a moment. His pale eyes glimmered with a feeble anxiety.
"Sixty-three," he said.
Congressman Brant lifted his eyebrows. "Is that right?"
"Check it for yourself, Congressman."
The congressman took out his pocket computer, nudged the milled edges twice, looked at its face as it lay there in the palm of his hand, and put it back. He said, "Is this the gift you brought us here to demonstrate. An illusionist?"
"More than that, sir. Aub has memorized a few operations and with them he computes on paper."
"A paper computer?" said the general. He looked pained.
"No, sir," said Shuman patiently. "Not a paper computer. Simply a piece of paper. General, would you be so kind as to suggest a number?"
"Seventeen," said the general.
"And you, Congressman?"
"Twenty-three."
"Good! Aub, multiply those numbers, and please show the gentlemen your manner of doing it."
"Yes, Programmer," said Aub, ducking his head. He fished a small pad out of one shirt pocket and an artist's hairline stylus out of the other. His forehead corrugated as he made painstaking marks on the paper.
General Weider interrupted him sharply. "Let's see that."
Aub passed him the paper, and Weider said, "Well, it looks like the figure seventeen."
Congressman Brant nodded and said, "So it does, but I suppose anyone can copy figures off a computer. I think I could make a passable seventeen myself, even without practice."
"If you will let Aub continue, gentlemen," said Shuman without heat.
Aub continued, his hand trembling a little. Finally he said in a low voice, "The answer is three hundred and ninety-one."
Congressman Brant took out his computer a second time and flicked it. "By Godfrey, so it is. How did he guess?"
"No guess, Congressman," said Shuman. "He computed that result. He did it on this sheet of paper."
"Humbug," said the general impatiently. "A computer is one thing and marks on a paper are another."
"Explain, Aub," said Shuman.
"Yes, Programmer. Well, gentlemen, I write down seventeen, and just undernea
Re:large function in small code (Score:2, Interesting)
However, the PDP-8 was a 12-bit-word minicomputer that was designed for inexpensive general-purpose computing, whereas the 4004 was (IIRC) a "tiny" 4-bit-word microchip designed mainly for numerical control applications.
I programmed both, the latter for a friend of mine when I was about 15 years old (he later basically got me my first "real" job as a Software Engineer at Pr1me), and the -8 was definitely much easier to program, with a much more powerful instruction set — the code my friend needed written would have been much easier to write, and perhaps even "smaller" (fewer instructions, maybe fewer bits in the instruction stream?), on the -8, though I confess to remembering too little about the 4004 to be really sure about that. (Of course, the -8 wasn't nearly as nifty a machine, instruction-set-wise, as the -11, or as all-out kick-butt powerful as the -10; I wrote much more assembly/machine code for the -10 than for the other DEC systems combined, and actually got to use -10's far more often, at timesharing companies like Comp/Utility and First Data Corp in Mass. where they ran TOPS-10, and at MIT in the AI lab, where ITS ruled!)
So, all in all, I think the calculator-on-a-4004 is probably more impressive than FOCAL or BASIC on the -8, though FORTRAN on the -8 probably was no trivial accomplishment. But I haven't looked at the source/assembly/machine codes myself to make a proper assessment.
(This seems so long ago now. That was around the time a James Bond movie came out with Roger Moore playing Bond. I recall watching it in the theatre, pretty good-sized crowd, and, I think early on in the movie, there's a scene where Bond is in bed and gets some kind of signal or alarm — I forget which — and looks at his watch, which is shown to the viewers and is an early-model LED watch. And I distinctly recall the reaction from the mostly-male audience when he pressed a button on the watch and it lit up with the time in red LED digits: "Ooooooohhhhh!". As it happens, I later became wealthy enough to buy myself a digital watch...but, sadly, not a Lotus Eclipse.)
Re:large function in small code (Score:2, Interesting)
In fact DECUS may have been the very first organized attempt at general distribution of free and/or open source software.
Re:Those were fun (Score:3, Interesting)
to make it a little easier to relate to I said color computer but in fact it was a very little known
clone called the Dragon 32 (which, incidentally as we found out had 64K that you could use if you
pulled a few tricks).
I wished I had known about OS/9 at the time (but this was long before the age of easy access to
information and in Europe).
But hey, why am I feeding the trolls... anonymous ones at that
I guess it is because I wonder what has become of the software scene that we now have f'ing laws
that stop kids from being curious and looking 'inside the box'.
Re:large function in small code (Score:3, Interesting)
1024 Bytes? Bah! (Score:3, Interesting)
LS
Please post this code. (Score:3, Interesting)
People are still writing assembler code for tiny microprocessors. However now it is being done for very inexpensive microcontrollers like the Atmel AVR and the Microchip PIC. This ICs have all their major components integrated (like program ROM, limited RAM, UARTs, and ADC) and sell for about $1-$2. This business is moving to C language as the 32-bit, 128Kbyte memory, 50MHz microcontrollers like the ARM fall below the $5 price.
But constructing code out of instruction sets one byte at a time is still done for very low-end devices like the Atmel Tiny11 that sells for about $0.30 each. At this price, they can replace 555 timers and TTL gates in updates of classic 1970's and 1980s electronic designs.