@Jason: No SDL was used in the XMas demo, we used libnds only; about the XM, we converted it to wav, because the lack of mod libraries for ds. The sources are in the fpc4nds' "examples" directory.

@Dani?īl: I have removed the old hack for ds and gba, so now (I mean in 2.3.x trunk) gba and ds use the standard memory manager shipped with free pascal. Is it merged in the 2.2 fix branch now?

@Dominique: as promised, my batch file ^_^

Code:
rem This batch script is a little utility to make your fpc4nds in an easy way.
rem Make sure to install all stuff required and set the dirs accordingly.
rem For more infos feel free to contact me at francky74 AT gmail DOT com

@echo off

rem !!WARNING!! Set right directories!
rem     FPC_INST_DIR: The folder where you want your fpc4nds installed
rem     FPC_SRC_DIR: The folder where you have unpacked fpc sources
rem     BINUTILS_DIR: The folder where you have unpacked arm-nds binutils
rem     FPC_BIN_DIR: The folder where is fpc compiler used for build

set FPC_INST_DIR=C:\fpc4nds
set FPC_SRC_DIR=C:\fpc_sources
set BINUTILS_DIR=C:\arm-nds-binutils
set FPC_BIN_DIR=C:\fpc\2.2.0\bin\i386-win32

cls

