Advertisement
PsHegger

Write text to file

Apr 6th, 2012
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. section .data
  2.     filename:   db 'hello.txt',0
  3.     text:       db 'Hello World!',10
  4.     textLen:    equ $-text
  5.  
  6. section .bss
  7.     fd:     resb    4
  8.  
  9. section .text
  10.     global _start
  11.  
  12. _start:
  13.     mov eax,8
  14.     mov ebx,filename
  15.     mov ecx,1
  16.     int 80h
  17.     mov [fd],eax
  18.  
  19.     mov eax,15
  20.     mov ebx,filename
  21.     mov ecx,420
  22.     int 80h
  23.  
  24.     mov ebx,[fd]
  25.     mov eax,4
  26.     mov ecx,text
  27.     mov edx,textLen
  28.     int 80h
  29.  
  30.     mov eax,1
  31.     mov ebx,0
  32.     int 80h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement