SNES C compiler?

Discussion in 'Nintendo Game Development' started by cdoty, May 12, 2005.

  1. kammedo

    kammedo and the lost N64 Hardware Docs

    Joined:
    Sep 24, 2004
    Messages:
    2,138
    Likes Received:
    12

    Correct. You usualy check for a VBlank BEFORE enabling a DMA, rather than checking the $420b reg.
     
    Last edited: Nov 12, 2007
  2. cdoty

    cdoty Gutsy Member

    Joined:
    Mar 23, 2005
    Messages:
    413
    Likes Received:
    2
    Well, that's a *little* more reasonable. It was in the $1000s before.

    I wonder if we could do a group purchase for SNES development at a more reasonable fee, ($50-$75) with no support or something?
     
    Last edited: Nov 12, 2007
  3. lint

    lint Member

    Joined:
    Sep 24, 2007
    Messages:
    24
    Likes Received:
    0
    Well 395$ is maybe more affordable, but anyway currently that sdk cannot produce anything runnable easily. There is some way to run code by outputting in binary format but then the ROM is not clean and i doubt it will work on real HW. I think the key is get that isx file specification and make our own tool, or just to get our hands on older tools from developpers.

    cdoty : wich tools did you use for your frog feast port on SNES ?

    See ya all,

    ++ Lint
     
  4. cdoty

    cdoty Gutsy Member

    Joined:
    Mar 23, 2005
    Messages:
    413
    Likes Received:
    2
    It's based on the modified version of CC65 that worked with lcc816. It's a very early version, and did no optimizations. I detailed the compiler issues in my blog:
    http://www.rastersoft.net/Blog/2006_03_01_archive.html


    Here's the compiler (For windows, probably needs Cygwin installed to work):
    http://www.rastersoft.net/SNESDev.rar

    And a skeleton project:
    http://www.rastersoft.net/SNES.zip

    The project expects the compiler to be in c:\SNESDev\bin (unrar the file to "C:\").
    And, the project goes to c:\SNES (unzip the file to "C:\").

    You can debug the project using MESS using "go.bat", if MESS is installed in C:\MESS.
     
    Last edited: Nov 12, 2007
  5. cdoty

    cdoty Gutsy Member

    Joined:
    Mar 23, 2005
    Messages:
    413
    Likes Received:
    2
    The line limit is incorrect in the install. It's 750 lines, and that's per C file. Which isn't too bad.
    The linker will also link multiple files.


    The -HZ (Zardoz) format is going to be much easier to work with. Here's what I found:

    BYTE Type; (0x5A)
    WORD StartAddress;
    WORD Size; (Or could be a DWORD for size).
    WORD Unknown;

    (Size) bytes of data starting at StartAddress.

    Immediately followed by the next section:

    WORD StartAddress;
    WORD Size; (Or could be a DWORD for size).
    WORD Unknown;

    etc...

    End is marked with
    0x0000
    0x0000
    0x0000
     
    Last edited: Nov 12, 2007
  6. kammedo

    kammedo and the lost N64 Hardware Docs

    Joined:
    Sep 24, 2004
    Messages:
    2,138
    Likes Received:
    12
    you mean paying to get it leaked? ;)
     
    Last edited: Nov 12, 2007
  7. cdoty

    cdoty Gutsy Member

    Joined:
    Mar 23, 2005
    Messages:
    413
    Likes Received:
    2
    No, paying to get a version without the IDE, simulator, and support.

    The 'community' of users would have to support it.


    The binary format will work (with some processing) as a SNES rom. Here's what I used:

    To compile use:
    WDC816CC -ML File.c -O File.obj

    To link use:
    WDCLN -B -T -HB -MN -PFF -zCODE=8000,FFFF -C8000 -K8000 -D0000,1FFF -U0000,1FFF -V startupSnes.obj File.obj -O File.bin

    The generated file needs to be padded to a multiple of 64k, and the first 32k of each 64k block needs to be removed from the file.

    This will span data correctly across banks ($8000,$18000, etc). A function can only fill one bank though.

    This should work. I will be testing it further tonight.
     
    Last edited: Nov 12, 2007
  8. lint

    lint Member

    Joined:
    Sep 24, 2007
    Messages:
    24
    Likes Received:
    0
    I am about at the same point that you. I just prefer to take the ISX path since WDC support it as the nintendo format. I will install myself a C compiler by tomorow and make a quick ISX to ROM converter. Within 24h i should have something up and running (i will start by a linux version since it's my predilection dev platform when i need to write a tool in C).

    Anyway keep the good work going.

    Im not sure we need to "buy" the pro version of the WDC sdk since the limitation annouced by WDC for the free sdk dont seem to be real.

    See ya,

    ++ Lint
     
  9. cdoty

    cdoty Gutsy Member

    Joined:
    Mar 23, 2005
    Messages:
    413
    Likes Received:
    2
    The only two limits I've found are the 750 lines per C file, and the assembly language 2k size limits (with doesn't include data, only code).

    Both are very easy to work with.
     
    Last edited: Nov 12, 2007
  10. cdoty

    cdoty Gutsy Member

    Joined:
    Mar 23, 2005
    Messages:
    413
    Likes Received:
    2
    The WDC compiler will work for SNES development. This isn't a multi-bank project, but adding a bank appeared to work without any problems. You will have to use jsl/rtl instead of jsr/rts, unless you know the routines are located in the same bank.

    Here's my first test project, using some of the routines from Frog Feast; it does not use any libraries included with the compiler.

    http://www.rastersoft.net/WDCTest.zip

    I used the binary format, and wrote a utility to convert from binary to SNES binary.

    The assembler and C compiler seem very easy to use. The only issue I had was initially finding the command to include a binary file, it's INSERT.

    Edit:
    The file has been updated to include a utility to convert the map file to a WLA symbol file. This works with the Super Sleuth emulator (http://users.tpg.com.au/advlink/spx/mainframe.html). The mk.bat file has the utility commented out.
     
    Last edited: Nov 13, 2007
  11. lint

    lint Member

    Joined:
    Sep 24, 2007
    Messages:
    24
    Likes Received:
    0
    Very nice work.

    I haven't got the time to work on my isx tool yet. Hope to get something by end of the week.

    Keep up the good work,

    ++ Lint
     
  12. babu

    babu Mamihlapinatapai

    Joined:
    Apr 15, 2005
    Messages:
    2,945
    Likes Received:
    3
    nice. never heard of this emulator before. Allways used that "Geiger's Snes9x Debugger" emu.. is the emu any accurate? Think I'm gonna give this one a try.
     
  13. cdoty

    cdoty Gutsy Member

    Joined:
    Mar 23, 2005
    Messages:
    413
    Likes Received:
    2
    I'm not sure how accurate it is. I think it's designed more as a development tool, rather than an accurate emulator.

    I routinely use BSNES for accurarcy.
     
    Last edited: Nov 13, 2007
  14. babu

    babu Mamihlapinatapai

    Joined:
    Apr 15, 2005
    Messages:
    2,945
    Likes Received:
    3
    was mostly thinking if it's good enough to use for development - and I guess that's a yes considering your comments
    (I do final testing on real HW any way)
     
  15. cdoty

    cdoty Gutsy Member

    Joined:
    Mar 23, 2005
    Messages:
    413
    Likes Received:
    2
    Personally, I use MESS for debugging, BSNES for a quick santy check, and an old Romulator ISA card for testing on a real system. I recently got a GD6, which should be easier to use for testing on a real system.
     
  16. kammedo

    kammedo and the lost N64 Hardware Docs

    Joined:
    Sep 24, 2004
    Messages:
    2,138
    Likes Received:
    12
    Why didnt you get a GD7 from tototek?
    They arent that expensive...
     
  17. cdoty

    cdoty Gutsy Member

    Joined:
    Mar 23, 2005
    Messages:
    413
    Likes Received:
    2
    I initially thought about that. But, I was able to get the GD6 with 32 Mbit for around $30. And, the GD6 also has a parallel port, and I found out the floppy is easier and faster for testing.
     
  18. lint

    lint Member

    Joined:
    Sep 24, 2007
    Messages:
    24
    Likes Received:
    0
    Floppy faster ? hell no ... i found myself easier my the // port of my pro fighter Q+. 30$ for a GD6 ... it's a nice price ... If anyone got cheap SNES Backup Units feel free to contact me.

    I haven't yet started the isx convert tool, since i'm busy on an other project, got my day job and my family to take care of.

    I keep you updated anyway...

    ++ Lint
     
  19. cdoty

    cdoty Gutsy Member

    Joined:
    Mar 23, 2005
    Messages:
    413
    Likes Received:
    2
    Is using isx format important? It would be nice to use the debugging information, but the only emulator that uses any debugging information only uses addresses, which can be taken from the map file.
     
    Last edited: Nov 15, 2007
  20. lint

    lint Member

    Joined:
    Sep 24, 2007
    Messages:
    24
    Likes Received:
    0
    Not that much important, you are right ... but i would like to create that tool anyway...
     
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page