Tuesday 15 April 2014

assembly - fasm, searching a word in dos environment -


Take a word from the exercise keyboard, search for the DOS environment and if it is the word, then display the line with this . The word dos from the environment

Here is my code:

  format binary org 100h start: mov es, [ds: 02ch] xor c, c, **** *************** ********************************************************************************** ******************************************************************************************** Mov Mov , 9 mov dx, string integer 21h mov ah, 10 mov dx, word integer 21h mov ah, 0 integer 16h; ************** ************************************************************************************ **************************************************************************************************** Mov di, $ - word jge equal to mov dl, [es] si mov mov, dl mov dl, [bx + di] cmp dl, [string + di] jne di add next_line, 1 jmp start_while next_line: ink cmp dl , 0 jns nonst equal: mov ah, 2 int 2 1 hour jmp end notexist: mov ah, 9 mov dx, d_exist integer 21h jmp end end: mov ah, 08h integer 21h retired; ********** **************************************************************** **************************************************************************************************** ******************************** String Database 'word:', 10,13, "$ "The word db 6 db 0 times 22 db" $ "d_exist database 'variable does not exist', 10,13," $ ' 

The compiler says: MOV DL, [DL + D ] Error I am an eater, how do I fix the code? I do not know.

some

issue first Apart from mentioning the 86 Base Plus Index with the address, here are additional questions and problems, some of which are available to you Moving forward to the desired results:

  started: mov es, [ds: 02ch] xor si, si mov ah, 9; writes the word: mov dx, string int 21h mov ah, 10 ; User accepts the word "word" mov dx, in the word int 21h; reads the buffered input for "word"; reads the keyboard key; -> **** Why? Input only INT 21 / AH = The above was read with 10; mov ah, 0 int 16h; ah = scan code, ax = ascii four ereddy, die xer bx, bx startieth: mov di, $ - word; Current location detected; Void address of "word" - -> Why? ; The last operation to affect the flag were xor bx, bx, which resulted; In zeros, this jump will always take the jazz equals ... Even all the codes are left equal to 'equal' label: mov ah, 2; Type Dl in stdout; - & gt; *** But the content of DL is unknown 21h jmp end; Exit the program  

You should be able to understand why you do not see any output or why your terminal closes (possibly in dl ) The control letter. / Code> $ - word in mov di, $ - word not the word length at the word . $ symbol indicates the address of current location in which $ is displayed, so in the above, it actually So, if you want the length of the word, you will get the the word di After should set a new data object, it is a normal pattern to make an object after the definition of word :

  word db 6; It defines one byte, value = 6 db 0 times 22 db "$" word_len db $-word; The length of the word is current - the word of "word" R; I accept all 24 bytes for "word"  

No comments:

Post a Comment