Hızlı yanıt: kod örneği
As some of the other answers say, the keyword refers to the offset from the segment in which it is defined. Note, however, that segments may overlap and the offset in one segment may be different in another segment. For instance, suppose you have the following segment in real modeThe assembler sees that is at offset from the base of , so wherever it sees it will put the value , regardless of the value of at the time. For example, if we change to something other than the base of the segment the assembler is assuming:In the second example is , so the base of the segment pointed to by is . This means that points to the address which is the same as , which points to .
offset
data SEGMENT USE16 ;# at segment 0200h, linear address 2000h org 0100h foo db 0 org 01100h bar db 0data ENDS
foo
0100h
data SEGMENT
offset foo
0100h
DS
DS
data
mov ax, 200h ; in some assemblers you can use @data for the seg basemov ds, axmov bx, offset foo ; bx = 0100hmov byte ptr [bx], 10 ; foo = 10mov ax, 300hmov ds, axmov bx, offset foo ; bx = 0100hmov byte ptr [bx], 10 ; bar = 10, not foo, because DS doesn't match what we told the assembler
DS
0300h
DS
03000h
ds:[offset foo]
03000h + 0100h
02000h + 01100h
bar