Quote:
|
Originally Posted by red_alert_13
I was wondering if the same thing would be possible with the compiler supplied by FIRST?
|
This is called 'inline assembly' and is a nonstandard feature of most compilers, and they all seem to implement it in a slightly different way. Luckily, though, you don't have to look any further than the default code to find an example.
From ifi_startup.c:
Code:
void _startup (void)
{
_asm
/* Initialize the stack pointer */
lfsr 1, _stack lfsr 2, _stack clrf TBLPTRU, 0 /* 1st silicon doesn't do this on POR */
bcf FPFLAGS,RND,0 /* Initialize rounding flag for floating point libs */
/* initialize the flash memory access configuration. this is harmless */
/* for non-flash devices, so we do it on all parts. */
bsf 0xa6, 7, 0
bcf 0xa6, 6, 0
_endasm
loop:
Clear_Memory();
_do_cinit ();
/* Call the user's main routine */
main ();
goto loop;
} /* end _startup() */
There's several other examples in that file as well.