; hi.asm - simple "hello world" program ; assemble with "nasm -f bin -o hi.com hi.asm" org 100h ; inform Nasm this is a .com file section .data msg db 'this is shyam!',0Dh,0Ah,'$' ; $-terminated message MSG1 DB "ENTER FIRST NO. $" MSG2 DB 0AH,0DH,"ENTER THE SECOND NUMBER $" MSG3 DB 0AH,0DH,"RESULT IS $" a db 00h b db 00h sum db 00h section .text ; int 21h is going to want... ;//;mov dx,msg ;the address of or message in dx ;//;mov ah,9 ; ah=9 - "print string" sub-function ;//;int 21h ; call dos services start: mov dx,msg ; the address of or message in dx mov ah,9 ; ah=9 - "print string" sub-function int 21h ; call dos services mov ah,09h lea dx,[MSG1] int 21h mov ah,01h int 21h cmp al,3ah jb L0 sub al,07h L0: mov cl,04h shl al,cl mov [a],al mov ah,01h int 21h cmp al,3ah jb L1 sub al,07h L1: and al,0fh add [a],al mov ah,09h lea dx,[MSG2] int 21h mov ah,01h int 21h cmp al,3ah jb L2 sub al,07h L2: mov cl,04h shl al,cl mov [b],al mov ah,01h int 21h cmp al,3ah jb L3 sub al,07h L3: and al,0fh add al,[b] mov bl,al mov ah,09h lea dx,[MSG3] int 21h mov al,bl add al,[a] mov [sum],al mov bl,al mov cl,04h shr al,cl cmp al,0ah jb L4 add al,07h L4: add al,30h mov dl,al mov ah,02h int 21h mov al,bl and al,0fh cmp al,0ah jb L5 add al,07h L5: add al,30h mov dl,al mov ah,02h int 21h mov ah,4ch mov al,00h int 21h