Advertisement
Il_Voza

1.4 Compute OPA+OPB+OPA+OPB

May 3rd, 2013
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Given the following variables of type word (unsigned) already initialized in memory:
  2. ;•OPA = 32767
  3. ;•OPB = 1
  4. ;Write a program to compute the expression OPA+OPB+OPA+OPB, using AX register, and observe, giving reason, the ;behavior of flags (sign, overflow, carry)
  5.  
  6. ;NB: 8086: Representation of numbers
  7. ;8086 processor lets to do operations on numbers in CA2 (signed) or in pure binary
  8. ;Let's analyze 'add' instruction:
  9. ;-Carry Flag is set to pass between FFFF and 0000
  10. ;-Overflow Flag is set to pass between 7FFF and 8000
  11. ;So,it's need to be care about the behavior of flags, considering the representation type that we would like to use
  12.  
  13. .MODEL small
  14. .STACK
  15. .DATA
  16. OPA DW 32767
  17. OPB DW 1
  18. .CODE
  19. .STARTUP
  20. MOV AX,OPA
  21. ADD AX,OPB
  22. ADD AX,OPA
  23. ADD AX,OPB
  24. .EXIT
  25. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement