You are here : assembly8086CMPSB

CMPSB - 8086

Compare bytes: ES:[DI] from DS:[SI].

Algorithm :

  • DS:[SI]-ES:[DI]
  • Sets flag according to Result : OF,ZF,AF,CF,SF,PF
  • if DF = 1 : SI=SI+1 and DI=DI+1
  • else : SI=SI-1 and DI=DI-1


Syntax

cmpsb


Example

.model small
.data
  s1 db 'hello World'
  s2 db 'hello World'
  ...
  ...
.code
  ...
  ...
  lea si,s1
  lea di,s2
  repne cmpsb
  ...
  ...
  end


Output / Return Value


Limitations


Alternatives / See Also


Reference