The first program I got paid for

My initial programming experiences were with an Apple ][e in the fall of 1985 when I was a sophomore at a small town Kansas High School. (Freshmen weren’t allowed to take programming.) Only 2 classes were offered so I was effectively done after 2 years. I kept programming though because I loved it and I bought an Apple //c before I bought a car.

There was a certain type of program that I liked to write when I was bored. AppleBASIC had a lores graphics mode that was just 40x40 with 16 colors but the ‘pixels’ weren’t square. I liked to make small animations that just shifted blocks of color around in what I considered interesting ways.

At the time I also had a subscription to A+ magazine and they had a column that featured short programs sent in by readers. Sometime when I was a Senior in HS I sent in this program.

 10  HOME : GR :C2 =  INT ( RND (1) * 15) + 1
 20 C1 =  INT ( RND (1) * 15) + 1: FOR X = 0 TO 19: COLOR= C1: VLIN 0,39 AT X: COLOR= C2: VLIN 0,39 AT X + 20: NEXT X:C2 = C1: GOTO 20

You can run it on this emulator but you won’t really get a sense of what it actually looked like because modern browsers can emulate 40 year old interpreted computer languages at blazing speed.

Here is the longer ‘unobfuscated’ version.

 3  REM  >>> 3-28-88
 10  HOME : GR 
 20 C2 =  INT ( RND (1) * 15) + 1
 30 C1 =  INT ( RND (1) * 15) + 1
 31  IF C1 = C2 THEN 30
 40  FOR X = 0 TO 19
 50  COLOR= C1
 60  VLIN 0,39 AT X
 70  COLOR= C2
 80  VLIN 0,39 AT X + 20
 90  NEXT X
 100 C2 = C1
 110  GOTO 30

If you want to get a sense of what it actually looked like on hardware you can add this line 81 FOR J = 0 to 1000:NEXT J when running it in the emulator. Depending on your machine you might have to change the loop count up or down from 1000.

Sliding Boxes

After the first initial pass to draw both boxes on the black screen, the box on the left seems to slide towards the right. This is accomplished by ‘erasing’ a line on the left (X in the loop on line 40 being drawn on line 60 in a new color) and adding to the right side in the previous color (the X + 20 on line 80).

I think what makes this slightly interesting is that I unrolled the loop on lines 40-90. Of course I did not know until much later what that technique was called.

Also the longer version has a check on line 31 that makes sure the new color choice is different than the previous one. (and the fact that the line number is 31 tells me this a discovered ‘bug’ and I added that line to fix it but did not bother to re-number the program.)

The shorter version does not have this check beause it would have added another line to the program and I considered it a valid trade-off to keep the program compact.

Anyway, I submitted the 2 line version of this to the magazine and promptly forgot about it. Once I started college I swtiched to MS-DOS programming and stopped my subscription to the magazine. A couple of years later I got a stack of accumulated mail that still went to my parent’s address. In it was a $25 check from the magazine indicating they wanted to publish my program. I don’t actually know if it was ever published because they didn’t say what issue it would be in and I didn’t want to resubscribe. I did make a photocopy of the check but I’ve lost that.

I still have my Apple //c and occasionally I set it up to play around. Quite a few years ago I bartered some computer parts to someone who could ‘rip’ all my my Apple disks so they could be run in an emulator. (not the just the basic programs.) Three years ago I put the BASIC code up on github here. Not all of the programs are authored by me but the majority are. And most are pretty boring because they are homework assignments.