Thursday, February 25, 2010

The Job Tracking System in BASIC

It was time to put my new SBASIC tool to good use. Bob wanted a new tracking system to replace the old TRS-80 one. We decided to use one of the Kaypro II machines for this. I'm a little fuzzy on whether Bob started this one and handed it off to me, or if I was the developer from the get-go.  Regardless, this project was a showcase for what could be done with the BASIC programming language.

This was a pretty easy application to build. There were a dozen or so departments on the factory floor. Each time a new job was ordered there were some essentials entered like job #, customer name, board type, due date, etc. and these were just stored in a simple random access file. Several times a day a young lady from Brazil named Danusa would make rounds collecting information about jobs and where they were in factory. Then she would come back and enter this information. Status reports would get printed out.

C.F.C. specialized in quick turnaround orders. Anything we could do to improve information about important rush orders was critical. A more timely tracking system was in our sights. We took one of the Tandy Model 100 portables and bought a barcode wand for it.  A data collection program for it was written in BASIC.  This would be used to collect the locations of all the jobs. I wrote a program in the tracking application for printing 3 of 9 bar code on label stock using an Epson compatible dot matrix printer. These had job numbers on them and we stuck them on the job bill of materials sheets that went with each order. Then we printed large bar codes for each department.

So now all Danusa had to do was go to a department, scan the bar code on the department sign, and then go to each bill of materials sheet and scan in the job number bar code. Then she would repeat this with each department. When this was done (and it was a lot faster than using a pen and clipboard) all she had to do was come back and we would read the information into the Kaypro II using an RS-232 cable and we would just suck that information into the tracking system and print the reports.

It really stands out to me that this sort of very useful application programming was easily achievable by a high school graduate with a knowledge of BASIC.  For a good while we used this system to expedite manufacturing.   End users used to do this kind of thing a lot more back then and I'm sure that Bob could easily have written this himself if he were so inclined and it he weren't so busy running the company. People should take more interest in programming because it's fun, it teaches important thinking skills and even untrained programmers can accomplish real productivity enhancements.

The SBASIC Preprocessor

I had become familiar with structured programming ideas from my casual experimentation with Forth. I wanted to do something to improve the quality of my Microsoft BASIC programming. I realized that I could write a program that would take BASIC source code without line numbers, and adding in named labels for the GOTO and GOSUB targets and output line numbered BASIC. Then I could run this code in an interpreter or compile it. This was a cool idea for me. After having done the CNC simulator this lit up a part of my brain that brought me closer to realizing that a compiler is just another kind computer program that treats source code as data.

I wasn't familiar with QuickBASIC at that time, so I didn't use Microsoft's syntax for this. Instead I used square brackets for branch labels like so:

[loopHere]
a = a + 1
print a
if a = 10 then [quit]
goto [loopHere]

[quit]
print "done."
end

Liberty BASIC programmers will recognize this syntax. I called this preprocessor SBASIC for Structured BASIC.

Here's what it looks like in QuickBASIC:

loopHere:
a = a + 1
print a
if a = 10 then quit
goto loopHere

quit:
print "done."
end

I think that my syntax is better. It certainly is more consistent because in QuickBASIC the branch label will either be quit or quit: but in SBASIC it is always [quit].

So here we see a direct precursor to Liberty BASIC. At this time I did not have plans to create my own BASIC. That wouldn't come for four more years.

Monday, February 22, 2010

The Job Does Has Its Perks

When I got promoted to computer programmer they moved me out of the engineering area and into the room next to it. They also gave me a desk and bought me a computer. This was a Tandy 1000SX, sporting a 7.16MHz 8088 processor, 384K bytes of RAM, two floppy drives and a 20MB hard card (a hard drive that is mounted on a frame in line with the controller card).

This was a slightly quirky machine. Tandy was used to producing their own designs, and their IBM PC clones up to this point were attempts at going their own way. As every computer manufacturer was learning it really didn't work to make an almost IBM compatible computer. The 1000 series was their first really compatible line. Even so they stubbornly kept their own keyboard layout from the Tandy 2000. I even needed to draw some missing symbols on keys with a permanent marker. The printer port was just circuitboard fingers on the motherboard instead of the popular Centronics printer connector.

