Re: Python on Nintendo DS

2006-04-26 Thread Richard Tew
You can find the new port of Python 2.4.3 (Stackless) here:
http://www.disinterest.org/NDS/Python24.html

Even if you do not have a Nintendo DS with the appropriate
homebrewing device to make the rom available to it, you should
still be able to run it within an emulator like Dualis (which is
where the screenshot is taken).

Any comments are welcome :)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on Nintendo DS

2006-04-25 Thread Richard Tew
An update to my Python on Nintendo DS efforts.

Summary:
- Working bug free port of Python for the Nintendo DS.
- Programmers wanted to help write extensions to expose the DS hardware
  to Python.
- Stackless Python supported, but not bug free.

When I last worked on it, it had several remaining bugs including a
broken zipimport, unreliability due to limited stack space and more.

I spent a statutory holiday on it and located and fixed all the bugs,
including the allocation of stack space and the problems with zipimport
(due to a misunderstanding about what seek function API I should
respect).  As it stands now, it seems pretty bug free.

Python itself running on the Nintendo DS with no access to the hardware
features (graphics, microphone, speakers, touchscreen) is not much use.
 As a text-based calculator it serves one purpose I guess. But to
really serve as a useful tool on the DS, it needs to expose these
pieces of hardware.  SDL is one option, as there is a reportedly buggy
port of SDL for the DS, and ideally as PyGame is based on SDL, a port
of that would hopefully be straightforward.

If anyone has an experience writing extension modules in C, and with
programming the DS hardware in C, and wishes to help flesh out some
form of library codebase to make this a useful port of Python, please
let me know! :)

Also, I switched to the Stackless Python code base.   The tasklet
scheduler locks up if invoked, but I haven't had the chance to look
into this yet.  But given that tasklets run and switch in the limited
scenarios I have tried, fixing the scheduler should be a matter of
time.

Richard

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on Nintendo DS

2005-12-21 Thread Do Re Mi chel La Si Do
Hi!

Super mega cool.
Thanks!

MCI



-- 
http://mail.python.org/mailman/listinfo/python-list


Python on Nintendo DS

2005-12-20 Thread [EMAIL PROTECTED]
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/NDSPythonStuffzip/;4497277;;/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.

-- 
http://mail.python.org/mailman/listinfo/python-list