汇编语言标记寄存器标记位_NV UP EI NG NZ AC PE CY

在8086CPU中,有一种标记寄存器,长度为16bit;

其中存储的信息被称为程序状态字(Program Status Word,PSW),以下将该寄存器简称为flag。

功能:1)用来存储相关指令的某些执行结果;

2)用来为CPU执行相关指令提供行为依据;

3)用来控制CPU的相关工作方式。

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAmgAAABUCAIAAAC5qlzhAAAgAElEQVR4nO2dZ1gU1/v3Z5eld2EBFwQUVCw0hZ8NFQt2RaPYEg1FYiFRjDVqFFCxEYMFEAVUsAIWiIpKk6JYQFiwRkBA6exSlr7APC/ux3NNFlgX2R3zN/N5wTVzyn2fWc7Md06ZczCcgoKCgoKCQmSwr10ACgoKCgqK/0tQwklBQUFBQdEDKOGkoKCgoKDoAZRwUlBQUFBQ9ABKOCkoKCgoKHoAJZwUFBQUFBQ9gBJOCgoKCgqKHkAJJ8W/hVevXknIckFBwbNnzyRkvDvYbPaTJ09I89vc3Pzkn9TX14vdy8ePH8PDwz08PMRuuTtSUlLu379/7969lJQU0pziOF5TU7N69WrS3MXHx2/evHnGjBmSuAuKi4sPHTo0a9asffv2lZWVid2+EL8hISHLli0jzSOO4zExMSNHjrS0tPT19eXz+RLyIgbhrK6uDgoKamxsFAi/cOHCH3/88ccff9y9e7f3XgRITEwMDQ3tMury5cuXLl3qjfH4+PgDBw4QQ2pqavbv3z9nzpxff/31/fv3vTHeJcXFxYcPH758+TIx8OXLly4uLlOnTt24cWNlZaXYndbW1oaHh48fP54Y2NTUlJqa6uLiEhsbK3aPbW1tfn5+JiYm4eHhxPD3799PmDDB2tra0tLy48eP4nXq5eU1aNCglStXGhoaPnnyRLzGu8PX13fhwoX79u2bN2/ed999JwkNE8DLywsjICcnV11dLV4X/v7+AwYMOH78eHFxsXgtd0deXp6UlBRckbOzMzlOAUdHRwzDOjo6SPC1d+/eSZMmbdq0acSIEdra2uLVTh6PJysra29vv3r1agaDMXz4cNK0MzIyksFgWFhYkOMOx/FX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PYnoqOjo6KiMjMzYZDl5s2bSUlJ0dHRiYmJZ86cuX79+sOHD+F6ocDgOiIiIiAg4N69e3V1dZAxISEBLKekpCQlJaGiPnv2DMzGxcXdvn07KSkpMTExOTk5Ozu7sLCwuLg4Pz8/LS0Nkn348CEnJ6eoqAgN+hQVFaFkRUVF4K6oqAjSEFOmpKQUFha+f/++tLQ0NzcXolDxIG9dXV12dnZBQUFJScmHDx9yc3MFrNXV1TU2NkLIx48fa2pqSktL8/LyIBAM1tXV8Xi84uLioqKiDx8+NDQ0tLS0NDY21tXVQcY6Ajwer6GhAWJRMviLaGxsLC4uRsYhJTEW5W1oaGhoaBCIqqur4/P59fX1KLC5ubnunzQ2NsKOMei4tbUVSg42wT7khVjY2AdlbGtr63I7HdipRmACCiSG9JClpaWlqakJkgkYaW9vh71uIBeyIKIufhZhm5d2dHSw2ey8vLyioqLGxsbCwsKmpqaXL19yudyysjKoc0VFRRkZGUVFRa9fv87JycnLy4NBbxj9LigoYLPZHz9+zMvLKyws5PF4RUVFCQkJ8L9JT08vLCxMT0+HGwyGMDMzM/Pz8+EYXOfn5797966wsLCoqCg3Nzc9Pf3Vq1dwk5SUlBQWFjY2NpaUlMDNUFJSUllZWVZWVldXV1JSAmUrLS198eIF5580NDTAvxA2D8rNza2pqeHz+RwOB/7ZHA6ntrYWbMLlQ+LW1taioqKSkhII5/P5dXV1EPvx48fa2lpUqtraWigbn88vKyurqqqCe4PH48G9x+PxKisrUbLGT6B/AfzvwQs6RSF8Pp84ZwSlQUZQMpQG6hPMEBGIIvoVF91tPNllVI8SU1BQUHwthAknBQUFBQUFhQCUcFJQUFBQUPQASjgpKCgoKCh6ACWcFBQUFBQUPYASTgoKCgoKih5ACScFBQUFBUUPoISTgoKCgoKiB1DCSUFBQUFB0QMo4aSgoKCgoOgB/w9HdQANa3AaCwAAAABJRU5ErkJggg==" alt="" />

flag寄存器各位示意图

注明:16位中未标明字符的各位在8086CPU中没有使用,无意义;

标明字符的各位具有特殊含义。

位     符号    英文全称                             中文名称              说明(数学或逻辑运算)

0      CF      Carry Flag                          进位标记位           无符号数运算结果是否进位/借位

2      PF      Parity Flag                          奇偶标志位           运算结果二进制表示各位为1的个数(奇偶表示)

4      AF      Auxiliary carry Flag              辅助进位标记位      AF=1时,向高位或高字节进位或借位

6      ZF      Zero Flag                           零标志位              运算结果是否为0

7      SF      Sign Flag                            符号标记位           有符号数运算结果的正负

8      TF      Trace Flag                           跟踪标记位           TF=1,产生单步中断,引发中断过程

9      IF       Interrupt-enable Flag           中断允许标记位      IF=1/0,CPU允许中断或关闭中断

10    DF      Direction Flag                      方向标记位           字符串处理指令中DF=0/1,控制每次操作si,di的增减

11    OF      Overflow Flag                      溢出标记位            有符号数运算结果是否溢出

注明:数学或逻辑运算指令才会影响flag,包括add,sub,mul,div,inc,dec,or,and等;

mov,push,pop等传送指令对flag没有影响;

TF跟踪标志(为调试机器或调试程序发现故障而设置):

TF=1,CPU在执行完一条指令后将引发单步中断,转去执行中断处理程序;

TF=0,CPU处在连续工作状态。

IF中断允许标记位(可屏蔽中断的中断过程中CPU检测IF确定是否屏蔽中断):

IF=1,CPU执行完当前指令后,响应中断,引发中断过程;

IF=0,CPU执行完当前指令后,不响应中断。

sti,则IF=1;

cti,则IF=0.

各寄存器的详细说明参考:http://www.cnblogs.com/ant-colonies/p/6008322.html

标记寄存器在Debug中的表示
AX=0000 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=**** ES=**** SS=**** CS=**** IP=0100 NV UP EI PL NZ NA PO NC                                  
位    标志     值为的标志                  值为的标志
0     CF      CY(CarrY)                     NC(Not Carry)
2     PF       PE(Parity Even)             PO(Parity Odd)
4     AF      AC(Auxiliary Carry)        NA(No Auxiliary carry)
6     ZF      ZR(ZeRo)                     NZ(Not Zero)
7     SF      NG(NeGative)                PL(Positive)
9     IF       DI(Disabled Interrupt)    EI(Inabled Interrupt)
10   DF      DN(DowN)                    UP(Up)
11   OF      OV(Overflow)                NV(Not Overflow)

标记位CF与OF:

adc是带进位的加法指令
指令格式:adc object1,object2      
功能:object1=object1+object2+CF
举例:adc ax,bx即 (ax)=(ax)+(bx)+CF

sbb是带借位的减法指令
指令格式:sbb object1,object2      
功能:object1=object1-object2-CF
举例:adc ax,bx即 (ax)=(ax)-(bx)-CF

注:adc和sbb可以用于解决add,sub运算时的进位无法存储的问题;

adc(add & CF),带进位的加法;

sbb(sub & below),带错位的减法;

标志位CF与OF的比较:

1111 1111      8bit表示范围               对应标志位      超出表示范围时
2^8-1(255)     无符号数[0,255]         CF                 向更高位发生进位或借位
2^7-1(127)     有符号数[-128~127]   OF                 发生溢出

cmp指令    
指令格式:cmp object1,object2
功能:计算操作对象object1-object2,但不保存结果,仅根据计算结果对标志寄存器进行设置
举例:
  cmp ax,ax                        ;(无符号数之间的比较)
  执行后ax值不变,zf=1,pf=1,cf=0,of=0 ;
  mov ax,8
  mov bx,3
  cmp ax,bx
  执行后:(ax)=8,zf=0,pf=1,cf=0,of=0。

指令 cmp ax,bx    (无符号数之间比较,参考的标记位zf,cf)
zf=1,则(ax)=(bx)
zf=0,则(ax)!=(bx)
cf=1,则(ax)<(bx)
cf=0,则(ax)>=(bx)
cf=0且zf=0,则(ax)>(bx)
cf=1或zf=1,则(ax)<=(bx)

指令 cmp ah,bh     (有符号数之间比较,参考的标记位sf,of,zf)  
sf=1,且of=0,则(ah)<(bh)
sf=1,且of=1,则(ah)>(bh)
sf=0,且of=1,则(ah)<(bh)
sf=0,且of=0,则(ah)>=(bh)

条件转移指令:
  "转移"的本质是——修改IP;"条件"指的是可以根据某种条件,决定是否修改IP
  所有条件转移指令的转移位移范围为[-128,127]
  1)jcxz,即当(cx)=0时,即修改IP(实现转移)
  2)被cmp指令影响标记寄存器标记位,与以下条件转移指令配合使用
  常用的根据无符号数的比较结果进行转移的条件转移指令:
  指令              含义                 检测相关的标志位
  je                 等于则转移          zf=1
  jne               不等于则转移       zf=0
  jb                 小于则转移         cf=1
  jnb               不小于则转移      cf=0
  ja                 大于则转移         cf=0且zf=0
  jna               不大于则转移       cf=1或zf=1
 
  注:j-jmp  
      e-equal   ne-not equal
      b-below  nb-not below
      a-above  na-not above

标记位DF与串传送指令:

df(direction flag),方向标志位,控制每次操作后si,di的增减
  df=0,si,di递增
  df=1,si,di递减
字符串传送指令:
格式:movsb                   ;mov string byte
功能:1)((es)*16+(di))=((ds)*16+(si))
             即:mov es:[di],byte ptr ds:[si]
      2)当df=0, (si)=(si)+1
                    (di)=(di)+1
             即:inc si
                  inc di
        当df=1, (si)=(si)-1
                   (di)=(di)-1
             即:dec si
                   dec di

格式:movsw                   ;mov string word
功能:1)((es)*16+(di))=((ds)*16+(si))
             即:mov es:[di],word ptr ds:[si]
      2)当df=0, (si)=(si)+2
                    (di)=(di)+2
             即:add si,2
                  add di,2
        当df=1, (si)=(si)-2
                   (di)=(di)-2
             即:sub si
                   sub di     
一般movsb/movsw与rep配合使用   ;rep-repeat
格式:rep movsb
    即:s:movsb
          loop s       ;所以rep的作用是根据cx的值,进行重复串传送
          
设置df的指令:
  cld                    ;将df置0,字符串传送——偏移地址递增的方向      clear df
  std                   ;将df置1,字符串传送——偏移地址递减的方向      set df

assume cs:code,ds:data

data segment
db 'Welcome to masm!' ;将此字符串复制到相同段地址,偏移地址为16的内存位置
db 16 dup (0)
data ends code segment
start: mov ax,data
mov ds,ax
mov es,ax
mov si,0
mov di,16
mov cx,8
cld
rep movsw mov ax,4c00h
int 21h
code ends
end start

 pushf和popf:

pushf的功能——将标记寄存器的值压栈;

popf的功能——出栈,将值送入标记寄存器中。

注:此文参考网络和《汇编语言》(王爽,第二版)

上一篇:软件调试——IA-32 保护模式下寄存器一览


下一篇:sublime--package control的配置与插件安装