echo ------------------------------------------------------------------------
echo                 FreePascal arm-nds installation script                 
echo ------------------------------------------------------------------------
echo You need to prepare the following stuff:
echo 1. Install the arm-nds binutils into %BINUTILS_DIR%
echo    http://itaprogaming.free.fr/download/arm-nds-binutils.zip
echo 2. Install the latest FreePascal snapshot into %FPC_SRC_DIR%
echo    ftp://ftp.freepascal.org/pub/fpc/snapshot/v21/source/fpc.zip
echo. 
echo According with this batch file, your fpc4nds will be installed in
echo %FPC_INST_DIR% from the fpc sources located at %FPC_SRC_DIR%
echo by using the Binutils located at %BINUTILS_DIR%.
echo.
echo At the end of this batch script, you could delete %FPC_SRC_DIR%/*.*
echo and %BINUTILS_DIR%/*.*. 
echo Please, remember to add %FPC_INST_DIR% to your search path too!
echo ------------------------------------------------------------------------

if NOT EXIST %BINUTILS_DIR%\arm-nds-ld.exe goto errorarmmissing
if NOT EXIST %FPC_SRC_DIR%\compiler\cclasses.pas goto errorfpcmissing
if EXIST %FPC_INST_DIR%\ goto makefpc4nds

echo ------------------------------------------------------------------------
echo Creating the freepascal dir ...
echo ------------------------------------------------------------------------
mkdir %FPC_INST_DIR%\bin\arm-nds

:makefpc4nds
pause
echo ------------------------------------------------------------------------
echo The necessary files were found, you may now continue.
echo ------------------------------------------------------------------------
pause

rem Creating cross compiler
rem ---------------------------

echo ------------------------------------------------------------------------
echo Cross compiler will now be created...
echo ------------------------------------------------------------------------

cd %FPC_SRC_DIR%\compiler
set path=%BINUTILS_DIR%;%PATH%;%FPC_BIN_DIR%
fpcmake -r -w -Tall
make distclean
make PPC_TARGET=arm
echo ------------------------------------------------------------------------
echo If you don't see any error messages, you may now continue.
echo ------------------------------------------------------------------------
pause
echo ------------------------------------------------------------------------
echo Creating the folder %FPC_INST_DIR%\bin\arm-nds ...
echo ------------------------------------------------------------------------
mkdir %FPC_INST_DIR%\bin\arm-nds
echo ------------------------------------------------------------------------
echo Copying %FPC_SRC_DIR%\compiler\ppcarm.exe
echo      to %FPC_INST_DIR%\bin\arm-nds\ ...
echo ------------------------------------------------------------------------

rem Renamed to avoid conflicts with other fpc arm compilers (like fpc4gba)
copy %FPC_SRC_DIR%\compiler\ppcarm.exe %FPC_INST_DIR%\bin\arm-nds\ppcarmnds.exe
echo ------------------------------------------------------------------------
echo Copying %BINUTILS_DIR%\*.*
echo      to %FPC_INST_DIR%\bin\arm-nds\ ...
echo ------------------------------------------------------------------------
copy %BINUTILS_DIR%\*.* %FPC_INST_DIR%\bin\arm-nds\
echo ------------------------------------------------------------------------
echo Creating the folder %FPC_INST_DIR%\msg ...
echo ------------------------------------------------------------------------
mkdir %FPC_INST_DIR%\msg
echo ------------------------------------------------------------------------
echo Copying %FPC_SRC_DIR%\compiler\msg\*.*
echo      to %FPC_INST_DIR%\msg\ ...
echo ------------------------------------------------------------------------
copy %FPC_SRC_DIR%\compiler\msg\*.* %FPC_INST_DIR%\msg\
pause
echo ------------------------------------------------------------------------
echo The crosscompiler is created and installed. You may now build the RTL.
echo ------------------------------------------------------------------------
pause

rem Compiling rtl
rem -----------------

echo ------------------------------------------------------------------------
echo The rtl will now be compiled...
echo ------------------------------------------------------------------------
cd %FPC_SRC_DIR%\rtl\nds
fpcmake -r -w -Tall
make clean
make CPU_TARGET=arm OS_TARGET=nds PP="%FPC_INST_DIR%\bin\arm-nds\ppcarmnds" OPT="-Tnds -CX" 
echo ------------------------------------------------------------------------
echo If you don't see any error messages, you may now continue.
echo ------------------------------------------------------------------------
pause
echo ------------------------------------------------------------------------
echo Creating the folder %FPC_INST_DIR%\units\arm-nds ...
echo ------------------------------------------------------------------------
mkdir %FPC_INST_DIR%\units\arm-nds
echo ------------------------------------------------------------------------
echo Copying %FPC_SRC_DIR%\rtl\units\arm-nds\*.*
echo      to %FPC_INST_DIR%\units\arm-nds\ ...
echo ------------------------------------------------------------------------
copy %FPC_SRC_DIR%\rtl\units\arm-nds\*.* %FPC_INST_DIR%\units\arm-nds\


echo ------------------------------------------------------------------------
echo Creating %FPC_INST_DIR%\bin\arm-nds\fpc.cfg ...
echo ------------------------------------------------------------------------
echo -Tnds > %FPC_INST_DIR%\bin\arm-nds\fpc.cfg
echo -Fu%FPC_INST_DIR%\units\arm-nds >> %FPC_INST_DIR%\bin\arm-nds\fpc.cfg
echo -XParm-nds- >> %FPC_INST_DIR%\bin\arm-nds\fpc.cfg
echo -FD%FPC_INST_DIR% >> %FPC_INST_DIR%\bin\arm-nds\fpc.cfg
echo -FD%FPC_INST_DIR%\bin\arm-nds >> %FPC_INST_DIR%\bin\arm-nds\fpc.cfg


echo ------------------------------------------------------------------------
echo Creating some useful shortcuts ...
echo ------------------------------------------------------------------------
echo [InternetShortcut] > %FPC_INST_DIR%\freepascal.url
echo URL=http://www.freepascal.org/ >> %FPC_INST_DIR%\freepascal.url
echo [InternetShortcut] > %FPC_INST_DIR%\fpc4nds.url
echo URL=http://itaprogaming.free.fr/ >> %FPC_INST_DIR%\fpc4nds.url



echo ------------------------------------------------------------------------
echo Congratulations! Your fpc4nds is now correctly installed.
echo Remember to add %FPC_INST_DIR% to your search path. If you want, you 
echo can delete %FPC_SRC_DIR%/*.* and %BINUTILS_DIR%/*.* now. 
echo ------------------------------------------------------------------------
goto EOF
;

:errorarmmissing
echo ------------------------------------------------------------------------
echo The ARM files are missing in %BINUTILS_DIR%!
echo Please install them, then restart this batch file.
echo. 
echo You can download these files from
echo http://itarogaming.free.fr/download/arm-nds-binutils.zip
echo. 
echo If you want to use different paths, please open this file in notepad
echo and change the first few lines according to your wishes.
echo ------------------------------------------------------------------------
pause
goto :EOF
;

:errorfpcmissing
echo ------------------------------------------------------------------------
echo The FPC files are missing in %FPC_SRC_DIR%\!
echo Please install them, then restart this batch file.
echo. 
echo You can download these files from
echo ftp://ftp.freepascal.org/pub/fpc/snapshot/v21/source/fpc.zip
echo.
echo If you want to use different paths, please open this file in notepad
echo and change the first few lines according to your wishes.
echo ------------------------------------------------------------------------
pause
goto :EOF
;

:EOF
cd %FPC_INST_DIR%
set FPC_INST_DIR=
set FPC_SRC_DIR=
set BINUTILS_DIR=
set FPC_BIN_DIR=

pause
Hope it helps