AnsweredAssumed Answered

Codewarrior Inline assembly hc12

Question asked by Terence Pereira on Jun 22, 2010
Latest reply on Jun 23, 2010 by Stefan-Teodor Craciun

I have a small C function with input far pointers and ints, and returns a char value 1 or 0.

It is compiled and to create an assembly listing.

The c code in function is then commented out and a slightly modified inline assembly from lst file inserted in the function.

 

This executed code seems to work, however the compiler states warning that, return expected and parameters declared in function but not used.

What is required to ensure it will always work correctly and to clean up these warnings.

 

//------------------------------------------------------------------------
char cFarCmp(unsigned char *__far24 cpFarCurBlk,
       unsigned char *__far24 cpFarBlkStart,
       unsigned long lFsize)

#if 0
  if(cpFarCurBlk < (cpFarBlkStart+lFsize)) return 0;
  return 1; 

#else

  __asm {

     PSHD 
          PSHX 
//if(cpFarCurBlk < (cpFarBlkStart+lFsize)) return 0;
          PSHD 
         LDAB  3,SP
          PSHB 
          LDX   11,SP
         LDAA  10,SP
        JSR   tpPADD
         LDY   11,SP
          PSHA 
         LDAA  11,SP
          PULB 
        JSR   tpFPCMP
          BCC   *+4 ;abs = 001a
          CLRB
          BRA  FARCMP1
//return 1; 
     LDAB  #1
FARCMP1:
         LEAS  4,SP
     RTC  
     }

}
//------------------------------------------------------------------------

Outcomes