View Single Post
~ Б0ЯИ Τ0 С0δЭ ~
8May2009,08:19  
SaswatPadhi's Avatar
(1) Do you mean 16 bit and 32 bit instructions or registers ??
16 bit registers are ax, bx, cx, dx and 32 bit registers are eax, ebx, ecx, edx.

(2) Operand size : Any time a memory reference is given as part of an instruction, the size of the memory operand is either implied or must be specified.
Consider this :
Code: asm
mov ax, ds:bx
Here, the operand-size WORD is implied since the AX register is one word in size.

Now, consider this :
Code: asm
inc ds:bx  ;incorrect !!!!!
 
This is incorrect since compiler will be confused whether the value pointed to by bx is byte or word in size.
Correction :
Code: asm
inc word ds:bx  ;increment word at [bx]
 
or
Code: asm
inc byte ds:bx  ;increment byte at [bx]
 
In the correction, word and byte are operand-size attributes.

(3) Partly answered in (2). Look at the first example above :
Code: asm
mov ax, ds:bx
Here compiler assumes that value of [bx] is word because ax has size 1 word. To override, you can write :
Code: asm
mov ax, byte ds:bx
This will move byte value pointed by bx to ax.

Hope I cleared your doubts.