Search code examples
assemblybytenasmambiguitymov

What do you mean by "byte equivalent" ?


I am bit new to assembly language and having difficulty understanding the term "byte equivalent".

It is used in the following context :-
The MOV instruction causes ambiguity at times. For example, look at the statements:

MOV  EBX, [MY_TABLE]  ; Effective Address of MY_TABLE in EBX
MOV  [EBX], 110       ; MY_TABLE[0] = 110

It is not clear whether you want to move a byte equivalent or word equivalent of the number 110. In such cases, it is wise to use a type specifier.

The link to the tutorial is here

It would be a great help if anybody could explain the term byte equivalent and provide with a clear situation in which "type specifiers" may come in handy.


Solution

  • It just means that the size of 110 is ambiguous in the instruction MOV [EBX], 110. There's no way of telling just by looking at that instruction if you intended to store the 8-bit (byte equivalent) value 0x6E, the 16-bit (word equivalent) value 0x006E or the 32-bit (dword equivalent) value 0x0000006E.

    A size specifier would be used to tell the assembler how to interpret the instruction, and the exact syntax for such specifiers depends on which assembler you use. In NASM syntax you'd say mov byte [ebx],110 to specify that you wanted to store a byte. In MASM/TASM syntax you'd say mov byte ptr [ebx],110.