Things I figured out this weekend, and will be corrected on my blog.
I wrote the code for most of the pages very quickly, and occasionally I would get error messages from the cc65 compiler. "converting pointer to int without a cast" "incompatible pointer type" etc...and I didn't know what caused them, but I slapped an (int) on there, and the error message went away. But, it didn't look right to me, and I could never find any example code that required type casting to fix error messages...so it bothered me a bit.
Well, the reason I never found example code to match what I was doing, was because I was doing things wrong. The ASM code was correct, so I assumed I had correctly addressed the issue, but once I saw the correct answer...I see that I hadn't.
example...
Code:
const int AllBackgrounds[] = {(int) &n1,(int) &n2,(int) &n3,(int) &n4 };
I slapped some (int)'s on there because it gave me error messages...but what I really wanted was this...
Code:
const unsigned char * const All_Backgrounds[]={n1,n2,n3,n4};
and the companion piece...
Code:
UnRLE(BGDaddress);
I believe the error was that my prototype said this...
Code:
void __fastcall__ UnRLE(int data);
and, what I really wanted was this...
Code:
void __fastcall__ UnRLE(const unsigned char *data);
because, what I'm really doing with the code, is an array of constant pointers to an array of constant characters. And, what I'm really passing to the function is a pointer to an array.
This will be fixed soon on the blog example code.
Further, I don't think I've fully tested 'controller 2' input code. All my example code only tests 'controller 1'. I will have to do that as well.EDIT, I tested it. Works fine.
_________________
nesdoug.com -- blog/tutorial on programming for the NES