Commodore 64 Color Bars
In this Commodore 64 Color Bars example we are going to see a Basic program that installs a machine language routine to alter the screen colors. The listing is provided here for reference.
Back in my days, we had to type in the code, and didn’t have the convenience of downloading programs that someone else wrote, but I have provided the download below.
After you click the Download File button, you will get a zip file that can be extracted, which should contain the file called asm1.d64. This contains the program that you can load using the VICE C64 emulator.
Just go into Basic and type LOAD”COLROUT5″,8
Commodore 64 Raster Interrupt
This program triggers an “interrupt” using the Commodore 64’s VIC chip.
This works by a scan moving across the across from top to bottom. When you want to set a program at a specific rater line to handle this interrupt, you assign a number and store it in register 53266.
The program explained
Line 90 starts off the program by reading the DATA values into the variable A.
If A is less than zero, then we have completed reading all the data statements and can execute the machine language program with SYS 49152. Then we also write a value from register 251, change the border color, and stop the program.
Line 100 inserts the data statement values into our memory starting at 49152. This is a free area available for us to use. The variable T is incremented to read the next machine language byte, and it loops back to 90 until we have read all the machine language code into memory.
Then everything from 110-130 is our data statements.