Advertisement
Il_Voza

2.1 MUL

May 4th, 2013
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Given three variables of type byte into memory, that represent respectly number of days, hours and minutes spent ;since a time T0. Calculate the total number of minutes passed since T0, and this value must be saved into variable of ;type word 'risultato'.
  2. ;-To extend the range of representable numbers, it is requested to work with a representation in pure binary
  3. ;-In the case of overflow of representation, write in 'risultato' FFFFh value
  4.  
  5. ;IMPLEMENTATION
  6. ;It is need to do a sum of the input variables:
  7. ;-Conversion of days into hours
  8. ;-Sum of hours
  9. ;-Conversion of hours into minutes
  10. ;-Sum of minutes
  11.  
  12. ;Interim operations executed on word
  13. ;Assess when is possible to get overflow in sum/multiplication operations
  14.  
  15. .MODEL small
  16. .STACK
  17. .DATA
  18. day DB 46
  19. hour DB 2
  20. min DB 30
  21. risultato DW ?
  22. .CODE
  23. .START
  24.  
  25. ;DAYS
  26. MOV AL,day
  27. MOV CX,1440
  28. MUL CX
  29. JO overflow
  30. ADD risultato,AX
  31. JO overflow
  32.  
  33. ;HOURS
  34. MOV AL,60
  35. MUL hour
  36. JO overflow
  37. ADD risultato,AX
  38. JO overflow
  39.  
  40. ;SUM MINUTES
  41. MOV AL,min  
  42. CBW
  43. ADD risultato,AX
  44. JO overflow
  45. JMP exit
  46.  
  47. overflow:
  48. MOV risultato,0FFFFh
  49.  
  50. exit:
  51. .EXIT  
  52. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement