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

Can I embed hard-coded bytes into program?

I want to write a macro which pushes IE onto stack and pops it out soon. How can I do it?
How to embed the code
0xc0, 0xa8 PUSH IE
and
0xd0, 0xa8 POP IE
into c program?

Parents
  • Sigh...

    Use #pragma disable. For example:

    #pragma disable
    void interrupt_protected_function (void)
    {
    }
    

    #pragma disable saves then clears the EA bit on entry to the function and restores the EA bit on exit.

    If you use this you won't have to do wacky stuff like in-line assembly or weird macros.

    Jon

Reply
  • Sigh...

    Use #pragma disable. For example:

    #pragma disable
    void interrupt_protected_function (void)
    {
    }
    

    #pragma disable saves then clears the EA bit on entry to the function and restores the EA bit on exit.

    If you use this you won't have to do wacky stuff like in-line assembly or weird macros.

    Jon

Children
No data