This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

intrinsic functions

The GNU compiler can define intrinsic functions. Is there a mechanism in Keil library or whatever, to allow you to create a function in assembly and tag it as intrinsic?

How can you pop a couple bytes off the internal stack?

Parents Reply Children
  • I wanted to avoid the stack usage of a function call. But I finally crafted this solution:
    Problem. A lowlevel interrupt has locked another low level interrupt out (Timer 2 is higher in the vector table than timer 3 so takes precedence.) in Timer 2
    I tested the timer 3 interrupt pending bit and then call this routine, which cleans up the stack and vectors to timer 3. problem solved. no more low level priority lockout.
    NAME vjump
    ?PR?GOTO_TMR3?vjump SEGMENT code
    PUBLIC GOTO_TMR3

    rseg ?PR?GOTO_TMR3?vjumP
    ; ; designed to be called from within interrupt 2 to transfer to int 3
    ; ; when this is called ACC can be trashed
    ; GOTO_TMR3: pop ACC ; clear the return address off the stack pop ACC POP PSW ; clear off int data POP DPL POP DPH POP B POP ACC
    ; ; leave reurn address on the stack. Then jump to interrupt handler with interrupt status set, so that
    ; timer 3 interrupt will work as if it was interrupted
    ; LJMP 0x0073 ;go to timer 3 interrupt handler

    END

  • "Problem. A lowlevel interrupt has locked another low level interrupt out"

    You mean this: http://www.keil.com/forum/docs/thread14896.asp ?

  • Problem. A lowlevel interrupt has locked another low level interrupt out (Timer 2 is higher in the vector table than timer 3 so takes precedence.)

    only true if they happen at EXACTLY the same time Please read the manual. That is the only time the place in the 'priority order'/'vector table' means anything.

    Erik