473,387 Members | 3,684 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Python on Nintendo DS

Hi,

I tried porting Python to the Nintendo DS, and it was surprisingly
easy. Installing something called devkitPro, devkitARM, libNDS, msys,
msys-DTK and then just using that to cross compile a python
installation.

Heres a screenshot of it running in the Dualis emulator. It runs
flawlessly for what has been compiled into it:
http://img520.imageshack.us/img520/2145/python240cj.jpg

You can download the source code to link against the static library and
add a method of input (which you can see in the picture). Also
included is a .nds file for running on your Nintendo DS:
http://files.filefront.com/NDSPython.../fileinfo.html

You click on keys on the touch screen to enter input. Notes: The
clicking on keys in the emulator is extremely non-responsive, on the
DS, it is perfect. Also, the emulators do not handle displaying the
right bits and pieces to the right screen, so the keyboard is displayed
on the top screen and the console on the touch screen (so its kind of
hard to use as you can't see the regions on the touch screen to click
on). The .nds file can be recompiled to use the lcd screens right for
emulators, but the .nds file was compiled to work correctly on a DS.

A problem.. On Dualis, the interpreter works perfectly. However, on
the Nintendo DS, it is completely unreliable and seems to corrupt at
random points. Occasionally you can get to the command line and enter
one command or two, but its guaranteed to corrupt at some point. I
have no idea why this is. I have to assume that Dualis implements the
processor and hardware specs more flexibly than they actually are on
the DS. And that there is some way the compilation options or linking
options can be modified to restrict the output to what the DS can
actually run.

If anyone has the time and interest to give it a shot at getting it
working, you will need a Nintendo DS with some form of homebrewing
hardware which lets you put storage mediums into the DS with custom
media.. like compiled .nds files. I use a Supercard, the compact flash
version.

As for the installation of tools required to compile .nds files, I used
the following page:
http://www.double.co.nz/nintendo_ds/nds_develop1.html
Then I went to the mingw sourceforge page and got msys-dtk and
installed that so that I would have autoconf and automake.
Then I extracted Python2.4 source code and opened a dos console, cd to
the directory with the Python source code and type the following:

set BASECFLAGS=-mcpu=arm9tdmi -mtune=arm946e-s -ffast-math -mthumb
-mthumb-interwork -DARM9
set CFLAGS=-mcpu=arm9tdmi -mtune=arm946e-s -ffast-math -mthumb
-mthumb-interwork -DARM9
set LDFLAGS=-specs=ds_arm9.specs -g -mthumb -mthumb-interwork
-Wl,-Map,libpython2.4.map
sh configure --host=arm-elf

This should give you a makefile, now you need to edit it. Change AR to
have a value of arm-elf-ar (configure doesn't pick that up properly).
Also, where there are references to OBJECT_OBJS, you need to also enter
NDS_OBJS to get included along with it. And enter the following in the
makefile somewhere, maybe after OBJECT_OBJS

NDS_OBJS = RISCOS/Python/getcwd_riscos.o

Also, go into Modules and edit Setup. Comment out all four of the
modules still listed uncommented in the same block, posix, errno, ...
Now in the top level python source code directory, type make.
It should make and then error claiming it can't link against some
function to do with ThreadState, locate all calls of that function in
Python/pystate.c and comment them out -- this is a bug in the Python
2.4.2 source distribution that pops up when threads are disabled. Now
it should compile the static library and error on the python.exe (which
is of no use to us).

You should now be able to compile the contents of NDSPythonStuff.zip
against that library (you'll need to make cosmetic changes to the
Makefile of course).

Anyway, if anyone can help with working out how to change the
compilation or linking options to get the code to work properly on the
DS, please email me.

Dec 21 '05 #1
2 5918
Hi!

Super mega cool.
Thanks!

MCI

Dec 21 '05 #2
Updated: http://www.disinterest.org/NDS/Python24.html

- Worked out why it was working sporadically (Supercard requires the
NDS loader to be prepended to ROMs). I assumed I was getting a ROM
created with the loader/forgot that it was required, since it even ran.
- Hooked it up to FAT file system code that can read and write to the
compact flash card in the GBA slot (Supercard in my case).
etc.

Jan 9 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

53
by: john67 | last post by:
The company I work for is about to embark on developing a commercial application that will cost us tens-of-millions to develop. When all is said and done it will have thousands of business...
0
by: Cameron Laird | last post by:
QOTW: "ortability is an n-way street." - Paul McGuire "Python's polymorphism support is so good that it makes inheritance much less important than it is in other languages." - Ben Sizer ...
0
by: Cameron Laird | last post by:
QOTW: "ortability is an n-way street." - Paul McGuire "Python's polymorphism support is so good that it makes inheritance much less important than it is in other languages." - Ben Sizer ...
2
by: Githlar | last post by:
I was just wondering if anybody in here has done any coding for the Nintendo DS? Since I can't find any DS Development-specific newsgroups, I was wondering if this would be a good place to ask...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.