Natasha
Natasha

Reputation: 205

reading from File in assembly

i am trying to read a username and a password from a file in x86 assembly for the perpose of authentication obviously the file consists of two lines , the user name and the password how can i read the two lines seperately and compare them?

My attempt:

proc read_file

  mov ah,3dh
  lea dx,file_name
  int 21h

  mov bx, ax 
  xor si,si

repeat:

  mov ah, 3fh
  lea dx, buffer
  mov cx, 100 
  int 21h

  mov si, ax
  mov buffer[si], '$'
  mov ah, 09h
  int 21h ;print on screen


  cmp si, 100
  je repeat 

  jmp stop;jump to end
stop:
   RET
    read_file ENDP

Upvotes: 1

Views: 3895

Answers (2)

Morano88
Morano88

Reputation: 2077

You should use system class to do that and it depends on whether you use Windows or Linux. Check this : http://www.freebsd.org/doc/en/books/developers-handbook/x86-system-calls.html

Upvotes: 1

Jens Björnhager
Jens Björnhager

Reputation: 5649

Go here and read up on functions like CreateFile and ReadFile.

Upvotes: 1

Related Questions