Advertisement
Guest User

Lab5_4

a guest
Mar 28th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. .486
  2. .model flat, stdcall
  3. INCLUDE stdlib.inc
  4. INCLUDELIB msvcrt.lib
  5.  
  6. .DATA
  7. string db "1230", 0
  8. leng dd ?
  9. res db ?, 0
  10.  
  11. .CODE
  12. main:
  13. mov al, string
  14. mov res, al
  15. mov esi, offset string
  16. mov edi, offset res
  17. mov leng, 0
  18.  
  19. calculateLength: ; считаем длину массива
  20. cmp byte ptr [esi], 0
  21. je prepare
  22. inc leng
  23. inc esi
  24. jmp calculateLength
  25.  
  26. prepare:
  27. mov edi, offset res ; начало массива
  28. mov ebx, leng
  29. add ebx, edi
  30. dec ebx
  31. mov edi, ebx ; конец массива
  32. mov esi, offset string
  33. jmp start
  34.  
  35. start:
  36. cmp byte ptr [esi], 0
  37. je ending
  38. mov bh, [esi]
  39. mov [edi], bh
  40. inc esi
  41. dec edi
  42. jmp start
  43.  
  44. ending:
  45.  
  46. call exit
  47. END main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement