Article ID: 120070
Article Last Modified on 2/11/2004
.DATA dataitem DW 0 .CODE mov ax, dataitem mov ax, [dataitem]The results are the same because the assembler determines the addressing mode based on the way that dataitem is declared. In both cases, dataitem is a label, so the assembler will access the data located at the label.
.CODE mov ax, OFFSET dataitemIn this case, OFFSET tells the assembler to treat dataitem as a constant value rather than as a data item that is located at a memory location.
datavalue EQU 0 .CODE mov ax, datavalue mov ax, [datavalue]Again, the result is the same, because the assembler determines the addressing mode based on the way datavalue is declared. In both cases, datavalue is an equate, so the assembler will treat datavalue as a constant value.
.CODE mov ax, ds:datavalueIn this case, the segment override tells the assembler to treat datavalue as a data item that is located at ds:datavalue, rather than treating datavalue as a constant value.
.CODE mov ax, bx mov ax, [bx]In the first case, we are moving what is in bx into ax. In the second case, we are using bx as an offset and moving what is at that offset into ax. The assembler determines what to do based on the brackets or lack of brackets around the register. This is the only case where the brackets have this effect.
Additional query words: 6.00 6.10 6.11
Keywords: KB120070