Sunday, January 31, 2010

Pascal on the PDP-11

When I was a junior I transferred from Xaverian Brothers High School to Needham High School. One of the great things that NHS had was a DEC PDP-11/40, and there were several classes you could take in order to access this minicomputer. I enrolled in the APP Computer Science class, which was essentially a course in Pascal programming.

I'm guessing there were at least a dozen terminals on the school property. I remember four Lear Sieglar ADM-3 terminals and two DECWriter dot matrix terminals in the room where we studied Pascal. I'm sure there were a bunch more in other locations, but I never saw them. I never saw the PDP-11 either, but I'm pretty sure it was there. ;-)

The experience was pretty sluggish. To compile a very short Pascal program took 15 seconds at least. If you made a mistake in your code it would give you a cascade of error messages. It took some practice to figure out what the errors meant. The computer system was so slow we didn't actually get to be very good at Pascal because the maintenance guy would kick us out of the building just 20 minutes after the end of the school day and before anything interesting could get done. Ah well, I had a good time.

Saturday, January 30, 2010

Enhancing Your Apple II

Back in the day friend Richard Stoddart loaned me a book titled Enhancing Your Apple II by Don Lancaster. Mind you, I didn't even own an Apple II but I was very interested in learning, and the book seemed promising so I took it home. The author Dan Lancaster was a popular writer and quite an Apple II guru. My understanding is that he was part of the same computer users group that Steve Wozniak, the creator of the Apple II belonged to. The contents of this book are certainly compatible with the idea that he had an insider's caliber of insight.

The book starts off with some really neat but simple modifications to the motherboard of the Apple II. The kinds of modifications described were things like adding a single wire to connect together circuits that would otherwise not have any knowledge of each other. Then he explains how with this and some simple software tricks you can do multimode graphics and high resolution text. He even shows how to do this from an Applesoft BASIC program by calling some machine code he provides in the book. Very nice.

Later in the book he explains how to disassemble machine code and figure out how a machine language program works so that you can make modifications. What an excellent education!

There is also supposed to be a Volume 2 of this book, but I'm not sure what it contains.

Friday, January 29, 2010

Whoa Daisy!

I don't know if we were quite prepared for the noise and vibration of the daisy wheel printer that Mr. Alessi bought. This kind of printer was called a daisy wheel because it has what looked like a black plastic flower with the letters and numbers on the petals. This sort of device was borrowed straight from typewriter technology. To print each letter the wheel would spin around and a hammer would knock the desired petal against the paper. It would also rapidly shift up and down because there was more than one symbol on each petal. The wheel assembly would swing back and forth energetically (zooming is a good word for this) as it printed each page. It was loud, and it would shake the table like a bucking bronco! It was intolerable. The printer did produce nice clean and smooth black characters on the page, so we kept using it. The solution to all the noise and vibration was to sit the printer on top of a very large and thick piece of mattress foam. This worked a lot better than it probably should have.

Thursday, January 28, 2010

Enter IBM

After I had worked on a couple of projects on the Apple II+, Mr. Alessi decided it was time to develop software for the IBM PC. I think he bought his at the Sears Business Systems Center in Natick, Massachusetts. He purchased one with two floppy drives, an expansion unit housing a 10MB hard drive (the first one I had ever used), and a green phosphor monitor. He also bought a daisy wheel printer so we could produce letter-quality documentation for our software.

I enjoy discovering a new computer, but my initial impression was not all positive. The machine was big and expensive. It felt slow. This didn't make sense to me because even though the PC's 4.77MHz Intel 8088 processor was clocked at nearly 5 times higher than the 1MHz 6502 processor in the Apple II+, the Apple felt much, much faster. Steve Wozniak's hard work on the Apple II+ was clearly more efficient in many ways.

In addition, the computer came with PC-DOS 1.10. I was expecting something more advanced than CP/M from IBM but was disappointed. In fact PC-DOS seemed to me to be nothing but a ripoff of CP/M.

Overall, this computer was underwhelming. With IBM behind it this design would be copied widely. The variety and innovation in the microcomputer market was slowly wiped out by this computer and its imitators.

Wednesday, January 27, 2010

Rumblings of the Future

One formative project I started but never finished on my VIC-20 was a programmable calculator program. I got my start programming the HP-67 calculator, and I've always been fond of these little pocket sized computers so this was my inspiration for this project. This was going to be the simplest interpreter you could write in BASIC. I didn't bother to sit down and design it on paper first. I just starting coding it. Really, I can't remember much about it except that I was motivated to give it a try. I didn't get very far.

Another idea I've always been very interested in pursuing is to create a robot battle programming system like Robot Wars on the Apple II. This is similar to CRobots for the PC. It's a very simple real-time simulation of two or more robots duking it out in an arena. The robots search and destroy each other by executing battle programs written by a human user.

I never finished my programmable calculator. Years later on I would go on to write different kinds of interpreters and some similar things in connection with paid work, and ultimately Liberty BASIC and Run BASIC.

Programming languages have always fascinated me, and I enjoy reading books and articles by other programming language implementors to improve my understanding of the field.

Monday, January 25, 2010

6502 Assembly Language

My brother Ernie is a little more than a year than I. He was ahead of me in the programming department when we were kids, and my first exposure to assembly language was through a book he had on Z-80 assembly language. I never did have an opportunity to try Z-80 assembly, but when I had my VIC-20 I decided to try 6502 assembly language. I didn't find machine language hard at all to grasp because it seemed very similar to the language used to program calculators, especially the HP-67.

I was a regular reader of COMPUTE! magazine, and in one issue they included source code in BASIC for a 6502 machine code monitor. This was a far cry from an assembler, but it was better than nothing. I wanted to try speeding up a side-scrolling video game, so I decided it made sense to write an assembly language routine to move characters from the right to the left by one character. This is how video game graphics were done on the VIC-20. You could program up to sixty four 8x8 pixel custom characters, and you put these on the screen for some crude graphics.

So, since I didn't have an assembler I needed to be my own assembler. The VIC-20 Programmers Reference Guide included all the information I needed to write my first assembly language program. Once I had the code written, I translated the assembly language instructions into machine code. On the 6502 the instructions are in the form of hexadecimal numbers. I typed these into the machine language monitor to try them out. I don't remember if I got this to work the first time.

When using machine code in BASIC on the VIC-20, you would usually convert the hexadecimal numbers into decimal and then put them in a DATA statement. Then READ the numbers and POKE then into memory and call the routine with the SYS statement.

The great thing about the VIC-20 is that anyone can learn to do these things. It's fun!

Stop reading this right now. Go to ebay.com and buy a VIC-20. Go to amazon.com and buy a copy of the VIC-20 Programmers Reference. Try it yourself! Seriously!

Continental Cablevision and the Apple IIc

The first real paid contract software job that Mr. Alessi and I did was for a local cable company called Continental Cablevision. I guess with a name like that they must have had grand ambitions, but I'm sure they don't exist anymore. We got this work through a fellow named James Foster, who was an associate of Mr. Alessi's.

The business model for cable TV was different back then. They actually had real sales reps, and they would call people up and try to sell cable TV service. The packages would have different options and depending on how successful the rep was at selling these to the customer, commission was paid appropriately. This is what our Apple II application was for, computing sales commissions and payroll.

I was new to this, and quite naive. When we went to the customer site (one in Needham, Massachusetts and one in nearby Natick), I found myself making mistakes in the way I disclosed information. The people who worked there were pretty good at getting my to talk about things that I should have been more discreet about; For example, how easy or hard it would be add certain features. I was a member of a team, and needed to act appropriately. This was a good lesson for me, and it sticks with me.

In the Natick office for Continental Cablevision they had the miniaturized version of the Apple II, called the Apple IIc. These machines were really small, about the size of a laptop computer, but of course the screen was separate. Apple sold very small screens that looked appropriate for the size of the Apple IIc. It was a complete Apple II, and it was cute. Brains and beauty in one package.

Saturday, January 23, 2010

Compilers, coffee and cookies

As Mr. Alessi and I proceeded with development of Forecaster-Buy we decided that we wanted to use a BASIC compiler instead of using the built-in Applesoft BASIC interpreter. This protected the source code of the program so no one could steal it. It also made the program run faster, but honestly because most of the time was spent entering data, waiting for disk access and printing stuff on a slow dot matrix printer it was pretty hard to tell it was faster.

The only real choice if you wanted to compile Applesoft BASIC was to use Microsoft's Applesoft BASIC Compiler. Imaginative name, right? This was a very nice product. Back in those days, compilers made your program run faster, but they made development very slow. You tried to cram as much work as you could in between compiles because each line of code took 3 or 4 seconds to compile. Each next line would appear on the screen, and then the floppy drive would go brrrr, brrr, mmmm, mmmm, mmmmm. Repeat.

Now this actually had a nice benefit. Every half an hour or so you would compile the program, and then run off and have a coffee break. I drank soooooo much coffee, and Keebler fudge cookies were consumed in large quantities also. I wish I could still eat like that. ;-)

Soldering, and joysticks

Some of the time I spent working with Mr. Alessi was actually spent just playing around. I didn't always write business software. Sometimes I would write code to draw graphics, or read BYTE magazines, or play video games on the computer.

Some of these games allowed the use of a joystick, which we didn't have. I decided to build my own. The Apple II+ supports the reading of 2 variable resistor (volume control) knobs. Many joysticks use this to provide x/y positioning.

To plug a joystick into the computer, the joystick needs to have a 16 pin DIP connector. I went to Radio Shack and bought the connector, a cable, and the joystick module preassembled. I had an old radio control car, so I took the steering controller and cut out a hole where the steering wheel was. It had button for reverse, so I used that for button 1 on the joystick. I can't remember if I added a second button. I guess I must have since it would be hard to play games without it.

The joystick came together easily with my limited soldering skills, and it worked! Thinking back on it, Mr. Alessi was remarkably okay with my plugging in a homebrew device like this into his $2400 computer. The only thing about the joystick was that the value of the potentiometers was slightly off. I didn't get the complete range of motion of a properly designed joystick. However it was good enough to play Choplifter and some other games!

Friday, January 22, 2010

My Education

I wasn't much of a high school student, I suppose. I did like some of my classes, but I really didn't like to do my homework. Whether this disposition is a good or bad thing is probably irrelevant. I wasn't lazy. I wasn't rebelling at a conscious level. I was simply crazy about computers, and after school most days I would walk the three blocks to Mr. Alessi's house and spend hours writing software, playing games and watching TV with my new boss and mentor. I'm sure my parents weren't completely thrilled with this, but they seemed glad I wasn't getting in trouble.

There was simply no end to what I could learn. There were many books and magazines to read and computers to experiment with. Mr. Alessi was an accomplished electrical engineer and businessman. I really thought we were going to make millions of dollars. That didn't happen, but I must always remember to be grateful for my education. I make just as much money today as software engineers who paid for four years of college, and I was ready for full time work right out of high school. I think young people today should try to find similar opportunities for themselves in whatever field interests them. Read a lot about what interests you. Find other people with your interests and do something ambitious together.

Patrick Alessi, I owe you a debt of gratitude. Thanks!

Thursday, January 21, 2010

The Apple II+

My job with Mr. Alessi started out with a software project he called Forecaster-Buy. The idea was to create a trend following inventory management system for distributors and manufacturers so that overstocking was a thing of the past. The computer we did all our initial development was:

An Apple II+ with 48K RAM and Applesoft BASIC in ROM
Two 143K Apple Disk II floppy drives
An Epson MX-100 dot matrix printer
Later we added a Microsoft Z-80 Softcard but didn't do much with it

I learned so much about programming with Mr. Alessi. We worked in the basement. There was a small room at the bottom of the basement stairs where the computer was kept, and in the larger basement space there was a TV and some chairs. We would talk about the software (and politics) and I would go into room and write software. Mr. Alessi would come in and ask me how I was doing. He'd make suggestions to which I would sometimes respond "That's impossible!" Of course it wasn't impossible, but if I didn't know how to do it, that is what I sometimes said. Then we'd talk and I'd think it over and come up with some sort of code to do the previously impossible.

Working with Mr. Alessi was a great experience. He was smart enough to know what sort of software to create. He'd bring me endless coffee and cookies. On Saturdays he would make me breakfast. He made very nice scrambled eggs. His two sons Tom and Michael were a little older than me and they'd always be around. I remember I used to play with them (and with all the other kids around the block) up at the park at the end of my street; kickball, pickle, keepaway, capture the flag, and hide and seek with the whole neighborhood as our hiding place. :-)

Yeah, working with Mr. Alessi was a great opportunity. It didn't pay much, but I learned a ton!