From: Arvid Norberg (c99ang_at_cs.umu.se)
Date: 2001-03-06 12:17:25
Hello,
I'm sorry to a post computer-specific question here, but you guys are
my last hope.. ;)
What I'm trying to do is to scroll the lines 100 through 150 by using a
raster-interrupt (two actually). But I can't get it to work.
My questions are:
What am I missing? why doesn't it work the way I want it to?
If I want to make a function that ends with an "rti" instead of "rts",
is there a keyword/modifier in cc65 that does that to a function?
in some compilers you can to write:
interrupt void IRQ_handler(void)
{
...
}
ok then, here's the source:
-------------------
#include <c64.h>
#include <6502.h>
#define irq_vector (*(void**)0x314)
void IRQ_handler_bottom();
void IRQ_handler_top();
void main();
void IRQ_handler_top()
{
if (VIC.irr & 1) // make sure we got a raster interrupt
{
static unsigned char a = 0;
a = (a + 1) & 7; // increase the scroll-counter
// select 38 column mode and scroll this part of the screen 'a'
pixels
VIC.ctrl2 = a;
// let the next interrupt handler get executed on line 150
irq_vector = IRQ_handler_bottom;
VIC.rasterline = 150;
// tell the VIC-chip that we have handled the interrupt
VIC.irr &= ~1;
}
// jump to the standard interrupt routine
__asm__(" jmp $ea31");
}
void IRQ_handler_bottom()
{
if (VIC.irr & 1) // make sure we got a raster interrupt
{
// select 40 columns mode and
VIC.ctrl2 = 0x8;
// let the first interrupt handler get executed on line 100
irq_vector = IRQ_handler_top;
VIC.rasterline = 100;
// tell the VIC-chip that we have handled the interrupt
VIC.irr &= ~1;
}
// jump to the standard interrupt routine
__asm__(" jmp $ea31");
}
void main()
{
SEI(); // make sure we don't get an interrupt while we are setting
up our own
irq_vector = IRQ_handler_top;
CIA1.icr = 0x7f;
VIC.imr = 1; // enable raster IRQ
VIC.rasterline = 100; // the line where we want to get an
interrupt
CLI(); // enable interrupts again
while (1); // just wait here
}
---
Arvid Norberg
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:39 CET