C64 Programming Examples
Each week my YouTube channels attracts visitors from all walks of life in their experience. Todd is an engineer that has a wide knowledge of electronics, software, and computers. Bo Goren has a passion of the C64 and a vast knowledge of the Commodore 64. Together we combine a great team to bring the Commodore 64 into the spotlight each week to give credit to this ancient, amazing piece of history. On this page you will be provided with a summary of the concepts that are discussed in the Google Hangouts C64 Corner. We broadcast live each Friday between 7:30pm – 8:00pm Mountain Standard Time. So in case you miss a meeting, you will be able to now receive the updates on this page. However, I welcome you to drop in to speak with us. Also I will add you to the friends circle if you ask. We enjoy sharing information among each other and learning from one another. Click on the video below and you will see how we work together to create interesting Commodore 64 utilities and demos.
SpritePad will allow you to create your own Commodore 64 sprites that can be saved and loaded into the VICE C64 emulator to work with a Basic program. Here is a screenshot of the SpritePad editor
When you first load up SpritePad you will be presented with a blank canvas to work with. Look at the lower right and you will see a Quantity setting. When you begin your first sprite make sure to set this to a 1 using the up arrow. If you want to add more than one sprite just increase the Quantity per sprite that is needed.
A sprite can be drawn in several colors (known as multicolor). Click on the section that says ‘Pen” to change to a specific multicolor selection. Then you can click on the colored squares below to select a new color. Next use your mouse to draw in the small squares in the upper left corner. As you begin drawing you will see the output in the small window to the right and in the larger squares to the farthest right.
Once you have completed your design, click on the File menu and select Export. You will see the Export dialogue box. For our example click on the PRG File radio button. Then you will need to set the hexadecimal address of where your sprites will appear in memory. In this example type in 380 which is decimal for 896. Make sure the Attribute Byte Format is set to Sprite Pad and click the OK button. Another dialogue box will appear where you can save (export) your file to your computer. As an example use a name like Sprite.prg and click the Save button.
Later we downloaded a program called a Blitz compiler. This compiler allows you to speed up a Basic program. We spent a considerable amount of time utilizing this tool out of curiousity mostly. The goal was to create a way to speed up a Basic program by compiling it into assembly language. So Bo created a simple program to fill the screen in VICE. Then we ran the Blitz compiler and it created the Z/RANDOM FILL and C/RANDOM FILL files. Todd’s theory was that the file Z/RANDOM FILL is the original program created in VICE, which is the actual p-code. The file C/RANDOM FILL is the interpreter program that gets loaded into higher memory. It interprets the p-code from the Z/RANDOM FILL. He stated it’s like a boot loader for a micro controller.
The Commodore 64 is capable of producing an interrupt to allow a stand-alone program to run outside of a Basic program without hardly any interruption. According to the book Mapping the Commodore 64 & 64C memory location 59953 sets an entry point for the IRQ interrupt handler. Then Timer A of CIA #1 is set at power-on which causes the interrupt to take place every 1/60 second. When this occurs, the program sends execution control to the vectors at 788 and 789.
I created a simple sprite example that allowed our sprite to travel across the screen based on the assembly language interrupt routine. The code is listed below. Click the link below to download the d64 disk images. The file is found in SteveProg under the name INT ROUTINE.
I created a simple sprite example that allowed our sprite to travel across the screen based on the assembly language interrupt routine. The code is listed below. Click the link below to download the d64 disk images. The file is found in SteveProg under the name INT ROUTINE.
Finally you can watch the full video below.