Re: [cc65] C64, Interrupt and in need of an example

From: Greg King <>
Date: 2008-03-05 15:32:46
From: "Markus Stehr" on Wednesday, February 27, 2008; at 07:39 PM -0500
> Could someone please provide me with an usable example for an interrupt
> handler for the C64?  I have been reading the manual, and asked Google
> for 2 hours now; and, I am as clueless as I was 2 hours ago.
> I need this for the BunkerParty Invitro [nobody else volunteered, so I
> am doing it again, but this time in C and not ASM. ;) ]; and, I need that
> IRQ for the music.

Here is almost exactly what you need:

My code is similar to MagerValp's code, but I use CC65's actors
(constructor, destructor, and interruptor).  That archive has C-language
versions of two of the example programs in the Goattracker2 music editor

(I say "almost" because the code actually is designed for a modification
that I did to an old revision of Goattracker.  It can create CA65
source-code files of its songs.  They can be assembled and linked directly
into a program -- there is no need to worry about where to put the song in
RAM, and the player is a group of "standard" CC65 functions.  So, you would
need to change my code into a form that can use the binary files that
published music-editors produce.)

By the way, my code originally used "--VIC.irr;" to acknowledge the
interrupt; MagerValp's code uses an assignment.  After thinking about it for
awhile, I realized that my code would not work on a SuperCPU (because it
exploits a 6502 defect that does not exist in the 65SC816).  Thanks for
alerting me, MagerValp.

> And, a second question, how can I deactivate the charset change at
> startup?
> Even with a "VIC.addr = 20;" at the start, you still can see the change
> for a split second.
> I am using my own charset later on, but I am clearing the screen in some
> non-standard way, and I need the screen in its original form.

There is no easy way to do it!  That "flip" is built into the start-up code
[it is the second thing that the program does -- long before it runs
main()].  You would need to get the source-code file ("libsrc/c64/crt0.s"),
remove the two lines that switch to lower-/upper-case, assemble it, and then
link it to your program, in place of "c64.o" -- use ld65 instead of cl65
when you link them.

To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Mar 5 16:02:31 2008

This archive was generated by hypermail 2.1.8 : 2008-03-05 16:02:34 CET