Add and Display integers

I am new to assembly language. I would like to know how to add two integers, store them, then display the total on the console. Thanks

title Ch4ex-1 (cal.ASM)

;Problem statement: Enter two numbers, store them, then display the total on the screen


.model small
.stack 100h
.data
numberPrompt db "Please enter a number--->>"

.code
extrn Crlf:proc, Writeint:proc, Clrscr:proc,
Gotoxy:proc,Writestring:proc,Readint:proc

main proc
mov ax,@data
mov ds,ax

;clear the screen
call Clrscr
;ask for number
mov dx,offset numberPrompt
call Writestring
call Readint
call Crlf


;ask for another number
mov dx,offset numberPrompt
call Writestring
call Readint
call Crlf

;add both nembers
?





int 21h

mov ax,4C00h
int 21h
main endp

end main
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories