Advertisement
Guest User

Untitled

a guest
Feb 18th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. .data
  2. val: .byte 0
  3. current:.int 0
  4. first: .int 0
  5. previous:
  6. .int 0
  7. .text
  8. .global list_del
  9.  
  10. list_del:
  11. pushl %ebp
  12. movl %esp, %ebp
  13. pushl %edi
  14. pushl %ebx
  15. movl $0, %edi
  16. movl $0, %ecx
  17. movl 8(%ebp), %eax
  18. movl 12(%ebp), %ebx
  19. cmpl $0, %eax
  20. je null
  21. cmpl $-128, %ebx
  22. jl not_found
  23. cmpl $127, %ebx
  24. ja not_found
  25. movb 12(%ebp), %bl
  26. movb %bl, val
  27. movl %eax, current
  28. movl $0, first
  29. del:
  30. movl current, %eax
  31. cmpl $0, %eax
  32. jne continue
  33. cmpl $0, %ecx
  34. je not_found
  35. movl first, %eax
  36. jmp end
  37. continue:
  38. movb (%eax), %bl
  39. cmpb val, %bl
  40. jne not_equal
  41. incl %ecx
  42. movl 4(%eax), %ebx
  43. movl previous, %eax
  44. movl %ebx, (%eax)
  45. movl %ebx, current
  46. jmp del
  47. not_equal:
  48. cmpl $0, %edi
  49. je first_time
  50. jmp n_time
  51. first_time:
  52. incl %edi
  53. movl %eax, first
  54. n_time:
  55. addl $4, %eax
  56. movl %eax, previous
  57. movl (%eax), %ebx
  58. movl %ebx, current
  59. jmp del
  60. null:
  61. movl $0, %eax
  62. jmp end
  63. not_found:
  64. movl 8(%ebp), %eax
  65. jmp end
  66. end:
  67. popl %ebx
  68. popl %edi
  69. movl %ebp, %esp
  70. popl %esp
  71. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement