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!

Tuesday, October 13, 2009

Going Forth

I came across a surprising book in the Needham Public Library when I was 15. It was called Starting Forth, and it was about a programming language called Forth.

The author Leo Brodie had written a charming and fun book about a very interesting language. Forth is a stack based language, and it has a postfix notation in its syntax. So instead of writing 3 + 4 you wrote 3 4 +. Seems strange, but to me it was very familiar because I got my start using HP calculators where you did exactly the same thing.

Forth is interactive, like BASIC. It has a very small core of functions called words, and you create an application by adding new words which have the same syntax as the ones that come built-in. Essentially you extend the language to solve your problem. Smalltalk is also like this.

Forth is the language used to program NASA's space shuttle, so it has some clout. I discovered that there are quite a few Forth fans out there, and I even managed to buy a Forth language cartridge for my VIC-20. Awesome.

Friday, October 9, 2009

Strange Computer Stories

The following is a true story. My Commodore VIC-20 suddenly stopped working. Somehow I figured out that the power supply (one of those black bricks) was at fault. I told my boss Mr. Alessi about it. I needed to order a new one. He made an interesting proposal. He happened to be an electrical engineer specializing in power supplies. He had a novel idea. He would make me a new power supply for my computer himself at no charge, for fun.

Okay, I accepted. He explained that he wanted to build me a very special power supply. It would have a standard lightbulb socket on top, into which would be screwed a standard 60 watt bulb. The purpose of this strange addition? It would act as part of a surge protection mechanism. If there was a surge, the filament in the bulb would become hotter and its resistance would go up. A kind of thermistor (look that up). This was useful for regulating the voltage.

The end result was a very plain looking black project box with a two prong power cord going in on one side, and power cable going to the VIC-20 on the other end. On top, to one side was a dimly orange glowing Sylvania lightbulb. The brightness (dimness really) would remain fairly steady. Here and there it would suddenly glow a little brighter, or dimmer. No lie.

Did it work? Seemed to.

Saturday, December 27, 2008

COMPUTE! Magazine

Computer magazines used to be so much fun. First of all most of them had a very strong focus on programming and they would have articles about how to make electronic hardware to plug into your computer. Very much fun indeed.

Since I was the owner of a Commodore VIC-20 I would buy issues of COMPUTE's Gazette which catered specifically to Commodore 8-bit computers.

I remember one issue which included a machine code monitor listing. The program was in BASIC and it would POKE a machine code monitor (in machine code of course) into memory and then it would start up. I experimented with 6502 assembler using this monitor. I would write the assembly code down and then I would translate it myself to hexadecimal numbers and type them carefully in.

This was one of the great things about the computers of those days. A fifteen year old kid could figure this stuff out by reading magazine articles. There's probably no reason why it can't be made relevant to young people today. Why not make a cool and easy game programming tool for the Nintendo DS for example?

Saturday, October 11, 2008

Flight Simulator in BASIC

I remember years ago that there was an instrument-only flight simulator written in BASIC and ported to different computers. It wasn't much to look at because it was all character based. Tom Nally has just released an open source flight simulator with graphics and sound, all written in Liberty BASIC. This one blows the doors off that old classic. Check it out here.

Monday, October 6, 2008

CP/M and the Z-80 Softcard

When Patrick Alessi and I were working on our original inventory software (called Forecaster-Buy) for the Apple II+, Patrick wanted to expand our marketing reach. He decided to purchase a Z-80 Software for the Apple II and also a copy of CP/M.

This was a completely different environment than the Applesoft BASIC interpreter that comes built into the Apple II+. It reminded me somewhat of the HDOS that ran on my father's Heathkit H-89 computer. You first booted up the CP/M operating system before you could do anything else, like writing software.

You run a copy of MBASIC (Microsoft BASIC-80) to develop in BASIC, and then used a copy of BASCOM to compile this. Then you had to link the software with a library. This was all new to me.

We also purchased an 80 column card for the machine. The Z-80 Softcard, the 80 column card and CP/M didn't get much use because soon after Patrick went out and bought an IBM PC. CP/M would quickly fall out of favor, although in later years I would be reintroduced to it for a time.

Friday, September 26, 2008

Microsoft and compilers

Back in the early 1980's when I was writing inventory management software I would spend most of my time using the Applesoft BASIC interpreter for development. Periodically I would take my BASIC source code and feed it into a compiler. We liked to use Microsoft's Applesoft BASIC Compiler. At that time Microsoft was more of a programming tools vendor than an operating systems vendor (they did sell MS-DOS, but not Windows).

Microsoft really did help launch the microcomputer revolution. They provided BASIC for many computers, and without this people probably wouldn't have written so much software. People say over and over again that Visicalc was the "killer app" that make the computer market grow, but I think that BASIC really deserves that award.

Sunday, June 24, 2007

Microcomputer Trainer

I think one of the best things a budding programmer can do is program in machine code. The absolute easiest way to get your toes wet in this skill is by using a microprocessor trainer. Radio Shack used to sell the simplest trainer I've ever seen, and I even have one of these around the house somewhere. Sometimes you can still get these on ebay (in fact that's where I got mine).  
I know this looks like a toy, and it is. For a toy it's serious business. It has a very simple Texas Instruments microprocessor and you program it in machine code using the hex pad. Easy instructions are included. 
Once you've played with one of these, the next fun thing to do is to write a simulator in BASIC. Not that hard to do actually. ;-)

Monday, June 18, 2007

Electronic Flip-Flop

Early users of computers were usually also interested in electronics, and in fact I was a casual student of electronics before I knew what a computer is. So I owned a couple of electronic experimenter's labs (and I still do) that we picked up at the You-Do-It Electronics store.

Particularly interesting was the Gakken Denshi Block system, recently reintroduced to the market. This is a high quality kit with a portable radio style case. It has a transparent lid which you open to place pluggable modules.

Here is a photo of my own kit (rebranded as Skilcraft).

One of the experiments was important to my understanding of computers. It was titled Bistable Circuit with Two Lamp. This was another was of saying Flip-Flop, which is a critical building block of digital computers. Up until this point I had only an abstract concept of how a Flip-Flop actually worked.

Here is a link to an article on Wikipedia explaining what a Flip-Flop is http://en.wikipedia.org/wiki/Flip-flop_%28electronics%29

Thursday, June 14, 2007

Early networks

When I started in high school at Xavarian Brothers High School in Westwood, Mass. they had an early example of a network. It amounted to a shared hard drive between four TRS-80 Model 3 computers (or maybe they were Model 4s). There were also Epson MX-70 printers.

I didn't actually take the programming class, which was only available for juniors and seniors, but my math class was in the classroom where the computers were, and I would sometimes write little programs for them in the minutes before or after class.

I'm not sure if the hard drive was manually or automatically switched, or if these computers ran a real disk operating system. I don't remember the computers having floppy drives, and it seems unlikely that they had networking code built into the power-up ROMs; just BASIC.

Perhaps someone else would be eager to comment on this?

Monday, June 11, 2007

Floppy disks

In the early micro days we used cassette tapes and floppy disks. Floppies were better for many reasons but they were expensive. The Apple Disk II drives were $495 including the controller. Once you had one of these babies you still needed floppy disks. I remember pretty clearly in the early 80's spending $80 for a box of 10 floppy disks. These were Dysan disks, and were of very good quality.

However these disks probably exceeded the quality required. Later on some less expensive floppy disks became available from the likes of Maxell and memorably named Elephant Memory Systems. These were $2.50 or so per disk. The disk surfaces weren't as polished, and some cheap brands didn't have a reinforced mount but no matter really. The cheap disks were pretty much as reliable as far as anybody could tell.

Disk drive systems themselves were all quite different from each other. Apple's legendary Steve Wozniak had managed to create the ultimate in economy of design for a disk controller with a small card having only 5 ICs. Most other disk controllers were long circuitboards with 2 to 3 dozen chips. Monsters. ;-)

Some of these floppy drives used hard sector disks, meaning that there was an index hole in the media for each sector on the disk. So, if the disk was meant for a 16 sector drive, the disk would have 16 timing holes cut out of it evenly around the inner part of the disk. This would be read by an LED and a sensor. The Apple II used soft sector disks where there was only one hole cut in the disk, and the drive controller itself decided how many sectors to put on the disk by doing careful timing.

I remember that my father's H-89 had hard sector disks. The drives also made a strange clunking noise as they operated. The Apple II's drives made the much more familiar brrrr, brrr, mmm, mmm sound of most floppy drives and they were faster than the H-89 drives.

Thursday, June 7, 2007

Applesoft BASIC

So settling down to programming on the Apple II+, we had several books to help me with the process. Of course there was the standard green covered Applesoft book, and Mr. Alessi also has another book but I can't remember the title. I tried to find a shot of the book cover on Google but no luck.

Before we started writing inventory management software I tried my hand at creating some graphics. The Apple II had hi-res graphics (for that day), and Applesoft had high level commands for drawing so you didn't need to POKE and PEEK as much as in other BASICs. We had only a green phosphor monitor without color, but this was appropriate for business software development.

When editing a program in Applesoft BASIC, you could type some escape sequences to move the cursor around. If you moved the cursor up to the start of a line on the screen you could then reenter the line by moving the cursor to the right, and you could substitute some characters to change the line of code. This was crude compared to the way you did things on a VIC-20 where you just moved the cursor to the line you wanted to edit, changed just what was needed and hit Return.

Also, I had never written software before that used a floppy disk. This was another thing that I needed to become comfortable with. Our Apple II had 3 floppy drives, each was 143K. We also had a 16K card and a Z80 Softcard so the machine could run CP/M, but this was something we rarely did.

Monday, June 4, 2007

What's a Mark-8 Anyway?

I ran across this fun story about someone who restored an old computer he found by accident on ebay. Check it out! :-)

http://www.bytecollector.com/m8_restoration.htm

Sunday, June 3, 2007

My First Programming Job

As well as I can remember (this would have been 1981) I met Patrick A. Alessi when I was 14 years old at NEECO. He was there purchasing an Apple II+ and an Epson MX-100 printer, and he told the sales guy there he needed a programmer to work on some business software. They pointed across the store at me. He told me later that he said, "Who, him? He's just a kid!" They introduced us to each other.

Turns out I knew his son Michael from playing kickball at the park down the street. Mr. Alessi lived a mere 4 blocks away from me, which was the perfect distance. So I began visiting his place. As first we just played pool and experimented with his new Apple II+, and Mr. Alessi made no apologies about sharing his political opinions while smoking different kinds of pipe tobacco.

Since my friend Richard had an Apple II computer I got some games from him, and I made a joystick for the computer out of parts I bought at Radio Shack. I reused the case from an RC car's remote control. I cut out the steering wheel and replaced it with a dual-potentiometer joystick. It was ugly, but I saved some money. ;-)

Mr. Alessi was interested in creating some trend following inventory management software, and he talked a lot about this. Eventually we would begin to write this software, and do a lot of other things as well. This was not going to make me much money in the short run, but I couldn't have asked for a better opportunity to learn.

Saturday, June 2, 2007

Microsoft BASIC

The original story of how Bill Gates and Paul Allen created their first BASIC for the Altair microcomputer is a fascinating one, especially for me since I am also the author of a BASIC language. Here is a fun site with one take on how Microsoft got its start.

http://www.startupgallery.org/gallery/story.php?ii=20