ASM

Apr 11, 2013

I first learned to program on a TI-59 programmable calculator.  My dad "the physicist" would bring it home on weekends and I would monopolize it for the next two days.  I'd make games and type in programs from Byte magazine.  It was a magical device. I don't know what it was about programming that enthralled me, but I was obsessed with it.  It was an odd skill to have back then, even at the level of programmable calculators.  Computers were still the stuff of science fiction or only owned by huge companies or universities and housed large noisy air conditioned rooms with punch-card machines.

One summer the college got two Commodore Pet computers that were destine for the local High School.  My friend, Tom McFarlane and I spent that entire summer in the computer lab programming those Commodore Pet computers.

It was my first experience with BASIC and it blew the socks off of the TI-59.  Tom and I devoured everything about those Commodore Pet computers.  We wrote every game we would could think of from Space Invaders to Astroids to Space Wars to little platformers (although we didn't know that's what they were called).  We challenged and pushed each other and became masters of the PEEK and the POKE.

I do blame the Commodore Pet from one nasty habit that's followed me for over 30 years.  Tom and I realized that if we removed all the comments (the REM statements) from our BASIC code, the game would run significantly faster.  To this day, I find myself deleting comments or whitespace under some misguided pavlovian notion that my code will run faster.

The summer ended and the Commodore Pets made their way to the High School, were I was starting as a freshmen.

As I continued to read about programming and computers (mostly in Byte magazine) this odd and strange concept kept coming up: Assembly Language.  What was it?  How did it work?  And more importantly, what could it do for me?

I started to realize that assembly language was real programming.  BASIC was just an imitation of programming.  A layer that sat on top of this thing called Assembly Language.  You weren't really programming the computer if you weren't programming it in assembly language.  That was getting right down to the metal and I had to know what it was.

Lore said it was fast.  Faster than BASIC and this was very appealing to me.  We were pushing the limits of BASIC, removing features from our games just to speed them up.  If assembly language could help with that, even a little, then it was something I had to learn.

Armed with the knowledge that the Commodore Pet used a 6502, I spent the weekend hand writing this program that would fill the screen with @-signs.  I wanted to see how fast this assembly language really was.  I wrote the same program in BASIC.  I needed a baseline.

After class on Monday, I headed to the computer room and found a free Pet computer and typed in the BASIC program. It filled the screen in a little over 1 second.  Fast.  Could assembly language top that?

I typed in my little assembly language program and entered the SYS command to start it executing... and... nothing.  The machine locked up.  No error message, it just locked up.  Odd.  I power cycled the Commodore Pet, started over and soon found my mistake.  Program entered.

My finger poised above the ENTER key.  I was trying to remember how fast the BASIC program filled the screen. I need to be able to tell if assembly language was faster.  I might need to run several tests, maybe add a timer, just to be sure.

I hit the ENTER key.

The screen instantly filled with @-signs.  Instantly.  So fast that I could not even begin to see them being drawn on the screen.  One moment the screen was blank, then next instant it was full of @-signs.  Instantly.

I just stood there.  "Holy shit" I said to myself.  My heart was pounding.

This truly was a religious experience.  Someone had pulled back the curtain to heaven and given me a glimpse of God.  The speed was staggering.  Stunning.  I had no words for it.

That was the last day I ever programmed in BASIC.  Assembly language was my savior.  I gave into it completely.

I was changed forever.









Met
How did it change you exactly? Did you use assembly in your games?
what is three + two + three?