8086 - Is this correct assembly? -


i trying write code compares 2 strings. let's assume string1 referred si , string2 referred di , each string length 50.

is correct?

mov si,2000h mov di,3000h mov cx,50h cld repne cmpsw 

some problems:

  • 50h 80 decimal
  • you're - using cmpsw instruction - comparing words (16 bit), ie 160 bytes
  • i think want use repe prefix, repeats instruction long compared elements equal. or until number of comparisons in cx performed of course.

re put in cx: well, if you're string have length that's multiple of 2 cmpsw faster. have adjust contents of cx


Comments