Advertisement
Il_Voza

1.2 Compute n1+n2-n3

May 3rd, 2013
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Given the following variables of type byte already initialized in memory:
  2. ;•n1 db 10
  3. ;•n2 db 10h
  4. ;•n3 db 10b
  5. ;Compute the following expression, the result of which will be saved into variable byte called 'res':
  6. ;•n1 + n2 – n3
  7.  
  8. .MODEL small
  9. .STACK
  10. .DATA
  11. n1 DB 10
  12. n2 DB 10h
  13. n3 DB 10b
  14. res DB ?
  15. .CODE
  16. .STARTUP
  17. MOV AL,n1
  18. ADD AL,n2
  19. SUB AL,n3
  20. MOV res,AL
  21. .EXIT
  22. END
  23.  
  24. ;NB: Here, when I add or subtract numbers with several base, I don't need of convert, because it does automatically
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement