x86 with nasm reading from file

Reply

Join Date: Jan 2008
Posts: 15
Reputation: bobrien314 is an unknown quantity at this point 
Solved Threads: 0
bobrien314 bobrien314 is offline Offline
Newbie Poster

x86 with nasm reading from file

 
0
  #1
Apr 8th, 2009
  1. org 100h
  2. section.text
  3.  
  4. openfile:
  5. mov dx,sendfile
  6. mov al,0h
  7. mov ah,03dh
  8. int 21h
  9. mov bx,ax
  10. mov [filehandle],bx
  11.  
  12. filelength:
  13. mov ah,042h
  14. mov cx,0h
  15. mov dx,0h
  16. mov al,002h
  17. mov bx,[filehandle]
  18. int 21h
  19.  
  20. shr ax,7
  21. shl dx,9
  22. or ax,dx
  23. mov bx,ax
  24. mov [filediv128],bx
  25.  
  26. mov dl, bh
  27. mov ah, 02h
  28. int 21h
  29. mov dl, bl
  30. mov ah, 02h
  31. int 21h
  32.  
  33. mov bx,[filediv128]
  34. mov cx,bx
  35.  
  36. loopread:
  37. push cx
  38. mov cx, 080h
  39. mov bx,[readin]
  40. mov dx,bx
  41. mov bx,[filehandle]
  42. mov ah,03fh
  43. int 21h
  44.  
  45.  
  46.  
  47.  
  48. ; mov cx,80h
  49. mov bx,24h
  50. mov [readin +129],bx
  51.  
  52.  
  53. prints:
  54. mov ah,09h
  55. mov bx,[readin]
  56. mov dx,bx
  57. int 21h
  58.  
  59.  
  60.  
  61.  
  62. endit:
  63. mov ah, 00h
  64. int 21h
  65.  
  66. section .data
  67. sendfile: db "C:\shit\file.txt",0h
  68.  
  69.  
  70. section .bss
  71. filehandle: resb 2
  72. filediv128: resb 2
  73. 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
Last edited by bobrien314; Apr 8th, 2009 at 9:18 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Assembly Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC