In the last few days I was trying to create an interpreter for the nintendo 3DS, yet I was unable to. I do not think it is impossible, but it is certainly a not an easy project.
My idea was to compile C code (since the most of ocaml library is written using c, and I can use c to compile 3DS apps), but I struggled to compile a basic example.
The concept is as follows, the program is booted up, it has no previous memory.
The user inputs a string, the c code gives it to the “ocaml” interpreter (which is C code as well), the ocaml interpreter evaluates it and returns back the output.
Known limitations:
- Not all libraries/functionality are probably portable to the 3DS
- It must be a version of ocaml before version 5. The 3DS has a 32bit arm processor, and the version 5 can be only ran on a 64bit machine.
- Code has to be compiled with the 3DS library with devkitpro
export HOST=arm-none-eabi
export TARGET=arm-none-eabi
export PATH=/mnt/c/devkitPro/devkitARM/bin:$PATH
wget https://github.com/ocaml/ocaml/archive/refs/tags/4.14.0.tar.gz
tar xzf 4.14.0.tar.gz
cd ocaml-4.14.0
./configure --host=$HOST --target=$TARGET
make world
make install
This is my try at a script to create the libraries needed for compilation, but I am afraid that it will never compile since the arm-none-eabi option is not present.
I have tried different options, but so far, none of them succeeded.
I think the next step would be probably trying to replace the runtime functions of ocaml’s code with the 3DS ones, but that would take considerable effort to do so.