SNES C compiler?

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

  1. Borman

    Borman Digital Games Curator

    Joined:
    Mar 24, 2005
    Messages:
    9,543
    Likes Received:
    1,880
    If you guys find the files, send them to me. Ill host certain dev tools on my site.
     
  2. babu

    babu Mamihlapinatapai

    Joined:
    Apr 15, 2005
    Messages:
    2,945
    Likes Received:
    3
    your in luck as the drive that died yesterday didn't have it ;)

    clicky
     
  3. Producer

    Producer Member

    Joined:
    Sep 7, 2007
    Messages:
    24
    Likes Received:
    0

    Very very thank you...
     
  4. lint

    lint Member

    Joined:
    Sep 24, 2007
    Messages:
    24
    Likes Received:
    0
    Hi,

    There is a free sdk available from WDC. You can get it there : http://westerndesigncenter.com/wdc/Evaluation_Kit/freesdk.exe

    Apparently the free version is a bit limited but it is something that need to be confirmed. In the linker they a few options specific for nintendo.

    Does someone already used this compiler?

    The full version (pro sdk) is available for 395$ wich is a bit expensive for me.

    ++ Lint
     
  5. Producer

    Producer Member

    Joined:
    Sep 7, 2007
    Messages:
    24
    Likes Received:
    0
    But the C Compiler of the free Version is limited to 250 lines code... This is not enough...
     
  6. lint

    lint Member

    Joined:
    Sep 24, 2007
    Messages:
    24
    Likes Received:
    0
    Here a the tools limitation specified during installation :

    The only strange stuff is that the -a flag on WDC816CC is working for me. I only have the tools suite for a bit more than 2 days and i have not yet tested to compile, assemble or link many code or object. I going to make a test with more than 250to see the result :

    It's seems then that the limitation are no mor ein place. Can somebody please confirm this ?

    thanks,

    ++ Lint
     
  7. Producer

    Producer Member

    Joined:
    Sep 7, 2007
    Messages:
    24
    Likes Received:
    0
    The freeSDK is very buggy... i would test it - the toolbar produce Messageboxes with "Access Violation"... But over the terminal i can create object file from source... and this by 300+ Code...

    The Object Viewer showsw me
    Code:
    wdobject.exe main.obj
    WDC Object Viewer EVALCOPY Jan 18 2006 17:36:06
    Module: main.obj
    section CODE               org=$0 size=$26D
    
    CODE : 000000 : REL :              : GDrvpt : __main
    How compile object to binary?
    WDCLN with Nintendo memorymap?
    [​IMG]
     
    Last edited: Oct 3, 2007
  8. lint

    lint Member

    Joined:
    Sep 24, 2007
    Messages:
    24
    Likes Received:
    0
    -HN options is effectively buggy (don't work at all), but if you read the doc you will see that the -HN is to create debug binary. Do we really need that ? -MN command maybe more appropriate. I also had the ability to link more than 2 .obj files (one more tools limitation that is not true).

    I now need a tool (command line or GUI) that allow to add the SWC header and make some tests with a emulator. I'm currently quite busy and only have 1h free time during my train transportation from home to office and way back.

    I keep you updated as soon as possible.

    ++ Lint
     
  9. d4s

    d4s Robust Member

    Joined:
    Jan 28, 2005
    Messages:
    287
    Likes Received:
    3
    you dont need an swc/backup unit header to run it on an emulator.
    in fact, all emulators i know of completely disregard it.
    strictly speaking, you just need the reset vector at $fffc in bank 0 in order to create a valid executable on the snes.
    however, most emulators use heuristics to detect rom mapping and therefore, your rom should have a complete and valid nintendo header at $ffc0.
    otherwise, emulators might not be able to run it at all.
     
    Last edited: Oct 4, 2007
  10. lint

    lint Member

    Joined:
    Sep 24, 2007
    Messages:
    24
    Likes Received:
    0
    I was walking during my lunch time and i said to myself that that kind of header wasnt needed. Dont we need a nintendo header anyway (that was i wanted to say in fact) or it's just the same ?

    I will try to test that out when i got back from work and post later tonight. Is there any way any good command line tools for header manipulation.

    D4S are you still keeping "ultrasnes" schematics and code for yourself or you wanna share ?

    I may abuse, but if anyone got scan or OCR of official snes i dont mind to get a link. Thanks in advance.

    ++ Lint
     
  11. Producer

    Producer Member

    Joined:
    Sep 7, 2007
    Messages:
    24
    Likes Received:
    0
    How can i fix that C-Compiled roms not run on SNES9X - only ZSNES?
    It show Checksum Fail on Zsnes but run... It show bad ROM :shrug:

    Any Ideas?

    [​IMG]
    [​IMG]



    Yes i, too. ;-)


    Edit: because i hear from lint he think i use wdc: "My Hello World Application is written in snesc"!
     
    Last edited: Oct 9, 2007
  12. lint

    lint Member

    Joined:
    Sep 24, 2007
    Messages:
    24
    Likes Received:
    0
    Wich tool are you using to generate rom header ?
     
  13. d4s

    d4s Robust Member

    Joined:
    Jan 28, 2005
    Messages:
    287
    Likes Received:
    3
    judging by the screenshot of the snes9x debugger, it should boot up fine.(correctly detected the rom mapping and runs off the correct reset vector, at least)
    i`ll most likely be able to spot the problem, but you`d have to send the compiled rom or the sourcecode my way first.


    lint:
    will probably share sooner or later, but i`m still not happy with the hardware side of things.
    i do know there are quite a few people waiting for it and i don`t like how long it takes to finish, either, but theres not much i can do about it right now.
    imo, the prototype i assembled a year ago is lacking in so many ways that it would just be a disappointment if i released its schematics and software as is.
    besides, i still think about eventually selling it once its done, so releasing schematics and software would be kind of contra-productive in that case.
     
  14. lint

    lint Member

    Joined:
    Sep 24, 2007
    Messages:
    24
    Likes Received:
    0
    d4s : thanks for you answer about ultrasnes.

    producer :

    Did you made some avancement ? On my side i have been too busy to do anything else. Any time you got something fully working do you mind to post a .zip of your hello world app with makefile and so on ? My main question is wich linker flag are you using and how do you set the interupt vector ?

    See ya later all,

    ++ Lint
     
  15. Producer

    Producer Member

    Joined:
    Sep 7, 2007
    Messages:
    24
    Likes Received:
    0
    Progresspost:


    Here is the Source from Hello World for SNESC


    Code:
    #include "graphics.txt"
    #include "string.txt"
    resource {
      "font.smc" as font;
      "palette.dat" as palette;
    }
    void main() {
      char st[11]="HALLO WELT", st2[11]="          ";
      unsigned int hintergrund[0x400], pal[0x100];
      settiles(0, font, 0xF00);
      memcopy(pal, palette, 0x200);
      writestring(st, hintergrund, 0x416, 0x3F6);
      setmap(0, hintergrund);
      setpalette(pal);
      enablescreen(); 
    }
    Binary:
    http://uploaded.to/?id=406861


    Screens:

    [​IMG]

    Here is the Soruce of a text based Scissor, Stone, Paper... but it is in German... you can edit the Strings to translate in english or any other language...
    Code:
    #include "graphics.txt"
    #include "string.txt"
    #include "input.txt"
    resource {
      "font.smc" as font;
      "palette.dat" as palette;
    }
    void main() {
      char st[7]="Schere", st2[7]="Stein ", st3[7]="Papier";
      char point[2]=">", blank1[2]=" ", blank7[7]="      ";
      char enemy[7]="CPU   ", player[7]="Player";
      char du[14]="Du gewinnst  ", er[14]="Du verlierst ", gleich[14]="Unentschieden", blank14[14]="             ";
      char anw[23]="Neue Runde Start Knopf",anw2[27]="Auswahl mit A Knopf   ", blank23[23]="                      ";
      unsigned int hintergrund[0x400], pal[0x100], menu=2, random=0;
      start:
      settiles(0, font, 0xF00);
      memcopy(pal, palette, 0x200);
      writestring(st, hintergrund, 0x216, 0x3F6);
      writestring(st2, hintergrund, 0x316, 0x3F6);
      writestring(st3, hintergrund, 0x416, 0x3F6);
      writestring(point, hintergrund, 0x310, 0x3F6);
      writestring(anw2, hintergrund, 0x610, 0x3F6);
      setmap(0, hintergrund);
      setpalette(pal);
      enablescreen();
    label1:
    resettimer();
    if ((getjoystatus(0) & UP_BUTTON) != 0) {
        if (menu == 2){
        writestring(blank1, hintergrund, 0x310, 0x3F6);
        writestring(point, hintergrund, 0x210, 0x3F6);
        setmap(0, hintergrund);
        menu = 1;
        while (getjoystatus(0) != 0) { clearjoy(0); delay(5); }
        }
        if (menu == 3){
         writestring(blank1, hintergrund, 0x410, 0x3F6);
         writestring(point, hintergrund, 0x310, 0x3F6);
         setmap(0, hintergrund);
         menu = 2;
         while (getjoystatus(0) != 0) { clearjoy(0); delay(5); } 
        }
      }
      if ((getjoystatus(0) & DOWN_BUTTON) != 0) {
        if (menu == 2) {
        writestring(blank1, hintergrund, 0x310, 0x3F6);
        writestring(point, hintergrund, 0x410, 0x3F6);
        setmap(0, hintergrund);
        menu = 3;  
        while (getjoystatus(0) != 0) { clearjoy(0); delay(5); } 
        }
        if (menu == 1){
         writestring(blank1, hintergrund, 0x210, 0x3F6);
         writestring(point, hintergrund, 0x310, 0x3F6);
         setmap(0, hintergrund);
         menu = 2;
         while (getjoystatus(0) != 0) { clearjoy(0); delay(5); } 
        }
      }
      if ((getjoystatus(0) & A_BUTTON) != 0) {
        if (menu == 1){
        while (getjoystatus(0) != 0) { clearjoy(0); delay(5); } 
        writestring(blank1, hintergrund, 0x210, 0x3F6);
        writestring(blank1, hintergrund, 0x310, 0x3F6);
        writestring(blank1, hintergrund, 0x410, 0x3F6);
        writestring(blank7, hintergrund, 0x216, 0x3F6);
        writestring(blank7, hintergrund, 0x316, 0x3F6);
        writestring(blank7, hintergrund, 0x416, 0x3F6);
        writestring(blank23, hintergrund, 0x610, 0x3F6);
        writestring(player, hintergrund, 0x110, 0x3F6);
        writestring(st, hintergrund, 0x120, 0x3F6);
        writestring(enemy, hintergrund, 0x210, 0x3F6);
        random = random % 3;
        if (random == 0)
        {    
        writestring(st2, hintergrund, 0x220, 0x3F6);
        writestring(er, hintergrund, 0x412, 0x3F6);
        writestring(anw, hintergrund, 0x608, 0x3F6);
        setmap(0, hintergrund);
        menu = 4;
        }
        if (random == 1)
        {    
        writestring(st, hintergrund, 0x220, 0x3F6);
        writestring(gleich, hintergrund, 0x412, 0x3F6);
        writestring(anw, hintergrund, 0x608, 0x3F6);
        setmap(0, hintergrund);
        menu = 4;
        }
        if (random == 2)
        {    
        writestring(st3, hintergrund, 0x220, 0x3F6);
        writestring(du, hintergrund, 0x412, 0x3F6);
        writestring(anw, hintergrund, 0x608, 0x3F6);
        setmap(0, hintergrund);
        menu = 4;
        }
        }
        if (menu == 2){
        while (getjoystatus(0) != 0) { clearjoy(0); delay(5); } 
        writestring(blank1, hintergrund, 0x210, 0x3F6);
        writestring(blank1, hintergrund, 0x310, 0x3F6);
        writestring(blank1, hintergrund, 0x410, 0x3F6);
        writestring(blank7, hintergrund, 0x216, 0x3F6);
        writestring(blank7, hintergrund, 0x316, 0x3F6);
        writestring(blank7, hintergrund, 0x416, 0x3F6);
        writestring(blank23, hintergrund, 0x610, 0x3F6);
        writestring(player, hintergrund, 0x110, 0x3F6);
        writestring(st2, hintergrund, 0x120, 0x3F6);
        writestring(enemy, hintergrund, 0x210, 0x3F6);
        random = random % 3;
        if (random == 0)
        {    
        writestring(st2, hintergrund, 0x220, 0x3F6);
        writestring(gleich, hintergrund, 0x412, 0x3F6);
        writestring(anw, hintergrund, 0x608, 0x3F6);
        setmap(0, hintergrund);
        menu = 4;
        }
        if (random == 1)
        {    
        writestring(st, hintergrund, 0x220, 0x3F6);
        writestring(du, hintergrund, 0x412, 0x3F6);
        writestring(anw, hintergrund, 0x608, 0x3F6);
        setmap(0, hintergrund);
        menu = 4;
        }
        if (random == 2)
        {    
        writestring(st3, hintergrund, 0x220, 0x3F6);
        writestring(er, hintergrund, 0x412, 0x3F6);
        writestring(anw, hintergrund, 0x608, 0x3F6);
        setmap(0, hintergrund);
        menu = 4;
        }
        }
        if (menu == 3){
        while (getjoystatus(0) != 0) { clearjoy(0); delay(5); } 
        writestring(blank1, hintergrund, 0x210, 0x3F6);
        writestring(blank1, hintergrund, 0x310, 0x3F6);
        writestring(blank1, hintergrund, 0x410, 0x3F6);
        writestring(blank7, hintergrund, 0x216, 0x3F6);
        writestring(blank7, hintergrund, 0x316, 0x3F6);
        writestring(blank7, hintergrund, 0x416, 0x3F6);
        writestring(blank23, hintergrund, 0x610, 0x3F6);
        writestring(player, hintergrund, 0x110, 0x3F6);
        writestring(st3, hintergrund, 0x120, 0x3F6);
        writestring(enemy, hintergrund, 0x210, 0x3F6);
        random = random % 3;
        if (random == 0)
        {    
        writestring(st2, hintergrund, 0x220, 0x3F6);
        writestring(du, hintergrund, 0x412, 0x3F6);
        writestring(anw, hintergrund, 0x608, 0x3F6);
        setmap(0, hintergrund);
        menu = 4;
        }
        if (random == 1)
        {    
        writestring(st, hintergrund, 0x220, 0x3F6);
        writestring(er, hintergrund, 0x412, 0x3F6);
        writestring(anw, hintergrund, 0x608, 0x3F6);
        setmap(0, hintergrund);
        menu = 4;
        }
        if (random == 2)
        {    
        writestring(st3, hintergrund, 0x220, 0x3F6);
        writestring(gleich, hintergrund, 0x412, 0x3F6);
        writestring(anw, hintergrund, 0x608, 0x3F6);
        setmap(0, hintergrund);
        menu = 4;
        }
        }
      }
    if ((getjoystatus(0) & START_BUTTON) != 0){
        if (menu == 4)
        {
        writestring(blank23, hintergrund, 0x608, 0x3F6);
        writestring(blank7, hintergrund, 0x110, 0x3F6);
        writestring(blank7, hintergrund, 0x210, 0x3F6);
        writestring(blank14, hintergrund, 0x412, 0x3F6);
        writestring(blank7, hintergrund, 0x120, 0x3F6);
        writestring(blank7, hintergrund, 0x220, 0x3F6);
            menu = 2;
            clearjoy(0);
            goto start;
        }
    }
    random=random+1;
    sync(1);
    goto label1;
    }
    Here is the Binary: http://uploaded.to/?id=x9toha



    Screens:

    [​IMG][​IMG]



    I hope it help somebody to code for SNES, and that the WDC working...
     
  16. d4s

    d4s Robust Member

    Joined:
    Jan 28, 2005
    Messages:
    287
    Likes Received:
    3
    very interesting.
    just had a quick look at a disassembly of your hello world rom.
    the reason why it isnt working on snes9x, bsnes most likely not even a real snes is that it tries to read a write-only register and relies on the data read.
    its actually pretty funny:
    they try to read the dma enable register to check if all dma transfers have been completed.

    after initiating a transfer on the snes, code execution is automatically halted and not resumed before all transfers are done. therefore, you dont need to check for completed dma transfers at all.

    replacing this
    Code:
    $80/8080 AD 0B 42    LDA $420B  [$00:420B]   A:0002 X:022A Y:0002 P:envMxdIzc
    $80/8083 D0 FB       BNE $FB    [$8080]      A:0042 X:022A Y:0002 P:envMxdIzc
    with

    lda.b #$0
    nop
    nop
    nop

    in the rom cures the problem.
    however, such a fundamental error leads me to believe that the libraries were never really tested.
    i assume you`ll have to rewrite some of the display and irq stuff before being able to put them to good use.
     
    Last edited: Oct 10, 2007
  17. Producer

    Producer Member

    Joined:
    Sep 7, 2007
    Messages:
    24
    Likes Received:
    0
    Thank you d4 for the informations... i have disassembling the ROM too (i use tracer with -o and -t) - and become a 3,5 MB File from a 512KB Binary...

    But when i change the code (like you write) i cant assembly the source... WLA doesnt know the symbol INC from Line 33... Use you a other assembler or a other disassembler?

    Yes, i think so too. The Website from the compiler[FONT=&quot] is down, but i heard that it had many other libaries store on that. Have anybody any files from that? (more examples, or libaries?) I had write for any time a email to the ex-webmaster of the lfx.org space but he hasnt a backup from the subdomain... :shrug:
    [/FONT]
     
  18. lint

    lint Member

    Joined:
    Sep 24, 2007
    Messages:
    24
    Likes Received:
    0
    C Compiler from WDC update ... and need for more information

    After a few weeks of playing with the wdc sdk, I finally have been able to get some real results. However it's still not fully functionnal, it still need a bit more work to be able to output valid ROM binaries.

    The Binary output provided by WDC is kind of too raw, not constructing the ROM the right way using the memory mapping type given by -MN.. options. Using the right options (by example : wdcln -B -t -sz -HN -MN -V startupSnes.obj main.obj -O test.smc) we are able to use the "Nintendo debug format" that will output an isx file. This test.smc file in isx format is not able to boot directly on a backup unit or an emu or be flashed directly to an Snes cart.

    Im here trying to collect information about the ISX format itself. I thing that "Inteligent System" is the creator of this format. And this format is suposed to be run on the SE-emulator. I have also read on a Gameboy dev faq that there was a tool called "cvtisx" that was supposed to read isx and convert to ROM binary.

    Any information is welcome ... Here on the forum or by pm.

    Thanks,

    Lint
     
  19. kammedo

    kammedo and the lost N64 Hardware Docs

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

    Very very nice work!! Keep it going! I have some of the tools for the SE developement, you can torrent them down - im not sure if it can help, but if you want i can put them for download.
     
  20. lint

    lint Member

    Joined:
    Sep 24, 2007
    Messages:
    24
    Likes Received:
    0
    What i really need is ISX tools of file specification

    Hi,

    Thanks for the help proposal. I will contact you in private about that.

    For the others, what i really need is information about the .isx file format or tools that might help me convert isx file format to ROM format. From what i have already seen the .isx format is declined in different version that not compatible with each other. Any info on that file format is welcome. I'm starting to reverse engineering my test files, but im really seeking for a more complete specification if possible, in order to not waste too much of my time.

    See ya,

    ++ Lint
     
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page