ze3leX

Untitled

May 13th, 2019
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. .section .text
  2. .global inter_to_oct_str_float
  3. inter_to_oct_str_float:
  4. pushl %ebp
  5. movl %esp, %ebp
  6. subl $4, %esp
  7. pushl %esi
  8. pushl %edi
  9.  
  10. movl $0, -4(%ebp)
  11.  
  12. movl 8(%ebp), %eax #broj
  13. movl 12(%ebp), %ecx #adresa niza
  14.  
  15. movl $8, %esi #jer mnozimo sa 8
  16. movl $100000000, %edi #jer delimo sa 10...0
  17.  
  18. cmpl $3, 16(%ebp)
  19. je greska
  20.  
  21. movb $'0', (%ecx)
  22. incl %ecx
  23. decl 16(%ebp)
  24. movb $'.', (%ecx)
  25. incl %ecx
  26. decl 16(%ebp)
  27.  
  28. pocetak:
  29. decl 16(%ebp)
  30. cmpl $0, 16(%ebp)
  31. je kraj_pod
  32.  
  33. xorl %edx, %edx
  34.  
  35. mull %esi
  36. #jc greska
  37. divl %edi
  38.  
  39. addb $'0', %al
  40. movb %al, (%ecx)
  41. incl %ecx
  42.  
  43. movl %edx, %eax
  44. andl %eax, %eax
  45. jz kraj_pod
  46.  
  47. jmp pocetak
  48.  
  49. greska:
  50. movl $1, -4(%ebp)
  51. kraj_pod:
  52. movl $0, (%ecx)
  53. movl -4(%ebp), %eax
  54. popl %edi
  55. popl %esi
  56. movl %ebp, %esp
  57. popl %ebp
  58. ret
Add Comment
Please, Sign In to add comment