Episode 2-1: Let's compile and run C64 code
Topics: In this first tutorial I want to over some basics like loading code, writing text to screen, adding a effect and include music. No indepth explanations yet, let's get an initial feeling for C64 coding.
- Episode 2-1: Let's compile and run C64 code
- Episode 2-2: Writing to the C64 Screen
- Episode 2-3: Did I interrupt you?
- Episode 2-4: Effects using a table of data
- Episode 2-5: Understanding and including music
We start simple but not too simple
Is there something more boring then the "inc $d020" tutorials seen on most C64 beginner tutorials? I think people who start coding the C64 want to do the cool stuff they did not understand in the past. And new people to C64 coding must get an immediate understanding with how little effort you can achieve cool stuff. I think if you want to get people excited about C64 development one must provide a breath of retro demo coding. On the other hand I understand that a lot of simplification is required to not frustrate people on their first steps. Anyways, if you wonder what that standard introduction into C64 coding looks like, here is a screenshot.
A real C64 intro explained
As opposed to the boring screenshot above our little intro we will inspect during this tutorial is simple but as a kid in the 80s I would have thought it is looking cool. Basically something I want to achieve myself one day when I understand how to code C64 - I just did not expect to wait for over 25 years. The intro is not much more complex than let's say the famous Dynamic Duo intro and how much did I admire those guys and felt good whenever I saw the intro.
All our little intro does is to display two lines of text with a rotor-like colorcycle effect and it plays some background music.
When the code has been downloaded, just change into the directory and run "dust compile". Vice should open and the compiled intro will be loaded in the emulator. If you don't use DUST there is some advice in the second chapter of this tutorial.
Here is a video of the actual program.
Wow! So simple but it somewhat catches the beginner with the nice sid music and the color cycling, does it not?
So what we do here is putting to lines of text in the standard C64 font in the middle of the screen, do twice the color cycle effect in two different directions for each line and last but not least make sure the music is played while all this crazy stuff happens.
The basics you will get introduced to
In the next chapters I will describe more or less detailed everything which is required to understand whats going on in the intro. We will touch programming on the interrupt, you will also soon understand how memory and in particular screen is organized on the C64. I will explain how to iterate over tables of data, e.g. to change color information or to display a line of text. Finally we include the music into the intro and look how initialization and playback works.