gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > mixing assembly with C

#44066 - ghost Leinad - Sun May 29, 2005 10:27 pm

how do i mix assembly code with C code???

this has nothing to do with the GBA but im looking for help, and you are the ones who can help me

i use borland c++ as my editor and compiler...

now..im making a tic tac toe game, this is in C, and is completed but i need to have some external buttos using a 8255 ppi, and this code MUST be in assembly...that's why im asking, becasuse i have no idea...

thanks...by the way i need to kwon this by thursday....thanks again

#44080 - strager - Mon May 30, 2005 1:34 am

Code:
_asm
{
    /* ASM */
}

__asm
{
    /* ASM */
}

asm("/* ASM */");


Try those. The first one should work, according to my BCC help files.

#44327 - Quirky - Tue May 31, 2005 9:16 pm

Another way is to put the assembly in a seperate .S file and make the function symbol global (i.e. not static in the C sense) and make sure you let the C++ code know that the linkage is C.