Miscellaneous > 16 bit DOS Programming

DI and SI

(1/1)

buli:
I am confused that DI and SI can point to the same address
below it's my code

--- Code: ---.MODEL SMALL
.STACK
.DATA
   NUM1 DB 10,11,12,14
.CODE
MAIN:
    MOV AX,@DATA
    MOV DS,AX
    MOV DI,OFFSET NUM1
    MOV SI,OFFSET NUM1
    MOV DL,[DI]
    ADD DL,30H
    MOV AH,02H
    INT 21H
    MOV DL,[SI]
    ADD DL,30H
    MOV AH,02H
    INT 21H
    MOV AH,4CH
    INT 21H
END MAIN

--- End code ---
I used the debug tool and saw that DI and SI are shifted into same address,when i print the content they are same!! But i know that DI belongs to ES and SI belongs to DS. But OFFSET just calculate the variable's offset. Why they can print the same content? 

nidud:
DI only "belongs to ES" on a selective set of string instructions, like SCAS, MOVS, CMPS. Else DI (and SI) will default to @Data.

buli:
Thanks a lot~~
By the way
I begin to suspect that my book is .........

Navigation

[0] Message Index

Go to full version