Page 1 of 1
CBW, CWD, CDQ...
Posted: Tue Jul 09, 2002 2:38 pm
by Peter_Vigren
What is the usage of them??
Re:CBW, CWD, CDQ...
Posted: Wed Jul 10, 2002 3:27 pm
by df
conversions for signed + unsigned. they are very handy indeed!
Re:CBW, CWD, CDQ...
Posted: Wed Jul 10, 2002 4:53 pm
by Peter_Vigren
df wrote:
conversions for signed + unsigned. they are very handy indeed!
Yeah... so far I have understood... but an example perhaps?
Re:CBW, CWD,......
Posted: Fri Jul 12, 2002 3:44 am
by sriko
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