Tutorial  Updated

DS Programming for Newbies!

3Lwpv.png

Table of Contents:

Introductory Chapters:
  1. Preparing the environment
  2. Variables!
  3. Functions!
  4. Operators in C
  5. Conditions - if/else Statements and switches
  6. Looping - for() and while() Loops
  7. Containers of Variables - Arrays and Structures
Introduction to DS Hardware:
  1. RAM and VRAM
  2. OAM and 2D Sprites
Practical use of libnds:
  1. Input: Keys and the Touchscreen
Practical Use of NightFox Lib:
  1. NightFox Lib Integration
  2. 2D MODE-0 Part 1 - Tiled Backgrounds
  3. 2D MODE-0 Part 2 - Tiled Sprites
Excercises:
  1. Your first program!
  2. MODE-0 Tiled Backgrounds Example
  3. MODE-0 Tiled Sprites Example
  4. Our very first game: Tic Tac Toe!
Additional Utilities:
  1. GRIT


:download: PDF Version maintained by CannonFoddr available on FileTrip HERE!

:download: PDF Version maintained by Pomegrenade GBAtemp Mirror HERE!




Preface



Hello and welcome! If you are reading this then it’s likely that you’re interested in getting to know more about programming for the Nintendo DS! If you are not, then you likely took the wrong turn, but let’s not get into that. Let’s also start with establishing one important thing – as the title suggests, this is a “From Zero to Hero” guide. If you are an experienced programmer then it is likely that you will not benefit from it much, if at all. It is going to introduce the very basics to users who have never even seen a compiler before and never coded in their life – stuff that you probably already know and aren’t interested in anymore. You are however still welcome as this is my first tutorial and will likely require a certain degree of proof-reading, plus, you may of course have useful suggestions! Keep in mind the target audience though, I’m doing my best not to introduce complicated concepts early on. If you’re not an experienced programmer or never programmed at all, this is a great place to start!

I’ve seen many guides approaching this subject – some were more helpful, some were rather vague, but there is one thing that was common in all of them, and it became apparent to me that something has to be done about it. The guides I’ve seen so-far are dedicated to users who are familiar with programming and only require an introduction to the DS environment, none of them are actually “tutorials” from the ground up. Does this mean that a non-experienced user simply cannot program for the DS or should not begin his adventure with programming on this exact platform? No, it does not! In fact, the DS is likely the easiest platform to program for when it comes to consoles – libnds is really not that hard to wrap your mind around and there are numerous libraries out there that facilitate programming for it even further. You probably want to ask: “If it’s so easy, why do You think it requires some sort of an explanation? The libraries are well-documented, do you expect the readers to be dill-wits who can’t follow simple examples?” and the answer to that is “No, in fact, I do believe that everybody is capable of programming, however one has to learn and acquire some basic programming habits and have some practice in C to be successful at it” and this is exactly the main goal of this tutorial. Depending on the interest shown by users and my workload at Uni this may or may not be a full-featured guide, however I promise that I will at least try to keep it up-to-date and expand upon it from time to time.

Now that the purpose is established, let’s move on to the juicy parts! I hope you will enjoy learning together and in case of any questions or suggestions, do write! Dear readers, keep in mind that the first few tutorials will be an incredibly rapid course in C, applicable to any type of programming, not just for the DS! We won’t be compiling much until this material is covered and thoroughly understood! So… Let’s get it on!
 
Last edited by Foxi4,
Hy, new here, not in programming tho. I recently started making my career final project and I decided to do a zelda like for the ds, and this tutorial has been literally gold for getting to the starting point with the ds without major troubles. The biggest one was the fact that devkit no longer pairs well with NF lib so instead im using Block ds, an alternative library that lets me use C++ (I intend to implement an ECS) and NF lib effortlestly, so im pretty happy. Love u all
 
  • Like
Reactions: Foxi4
Hy, new here, not in programming tho. I recently started making my career final project and I decided to do a zelda like for the ds, and this tutorial has been literally gold for getting to the starting point with the ds without major troubles. The biggest one was the fact that devkit no longer pairs well with NF lib so instead im using Block ds, an alternative library that lets me use C++ (I intend to implement an ECS) and NF lib effortlestly, so im pretty happy. Love u all
I’m happy that this is still helpful after all these years. Yeah, getting NFLib to work with the latest devkit isn’t the easiest task in the world and getting a legacy copy of it is far more difficult than it should be. Glad to hear that there’s some kind of alternative. Nowadays I recommend graduating to using pure libnds once you get the hang of things, it’s intimidating at first but not as complicated as one might imagine. Funny, I made a DS game myself as a finals project, albeit far less complicated than a Zelda-style adventure. Good luck with your project!
 
Last edited by Foxi4,
Hi guys! First of all thank you for the tutorial, i enojyed a lot following it. I'm new to the Nintendo DS console, but i've programmed for many years. I'm just trying to get a basic application going, but i got few problems with implementing NF_Lib. I have BlocksDS and NF_Lib installed (via "Wonderful Toolchains"), and i can easily compile every example in the "examples" directory (of BlocksDS). But when i try to compile the TicTacToe example via "Wonderful Toolchains" it says:

Code:
Makefile:11: *** "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM".  Stop.

And when i try to compile it with the .bat file, it can't find the make command.

Do you guys know how to solve this problem? If u guys have one, I'd like a template, maybe even using graphics, or just a makefile that works for my case (I think that's the problem). Thank you a lot! (If it can help, I'm on Windows 11)


EDIT: I got it to compile! I used the Makefile in the NFLib template. But now the problem is another... it's not founding images. "File /Topscreen.img not found". It might have something to do with the setRoot function?
 
Last edited by Iceb3rg82,
Hi guys! First of all thank you for the tutorial, i enojyed a lot following it. I'm new to the Nintendo DS console, but i've programmed for many years. I'm just trying to get a basic application going, but i got few problems with implementing NF_Lib. I have BlocksDS and NF_Lib installed (via "Wonderful Toolchains"), and i can easily compile every example in the "examples" directory (of BlocksDS). But when i try to compile the TicTacToe example via "Wonderful Toolchains" it says:

Code:
Makefile:11: *** "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM".  Stop.

And when i try to compile it with the .bat file, it can't find the make command.

Do you guys know how to solve this problem? If u guys have one, I'd like a template, maybe even using graphics, or just a makefile that works for my case (I think that's the problem). Thank you a lot! (If it can help, I'm on Windows 11)


EDIT: I got it to compile! I used the Makefile in the NFLib template. But now the problem is another... it's not founding images. "File /Topscreen.img not found". It might have something to do with the setRoot function?
Entirely possible, we’re talking many revisions of the devKit backwards, but realistically it should be an easy fix so long as everything that’s supposed to be #include’ed is in fact included and the ROOT folder is correct.
 

Site & Scene News

Popular threads in this forum