Tuesday, May 7, 2013

Bidding on the Impossible Job...

I ran across this funny story about someone advertising a request for bids on an impossible programming job – and then getting (apparently) serious responses!

After I was done laughing, though, I started thinking about my very first programming job (that is, programming I did for money).  It happened much as in this story, except that it was before the Internet, so it all happened by snail mail.  Here's the outline:

The year was 1976.  Don Tarbell (founder of the then-famous Tarbell Electronics) had some very successful S100 boards, most especially his floppy disk interface.  He wanted a low cost Basic interpreter that he could sell along with his floppy boards; something that would compete with the dominant Microsoft Basic.  So he placed an ad in a computer hobbyist magazine (probably either TCH or Byte, but I've forgotten) asking for a quote on a Basic interpreter, written using “structured programming” techniques.  The ad was short, and very light on details; I'm sure Don was expecting it to be a catalyst for a more detailed discussion.

At that point I was still enlisted in the U.S. Navy.  Someone pointed out the ad to me, and suggested that I respond.  Those who know me will have trouble understanding just how incredibly naive I was back then about the ways of business.  Well, maybe they'll have trouble :)  Anyway, there were several very good reasons why my responding was completely crazy.

For starters, I had no idea what Basic was.  I'd never seen Basic, never written any Basic programs.  In fact, I'd never used a high level language of any kind.  My entire programming experience at that point was in machine code and assembly language (which, to me, was a high level language - macros!).

Then there was the niggling little detail that I didn't have any kind of programming environment.  I owned a 4MHz Z80 computer that I'd built from a kit, with 64 KB of RAM (woo hoo!).  The 5V linear power supply on that thing weighed about 50 pounds, and the computer put out enough heat to warm up a good sized room.  But there was no mass storage on it, and I didn't even have an assembler program.

Another challenge was that I didn't actually have a business yet, and I knew utterly nothing about contracts.  I also knew absolutely nothing about negotiations, or licensing, or anything else that smacked of business.

What I did know how to do was to write assembly language programs.  I figured that nothing else really mattered much.

So I wrote Don Tarbell a letter.  It was hand-printed in ink on Teletype roll paper, which is what I had at hand.  I wish I had a copy of that letter, but I don't.  It wasn't very long, and I can relate the important details from memory: I told Don that I'd write that Basic interpreter for $2,000, and that I'd deliver it in four months.  I dropped it in the post and forgot about it.

A few weeks later, I got a letter back from Don, telling me that if I could deliver that interpreter by the agreed date, he'd buy it from me.  As I recall, he had just one specific request: he wanted it to eliminate line numbers.  I agreed to his conditions and got to work.

Much later I had a conversation with Don wherein he told me that he had received several bids.  Most of them were for well over $100,000.  The bid closest to mine was for about $50,000.  The fastest delivery time quoted was close to a year, and a couple of them were for well over a year.  These bids were all from companies that routinely did programming jobs.  Don could tell from my letter (posted from the U.S.S. Long Beach!) that I was absolutely an amateur.  He judged it quite unlikely that I could deliver a usable product in the time given, but he also figured the risk to him was zero – so why not give me a chance?  That's the only reason I got the contract.

But back to my project.  The first thing I had to do was to get some kind of mass storage on my system – so I bought a couple floppy disk drives and a floppy interface card from Don.  Then I had to get an assembler.  I found a complete code listing for one in a magazine, typed it all in, got it to work, and then modified the crap out of it.  I added capability for “long” symbols (more than 6 characters!) and lots of debugger enhancements.  All this preparation took about a month of my four months, so I had just three months left.

I got to work.  I got a bootleg copy of Microsoft Basic and just played with it until had learned what the Basic language was all about.  I had no idea how to write an interpreter, and I had no reference material to work from.  There was no Internet for me to Google.  So I just thought about how to make one, and started writing code.  All my assembly language experience served me well during this work.  I understood a lot about how to write compact and efficient code, and I understood the capabilities and limitations of the Z-80 (that was my target machine) very well.  Interpreters for a simple language like Basic are actually quite straightforward beasts.  You don't have to worry about concurrency, for example.  The challenges were mainly in getting the code small enough to fit easily in 16 kb or less of RAM while still be fast enough to be useful. 

As things turned out, I spent most of my development time in two areas: the floating point math package, and the string package.  I probably spent two solid weeks simply on printing a formatted number.  Those areas were really the only parts that turned out to be difficult to write.

I wish I'd kept the notes and “design documents” for all that work, just to amuse myself (and perhaps others).  The designs were all done in my own made-up pseudocode, in pencil on scratch paper.  The pseudocode mostly made it into the assembly language comments, which helped when debugging.  I made liberal use of macros for some of the common structured programming constructs (such as  a “while” loop). 

Don would call me every few weeks, I suspect just to see if I'd given up yet.  As the delivery date approached, Don started to sound a little excited – the list of remaining Basic commands to implement started getting quite short.  In fact, I finished them all by about three weeks before the delivery deadline – but of course I had numerous bugs, some of them quite nasty “crashers” that would take out the entire system.  For that last three weeks or so, all I did was test, debug, and fix, in a cycle that seemed to repeat endlessly.

Just a couple of days before the deadline, I started to gain some confidence that I had built something deliverable.  My test programs were largely working.  There were some performance issues (especially with transcendental functions, like sines or logarithms), but in general my interpreter was faster than Microsoft Basic.  That really isn't an apples-and-apples comparison, as the Microsoft interpreter worked on 8080 machines (which the Z80 was compatible with, but extended).  I took advantage of the extra power of the Z80, which by that time dominated the personal computer scene.  But still...to beat Microsoft at that game felt pretty good.

I didn't sleep at all for the two days prior to the deadline.  I spent that entire time polishing every little thing I could.  Then I climbed into my beater of a car and made the drive up to Carson, California (a hundred miles or so north of where I lived at the time) to deliver it to Don.

When I walked into his shop I was  entranced.  Hardware was everywhere, and there were dozens of floppy systems set up for assembly or testing.  Don dropped everything else and we sat down together to install and demonstrate the interpreter on his system.  We had no trouble at all, really. He typed in a few short test programs, and got a big grin as they all worked just like he expected.  He then told me he had a “test suite” (something I'd never heard of at the time :) that he'd written and wrung out on Microsoft Basic, and he wanted to try it on mine.

That was a terrifying moment for me.  Once he'd explained what the test suite was, I instantly saw both the utility of it and the nearly infinite possibilities it provided for failure.  I was agonizing about this as he loaded up that test suite and kicked it off.  It printed out its progress as things went along, with the name of a test followed by “OK”, “Error”, or “Delta”. after it.  The “Delta” meant the result was different than Microsoft Basic, but not necessarily wrong.  As I recall, his test suite had about 200 tests in it, and the results were about 150 OK, 10 Error, and the rest Delta.  I was behind Don as he ran this, so I didn't know how he was reacting until he turned around.  He had an ear-to-ear grin, stuck out his hand for a handshake, and said “Accepted!”  Later he told me that he expected it to crash on his test suite, and that he was astonished to find it in such close correspondence to Microsoft Basic.  Whew!

Don handed me a check for $2,000 and took me out to lunch.  He then asked if I'd be willing to contract with him for enhancements and bug fixes.  My assumption was that the bug fixes were my responsibility, so when he said he was willing to pay for them I was very happily surprised :)  That started a collaboration that lasted several years.  Don kept coming up with ideas for enhancements, and we constantly nibbled away at performance issues.  He was delighted to be able to boast that Tarbell Basic (as he named it) was faster than Microsoft Basic, even though that wasn't one of the initial requirements.  That collaboration is what got me started on a career in software.  What a start!

Tarbell Basic never was a big commercial success for Don.  I know he got some satisfaction from it, though, and he did more than recover his costs.  After Don was done with enhancements, another company (the now-defunct NH Research) decided to use it for their line of automated power supply testers, based on the IEEE-488 bus.  They wanted some enhancements specific to their needs, and they contracted me to provide them.  So that project provided me with much-needed income even after Don was done with it, into the early '80s.

For years afterward, I assumed I'd never hear about Tarbell Basic again.  But then came the Internet, and some (crazy!) people who decided it would be a good idea to write simulators for Z80s and CP/M that ran on modern computers, and to curate all this ancient software.  There's a sizable community of these folks, and they've collected a large number of software packages – including Tarbell Basic (Don eventually put the source code for it in the public domain).  My name is all over the source code, and my name is easy to Google – and it wasn't long after that that I started getting queries from these new/old hobbyists.  Probably I've averaged two or three queries a year since about 1996; the last one was just last week.  Sometimes the queries are questions, sometimes requests for enhancements or bug fixes, and sometimes angry accusations about my incompetence (that's what the most recent one was :). 


I don't have any interest in running that old code myself.  But I sure wish I had those old notes!

No comments:

Post a Comment