Thursday, March 30, 2006

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.

Friday, March 17, 2006

Super Nintendo Frog Feast started

The Super Nintendo version of Frog Feast has been started.

Most of my time has been spent getting a version of the lcc816 and CC65 tools working correctly. This is the first version not to use a 320 pixel wide display (The Neo Geo doesn't count as the tile map was 320 pixel wide). The SNES only offers a 256 or 512 pixel wide display.

This will also help out with the MSX 2+/Turbo R version, as the display is only 256 pixels wide on those machines. A Master System version will also be considered.

Sunday, March 12, 2006

Sega Genesis Frog Feast released!

I was able to persuade a friend to create a cartridge version of Frog Feast for the Sega Genesis.

The cartridge can be purchased from:
http://shop.rastersoft.net

X68000 Frog Feast works on the real system

I was finally able to test Frog Feast on a real X68000 (Pro). I only had to fix two problems. One was initializing the sprite Table ($EB0000) before enabling a graphics mode caused an error.

The other error was me outsmarting myself. Reading through the hardware descriptions, it looked like a value needed to be set to enable joysticks ($E9A006), but this caused joysticks not to work... D'oh!

I am working to get this published on a real disk shortly. I will post more when I find out more. Worse case, I will hand make them as needed.

Sunday, March 05, 2006

Genesis Frog Feast

I've implemented the sound effects into the Genesis version of Frog Feast. I'm wrapping Paul Lee's sound driver into my routines. It's working nicely.

I also corrected a problem with a joystick using the 'B' buton instead of the 'A' button. If I put the joystick read in it's own routine, it doesn't work correctly. It's probably a bus or timing issue.