Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .model small
- .data
- message1 db 10, 13, "1st Number: $"
- message2 db 10, 13, "2nd Number: $"
- message3 db 10, 13, "Difference = $"
- line db 10, 13, "-------------$"
- num1 db ?
- num2 db ?
- .code
- main proc far
- mov ax, @data
- mov ds, ax
- mov num1, 5 ; store 5 in 'num1' variable
- mov num2, 4 ; store 4 in 'num2' variable
- lea dx, message1 ; print 'message1' variable
- mov ah, 09h
- int 21h
- mov ah, 2 ; print 'num1' variable
- mov dl, num1 ; move 'num1' to dl
- add dl, 48 ; add 48 to dl to make it decimal
- int 21h
- lea dx, message2 ; print 'message2' variable
- mov ah, 09h
- int 21h
- mov ah, 2 ; print 'num2' variable
- mov dl, num2 ; mov 'num2' to dl
- add dl, 48 ; add 48 to dl to make it decimal
- int 21h
- lea dx, line ; print 'line' variable
- mov ah, 09h
- int 21h
- lea dx, message3 ; print 'message3' variable
- mov ah, 09h
- int 21h
- mov ah, 2
- mov dl, num1 ; move 'num1' to dl
- sub dl, num2 ; subtract 'num2' from dl
- add dl, 48 ; add 48 to dl to make it decimal
- int 21h
- mov ah, 4ch ; end program
- int 21h
- endp
- end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement