if,while和do..while语句的汇编形式代码

(1)if语句
 
/**** if 语句 pseudo-code ********/
 if ( condition )
  then_block;
 else
  else_block;
 
/****if 语句 assembly language ***/
 ; code to set FLAGS
 jxx   else_block ;如果条件为假跳转到else_block分支
 ; code for then block
 jmp   endif
 else_block:
 ; code for else block
 endif:
 
////////////////// 没有else分支的语句如下 ///////
 ; code to set FLAGS
 jxx   endif   ;如果条件为假跳转到if结束处
 ; code for then block
 endif:
/****if 语句 assembly language (end) ***/
 
 
(2)while语句
 
/**** while 语句 pseudo-code ********/
 while ( condition )
 {
  body of loop;
 }
 
/****while 语句 assembly language *******/
 while:
 ; code to set FLAGS based on condition
 jxx   endwhile
 ; body of loop
 jmp while
 endwhile:
/****while 语句 assembly language (end) ***/
 
 
(3)do{...}while语句
 
/**** Do while 语句 pseudo-code ********/
 do{
  body of loop;
 }while ( condition )
 
/****Do while 语句 assembly language *******/
 do_while:
 ; body of loop
 ; code to set FLAGS based on condition
 jxx   do_while
/****Do while 语句 assembly language (end) ***/

 

你可能感兴趣的:(if,while和do..while语句的汇编形式代码)