AnsweredAssumed Answered

HC908 backend intergrating asm+C

Question asked by MrBean on Apr 24, 2009
Latest reply on May 12, 2009 by MrBean

I need fast routines in this case so i built a 32bit timeout checking routine in assembly that is very fast.

It returns a bool in accumulator A and an accordingly set Z flag (condition code).

On use of this routine the compiler thinks it is necessary to test A again:

 


  936:   if(CheckTimeoutByRef(&Timeout)) { //If timeout:  0000 a600     [2]             LDA   @Timeout  0002 5f       [1]             CLRX    0003 cd0000   [5]             JSR   CheckTimeoutByRef  0006 4d       [1]             TSTA    0007 270b     [3]             BEQ   L14 ;abs = 0014  937:

 

How do i tell the compiler that Z is already correctly set ie. that the TSTA instruction is not necessary ? (I know it saves just one instruction.)

The CheckTimeoutByRef function is pure assembly.

Add something to the function definition ? A pragma ? Or .... ?

Outcomes