cwd ; convert word to doubleword
cdq ; convert doubleword to quadword
; Doubles the size of the operand in register AX or EAX (depending on the
operand size) by means of sign extension and stores
; the result in registers DX:AX or EDX:EAX, respectively.
movzx ; move with zero-extend
; Doubles the size of the operand in register AX or EAX (depending on
the operand size) by means of sign extension and stores
; the result in registers DX:AX or EDX:EAX, respectively.
movsx ; move with sign-extension
; Copies the contents of the source operand (register or memory
location) to the destination operand (register) and sign
; extends the value to 16 or 32 bits. The size of the converted value
depends on the operand-size attribute.
When you do a cmp a,b
, the flags are set as if you had calculated a - b
.
Then the jmp
-type instructions check those flags to see if the jump should be made.
cmp al,dl ; set flags based on the comparison
jg label1 ; then jump based on the flags
would jump to label1
if and only if al
was greater than dl
.
instruction (destination<-source)
nibble: 4bits
byte: 8bits
word: 16bits
doubleword: 32bits
quadword: 64bits