The machine had CGA graphics and a green screen monitor. This would prove to be very important to software I would write but I couldn't imagine at this time where this would lead.

101 Things You Can Do With a Floppy Disk

C.F.C. hired a college student for the summer of 1987 to operate their TRS-80 system which had three 5.25 inch floppy drives. The young student (he might have been older than me) would sometimes come to me when he had computer questions or if the machine wasn't working perfectly.

So, one day he comes to me and says that he's getting errors from the floppy drive. Okay, I followed him over to the computer. He reaches over and perfectly naturally reaches down, opens the drive and pulls out the disk... backwards! The disk was in the drive backwards, and his fingers were touching the magnetic disk through the access hole. I wasn't ready for that, and I don't think he was ready for my surprised outcry!

The good news? Even with fingerprints on the disk surface the data was still intact. The disk read fine when it was reinserted correctly.

Sunday, February 21, 2010

CNC Machine Simulator

The two Osborne 1 computers we were using in engineering were getting a bit worn, so Bob sprung for some Kaypro computers. I don't think they appeared all at once but soon enough we had two Kaypro II machines and one Kaypro 10. The Kaypro II's were similar to the Osbornes but with bigger screens. Now we had 80 columns of bright green text. The Kaypro 10 also had a built in 10MB hard drive.

One really important difference with these new machines is that they had block graphics characters, and you could plot lines and points. This wasn't high resolution but it was good enough to inspire me to write a simple interpreter for the CNC programming language. Remember how I tried to write a programmable calculator program for my VIC-20 but never finished it? This interpreter was the realization of ideas that I'd been kicking around for a while. I wrote this as an extension of the machining text editor in MBASIC.

Now we could run a rough simulation of how a routing or drilling program would work and see the result on the screen. There was no fine detail, but it was easy to see if we accidentally drilled outside the board, or if a panel would be ruined by an accidentally placed cut. This certainly saved time and money because we were able now to make fewer first pieces so the single head Excellon machine and it's operator were more efficient.

Friday, February 19, 2010

Moving Up

A few months into my new job at C.F.C. I wrote an application for Tina in accounting. She had the only computer in the building that had a hard drive. It was an Epson Equity which is an IBM XT clone with a monochrome green screen and a 20MB hard drive running MS-DOS 2.11. I'm guessing a heard Tina and Simone (who is Bob's wife and VP of the company) talking about a need, and I must have offered to craft a solution for them. Simone probably asked me with surprise, "Can you do that?" I was eager to jump right in. I'm pretty sure that GW-BASIC was already installed on the computer. :-)

Up to this point my programming work for engineering and accounting was done on my own initiative. I wasn't trying to attract attention, but Bob noticed my enthusiasm for software development. He is an open minded person, and his whole business was personal and informal so he must have found it easy to promote me out of engineering. I became the company's in-house computer programmer. That was quick! I didn't get a pay raise but how could I complain? This was exactly what I wanted and it was an opportunity for him too.

This is the sort of business that just begs to be automated. Bob certainly knew this. One programmer could keep himself busy with interesting work for many years and I was the lucky fellow.

Thursday, February 18, 2010

My First Text Editor

Using a word processor to edit CNC programs didn't seem quite right to me, so I decided to write a text editor especially for editing drilling and routing programs. I had never written a text editor before, but I had a pretty good idea how to go about it. The Osborne 1 had a terminal style display, so there were control and escape sequences for inserting and deleting lines and characters which makes it pretty easy to write a screen editor.

One thing that motivated me to write this editor was to save time. Sometimes it was really useful to be able to mark of bunch of drilling coordinates and move them or make copies at an offset. My editor made this easy to do.

I wrote the editor in MBASIC. I'm pretty sure it was also compiled to a standalone application using BASCOM. This was in a before IDEs, and programs needed to be compiled and linked.

The Osborne 1

The Osborne 1 was a portable CP/M computer with a Z-80 processor. It looked like a portable sewing machine. You tip it on its side and undo the latches and the end would come off revealing a keyboard which was attached to the rest of the machine by a wide ribbon cable. Removing the keyboard revealed two large floppy drives, a tiny 5 inch screen, cubbies for floppy disks, and a bunch of ports. We would plug the RS-232 cable from the paper punch into one of the ports.

The 5 inch screen could only display 52 characters wide, but it could scroll. You had to have a tolerance for reading very small type to use this machine. I was okay with it, but today I probably wouldn't enjoy it.

Aside from editing CNC programs, we also had MBASIC on these machines and so we could do a little programming to help us with our work. Bob knew how to write in BASIC and he had written a few things. For example there was a program for spitting out a simple routing program for a rectangular board. You just punch in the size of the board and it would generate a file. Anything more complex than that required manual coding.

One problem we had with the Osborne 1 machines we had was that the keyboard bezel was metal and it wasn't grounded well. If you walked up to the computer and touched the keyboard it wasn't unusual to discharge some static electricity and reset the computer, losing whatever work you were doing.

Wednesday, February 17, 2010

Paper Tape

When there was a mistake in a long CNC program, sometimes it was easy to tell that it was a mistake at the beginning of the program. Rather than read the whole thing in, edit it in WordStar and then punch a whole new tape, sometimes it was easier to repair the paper tape itself.

Usually you could just create a new section of paper tape, and then you unroll the tape to the section you are looking for and splice in the change. With some practice it wasn't too hard to read the binary numbers by eye. Instead of ASCII values, CNC programs were punched to tape using EIA (Electronic Industries Association) codes.

In some instances if you didn't need to change the number of characters, but just which values (change some digits for example), you could just cover the holes with tape and punch new holes. I think I did that at least a couple of times.

So, this all seems very archaic right? On the plus side you really had control over the stored data. Today if your disk drive or your flash memory loses a bit you can't even see it let alone fix it. ;-)

Tuesday, February 16, 2010

Welcome to the Machine

Or welcome to the machines as it were. I think there were four Excellon drilling and routing machines at C.F.C. One of them had just a single head and was used for making first pieces to test for errors in the drilling and routing programs.

So my first job was to learn the programming language for these machines. Bob Spain and a young lady named Kristen Van der Laan were my teachers. This is no high level programming language, but more like a machine code of sorts. Circuitboards are still drilled and routed this way today more than 20 years later.

Here is an example of a very short Excellon drilling program. The actual language for CNC machining is based on commands used to control Gerber Scientific plotters:

M48
T1C0.028
T2C0.032
%
M48
G05
M60
T1
X2.550Y1.550
T2
X2.600Y1.650
X2.600Y1.750
M30

That drills just three holes of two different sizes. Writing programs to drill holes wasn't really the engineer's job. We mostly wrote programs to cut the boards out. Most of these were simple rectangles, and the program for this wasn't much longer than the example above. Sometimes boards would be circular, or have odd shapes. Some would have chamfers, fingers, slots, large inner cutouts. There was great variety. Sometimes we would make palletized panels which have more than one circuitboard. The routing was designed to leave only small perforated spots to hold it all together, and the boards would be removed from the panel either by hand or by machine.

We would write a program for routing using WordStar and then save it to a floppy disk. Then we would send the program out to the paper tape punch machine. The tape was usually gray, blue or pink. There were little tiny round pieces of colored paper all over the place.

A finished program would go out for a first piece to make sure it was correct. If you left just one digit out of a routing program the machine could destroy the panel, cutting straight through the middle of it.

Saturday, February 13, 2010

A Cornucopia of Computers

So I joined the engineering group at C.F.C. Our job was to write and debug CNC programs for the Excellon drilling and routing machines. Most of the programs were written using WordStar on Osborne-1 and Kaypro CP/M machines. We did not use hard drives to do this work, and the final medium of storage was punched paper tape. Yes, really! That was the format the machines used, and we had a storage library for keeping the tapes.

There was one Macintosh in engineering for special purposes, but here again I never used it.

There was a TRS-80 used for managing job tracking in the factory. It had the standard silver expansion box and three floppy drives.

Accounting had an Epson PC clone (or was it a Leading Edge Model D?), and there were a couple of Tandy Model 100 laptops that look like Alan Kay's Dynabook prototype.

Things were about to get interesting.

Friday, February 12, 2010

A Fortunate Series of Events

In the spring of 1986 I discovered something that would change the direction of my life completely. I had been reading the Bible a lot in my teen years, but I didn't have a church community that fit what I understood from my studies until I found the Boston Church of Christ.

Late that year I decided to move in with some other young fellows from the church in Newton, but in order to do this I needed to find more regular paying work. I continued to work with Mr. Alessi but I began to look for a job. For some reason in the cold early spring of 1987 I worked for a few weeks at McDonalds and then suddenly I found an ad in the local paper. I remember the ad was titled "Programmer Trainee".

I went in for an interview. The company was called Circuitboard Fabrication Company, or C.F.C. It was hidden neatly in a neighborhood right next to a grade school in Newtonville. The president of C.F.C. was Bob Spain. He explained that this was a job programming CNC drilling and routing machines which are used to cut circuitboards out of fiberglass sheets. I told him that I was interested in developing computer programs and he responded that I may have an opportunity to do some of that at C.F.C. Small business owners like Bob Spain and Patrick Alessi are so openminded. :-) He offered me $5.50 an hour, and I accepted the job.

I began my new job taking the bus from Needham center to Newtonville because my car had broken down. Then after a few weeks I moved in with the guys from church. I only took with me what would fit in one carload. My new home just happened to be walking distance from C.F.C. It was very easy for me to see the hand of God in this arrangement.

I was surprised to learn soon after starting my new job that Mr. Alessi had used C.F.C.'s services to produce the circuitboards I had been assembling for two years. I had notice the marking CFC-1 on the boards and now I understood what it meant.

How I met the transistor

When I was perhaps 11 years old my father brought me home a book, and what a book it was! It was a red covered paperback titled Transistors, and I think it was published by Tab. The book was a perfect introduction to semiconductors for the neophyte. It was peppered with cartoon characters and helpful diagrams. The wonders of doped germanium and silicon were laid bare. PN, NPN and PNP junctions, holes, valence electrons and more all demystified. I already had a basic understand of what a transistor was, but until I read this book I really had no idea how they worked. The book blew the door wide open!

This was obviously a well written book to be suitable for an 11 year old to grasp and the information has stuck with me even after all these years. Thanks Dad! Now where did I leave that book?

Thursday, February 11, 2010

VIC-20 Blues

Here's an embarrassing story. One day I got the bright idea to put my VIC-20 on my lap and then I put my nearly new black and white television on a milk crate on the floor in front of me. I sat on a chair in front of it and wrote code. This would have been awkward I suppose if not for the fact that the VIC-20 had only 23 rows of 22 characters. The letters on the screen were huge, so the screen could be rather far away and I was comfortable.

Alas, I put my foot on the corner of the milk crate. At some point I shifted my weight to get comfortable and unwittingly kicked the television over backwards. It fell only about a foot to the floor. The back of the plastic case was so close to the back of the cathode ray tube that the case only needed to deform slightly to press against the tube. The back of the tube snapped off and it was ruined. The phosphor on the front of the screen was removed by the action of the gasses rushing in and you could see inside. What a disappointment, but it was a good lesson for me.

I never found an opportunity to replace the TV, and I never used my VIC-20 again and all these years later I don't remember what happened to it.

Tuesday, February 9, 2010

On the Road in a Green Bug

In addition to the East Coast Video in Brockton, we picked up a second customer for our video rental software in Somerville, Massachusetts. It wasn't unusual for me to drive myself to these locations in my forest green 1965 VW Beetle. Sometimes there were bugs that needed fixing and sometimes they wanted enhancements. There was at least one evening when I was at the Somerville store late into the night.

These two customers were the very last work I did with Patrick Alessi, and the only real money I made with him aside from the circuit assembly work he provided. Perhaps if we had managed to sell to more stores I might have continued to work for him, but my life was about to take a turn in a totally different direction.

Soldering my way to Israel

Patrick Alessi wasn't just interested in the software business. He was an electrical engineer. There was a company up in Wilmington, Massachusetts called Cryovac. They made machines that shrinkwrapped fruit, and presumably other things too. Mr Alessi had managed to win a bid on some business to provide them with electronic controller boards for their machines. There were two different boards, and he offered me a chance to make some money assembling and soldering them together. It's amazing to me how I was able to memorize where hundreds of parts should be inserted and soldered into place. The more I worked the faster I got and the more money I made.

In my junior year of high school I had met a very sweet girl who was a foreign exchange student from Israel. Her name was Michal Zilberman. I began to spend a lot of time with her and we became very close. When she went back home we wrote back and forth a few times and I called her on the phone once in a while. I decided to visit her the following year.

I would pay for the trip by assembling circuitboards for Mr. Alessi. It only took me a few weeks to earn the $850 or so dollars I needed for the plane ticket. When my folks noticed what I was doing and that I had obtained a passport they figured I wasn't ready to be a world traveler (probably true) and they sent my grandfather with me. He had always wanted to go to see the Holy Lands, so he was eager to go. When we got to Tel Aviv we didn't actually see each other very much. He was a great traveling companion and we did enjoy some time together and he let me beat him at checkers. When he took off to go on tours including a diversion to Egypt, I enjoyed exploring Tel Aviv with my camera in the mornings and then I would walk to Michal's home and see her family. We spent a few days together in Tel Aviv seeing the city. The we went to stay with her sister in Jerusalem for a few days and spent a day in Haifa.

My relationship with Michal was not meant to be, but this was an unforgettable adventure.

Monday, February 8, 2010

Mis-adventures in PDP-11 Programming

I mentioned earlier that I didn't become much of a Pascal programmer, but I neglected to mention one very important reason. We were too busy messing around. Brice Illingsworth (I hope I got that right) managed to get copies of all the manuals for the PDP-11 and the RSX-11 operating system. The most useful thing we managed to produce with these generously donated manuals was a simple internal email system. Pretty amazing when I think back on it.

However, we did almost get ourselves into some real trouble. Brice had the brilliant idea that we should create a mock login routine that would capture people's account information into a file and then present a login error and then quit to a real login. We managed to capture a few passwords before someone noticed our little mischief. Thankfully he gave us a wink and a nod and we didn't repeat this bad behavior.

Since graduating from high school I have not used a PDP-11. I just checked ebay.com and found a DEC Digital PDP 11/03-LK Rack Mount Computer for a mere $203. I'm sure I wouldn't know what to do with it. ;-)

Sunday, February 7, 2010

My own Commodore 64

One of my close friends Jeff Benitz (whom I had originally met years before at Radio Shack while playing with their TRS-80s) bought a Commodore 64. I went with him to Westwood, Massachusetts to buy the used computer. It included a monitor, a cassette deck, and a dot matrix printer. We enjoyed staying up late into the night playing a game called Telengard, which was a popular Dungeons and Dragons style game. I seem to remember we went to Toys R Us to buy the game back when you could buy tons of software for this machine in the stores. Telengard was written in BASIC, and we figured out how to break into it to modify it. Terrific fun (if you ask me).

One other cool thing I remember doing with this computer was writing a custom routine to reprogram the custom graphics characters on the fly to draw detailed images. This was in BASIC. It was slow but it worked.

Eventually Jeff sold this computer to me. I didn't use it for much and after moving a couple of times I tossed it because I couldn't find the power supply. Oops. What was valuable became obsolete and disposable. Nowadays I wish I could find the time to rediscover the simple joy of programming old home computers.

Saturday, February 6, 2010

Computerized Cameras

Nowadays most everyone uses a digital camera without film. Back in 1983 I became involved in the old fashioned sort of photography. My brother Neil sold me his Canon FTb-n camera and a couple of very nice lenses. This was a completely mechanical SLR camera, the only electronic part being the meter which was a real meter with a physical needle that swung back and forth in the viewfinder.

A couple of years later my brother sold me his Canon AL-1. This was a smaller camera based on their popular AE-1 model. It had a computer in it, and needed batteries just to fire the shutter. It also had an early autofocus system. It didn't actually turn the focus ring on the lens with a motor like modern cameras do. Instead the computer in the camera controlled a red LED in the viewfinder to tell you to turn the focus one way, another red LED to tell you to turn it the other way, and a green LED in the middle to say that focus is achieved.

This was a nice enough little SLR I suppose, but it wasn't as durable as the FTb-n. Also, the batteries didn't last very long.

My attitude at this time towards computers in cameras was "computers are wonderful computers, but computers are not wonderful cameras." I still feel this way about computers in automobiles, but digital cameras have finally come into their own. I still love film, but it's too expensive now.

Friday, February 5, 2010

The Macintosh and its Imitators

While I was busy learning how to develop software for the IBM PC and it's copies, Apple was marketing a complete new kind of computer called the Macintosh. I didn't know anybody who owned one, and somehow I never found my way into a computer store to try one out. My only experience of the Mac was what I read about it in magazines. It certainly looked cool and amazing.

To me it was a very distant phenomenon, sort of like a distant land. Very exotic and unreachable. One thing seemed clear from what I read. Programming a Macintosh required a different way of thinking about software. Microsoft did produce a version of QuickBASIC for the Mac.

Other manufacturers were working hard to create their own Mac-like products. Atari has their ST computer with GEM desktop. Commodore announced the Amiga which had a similar windowing system as the Mac. Microsoft was demoing their very primitive early version of Windows as far back as 1985. Berkeley Softworks released GEOS, which was a Mac style operating environment for the Commodore 64, the Apple II, and later on the PC. Nowadays you can still buy the PC version which is sold by its new developer Breadbox Computer Company under the name Breadbox Ensemble.

Wednesday, February 3, 2010

East Coast Video - Communications Breakdown

Our friend James Foster had found us some contract work. A video rental store in Brockton, Massachusetts wanted to get out of their 3x5 index card system and into a computerized one. The software was going to run on an IBM PC clone with two floppy drives. This was to be a pretty big project worth thousands of dollars. I went with James to meet the owner of the store. He began to explain what he wanted. I would ask him questions to try and clarify the details and I took notes. He was very enthusiastic about our designs.

I went back to Mr. Alessi's house and with great energy proceeded to build this system. We wrote and debugged it using the BASICA interpreter and then created binaries with the IBM BASIC Compiler. It had to manage a catalog of customers, and catalog of video tapes, and also keep track of who rented what, and for how long, and how much that cost depending on what category of movie it was. It also had to calculate total charges including taxes, and of course the cashier had to be able to override the price.

One month later we were ready and we took the system to Brockton. Wouldn't you know it, the system was not anything like the way our customer was expecting even with the long design session together. So, now equipped with the knowledge of what they didn't want we sat down for another design session.

The software needed to be rewritten from scratch, and this time they wanted in a week! I spent the next week working late into the night to create the new system. When we were done and showed it to the customer we were relieved that he was happy with the result. We just needed to deal with some minor tweaks and some performance optimizations.

In retrospect this would have gone a lot better if I had developed the software there in the store. That way we would have learned very quickly if we were straying from the customer's needs.

Tuesday, February 2, 2010

Noisy Calculator, the SR-56

One very interesting feature of the Texas Instruments SR-56 calculator was that it was noisy. I know that sounds strange, but if you held it up to your ear you could hear some quiet humming noises. If you used a trig or a log function it would change the sound as it worked out the answer. I can't think of any other digital devices I've ever owned (actually this particular calculator belonged to my brother Billy) that make noises you can hear. Sure, you can hear your cell phone blasting out data packets over your stereo or PC speaker system, but that's radio interference. This was actual audible noise. I wonder if they made any other noisy calculators back then.

Monday, February 1, 2010

Pocket Computers and Programming

My brother Ernie was a fan of the Radio Shack pocket computers. He started with the original pocket computer. This was a neat little machine with a QWERTY keyboard and a BASIC interpreter. This was a real step up from a programmable calculator. Later on he bought their Pocket Computer 2 model. I think this model had two microprocessors, and you could draw very simple pixel graphics with it. You could save your programs to tape, and there was a printer for it. My brother managed to discover a machine code monitor in that model and he was experimenting with that. This reminds me of what another friend of mine told me about the first model of the HP-41 calculator, that it was possible to program it in machine code in an undocumented way.

Today these pocket computers would seem quite primitive and wanting, but for many purposes even today they would be very useful. Of course nowadays people expect their pocket devices to have Wifi and Internet access. What was great about these machines? They shared the same approachability as home computers like the VIC-20 and TRS-80. Just by reading a simple 100 page manual you could learn how to make the computer do your bidding. Want to be a programmer?

You + pocket computer + 100 pages of reading = programmer