MES’s Wadia College of Engineering, Pune
SUBJECT: MICROPROCESSOR LAB (MPL)
NAME:
CLASS: SE COMP ROLL NO.:
SEMESTER: SEM-II YEAR: 2023-24
DATE OF PERFORMANCE: DATE OF SUBMISSION:
EXAMINED: Prof. G. B. Aochar
Assignment No-05
Title:- Count no. of positive and negative numbers
Assignment Name: - Write an ALP to count no. of positive and negative numbers from
the array.
Objective:-
● To understand the assembly language program
● To understand 64 bit interrupt.
Outcome:-
● Students will be able to write code for how to count positive and negative
number from array
● Students will be able to understand different assembly language instruction.
Prerequisite:-
System call of Unix for Assembly language Program.
Hardware Requirement-
Desktop PC
Software Requirement-
Ubuntu 14.04,
Assembler: NASM
version 2.10.07
Linker: ld
MPL Handouts Department of Computer Engg. 1
MES’s Wadia College of Engineering, Pune
Introduction:-
Write System Call
mov rax,1
mov rdi,1
mov rsi,%1
mov rdx,%2
syscall
Read System Call
mov rax,0
mov rdi,0
mov rsi,%1
mov rdx,%2
syscall
Compiling and Linking an Assembly Program in NASM
1. Type the above code using a text editor and save it as assignment1.asm.
2. Make sure that you are in the same directory as where you saved
assignment1.asm.
3. To assemble the program, type nasm -f elf64 assignment1.asm
4. If there is any error, you will be prompted about that at this stage.
Otherwise an object file of your program named assignment1.o will be
created.
5. To link the object file and create an executable file named assignment1,
type ld -o assignment assignment1.o
6. Execute the program by typing ./assignment1
Algorithm:
1. Start
2. Initialize section .data
3. Define variable for array, pcount, ncount
4. Count Positive and negative number using BT command.
5. Display counts
6. Terminate program using system call
6. Stop
Conclusion:- Hence we implemented an ALP to count positive and negative
number from array and display count.
Questions:-
1. Explain BT,JS,loop instruction with Example?
2. Explain Paging in 80386?
3. Draw control registers of 80386
MPL Handouts Department of Computer Engg. 2