Advertisement
Tobiasz931

1st i 2nd zadanie

Feb 18th, 2013
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  .data
  2. skompr dd 0
  3. .code
  4. _kompresja_tekstu PROC
  5. push ebp
  6. mov ebp, esp
  7. mov edx, 1
  8. mov eax, [esp+16]
  9. mov ebx, OFFSET skompr
  10. mov [ebx], eax
  11. start:
  12. mov eax, esp
  13. add eax, 12
  14. add eax, ecx
  15. mov eax, [eax];      eax=ebp+12+ecx
  16. mov bl, byte PTR [eax]
  17. cmp bl, 0
  18. je koniec
  19. mov bh, byte PTR [eax+1]
  20. cmp bl,bh
  21. je rowne
  22. inc ecx
  23. mov eax, OFFSET skompr
  24. dec edx
  25. je raz
  26. inc edx
  27. mov [eax], bl
  28. add edx, 128
  29. mov [eax+1], edx
  30. mov ebx,[eax]
  31. add ebx, 2
  32. mov [eax], ebx
  33. mov edx, 1
  34. //inc eax
  35. jmp start
  36. raz:
  37. mov [eax], bl
  38. push ebx
  39. mov ebx,[eax]
  40. inc ebx
  41. mov [eax], ebx
  42. pop ebx
  43. jmp start
  44. rowne:
  45. inc edx;ilosc powtorzen
  46. cmp edx, 127
  47. je powtorz
  48. jmp start
  49. powtorz:
  50. mov [eax], bl
  51. add edx, 128
  52. mov [eax+1], edx
  53. mov ebx,[eax]
  54. add ebx, 2
  55. mov [eax], ebx
  56. mov edx, 1
  57. jmp start
  58. koniec:
  59. mov eax, ebx
  60. pop ebp
  61. RET
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69. push ebp
  70. mov ebp, esp
  71. jc jeden
  72. mov eax, OFFSET TMP
  73. mov eax, [eax]
  74. sal eax, 1
  75. jmp dalej
  76. jeden:
  77. mov eax, OFFSET TMP
  78. mov eax, [eax]
  79. sal eax, 1
  80. inc eax
  81. jmp dalej
  82. sal eax, 3
  83. sar eax, 3
  84. cmp eax, 00011011b
  85. je rowne
  86. jmp koniec
  87. rowne:
  88. mov eax, OFFSET CIAG
  89. mov ebx, [eax]
  90. inc ebx
  91. mov [eax], ebx
  92. koniec:
  93. pop ebp
  94. RET
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement