Advertisement
Neveles

Untitled

Dec 17th, 2019
1,116
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.  jmp beg
  8.  
  9.  print_symbol:
  10.   push ax
  11.   push dx
  12.   mov ah, 02h
  13.   mov dl, dh
  14.   cmp dl, 0
  15.   je t2
  16.   int 21h
  17.   t2:
  18.   pop dx
  19.   int 21h
  20.   pop ax
  21.   ret
  22.  
  23.  print_number:
  24.   push ax
  25.   push bx
  26.   push cx
  27.   push dx
  28.   mov ax, dx
  29.   mov bx, 10
  30.   mov cx, 0
  31.   getdigits:
  32.    mov dx, 0
  33.    div bx
  34.    inc cx
  35.    add dx, 30h
  36.    push dx
  37.    cmp ax, 0
  38.    jnz getdigits
  39.   mov ah, 02h
  40.   printdigits:
  41.    pop dx
  42.    int 21h
  43.    loop printdigits
  44.   pop dx
  45.   pop cx
  46.   pop bx
  47.   pop ax
  48.   ret
  49.  
  50.  debug:
  51.   cli
  52.   push bp
  53.   mov bp, sp
  54.   push ax
  55.   push bx
  56.   push cx
  57.   push dx
  58.   push si
  59.   mov dx, '['
  60.   call print_symbol
  61.   mov dx, [bp+2]
  62.   call print_number
  63.   mov dx, ','
  64.   call print_symbol
  65.   mov dx, [bp-2]
  66.   call print_number
  67.   mov dx, ']'
  68.   call print_symbol
  69.   mov dx, etr
  70.   call print_symbol
  71.   xor ax, ax
  72.   int 16h
  73.   pop si
  74.   pop dx
  75.   pop cx
  76.   pop bx
  77.   pop ax
  78.   pop bp
  79.   sti
  80.   iret
  81.  
  82.  thread:
  83.   mov ax, 1
  84.   mov cx, 10
  85.   t1:
  86.    add ax, ax
  87.    loop t1
  88.   ret
  89.  
  90.  beg:
  91.   mov ax, 3501h
  92.   int 21h
  93.   mov int1, bx
  94.   mov int1+2, es
  95.   push cs
  96.   pop ds
  97.   mov dx, offset debug
  98.   mov ax, 2501h
  99.   int 21h
  100.   pushf
  101.   push offset exit
  102.   pushf
  103.   pop ax
  104.   or ax, 100h
  105.   push ax
  106.   push cs
  107.   push offset thread
  108.   iret
  109.  
  110.  exit:
  111.   popf
  112.   lea dx, int1
  113.   mov ax, 2501h
  114.   int 21h
  115.   mov ah, 01h
  116.   int 21h
  117.   int 20h
  118.  
  119. int1 dw 0h, 0h
  120. etr dw 0Ah, 0Dh
  121.  
  122. code ends
  123. end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement