Friday, July 27, 2012

Writing A Commodore 64 BASIC Program On A C64 Emulator: A Christmas Candle [UPDATED]

Going back to a retro computer system is interesting. Especially when you go back to develop software for it. That's exactly what I did. Using WinVice, a Commodore 64 Emulator that most people probably use to play those old C64 games that you can find on the Internet, and using BASIC, that old, somewhat easy to get into, interpreted and insanely slow programming language that was usually bundled with most 8-bit computers, I set about recreating a classic family Christmastime memory.

In the Beginning

Back in the early 1980s I created a flickering candle as a sort of demo/entertainment program to run during the Christmas Holiday. I wrote it in BASIC and I wrote it on my TRS-80 Color Computer. It took a couple days to figure out and write and I had to use a tape player as a storage device. Anybody who remembers those days remembers how time consuming and error prone that tended to be.  I was pretty proud of myself for accomplishing this and rightly so.

Now, I've decided to redo that program on the C64 emulator WinVice. Since I don't have that tape with the program on it anymore nor any sort of printout of the source code I'm having to reconstruct the program from memory and whatever skills I have as a retro computer programmer.

We'll see if I have the programming chops to pull this off.

UPDATE:
Okay, so I finally finished this project and it feels good to do so. It didn't take me as long as I thought it would and I ran into fewer problems than I thought I would. I attribute that to having a plan (somewhat) and structuring my code (as much as possible in BASIC.



What I Learned

This was an interesting and nostalgic look back at programming old retro 8-bit computers. I look back and shudder to think at how my code was structured and laid out back in the 80s. Spaghetti programming indeed.

So, what did I learn?
  1. Planning and Structure are super important. I'm sure if I would have just dove into this project with out planning or designing the program I would have ran into way more problems than what I originally did.
  2. BASIC has more limitation than I remember. Line numbers, which I used to love, become the bane of me on a couple of occasions. Not enough to derail the project but enough to cause some concern in a couple of areas.
  3. It is super easy to prototype stuff in BASIC. I've often compared modern day Python to BASIC of old (but better) and I still think it's true. If anybody were interested in learning how to program I'd suggest they start with Python and move on.
  4. It was fun. I'm looking forward to doing another project or two in BASIC before moving on to doing stuff with more advanced languages.  Well, for my YouTube stuff anyway.
Anyway, I hope anybody reading this enjoyed my videos as well. I know that a candle isn't the most exciting thing to view but I wanted to recreate something from my youth. Something I was proud of achieving and I did. It was odd however. The nostalgia I got from seeing it run was a bit overwhelming. It made me ache to go back to those days and program some more games or something. Fortunately I can still do this but I won't be 15 and I hope the code will look a lot better.

Now, that the retro bug has bitten me I'll go over to C64.com and download c6 roms of some of my favorite games and relive a little retro computer hedonism.

Now, what to do for my next programming challenge. Maybe I'll attempt to write some sort of BASIC C64 game. A text adventure maybe. We'll see.

Some Links

CBM Programming Studio - What I'm using to write the software.
WinVice - What I'm running my program in. A pretty good emulator if you ask me.
Retro Invaders Part 1, Part 2 and Part 3.
Project File

No comments:

Post a Comment