eager to know weirdness of asm cli...

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 01/06/2005 at 09:13, xxxxxxxx wrote:

Hi, i have 1 question about inline assembly.  as shown in the program listing below, if i remove "asm cli", "i=8, flag=5" statement will not be executed.....why the program doesn't work???  why inline assembly asm makes the difference?   I'm hoping that i can get the answer here. please and thanks.
#include <mc9s12dp256.h>        /* derivative information */
#include "pll.h"                /* defines _BUSCLOCK, sets bus frequency to _BUSCLOCK MHz */

void main(void) {
unsigned int  i, flag;
  /* set system clock frequency to _BUSCLOCK MHz (24 or 4) */
  PLL_Init();
  /* set port B as output (LEDs) */
  DDRB  = 0xff;       // Port B is output
  /* allow all interrupts */
  asm cli   //weirdness happen here
  
  i = 8;
  if (i==8) {
 
    flag=5;
 
  }
 
  /* forever */
  for(;;){}     // remove this to make things even worse...
}