CBW, CWD, CDQ...
Re:CBW, CWD, CDQ...
Yeah... so far I have understood... but an example perhaps?df wrote: conversions for signed + unsigned. they are very handy indeed!
Re:CBW, CWD,......
as far as CBW... is concerned they are useful to convert 8 bit to 16 bit values.
as i know , it applies only to the ax or accumulator register.it is also used during DIV instruction and MUL .
suppose we want to div 8bit/8bit then usually it gives an error, so
we first put the 8 bit dividend into the ax reg. then write CBW which puts zeroes into AH reg .Then we use DIV operand.
op1 db 40
op2 db 10
..
mov al,op1 ; ;we can't write mov ax,op1
cbw
div op2.
result = 4 in al, ah=0;
During multiplication of 8bit x 8 bit there is all possibility that the result will be 16 bit. so CBW is used before MUL.
similarly for 32 bit/16bit or 32bit x 16 bit, result is obttained in dx:ax pair.here CWD is used
kindly tell me if i am wrong
as i know , it applies only to the ax or accumulator register.it is also used during DIV instruction and MUL .
suppose we want to div 8bit/8bit then usually it gives an error, so
we first put the 8 bit dividend into the ax reg. then write CBW which puts zeroes into AH reg .Then we use DIV operand.
op1 db 40
op2 db 10
..
mov al,op1 ; ;we can't write mov ax,op1
cbw
div op2.
result = 4 in al, ah=0;
During multiplication of 8bit x 8 bit there is all possibility that the result will be 16 bit. so CBW is used before MUL.
similarly for 32 bit/16bit or 32bit x 16 bit, result is obttained in dx:ax pair.here CWD is used
kindly tell me if i am wrong