Monday, March 14, 2011

Power BASIC and the Uncrashable Kingdom

I had it in mind to use Power BASIC as the compiler to implement the new DOS file server for the factory. This was a new, slicker and rebranded version of Turbo BASIC which I had been using for a while. It wasn't cheap. Power BASIC was a nicely polished compiler and had good documentation. I think we paid $300 or so for it.

I wanted to create a nice UI for the file server so I purchased a windowing library for Power BASIC. It made it easy to create text mode windows using graphics characters. The way it worked was very similar to the way that a Windows programmer would do it in C. You called functions which created windows, buttons, etc. These would return a numeric handle.

Your program would intercept messages from the UI library in an event loop and act on them. Each message would include the handle for the window or widget it was about, and also a value for an action such as a click or a key press. This is not an easy way to write windowing code, but the file server would have a simple enough UI. The end result looked nice and was functional.

I learned a lot on this project. This must have been the highest quality BASIC code I had written to this point. It was a multitasking file server using state machine techniques. Unlike its Xenix based predecessor, this file server never crashed once we had it up and running. Never.

Saturday, March 12, 2011

Hacking a file server

No, I'm not talking about hacking an Internet file server. At CFC, Inc. we kept the CNC drilling and routing programs on a file server running Xenix which was a Microsoft branded version of Unix. The CNC machines were plugged directly into this file server using RS-232 ports. Until we purchased this server we had been keeping all our programs on punched paper tape and stored on shelves but now we could keep all this stored electronically.

Okay, this new way of doing things would have been great except that the file server cost lots of money and it wasn't reliable. Every so many weeks or months the computer would crash for one reason or another. When this happened it would run fsck on bootup. This would sometimes find some file system records to repair because the machine didn't have a chance to write everything to disk when it crashed. The end result? We would sometimes lose files from the file server. Bad, bad and worse because all our backups were on tape and we had really bad luck restoring from tape.

We didn't want to spend any more money on this file server. I wanted to develop a replacement in house. It would run on DOS which didn't have the bad habit of delaying writes to the file system. Not bulletproof, but bullet resistant and cheap. But, I had a problem. The only documentation I had which explained the communication protocol for the file server was very thin and hard to understand. I was stuck.

Remember the RS-232 monitor that I grabbed at the GTE auction? I knew right away how useful it would be for this project! Back at the factory I installed this monitor between one of the CNC machines and the Xenix file server. With the ability to see data moving back and forth I was able to figure out how the file server worked. It was tricky because data was actually delivered in packets. There was a non-trivial conversation that happened between these machines but it looked like the code for this was going to be fun to write!

I was ready to get started!

Tuesday, March 1, 2011

An Auction, an RS-232 monitor and an Apple Lisa

My father called and told me that GTE was auctioning off old equipment. Me and my friend Ray took a break from work in the middle of the day to see if there was anything useful we could use at the factory. There was.

A piece of equipment about the size of a small benchtop oscilloscope caught our attention. It had a 5 inch CRT display, a flat panel keyboard on the front next to the screen and a ribbon cable with a pass-through 25-pin D connector. It was an RS-232 monitor! When I realized what it was I had to have it for a project at work. The idea is that you place this device between devices and it allows you to spy on data that goes back and forth over the serial line. It displayed data in both directions, and you could see it as text or hexadecimal. The price? If I remember correctly I paid $35 for it. Amazing!

I also managed to buy an Apple Lisa computer for $25, but it didn't come with a keyboard. Luckily I noticed the keyboard on a palette of keyboards. I talked to the fellow who won that palette and convinced him that the Lisa keyboard wasn't valuable to him without the computer, and he let me have it.

This was a huge win. I still have the Lisa computer.