Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;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'.
- ;-To extend the range of representable numbers, it is requested to work with a representation in pure binary
- ;-In the case of overflow of representation, write in 'risultato' FFFFh value
- ;IMPLEMENTATION
- ;It is need to do a sum of the input variables:
- ;-Conversion of days into hours
- ;-Sum of hours
- ;-Conversion of hours into minutes
- ;-Sum of minutes
- ;Interim operations executed on word
- ;Assess when is possible to get overflow in sum/multiplication operations
- .MODEL small
- .STACK
- .DATA
- day DB 46
- hour DB 2
- min DB 30
- risultato DW ?
- .CODE
- .START
- ;DAYS
- MOV AL,day
- MOV CX,1440
- MUL CX
- JO overflow
- ADD risultato,AX
- JO overflow
- ;HOURS
- MOV AL,60
- MUL hour
- JO overflow
- ADD risultato,AX
- JO overflow
- ;SUM MINUTES
- MOV AL,min
- CBW
- ADD risultato,AX
- JO overflow
- JMP exit
- overflow:
- MOV risultato,0FFFFh
- exit:
- .EXIT
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement