Advertisement
Guest User

Untitled

a guest
May 20th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1.  
  2.  
  3. proc BinToDec
  4.  
  5. mov cx,16
  6. mov si, 15
  7. xor bx,bx
  8. xor ax,ax
  9. mov bl, 1
  10.  
  11.  
  12.  
  13. againBtD:
  14. cmp BinResult[si],'1'
  15. je addBtD
  16. shl bx,1
  17. dec si
  18. loop againBtD
  19. jmp startMakeDec
  20.  
  21. addBtD: add ax,bx
  22. shl bx,1
  23. dec si
  24. loop againBtD
  25.  
  26. startMakeDec:
  27. xor bx,bx
  28. xor si,si
  29. mov bx,10
  30. mov cx,100
  31.  
  32. makeDec: div bx
  33. mov DecResult[si],dl
  34. add DecResult[si],'0'
  35. inc si
  36. cmp ax,0
  37. je exitBinToDec
  38. loop makeDec
  39.  
  40.  
  41.  
  42.  
  43. exitBinToDec: mov DecResult[si],10
  44. mov DecResult[si+1],13
  45. mov DecResult[si+2],'$'
  46.  
  47. lea dx, DecResult
  48. mov ah,9
  49. int 21h
  50.  
  51. ret
  52.  
  53. endp BinToDec
  54.  
  55. proc CheckInput
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement