Guest User

Untitled

a guest
Nov 20th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. ; doubles the number, and outputs the result
  2.  
  3. name double
  4.  
  5. .model small
  6. .stack 100
  7. .data
  8. prompt db 0ah,0dh,"Enter a number < 5: $"
  9. resmes db 0ah,0dh,"Double your number is: "
  10. result db ?,0ah,0dh,"$"
  11.  
  12. .code
  13. start:
  14. mov ax, @data
  15. mov ds, ax
  16. lea dx, prompt
  17. mov ah, 09h ;dos fn to output string up to $
  18. int 21h
  19.  
  20. mov ah, 01h ;dos fn to input byte into al
  21. int 21h
  22.  
  23. sub al, 30h ;convert from ascii to integer
  24. add al, al
  25.  
  26. add al, 30h ;convert back to ascii
  27. mov result, al
  28.  
  29. lea dx, resmes
  30. mov ah, 09h
  31. int 21h
  32.  
  33. mov ax, 4c00h
  34. int 21h
  35. end start
Add Comment
Please, Sign In to add comment