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

From: stefan <stefan-physik1gmx.net>
Date: 2008-03-03 09:29:33
You did'nt listen to me:

The irq-init is WRONG. Acknowledge the the I R R of both C I A and VIC.
Interesting, that you don't use SEI/CLI, but that should be
ok.
 
Monte Carlos

>>>>>> "MS" == Markus Stehr <bastetfurry@ircnet.de> writes:
>>>>>>             
>
> MS> Could someone please provide me with an usable example for an
> MS> interrupt for the C64? I have been reading the manual and asked
> MS> Google for 2 hours now and i am as clueless as i was 2 hours ago.
>
> In (almost) pure C:
>
>
> #include <c64.h>
> #include <peekpoke.h>
>
>
> void music_init(void) {
> }
>
>
> void music_play(void) {
> }
>
>
> void my_irq(void) {
>   ++VIC.bgcolor0;
>   music_play();
>   --VIC.bgcolor0;
>
>   /* ack raster IRQ */
>   VIC.irr = 1;
>   __asm__(" jmp $ea31");
> }
>
>
> void __fastcall__ irq_setup(void (*irqh)(void)) {
>   /* disable IRQ sources, SEI not needed */
>   CIA1.icr = 0x7f;
>   VIC.imr = 0;
>
>   /* irq on line 100 */
>   VIC.rasterline = 100;
>   VIC.ctrl1 = 0x1b;
>
>   /* set kernal IRQ vector */
>   POKEW(0x0314, (int)irqh);
>
>   /* enable raster IRQs */
>   VIC.imr = 1;
> }
>
>
> void main(void) {
>   music_init();
>
>   irq_setup(&my_irq);
>
>   while (PEEK(0xc6) == 0) {
>     ;
>   }
> }
>
>   



******* Diese Email wurde gesendet von der ********
Laser- und Medizin-Technologie GmbH, Berlin
                  (gemeinnuetzig nach §52 AO)
     Fabeckstr. 60 - 62, 14195 Berlin
     Telefon:  +49 (0)30 8449 23 - 0
     Fax:      +49 (0)30 8449 23 - 99
     Handelsregister:    Berlin 97 HRB 23 655
     Homepage: www.LMTB.de
     Vorsitzender des Aufsichtsrats: Dr. Frank Frank
     Geschaeftsfuehrung: Dr. H. Albrecht
                         Prof. Dr.-Ing. H. J. Eichler
*************************************************** 
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Mar 3 09:29:46 2008

This archive was generated by hypermail 2.1.8 : 2008-03-03 09:29:48 CET