1876
Calculator C / Re: Post your Nspire routines here!
« on: June 16, 2010, 02:59:48 pm »
I'm having trouble compiling with the skeleton environment. I was able to successfully compile the Ndless demo, whereas Bwang's raycaster and a small test program I wrote won't compile. It seems to not be loading the headers properly.
Here is the code:
And the the full output:
If it matters, I'm using the arm-elf-gcc version of yagarto.
Here is the code:
Code: [Select]
#include <os.h>
#include <common.h>
#include <utils.h>
asm(".string \"PRG\"\n");
int main()
{
int antx = 160;
int anty = 120;
int dir = 1;
while (!isKeyPressed(KEY_NSPIRE_ESC)) {
if (getpixel(antx,anty) == 15) {
setpixel(anty,antx,0);
dir = dir - 1;
}
else {
setpixel(anty,antx,15);
dir = dir + 1;
}
if (dir == 0)
dir = 4;
else if (dir == 5)
dir = 1;
if (dir == 1)
antx = antx - 1;
else if (dir == 2)
anty = anty + 1;
else if (dir == 3)
antx = antx + 1;
else
anty = anty - 1;
if (antx == 0)
antx = 320;
else if (antx == 321)
antx = 1;
if (anty == 0)
anty = 240;
else if (anty == 241)
anty = 1;
}
return 0;
}
And the the full output:
Code: [Select]
arm-elf-gcc -mcpu=arm7tdmi -O3 -Wall -W -fpie -fno-merge-constants -c -I./header
s -D NON_CAS main.c
In file included from ./headers/os.h:17,
from main.c:1:
./headers/common.h:62:20: warning: missing whitespace after the macro name
./headers/common.h:71:22: warning: missing whitespace after the macro name
./headers/common.h:114:20: warning: missing whitespace after the macro name
./headers/common.h:114:1: warning: "KEY_NSPIRE_" redefined
./headers/common.h:62:1: warning: this is the location of the previous definitio
n
./headers/common.h:116:20: warning: missing whitespace after the macro name
./headers/common.h:116:1: warning: "KEY_NSPIRE_" redefined
./headers/common.h:114:1: warning: this is the location of the previous definiti
on
main.c: In function 'setPixel':
main.c:23: warning: implicit declaration of function 'getpixel'
main.c:24: warning: implicit declaration of function 'setpixel'
main.c:52: warning: 'return' with a value, in function returning void
main.c: In function 'main':
main.c:53: error: expected declaration or statement at end of input
make: *** [main.o] Error 1
If it matters, I'm using the arm-elf-gcc version of yagarto.