[cc65] interrupt routine hooking in c

From: Tachdaun <tachdaun1gmail.com>
Date: 2009-01-03 22:13:59
Hi, I may be trying to do something impossible, but, is it ok if I try 
to do this?

unsigned char a;
void func()
{
    ++a;
}
void main()
{
    a = 0;   
     //*( (unsigned char*) 0xFFFA ) = (unsigned char*) func;
    asm( "lda %v", func );
    asm( "sta $FFFA" );
}
//--------------------
$FFFA is the memory address in NES with a pointer to a routine that will 
be called on each vertical blank.
( I'm aware of the existance of waitvblank(), I just want to know if I 
can do this with interrupts.)
I'm trying to hook my func() there, I tried to do it with the commented 
line in pure c and didn't work.
The asm code doesn't do it either. am I doing something wrong from the 
point of view of the 6502?
( If my error is just of NES architecture understanding, as it's not the 
main subject of this list, I may find out elsewhere,
but if the error is of 6502 or cc65/ca665 understanding, please let me 
know.)

Thanks!

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sat Jan 3 21:14:15 2009

This archive was generated by hypermail 2.1.8 : 2009-01-03 21:14:16 CET