0% found this document useful (0 votes)
6 views4 pages

Program

The document contains several assembly-level language programs that demonstrate various functionalities including finding odd/even numbers in an array, sorting array elements, calculating the sum of natural numbers, finding the largest number in an array, and performing basic arithmetic operations. Each program is structured with specific instructions and labels to achieve its intended task. The examples illustrate fundamental programming concepts in assembly language.

Uploaded by

suzannesha18rma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

Program

The document contains several assembly-level language programs that demonstrate various functionalities including finding odd/even numbers in an array, sorting array elements, calculating the sum of natural numbers, finding the largest number in an array, and performing basic arithmetic operations. Each program is structured with specific instructions and labels to achieve its intended task. The examples illustrate fundamental programming concepts in assembly language.

Uploaded by

suzannesha18rma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

1.

Assembly level language program to find ODD/EVEN number in an


array
ORG 0000h //Clear
MOV R0,#50H //
MOV R1,#05H
HERE: MOV A,@R0
RRC A
JC LOOP
INC R4
INC R0
DJNZ R1,HERE
SJMP LABEL1
LOOP: INC R3
INC R0
DJNZ R1,HERE
LABEL1: MOV 40H,R3
MOV 41H,R4
END

2. Assembly-level language program to sort array elements in ascending


order

ORG 0000H
MOV R3, #05H
HERE: MOV R0, #50H
MOV R1, #05H
LABEL2: MOV A, @R0
INC R0
MOV B, @R0
CJNE A, B, LABEL
LABEL: JC LABEL1
MOV @R0,A
DEC R0
MOV @R0,B
INC R0
LABEL1: DJNZ R1, LABEL2
DJNZ R3, HERE
END

3. Assembly-level language program for sum of n natural numbers


(n=10)

ORG 00H
MOV A, #00H
MOV R0,#0AH
MOV B, #01H
REPEAT: ADD A,B
INC B
DJNZ R0, REPEAT
MOV 40H, A
END

4. Assembly-level language program for finding largest number in an


array
ORG OOH
MOV R0,#05H
MOV R1,#30H
MOV 40H,@R1
UP: INC R1
MOV A,@R1
CJNE A,40H,D1
D1: JC D2
MOV 40H,@R1
D2: DJNZ R0,UP
END

5. Assembly-level language program for Arithmetic calculator

ORG OOH
MOV A, #05H
MOV B,A
MOV A, #08H
ADD A,B
MOV R0,A
END

ORG OOH
MOV A, #05H
MOV B,A
MOV A, #08H
SUB A,B
MOV R1,A
END

ORG OOH
MOV A, #05H
MOV B,A
MOV A, #08H
MUL AB
MOV R2,A
END

ORG OOH
MOV A, #05H
MOV B,A
MOV A, #08H
DIV AB
MOV R3,A
END

You might also like