Advertisement
Neveles

Untitled

Dec 17th, 2019
991
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .model large
  2. code segment
  3. assume cs:code, ds:code, es:code, ss:code
  4. org 100h
  5. start:
  6.  
  7.  ;??????? ?? ??????
  8.  jmp beg
  9.  
  10.  print_symbol:
  11.  ;??????????? ??????
  12.   push ax
  13.   push dx
  14.   mov ah, 02h
  15.   mov dl, dh
  16.   cmp dl, 0
  17.   je t2
  18.   int 21h
  19.   t2:
  20.   pop dx
  21.   int 21h
  22.   pop ax
  23.   ret
  24.  
  25.  print_number:
  26.   ;??????????? ?????, base = 10
  27.   push ax
  28.   push bx
  29.   push cx
  30.   push dx
  31.   mov ax, dx
  32.   mov bx, 10
  33.   mov cx, 0
  34.   getdigits:
  35.    mov dx, 0
  36.    div bx
  37.    inc cx
  38.    add dx, 30h
  39.    push dx
  40.    cmp ax, 0
  41.    jnz getdigits
  42.   mov ah, 02h
  43.   printdigits:
  44.    pop dx
  45.    int 21h
  46.    loop printdigits
  47.   pop dx
  48.   pop cx
  49.   pop bx
  50.   pop ax
  51.   ret
  52.  
  53.  debug:
  54.   ;????????? ????????, ????????? ??????????
  55.   cli
  56.   push bp
  57.   mov bp, sp
  58.   push ax
  59.   push bx
  60.   push cx
  61.   push dx
  62.   push si
  63.   ;??????? ip ? ax
  64.   mov dx, '['
  65.   call print_symbol
  66.   mov dx, [bp+2]
  67.   call print_number
  68.   mov dx, ','
  69.   call print_symbol
  70.   mov dx, [bp-2]
  71.   call print_number
  72.   mov dx, ']'
  73.   call print_symbol
  74.   mov dx, etr
  75.   call print_symbol
  76.   ;??????? ??????? ???????
  77.   xor ax, ax
  78.   int 16h
  79.   ;???????????? ????????, ????????? ??????????
  80.   pop si
  81.   pop dx
  82.   pop cx
  83.   pop bx
  84.   pop ax
  85.   pop bp
  86.   sti
  87.   iret
  88.  
  89.  ;???????????? ?????????
  90.  thread:
  91.   mov ax, 1
  92.   mov cx, 10
  93.   t1:
  94.    add ax, ax
  95.    loop t1
  96.   ret
  97.  
  98.  beg:
  99.   ;????????? ?????? ??????????
  100.   mov ax, 3501h
  101.   int 21h
  102.   mov int1, bx
  103.   mov int1+2, es
  104.   ;?????????? ????? ??????????
  105.   push cs
  106.   pop ds
  107.   mov dx, offset debug
  108.   mov ax, 2501h
  109.   int 21h
  110.   ;????????? ???????? ??? ????????
  111.   pushf
  112.   push offset exit
  113.   ;????????? TF ????
  114.   pushf
  115.   pop ax
  116.   or ax, 100h
  117.   push ax
  118.   push cs
  119.   push offset thread
  120.   iret
  121.  
  122.  exit:
  123.   popf
  124.   ;?????????? ?????? ??????????
  125.   lea dx, int1
  126.   mov ax, 2501h
  127.   int 21h
  128.   ;????? ????? ??????? ???????
  129.   mov ah, 01h
  130.   int 21h
  131.   int 20h
  132.  
  133. int1 dw 0h, 0h
  134. etr dw 0Ah, 0Dh
  135.  
  136. code ends
  137. end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement