This is a port of Python 2.5 to the Nintendo DS. However before you read further
there are a couple of important things to know.
- None of the DS hardware is as yet supported. This means that the use you can
get out of this port is severely limited. You cannot access the microphone, the
graphics, the speakers, the touchscreen or any of the controls. All you can do
is enter lines of Python code into the console through the touchscreen keyboard
seen in the picture to the right.
- You need a homebrew device to get the Python rom onto your DS. I will not
go into what is involved here, you will need to work this out on your own.
If all you are interested in is running Python on your Nintendo DS in order
to play with it or to verify that it actually works as I claim it does, you
can download precompiled roms in 'NDSPython25-binaries.zip'. However
be aware that it only has built in support for the compact flash Supercard.
If you want it to have support for your homebrew device, then you need to
patch it yourself via the now standard route of
dlditool.
If you want to develop this port further or just compile it yourself, all
of the source code needed is found in the 'NDSPython25-src.tar.bz2'
as well as complete instructions on how to go about it.
And if you just want to embed Python in your own application you can download
the precompiled static library in 'libpython25.zip' and link against
that. However you will probably still need the provided Python source code
in 'NDSPython25-src.tar.bz2' for the headers. You can also use this
static library to avoid compiling Python yourself.
As mentioned above, this port is not very useful and needs the
DS hardware to be exposed to it. However this requires a lot of work
which I do not have time to do myself. If you want this work done
I encourage you to give me some incentive by either contacting me and
sending me an up to date homebrew device, or buying something on my
Amazon wishlist.
Here are some of the tasks which you might wish to take up or which you
might wish to donate something to give me incentive to spend time on:
- Porting PyGame. In theory this should be possible. GPF has already
ported SDL to the DS,
which PyGame wraps.
- Updating the filesystem support. When devkitpro v20 is released
NDSPython will need to be recompiled and adjusted to support directory
listing.
As you will have noticed this is a port of Stackless Python.
You can learn more about how it differs from normal Python by reading its website.
It might be of interest to note that unless you choose to access the extra
functionality which Stackless Python provices NDS Python should be appear
identical to normal Python.
Python 2.5 (28th January 2007)
- Removed support for gba_nds_fat and installed support for libfat.
Now you can get the rom to work on your homebrew device by using
dlditool to inject the relevant driver into the rom.
Python 2.5 (8th January 2007)
- Upgraded to Python 2.5 from Python 2.4.3.
- Updated how the filesystem support was exposed to Python. This was
needed because the hooks provided by devkitArm had changed.
- Cleaned up the source code so that others can actually get it to compile.
Important bits of information were left out of the Python 2.4.3 release
because I did not remember them myself when I packaged it up. Now the whole
compilation process is documented in a README file which is included with the
source code.
Python 2.4.3 (March 2006)
Summarised:
- Fixed lots of bugs which would prevent Python from finding modules on homebrew devices.
- Is now, except for the Stackless aspects, bug free and usable to the extent a programming language can be without the DS hardware being exposed to it. So, this means it is in a good place for that to be the next thing worked on.
Detailed:
- Identified and fixed a bug in chishm's FAT filesystem code which was breaking the finding of imported modules because of the way the zipimport module works. Fix has been submitted to chishm, but a fixed version of the code is included in the Python patches.
- The use of AddDevice to hook into the newlib file functions had a bug in the hooked seek function, because it implemented the normal seek API instead of the lseek API (it needed to return the current file offset when called, so that the higher level code could know where in the file the underlying FAT code was).
- Corrected the initial memory allocations so that the regions for the heap and the stack were given correctly and in usable amounts. I had no understanding of how this really worked in the initial release. As seen in the screenshot on the website, you can import the 'nds' module and have 'nds.meminfo()' display heap and stack information.
- Moved the FAT code initialisation before the Python initialisation so that the modules could be found while Python was initialising.