Advertisement
jasonpogi1669

Lab Activity 3 (Add 10 then Subtract 5) using Assembly Language

Feb 26th, 2021
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. .model small
  2.  
  3. .data
  4.  
  5. prompt db "Enter favorite number (0 - 9): $"
  6. result db ? 13, 10, "Value = $"
  7.  
  8. .code
  9.  
  10. main proc far
  11.  
  12. mov ax, @data
  13. mov ds, ax
  14.  
  15. lea dx, prompt ; print 'prompt' variable
  16. mov ah, 09h
  17. int 21h
  18.  
  19. mov ah, 1 ; input number
  20. int 21h
  21. mov bl, al
  22.  
  23. add bl, 10 ; add 10 to bl
  24. sub bl, 5 ; subtract 5 from bl
  25.  
  26. lea dx, result ; print 'result' variable
  27. mov ah, 09h
  28. int 21h
  29.  
  30. mov ah, 2 ; print the value in bl
  31. mov dl, bl
  32. int 21h
  33.  
  34. mov ah, 4ch ; end program
  35. int 21h
  36.  
  37. endp
  38.  
  39. end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement