SHARE
TWEET

Untitled

a guest Dec 14th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .386
  2. .model large
  3. .stack 100h
  4. .data
  5.  
  6. message db 'AX: $'
  7.  
  8.  
  9. .code
  10.  
  11. assume cs:code, ds:code, es:code, ss:code
  12.  
  13. start:
  14.  
  15. ;??????? ?? ??????
  16.  
  17. jmp beg ;??????????? ???????
  18.  
  19. print_symbol:
  20.  
  21. ;??????????? ??????
  22.  
  23. push ax
  24.  
  25. push dx
  26.  
  27. mov ah, 02h ;????? ?? ???????
  28.  
  29. mov dl, dh ;dl - ?????? ?????????
  30.  
  31. cmp dl, 0 ;c????????? ? ?????
  32.  
  33. je t2 ;???????? ???????, ???? ZF=1; ??????? ???? ???? ??? ?????
  34.  
  35. int 21h
  36.  
  37. t2:
  38.  
  39. pop dx
  40.  
  41. int 21h
  42.  
  43. pop ax
  44.  
  45. ret ; ?????? ????????? ?????? ?? ?????, ????? ??????? ????
  46.  
  47. print_number:
  48.  
  49. ;??????????? ?????, base = 10
  50.  
  51. push ax
  52.  
  53. push bx
  54.  
  55. push cx
  56.  
  57. push dx
  58.  
  59. mov ax, dx
  60.  
  61. mov bx, 10
  62.  
  63. mov cx, 0
  64.  
  65. getdigits:
  66.  
  67. mov dx, 0
  68.  
  69. div bx
  70.  
  71. inc cx
  72.  
  73. add dx,
  74.  
  75. push dx
  76.  
  77. cmp ax, 0
  78.  
  79. jnz getdigits
  80.  
  81. mov ah, 02h
  82.  
  83. printdigits:
  84.  
  85. pop dx
  86.  
  87. int 21h
  88.  
  89. loop printdigits
  90.  
  91. pop dx
  92.  
  93. pop cx
  94.  
  95. pop bx
  96.  
  97. pop ax
  98.  
  99. ret
  100.  
  101. debug:
  102.  
  103. ;????????? ????????, ????????? ??????????
  104.  
  105. cli ;Clear Interrupt-Enable Flag IF
  106.  
  107. push bp
  108.  
  109. mov bp, sp
  110.  
  111. push ax
  112.  
  113. push bx
  114.  
  115. push cx
  116.  
  117. push dx
  118.  
  119. push si
  120.  
  121. ;????? ax
  122.  
  123. mov ah,09h
  124.  
  125. lea dx,message
  126.  
  127. int 21h
  128.  
  129. mov dx, [bp-2]
  130.  
  131. call print_number
  132.  
  133. mov dx, etr
  134.  
  135. call print_symbol
  136.  
  137. ;??????? ??????? ???????
  138.  
  139. xor ax, ax
  140.  
  141. int 16h
  142.  
  143. ;???????? ??????
  144.  
  145. mov ah, 02h
  146.  
  147. mov dl, 07h ; ASCII ??? ??????? BELL
  148.  
  149. int 21h ; ??????? ?????
  150.  
  151. pop si
  152.  
  153. pop dx
  154.  
  155. pop cx
  156.  
  157. pop bx
  158.  
  159. pop ax
  160.  
  161. pop bp
  162.  
  163. sti
  164.  
  165. iret
  166.  
  167. ;???????????? ?????????
  168.  
  169. thread:
  170.  
  171. mov ax, 1
  172.  
  173. mov cx, 10
  174.  
  175. t1:
  176.  
  177. add ax, ax
  178.  
  179. loop t1
  180.  
  181. ret
  182.  
  183. beg:
  184.  
  185. ;????????? ?????? ??????????
  186.  
  187. mov ax, 3501h ; 01h - ???? ? ??????????
  188.  
  189. int 21h
  190.  
  191. mov old, bx
  192.  
  193. mov old+2, es
  194.  
  195. ;?????????? ????? ??????????
  196.  
  197. push cs ;??????? ????(???????? ??????) ??????????? ? ?????? ?????? ?????????
  198.  
  199. pop ds
  200.  
  201. mov dx, offset debug ;????? ????? ????? ??????
  202.  
  203. mov ax, 2501h
  204.  
  205. int 21h ;??????????? ?????????? DOS ????????? ?? ???????? ah
  206.  
  207. ;????????? ???????? ??? ????????
  208.  
  209. pushf
  210.  
  211. push offset exit
  212.  
  213. ;????????? TF ????, ?? ????????? ????????? ???????, ????? ????? ??????
  214.  
  215. ; ?????????? ?????????? ?????????? ????????? ? ????? ???????????? ???????????
  216.  
  217. pushf
  218.  
  219. pop ax
  220.  
  221. or ax, 0100h ;TF ???? ???????????????
  222.  
  223. push ax
  224.  
  225. push cs ;???????? ???????? ????
  226.  
  227. push offset thread ;???????????? ????? ?? ??? ???????
  228.  
  229. iret ;????????? ?? ????? ????? ???????? ip(thread) ????? cs ?????
  230.  
  231. ;???? ??????????? ???????? ????????? ?????? ??????? ?? ? ax ????????
  232.  
  233. exit:
  234.  
  235. popf ; ??????????????? ???????? ???????? ??????
  236.  
  237. ;?????????? ?????? ??????????
  238.  
  239. lea dx, old
  240.  
  241. mov ax, 2501h
  242.  
  243. int 21h
  244.  
  245. ;????? ????? ??????? ???????
  246.  
  247. mov ax, 4c00h
  248.  
  249. int 21h
  250.  
  251. int 20h
  252.  
  253. old dw 0h, 0h ;dw - 2 ????? ??? ??????????
  254.  
  255. etr dw 0Ah, 0Dh ;???? ?????????? ? ??????? ??????????
  256.  
  257.  
  258. end start
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top