Advertisement
altervisi0n

Untitled

Jun 11th, 2023
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. Поменять массив на А[0] = N, a[1] = n-1 и т,д.
  2.  
  3. push arr
  4. push [arr]
  5. push [num]
  6. call Solver
  7.  
  8. Solver:
  9. push bp
  10. mov bp,sp
  11. push si
  12. mov si,[bp+8]
  13. mov cx,[bp+6]
  14. mov dx,[bp+4]
  15. xor bx,bx
  16.  
  17. .SolveTask:
  18. add si, 2
  19. mov [si],dx
  20. sub [si],bx
  21. inc bx
  22. loop .SolveTask
  23.  
  24. pop si bp
  25. ret 6
  26.  
  27. num dw -10
  28. arr dw 10, 1, 2, 3, 4, 5, 6, 7, 8, 5, 5
  29.  
  30.  
  31. Подсчитать количество элементов,меньших чем число
  32.  
  33. push arr
  34. push word[num]
  35. call Solver
  36.  
  37. Solver:
  38. push bp
  39. mov bp,sp
  40. push si
  41. mov si,[bp+6]
  42. mov cx,[si]
  43. xor ax,ax
  44.  
  45. .Solver:
  46. add si,2
  47. mov ax,[si]
  48. cmp ax,[bp+4]
  49. jge .Met2
  50. inc dx
  51.  
  52. .Met2:
  53. loop .Solver
  54.  
  55. pop si bp
  56. ret 4
  57.  
  58. arr: db 5, -11,2,-3,4,-15
  59. num: dw -6
  60.  
  61. Сумма четных
  62.  
  63. push arr
  64. call Solver
  65.  
  66. Solver:
  67. push bp
  68. mov bp,sp
  69. push si
  70. mov si,[bp+4]
  71. mov cx,[si]
  72. xor ax,ax
  73. .SolveTask:
  74. add si,2
  75. test byte[si],00000001b
  76. jne .Skip
  77. add al,byte[si]
  78. .Skip:
  79. loop .SolveTask
  80.  
  81. pop si bp
  82. ret 2
  83.  
  84. arr db 4, 1, 2, 4, 2
  85.  
  86.  
  87. Дана С-строка найти длину
  88.  
  89. push str1
  90. call Solver
  91.  
  92. Solver:
  93. push bp
  94. mov bp,sp
  95. push si
  96. mov si,[bp+4]
  97. xor ax,ax
  98.  
  99. .SolveTask:
  100. cmp byte[si],0
  101. je .End
  102. inc ax
  103. inc si
  104. jmp .SolveTask
  105. .End:
  106. pop si bp
  107. ret 2
  108.  
  109. str1 db 'fdhhufd',0
  110.  
  111.  
  112.  
  113.  
  114.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement