Daniel,

You can disable interrupts with out using any assembly.

Just use this code

// This turns off all interrupts
Word statusRegister = SysDisableInterrupts();
/* Use this next line to turn on the interrupts you want (in this case I
turn on everything but level 1).  Use 0x0100 thru 0x0700 to control the
levels */
SysRestoreInterrupts( (statusRegister&0xF8FF) | 0x0100 );

// Finally you can restore all the interrupts with
SysRestoreInterrupts( statusRegister );

I hope this helps.

Oliver



At 03:14 PM 8/30/99 -0500, you wrote:
>   I'm attempting to disable irq's for a split second to play
>a quick sound with the PWM but my attempts to write a 3-line
>function in assembler with GCC have failed so far.
>
>   I've pored through GCC docs and read the "Assembler
>Instructions with C Expression Operands" section, but while
>I have a version that will compile, it only Fatal Reset's an
>actual device.
>
>   My code so far looks like:
>     static Word TurnOffInts(void)
>     {
>        asm ("move.w %%sr, %%d0" : :);
>        asm ("ori.w #$0700, %%sr" : :);
>        asm ("rts");
>     }
>
>   I found some help at
>     http://www.delorie.com/doc/brennan/brennan_att_inline_djgpp.html
>but it deals more with GAS under DJGPP and not GCC.  Any help
>with what I'm doing wrong (syntax?) would be grealy appreciated.
>
>Thanks,
>Daniel.
>
>   ***  I realize I'm setting myself up for a full flaming from
>David Fedor for trying to disable interrupts, and another one
>from John Marshall for not wading though more docs and visiting
>his super-portal twice daily, but at this point I'm willing to
>risk it.  ;)
> 

Reply via email to