Pic14 ABI

Michel
2007-07-23
2013-03-12
  • Michel
    Michel
    2007-07-23

    Hi,

    I want to interface some assembly routines with sdcc C-code (pic14 target).
    However it is not clear to me what rules should be followed.

    More concretely: code generated by sdcc itself starts by copying the registers
    STK** to locally defined registers. Is this always necessary? In my assembly
    code I would like to manipulate the STK registers directly to save instructions.
    Are there pitfalls to this?

    Regards,
    Michel

     
    • AP2k
      AP2k
      2007-07-25

      Do like this:

      void main(){
        unsigned char a_byte = 1;
        //Increment a_byte using ASM
        _asm
          incf _a_byte,F
        _endasm;
      }

      When writing in ASM in a C file, you should reference a byte with an underscore before it as prescribed in the manual.

       
    • Michel
      Michel
      2007-07-26

      >When writing in ASM in a C file, you should reference a byte with an underscore before it as prescribed in >the manual.

      Your example is wrong. This works only for globals.

      The example also has nothing to do with my question which was about linking a seperate assembly file.
      More specifically I was asking if it is really necessary to copy the argument registers STK** to locally defined registers (which is what the assembler generated by sdcc seems to do by default).

      Michel