Advertisement
Iljam

Untitled

Mar 28th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. WriteInteger proc
  2.     push ax
  3.     push cx
  4.     push bx
  5.     push dx
  6.    
  7.     xor cx, cx
  8.     mov bx, 10
  9.    
  10.     cmp ax, 0
  11.     jl ddd
  12.     jmp divl
  13. ddd:
  14.     push ax
  15.     mov dl, '-'
  16.     mov ah, 2
  17.     int 21h
  18.     pop ax
  19.     neg ax
  20. divl:
  21.     xor dx, dx
  22.     idiv bx
  23.     push dx
  24.     inc cx
  25.     cmp ax,0
  26.     jg divl
  27. popl:
  28.     pop ax
  29.     add al, '0'
  30.    
  31.     call WriteChar
  32.     loop popl
  33.    
  34.     pop dx
  35.     pop bx
  36.     pop cx
  37.     pop ax
  38.     ret
  39. WriteInteger endp
  40.  
  41. WriteChar proc
  42.     push ax
  43.     push dx
  44.     mov dl, al
  45.     mov ah, 2
  46.     int 21h
  47.     pop dx
  48.     pop ax
  49.     ret
  50. WriteChar endp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement