bedrock-nds is an emulator for the Bedrock computer system that runs on the Nintendo DS handheld game console. It’s written in C, using the BlocksDS SDK and libnds
.
Installation
Source code can be found at code.benbridle.com/bedrock-nds. No precompiled binaries are available yet, the emulator will need to be built from source with a Bedrock program baked in. This will change in the future.
If you’re just looking to see what it looks like, you can try out cobalt-demo-2.0.2.nds, the Nintendo DS release of Cobalt (a pixel-art painting program).
Build from source
Follow the instructions at blocksds.skylyrac.net/docs/setup/options/from_source/ to install the BlocksDS SDK and a C cross-compiler for ARM under Linux. I installed and used version 1.8.0 of BlocksDS because I ran into an error (relating to fake_heap_start
) when compiling any version above that. This should end with the C compiler toolchain at /opt/wonderful/bin
added to your PATH
and with a BLOCKSDS
environment variable that points to the BlocksDS sdk
folder.
Next, download the bedrock-nds
source code from code.benbridle.com/bedrock-nds. Edit the main_program
variable in the arm9/source/main.c
file so that it includes the source code of the Bedrock program that you want to run. You should assemble your Bedrock program using the --format=c
flag of bedrock-pc
to get it into the comma-separated list of hexadecimal literals that C expects, and save that assembled file to the arm9/include
folder to make it easy to find.
After that, edit the Makefile
file at the root of the bedrock-nds
repository to change the information that will be written to the compiled .nds
file. This is just for vanity, it won’t affect how the program runs.
Lastly, run make
from the root of the repository to compile a .nds
ROM file that will run on an ordinary Nintendo DS console. You’ll need a flashcart to be able to run it on real hardware (the options here are truly impenetrable; I use an R4i Gold Pro card from www.r43ds.org/, running the RetroGameFan fork of YSMenu). In lieu of real hardware, you can run the .nds
ROM file on a Nintendo DS emulator instead: I recommend the DeSmuME emulator, although it doesn’t support filesystem access.
Run multiple programs simultaneously
To run multiple programs simultaneously, you’ll need to edit the arm9/source/config.h
file to enable SWITCH_BETWEEN_INSTANCES
and then to increase NUM_INSTANCES
to the desired number. After that, you’ll need to manually add some code to arm9/source/main.c
to include the additional programs as byte arrays and then to load them each into free instances with a call to br_load(&br[1], second_program, sizeof(second_program))
or similar (it should be straightforward to follow along with the existing initialisation code that does all this).
If you have a memory-related error when compiling, you’ll need to wind back the MAX_PAGES
constant defined at the top of arm9/source/devices/memory.c
until it compiles successfully.
Once the program is compiled and running, use the L and R bumper buttons to switch back and forth between the available instances.
Development
License
bedrock-nds is licensed under the MIT License. Feel free to use it, change it, and share it however you want.
Troubleshooting
If you have any difficulties getting it to run, send an email to ben@derelict.engineering and I’ll help you out.