#177085 - blessingta@hotmail.co.uk - Thu Dec 08, 2011 2:35 pm
Basically, I'm trying to rewrite a "C" function in assembly but it refuses to work.
here is the code & errors: (my original C file is the one commented out)
here is the code & errors: (my original C file is the one commented out)
Code: |
//VRAM = video ram #include <gba_console.h> #include <gba_video.h> #include <gba_interrupt.h> #include <gba_systemcalls.h> #include <gba_input.h> #include <stdio.h> /* void ASSEMBLY_FUNC_HERE() { volatile unsigned char * pvuc_Im_in_assembly = "find me here in assembly"; } */ asm ( ".align 2 \n\t" ".global ASSEMBLY_FUNC_HERE \n\t" " .code 16 \n\t" " .thumb_func \n\t" " .type ASSEMBLY_FUNC_HERE, %function \n\t" "ASSEMBLY_FUNC_HERE: \n\t" //".LFB6: \n\t" " .loc 1 11 0 \n\t" " .cfi_startproc \n\t" //".LVL0: \n\t" " .loc 1 15 0 \n\t" " @ sp needed for prologue \n\t" " bx lr \n\t" " .cfi_endproc \n\t" //".LFE6: \n\t" " .size ASSEMBLY_FUNC_HERE, .-ASSEMBLY_FUNC_HERE \n\t" ); int NEWFUNC (int i) { i += 9000; return i; } //--------------------------------------------------------------------------------- // Program entry point //--------------------------------------------------------------------------------- int main(void) { //--------------------------------------------------------------------------------- // the vblank interrupt must be enabled for VBlankIntrWait() to work // since the default dispatcher handles the bios flags no vblank handler // is required irqInit(); irqEnable(IRQ_VBLANK); consoleDemoInit(); ASSEMBLY_FUNC_HERE(); NEWFUNC(1); while (1) { VBlankIntrWait(); } } |
Quote: |
> "make" main.c arm-eabi-gcc -MMD -MP -MF /h/YEAR2/Console_Programming_CONPRG/Course_Work/gba/my_gba_asm/build/main.d -g -Wall -O3 -save-temps -mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer -ffast-math -mthumb -mthumb-interwork -I/h/YEAR2/Console_Programming_CONPRG/Course_Work/gba/my_gba_asm/include -I/c/devkitPro/libgba/include -I/h/YEAR2/Console_Programming_CONPRG/Course_Work/gba/my_gba_asm/build -c /h/YEAR2/Console_Programming_CONPRG/Course_Work/gba/my_gba_asm/source/main.c -o main.o h:/YEAR2/Console_Programming_CONPRG/Course_Work/gba/my_gba_asm/source/main.c: In function 'main': h:/YEAR2/Console_Programming_CONPRG/Course_Work/gba/my_gba_asm/source/main.c:58:2: warning: implicit declaration of function 'ASSEMBLY_FUNC_HERE' [-Wimplicit-function-declaration] main.s: Assembler messages: main.s:20: Error: unassigned file number 1 main.s:20: Error: junk at end of line, first unrecognized character is `0' main.s:22: Error: unassigned file number 1 main.s:22: Error: junk at end of line, first unrecognized character is `0' make[1]: *** [main.o] Error 1 "make": *** [build] Error 2 > Process Exit Code: 2 > Time Taken: 00:01 |