DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Assembly (http://www.daniweb.com/forums/forum125.html)
-   -   x86 with nasm reading from file (http://www.daniweb.com/forums/thread185872.html)

bobrien314 Apr 8th, 2009 9:11 pm
x86 with nasm reading from file
 
org 100h
section.text

openfile:
        mov dx,sendfile
        mov al,0h
        mov ah,03dh
        int 21h
        mov bx,ax
        mov [filehandle],bx

filelength:
        mov ah,042h
        mov cx,0h
        mov dx,0h
        mov al,002h
        mov bx,[filehandle]
        int 21h
       
        shr ax,7
        shl dx,9
        or ax,dx
        mov bx,ax
        mov [filediv128],bx
 
        mov dl, bh
        mov ah, 02h
        int 21h
        mov dl, bl
        mov ah, 02h
        int 21h
     
        mov bx,[filediv128]
        mov cx,bx

loopread:
        push cx
        mov cx, 080h
        mov bx,[readin]
        mov dx,bx
        mov bx,[filehandle]
        mov ah,03fh
        int 21h
       


       
      ; mov cx,80h
        mov bx,24h
        mov [readin +129],bx
       

prints:
        mov ah,09h
        mov bx,[readin]
        mov dx,bx
        int 21h

       


endit:
        mov ah, 00h
        int 21h

section .data
        sendfile: db "C:\shit\file.txt",0h


section .bss
        filehandle: resb 2
        filediv128: resb 2
        readin: resb 129

we are trying to read in 129 bytes to a buffer (readin) and print it to the screen but it is completely not working can anyone please help


All times are GMT -4. The time now is 1:31 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC