#134646 - thegamefreak0134 - Sun Jul 15, 2007 6:43 am
No, this is not a noobish question like it appears to be. I am about to go on a very long road trip, and it has become quite apparent to me that I will not be able to actually "program" on my computer, because I am not allowed to bring it along. Thus, I was wondering if someone has created a simple programming language for the DS, or possibly the ability for something like DSlinux to actually compile code. I know this is asking a lot, but I just want to know if something useable exists that can be programmed on the DS itself, without having to use a PC.
If not, I fully intend to make said project, although (obviousy) it will have to wait until after my road trip. I have great faith in a token based interpreter system running at decent speeds, and I believe I can create a wide enough range of commands and variable types to make something rather workable. Getting graphics to work might be a pain, but I think I could at least do something for on-the-road theorey testing, like in a console window, or with very simplified graphics commands. (I was actually thinking of modeling it after TI-BASIC, although without the calculator-specific functions and bugs of course.)
If something like this already exists, let me know. Heck, if I get to write the first compiler for the DS, something is terribly wrong here... ^_^
-gamefreak
PS: please don't bug me about what I should do with said project, it's not official yet. ^_^
_________________
What if the hokey-pokey really is what it's all about?
[url=http:/www.darknovagames.com/index.php?action=recruit&clanid=1]Support Zeta on DarkNova![/url]
#134656 - thehive - Sun Jul 15, 2007 10:02 am
#134722 - thegamefreak0134 - Mon Jul 16, 2007 5:54 am
Hmm... this sounds interesting, and it's certainly what I was going for. It's too bad that it's an older version that does not support SD cards though, as that's what I'm using for everything.
I am getting more and more serious about actually writing an interpreter myself though. Heck, I spent almost all of today at work trying to work out the logistics of parsing an expression written using tokens, and I think I've got some manageable ideas down. Problem is, all I have to work with on the road (starting tomorrow, *sob*) is a notebook and a pencil. DS BASIC does not support strings or arrays it seems, so it wouldn't even be good for trying out my interpreter idea, because there is no easy way to gather a list of input. Of course, I haven't played with it much, but still.
This is something that I know I want to do. So I'm going to go ahead and list some ideas I've had.
Output: This is the fancyness of every language written, as it's the only way you get to see the results of what you have done. I plan to begin by implementing a console-based text system, probably by wrapping the already-existing console in a DS-editable language. This will be on one screen, the other screen will default to being the "debug" screen, which I'll set up for you to be able to pull up at any time with code on either supporting map, so you can see things like variable contents and memory stuff.
I will also plan to allow the user to change the function of all "screens", meaning that you can essentially set up the backgrounds and things on the DS using the interpreter. (This will be a much later feature, as I need to get expression parsing going before the program even becomes useful.) That way, you can essentially do with this program what you can do normally, with a major limitation on speed due to the interpreting of course. I aim for simple games to be quite possible without a slowdown, but we'll see. I'm not quite sure how to implement this all yet, but I know that the text and bitmap modes of any background I want to model after the TI functions, because I find them rather useful. (Plus they can be re-implemented very quickly.)
Input: Along with raw button input, I will also allow direct variable input on text screens, using a variety of methods. Most likely, input will pull up a separate background with a keyboard, allowing the user to type something in, and will alter the keyboard based on whether the variable in question is a number, string, etc, thus disallowing invalid input. The program will at first simply call this up on-top of the debug screen, but of course I will want this all changeable later. I also plan to include touch screen input, but I'm not sure mic input can be done or is even a necessity for this kind of project.
Functions: Along with the basics of a Basic style language, I want to include such things as custom variable names and custom functions. This is a feature left out of the TI included language, and one I feel is rather useful. In order for this to work however, the program will have to undergo a "compile" stage, so that the function and variable names become something that can be recognized by the token system. (Parsing code on-the-fly seems like it would be extra slow, so I'm planning to avoid it at all costs.) Not quite sure how to actually handle this at all, but I do want it to be done.
Memory: The first releases, as stated, will allow a set number of variables of various types. This will change as I become more confortable with the idea, and I plan to be very non-basic and allow the dynamic creation of different variables. I will implement this by setting aside a (target value here) 2MB block of memory in the DS Work RAM, and then using interpreter functions to manage declared data within that block. Not sure quite how this will work out, but since I plan to also include basic FAT operation (to allow working on files with the language) users will definitely need to be able to load bits of files into memory, or create data based on information in those files.
I also want to implement a way to write to (and read from) specific memory addresses on the DS, very similar to what you do to read registers normally. This will allow people to use the interpreter to do all sorts of things that I have chosen not to implement, should their hearts desire.
Basically, I'm aiming to make homebrew possible with nothing more than a nintendo DS, and the homebrew equipment. While an interpreter can never substitute for compiled code, I still want people to be able to test out ideas and such on the road.
I think I am at a decent enough skill level to be able to actually pull this off, crazy though it may sound. What you see above is the result of a days worth of brainstorming, and a lot of it may be absurd, good or bad ideas, or not even possible. It's just a dream really. I'll whip out a dev environment when I can and see what I can come up with though. Check back in about two weeks and I may have some progress. (I do not plan to be online for about that long, sadly.)
Please comment. It makes me feel special, even if it's insane.
-thegamereak
_________________
What if the hokey-pokey really is what it's all about?
[url=http:/www.darknovagames.com/index.php?action=recruit&clanid=1]Support Zeta on DarkNova![/url]
#134728 - DekuTree64 - Mon Jul 16, 2007 6:21 am
I say go for it. You'll learn stuff, and maybe end up with something useful :)
One thing I've been tossing around ideas about is an assembler that runs on the DS. For starters, I'd probably just do a simple touch screen keyboard for input, and a single source file for ARM9, with default ARM7 binary.
Eventually I'd want to do a nice graphical interface, with buttons for all the instructions and registers so you don't have to type them manually. And multiple source files. But I really don't want to figure out how to parse the GNU .o format, so I might just make my own intermediate format.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku
#134731 - thegamefreak0134 - Mon Jul 16, 2007 6:57 am
Deku, your support is basically all the encouragement I need. ^_^ Thanks.
This will be my last post for a while or so, I'm signing off for tonight. Hopefully, within a month or so, I'll actually have High-Speed internet (all to myself) so I'll be able to do this sort of thing properly. Expect to see something usable (good is debatable, as always) by Christmas, as I'll be tied up with College and all.
-thegamefreak
_________________
What if the hokey-pokey really is what it's all about?
[url=http:/www.darknovagames.com/index.php?action=recruit&clanid=1]Support Zeta on DarkNova![/url]
#134855 - sonny_jim - Tue Jul 17, 2007 8:14 pm
Just so you know, there's a cut down port of perl in DSLinux.
#134870 - Dood77 - Tue Jul 17, 2007 9:30 pm
This sounds like a great idea! I first learned programming on my Ti-83+ back in 8th grade... One feature I would like to stress is the ability to expand and add new functions through compiled C code, so people can write image loading functions, etc. in C and compile them and we can use them in your project. Hopefully this won't turn into something like PSP lua though... But I'm guessing it won't be nearly as powerful.
_________________
If I use a term wrong or something then feel free to correct, I?m not much of a programmer.
Original DS Phat obtained on day of release + flashme v7
Supercard: miniSD, Kingston 1GB, Kingston 2GB
Ralink chipset PCI NIC
#134927 - Ollie - Wed Jul 18, 2007 1:13 pm
I'm not a particularly great programmer, but i've recently completed a simplistic run-time enterpretted script-engine type affair. It's a scripting system that is rather ASM-Styled as I felt no need to implement syntax tree generation.
It's essentially like:
Code: |
function main
{
variable: result 0; //make a variable "result", value 0
call: add 10 15; //go to function "add", push 10 and 15 onto the stack
pop:result; //get the result off the stack
showvar:result _; //print the result out, with a newline after it
}
function add
{
variable: __tempvar_A 0; //make two temporary variables
variable: __tempvar_B 0;
pop:__tempvar_A; //pop the two arguments off the stack
pop:__tempvar_B;
add:__tempvar_A __tempvar_B; //call the built in add function which pushes the result onto the stack
removevar:__tempvar_A;
removevar:__tempvar_B;
}
|
This isn't a particularly neat language due to it's semi-ASM inspiration, however it's perfectly usable and very very extendable because I used polymorphism in the script engine's design.
I think I shall try to make a working example where this langauge can be used to control the nintendo DS. Hopefully ;)
If you want you can have the source code to the script engine. Just ask. (I know you won't ;)
#134948 - JLsoft - Wed Jul 18, 2007 8:30 pm
There's also a compile of DSLua 0.7 out, and that has DLDI support, so it'd involve just editing text files in \scripts to write simple stuff. :)
#135255 - LiraNuna - Sat Jul 21, 2007 2:38 pm
The JIM Interperter
:)
_________________
Private property.
Violators will be shot, survivors will be shot again.
#136105 - thegamefreak0134 - Sun Jul 29, 2007 6:09 am
Well HI again... Gosh I never thought road trips were so long...
KK, I start work on this project (officially) tomorrow, so keep a watch. I need to dust off my DS compiler and get going again, so you should expect something operating, if not doing a lot else, by the end of the week.
For the starting run, I've already decided to implement only a console-based language, using the console rendering engine that is a part of the semi-standard DS libraries already.
To answer your image question however, I do plan to allow for loading of images from the FAT system, and plan to include easy-enough ways to load those images into RAM (in various formats) or into the appropriate sprite or tile-map location. Although these will obviously be a bit slow due to the interpretation involved, they should be workable.
One of my top concerns early on is the ability to write directly to (and read directly from) memory, even in a very simple way, so that my language can do all sorts of things, slow or not, right from the start. The only catch there is, there will be specific areas of memory that will crash the interpretor if fooled with, so I'll need to document what should not be done.
I'll probably need some help from the community early on however. Math is my strong suit, easily. However, implementing the rules that make math work is more complicated than it sounds. I will need to be able to parse mathematically-logical equasions with my interpreter, and I know perfectly well that this is going to give me grief, so be prepared to answer a lot of silly questions. ^_^
kk, enough of this babble, on to work!
-thegamefreak
PS: Washington is really nice. Bit cold, but nice.
_________________
What if the hokey-pokey really is what it's all about?
[url=http:/www.darknovagames.com/index.php?action=recruit&clanid=1]Support Zeta on DarkNova![/url]
#136107 - thegamefreak0134 - Sun Jul 29, 2007 6:32 am
I'm sorry to double-post here... I'm playing with the web-browser in DSOrganize. ^_^
-thegamefreak (quite happy)
Do I get the first post from a DS?
_________________
What if the hokey-pokey really is what it's all about?
[url=http:/www.darknovagames.com/index.php?action=recruit&clanid=1]Support Zeta on DarkNova![/url]
#136305 - me101 - Tue Jul 31, 2007 3:13 am