S
S..NNoo.. PPRROOGGRRAAMM PPaaggee NNoo..
1
1 WWrriitte e aan n aasssseemmbblly y pprrooggrraam m tto o pprriinnt t a a ssiinngglle e cchhaarraacctteerr 22 2
2 WWrriitte e aan n aasssseemmbblly y pprrooggrraam m tto o pprriinnt t ttwwo o mmeessssaaggeess 33 3
3 WWrriitte e aan n aasssseemmbblly y pprrooggrraam m tto o pprriinnt t tthhe e ssuum m oof f ttwwo o ddiiggiittss 44 4
4 WrWritite ae an an assssememblbly py prrogograram tm to po prirint nt ththe fe facactotoririal al vavalulue oe of af a number
number
5 5 5
5 WWrriitte e aan n aasssseemmbblly y pprrooggrraam m tto o pprriinnt t mmuullttiipplle e ddiiggiit t nnuummbbeerr 77 6
6 WrWritite an ae an assssememblbly pry progograram to rm to reaead a cd a chahararactcter er frfrom kom keyeyboboarardd then display within parenthesis
then display within parenthesis
9 9 7
7 WrWritite ae an an assssememblbly pry progograram to m to rreaead a sd a strtrining & tg & thehen dn disisplplay iay inn reverse string
reverse string
10 10 8
8 WWrriitte e aan n aasssseemmbblly y pprrooggrraam m tto o pprriinnt t ssqquuaarre e oof f aanny y ggiivveen n nnuummbbeerr 1111 9
9 WrWritite an ae an assssememblbly pry progograram to fm to finind oud out tht the mue multltipiplilicacatition oon of twf twoo single digit numbers
single digit numbers
13 13 10
10 WrWrite ite an an asassesemblmbly py prorogrgram am to to fifind nd ouout tt the he subsubtrtractaction ion of of twtwoo single digit numbers
single digit numbers
15 15 1
111 WrWrite ite an an asassesemblmbly py prorogrgram am to to fifind nd ouout tt the he adadditdition ion of of twtwoo multiple digits numbers
multiple digits numbers
17 17 12
12 WrWrite ite an an asassesemblmbly py prorogrgram am to to fifind nd ouout tt the he subsubtrtractaction ion of of twtwoo multiple digits numbers
multiple digits numbers
19 19 13
13 WrWrite ite an aan assessemblmbly pry progrogram am to fto find ind ouout tht the mue multiltiplplicaicatiotion on of twf twoo multiple digits numbers
multiple digits numbers
21 21 14
14 WrWrite ite an an asassesemblmbly py prorogrgram am to to fifind nd ouout tt the he didivisvision ion of of twotwo multiple digits numbers
multiple digits numbers
23 23 1
155 WWrriitte e aan n aasssseemmbblly y pprrooggrraam m tto o pprriinnt t A A tto o ZZ 2255 1
166 WWrriitte e aan n aasssseemmbblly y pprrooggrraam m tto o ccaallccuullaatte e ssuum m oof f sseerriieess 2266 17
17 WrWrite ite an aan assessemblmbly pry progrogram am to dto deteterermimine lne larargesgest nut numbember or out out of f 3 numbers
3 numbers
28 28
1
1ststProgram:Program:
Write an assembly program to print a
Write an assembly program to print a single character.single character. // an assembly program
// an assembly program for print a chafor print a characterracter.. .model small .model small .stack 100h .stack 100h .data .data msg1 db
msg1 db 13,10, “Enter 13,10, “Enter character $”character $” msg2 db 13,10, “Entered character is $” msg2 db 13,10, “Entered character is $” .code
.code
mov ax, @data mov ax, @data mov ds, ax mov ds, ax lea dx, msg1 lea dx, msg1 mov ah, 09h mov ah, 09h int 21h int 21h mov ah, 01h mov ah, 01h int 21h int 21h mov bl, al mov bl, al lea dx, msg2 lea dx, msg2 mov ah, 09h mov ah, 09h int 21h int 21h mov dl, bl mov dl, bl mov ah, 02h mov ah, 02h int 21h int 21h mov ah, 4ch mov ah, 4ch int 21h int 21h end end
Screen print of program: Screen print of program:
C:\>MASM> PROGRAM NAME C:\>MASM> PROGRAM NAME
Enter character G Enter character G Entered character is G Entered character is G
Write an assembly program to print two
Write an assembly program to print two messages.messages. // an assembly program for print two messages. // an assembly program for print two messages. .model small .model small .stack 100h .stack 100h .data .data
msg1 db 13,10, “No time for $” msg1 db 13,10, “No time for $” msg2 db 13,10, “Study $” msg2 db 13,10, “Study $” .code
.code
mov ax, @data mov ax, @data mov ds, ax mov ds, ax lea dx, msg1 lea dx, msg1 mov ah, 09h mov ah, 09h int 21h int 21h lea dx, msg2 lea dx, msg2 mov ah, 09h mov ah, 09h int 21h int 21h mov ah, 4ch mov ah, 4ch int 21h int 21h end end
Screen print of program: Screen print of program:
C:\>MASM> PROGRAM NAME C:\>MASM> PROGRAM NAME
No time for No time for
Study Study
3
3rdrdProgram:Program:
Write an assembly program to print the sum of two digits. Write an assembly program to print the sum of two digits. // an assembly program for print the sum of
// an assembly program for print the sum of two digits.two digits.
.model small .model small .stack 100h .stack 100h .data .data s1 db 13,10, “Enter the 1
s1 db 13,10, “Enter the 1 st value $”st value $” s2 db 13,10, “Enter the 2
s2 db 13,10, “Enter the 2 nd value $”nd value $” s3 db 13,10, “Sum is $”
s3 db 13,10, “Sum is $” .code
.code
mov ax, @data mov ax, @data mov ds, ax mov ds, ax lea dx, s1 lea dx, s1 mov ah, 09h mov ah, 09h int 21h int 21h mov ah, 01h mov ah, 01h int 21h int 21h sub al,30h sub al,30h mov bl, al mov bl, al lea dx, s2 lea dx, s2 mov ah, 09h mov ah, 09h int 21h int 21h mov db, 0lh mov db, 0lh int 21h int 21h mov ah, 01h mov ah, 01h int 21h int 21h sub al, 30h sub al, 30h add bl, al add bl, al lea dx, s3 lea dx, s3 mov ah, 09h mov ah, 09h int 21h int 21h add bl, 30h add bl, 30h mov dl, bl mov dl, bl mov dh, 02h mov dh, 02h int 21h int 21h mov ah, 4ch mov ah, 4ch int 21h int 21h end end
Screen print of program: Screen print of program:
C:\>MASM> PROGRAM NAME C:\>MASM> PROGRAM NAME
Enter the 1
Enter the 1 st value 2st value 2 Enter the 2
Enter the 2 nd value 3nd value 3 Sum is 6
Write an assembly program to print the
Write an assembly program to print the factorial value of a factorial value of a number.number. // an assembly program
// an assembly program for print factorial of a for print factorial of a numbernumber.. .model small .model small .stack 100h .stack 100h .data .data msg1 db
msg1 db 13,10, “Enter 13,10, “Enter Number $”Number $” msg2 db
msg2 db 13,10, “Factorial 13,10, “Factorial value is value is $”$” .code
.code
mov ax, @data mov ax, @data mov ds, ax mov ds, ax lea dx, msg1 lea dx, msg1 mov ah, 09h mov ah, 09h int 21h int 21h mov bx, 0 mov bx, 0 start: start: mov ah, 01 mov ah, 01 int 21h int 21h cmp al, 0dh cmp al, 0dh je next je next mov ah, 0 mov ah, 0 sub al, 30h sub al, 30h push ax push ax mov ax, 10d mov ax, 10d mul bx mul bx pop bx pop bx add bx, ax add bx, ax jmp start jmp start next: next: mov cx, bx mov cx, bx mov ax, 1 mov ax, 1 top: top: mul cx mul cx loop top loop top mov bx,10d mov bx,10d mov dx, 0 mov dx, 0 break: break: div bx div bx push dx push dx inc cx inc cx mov dx, 0 mov dx, 0 or ax, ax or ax, ax jnz break jnz break
mov ah, 09 mov ah, 09 lea dx, msg2 lea dx, msg2 int 21h int 21h mov dx, 0 mov dx, 0 print: print: pop dx pop dx mov ah, 02 mov ah, 02 add dl, 03h add dl, 03h int 21h int 21h loop print loop print mov ah, 4ch mov ah, 4ch int 21h int 21h end end
Screen print of program: Screen print of program:
C:\>MASM> PROGRAM NAME C:\>MASM> PROGRAM NAME
Enter
Enter Number Number 55 Factorial
Write an assembly program to print multiple
Write an assembly program to print multiple digit number.digit number. // an assembly program
// an assembly program for print multiple digit number.for print multiple digit number. .model small .model small .stack 100h .stack 100h .data .data m1 db
m1 db 13,10, “Enter 13,10, “Enter Number $”Number $” m2 db 13,10,
m2 db 13,10, “Entered Number “Entered Number is is $”$” .code
.code
mov ax, @data mov ax, @data mov ds, ax mov ds, ax lea dx, m1 lea dx, m1 mov ah, 09h mov ah, 09h int 21h int 21h mov bx, 0 mov bx, 0 start: start: mov ah, 01 mov ah, 01 int 21h int 21h cmp al, 0dh cmp al, 0dh je next je next mov ah, 0 mov ah, 0 sub al, 30h sub al, 30h push ax push ax mov ax, 10d mov ax, 10d mul bx mul bx pop bx pop bx add bx, ax add bx, ax jmp start1 jmp start1 next: next: push bx push bx mov ah,09h mov ah,09h lea dx, m2 lea dx, m2 int 21h int 21h pop ax pop ax mov dx,0 mov dx,0 mov bx,10d mov bx,10d break: break: div bx div bx push dx push dx mov dx,0 mov dx,0 or ax, ax or ax, ax jnz break jnz break
print: print: pop dx pop dx add dl, 30h add dl, 30h mov ah, 02 mov ah, 02 int 21h int 21h loop print loop print mov ah, 4ch mov ah, 4ch int 21h int 21h end end
Screen print of program: Screen print of program:
C:\>MASM> PROGRAM NAME C:\>MASM> PROGRAM NAME
Enter
Enter Number Number 555555 Entered Number is 555 Entered Number is 555
Write an assembly program to read a character from keyboard then display within Write an assembly program to read a character from keyboard then display within parenthesis.
parenthesis.
// an assembly program for
// an assembly program for read a character read a character and display within parenthesis.and display within parenthesis.
.model small .model small .stack 100h .stack 100h .data .data m1 db 1
m1 db 13,10, “Enter 3,10, “Enter Character : $Character : $”” m2 db 13,10, “Entered Character is : $” m2 db 13,10, “Entered Character is : $” .code
.code
mov ax, @data mov ax, @data mov ds, ax mov ds, ax lea dx, m1 lea dx, m1 mov ah, 09h mov ah, 09h int 21h int 21h mov ah,01h mov ah,01h int 21h int 21h mov bl,al mov bl,al lea dx,m2 lea dx,m2 mov ah,09h mov ah,09h int 21h int 21h mov dl,”(” mov dl,”(” mov ah,02h mov ah,02h int 21h int 21h mov dl,bl mov dl,bl mov ah,02h mov ah,02h int 21h int 21h mov dl,”) mov dl,”) mov ah,02h mov ah,02h int 21h int 21h mov ah,4ch mov ah,4ch int 21h int 21h end end
Screen print of program: Screen print of program:
C:\>MASM> PROGRAM NAME C:\>MASM> PROGRAM NAME
Enter
Enter Character Character : : hh Entered Character is : (h) Entered Character is : (h)
7
7ththProgram:Program:
Write an assembly program to read a string & then display in reverse string. Write an assembly program to read a string & then display in reverse string. // an assembly program for print reverse string.
// an assembly program for print reverse string. .model small .model small .stack 100h .stack 100h .data .data m1 db 13,10,
m1 db 13,10, “Enter “Enter String : String : $”$” m2 db 13,10, “Reverse String is : $” m2 db 13,10, “Reverse String is : $” .code
.code
mov ax, @data mov ax, @data mov ds, ax mov ds, ax lea dx, m1 lea dx, m1 mov ah, 09h mov ah, 09h int 21h int 21h mov cx, 0 mov cx, 0 read: read: mov ah, 01 mov ah, 01 int 21h int 21h cmp al, 0dh cmp al, 0dh je ahead je ahead push ax push ax inc cx inc cx jmp read jmp read ahead: ahead: lea dx, m2 lea dx, m2 mov ah,09h mov ah,09h int 21h int 21h display: display: mov ah,02h mov ah,02h pop dx pop dx int 21h int 21h loop display loop display mov ah,4ch mov ah,4ch int 21h int 21h end end
Screen print of program: Screen print of program:
C:\>MASM> PROGRAM NAME C:\>MASM> PROGRAM NAME
Enter
Enter String String : : mcamca Reverse String is : acm Reverse String is : acm
Write an assembly program to print square
Write an assembly program to print square of any given of any given number.number. // an assembly program for print square value
// an assembly program for print square value .model small .model small .stack 100h .stack 100h .data .data a dw ? a dw ? s1 db
s1 db 13,10, “Enter 13,10, “Enter Number : Number : $”$” s2 db
s2 db 13,10, “Square is 13,10, “Square is : $”: $” .code
.code
mov ax, @data mov ax, @data mov ds,ax mov ds,ax mov ah,09h mov ah,09h lea dx,s1 lea dx,s1 int 21h int 21h mov bx,0 mov bx,0 read: read: mov ah,01h mov ah,01h int 21h int 21h cmp al,0dh cmp al,0dh je next je next mov ah,0 mov ah,0 sub al,30h sub al,30h push ax push ax mov ax,10d mov ax,10d mul bx mul bx pop bx pop bx add bx,ax add bx,ax jmp read jmp read next: next: mov ax,bx mov ax,bx mov a,ax mov a,ax mul a mul a push ax push ax mov cx,0 mov cx,0 mov ah,09h mov ah,09h lea dx,s2 lea dx,s2 int 21h int 21h mov dx,0 mov dx,0 mov bx,10d mov bx,10d pop ax pop ax
display: display: mov dx,0 mov dx,0 div bx div bx push dx push dx inc cx inc cx or ax,ax or ax,ax jnz display jnz display print: print: mov dx,0 mov dx,0 mov ah,02h mov ah,02h pop dx pop dx add dl,30h add dl,30h int 21h int 21h loop print loop print mov ah,4ch mov ah,4ch int 21h int 21h end end
Screen print of program: Screen print of program:
C:\>MASM> PROGRAM NAME C:\>MASM> PROGRAM NAME
Enter
Enter Number Number : : 22 Square
Write an assembly program to find out the multiplication of two single digit numbers. Write an assembly program to find out the multiplication of two single digit numbers. // an assembly program for print multiplication of two single digit numbers.
// an assembly program for print multiplication of two single digit numbers. .model small .model small .stack 100h .stack 100h .data .data s1 db 13,10, “Enter 1st Number : $” s1 db 13,10, “Enter 1st Number : $” s2 db 13,10, “Enter 2nd Number : $” s2 db 13,10, “Enter 2nd Number : $” s3 db 13,10, ”Multiplication is : $” s3 db 13,10, ”Multiplication is : $” .code .code
mov ax, @data mov ax, @data mov ds, ax mov ds, ax lea dx, s1 lea dx, s1 mov ah, 09h mov ah, 09h int 21h int 21h mov ah, 01h mov ah, 01h int 21h int 21h sub al, 30h sub al, 30h mov bl,al mov bl,al lea dx, s2 lea dx, s2 mov ah, 09h mov ah, 09h int 21h int 21h mov ah, 01h mov ah, 01h int 21h int 21h sub al, 30h sub al, 30h mul bl mul bl mov bl, al mov bl, al lea dx, s3 lea dx, s3 mov ah, 09h mov ah, 09h int 21h int 21h add bl, 30h add bl, 30h mov dl, bl mov dl, bl mov ah, 02h mov ah, 02h int 21h int 21h
mov ah, 4ch mov ah, 4ch int 21h int 21h end end
Screen print of program: Screen print of program:
C:\>MASM> PROGRAM NAME C:\>MASM> PROGRAM NAME
Enter 1st Number : 2 Enter 1st Number : 2 Enter 2nd Number : 3 Enter 2nd Number : 3 Multiplication is : 6 Multiplication is : 6
Write an assembly program to find out the subtraction of two single digit numbers. Write an assembly program to find out the subtraction of two single digit numbers. // an assembly program for print subtraction of two single digit numbers.
// an assembly program for print subtraction of two single digit numbers. .model small .model small .stack 100h .stack 100h .data .data s1 db 13,10, “Enter 1st Number : $” s1 db 13,10, “Enter 1st Number : $” s2 db 13,10, “Enter 2nd Number : $” s2 db 13,10, “Enter 2nd Number : $” s3 db 13,10, ”Subtraction is : $” s3 db 13,10, ”Subtraction is : $” .code .code
mov ax, @data mov ax, @data mov ds, ax mov ds, ax lea dx, s1 lea dx, s1 mov ah, 09h mov ah, 09h int 21h int 21h mov ah, 01h mov ah, 01h int 21h int 21h sub al, 30h sub al, 30h mov bl,al mov bl,al lea dx, s2 lea dx, s2 mov ah, 09h mov ah, 09h int 21h int 21h mov ah, 01h mov ah, 01h int 21h int 21h sub al, 30h sub al, 30h sub bl, al sub bl, al lea dx, s3 lea dx, s3 mov ah, 09h mov ah, 09h int 21h int 21h add bl, 30h add bl, 30h mov dl, bl mov dl, bl mov ah, 02h mov ah, 02h int 21h int 21h mov ah, 4ch mov ah, 4ch
int 21h int 21h end
end
Screen print of program: Screen print of program:
C:\>MASM> PROGRAM NAME C:\>MASM> PROGRAM NAME
Enter 1st Number : 6 Enter 1st Number : 6 Enter 2nd Number : 3 Enter 2nd Number : 3 Subtraction is : 3 Subtraction is : 3
Write an assembly program to find out the addition of two multiple digits numbers. Write an assembly program to find out the addition of two multiple digits numbers. // an assembly program for print addition of two multiple digits numbers.
// an assembly program for print addition of two multiple digits numbers. .model small .model small .stack 100h .stack 100h .data .data s1 db 13,10, “Enter 1st Number : $” s1 db 13,10, “Enter 1st Number : $” s2 db 13,10, “Enter 2nd Number : $” s2 db 13,10, “Enter 2nd Number : $” s3 db 13,10, ”Addition is : $” s3 db 13,10, ”Addition is : $” .code .code
mov ax, @data mov ax, @data mov ds, ax mov ds, ax lea dx, s1 lea dx, s1 mov ah, 09h mov ah, 09h int 21h int 21h mov bx, 0 mov bx, 0 start1: start1: mov ah, 01h mov ah, 01h int 21h int 21h cmp al,0dh cmp al,0dh jz next1 jz next1 mov ah,0 mov ah,0 sub al,30h sub al,30h push ax push ax mov ax,10d mov ax,10d mul bx mul bx pop bx pop bx add bx,ax add bx,ax jmp start1 jmp start1 next1: next1: push bx push bx lea dx,s2 lea dx,s2 mov ah,09h mov ah,09h int 21h int 21h mov bx,0 mov bx,0 start2: start2: mov ah,01h mov ah,01h int 21h int 21h cmp al,0dh cmp al,0dh
jz next2 jz next2 mov ah,0 mov ah,0 sub al,30h sub al,30h push ax push ax mov ax,10d mov ax,10d mul bx mul bx pop bx pop bx add bx,ax add bx,ax jmp start2 jmp start2 next2: next2: pop ax pop ax add ax,bx add ax,bx push ax push ax lea dx,s3 lea dx,s3 mov ah,09h mov ah,09h int 21h int 21h pop ax pop ax mov cx,0 mov cx,0 mov dx,0 mov dx,0 mov bx,10d mov bx,10d break: break: div bx div bx push dx push dx mov dx,0 mov dx,0 inc cx inc cx or ax,ax or ax,ax jnz break jnz break push: push: pop dx pop dx add dl,30h add dl,30h mov ah,02h mov ah,02h int 21h int 21h loop print loop print mov ah,4ch mov ah,4ch int 21h int 21h end end
Screen print of program: Screen print of program:
C:\>MASM> PROGRAM NAME C:\>MASM> PROGRAM NAME
Enter 1st Number : 26 Enter 1st Number : 26 Enter 2nd Number : 24 Enter 2nd Number : 24 Addition is : 50 Addition is : 50
Write an assembly program to find out the subtraction of two multiple digits numbers. Write an assembly program to find out the subtraction of two multiple digits numbers. // an assembly program for print subtraction of two multiple digits numbers.
// an assembly program for print subtraction of two multiple digits numbers. .model small .model small .stack 100h .stack 100h .data .data s1 db 13,10, “Enter 1st Number : $” s1 db 13,10, “Enter 1st Number : $” s2 db 13,10, “Enter 2nd Number : $” s2 db 13,10, “Enter 2nd Number : $” s3 db 13,10, ” Subtraction is : $” s3 db 13,10, ” Subtraction is : $” .code .code
mov ax, @data mov ax, @data mov ds, ax mov ds, ax lea dx, s1 lea dx, s1 mov ah, 09h mov ah, 09h int 21h int 21h mov bx, 0 mov bx, 0 start1: start1: mov ah, 01h mov ah, 01h int 21h int 21h cmp al,0dh cmp al,0dh jz next1 jz next1 mov ah,0 mov ah,0 sub al,30h sub al,30h push ax push ax mov ax,10d mov ax,10d mul bx mul bx pop bx pop bx add bx,ax add bx,ax jmp start1 jmp start1 next1: next1: push bx push bx lea dx,s2 lea dx,s2 mov ah,09h mov ah,09h int 21h int 21h mov bx,0 mov bx,0 start2: start2: mov ah,01h mov ah,01h int 21h int 21h cmp al,0dh cmp al,0dh
jz next2 jz next2 mov ah,0 mov ah,0 sub al,30h sub al,30h push ax push ax mov ax,10d mov ax,10d mul bx mul bx pop bx pop bx add bx,ax add bx,ax jmp start2 jmp start2 next2: next2: pop ax pop ax sub ax,bx sub ax,bx push ax push ax lea dx,s3 lea dx,s3 mov ah,09h mov ah,09h int 21h int 21h pop ax pop ax mov cx,0 mov cx,0 mov dx,0 mov dx,0 mov bx,10d mov bx,10d break: break: div bx div bx push dx push dx mov dx,0 mov dx,0 inc cx inc cx or ax,ax or ax,ax jnz break jnz break push: push: pop dx pop dx add dl,30h add dl,30h mov ah,02h mov ah,02h int 21h int 21h loop print loop print mov ah,4ch mov ah,4ch int 21h int 21h end end
Screen print of program: Screen print of program:
C:\>MASM> PROGRAM NAME C:\>MASM> PROGRAM NAME
Enter 1st Number : 100 Enter 1st Number : 100 Enter 2nd Number : 40 Enter 2nd Number : 40 Subtraction is : 60 Subtraction is : 60
Write an assembly program to find out the multiplication of two multiple digits numbers. Write an assembly program to find out the multiplication of two multiple digits numbers. // an assembly program for print multiplication of two multiple digits numbers.
// an assembly program for print multiplication of two multiple digits numbers. .model small .model small .stack 100h .stack 100h .data .data s1 db 13,10, “Enter 1st Number : $” s1 db 13,10, “Enter 1st Number : $” s2 db 13,10, “Enter 2nd Number : $” s2 db 13,10, “Enter 2nd Number : $” s3 db 13,10, ”Multiplication is : $” s3 db 13,10, ”Multiplication is : $” .code .code
mov ax, @data mov ax, @data mov ds, ax mov ds, ax lea dx, s1 lea dx, s1 mov ah, 09h mov ah, 09h int 21h int 21h mov bx, 0 mov bx, 0 start1: start1: mov ah, 01h mov ah, 01h int 21h int 21h cmp al,0dh cmp al,0dh jz next1 jz next1 mov ah,0 mov ah,0 sub al,30h sub al,30h push ax push ax mov ax,10d mov ax,10d mul bx mul bx pop bx pop bx add bx,ax add bx,ax jmp start1 jmp start1 next1: next1: push bx push bx lea dx,s2 lea dx,s2 mov ah,09h mov ah,09h int 21h int 21h mov bx,0 mov bx,0 start2: start2: mov ah,01h mov ah,01h int 21h int 21h cmp al,0dh cmp al,0dh
jz next2 jz next2 mov ah,0 mov ah,0 sub al,30h sub al,30h push ax push ax mov ax,10d mov ax,10d mul bx mul bx pop bx pop bx add bx,ax add bx,ax jmp start2 jmp start2 next2: next2: pop ax pop ax mul bx mul bx push ax push ax lea dx,s3 lea dx,s3 mov ah,09h mov ah,09h int 21h int 21h pop ax pop ax mov cx,0 mov cx,0 mov dx,0 mov dx,0 mov bx,10d mov bx,10d break: break: div bx div bx push dx push dx mov dx,0 mov dx,0 inc cx inc cx or ax,ax or ax,ax jnz break jnz break push: push: pop dx pop dx add dl,30h add dl,30h mov ah,02h mov ah,02h int 21h int 21h loop print loop print mov ah,4ch mov ah,4ch int 21h int 21h end end
Screen print of program: Screen print of program:
C:\>MASM> PROGRAM NAME C:\>MASM> PROGRAM NAME
Enter 1st Number : Enter 1st Number : 1111 Enter 2nd Number : 11 Enter 2nd Number : 11 Multiplication is : 121 Multiplication is : 121
Write an assembly program to find out the division of two multiple digits numbers. Write an assembly program to find out the division of two multiple digits numbers. // an assembly program for print division of two multiple digits numbers.
// an assembly program for print division of two multiple digits numbers. .model small .model small .stack 100h .stack 100h .data .data s1 db 13,10, “Enter 1st Number : $” s1 db 13,10, “Enter 1st Number : $” s2 db 13,10, “Enter 2nd Number : $” s2 db 13,10, “Enter 2nd Number : $” s3 db 13,10, ”Addition is : $” s3 db 13,10, ”Addition is : $” .code .code
mov ax, @data mov ax, @data mov ds, ax mov ds, ax lea dx, s1 lea dx, s1 mov ah, 09h mov ah, 09h int 21h int 21h mov bx, 0 mov bx, 0 start1: start1: mov ah, 01h mov ah, 01h int 21h int 21h cmp al,0dh cmp al,0dh jz next1 jz next1 mov ah,0 mov ah,0 sub al,30h sub al,30h push ax push ax mov ax,10d mov ax,10d mul bx mul bx pop bx pop bx add bx,ax add bx,ax jmp start1 jmp start1 next1: next1: push bx push bx lea dx,s2 lea dx,s2 mov ah,09h mov ah,09h int 21h int 21h mov bx,0 mov bx,0 start2: start2: mov ah,01h mov ah,01h int 21h int 21h cmp al,0dh cmp al,0dh
jz next2 jz next2 mov ah,0 mov ah,0 sub al,30h sub al,30h push ax push ax mov ax,10d mov ax,10d mul bx mul bx pop bx pop bx add bx,ax add bx,ax jmp start2 jmp start2 next2: next2: pop ax pop ax div bx div bx push ax push ax lea dx,s3 lea dx,s3 mov ah,09h mov ah,09h int 21h int 21h pop ax pop ax mov cx,0 mov cx,0 mov dx,0 mov dx,0 mov bx,10d mov bx,10d break: break: div bx div bx push dx push dx mov dx,0 mov dx,0 inc cx inc cx or ax,ax or ax,ax jnz break jnz break push: push: pop dx pop dx add dl,30h add dl,30h mov ah,02h mov ah,02h int 21h int 21h loop print loop print mov ah,4ch mov ah,4ch int 21h int 21h end end
Screen print of program: Screen print of program:
C:\>MASM> PROGRAM NAME C:\>MASM> PROGRAM NAME
Enter 1st Number : 500 Enter 1st Number : 500 Enter 2nd Number : 50 Enter 2nd Number : 50 Division is : 10 Division is : 10
Write an assembly program
Write an assembly program to print A to Z.to print A to Z. // an assembly program
// an assembly program for print A tfor print A to Z.o Z. .model small .model small .stack 100h .stack 100h .data .data .code .code
mov ax, @data mov ax, @data mov ds, ax mov ds, ax mov dl,”A” mov dl,”A” mov cx,26 mov cx,26 again: again: mov ah,02h mov ah,02h int 21h int 21h inc dl inc dl mov bx,0 mov bx,0 mov bl,dl mov bl,dl mov dl,” ” mov dl,” ” mov ah,02h mov ah,02h int 21h int 21h mov dl,bl mov dl,bl loop again loop again mov ah,4ch mov ah,4ch int 21h int 21h end end
Screen print of program: Screen print of program:
C:\>MASM> PROGRAM NAME C:\>MASM> PROGRAM NAME
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
16
16ththProgram:Program:
Write an assembly program to calculate sum of series. Write an assembly program to calculate sum of series. // an assembly program for print sum of a series.
// an assembly program for print sum of a series. .model small .model small .stack 100h .stack 100h .data .data s1 db 13,10, “Input limit : $” s1 db 13,10, “Input limit : $” s2 db 13,10, “Sum of
s2 db 13,10, “Sum of series is : $”series is : $” .code
.code
mov ax, @data mov ax, @data mov ds,ax mov ds,ax mov ah,09h mov ah,09h lea dx,s1 lea dx,s1 int 21h int 21h mov bx,0 mov bx,0 read: read: mov ah,01h mov ah,01h int 21h int 21h cmp al,0dh cmp al,0dh je next je next mov ah,0 mov ah,0 sub al,30h sub al,30h push ax push ax mov ax,10d mov ax,10d mul bx mul bx pop bx pop bx add bx,ax add bx,ax jmp read jmp read next: next: mov ax,bx mov ax,bx mov cx,ax mov cx,ax mov ax,0 mov ax,0 again: again: add ax,cx add ax,cx loop again loop again push ax push ax mov cx,0 mov cx,0 mov ah,09h mov ah,09h lea dx,s2 lea dx,s2 int 21h int 21h
mov bx,10d mov bx,10d pop ax pop ax display: display: mov dx,b mov dx,b div bx div bx push dx push dx inc cx inc cx or ax,ax or ax,ax jnz display jnz display print: print: mov dx,0 mov dx,0 mov ah,02h mov ah,02h int 21h int 21h pop dx pop dx add dl,30h add dl,30h int 21h int 21h loop print loop print mov ah,4ch mov ah,4ch int 21h int 21h end end
Screen print of program: Screen print of program:
C:\>MASM> PROGRAM NAME C:\>MASM> PROGRAM NAME
Input limit : 5 Input limit : 5
Sum of series is : 15 Sum of series is : 15
17
17ththProgram:Program:
Write an assembly program to determine largest number out of 3 numbers. Write an assembly program to determine largest number out of 3 numbers. // an assembly program for determine largest number out of 3 numbers. // an assembly program for determine largest number out of 3 numbers. .model small .model small .stack 100h .stack 100h .data .data a dw ? a dw ? b dw ? b dw ? c dw ? c dw ? l dw ? l dw ? s1 db 13,10, “Enter 1st no. : $” s1 db 13,10, “Enter 1st no. : $” s2 db 13,10, “Enter 2nd no. : $” s2 db 13,10, “Enter 2nd no. : $” s3 db 13,10, “Enter 3rd no. : $” s3 db 13,10, “Enter 3rd no. : $” s4 db 13,10, “Largest no. is : $” s4 db 13,10, “Largest no. is : $” .code .code
mov ax, @data mov ax, @data mov ds,ax mov ds,ax mov ah,09h mov ah,09h lea dx,s1 lea dx,s1 int 21h int 21h call getint call getint mov a,bx mov a,bx mov ax,0 mov ax,0 mov bx,0 mov bx,0 mov ah,09h mov ah,09h lea dx,s2 lea dx,s2 int 21h int 21h call getint call getint mov b,dx mov b,dx mov bx,0 mov bx,0 mov ax,0 mov ax,0 mov ah,09h mov ah,09h lea dx,s3 lea dx,s3 int 21h int 21h call getint call getint mov c,bx mov c,bx mov bx,0 mov bx,0
mov ax,a mov ax,a cmp ax,b cmp ax,b jl check_bc jl check_bc cmp ax,c cmp ax,c jl mov_c jl mov_c mov l,ax mov l,ax jmp exit1 jmp exit1 check_bc: check_bc: mov ax,b mov ax,b cmp ax,c cmp ax,c jl mov_c jl mov_c mov l,ax mov l,ax jmp exit1 jmp exit1 mov_c: mov_c: mov ax,c mov ax,c mov l,ax mov l,ax mov ax,0 mov ax,0 mov bx,0 mov bx,0 mov dx,0 mov dx,0 exit1: exit1: mov ah,09h mov ah,09h lea dx,s4 lea dx,s4 int 21h int 21h call disprint call disprint mov ax,0 mov ax,0 mov ah,4ch mov ah,4ch int 21h int 21h getint proc getint proc mov bx,0 mov bx,0 read: read: mov ah,01h mov ah,01h int 21h int 21h cmp al,0dh cmp al,0dh je next je next mov ah,0 mov ah,0 sub al,30h sub al,30h push ax push ax mov ax,10d mov ax,10d
mul bx mul bx pop bx pop bx add bx,ax add bx,ax jmp read jmp read next: next: ret ret getint endp getint endp disprint proc disprint proc mov ax,l mov ax,l push ax push ax mov dx,0 mov dx,0 mov bx,10d mov bx,10d pop ax pop ax mov cx,0 mov cx,0 display: display: mov dx,0 mov dx,0 div bx div bx push dx push dx inc cx inc cx or ax,ax or ax,ax jnz display jnz display print: print: mov dx,0 mov dx,0 mov ah,02h mov ah,02h pop dx pop dx add dl,30h add dl,30h int 21h int 21h loop print loop print ret ret disprint endp disprint endp end end
Screen print of program: Screen print of program:
C:\>MASM> PROGRAM NAME C:\>MASM> PROGRAM NAME
Enter 1st no. : 8 Enter 1st no. : 8 Enter 2nd no. : 6 Enter 2nd no. : 6 Enter 3rd no. : 4 Enter 3rd no. : 4 Largest no. is : 8 Largest no. is : 8