April 9, 2015

TASM (Adding a number)

.model small
.stack 100h
.data
prompt db 13,10, 'First Number:','$'
prompt1 db 13,10, 'Second Number:','$'
result db 13, 10, 'SUM:', '$'

num1 db ?
num2 db ?
sum db ?
.code
main proc
mov ax @data;
mov ds, ax
mov ah, 9
mov dx offset prompt
int 21h

mov ah, l
mov int 21h
mov bl, a1
mov num1, al

mov ah, 9
lea dx, prompt1
int 21h

mov ah, 2
int 21h
mov bl, al
mov num2, al

mov ax, num1
add ax, num2
mov sum, ax

mov ah, 9
lea dx result
int 21h

 mov ax, 4C00h
     int 21h

main endp
end main

No comments: