The exercise is to take a word from keyboard, search the DOS environment and if that word is there, display the line with this word from DOS environment.
Here is my code:
format binary
org 100h
start:
mov es,[ds:02ch]
xor si,si
;*****************************
;*****************************
mov ah,9
mov dx,string
int 21h
mov ah,10
mov dx,word
int 21h
mov ah,0
int 16h
;*****************************
;*****************************
xor di,di
xor bx,bx
start_while:
mov di,$-word
jge equal
mov dl,[es:si]
mov bl,dl
mov dl,[bx+di]
cmp dl,[string+di]
jne next_line
add di,1
jmp start_while
next_line:
inc si
cmp dl,0
jnz notexist
equal:
mov ah,2
int 21h
jmp end
notexist:
mov ah,9
mov dx,d_exist
int 21h
jmp end
end:
mov ah,08h
int 21h
ret
;**************************************
;**************************************
string db 'THE WORD:',10,13,"$"
word db 6
db 0
times 22 db "$"
d_exist db 'variable does not exist',10,13,"$'
The compiler says: mov dl,[dl+di] error. I am a begginer, how to fix the code? I have no idea.