943,898 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 1030
  • Assembly RSS
Apr 8th, 2009
0

x86 with nasm reading from file

Expand Post »
Assembly Syntax (Toggle Plain Text)
  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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bobrien314 is offline Offline
15 posts
since Jan 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: Learning assembly
Next Thread in Assembly Forum Timeline: About interrupt 10h? Set video mode?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC