Assembly Program's File

  • Uploaded by: Hirdesh
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Assembly Program's File as PDF for free.

More details

  • Words: 3,260
  • Pages: 30
MCA (I-sem.) Laboratory file of Assembly Language Programming

INDEX S.No. 1

PROGRAM Write an assembly program to print a single character

Page No. 2

2

Write an assembly program to print two messages

3

3

Write an assembly program to print the sum of two digits

4

4

Write an assembly program to print the factorial value of a number Write an assembly program to print multiple digit number

5

9

15

Write an assembly program to read a character from keyboard then display within parenthesis Write an assembly program to read a string & then display in reverse string Write an assembly program to print square of any given number Write an assembly program to find out the multiplication of two single digit numbers Write an assembly program to find out the subtraction of two single digit numbers Write an assembly program to find out the addition of two multiple digits numbers Write an assembly program to find out the subtraction of two multiple digits numbers Write an assembly program to find out the multiplication of two multiple digits numbers Write an assembly program to find out the division of two multiple digits numbers Write an assembly program to print A to Z

16

Write an assembly program to calculate sum of series

26

17

Write an assembly program to determine largest number out of 3 numbers

28

5 6 7 8 9 10 11 12 13 14

1

7

10 11 13 15 17 19 21 23 25

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming 1st Program: Write an assembly program to print a single character. // an assembly program for print a character. .model small .stack 100h .data msg1 db 13,10, “Enter character $” msg2 db 13,10, “Entered character is $” .code mov ax, @data mov ds, ax lea dx, msg1 mov ah, 09h int 21h mov ah, 01h int 21h mov bl, al lea dx, msg2 mov ah, 09h int 21h mov dl, bl mov ah, 02h int 21h mov ah, 4ch int 21h end Screen print of program: C:\>MASM> PROGRAM NAME Enter character G Entered character is G

2

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming 2nd Program: Write an assembly program to print two messages. // an assembly program for print two messages. .model small .stack 100h .data msg1 db 13,10, “No time for $” msg2 db 13,10, “Study $” .code mov ax, @data mov ds, ax lea dx, msg1 mov ah, 09h int 21h lea dx, msg2 mov ah, 09h int 21h mov ah, 4ch int 21h end Screen print of program: C:\>MASM> PROGRAM NAME No time for Study

3

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming 3rd Program: Write an assembly program to print the sum of two digits. // an assembly program for print the sum of two digits. .model small .stack 100h .data s1 db 13,10, “Enter the 1 st value $” s2 db 13,10, “Enter the 2 nd value $” s3 db 13,10, “Sum is $” .code mov ax, @data mov ds, ax lea dx, s1 mov ah, 09h int 21h mov ah, 01h int 21h sub al,30h mov bl, al lea dx, s2 mov ah, 09h int 21h mov db, 0lh int 21h mov ah, 01h int 21h sub al, 30h add bl, al lea dx, s3 mov ah, 09h int 21h add bl, 30h mov dl, bl mov dh, 02h int 21h mov ah, 4ch int 21h end Screen print of program: C:\>MASM> PROGRAM NAME Enter the 1 st value 2 Enter the 2 nd value 3 Sum is 6

4

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming 4th Program: Write an assembly program to print the factorial value of a number. // an assembly program for print factorial of a number. .model small .stack 100h .data msg1 db 13,10, “Enter Number $” msg2 db 13,10, “Factorial value is $” .code mov ax, @data mov ds, ax lea dx, msg1 mov ah, 09h int 21h mov bx, 0 start: mov ah, 01 int 21h cmp al, 0dh je next mov ah, 0 sub al, 30h push ax mov ax, 10d mul bx pop bx add bx, ax jmp start next: mov cx, bx mov ax, 1 top: mul cx loop top mov bx,10d mov dx, 0 break: div bx push dx inc cx mov dx, 0 or ax, ax jnz break 5

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming mov ah, 09 lea dx, msg2 int 21h mov dx, 0 print: pop dx mov ah, 02 add dl, 03h int 21h loop print mov ah, 4ch int 21h end Screen print of program: C:\>MASM> PROGRAM NAME Enter Number 5 Factorial value is 120

6

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming 5th Program: Write an assembly program to print multiple digit number. // an assembly program for print multiple digit number. .model small .stack 100h .data m1 db 13,10, “Enter Number $” m2 db 13,10, “Entered Number is $” .code mov ax, @data mov ds, ax lea dx, m1 mov ah, 09h int 21h mov bx, 0 start: mov ah, 01 int 21h cmp al, 0dh je next mov ah, 0 sub al, 30h push ax mov ax, 10d mul bx pop bx add bx, ax jmp start1 next: push bx mov ah,09h lea dx, m2 int 21h pop ax mov dx,0 mov bx,10d break: div bx push dx mov dx,0 or ax, ax jnz break

7

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming print: pop dx add dl, 30h mov ah, 02 int 21h loop print mov ah, 4ch int 21h end Screen print of program: C:\>MASM> PROGRAM NAME  Enter Number 555 Entered Number is 555

8

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming 6th Program: Write an assembly program to read a character from keyboard then display within parenthesis. // an assembly program for read a character and display within parenthesis. .model small .stack 100h .data m1 db 13,10, “Enter Character : $” m2 db 13,10, “Entered Character is : $” .code mov ax, @data mov ds, ax lea dx, m1 mov ah, 09h int 21h mov ah,01h int 21h mov bl,al lea dx,m2 mov ah,09h int 21h mov dl,”(” mov ah,02h int 21h mov dl,bl mov ah,02h int 21h mov dl,”) mov ah,02h int 21h mov ah,4ch int 21h end Screen print of program: C:\>MASM> PROGRAM NAME  Enter Character : h Entered Character is : (h)

9

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming 7th Program: Write an assembly program to read a string & then display in reverse string. // an assembly program for print reverse string. .model small .stack 100h .data m1 db 13,10, “Enter String : $” m2 db 13,10, “Reverse String is : $” .code mov ax, @data mov ds, ax lea dx, m1 mov ah, 09h int 21h mov cx, 0 read: mov ah, 01 int 21h cmp al, 0dh je ahead push ax inc cx jmp read ahead: lea dx, m2 mov ah,09h int 21h display: mov ah,02h pop dx int 21h loop display mov ah,4ch int 21h end Screen print of program: C:\>MASM> PROGRAM NAME  Enter String : mca Reverse String is : acm 10

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming 8th Program: Write an assembly program to print square of any given number. // an assembly program for print square value .model small .stack 100h .data a dw ? s1 db 13,10, “Enter Number : $” s2 db 13,10, “Square is : $” .code mov ax, @data mov ds,ax mov ah,09h lea dx,s1 int 21h mov bx,0 read: mov ah,01h int 21h cmp al,0dh je next mov ah,0 sub al,30h push ax mov ax,10d mul bx pop bx add bx,ax jmp read next: mov ax,bx mov a,ax mul a push ax mov cx,0 mov ah,09h lea dx,s2 int 21h mov dx,0 mov bx,10d pop ax 11

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming display: mov dx,0 div bx push dx inc cx or ax,ax jnz display print: mov dx,0 mov ah,02h pop dx add dl,30h int 21h loop print mov ah,4ch int 21h end Screen print of program: C:\>MASM> PROGRAM NAME  Enter Number : 2 Square is : 4

12

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming 9th Program: 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. .model small .stack 100h .data s1 db 13,10, “Enter 1st Number : $” s2 db 13,10, “Enter 2nd Number : $” s3 db 13,10, ”Multiplication is : $” .code mov ax, @data mov ds, ax lea dx, s1 mov ah, 09h int 21h mov ah, 01h int 21h sub al, 30h mov bl,al lea dx, s2 mov ah, 09h int 21h mov ah, 01h int 21h sub al, 30h mul bl mov bl, al lea dx, s3 mov ah, 09h int 21h add bl, 30h mov dl, bl mov ah, 02h int 21h

13

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming mov ah, 4ch int 21h end Screen print of program: C:\>MASM> PROGRAM NAME  Enter 1st Number : 2 Enter 2nd Number : 3 Multiplication is : 6

14

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming 10th Program: 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. .model small .stack 100h .data s1 db 13,10, “Enter 1st Number : $” s2 db 13,10, “Enter 2nd Number : $” s3 db 13,10, ”Subtraction is : $” .code mov ax, @data mov ds, ax lea dx, s1 mov ah, 09h int 21h mov ah, 01h int 21h sub al, 30h mov bl,al lea dx, s2 mov ah, 09h int 21h mov ah, 01h int 21h sub al, 30h sub bl, al lea dx, s3 mov ah, 09h int 21h add bl, 30h mov dl, bl mov ah, 02h int 21h mov ah, 4ch 15

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming int 21h end Screen print of program: C:\>MASM> PROGRAM NAME  Enter 1st Number : 6 Enter 2nd Number : 3 Subtraction is : 3

16

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming 11th Program: 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. .model small .stack 100h .data s1 db 13,10, “Enter 1st Number : $” s2 db 13,10, “Enter 2nd Number : $” s3 db 13,10, ”Addition is : $” .code mov ax, @data mov ds, ax lea dx, s1 mov ah, 09h int 21h mov bx, 0 start1: mov ah, 01h int 21h cmp al,0dh jz next1 mov ah,0 sub al,30h push ax mov ax,10d mul bx pop bx add bx,ax jmp start1 next1: push bx lea dx,s2 mov ah,09h int 21h mov bx,0 start2: mov ah,01h int 21h cmp al,0dh 17

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming jz next2 mov ah,0 sub al,30h push ax mov ax,10d mul bx pop bx add bx,ax jmp start2 next2: pop ax add ax,bx push ax lea dx,s3 mov ah,09h int 21h pop ax mov cx,0 mov dx,0 mov bx,10d break: div bx push dx mov dx,0 inc cx or ax,ax jnz break push: pop dx add dl,30h mov ah,02h int 21h loop print mov ah,4ch int 21h end Screen print of program: C:\>MASM> PROGRAM NAME  Enter 1st Number : 26 Enter 2nd Number : 24 Addition is : 50

18

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming 12th Program: 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. .model small .stack 100h .data s1 db 13,10, “Enter 1st Number : $” s2 db 13,10, “Enter 2nd Number : $” s3 db 13,10, ” Subtraction is : $” .code mov ax, @data mov ds, ax lea dx, s1 mov ah, 09h int 21h mov bx, 0 start1: mov ah, 01h int 21h cmp al,0dh jz next1 mov ah,0 sub al,30h push ax mov ax,10d mul bx pop bx add bx,ax jmp start1 next1: push bx lea dx,s2 mov ah,09h int 21h mov bx,0 start2: mov ah,01h int 21h cmp al,0dh 19

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming jz next2 mov ah,0 sub al,30h push ax mov ax,10d mul bx pop bx add bx,ax jmp start2 next2: pop ax sub ax,bx push ax lea dx,s3 mov ah,09h int 21h pop ax mov cx,0 mov dx,0 mov bx,10d break: div bx push dx mov dx,0 inc cx or ax,ax jnz break push: pop dx add dl,30h mov ah,02h int 21h loop print mov ah,4ch int 21h end Screen print of program: C:\>MASM> PROGRAM NAME  Enter 1st Number : 100 Enter 2nd Number : 40 Subtraction is : 60

20

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming 13th Program: 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. .model small .stack 100h .data s1 db 13,10, “Enter 1st Number : $” s2 db 13,10, “Enter 2nd Number : $” s3 db 13,10, ”Multiplication is : $” .code mov ax, @data mov ds, ax lea dx, s1 mov ah, 09h int 21h mov bx, 0 start1: mov ah, 01h int 21h cmp al,0dh jz next1 mov ah,0 sub al,30h push ax mov ax,10d mul bx pop bx add bx,ax jmp start1 next1: push bx lea dx,s2 mov ah,09h int 21h mov bx,0 start2: mov ah,01h int 21h cmp al,0dh 21

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming jz next2 mov ah,0 sub al,30h push ax mov ax,10d mul bx pop bx add bx,ax jmp start2 next2: pop ax mul bx push ax lea dx,s3 mov ah,09h int 21h pop ax mov cx,0 mov dx,0 mov bx,10d break: div bx push dx mov dx,0 inc cx or ax,ax jnz break push: pop dx add dl,30h mov ah,02h int 21h loop print mov ah,4ch int 21h end Screen print of program: C:\>MASM> PROGRAM NAME  Enter 1st Number : 11 Enter 2nd Number : 11 Multiplication is : 121

