Advertisement
Guest User

Untitled

a guest
Sep 16th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .model small
  2. .486
  3.  
  4. .stack 256
  5.  
  6. .data
  7. priglo db 'Input n$'
  8. priglt db 'Input k$'
  9. ans db 'Your number$'
  10. pyat dw 5
  11. ten dw 10
  12.  
  13. .code
  14.  
  15. stir proc
  16. push bp
  17. mov bp, sp
  18. add bp, 4
  19. xor dx, dx
  20. mov ax, [bp]
  21. mov bx, [bp+2]
  22.  
  23. cmp bx, 0
  24. je zero
  25.  
  26. cmp ax, bx
  27. je one
  28. jb zero
  29.  
  30.  
  31. dec ax
  32. push bx
  33. push ax
  34. call stir
  35. pop bx
  36. pop cx
  37. mul bx
  38. push ax
  39.  
  40. dec cx
  41. push cx
  42. push bx
  43. call stir
  44. pop bx
  45. pop bx
  46. pop bx
  47. sub ax, bx
  48. jmp con
  49.  
  50. one:mov ax, 1
  51. jmp con
  52. zero:xor ax, ax
  53. con:pop bp
  54. ret  
  55. stir endp
  56.  
  57.  
  58. vvod PROC
  59. sub bx, bx
  60. mov ah, 01h
  61. LP:int 21h
  62. sub al, 30h
  63. JL KON
  64. cmp al, 9
  65. JG KON
  66. xchg ax, bx
  67. mul ten
  68. xchg ax, bx
  69. add bl, al
  70. adc bh, 0
  71. jmp LP
  72. KON: ret
  73. vvod ENDP
  74.  
  75. vyvod proc
  76. sub cx, cx
  77.  
  78. bt ax, 7
  79. jnc pol
  80. push ax
  81. mov ah, 02h
  82. mov dl, '-'
  83. int 21h
  84. pop ax
  85. neg ax
  86.  
  87. pol:
  88. delt:sub dx, dx
  89. div ten
  90. inc cx
  91. add dl, 30h
  92. push dx
  93. cmp ax, 0
  94. jne delt
  95.  
  96.  
  97. vv:pop dx
  98. mov ah, 02h
  99. int 21h
  100. loop vv
  101.  
  102. ret
  103. vyvod endp
  104.  
  105. start:
  106. push @data
  107. pop ds
  108.  
  109. mov dx, offset priglo
  110. mov ah, 09h
  111. int 21h
  112. mov ah, 02h
  113. mov dl, 0dh
  114. int 21h
  115. mov dl, 0ah
  116. int 21h
  117.  
  118. call vvod
  119. mov cx, bx
  120.  
  121. mov dx, offset priglt
  122. mov ah, 09h
  123. int 21h
  124. mov ah, 02h
  125. mov dl, 0dh
  126. int 21h
  127. mov dl, 0ah
  128. int 21h
  129. call vvod
  130. push bx
  131. push cx
  132.  
  133. call stir
  134.  
  135. push ax
  136. mov dx, offset ans
  137. mov ah, 09h
  138. int 21h
  139. mov ah, 02h
  140. mov dl, 0dh
  141. int 21h
  142. mov dl, 0ah
  143. int 21h
  144.  
  145. pop ax
  146. call vyvod
  147. mov ah, 01h
  148. int 21h
  149. mov ax, 4c00h
  150. int 21h
  151. end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement