#43072 - doublec - Wed May 18, 2005 9:07 pm
I've only just started playing around with developing stuff for the DS and have never done any GBA programming either. It's all new to me so I thought I'd document some of the things I went through as a reminder to myself and maybe it would be of some help to others who are brand new.
My first attempt at explaining things, from compilation through to running on hardware is at:
http://www.double.co.nz/nintendo_ds/
Any suggestions for improvements or to fix errors in what I've described would be much appreciated.
I hope to write more as I try out various things on the DS.
Chris.
#43122 - jandujar - Thu May 19, 2005 9:12 am
#43212 - Mr Snowflake - Fri May 20, 2005 11:51 am
So, where is part 2??? :p I like this tut. Although it's very basic (which isn't a complaint), it helped me on the way :). Ok it's a short, slow driving way, but now I am going to the freeway. (hope this is as clear as it would be in dutch)
I have a question regard this tut. I comiled the hello world demo and ran it on ideas and dsemu. But the touchx/y values aren't updated, you know how to solve?
#43214 - doublec - Fri May 20, 2005 12:42 pm
I'm working on part 2 now. I'm beating my head against the wall getting some simple graphics going using a frame buffer mode at the moment. Once I've got a handle on it I'll put it up.
Possibly the emulator not working is due to using a later version of the emulator? I seem to recall that if ndslib change the internal layout of the IPC structure (which holds the touch screen values) then the emulator needs to be updated. I compiled these executables using an older ndslib which had a different IPC layout. Maybe.
I tested it on Dualis release 7 and it worked fine.
#43234 - Mr Snowflake - Fri May 20, 2005 7:31 pm
I got the newest ndslib from cvs and the newest dualis and ideas and it won't work.
Edit: I have a strange feeling the cvs isn't really working ... :-)
#43236 - Ethos - Fri May 20, 2005 8:40 pm
Mr Snowflake wrote: |
I got the newest ndslib from cvs and the newest dualis and ideas and it won't work.
Edit: I have a strange feeling the cvs isn't really working ... :-) |
Newest ndslib works with HW, not emus... (cache)
CVS works. ndslib is made to work on hardware, so you'll have to wait for a new emulator version.
_________________
Ethos' Homepage (Demos/NDS 3D Tutorial)
#43237 - Mr Snowflake - Fri May 20, 2005 8:49 pm
Nice to know, ty :)
#43264 - tepples - Sat May 21, 2005 5:26 am
Ethos wrote: |
Newest ndslib works with HW, not emus... (cache)
CVS works. ndslib is made to work on hardware, so you'll have to wait for a new emulator version. |
Are you adding anti-emulation tricks on purpose to push people to make better emulators and to drive up the price of used PassMe kits on eBay (for those people who don't have a free PCI slot in their computers or don't run Windows)?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#43334 - doublec - Sun May 22, 2005 5:58 am
Part two is up:
http://www.double.co.nz/nintendo_ds/nds_develop2.html
This part goes through how to use the framebuffer mode, drawing to the main screen, and the vertical blank interrupt.
Chris.
#43353 - Mr Snowflake - Sun May 22, 2005 6:11 pm
Nice doublec. Hope to see more soon :)
Ethos wrote: |
Newest ndslib works with HW, not emus... (cache)
CVS works. ndslib is made to work on hardware, so you'll have to wait for a new emulator version. |
That explains :) but what do you mean with (cache)??
Edit: Idea for next part: checking buttonpress and touch.
#43367 - Darkain - Sun May 22, 2005 8:08 pm
you reference a "word" as being 2 bytes in size. i would like to point out to you that you are a blatent win32 coder. ;) ya see... back in the day... of the windows SDK (before Win95 was made), the OS WAS 16bit based, therefor a "word" was 16bits wide. in the switch to the Win32 SDK (Win95/NT4), microsoft didnt want to break backwards compatibility w/ their existing SDK, so they called a 32bit word a "double word" or "dword" for short. and now their move to the win64 SDK, i do beleive that a 64bit word is referenced as a "quad word" or "qword" for short.
however, if you take a look at the NDSLIB standards, we use "word" to represent 32bits of data, and we use "half word" to represent 16bits of data. i would recomend following suit on this, as to not confuse people who read your tutorial and then try to use NDSLIB (or other projects based off of it), as they WILL get confused about what a word really is.
_________________
-=- Darkain Dragoon -=-
http://www.darkain.com
DarkStar for Nintendo DS
#43375 - doublec - Sun May 22, 2005 9:05 pm
Oops, you're right :-) I'll change it.
Cheers,
Chris.
#43381 - wintermute - Sun May 22, 2005 10:17 pm
tepples wrote: |
Ethos wrote: | Newest ndslib works with HW, not emus... (cache)
CVS works. ndslib is made to work on hardware, so you'll have to wait for a new emulator version. |
Are you adding anti-emulation tricks on purpose to push people to make better emulators and to drive up the price of used PassMe kits on eBay (for those people who don't have a free PCI slot in their computers or don't run Windows)? |
they're not "anti-emulation tricks" merely setting up the DS properly with cache & mpu regions. Next release of Dualis works fine with the latest crtls. I believe iDeaS will also support this with the next release.
#43382 - wintermute - Sun May 22, 2005 10:18 pm
doublec wrote: |
I've only just started playing around with developing stuff for the DS and have never done any GBA programming either. It's all new to me so I thought I'd document some of the things I went through as a reminder to myself and maybe it would be of some help to others who are brand new.
My first attempt at explaining things, from compilation through to running on hardware is at:
http://www.double.co.nz/nintendo_ds/
Any suggestions for improvements or to fix errors in what I've described would be much appreciated.
I hope to write more as I try out various things on the DS.
Chris. |
1. don't use .bat files
2. don't use ndsdev env
3. don't use .bat files
#43394 - doublec - Mon May 23, 2005 1:29 am
Thanks for the feedback. I used .bat files just to show what commands are being executed in an easy manner. Originally I wasn't going to include any build script at all. But makefiles are just as easy I guess.
What's wrong with the ndsdev system? I figured it was the easiest to use as there's already information on the web to set it up quickly with a simple download and install.
#43400 - wintermute - Mon May 23, 2005 2:07 am
doublec wrote: |
Thanks for the feedback. I used .bat files just to show what commands are being executed in an easy manner. Originally I wasn't going to include any build script at all. But makefiles are just as easy I guess.
What's wrong with the ndsdev system? I figured it was the easiest to use as there's already information on the web to set it up quickly with a simple download and install. |
Unfotunately for some reason, ndsdev env breaks devkitARM in some odd ways. I've had a number of error reports from people using it whose problems were only solved by uninstalling and reinstalling from scratch using the manual method - http://devkitpro.sourceforge.net/setup.shtml
ndsdev env is also somewhat windows centric and full of extremely poor examples.
There has been a lot of work put into the toolchains provided by the devkitPro project and it's a shame to see it abused.
Last edited by wintermute on Thu May 26, 2005 12:25 am; edited 1 time in total
#43407 - doublec - Mon May 23, 2005 2:48 am
Ok, thanks for the pointer. I'll probably update to using that instead then.
#43424 - Spaceface - Mon May 23, 2005 11:16 am
what's wrong with .bat files? :D
#43434 - Vixus - Mon May 23, 2005 2:36 pm
Nice, I'm glad I found this. Hopefully it'll help in my aspirations to develop some tunnelling software. Thanks again.
_________________
TunnelVision Website - Bringing DS multiplayer to the masses.
#43518 - doublec - Tue May 24, 2005 2:37 am
New tutorial up:
http://www.double.co.nz/nintendo_ds/nds_develop3.html
This one goes through how to read key events.
#43539 - Mr Snowflake - Tue May 24, 2005 9:16 am
Sweet dude, yesterday I was searching for KEY_A, but didn't find it (didn't search too long though, had to go to a friend).
Edit: Never mind (what was here). I saw the adresses already were included :)
#43555 - wintermute - Tue May 24, 2005 4:06 pm
just to reiterate, don't use .bat files.
follow the devkit setup instructions found here
http://devkitpro.sourceforge.net/setup.shtml
pay particular attention to the environment variables DEVKITPRO and DEVKITARM.
use the Complex2D example in devkitPro cvs as a guide.
<no longer hosted>
contains your example projects reworked to build across all 3 major platforms.
You've misspelled Tutorials.
Last edited by wintermute on Thu May 26, 2005 12:26 am; edited 1 time in total
#43597 - doublec - Wed May 25, 2005 1:02 am
Thanks for that wintermute. I've fixed the typo. One of the upcoming tutorials/articles is going to go through how to move to the devkitarm way of doing things, makefiles, etc. Your conversion of theprojects was very useful to show me what is required.
#43606 - jstart - Wed May 25, 2005 2:49 am
Hey Thanks wntrmute those converted demos acctually worked for me
With some tinkering I got all 3 working on a mac doublec if you want to include these for download on your site
http://www.ndshb.com/modules.php?mop=modload&name=Upload&file=index&op=getit&fid=42
(I can convert them to be xcode compatible too if you want)
because none of your demos will compile on a mac...
if you care ( i know that no one uses mac) but yah great job everybody great tut's
_________________
-=Jstart=-
#43626 - doublec - Wed May 25, 2005 6:21 am
Yep, I'm interested in making sure things work on other platforms. What changes did you make? I'm not able to view the file you linked to for some reason, it appears as just a binary file of some sort.
#43627 - jstart - Wed May 25, 2005 6:25 am
Its a zipped up copy of your lessons just had to change a few paths in the makefile to align with wintrmute setup tutorial just because it's easier and a few mac specific setting such as where the nds9 library is I can send you the lessons directly by email or just upload maybe a .zip file to the same place whichever is easier
heres a .zip
http://www.ndshb.com/modules.php?mop=modload&name=Upload&file=index&op=getit&fid=44
if it comes up as text you can just do a save as and unstuff it
_________________
-=Jstart=-
#43630 - doublec - Wed May 25, 2005 6:39 am
Ahh right. I got the file ok now, thanks. I'll put it on the site in the next update. Thanks!
#43631 - jstart - Wed May 25, 2005 6:41 am
Thanks! Glad to see someone cares about us mac people! :)
I'll do conversions for any other tut's that you do.
_________________
-=Jstart=-
#43632 - doublec - Wed May 25, 2005 6:46 am
I run Linux mostly full time at home and work so I can understand the frustration at everything being Windows centric.
I run Windows maily when doing DS development since my flash card software and wireless multiboot all require Windows. How do you work around that out of curiosity?
Wintermute, what's the difference between the 'libnds' in DevKitARM Pro and the 'ndslib' sourceforge project? Which should I be using?
#43633 - jstart - Wed May 25, 2005 6:49 am
Yah i have that problem too i can't get a mac compatible flash card
i belive libnds and ndslib are almost the same at least it seems like it im using libnds just because i started using devkit arm 12 I don't know which is better
_________________
-=Jstart=-
#43678 - wintermute - Wed May 25, 2005 6:14 pm
jstart wrote: |
Its a zipped up copy of your lessons just had to change a few paths in the makefile to align with wintrmute setup tutorial just because it's easier and a few mac specific setting such as where the nds9 library is I can send you the lessons directly by email or just upload maybe a .zip file to the same place whichever is easier
heres a .zip
http://www.ndshb.com/modules.php?mop=modload&name=Upload&file=index&op=getit&fid=44
if it comes up as text you can just do a save as and unstuff it |
the line you changed in the Makefile
Code: |
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := /devkitPro/libnds/lib/libnds9.a
|
should *not* have been changed, -lnds9 is sufficient.
I've attempted to flatten the environment with the devkitPro release 12 toolchains so that only the environment variables DEVKITPRO, DEVKITARM & DEVKITPPC need to be changed to suit the user's installation. This merely requires that you follow the suggested layout found on the setup page at devkit.tk.
#43679 - wintermute - Wed May 25, 2005 6:22 pm
doublec wrote: |
I run Linux mostly full time at home and work so I can understand the frustration at everything being Windows centric.
I run Windows maily when doing DS development since my flash card software and wireless multiboot all require Windows. How do you work around that out of curiosity?
|
I'm currently working on linux software for the Neo Power Kit and liasing with Mr Spiv on mac.
Quote: |
Wintermute, what's the difference between the 'libnds' in DevKitARM Pro and the 'ndslib' sourceforge project? Which should I be using? |
At one point ndslib was moving to the devkitPro cvs and libnds is merely a tidied up version of ndslib. For the most part it is compatible although I changed all the filenames to lower case and moved nds.h to the top level include folder. I've been synchronising with ndslib and maintaining cross platform portability.
Unfortunately the ndslib maintainer has issues with moving to devkitPro which have not yet been resolved.
#43925 - LOUD NOISES - Sat May 28, 2005 7:08 am
I've been trying to switch over to this from ndsdevenv but I keep getting
egrep: not found
As far as I know my environment variables are set up right.
edit: nevermind, no they weren't :)
#44067 - doublec - Sun May 29, 2005 10:28 pm
I've put a fourth tutorial up now, dealing with how to play sound samples:
http://www.double.co.nz/nintendo_ds/nds_develop4.html
#44068 - Darkain - Sun May 29, 2005 10:34 pm
Quote: |
The sample length is divided by two (the '>> 2' shift does this) as the length computed by subtracting start from end is in bytes. We need it in half-words. |
no, >> 2 is div by 4, >> 1 is div by 2.
_________________
-=- Darkain Dragoon -=-
http://www.darkain.com
DarkStar for Nintendo DS
#44070 - doublec - Sun May 29, 2005 10:43 pm
Thanks Darkain, you're right. That's what I get for writing the tutorial too late at night! I guess the length is measured in words then. I've updated the tutorial.
#44093 - jstart - Mon May 30, 2005 5:51 am
Man doublec! You have made me hate .bat files heh
Anyway at least I can confirm sox works on mac with some tweaking and
With the .bat files it says it can't find my libnds .h files unless they are hardcoded but luckily i have a spar copy of libnds thats hardcoded for times like this but heres what i get
sh build.bat
arm-elf-g++: arm7_main.o: No such file or directory
/opt/local/devkitARM/bin/arm-elf-objcopy: 'arm7.elf': No such file
arm-elf-g++: arm9_main.o: No such file or directory
/opt/local/devkitARM/bin/arm-elf-objcopy: 'arm9.elf': No such file
Nintendo DS rom tool 1.15 - May 21 2005 by Rafael Vuijk (aka DarkFader)
Cannot open file 'arm9.bin'.
dsbuild 1.21 - May 21 2005
using default loader
: command not found
I am having trouble mainly because of the added arm 7 source file. i can't use my old format.
WntrMute, any chance of a conversion to makefile format? :)
makefiles are much easier :P
_________________
-=Jstart=-
#44164 - Mr Snowflake - Mon May 30, 2005 7:53 pm
Great tut again. As I said, you convinced me to get developing for the ds (although I can't do much :)). Can you plz go into graphix modes the next one?? I would find that really handy :)
#44171 - doublec - Mon May 30, 2005 9:35 pm
Jstart, makefiles will be coming in a couple of days. I'm converting all the projects over to the devkitpro way of doing things. Sorry about that!
Mr Snowflake, sure, I'll get onto the graphics modes once I've done the makefile conversions. Thanks for the great feedback!
#44186 - jstart - Mon May 30, 2005 11:07 pm
alright thanks :)
But how can i compile it now anyone know why the .bat wasn't working from my results in my previous post
_________________
-=Jstart=-
Last edited by jstart on Tue May 31, 2005 12:11 am; edited 1 time in total
#44188 - Abcd1234 - Mon May 30, 2005 11:34 pm
Darkain wrote: |
Quote: | The sample length is divided by two (the '>> 2' shift does this) as the length computed by subtracting start from end is in bytes. We need it in half-words. |
no, >> 2 is div by 4, >> 1 is div by 2. |
It should also be pointed out that all reasonable compilers, including gcc, will quite happily turn a "/ 2" into a ">> 1" provided the correct flags are supplied. It's called "strength reduction", and it's a standard optimization that, with gcc, can be enabled with -O2 or -fstrength-reduce. The point being you might as well just use '/ 2' and let the compiler do the dirty work, as it's easier to read and understand.
#44335 - tepples - Tue May 31, 2005 9:38 pm
"x / 2" is strictly equivalent to "x >> 1" only if x is positive. Otherwise there's a rounding difference: "x / 2" rounds toward zero, whereas "x >> 1" rounds toward -∞. Therefore, I'm guessing that reduction from division to shifting is more likely to happen with unsigned types than with signed types.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#44342 - doublec - Tue May 31, 2005 9:57 pm
jstart, just run each command seperately from the shell. Otherwise edit the bat file to remove the Win32/Dos specific stuff like the setting of the environment variable and calling of the build_sounds batch file.
You'll also need to change the %LIBNDS% to $LIBNDS I suspect (I'm assuming the Mac using Unix style environment variable replacement).
Chris.
#44348 - jstart - Tue May 31, 2005 10:24 pm
Thanks typing each command seperately worked fine! looking forward to your next great tutorial!
_________________
-=Jstart=-
#44445 - doublec - Wed Jun 01, 2005 9:39 pm
I've removed the batch files and added makefiles to the tutorials now. I couldn't work out how to make the template DevKitPRO makefiles build seperate arm7 and arm9 binaries though. They seem to use the default ARM7 code only but I'm probably misunderstanding something. So I created simple makefiles but they should work fine on platforms other than Windows.
#44448 - jstart - Wed Jun 01, 2005 9:59 pm
Cool! Thanks!
Your sound demo is now up in mac format with a mac compatible sox at the same link you have posted on your front page.
(thanks for the mention, it makes me feel worthwhile :P)
_________________
-=Jstart=-
#44514 - Sylfurd - Thu Jun 02, 2005 1:06 pm
your .nds files in your examples don't seem to work with emulators ...
Neither my own projects compiled with your makefiles :(
#44523 - jstart - Thu Jun 02, 2005 4:34 pm
All things compiled with devkitarm 12 will not work with emulators because they don't support some features included in devkitARM
_________________
-=Jstart=-
#44534 - GPFerror - Thu Jun 02, 2005 6:03 pm
so is there an older version that works with the emulators that can be setup?
Does the older version code require code changes to work with newer toolchain? or just recompiling (so when new emulators are released)
Thanks,
Troy
#44542 - jstart - Thu Jun 02, 2005 6:40 pm
I looked into that.. I guess if you compile with devkitARM release 11 it might work but I'm no expert
The next versions of iDeaS and Dualis are going to support devkitarm 12
_________________
-=Jstart=-
#44564 - doublec - Thu Jun 02, 2005 10:41 pm
As jstart said it's because of using the latest DevkitPRO. This uses the latest libnds which changed the IPC structure which is used for passing data between the ARM7 and ARM9. Dualis needs to be updated when the IPC structure changes apparently.
I decided to go with the latest tools due to popular request - it is unfortunate that things don't work on the emulator though. Hopefully that will not be the caes for long.
You might be able to make things work on the emulator by replacing the arm7_main.cpp with a version from an older libnds and compiling with that older libnds.
#44566 - Darkain - Thu Jun 02, 2005 10:46 pm
i would just like to note that the IPC change is the least of your worries... the CP15 code is what seems to crash dualis.
_________________
-=- Darkain Dragoon -=-
http://www.darkain.com
DarkStar for Nintendo DS
#44717 - Herve13 - Sat Jun 04, 2005 4:25 pm
When I compile tuto4, no errors : but just blank screens when trying it on NDS. Does anyone have this problem ?
#44755 - doublec - Sun Jun 05, 2005 2:13 am
What version of devkitpro are you using? And are you using the libnds from that or 'ndslib'?
I just tested it now using the code from the zip file and it worked fine. Has anyone else been able to get it to work?
#44756 - doublec - Sun Jun 05, 2005 2:16 am
Also, did you have a look at the 'troubleshooting' section?
Code: |
When including largish samples (>32Kb) in the ARM7 executable you may find you have 'two white screens' when running the program on the hardware. If this happens it means you are using an older version of 'DevKitPRO', probably the one shipped with 'ndsdev'. Upgrade to the latest 'DevKitPRO' version and it fixes the problem. |
#44760 - doublec - Sun Jun 05, 2005 2:29 am
New tutorial up:
http://www.double.co.nz/nintendo_ds/nds_develop5.html
This one covers how to read and write to the save game area on the GBA cartridge. I've also modified tutorial one slightly so that it uses the main screen rather than the subscreen for the console output.
#44764 - wintermute - Sun Jun 05, 2005 2:42 am
doublec wrote: |
Also, did you have a look at the 'troubleshooting' section?
Code: | When including largish samples (>32Kb) in the ARM7 executable you may find you have 'two white screens' when running the program on the hardware. If this happens it means you are using an older version of 'DevKitPRO', probably the one shipped with 'ndsdev'. Upgrade to the latest 'DevKitPRO' version and it fixes the problem. |
|
This is probably not a good idea. With the default crtls you only have access to 64k for the entire arm7 app.
#44768 - doublec - Sun Jun 05, 2005 3:09 am
Ok thanks for noting that. Time to look into filesystems it seems.
#44932 - doublec - Mon Jun 06, 2005 9:47 pm
New tutorial up:
http://www.double.co.nz/nintendo_ds/nds_develop6.html
Covers using the GBFS filesystem and some more sound and key handling stuff.
#44937 - Mr Snowflake - Mon Jun 06, 2005 9:55 pm
My project won't compile using devkitpro. the compiler is able to find nds/arm9/console.h but it can't find nds/nds.h.. What system/environment variables do I have to set?
#44939 - doublec - Mon Jun 06, 2005 10:03 pm
It shouldn't be looking for nds/nds.h as 'nds.h' is just off include in libnds. The makefile has the following set:
NDSLIB_INCLUDE=$(DEVKITPRO)/libnds/include
NDSLIB_LIB=$(DEVKITPRO)/libnds/lib
So if DEVKITPRO is set to the right place it should just work. Are you using 'libnds' or 'ndslib'?
#44942 - jstart - Mon Jun 06, 2005 10:05 pm
That's because if you are using libnds nds.h isn't under the nds folder change it to just nds.h and it should work
_________________
-=Jstart=-
#44945 - Mr Snowflake - Mon Jun 06, 2005 10:11 pm
How stupid of me.. That I overlooked that... (*Shame*shame*) hehe.
Edit: It works now, but is it normal it won't run in emu's (dualis)?
Last edited by Mr Snowflake on Mon Jun 06, 2005 10:15 pm; edited 1 time in total
#44947 - wintermute - Mon Jun 06, 2005 10:12 pm
Mr Snowflake wrote: |
My project won't compile using devkitpro. the compiler is able to find nds/arm9/console.h but it can't find nds/nds.h.. What system/environment variables do I have to set? |
you're using libnds - use <nds.h>
or you could just read the other replies that turned up before I posted this :P
#44955 - jstart - Mon Jun 06, 2005 10:21 pm
I can confirm that this works with mac as long as you compile gbafs.exe's source that is provided at tepples site it all works I will have the mac version online soon.
Suggestion- Could the next tutorial be about displaying pictures because i can't find anything in the way of image conversion.
_________________
-=Jstart=-
#44958 - doublec - Mon Jun 06, 2005 10:23 pm
Yes, it's normal that it won't run under the emulator. Currently the released emulators aren't compatible with the recent releases of devkitpro or libnds. Hopefully they'll be updated soon.
Also none of the emulators do sound that I know of.
#44961 - Mr Snowflake - Mon Jun 06, 2005 10:39 pm
doublec wrote: |
Yes, it's normal that it won't run under the emulator. Currently the released emulators aren't compatible with the recent releases of devkitpro or libnds. Hopefully they'll be updated soon.
Also none of the emulators do sound that I know of. |
Sound is the least of their worries it think :) If you look at other emu development, the sound was almost always the last implemented feature :). It's kinda stupid I can't test my (crappy) demo's on emu's, because I don't have the real thing.. :(
#44964 - FourScience - Mon Jun 06, 2005 11:08 pm
Any plans for tutorial(s) concerning tile/sprite based graphics? Or should I just read the info in the guide at dspassme.com, found here: http://www.dspassme.com/programmers_guide/tutorial/index.html
I enjoyed the first three tutorials, good work.
_________________
Work in progress: Dual-Soft.com
#44965 - doublec - Mon Jun 06, 2005 11:13 pm
Yep, I do plan to cover other graphics modes - as soon as I learn a bit about them. The sprite and tile stuff is completely new to me, being more familiar with PC development the framebuffer mode was familiar, hence the reason I did that first. I'll be reading up on the GBA tutorials to get a handle on it.
#45090 - TheMikaus - Tue Jun 07, 2005 5:20 pm
In regards to tutorial 6. You might have covered it (I only skimmed the article) but what if you're using a multiloader and multiple file systems (one per rom say).
I guess you'd just have to read the file and then look for something that your game would have in the system and if it returns null look for the next file system on the cart?
#45137 - doublec - Tue Jun 07, 2005 10:55 pm
Good question, I've not played with the multi loaders yet. When I do I'll see what can be done. I'm open to suggestions on the best way of handling it.
#45241 - doublec - Wed Jun 08, 2005 11:27 pm
It appears to not work with a multi loader. I'm not sure how to handle this case at the moment but I'll look into it. I suspect it's finding the wrong gbfs file or not finding it at all.
#45261 - Kyoji - Thu Jun 09, 2005 2:52 am
I have a similiar problem as Mr. Snowflake. the Complex2D demo refuses to compile using the makefile included. I have all paths set, but I took a look in the complex2D.prj file and it references to \examples\nds\Complex2D\build\Complex2D.map I have the directory, but not the .map file, and trying to update it via CVs tells me the build dir does not exist.
I'm thinking this is what is halting the process.
#45265 - wintermute - Thu Jun 09, 2005 3:07 am
Kyoji wrote: |
I have a similiar problem as Mr. Snowflake. the Complex2D demo refuses to compile using the makefile included. I have all paths set, but I took a look in the complex2D.prj file and it references to \examples\nds\Complex2D\build\Complex2D.map I have the directory, but not the .map file, and trying to update it via CVs tells me the build dir does not exist.
I'm thinking this is what is halting the process. |
This has nothing to do with Mr. Snowflake's problems, or this topic at all.
If you follow the setup instructions at http://devkitpro.sourceforge.net/setup.shtml then the example in devkitPro cvs will compile. The .prj file is merely a project file for UltraEdit, the files referenced in there may belong to the project or not. The .map file is generated during the build process.
#45277 - Kyoji - Thu Jun 09, 2005 4:03 am
Alas, my makefile problems persist then. Cant seem to nail it down, and I've followed all the guides to the T...
Thanks for the insight anyway.
#45281 - cory1492 - Thu Jun 09, 2005 4:56 am
OMG thats what the .prj files are for! How handy! This must have been one of the "best kept secrets," wish I had known this a long long time ago, before I started using Notepad2.
Thanks for the valued info wintermute!
#45286 - Kyoji - Thu Jun 09, 2005 6:12 am
I'm really in between a rock and a hard spot here. I swear I've read that setup guide enough times my eyes bleed when they see it. Is there anything that would cause a make command to not work, if everything is set up right and a makefile exists?
All it does is create a "build" folder within the Complex2D folder, then stops.
Very weird, and its getting quite frustrating.
#45306 - TheMikaus - Thu Jun 09, 2005 2:12 pm
Don't know if this will help you or not, but sometimes I have to do a "make clean" before i can call "make"
Probably wont help, but worth mentioning just in case.
#45308 - Kyoji - Thu Jun 09, 2005 3:03 pm
Nope, but thanks for the help anyway.
#45336 - wintermute - Thu Jun 09, 2005 7:33 pm
Kyoji wrote: |
I'm really in between a rock and a hard spot here. I swear I've read that setup guide enough times my eyes bleed when they see it. Is there anything that would cause a make command to not work, if everything is set up right and a makefile exists?
All it does is create a "build" folder within the Complex2D folder, then stops.
Very weird, and its getting quite frustrating. |
What path are you running make from?
#45383 - Kyoji - Fri Jun 10, 2005 3:13 am
I'm running make in c:\devkitpro\complex2d. Unless you mean where is make.exe located, which is c:\devkitpro\msys\bin.
#45386 - DekuTree64 - Fri Jun 10, 2005 3:29 am
Try making a .bat file and put this in it:
Code: |
SET PATH=c:\devkitpro\devkitarm\bin;c:\devkitpro\msys\bin
SET NDSLIBPATH=/c/ndsdev/ndslib
make
pause |
That's what I run to build my DS projects. Change that /c/ndsdev/ndslib to whatever the path to your NDSLIB folder is.
Another nice thing about using a .bat file like that is that you can tell MSVC++ to run it, so you can just hit F7 to build, and get all the output and everything in VStudio (though errors still aren't clickable).
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku
#45389 - Kyoji - Fri Jun 10, 2005 3:40 am
DekuTree64, I could kiss you. It worked like a charm, thank you so much!
#45405 - FourScience - Fri Jun 10, 2005 11:46 am
Must have been one of those environment variables then. Good tip Deku.
_________________
Work in progress: Dual-Soft.com
#45417 - Kyoji - Fri Jun 10, 2005 3:04 pm
FourScience wrote: |
Must have been one of those environment variables then. Good tip Deku. |
Thats what I figured, so I went back and checked all my variables and the paths I had set, and they were all valid. Go figure..
#45934 - doublec - Thu Jun 16, 2005 11:10 pm
New tutorial up:
http://www.double.co.nz/nintendo_ds/nds_develop7.html
This one covers using the FIFO registers to send data between the ARM7 and ARM9.
#45936 - jstart - Fri Jun 17, 2005 12:01 am
Cool! It's awesome to figure out the secret innerworkings of the ds! :P
In this format your demos compile perfect if you hardcode the locations of your arm-elf-"whatever" tools in the makefile
Maybe you could include a read me telling mac users that
Another great tutorial!
_________________
-=Jstart=-
#45937 - doublec - Fri Jun 17, 2005 12:03 am
They shouldn't have to hardcode the locations of the compiler tools if they have $DEVKITARM/bin in their path. Or does the Mac work differently in that regard?
#45938 - jstart - Fri Jun 17, 2005 12:09 am
I may be an idiot but i haven't found a way to do that yet
Do I have to add something to the makefile? Or should I define where the bin folder is and then say (DEVKITARM)/arm-elf-""?
Plus i just compiled your space invader emulator! works great!
Thanks for remembering us unix oses
_________________
-=Jstart=-
Last edited by jstart on Fri Jun 17, 2005 12:23 am; edited 1 time in total
#45940 - strager - Fri Jun 17, 2005 12:18 am
doublec wrote: |
This one covers using the FIFO registers to send data between the ARM7 and ARM9. |
I was searching high and low for a tutorial that covers FIFO, and I've finally found it. Thanks a lot. :-)
#45941 - doublec - Fri Jun 17, 2005 12:19 am
You shouldn't have to change the makefile at all. By adding $DEVKITARM/bin to your PATH environment variable you should be fine. That's assuming you've set DEVKITARM of course!
I don't know anything about Mac OS X though to be able to point you in the right direction unfortunately.
#45945 - ecurtz - Fri Jun 17, 2005 12:49 am
doublec wrote: |
You shouldn't have to change the makefile at all. By adding $DEVKITARM/bin to your PATH environment variable you should be fine. That's assuming you've set DEVKITARM of course!
I don't know anything about Mac OS X though to be able to point you in the right direction unfortunately. |
Setting environment variables in OS X
#46801 - doublec - Thu Jun 30, 2005 10:57 pm
New tutorial covering the how and why of using interrupts:
http://www.double.co.nz/nintendo_ds/nds_develop8.html
#46811 - jstart - Fri Jul 01, 2005 2:07 am
Awesome! This will really help me! I didn't know anything about interrupts until now. Definately a great feature to spotlight!
I would still really like to see maybe a background and sprite demo or tile demo tutorial
_________________
-=Jstart=-
#47025 - doublec - Sun Jul 03, 2005 11:50 pm
I've released a version of DSEmu that will run the last tutorial I did, Tutorial 8:
http://www.double.co.nz/nintendo_ds/dsemu.html
Previously DSEmu didn't do keyboard interrupts and wouldn't return from SWI 4.
jstart, I hope to cover more graphics stuff soon - I'm still learning about that side myself.
#47150 - Spaceface - Tue Jul 05, 2005 9:17 pm
looking back on this tutorial, did you completely kick out the NDS Dev enviroment?
But amazing work.. you're going to help me miles into DS Dev... best work EVER
#47159 - doublec - Tue Jul 05, 2005 10:33 pm
I went from NDS dev env to using devkitpro as the Aaron wasn't updating it at the time. New stuff was coming out in ndslib and devkitpro but I couldn't write about it or use it. Then I had Mac OS X and Linux people wanting to run the tutorial demo's so it was worthwhile switching over to support that side of things.
#47613 - doublec - Mon Jul 11, 2005 11:31 am
Thanks to neimods microphone code, new tutorial up, Tutorial Nine, on using the microphone:
http://www.double.co.nz/nintendo_ds/nds_develop9.html
#47616 - NoMis - Mon Jul 11, 2005 12:51 pm
Very nice :)
Keep up the good work.
NoMis
_________________
www.gamedev.at - The austrian gamedev site
hde.gamedev.at - The Handheld Dev Env plugins for Eclipse
#47641 - jstart - Mon Jul 11, 2005 6:27 pm
WOW! I didn't think anyone would figure this out for a while! This is an amazing feature! Thanks neimod and doublec!
And as I always say, I'd really like a tutorial on graphics modes :)
_________________
-=Jstart=-
#47651 - doublec - Mon Jul 11, 2005 11:20 pm
I was actually putting the finishing touches on a mode 5 tutorial when neimod worked out the microphone stuff so I got side tracked :) Expect something later this week though.
#48583 - Spaceface - Wed Jul 20, 2005 9:28 pm
I have two questions:
- In day 4 you get to sounds. Are there any emu's by now which support sound?
- Also there's this piece of code
Code: |
void on_irq_vblank() {
// Disable interrupts
IME = 0;
draw_shape(old_x, old_y, VRAM_A, RGB15(0, 0, 0));
draw_shape(shape_x, shape_y, VRAM_A, shape_color);
// Tell the DS we handled the VBLANK interrupt
IF = IF;
VBLANK_INTR_WAIT_FLAGS = IF | IE;
// Enable interrupts
IME = 1;
}
|
What does IF = IF stand for? For me as a newb it seems to declare itself.
Is there any tutorial for the ndslib (libnds in this case) for me to make a tile based game like zelda?
Thanks very much in advance =)
#48584 - Mighty Max - Wed Jul 20, 2005 9:36 pm
The IF is a hardware register that need to be accessed once so that the interrupt controller knows the interrupt has been handled, and continues to listen for this event.
(At least that is what i think it is, as i know this behavior from x86 environment)
#48590 - tepples - Wed Jul 20, 2005 11:27 pm
Spaceface wrote: |
Also there's this piece of code
Code: | // Tell the DS we handled the VBLANK interrupt
IF = IF;
VBLANK_INTR_WAIT_FLAGS = IF | IE;
|
|
To anybody who knows about interrupt handling, have the semantics of interrupts on the Nintendo DS changed significantly from those on the GBA, where the proper sequence was the following?
Code: |
// Tell the GBA we handled the interrupts
int interrupts = IF;
VBLANK_INTR_WAIT_FLAGS |= interrupts;
IF = interrupts;
|
(In my GBA header file, IF and VBLANK_INTR_WAIT_FLAGS are called INTACK and BIOS_INTACK respectively.)
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#48593 - doublec - Wed Jul 20, 2005 11:39 pm
Quote: |
To anybody who knows about interrupt handling, have the semantics of interrupts on the Nintendo DS changed significantly from those on the GBA, where the proper sequence was the following? |
No that sequence is correct on the DS too. In my interrupts tutorial I show:
Code: |
void on_irq()
{
if(IF & IRQ_VBLANK) {
on_irq_vblank();
VBLANK_INTR_WAIT_FLAGS |= IRQ_VBLANK;
}
if(IF & IRQ_KEYS) {
on_irq_keys();
VBLANK_INTR_WAIT_FLAGS |= IRQ_KEYS;
}
IF |= IRQ_VBLANK | IRQ_KEYS;
} |
Which is effectively the same thing given the IE (in this example) is set to only allow VBLANK and KEYS interrupts.
Including IE in the OR of IF seems wrong to me:
Code: |
VBLANK_INTR_WAIT_FLAGS = IF | IE; |
This will mean that the BIOS wait for interrupt routine will exit on when waiting for interrupts that haven't been fired, but have been enabled. This is why my later tutorials (after the interrupts one) don't use the libnds interrupt handler. I need to revisit my earlier tutorials to remove some of this older code.
Unfortunately my PC died on me today (power supply I think) so it'll be a short wait before I can do much about it.
#48596 - tepples - Wed Jul 20, 2005 11:44 pm
doublec wrote: |
Including IE in the OR of IF seems wrong to me:
Code: | VBLANK_INTR_WAIT_FLAGS = IF | IE; |
This will mean that the BIOS wait for interrupt routine will exit on when waiting for interrupts that haven't been fired, but have been enabled. |
Depends. Does BIOS IntrWait() on each system clear VBLANK_INTR_WAIT_FLAGS itself?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#48599 - doublec - Thu Jul 21, 2005 12:04 am
Quote: |
Depends. Does BIOS IntrWait() on each system clear VBLANK_INTR_WAIT_FLAGS itself? |
I'm not sure, but would it matter? If IE is included in the assign to VBLANK_INTR_WAIT_FLAGS then the following could happen (pseudo code):
Code: |
IE = IRQ_VBLANK | IRQ_KEYS;
IntrWait(IRQ_KEYS);
// A vblank occurs so IF=IRQ_VBLANK and the vblank executes:
VBLANK_INTR_WAIT_FLAGS = IF | IE; |
Now my IntrWait exits because it thinks the IRQ_KEYS has been fired, but it hasn't.
#48601 - tepples - Thu Jul 21, 2005 12:16 am
I misread something. I admit that including IE in the OR is a Bad Thing, but I saw "OR is a Bad Thing". My fault.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#48603 - doublec - Thu Jul 21, 2005 1:48 am
Spaceface, to answer your other questions. I think the IDeaS emulator supports sound to some degree. DSEmu will run the code without crashing but no sound will play.
I don't know of any DS specific tile tutorials, but there are a few GBA ones around that may be helpful. I'm still learning that area myself and will probably do a tutorial when I understand it better.
#48728 - doublec - Thu Jul 21, 2005 11:24 pm
New tutorial up covering extended rotation backgrounds, decoding jpeg files, hardware scrolling and scaling:
http://www.double.co.nz/nintendo_ds/nds_develop10.html
I've also made various edits to the other tutorials to fix up some issues. The interrupt handling has been made consistent across the tutorials. I now use the key handling of libnds for the later tutorials. And the problems with devkitpro r14 have been fixed in tutorial 6.
#48734 - jstart - Thu Jul 21, 2005 11:43 pm
You rock doublec YAY!
_________________
-=Jstart=-
#48742 - skabio - Fri Jul 22, 2005 1:13 am
Another great tutorial! Cant seem to get demo 10 to work via GBAMP, all the others work fine however.
#49175 - GPFerror - Wed Jul 27, 2005 3:31 am
doublec wrote: |
New tutorial up covering extended rotation backgrounds, decoding jpeg files, hardware scrolling and scaling:
http://www.double.co.nz/nintendo_ds/nds_develop10.html
I've also made various edits to the other tutorials to fix up some issues. The interrupt handling has been made consistent across the tutorials. I now use the key handling of libnds for the later tutorials. And the problems with devkitpro r14 have been fixed in tutorial 6. |
in the latest devkitpro 4.1 and latest libnds cvs(today) , in the latest darc build of dsemu 0.45 the consoleprintf is broken, works in ideas.
#49180 - doublec - Wed Jul 27, 2005 4:49 am
Thanks for the report, I've got some fixes that I need to push through but I'm flat out with work till the end of the week. I'll probably have it resolved after the weekend though.
#49237 - Spaceface - Wed Jul 27, 2005 6:52 pm
doublec any improvement on the tile based tutorial? ;)
I'm not too well known with GBA dev, so I would probably not see the difference between DS and GBA...
#49238 - alangerow - Wed Jul 27, 2005 7:07 pm
doublec, just wanted to let you know that I'm learning to program for the DS from a web scripting background (PHP), and your tutorials are really good. I'm using them in conjunction with every other tutorial I could find, and I'm finding I'm using yours for primary workthrough, and then referencing other tutorials to fill in any gaps.
Things are made more difficult because I'm learning C at the same time, but your examples are easy to understand, break apart, and analyze. Just wanted to let you know that your work is very helpful. At the end of Day 1, I had played around with the 2nd tutorial demo and got the box to bounce around the sides. I can now make Pong.
Looking forward to making my way through the rest of your tutorials.
#49271 - doublec - Thu Jul 28, 2005 12:14 am
alangerow, that's great, thanks for the feedback! Your approach is exactly how I was hoping people would benefit from the tutorials. Using them as a starting point to play around with and a launching pad for going out and learning more.
Spaceface, I'm writing a tile based demo at the moment. Once this week of work is over, I'll be able to spend more time on it so hopefully sometime next week. Then hopefully sprites, and some demos tying things together.
#49458 - Freakreation - Fri Jul 29, 2005 10:07 pm
Firstly, Doublec thanks for the work you are putting into the tutorials for us DS noobs. I'm going through them slowly and tinkering with each demo source to make sure I get it before moving on (great fun!). I have a simple enquiry about some of the Framebuffer gfx code:
Code: |
if (shape_x + shape_width >= SCREEN_WIDTH) {
shape_x = 0;
shape_y += shape_height;
if(shape_y + shape_height >= SCREEN_HEIGHT) {
shape_y = 0;
} |
I just wondered why you have >= on both height and width, on my DS hardware it misses a pixel on the right and bottom of the screen when moving the box around. Am I missing something, surely > would be ideal as the box appears to skip a little at the edge of the screen. I know this is a trivial point but it's bugging me that there might be some reason for this I don't understand...
thanks :)
#49463 - cory1492 - Fri Jul 29, 2005 10:52 pm
Freakreation wrote: |
Code: | if (shape_x + shape_width >= SCREEN_WIDTH) {
shape_x = 0;
shape_y += shape_height;
if(shape_y + shape_height >= SCREEN_HEIGHT) {
shape_y = 0;
} |
I just wondered why you have >= on both height and width, on my DS hardware it misses a pixel on the right and bottom of the screen when moving the box around. Am I missing something, surely > would be ideal as the box appears to skip a little at the edge of the screen. I know this is a trivial point but it's bugging me that there might be some reason for this I don't understand...
thanks :) |
I think SCREEN_WIDTH and height both refer to the values of it as if 0 were 1, so the actual pixel width of the screen would be SCREEN_WIDTH + 1
#51024 - Spaceface - Mon Aug 15, 2005 3:24 pm
doublec (or anybody else who can help me), I have a question regarding tutorial 4, the sound tutorial. The samples I convert seem extremely distorted through my DS. Also when I lower the SOUND_VOL in:
Code: |
SCHANNEL_CR(0) = SCHANNEL_ENABLE | SOUND_ONE_SHOT | SOUND_8BIT | SOUND_VOL(0x3F);
|
Also I was wondering how the tile tutorial is coming along =)
#51057 - doublec - Mon Aug 15, 2005 11:24 pm
How are you converting the sound files? Are they 8 bit, signed or unsigned, etc?
The tutorial is stalled at the moment due to a busy workload at work. I'll be getting a dsemu release out this weekend and then back to tutorials hopefully.
#51059 - Spaceface - Mon Aug 15, 2005 11:53 pm
using it exactly as told in the tutorial..
don't know whether it's signed or unsigned though..
I've uploaded it on http://www.moonpirates.nl/guitar2.wav
Other than that it converts exactly as shown in the tutorial. Eventhough I believe the Ufo.wav didn't show this problem.. Don't have a clue whatsoever...
#51247 - Spaceface - Wed Aug 17, 2005 3:53 pm
Problem solved, saved the wav as raw signed via SoundForge. Aparently sox decided to save it as unsigned which caused the horrible distortion.
#54400 - doublec - Mon Sep 19, 2005 12:26 am
Devkitpro r16a changed quite a few things which broke my tutorials. I've fixed the first six and they are at the usual place:
http://www.double.co.nz/nintendo_ds
For some reason the FIFO tutorial is not working and I'm currently working on getting that going then will continue fixing up the rest.
#54433 - biubid_boy - Mon Sep 19, 2005 10:31 am
Wo! Just started your tutorial but when I tried to compile the first demo, I got this:
Code: |
$ make
arm-elf-g++ -g -Wall -O2 -mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer -ffast-math -mthumb-interwork -I/libnds/include -DARM7 -c arm7_main.cpp -oarm7_main.o
arm7_main.cpp:6:17: error: nds.h: No such file or directory
arm7_main.cpp:17: error: 's32' does not name a type
arm7_main.cpp:18: error: 's32' does not name a type
arm7_main.cpp:19: error: 's32' does not name a type
arm7_main.cpp:20: error: 's32' does not name a type
arm7_main.cpp:26: error: 'uint32' has not been declared
arm7_main.cpp:26: error: 'u8' has not been declared
arm7_main.cpp:26: error: 'u8' has not been declared
arm7_main.cpp:26: error: 'u8' has not been declared
arm7_main.cpp:26: error: 'u8' has not been declared
arm7_main.cpp: In function 'void startSound(int, const void*, int, int, int, int, int)':
arm7_main.cpp:27: error: 'SCHANNEL_TIMER' was not declared in this scope
arm7_main.cpp:27: error: 'SOUND_FREQ' was not declared in this scope
arm7_main.cpp:28: error: 'SCHANNEL_SOURCE' was not declared in this scope
arm7_main.cpp:28: error: 'uint32' was not declared in this scope
arm7_main.cpp:28: error: expected `;' before 'data'
arm7_main.cpp:29: error: 'SCHANNEL_LENGTH' was not declared in this scope
arm7_main.cpp:30: error: 'SCHANNEL_CR' was not declared in this scope
arm7_main.cpp:30: error: 'SOUND_ENABLE' was not declared in this scope
arm7_main.cpp:30: error: 'SOUND_ONE_SHOT' was not declared in this scope
arm7_main.cpp:30: error: 'SOUND_VOL' was not declared in this scope
arm7_main.cpp:30: error: 'SOUND_PAN' was not declared in this scope
arm7_main.cpp:30: error: 'SOUND_8BIT' was not declared in this scope
arm7_main.cpp:30: error: 'SOUND_16BIT' was not declared in this scope
arm7_main.cpp: At global scope:
arm7_main.cpp:34: error: 's8' does not name a type
arm7_main.cpp: In function 'void InterruptHandler()':
arm7_main.cpp:48: error: 'IF' was not declared in this scope
arm7_main.cpp:48: error: 'IRQ_VBLANK' was not declared in this scope
arm7_main.cpp:49: error: 'uint16' was not declared in this scope
arm7_main.cpp:49: error: expected `;' before 'but'
arm7_main.cpp:51: error: 'uint32' was not declared in this scope
arm7_main.cpp:51: error: expected `;' before 'temp'
arm7_main.cpp:52: error: 'uint8' was not declared in this scope
arm7_main.cpp:52: error: expected `;' before 'ct'
arm7_main.cpp:59: error: 'but' was not declared in this scope
arm7_main.cpp:59: error: 'XKEYS' was not declared in this scope
arm7_main.cpp:62: error: 'x' was not declared in this scope
arm7_main.cpp:62: error: 'TSC_MEASURE_X' was not declared in this scope
arm7_main.cpp:62: error: 'touchRead' was not declared in this scope
arm7_main.cpp:63: error: 'y' was not declared in this scope
arm7_main.cpp:63: error: 'TSC_MEASURE_Y' was not declared in this scope
arm7_main.cpp:64: error: 'xpx' was not declared in this scope
arm7_main.cpp:64: error: 'TOUCH_WIDTH' was not declared in this scope
arm7_main.cpp:64: error: 'TOUCH_OFFSET_X' was not declared in this scope
arm7_main.cpp:65: error: 'ypx' was not declared in this scope
arm7_main.cpp:65: error: 'TOUCH_HEIGHT' was not declared in this scope
arm7_main.cpp:65: error: 'TOUCH_OFFSET_Y' was not declared in this scope
arm7_main.cpp:66: error: 'z1' was not declared in this scope
arm7_main.cpp:66: error: 'TSC_MEASURE_Z1' was not declared in this scope
arm7_main.cpp:67: error: 'z2' was not declared in this scope
arm7_main.cpp:67: error: 'TSC_MEASURE_Z2' was not declared in this scope
arm7_main.cpp:70: error: 'batt' was not declared in this scope
arm7_main.cpp:70: error: 'TSC_MEASURE_BATTERY' was not declared in this scope
arm7_main.cpp:70: error: 'touchRead' was not declared in this scope
arm7_main.cpp:71: error: 'aux' was not declared in this scope
arm7_main.cpp:71: error: 'TSC_MEASURE_AUX' was not declared in this scope
arm7_main.cpp:74: error: expected primary-expression before ')' token
arm7_main.cpp:74: error: 'rtcGetTime' was not declared in this scope
arm7_main.cpp:75: error: expected primary-expression before ')' token
arm7_main.cpp:75: error: 'ct' was not declared in this scope
arm7_main.cpp:75: error: 'BCDToInteger' was not declared in this scope
arm7_main.cpp:78: error: 'temp' was not declared in this scope
arm7_main.cpp:78: error: 'touchReadTemperature' was not declared in this scope
arm7_main.cpp:81: error: 'IPC' was not declared in this scope
arm7_main.cpp:83: error: 'x' was not declared in this scope
arm7_main.cpp:84: error: 'y' was not declared in this scope
arm7_main.cpp:85: error: 'xpx' was not declared in this scope
arm7_main.cpp:86: error: 'ypx' was not declared in this scope
arm7_main.cpp:87: error: 'z1' was not declared in this scope
arm7_main.cpp:88: error: 'z2' was not declared in this scope
arm7_main.cpp:92: error: 'u32' was not declared in this scope
arm7_main.cpp:92: error: expected `;' before 'i'
arm7_main.cpp:92: error: 'i' was not declared in this scope
arm7_main.cpp:102: error: 'TransferSound' was not declared in this scope
arm7_main.cpp:102: error: 'snd' was not declared in this scope
arm7_main.cpp:106: error: 's8' was not declared in this scope
arm7_main.cpp:106: error: expected `;' before 'chan'
arm7_main.cpp:107: error: 'chan' was not declared in this scope
arm7_main.cpp:115: error: 'IF' was not declared in this scope
arm7_main.cpp: In function 'int main(int, char**)':
arm7_main.cpp:124: error: 'rtcReset' was not declared in this scope
arm7_main.cpp:127: error: 'SOUND_CR' was not declared in this scope
arm7_main.cpp:127: error: 'SCHANNEL_ENABLE' was not declared in this scope
arm7_main.cpp:127: error: 'SOUND_VOL' was not declared in this scope
arm7_main.cpp:128: error: 'IPC' was not declared in this scope
arm7_main.cpp:131: error: 'IME' was not declared in this scope
arm7_main.cpp:132: error: 'IRQ_HANDLER' was not declared in this scope
arm7_main.cpp:133: error: 'IE' was not declared in this scope
arm7_main.cpp:133: error: 'IRQ_VBLANK' was not declared in this scope
arm7_main.cpp:134: error: 'IF' was not declared in this scope
arm7_main.cpp:135: error: 'DISP_SR' was not declared in this scope
arm7_main.cpp:135: error: 'DISP_VBLANK_IRQ' was not declared in this scope
arm7_main.cpp:139: error: 'swiWaitForVBlank' was not declared in this scope
make: *** [arm7_main.o] Error 1
|
#54434 - revo - Mon Sep 19, 2005 11:36 am
Quote: |
arm7_main.cpp:6:17: error: nds.h: No such file or directory |
take a look at system variables, there should be something wrong
_________________
[ sorry for all mistakes, but my english isn't as good as I wish it to be ]
#54465 - wintermute - Mon Sep 19, 2005 6:24 pm
biubid_boy wrote: |
Wo! Just started your tutorial but when I tried to compile the first demo, I got this:
Code: |
$ make
arm-elf-g++ -g -Wall -O2 -mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer -ffast-math -mthumb-interwork -I/libnds/include -DARM7 -c arm7_main.cpp -oarm7_main.o
arm7_main.cpp:6:17: error: nds.h: No such file or directory
|
|
Pay particular attention to the setting up instructions in the first tutorial http://www.double.co.nz/nintendo_ds/nds_develop1.html which links here http://www.devkitpro.org/setup.shtml . If you're using windows it's probably best to use the installer at the top of the second link.
#54791 - JessTicular - Thu Sep 22, 2005 4:13 pm
Hey there, guys :)
Great tute's, doublec! Really good to have something like this for the beginner, especially when you're keeping everything so up-to-date!
And, wintermute, I appreciate all the help you're giving out around here. Thanks ( even if you can't help me out here :P ).
Ok, I have a problem with running the code.
I continually get errors telling me that those sexy special variables aren't declared ( namely 'IF' )...
Quote: |
c:/dsdev/examples/nds/graphics/2d/complex_2d/source/main.cpp:84: error: 'IF' was not declared in this scope |
I've followed the latest on the setting up tutorial, and followed all the steps for devkitARM's set-up.
Basically, I have:
'devkitPRO' directory: "C:\dsDev"
'devkitARM' directory: "C:\dsDev\devkitARM"
system variables:
DEVKITPRO = /c/dsdev
DEVKITARM = /c/dsdev/devkitarm
Am using:
devkitARM r16a
libnds released 21st this month ( 2 days ago )
... I'm on winXP, and am using the msys console to execute the makefiles.
Have tried both the 'demo1' example in the first tute, and the Complex2D example from the CVS, both of which give the undeclared error for 'IF'
( additionally, demo1 gives it for 'IME' within the main ).
Any help on this would be greatly appreciated.
I'm really eager to start porting some old-school games I've made to my DS so I can show it off in my little circle of nerds :P
Thanks,
Jess.
#54805 - Kujo - Thu Sep 22, 2005 7:32 pm
case sensitive???
try
DEVKITPRO = /c/dsDev
DEVKITARM = /c/dsDev/devkitARM
hope that helps...that might not be the problem...I'm no expert...all I know is I have it set up as if it were case sensitive...I'm fairly sure that's it though...
*crosses fingers*
good luck
#54845 - doublec - Fri Sep 23, 2005 12:01 am
I believe that the latest libnds has changed the register names. From IF, to REG_IF or something like that. I haven't tried the very latest NDS yet, I use the one released with devkitpro r16a.
Life on the bleeding edge of DS development can be rocky :-)
Edit: To clarify, I'm using libnds released on the 14th September.
#54868 - JessTicular - Fri Sep 23, 2005 5:58 am
Kujo, nope, case didn't seem to make any difference, thanks anyway - 'twas something I didn't think of.
doublec, looks like what you said is the case.
I took out the 21st's version of libnds, and replaced it with the 14th, and everything works smooth like silk!
So, if anyone gets the errors of 'IF' not being declared, it's because it's been renamed in the latest version of libnds.
You have two options;
a) Find out the new names, and fix up your code to reflect that, or
b) use the September 14th version of libnds ( available from the sourceforge devkitPRO page ).
Thanks for the help guys, 'tis much appreciated!
#54979 - sirjorj - Sat Sep 24, 2005 2:23 am
First: awesome, awesome tutorials! I have only been through one of them, but based on all the feedback and what I have seen, very well done!
I am getting started in DS dev and found this to be an excellent starting point. I am also using Mac OS X (tiger) as a development platform. I have that neo-flash deev kit for hardware (512mb card, 'magic key' -passme device, and USB Slim Loader III for programming the flash card). It appears that there is no Mac support for this card programmer, so I need the winXP laptop for that, but I am trying to do as much as possible on the Powerbook.
Ok. Getting started. I went to the devkitPRO site and got devkitARM r15 for OS X. Is there an actual 'devkitPRO' program, or is that just a project name with several 'branches' like devkitARM?
Tutorial 1. Got it to build with the version at a dual-soft tutorial. I was looking at the differences that made the 'real' version of Tutorial 1 not build. The difference is in arm7_main.cpp. The original has the line
in the ISR, while the mac-ported version has
Why are these different? Different libnds versions?
Anyway, I did get the program built on the mac and the card flashed on the pc and the demo ran fine using passme and hardware.
fwiw, I'm really looking forward to playing with this. I am eager to see how similar it is to the embedded microcontollers i program for at my job. I guess I'm in this more for the learning and experience then the hope of making anything special. This is gonna be fun...
jorj
#55012 - wintermute - Sat Sep 24, 2005 5:27 pm
sirjorj wrote: |
Ok. Getting started. I went to the devkitPRO site and got devkitARM r15 for OS X. Is there an actual 'devkitPRO' program, or is that just a project name with several 'branches' like devkitARM?
|
devkitPro is the name for the set of gcc based toolchains, devkitARM is a component rather than a branch.
Quote: |
The difference is in arm7_main.cpp. The original has the line
in the ISR, while the mac-ported version has
Why are these different? Different libnds versions?
|
Later versions of libnds are gradually moving towards a consistent naming scheme. Eventually all the hardware registers will be prefixed with REG_ which helps both readability and programmers with editors that support code completion.
Unfortunately the most recent versions of libnds require devkitARM release 16 which isn't yet available for Mac OS X. We have limited access to Mac OS X programmers capable of building the toolchain so Mac support tends to lag the other platforms. Volunteers to help with this aspect would be greatly appreciated.
#55033 - sirjorj - Sat Sep 24, 2005 10:15 pm
Thank you for the response. What all would be involved in getting release 16 to OS X? I am very new to Mac and Mac development. I am wondering if this is something I could work on.
jorj
#55035 - tepples - Sat Sep 24, 2005 11:18 pm
I wonder if you could use the SourceForge.net compile farm for this.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#55040 - wintermute - Sun Sep 25, 2005 12:27 am
not enough allocated disk space, it's been tried
#55055 - crossraleigh - Sun Sep 25, 2005 3:00 am
Quote: |
What all would be involved in getting release 16 to OS X? |
If you have the Apple developer tools, wget, libelf, and about an hour of free time, just download the buildscripts and run them. You might have some problems from time to time, especially if you use the buildscripts from CVS, but most of time it's that easy.
However, if you prefer, you can try the Mac installer I just put up for r16. Let me know if you have problems with it.
_________________
My world is black and white, but if I blink fast enough, I see it in grayscale.
#55072 - sirjorj - Sun Sep 25, 2005 5:23 am
Thank you for updating the Mac release. However, when I try to install it, I get the following error.
Code: |
You cannot continue. There is nothing to install.
|
Also, is it recommended to delete the previous version before install a new one?
jorj
#55190 - crossraleigh - Mon Sep 26, 2005 5:04 am
Quote: |
Also, is it recommended to delete the previous version before install a new one? |
That could be the problem. Remove the /opt/local/devkitpro/ directory and try installing again. If push comes to shove, try this:
- Right click devkitARM.pkg and select "Show Package Contents."
- Enter the Contents directory.
- Double-click Archive.pax.gz to decompress it.
- Rename the newly-created Archive directory to devkitpro.
- Move devkitpro into /opt/local/.
Can you tell I'm new to this? A different guy (Mr. Spiv) made the older installers. Please bear with me.
_________________
My world is black and white, but if I blink fast enough, I see it in grayscale.
#55195 - sirjorj - Mon Sep 26, 2005 5:27 am
I had already deleted all but the opt folder, so that made no difference. After manually extracting the content and putting it in /opt/local/... it worked! I build the original demo1 and it ran in hardware! Thank you very much! And I totally understand about you being new to the mac stuff. I just got my first mac shortly after Tiger was released, and as you can see my by number of posts, Im very new to DS homebrew.
Thanks again!
jorj
#55824 - Lazy1 - Sun Oct 02, 2005 10:39 pm
I have done the first tutorial but I cannot get it to work, it compiles fine but screws up when creating the .elf file...
Code: |
C:\projects\ds_tutorial1>arm-elf-gcc -Lc:\devkitpro\libnds\lib arm7.o -lnds7 -o
arm7.elf -mthumb-interwork
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-elf/4.0.1/../../../../arm-elf/lib/inte
rwork/crt0.o: In function `start':
c:/projects/devkitPro/buildscripts/newlib-1.13.0/newlib/libc/sys/arm/crt0.S:89:
undefined reference to `initialise_monitor_handles'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-elf/4.0.1/../../../../arm-elf/lib/inte
rwork\libc.a(exit.o): In function `exit':
: undefined reference to `_exit'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-elf/4.0.1/../../../../arm-elf/lib/inte
rwork\libc.a(sbrkr.o): In function `_sbrk_r':
: undefined reference to `_sbrk'
|
Any ideas about why this isn't working?
I haven't changed much in the sources except the placement of code, use of local variables, ect but nothing I did would cause this.
#55832 - wintermute - Mon Oct 03, 2005 12:25 am
you forgot -specs=ds_arm7.specs in the link step to start with. In order to use malloc on the arm7 side you'll need to edit that specs file found in path/to/devkitARM/arm-elf/lib/ds_arm7.specs. It should look like this :-
Code: |
%rename link old_link
%rename link_gcc_c_sequence old_gcc_c_sequence
*link_gcc_c_sequence:
%(old_gcc_c_sequence) --start-group -lsysbase -lc --end-group
*link:
%(old_link) -T ds_arm7.ld%s
*startfile:
ds_arm7_crt0%O%s crti%O%s crtbegin%O%s
|
#55836 - Lazy1 - Mon Oct 03, 2005 3:24 am
Thanks, it compiles perfectly now - all I have to do now is figure out why its giving me extremely strange results from the touchscreen.
[Edit]
Nevermind, it works on hardware but all the emulators I know about are broken...
DSEmu - Instead of a console, all I get is a screen filled with garbage characters
iDeaS - Touchscreen is broken
It's not too hard to use hardware, I just don't like to keep moving my CF card in/out - those pins won't last forever.
#55837 - doublec - Mon Oct 03, 2005 3:59 am
Quote: |
DSEmu - Instead of a console, all I get is a screen filled with garbage characters |
Read the readme file included with DSEmu (assuming you are using 0.4.7 and above). It explains that to fix the garbage console, use the configuration options dialog box to set the 'unscramble' option.
Or from the dsemu website:
Quote: |
Workaround for 'console scramble'. There has been an issue since DevkitPro R14 which causes text output using the console output routines to be scrambled. I implemented a workaround in 0.4.6 but it didn't work for homebrew programs built with previous versions. I've been unable to fix the problem so far, so I added a 'Unscramble console text' option in the Options/Configuration menu option. If you run a game and the text appears scrambled, check or uncheck this, and it should correct the problem when you press 'Ok'. |
#55838 - Lazy1 - Mon Oct 03, 2005 4:02 am
Whoa, I completely forgot about checking the readme - I guess since it worked perfectly the first time I ran it a while ago I didn't bother - sorry about that.
#60396 - doublec - Wed Nov 09, 2005 11:26 pm
I've updated my tutorials so that they compile with the new libnds versions (with the changed register names):
http://www.double.co.nz/nintendo_ds/index.html
Sorry to take so long!
#64326 - doublec - Wed Dec 21, 2005 9:22 am
The tutorials are updated again to work with the latest version of libnds (dated 2005-12-12):
http://www.double.co.nz/nintendo_ds
I've also released a new version of DSEmu to work with this version of libnds. Some of the touchscreen code changes broken DSEmu:
http://www.double.co.nz/nintendo_ds/dsemu.html
This release also fixes the SWI divide issues that people were having.
#64331 - rootzilla - Wed Dec 21, 2005 11:29 am
F:\dsdev\demo1>make
arm-elf-g++ -g -Wall -O2 -mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer -ff
ast-math -mthumb-interwork -I/d/devkitPro/libnds/include -DARM7 -c arm7_main.cpp
-oarm7_main.o
make: arm-elf-g++: Command not found
make: *** [arm7_main.o] Error 127
any idea why it would say this, when normal ndslib examples compile fine?
and yep, my env variables are all set up correctly
#64334 - doublec - Wed Dec 21, 2005 11:34 am
Do you have arm-elf-g++ in your path? (From memory, \devkitpro\devkitarm\bin). I did notice, when installing on another machine, that the windows installer for devkitarm didn't add it to my path.
Perhaps the standard ndslib examples have the location to the compiler embedded within them, or within something that it includes.
#64339 - rootzilla - Wed Dec 21, 2005 12:09 pm
C:\Documents and Settings\shane>path
PATH=d:\devkitPro\msys\bin; d:\devkitPro\devkitARM\bin;d:\devkitPro\msys\bin;
sure do :/
#64367 - doublec - Wed Dec 21, 2005 7:26 pm
Does typing 'arm-elf-g++' work from the command prompt?
#64431 - rootzilla - Thu Dec 22, 2005 11:01 am
nope :/
#64437 - doublec - Thu Dec 22, 2005 12:32 pm
That would indicate that something in your path is incorrect. Can you confirm where arm-elf-g++.exe is located?
Does the following show it:
dir d:\devkitPro\devkitARM\bin\arm-elf*.*
Does this run it:
d:\devkitPro\devkitARM\bin\arm-elf-g++.exe
What about:
set PATH=d:\devkitPro\devkitARM\bin\
arm-elf-g++
#117354 - doublec - Sun Feb 04, 2007 3:19 am
Hi All,
I've had quite a few emails about the fact that my tutorials don't work with newer devkitPro releases. This is just a quick note to let you know that I'm updating my tutorials so that they work, and I'm moving to using the standard devkitPro makefiles so that they'll be more resilient to devkitPro updates.
So far tutorial one has been done and I'm working on the others:
http://www.double.co.nz/nintendo_ds
#117418 - silent_code - Sun Feb 04, 2007 8:06 pm
man, keep up the good work! i couldn't encourage you enough to work on your tutorials. they are a great resource and i always recommend them to newcomers.
thank you very much! :D
#117477 - d0hboy1 - Mon Feb 05, 2007 1:56 am
doublec wrote: |
... This is just a quick note to let you know that I'm updating my tutorials so that they work |
I had no idea that the tutorials were being actively updated -- this is a godsend for those of us that are following along with both yours and dovoto's material out there for DS programming. Huge thanks..