0% found this document useful (0 votes)
1 views

ICE 313 Lab-5(Subrata Roy)

Uploaded by

Shefali Islam
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)
1 views

ICE 313 Lab-5(Subrata Roy)

Uploaded by

Shefali Islam
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/ 8

Department of computer science engineering

Lab Report
Course Title: Microprocessor and Interfacing

Course code: ICE 313 (Lab)

Section:01

Experiment No: 05

Student Information
Name : Subrata Roy ID: 2020-1-50-038

Name: Shanjida Akter Priti ID 2019-2-50-006

Name: Sristi Paul ID: 2020-1-50-021

Name: Shanjida Sultan Shanta ID:2018-3-50-023

Name: Md. Shahriar Jubair ID: 2019-1-50-055

Submitted by: Submitted to:

Subrata Roy Rizwan Shaikh


Lecturer, Department of EEE
Date Of Submission: 21-08-2023

Experiment Name: ARM Assembly Functions and Stack Operations

Objectives: The main goal of the experiment is to educate students to how to construct a
function and call it from the main program, as well as the accompanying stack memory details,
utilizing ARM Assembly Codes for various practical modular applications.

Program #1
Code:
// R0 = a, R1 = b, R2 = a^b
.GLOBAL MAIN
MAIN:
MOV R0, #3
MOV R1, #5
PUSH {R0, R1}
BL POWER
MOV R2, R0
POP {R0, R1}
MOV R7, #1
SWI 0
POWER:
CMP R1, #0
BNE NZ
MOV R0, #1
B RET
NZ:
MOV R2, #1
MOV R3, R0
MOV R0, #1
FOR:
CMP R2, R1
BGT RET
MUL R0, R0, R3
ADD R2, R2, #1
B FOR
RET:
MOV PC, LR
Output:
Program #2
Code:
.global _start

_start: // R0 = n, R1 = n!

.GLOBAL MAIN

MAIN:

MOV R0, #7

MOV R1, #0

PUSH {R0}

BL FACT

MOV R1, R0

POP {R0}

MOV R7, #1

SWI 0

FACT:

CMP R0, #0

BNE NZ

MOV R0, #1

B RET

NZ:

MOV R2, #1

MOV R1, R0

MOV R0, #1

FOR:

CMP R2, R1

BGT RET

MUL R0, R0, R2

ADD R2, R2, #1


B FOR

RET:

MOV PC, LR

Output:
2. Develop an ARM function which takes two integer N and R as input and computes the
permutation (NPR) and combination (NCR) values as outputs. Test your function under a
suitable main function. Note that, you also have to consider the boundary conditions.
Code:
.global _start

_start:

.GLOBAL MAIN

MAIN:

MOV R0,#7

MOV R1,#0

PUSH {R0}

MOV R1,R0

POP {R0}

MOV R2,#1
SWI 0

COMB:

CMP R0,#0

BNE NZ

MOV R0,#1

B RET

NZ:

MOV R2,#1

MOV R1,R0

MOV R0,#1

FOR:

CMP R2,R1

BGT RET

MUL R0,R0,R2

ADD R2,R2,#1

B FOR

RET:

MOV PC,LR

Output:

You might also like