Archive for June, 2008

SNES Central news + NSF Replayer status

Monday, June 30th, 2008

This morning I discovered that one of the site that I consider as the best SNES ressource (especially about proto and alpha/beta release) did a small news on myself. Go check it : www.snescentral.com

Thanks guys, it is a good gift for me. Yeps, It’s my birthday today. I’m 34 years old today.

A little update on my SNES work : sound engine is soon going to be able to run. I already corrected many lines of code that were causing trouble. The whole NSF init process is almost finished (I hope tonight or tomorow morning 😉 ). Then I will attack the player itself, but since it’s based on the same process so it will be painless.

I still hope to finish this week my NSF Replayer work. I will try to make a package and a small doc so anybody can use it or improve it.

++ Lint

SNES Sound engine hell …

Thursday, June 26th, 2008

It’s been almost 2 weeks that I’m in a battle with sound engines on SNES. The sound CPU in the SNES is a SPC-700 chip designed by Sony. After my last post, I said to myself : “It would be nice to setup music now”. I tough it was a great idea since sound was almost the last thing that I hadn’t yet implemented on the SNES (except from some PPU feature).

I started looking after sound engine and tracker that suport the SPC-700 chip.

To my big surprise, there is no tracker available at all. No sound engine packaged and usable out of the box. After a small discussion with D4S, he told me a few facts about SPC-700 :

  • It’s not easy to understand
  • Transfer routine making it not easy to play other format
  • Definitively no dedicated tracker

While digging for sound engine I found out 3 engine that might be usefull to look at :

XMSNES

This engine is supposed to take .xm and transform it to another format to make it playable on the SNES. The problem is that the file that are being converted need to contains almost no effects and have many other limitation. Then the main problem is that it don’t really sound nice on the real SNES hardware. Since real hardware support is for my a pre-requisite, I left that engine out.

CDOTY / SME Engine by Nevitsky

Cdoty realeased a while ago the source code for his “frog feast” game on the SNES. In this game he used the SME Engine coded by Nevitsky. The problem is that there is absolutely no documentation at all and that the sounds need to be converted and I didnt found out the software to convert them. Once again I left out that one.

NSF Replayer

Sometimes google help you to find stuff on the internet. This timegoogle wasn’t my best friend while searching SNES sound engine. YouTube was a good buddy with me making me discovering the NSF Replayer for SNES. The NSF Replayer is NSF player for the SNES that playback music from NES game on the SNES. The engine is playing quite well on real hardware and after a few serach I found some forum posts that were talking about it. There is no real doc but the code is quite explicit.

I’m currently implementing the engine in the WDC sdk. I’m having isuue with code relocation but it should be fixed quite soon. So yes I’m loosing time for my 26th July deadline to implemnting the first level of kung fu master on the SNES, but at least I will have a sound engine.

One other great thing with this engine is that I have the NSF kung fu master soundtrack already ready to be played by the engine. The NES soundtrack sound really like the arcade version.

As soon as the engine is running I will make a new release, I promise. I hope to have it running by middle of next week.

See ya,

Lint

WDC C Compiler for 65816 in action [PART IV]

Friday, June 13th, 2008

Finally i take some time to describe what’s new in the fourth release.

First i wanna give you the rom and source code archive.

The code have patched since the pre release and now it should work on real hardware without any flow. There is just some sprite priority problems with ZNES. I will fix that sometimes. Since past stable realease I have corrected a lot of bad code in te event handling functions.

The biggest improvement is the sprite handling. I have ripped a part of the Kung Fu Master sprite and descide to implement walk, down and punch hit. I declared the whole sprite table in memory and i have a function that transfer it by DMA. Here is the structure in C :

typedef struct OBJECTData {
    byte HPos;
    byte VPos;
    byte nameLow;
    byte nameHigh:1;
    byte color:3;
    byte priority:2;
    byte HFlip:1;
    byte VFlip:1;
} OBJECTData;

typedef struct OBJECTProp {
    byte size:1;    // Size Large/Small
    byte HPos:1;    // H-Position MSB
} OBJECTProp;

typedef struct OAMData {
    OBJECTData data[0x80];
    OBJECTProp prop[0x80];
} OAMData;

So now it’s very easy to modify and setup sprite table. Then the OAMLoad() function do the DMA transfer. That function is called on NMI Interrupt by a dedicated event.

One other big work that I have done in this release is the work on PPURegister. Here is the list of functions that I have already implemented :

ppuRegisterStatus PPUStatus;

void initRegisters(void);

void savePPUContext(ppuRegisterStatus *PPUStatus_src,
                    ppuRegisterStatus *PPUStatus_dst);
void restorePPUContext(ppuRegisterStatus PPUStatus);

void setINIDSP(word blanking, word fade);
void setINIDSPDirectValue(word value);
byte getINIDSP(void);
void setOBJSEL(word objsize, word objnameselect,
               word objnameaddrbase);
void setOBJSELDirectValue(word value);
byte getOBJSEL(void);
void setOAMADDR(word oamadrr, word oampriority);
void setOAMADDRDirectValue(word value);
word getOAMADDR(void);
void setOAMDATA(word oamdata);
void setOAMDATADirectValue(word value);
byte getOAMDATA(void);
void setBGMODE(word bgsize, word bg3, word bgmode);
void setBGMODEDirectValue(word value);
byte getBGMODE(void);
void setMOSAIC(word mosaicsize, word mosaicenable);
void setMOSAICDirectValue(word value);
byte getMOSAIC(void);
void setBG1SC(word vramDst, word screenProp);
void setBG1SCDirectValue(word value);
byte getBG1SC(void);
void setBG12NBA(word vramDstBG1, word vramDstBG2);
void setBG12NBADirectValue(word value);
byte getBG12NBA(void);
void setBG34NBA(word vramDstBG3, word vramDstBG4);
void setBG34NBADirectValue(word value);
byte getBG34NBA(void);

It’s now very simple to setup those registers without the need to play for the bit position for certain of them. Everything is handled in C, the code is really not efficient, I’m totally aware of that but the code will be optimised at a later stage of the development. As you see also I have a variable that contain a erference to all PPU registers allowing me to save and restore them. Nice feature when entering to debug screen and not having to worry about saving thing and setings them back before leaving. (The only think you need to care is VRAM, but I will try to restore that too).

I’m very pleased with this relaese, I got all I needed to get work done in a couple of days. From now on I will really focus on the Kung Fu Master port on the SNES from the Arcade version. I already have everything I need in place for doing that, except for the sound engine. I will try to integrate XMSNES to my work.

I will anyway post on a regular basis about the progress I made on the port. And whatever i see a problem that I should expose to you I will make a post about it.

See ya,

++ Lint

Early release…

Wednesday, June 11th, 2008

Why early ?!? Because I think many people wait for relaese of the new source code and ROM. I will not have time to write a post describing what I have done and how I have done it. This will come in a few days (I really hope before the weekend).

Biggest new feature is sprite handling.

So here is the ROM and source code.

++ Lint

PS : The code might be refactored when official release. As usual don’t hesitate to send a comment for any questions, bugs, suggestions …

UPDATE Status

Thursday, June 5th, 2008

Hi all,

I took time to analyse why the code wasnt’t running correctly on the SNES hardware. It’s mostly the event handling code. The addEvent and removeEvent functions were causing multiple problems when there was more than 2 events. Now everything should be fixed.

At the start of this week, I did a small TODO list with 12 items. In 4 days I cleared 10 of them. Here is the list :

Events :

  • DONE !!! review add/remove comments
  • DONE !!! add priority (0xff -> 0x00)
  • DONE !!! Allow to stop some events during debug

PPU-registers :

  • DONE !!! make a NO_VALUE define (0xffff)
  • DONE !!! implement BGMODE, MOSAIC and INIDSP
  • DONE !!! implement save_context and restore_context

DEBUG DISPLAY :

  • DONE !!! [DONT WORK IN BSNES] trigger on L+R+Start
  • DONE !!! display register value A, X and Y) before jump to debug
  • DONE !!! display event queue information
  • DONE !!! display BGMODE / MOSAIC / FADE value before debug
  • DONE !!! save and restore context on enter debug.

SPRITE :

  • POC with main character on title screen (left, right, hit)
  • add up and down control

For next release I may not release a full sprite code, but a least I hope to being able to display a sprite on the screen.

Kung fu master first draft sprite

++ Lint