data segment
aa db 22h, 22h, 22h
len = $-aa
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
mov ax, data
mov ds, ax
mov es, ax
mov si, offset aa
mov [si+len],al
mov al,[si+len]
mov ax, 4c00h ; exit to operating system.
int 21h
ends
It works like this:
MOV [SI]+03H, AL
MOV AL, 03H (This is wrong)
when len
in source address, the source address will be compiled as the value of len
(3)
but when I change the len
in data segment:
len = 3
It will work correctly:
MOV [SI]+03H, AL
MOV AL, [SI]+03H
why?