but i have a problem when using the REG_BG0CNT register...
i try to this REG_BG0CNT = BG_MAP_BASE(1);... but the compiler said: error: expected identifier or '(' before 'vu16'.
now, the code to the begin from this section
Code: Select all
#include <nds.h>
//-----------------------------------------------
// graphic references
//-----------------------------------------------
#include "gfx_ball.h"
#include "gfx_brick.h"
#include "gfx_gradient.h"
//-----------------------------------------------
// tile entries
//-----------------------------------------------
#define tile_empty 0 // tile 0 = empty
#define tile_brick 1 // tile 1 = brick
#define tile_gradient 2 // tile 2 to 9 = gradient
// macro for calculating BG VRAM memory
// address with tile index
#define tile2bgram(t) (BG_GFX + (t) * 16)
// BG PALETTES
#define pal_bricks 0 // brick palette (entry 0->15)
#define pal_gradient 1 // gradient palette (entry 16->31)
#define backdrop_colour RGB8( 0, 0, 255 )
#define pal2bgram(p) (BG_PALETTE + (p) * 16)
// libnds prefixes the register names with REG_
// error at this point
REG_BG0CNT = BG_MAP_BASE(1);
REG_BG1CNT = BG_MAP_BASE(2);
// and this point
#define bg0map ( (u16*) BG_MAP_RAM(1) )
#define bg1map ( (u16*) BG_MAP_RAM(2) )
Code: Select all
[alex@darkstar ds]$ make
main.c
arm-eabi-gcc -MMD -MP -MF /home/alex/workspace/ds/build/main.d -g -Wall -O2 -it-frame-pointer -ffast-math -mthumb -mthumb-interwork -march=armv5te -mtune=946e-s -iquote /home/alex/workspace/ds/include -I/home/alex/apps/devkitpro//lds/include -I/home/alex/workspace/ds/build -DARM9 -c /home/alex/workspace/ds/rce/main.c -o main.o
/home/alex/workspace/ds/source/main.c:31:1: error: expected identifier or '('fore 'vu16'
/home/alex/workspace/ds/source/main.c:31:1: error: expected ')' before numerionstant
/home/alex/workspace/ds/source/main.c:32:1: error: expected identifier or '('fore 'vu16'
/home/alex/workspace/ds/source/main.c:32:1: error: expected ')' before numerionstant
make[1]: *** [main.o] Error 1
make: *** [build] Error 2
[img][/img]
the code without the last four lines, compile and work fine.