understanding random number code in assembly 8086 -


i found here on forum code generate random number between 0 , 9 in assembly 8086. here code:

    randstart:    mov ah, 2ch             int 21h           mov  ax, dx    xor  dx, dx    mov  cx, 10        div  cx           mov si, dx    mov variable, si  

please, need guys explain me line:

 xor  dx, dx  

i don't understand why need use xor here. hope guys can , teach me :)

xor dx,dx equals mov dx,0. logic gate that:

1+1=0  0+0=0  1+0=1  0+1=1 

basically when xor number output 0. preferred on mov command because takes less memory. hope understand little better now.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -