8086 Program to add two numbers using console screen.
Emulator Used: emu8086 (Version 4.08)
Click Here To Download
Click Here To Download
data segment msg1 db 10,13,'adition for 2 no$' msg2 db 10,13,'enter a first no$' msg3 db 10,13,'enter a second no$' msg4 db 10,13,'addition is$' a DW 0000h b DW 0000h c dw 0000h data endsassume cs:code,ds:datacode segment start: mov ax,data ;initilise data segment mov ds,ax lea dx,msg1 ;load offset of msg1 mov ah,09h ;print the msg to console int 21h ;intrrupt call lea dx,msg2 ; load offset of msg2 mov ah,09h ;print the msg to console int 21h ;intrrupt call mov ah,01h int 21h sub al,30h MOV CH,AL mov ah,01h int 21h sub al,30h MOV CL,AL MOV a,CX ;get the no from consol ;enter a no in askii form we need to conver into ;dec no and thise no is stored in al lea dx,msg3 mov ah,09h int 21h mov ah,01h int 21h sub al,30h MOV CH,AL mov ah,01h int 21h sub al,30h MOV cl,AL MOV b,CX lea dx,msg4 mov ah,09h int 21h mov cx ,a add cx,b mov c,cx mov bx,c mov dl,bh add dl ,30h mov ah,02h ;print the no int 21h mov dl,bl add dl ,30h mov ah,02h ;print the no int 21h mov ah,4ch int 21h ;give the control to os code endsend start
Output:
Comments
Post a Comment