Questions
Questions
Questions
ARCHITECTURE
LAB - 6
Nidhi Singh
PES1UG21C382
G-SECTION
.text
mov r10, #5
mov r1, #0
mov r2, #1
fib:
mov r1, r2
mov r2, r3
beq e
bal f
e:
mov r0, r3
mov r7, #1
swi 0x11
2) Implementation of ARM7TDMI code to find smallest and largest element in an array
.text
start:
mov r3, #5
mov r5, #0
mov r6, #0
loop:
cmp r3, #0
blt small
cmp r4, r6
bgt grt
bl loop
small:
ldr r2, =list
mov r3, #5
mov r5, #0
loop1:
cmp r3, #0
beq exit
cmp r4, r7
blt less
bl loop1
swi 0x11
less:
mov r7, r4
bl loop1
grt:
mov r6, r4
bl loop
exit:
swi 0x11
.data
list:.word 31,24,65,6,77
3) Implementation of ARM7TDMI code to find no.of 1’s & 2’s
.text
mov r2,#0x8800
check:movs r2,r2,lsr #1
bcs zero
add r0,r0,#1
b skip
zero:
add r1,r1,#1
skip:
cmp r2,#0
bne check
swi 0x11
.text
mov r0,#29
movs r0,r0,lsr #1
bcs nxt
ldr r0,=e
swi 0x02
swi 0x11
nxt:
ldr r0,=o
swi 0x02
swi 0x11
.data
e:.asciz"Even Number"
o:.asciz"Odd Number"