On Tue, 10 Sep 2002, Scott Dattalo wrote:
{Quote hidden}> On Wed, 11 Sep 2002, Martin Buehler wrote:
>
> > thanks, but i'm not shure if this will work for me, as i use a compiler to
> > generate the assembler code. so i think i have to patch the assembler
> > code, before the compiler forwards it to the assembler?!?
> > thanks tino
>
> void main(void)
> {
>
> #ifdef SIMULATION_ONLY
> _asm
> call $+1
> _endasm;
>
> #endif
>
> while(1)
> my_code_that_crashes();
>
> }
>
>
> I of course used SDCC's inline assembly syntax. I doubt you're using SDCC
> though. Hopefully your compiler is equipped with a preprocessor and inline
> assembler. If not you're SOL.
-- There's actually an easier way that doesn't involve inline assembly:
void main(void)
{
#ifdef SIMULATION_ONLY
bogus_routine();
#endif
while(1)
my_code_that_crashes();
}
void
bogus_routine(void)
{
while(1)
my_code_that_crashes();
}
Basically, you force an extra call. Now this won't work on SDCC since
it'll inline a simple call like this.
Scott
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.