22

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming 14th Program: 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. .model small .stack 100h .data s1 db 13,10, “Enter 1st Number : $” s2 db 13,10, “Enter 2nd Number : $” s3 db 13,10, ”Addition is : $” .code mov ax, @data mov ds, ax lea dx, s1 mov ah, 09h int 21h mov bx, 0 start1: mov ah, 01h int 21h cmp al,0dh jz next1 mov ah,0 sub al,30h push ax mov ax,10d mul bx pop bx add bx,ax jmp start1 next1: push bx lea dx,s2 mov ah,09h int 21h mov bx,0 start2: mov ah,01h int 21h cmp al,0dh 23

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming jz next2 mov ah,0 sub al,30h push ax mov ax,10d mul bx pop bx add bx,ax jmp start2 next2: pop ax div bx push ax lea dx,s3 mov ah,09h int 21h pop ax mov cx,0 mov dx,0 mov bx,10d break: div bx push dx mov dx,0 inc cx or ax,ax jnz break push: pop dx add dl,30h mov ah,02h int 21h loop print mov ah,4ch int 21h end Screen print of program: C:\>MASM> PROGRAM NAME  Enter 1st Number : 500 Enter 2nd Number : 50 Division is : 10

24

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming 15th Program: Write an assembly program to print A to Z. // an assembly program for print A to Z. .model small .stack 100h .data .code mov ax, @data mov ds, ax mov dl,”A” mov cx,26 again: mov ah,02h int 21h inc dl mov bx,0 mov bl,dl mov dl,” ” mov ah,02h int 21h mov dl,bl loop again mov ah,4ch int 21h end Screen print of program: C:\>MASM> PROGRAM NAME  ABCDEFGHIJKLMNOPQRSTUVWXYZ

25

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming 16th Program: Write an assembly program to calculate sum of series. // an assembly program for print sum of a series. .model small .stack 100h .data s1 db 13,10, “Input limit : $” s2 db 13,10, “Sum of series is : $” .code mov ax, @data mov ds,ax mov ah,09h lea dx,s1 int 21h mov bx,0 read: mov ah,01h int 21h cmp al,0dh je next mov ah,0 sub al,30h push ax mov ax,10d mul bx pop bx add bx,ax jmp read next: mov ax,bx mov cx,ax mov ax,0 again: add ax,cx loop again push ax mov cx,0 mov ah,09h lea dx,s2 int 21h 26

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming

mov dx,0 mov bx,10d pop ax display: mov dx,b div bx push dx inc cx or ax,ax jnz display print: mov dx,0 mov ah,02h int 21h pop dx add dl,30h int 21h loop print mov ah,4ch int 21h end Screen print of program: C:\>MASM> PROGRAM NAME Input limit : 5 Sum of series is : 15

27

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming 17th Program: Write an assembly program to determine largest number out of 3 numbers. // an assembly program for determine largest number out of 3 numbers. .model small .stack 100h .data a dw ? b dw ? c dw ? l dw ? s1 db 13,10, “Enter 1st no. : $” s2 db 13,10, “Enter 2nd no. : $” s3 db 13,10, “Enter 3rd no. : $” s4 db 13,10, “Largest no. is : $” .code mov ax, @data mov ds,ax mov ah,09h lea dx,s1 int 21h call getint mov a,bx mov ax,0 mov bx,0 mov ah,09h lea dx,s2 int 21h call getint mov b,dx mov bx,0 mov ax,0 mov ah,09h lea dx,s3 int 21h call getint mov c,bx mov bx,0 28

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming mov ax,0 mov ax,a cmp ax,b jl check_bc cmp ax,c jl mov_c mov l,ax jmp exit1 check_bc: mov ax,b cmp ax,c jl mov_c mov l,ax jmp exit1 mov_c: mov ax,c mov l,ax mov ax,0 mov bx,0 mov dx,0 exit1: mov ah,09h lea dx,s4 int 21h call disprint mov ax,0 mov ah,4ch int 21h getint proc mov bx,0 read: mov ah,01h int 21h cmp al,0dh je next mov ah,0 sub al,30h push ax mov ax,10d 29

Hirdesh Singh Rajput

MCA (I-sem.) Laboratory file of Assembly Language Programming mul bx pop bx add bx,ax jmp read next: ret getint endp disprint proc mov ax,l push ax mov dx,0 mov bx,10d pop ax mov cx,0 display: mov dx,0 div bx push dx inc cx or ax,ax jnz display print: mov dx,0 mov ah,02h pop dx add dl,30h int 21h loop print ret disprint endp end Screen print of program: C:\>MASM> PROGRAM NAME Enter 1st no. : 8 Enter 2nd no. : 6 Enter 3rd no. : 4 Largest no. is : 8

30

Hirdesh Singh Rajput

Related Documents

Assembly
November 2019 72
Assembly
May 2020 56
Assembly
November 2019 58
Assembly
August 2019 45

More Documents from ""