picocDS - C programming on the go! (DS Entry)

Discussion in 'NDS - Emulation and Homebrew' started by asiekierka, Feb 26, 2011.

  1. asiekierka
    OP

    asiekierka Advanced Member

    Newcomer
    99
    69
    Sep 26, 2007
    Poland
    So I am working on a proper port of picoc to the DS as my Homebrew Bounty project. I only started working on it today, though.

    picoc is a C interpreter with 99% of the ANSI C standard supported. That's right, it's an interpreter.

    CURRENT PORT FEATURES:
    - a quick port of the picoc interactive shell
    - most C standard functions supported
    - DS-specific functions added (with more coming!)

    HOW TO USE:

    Self-explanatory, really. Just input C code into the shell.

    Code:
    starting picoc v2.1
    picoc> char inbuf[80];
    picoc> gets(inbuf);
    hello!
    picoc> printf("I got: %s\n", inbuf);
    I got: hello!
    Sometimes in interactive mode you want to change a function or redeclare a variable. You can do this using the "delete" statement:

    Code:
    starting picoc v2.1
    picoc> int fred = 1234;
    picoc> printf("fred = %d\n", fred);
    fred = 1234
    picoc> delete fred;
    picoc> char *fred = "hello";
    picoc> printf("fred = '%s'\n", fred);
    fred = 'hello'
    You may want to load C files that you've prepared before. Let's assume you want to load test1.c, which is located in the main directory of your SD card. To do that, do this:

    Code:
    picoc> load "/test1.c";
    picoc>
    You can now use functions and code from that C file!

    Works in both DS and DSi mode, and it's quite fast!

    For more information please consult the README or the picoc wiki.

    MILESTONES (bXX - build XX):
    M1 (done at b02)
    - Have it work (b01)
    - Most standard C functions working (b02)

    M2 (done at b04)
    - Add some of the NDS-specific functions (began at b03, still in progress)
    - Add loading C files (b04)

    M3
    Idk. Maybe integrate a text editor?

    I fixed the links now
    DOWNLOAD:
    build 04 (20110326) - binary
    build 04 (20110326) - source
     
  2. Vigilante

    Vigilante TempLurker

    Member
    1,555
    46
    Jan 1, 2010
    CyberSpace IQ:OVER 9000
    Wow why is it most of the entiries things that people use to program isnt it suppose to be thing people can just go and play and use with
     
  3. asiekierka
    OP

    asiekierka Advanced Member

    Newcomer
    99
    69
    Sep 26, 2007
    Poland
    You don't use this to program FOR the DS.

    You use this to program ON the DS. In C.
    And it should compile on a normal PC, too!

    Coding on-the-go is quite awesome in my opinion, that's why I'm working on a port of picoc to the DS.

    Also, adding a milestone list to the first post.
     
  4. Frederica Bernkastel

    Frederica Bernkastel WebPerf and PWA advocate; @antoligy on Twitter

    Member
    3,150
    758
    Jan 31, 2008
    Hinamizawa
    Nice work asiekierka
    Even if it were, what exactly would be the problem with additional tools for developers?
    Just because it may not be useful to you, does not make it useless to everyone else.
     
  5. TehSkull

    TehSkull Living the life

    Member
    2,700
    388
    Nov 29, 2009
    United States
    Louisiana
    This is a cool concept, but I don't see it being very commonly used.

    Coding C on a DS just sounds like a pain.

    Python or something similar would be a much better fit.
     
  6. asiekierka
    OP

    asiekierka Advanced Member

    Newcomer
    99
    69
    Sep 26, 2007
    Poland
    https://www.develer.com/trac/dspython/

    Already done about 3 years ago. It even wraps a lot of libnds.
     
  7. TehSkull

    TehSkull Living the life

    Member
    2,700
    388
    Nov 29, 2009
    United States
    Louisiana
    Well nevermind then, lol. Still, your idea is one I've wished for in the past, so gg. [​IMG]
     
  8. The Pi

    The Pi Lurker

    Member
    1,638
    67
    Mar 18, 2010
    Scotland
    Sounds good, I'll try this later. [​IMG]
     
  9. SmokeFox

    SmokeFox Jesus Christ is the Lord

    Member
    537
    2
    Dec 27, 2010
    Brazil
    Brazil
    Me too.
     
  10. asiekierka
    OP

    asiekierka Advanced Member

    Newcomer
    99
    69
    Sep 26, 2007
    Poland
    I finally updated!

    NEW in build 4:
    - getTouchX() and getTouchY()
    - You can now load C files LIKE A BOSS
     
  11. ecko

    ecko GBAtemp Regular

    Member
    291
    39
    Nov 28, 2009
    Afghanistan
    on the fly syntax checking would be awesome for this
     
  12. asiekierka
    OP

    asiekierka Advanced Member

    Newcomer
    99
    69
    Sep 26, 2007
    Poland
    well it does, kind of
    when you input a line, or a procedure, it will syntax check it when you're done!
    the downside is you have to rewrite everything all over again
     
  13. Hyperlisk_

    Hyperlisk_ GBAtemp Regular

    Member
    187
    0
    Jan 30, 2008
    United States
    Bump for awesome. This is something I've wanted for awhile. Your thoughts about a builtin text editor are spot on. Definitely add it. I think you should expose the frame buffer (Just because it'd be easy), perhaps with functions such as drawPixel, drawLine, etc.
     
  14. RodrigoDavy

    RodrigoDavy GBAtemp Maniac

    Member
    1,453
    572
    Feb 9, 2011
    Brazil
    I liked your project, but for some reason the download link is not working for me.
    Is the link broken?
     
  15. corenting

    corenting GBAtemp Regular

    Member
    288
    51
    Jul 17, 2008
    France
    Yes, 404 error [​IMG]
    I wanted to test this too...
     
  16. asiekierka
    OP

    asiekierka Advanced Member

    Newcomer
    99
    69
    Sep 26, 2007
    Poland
    links fixed. sorry!