Writing GBA games with D!

Raimondo Mancino rmancino at gmail.com
Thu May 20 09:08:58 UTC 2021


On Thursday, 20 May 2021 at 03:30:40 UTC, TheGag96 wrote:
> Very cool, from a fellow Nintendo D homebrewer in arms!! I 
> would love to see more people using the language this way. I 
> myself am having a lot of fun writing a game in D for the 3DS - 
> here's a basic [hello world + 
> bindings](https://github.com/TheGag96/3ds-hello-dlang) that I 
> almost certainly need to update.

Very interesting!

> I'm kind of shocked you're not using 
> [devkitARM](https://github.com/devkitPro/gba-examples). Any 
> reason? At first, I modified the toolchain to compile D support 
> into GCC, but like someone already suggested here, I'm using 
> LDC now and am not looking back. Definitely recommend doing so.

No particular reason, I just followed the first tutorial I saw 
and it used GCC.
The article in question is this 
http://nuclear.mutantstargoat.com/articles/gba_dev_tools.html

I'm a complete newbie with this :)

At first I was doing it with LDC as well, but I didn't manage to 
build a working binary.

I tried with:

```sh
ldc2 test.d -betterC -mtriple=arm-none-eabi -float-abi=soft 
-singleobj -c -nogc -static
llvm-strip test.o -o test.o --strip-all --strip-all-gnu 
--remove-section .ARM.exidx
ld.gold -Tlscript.ld -o out.elf crt0.o test.o
gba-objcopy -O binary out.elf test.gba
```

where crt0 is the same one I used in this thread.

I used gold and not lld because lld doesn't support (or I didn't 
manage to make it work) the syntax used in the script.

I am not very familiar with linker scripts yet, but I'm trying to 
write my own for GCC now.

> DevkitARM uses Newlib also, and D unfortunately doesn't yet 
> have bindings for it yet. In my repo, you'll see that I had to 
> kind of study Newlib's header files and try to hack into 
> druntime in myself. LDC made a change recently that reserves 
> the version `CRuntime_Newlib`, so you will probably have to 
> something similar to what I did but call it `CRuntime_Gba` or 
> something. Hopefully it'll get first class support down the 
> road (people actually looking to use it like you and I should 
> probably be taking up the charge, honestly lol).

It's interesting though... I'll look into it.
I really didn't make much research, just tried right away.

> Just curious, what kind of game/app are you looking to make 
> with this?

I was considering to create a step sequencer at first so I can 
get used to audio and gui stuff.

I'll then try to write a game with j-rpg mechanics, but it's 
going to be a little different than your usual j-rpg.


More information about the Digitalmars-d mailing list