Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .model small
- .stack 100h
- .data
- add1 db 10,13,'Enter Number: $'
- add2 db 10,13,'Enter Number to add: $'
- psum db 10,13,'The sum is: $'
- n1 db 0
- n2 db 0
- .code
- ADDNUMS PROC
- mov ax, @data
- mov ds, ax
- ;Print add1 and get input
- lea dx, add1
- mov ah, 9h
- int 21h
- ; Get input strip ASCII
- mov ah, 1h
- int 21h
- sub al, '0'
- mov n1, al
- ; Print add2 and get inpu
- lea dx, add2
- mov ah, 9h
- int 21h
- ;Get input strip ASCII
- mov ah, 1h
- int 21h
- sub al, '0'
- mov n2, al
- ;Print psum
- lea dx, psum
- mov ah, 9h
- int 21h
- ;Calculate sum
- mov dl, n1
- add dl, n2
- add dl, '0'
- ;Print sum
- mov ah, 2h
- int 21h
- ;Return to DOS
- mov ah, 4ch
- int 21h
- ADDNUMS ENDP
- END ADDNUMS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement