gbadev
Game Boy Advance homebrew development forum
Member
Joined:
Posts: 24

Does anyone know the exact version of Programmer's Notepad that this page uses?

https://www.coranac.com/tonc/text/setup.htm

When I press Alt+1 to build the project, I get the Windows beep sound effect and nothing else happens. So, this is a major blocker.

I tried version 2.1.5.2222-devel and 2.4.2.1440-duke and neither worked.

Maybe the tutorial needs to be updated?

Administrator
avatar
Joined:
Posts: 45

Oh yeah, the setup part of Tonc is quite outdated. Here's what's changed since it was written:

  • Programmer's Notepad is not really used by anyone, I'd recommend to use a different editor such as Notepad++ or VS Code, and then compile in the MSYS2 terminal by running make. (If that's unfamiliar to you, I wrote a bit about it here which might help?)

  • devkitARM now uses MSYS2 as the recommended terminal on Windows, and uses pacman to manage updates.

  • libtonc is now included in devkitARM's package repository, so you don't need to manually install the version from tonc-code.zip (in fact that version is outdated)

  • the examples in tonc-code.zip won't compile anymore, but you can find updated versions at which work with the latest devkitARM here: https://github.com/gbadev-org/libtonc-examples

Note that devkitARM doesn't include any templates for working with libtonc, but you can use one of these as a starting point:

That's about it!

And yeah, an updated / community-maintained version of Tonc is something we'd like to do at some point, it's just taking a while to get it off the ground.

Member
Joined:
Posts: 24

I was able to build the first two makefiles in tonc-code in cygwin (MSYS2 had some trouble finding the arm gcc.)

I've seen quite a few ways that TONC could be improved, so yes a community/updated version would be a very good thing. If people have a bad experience as early as the setup, they may leave the scene and conclude it's a mess.

Member
Joined:
Posts: 24

I have now cloned the repo linked in your fourth bullet point. All the examples build with no issues in MSYS2. Thanks!

Administrator
avatar
Joined:
Posts: 45

This hasn't been properly announced yet but we've started a repo for community version of Tonc here: https://github.com/gbadev-org/tonc (viewable at https://gbadev.net/tonc/toc.html)

If you have any suggestions or contributions, please send them to us!

Member
Joined:
Posts: 24

Cool. One thing I didn't like about TONC is that optimizations are on in the demo makefiles. I think it's more important for people who are learning to be able to step through every line of code and understand it than it is to squeeze out every last drop of performance.

Moderator
Joined:
Posts: 13

Most people take the makefiles as they are, and use them right away. I think it's a good idea to leave optimizations on, as most people aren't actually going to step line by line in a debugger.

In fact, I created the libtonc-examples repository because the original examples were using a few different makefiles with more or less features, and a reduced version of libtonc called "toolbox" or something like that.

Most people take the first example they build and start building their game on top of it, it's important that all examples are decent enough to use them as base.

Member
Joined:
Posts: 24

SkyLyrac wrote:

Most people take the makefiles as they are, and use them right away. I think it's a good idea to leave optimizations on, as most people aren't actually going to step line by line in a debugger.

In fact, I created the libtonc-examples repository because the original examples were using a few different makefiles with more or less features, and a reduced version of libtonc called "toolbox" or something like that.

Most people take the first example they build and start building their game on top of it, it's important that all examples are decent enough to use them as base.

I'm going to have to strongly disagree with you on that one - I think being able to step through every line is extremely important - but no big deal, I can always write my own tutorial.

Moderator
Joined:
Posts: 13

jeffythedragonslayer wrote:

I'm going to have to strongly disagree with you on that one - I think being able to step through every line is extremely important - but no big deal, I can always write my own tutorial.

The GBA isn't a PC, it's a very resource-constrained device. People developing for GBA need to understand that it's not as comfortable as developing for PC. Only trivial code can be built without optimizations and expected to run at a reasonable speed. At some point in development you always need to enable optimizations, and you will eventually need to debug optimized code.

It's better to get used to the idea that compilers can rearrange code and debuggers stepping through that code may jump around. This is confusing for a beginner, sure, but only at the very beginning. In fact, some bugs may only show up with optimizations enabled (like timing-related bugs), so in any case you need to get used to debugging with optimizations enabled instead of disabling optimizations whenever you want to debug.

And it gets worse. On the GBA you sometimes need to place code in IWRAM for extra speed. Unoptimized code is bigger than optimized code, so you may simply not be able to build your game without optimizations if you are using too much of that RAM. And you should use that RAM, it's like a make-my-code-faster cheat! But then again, if you move your code out of that RAM for debugging, you're changing the timings of the actual code, which may hide bugs.

I think that in general it's better to debug the actual code you are going to run than a fake ideal version of the code. The only exception would be if you want to debug an algorithm, I guess, but you can always build it for the PC and debug it there, then use it on GBA.

I would say that if your first experience debugging code is debugging C on a GBA, you're going to have a hard time no matter what you do. Until fairly recently you couldn't even use GDB to debug code, the best you could do was to use no$gba to step through assembly code.

So yeah, while being able to debug line by line in a GBA project would generally be a nice thing, it's by no means something crucial for a developer, or even possible sometimes.

Member
Joined:
Posts: 1

exelotl wrote:

Oh yeah, the setup part of Tonc is quite outdated. Here's what's changed since it was written:

  • Programmer's Notepad is not really used by anyone, I'd recommend to use a different editor such as Notepad++ or VS Code, and then compile in the MSYS2 terminal by running make. (If that's unfamiliar to you, I wrote a bit about it here which might help?)

  • devkitARM now uses MSYS2 as the recommended terminal on Windows, and uses pacman to manage updates.

  • libtonc is now included in devkitARM's package repository, so you don't need to manually install the version from tonc-code.zip (in fact that version is outdated)

  • the examples in tonc-code.zip won't compile anymore, but you can find updated versions at which work with the latest devkitARM here: https://github.com/gbadev-org/libtonc-examples

Note that devkitARM doesn't include any templates for working with libtonc, but you can use one of these as a starting point:

That's about it!

And yeah, an updated / community-maintained version of Tonc is something we'd like to do at some point, it's just taking a while to get it off the ground.

exelotl, do you think the Tonc (Community Edition) will be updated with some of what you're mentioning here?

Edit: Oh, I see it's already marked as an issue. Ignore me : )