SNES Frog Feast near complete
I finally wrestled the lcc816/cc65 compiler combination to the ground, and got Frog Feast working on the SNES. The only thing left to add is sound playback, and getting it on a cartridge!
Getting it to play correctly on a 256 pixel screen (vs. 320 for the other versions) wasn't a major problem. The player cannot miss the lily pad on outer edges, but this doesn't change the game much.
The SNES version isn't able to use the same game logic source code as the other versions, due to the fixes and optimizations needed for the SNES and the compiler.
I had to reorganize a lot of the functions so that they access VRAM right after the VBlank. This is a bigger problem on the SNES compared to any other system.
Here are the fixes needed to get it working with the compiler correctly:
The lcc816 compiler doesn't pass function correctly between C functions. This is mostly due to a missing macro which isn't supported under ca65 (due to it's more limited macro language compared to xa/ja). So, I had to set up global variable for parameter passing. Assembly language routines work find, because they pull the values relative to the stack pointer.
Many additions were made to the SED script to convert from xa/ja to ca65.
The compiler calls functions with a jsr, instead of a jsl.
All of the prologue/epilogue calls and setting the __caller variable are removed. The lda #xxxx part of this is still there, because I couldn't get SED to remove both lines.
The RSH and LSH macros were fixed. They didn't do multi shifts in the converted version.
I converted the jgte, jgteu, etc macros from ja to ca65. mreg and mreg2 are set as zeropage locations.
Some of the math functions from the runtime library were also put into the routines section.
The compiler complains when trying to get the 16 bit value of a 24 bit address. This was fixed in the compiler to generate (address&$FFFF)
Code such as Frogs[Loop].x generates a call to muli32, which is very slow. This was replaced with FrogPtr->x. FrogPtr is set to &Frogs[0], for example;
C continue and switch statements do not appear to work correctly. The switch statement was replaced with a set of if..else if.. lines. A function containing a continue statement had to be broken into two seperate functions (one for each frog), and the loop eliminated. The continue is replaced with a return.
The code was updated to a 2004 version from the lcc816 version. I'm not sure if this fixed anything.
Constant data tables have to be done in assembly (using .dcb), since all arrays are put into the DATA segment, which is discarded by the linker script.
The size of the mreg and mreg2 variables were mis-set to 2 instead of 4. This caused a lot of problems, but cannot be blamed on the compiler.
Most of the time and effort has been spent figuring out the compiler issues. But, it's definately rewarding to see it working correctly on the real system.
I will be releasing the compiler and related stuff once everything is done.

