Using the ASSUME directive in instruction set 8086

My tutorial states that the ASSUME directive tells assembler the names of logical segments to use as physical segments. And that it uses movements from the beginning of the specified logical segment to encode instructions.  Click here to view a screenshot. But here, when I run this build program in emu8086, it automatically determines the offsets / offsets (even after commenting out the ASSUME statement). How does it do this? So, is ASSUME statement redundant?

+4
source share
1 answer

So, is ASSUME instruction redundant?

. ASSUME , ( : ). CS DS , , , . , CS , . , DS.

, , DS mov ax, 2000h ; mov ds, ax , () 2000h, . , - !

data_here segment
  multiplier     db 02h
  multiplicand   db 08h
  product        dw dup(0)       ; ??? btw, missing a count between dw and dup(0) ?
data_here ends

data_there segment
  ihavesomevalue dw 1234h
  multiplier     db 02h
  multiplicand   db 08h
  product        dw dup(0)       
data_there ends

assume ds:data_here assume ds:data_there :

lea ax, data_here
mov ds, ax
assume  ds:data_here
mov cx, word ptr [multiplier]

CX, 0802h ( + LSB). DS data_there data_here:

lea ax, data_there       ; MODIFIED !!!
mov ds, ax
assume  ds:data_here
mov cx, word ptr [multiplier]

, CX 1234h - ihavesomevalue.

?

, DS data_here .

, DS data_here, , / .

DS data_there. mis , DS data_here. , multiplier 2 0 , , . .

ASSUME .

BTW, ASSUME , , , :

BLOCK struct
  item1 dd 0
  item2 dd 0
  item3 dd 0
BLOCK ends

assume esi:PTR BLOCK 
mov eax, [esi].item2
add ecx, [esi].item3

.. ESI / BLOCK, .

P.S.: !

+9

Source: https://habr.com/ru/post/1627639/


All Articles