Share Pastebin
Guest
Public paste!

tekhammer

By: a guest | Feb 13th, 2009 | Syntax: None | Size: 0.56 KB | Hits: 873 | Expires: Never
Copy text to clipboard
  1. section .bss
  2.         buf     resb    64
  3. section .data
  4. %define bufsize         64
  5. %define sys_getcwd      183
  6. %define sys_exit        1
  7. %define sys_write       4
  8.         lf      db      10
  9.  
  10. section .text
  11.         global _start
  12. _start:
  13.         mov     eax,sys_getcwd
  14.         lea     ebx,[buf]
  15.         mov     ecx,bufsize
  16.         int     80h
  17.  
  18.         mov     eax,sys_write
  19.         mov     ebx,1
  20.         lea     ecx,[buf]
  21.         mov     edx,bufsize
  22.         int     80h
  23.  
  24.         call    linefd
  25.  
  26.         mov     eax,sys_exit
  27.         mov     ebx,0
  28.         int     80h
  29.  
  30. linefd  push    eax                             ; save values of registers to stack
  31.         push    ebx
  32.         push    ecx
  33.         push    edx
  34.         mov     eax,sys_write
  35.         mov     ebx,1
  36.         mov     ecx,lf
  37.         mov     edx,1
  38.         int     80h
  39.  
  40.         pop     edx                             ; return values to normal
  41.         pop     ecx
  42.         pop     ebx
  43.         pop     eax
  44.         ret