;how to take and show a message .model small .stack 100h .data ;declare variable msg db 'my ID 21300046!$' .code main proc mov ax, @data mov ds, ax lea dx,msg mov ah, 9 int 21h mov ah, 4ch int 21h main endp end main ;take input from keyboard and show it .model small .stack 100h .data msg db 'enter your string: $' .code main proc mov ax, @data mov ds, ax lea dx,msg mov ah, 9 int 21h mov ah, 1 int 21h mov bl, al mov ah, 2 mov dl, 0dh int 21h mov dl, 0ah int 21h mov dl, bl int 21h mov ah,4ch int 21h main endp end main ;addition of single digit .model small .stack 100h .data .code main proc mov ah, 1 int 21h mov bl,al mov ah,1 int 21h add bl,al sub bl,'0' mov ah,2 mov dl,bl int 21h mov ah,4ch int 21h main endp end main ;addition of multi digit .model small .stack 100h .data digit1 db 0ah, 0dh, "enter first digit: $" digit2 db 0ah, 0dh, "enter second digit: $" result db 0ah, 0dh, "result is $" .code main proc mov ax, @data mov ds, ax lea dx, digit1 mov ah, 09h int 21h mov ah,01h int 21h sub al, 30h mov bh, al mov ah, 01h int 21h sub al, 30h mov bl, al lea dx, digit2 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 add bl, cl mov al, bl mov ah, 00h aaa mov cl, al mov bl, ah add bl, bh add bl, ch mov al, bl mov ah,00h aaa mov bx,ax mov dx, offset result mov ah, 09h int 21h mov dl, bh add dl, 30h mov ah, 02h int 21h mov dl, bl add dl, 30h mov ah, 02h int 21h mov dl, cl add dl, 30h mov ah, 02h int 21h exit: mov ah, 04ch int 21h main endp end main ;subt of single digit .model small .stack 100h .data .code main proc mov ah, 1 int 21h mov bl,al mov ah,1 int 21h sub bl,al add bl,'0' mov ah,2 mov dl,bl int 21h mov ah,4ch int 21h main endp end main ;subt of multi digit .model small .stack 100h .data msg1 db 'enter first number: ', '$' msg2 db 'enter second number: ', '$' msg3 db 'the output is: ', '$' crlf db 0dh, 0ah, '$' num1digit1 db ? num1digit2 db ? num2digit1 db ? num2digit2 db ? .code main proc mov ax, @data mov ds, ax mov ah, 9 lea dx, msg1 int 21h mov ah,1 int 21h mov num1digit1, al sub num1digit1, 30h mov ah, 1 int 21h mov num1digit2, al sub num1digit2, 30h mov ah, 9 lea dx, crlf int 21h mov ah, 9 lea dx, msg2 int 21h mov ah, 1 int 21h mov num2digit1, al sub num2digit1, 30h mov ah, 1 int 21h mov num2digit2, al sub num2digit2, 30h mov ah, 9 lea dx, crlf int 21h mov ah, 9 lea dx, msg3 int 21h mov ah, 2 mov cl, num1digit1 sub cl, num2digit1 mov dl, cl add dl, 30h int 21h mov ah, 2 mov cl, num1digit2 sub cl, num2digit2 mov dl, cl add dl, 30h int 21h mov ah, 4ch int 21h main endp end main ;9-0 in reverse system .model small .stack 100h .data msg db 0ah, 0dh, "9-0 in reverse system: $" .code main proc mov ax, @data mov ds, ax lea dx, msg mov ah, 9 int 21h mov cx, 10 mov ah, 2 mov dl, 57 @loop: int 21h dec dl dec cx jnz @loop mov ah, 4ch int 21h main endp end main ;print @, read 2 dec digit and add them .model small .stack 100h .data msg db 'THE SUM OF$' msg1 db ' $' msg2 db 'AND$' msg3 db 'IS$' .code main proc mov dl,'@' mov ah,2 int 21h mov ah,1 int 21h mov bl,al mov ah,1 int 21h mov cl,al mov ah,2 mov dl,0dh int 21h mov dl,0ah int 21h mov ax,@data mov ds,ax lea dx,msg mov ah,9 int 21h lea dx,msg1 mov ah,9 int 21h mov ah,2 mov dl,bl int 21h lea dx,msg1 mov ah,9 int 21h lea dx,msg2 mov ah,9 int 21h lea dx,msg1 mov ah,9 int 21h mov ah,2 mov dl,cl int 21h lea dx,msg1 mov ah,9 int 21h lea dx,msg3 mov ah,9 int 21h lea dx,msg1 mov ah,9 int 21h add bl,cl sub bl,48d mov dl,bl mov ah,2 int 21h mov ah,4ch int 21h main endp end main ;ENTER THREEE INITIALS: JFK ;Output Will be ; J ; F ; K .model small .stack 100h .data msg db 'ENTER THREE INITIAL: $' .code main proc mov ax,@data ;initialize data segment mov ds,ax lea dx,msg mov ah,9 int 21h mov ah,1 int 21h mov bl,al mov ah,1 int 21h mov cl,al mov ah,1 int 21h mov bh,al mov ah,2 mov dl,0dh ;caariage return int 21h mov dl,0ah ;new line int 21h mov ah,2 mov dl,bl int 21h mov dl,0dh int 21h mov dl,0ah int 21h mov ah,2 mov dl,cl int 21h mov dl,0dh int 21h mov dl,0ah int 21h mov ah,2 mov dl,bh int 21h mov ah,4ch int 21h main endp end main ;Upper case to lower case .model small .stack 100h .data msg db 'Enter an uppercase letter: $' val db ? str db 0ah,0dh,'After convert the uppercase letter into lowercase letter: ' ans db ? finish db '$' .code main proc mov ax,@data mov ds,ax mov ah,9 lea dx,msg int 21h mov ah,1 int 21h mov val,al add al,20h mov ans,al mov ah,9 lea dx,str int 21h mov ah,4ch int 21h main endp end main ;Odd(o) even (e) .model small .stack 100h .data msg1 db 10, 13, 'This is an odd number$' msg2 db 10, 13, 'This is an even number$' .code main proc mov ax, @data mov ds, ax mov ah, 1 int 21h cmp al, 1 je odd_ cmp al, 3 je odd_ cmp al, 2 je even_ cmp al, 4 je even_ odd_: lea dx, msg1 mov ah, 9 int 21h jmp end_case even_: lea dx, msg2 mov ah, 9 int 21h jmp end_case end_case: mov ah, 4ch int 21h main endp end main ;yx = xy .model small .stack 100h .data msg db 10,13,'?$' msg1 db 10,13,'Enter two letter=$' msg2 db 10,13,'Output is=$' .code main proc mov ax,@data mov ds,ax lea dx,msg mov ah,9 int 21h lea dx,msg1 mov ah,9 int 21h mov ah,1 int 21h mov bl,al mov ah,1 int 21h mov cl,al lea dx,msg2 mov ah,9 int 21h cmp bl,cl ja go ; if bl>cl mov dl,bl mov ah,2 int 21h mov dl,cl int 21h jmp exit go: mov dl,cl mov ah,2 int 21h mov dl,bl int 21h jmp exit exit: mov ah,4ch int 21h main endp end main ;ttaannvviirr(Repeat loop) .model small .stack 100h .data .code main proc mov ax,@data mov ds,ax repeat: mov ah,1 int 21h cmp al,20h je end_ mov ah,2 mov dl,al int 21h jmp repeat end_: mov ah,4ch int 21h main endp end main ;if uppercase the display it .model small .stack 100h .data prompt db 'Enter the character : $' msg_1 db 'The input letter is : $' msg_2 db 'The input character is not an upper case letter.$' .code main proc mov ax, @data mov ds, ax lea dx, prompt mov ah, 9 int 21h mov ah, 1 int 21h mov bl, al mov ah, 2 mov dl, 0dh int 21h mov dl, 0ah int 21h cmp bl, "A" jb @display cmp bl, "Z" ja @display lea dx,msg_1 mov ah, 9 int 21h mov ah, 2 mov dl, bl int 21h jmp @exit @display: lea dx,msg_2 mov ah, 9 int 21h @exit: mov ah, 4ch int 21h main endp end main ;ABCDEFGHIJKLMNOPQRSTUVWXYZ .model small .stack 100h .data .code main proc mov cx, 26 mov ah, 2 mov dl, 65 L1: int 21h inc dl loop L1 mov dl, 10 mov ah,2 INT 21h mov dl, 13 mov ah,2 INT 21h mov cx, 26 mov dl, 97 mov ah, 2 mov ah,4ch INT 21h main endp end main