How to modify only the value of the EFLAGS register a flag?

 

Disclaimer: This article is a blogger original article, 2019-08-23,22: 21:42 reprint please attach the original source link and this statement.
By ----- drowning heart of the ups and downs ---- blog Park

 

1, write the assembly instructions only affect the value of CF bit (does not affect other flag

  MOV AX,0xFF00

  ADD AX,0x0101

 

 2, write assembler instruction only affects the value of the PF position (not affect other flags)

   MOV AX,0x3

  ADD AX,0xC

 

 

 3, write assembler instruction only affects the value of the AF bit (does not affect other flags)

   MOV AX,0xF0

  ADD AX,0x10

 

 

Disclaimer: This article is a blogger original article, 2019-08-23,22: 21:42 reprint please attach the original source link and this statement.
By ----- drowning heart of the ups and downs ---- blog Park 

 

 4, assembler instruction is written only affect the value of SF-bit (not affect other flag bits)

   MOV AX,0x8000

   ADD AX,0x1

 

 6, write assembler instruction only affects the value OF-bit (can not affect other flags)

   O bits, think, if two positive numbers together (i.e., a number between 0x00 ~ 0x7f), so that it becomes a negative number, the value of these two numbers together 0x7F bound to cross this line, Sign Flag changes will inevitably lead, AF bit byte into bits also occurs, so that the AF bits will change, it is clear, so that between two positive (i.e., 0x00 ~ 0x7f) number of added not, from another angle , then the situation by adding two negative numbers it (0x80 ~ 0xFF) it is not it will make C-bit overflows it, is it, then how to solve this problem, we can use the computer bigger negative number, subtract a positive number .

  MOV AL, 0x80

  SUB AL,0x10

 

 

 

 Disclaimer: This article is a blogger original article, 2019-08-23,22: 21:42 reprint please attach the original source link and this statement.
By ----- drowning heart of the ups and downs ---- blog Park

Guess you like

Origin www.cnblogs.com/Reverse-xiaoyu/p/11402968.html