汇编-标志位操作指令

 

CF置0

.386  
.model flat,stdcall 
option casemap:none
.stack 4096

ExitProcess PROTO,dwExitCode:DWORD  
 
.data       
 
.code   
main PROC   
    
   mov al,10000110b       
   shl al,1          ;cf=1
   clc               ;CF置0    cf=0
   
    

    INVOKE ExitProcess,0  
main ENDP   
END main

 

CF置1

.386  
.model flat,stdcall 
option casemap:none
.stack 4096

ExitProcess PROTO,dwExitCode:DWORD  
 
.data       
 
.code   
main PROC   
    
   mov al,00000110b       
   shl al,1          ;cf=0
   stc               ;CF置1   cf=1
   
    

    INVOKE ExitProcess,0  
main ENDP   
END main

 

CF取反

.386  
.model flat,stdcall 
option casemap:none
.stack 4096

ExitProcess PROTO,dwExitCode:DWORD  
 
.data       
 
.code   
main PROC   
    
   mov al,00000110b       
   shl al,1          ;cf=0
   cmc               ;CF取反   cf=1
   
    

    INVOKE ExitProcess,0  
main ENDP   
END main

 

DF置0

CLD        

 

DF置1

STD

 

IF置0 

CLI

 

IF置1 

 STI

 

 

若要将零标志置位, 就将操作数与0进行TEST或AND运算;若要将零标志清零,则将操作数与1进行OR运算:

若要将符号标志置位,就将操作数的最高位与1进行OR运算;若要将符号标志清零,则将操作数的最高位与0进行AND运算:

若要将溢出标志置位,就将两个正数相加使之产生负的和数;若要将溢出标志清零,则将操作数与0进行OR运算:

 

test逻辑与

https://www.cnblogs.com/liming19680104/p/17878956.html    

 

 

 

 

 

posted @ 2023-12-08 14:09  天子骄龙  阅读(77)  评论(0)    收藏  举报