- Uncategorized

Smallest of N numbers ARM Assembly Code

ARM Assembly Code to find smallest of N numbers and store value in memory 

This code is tested in Keil uVision 4. Developed for ARM LPC2148 by Abhay Kagalkar 

ARM Code :

;/*Program to find smallest of N numbers*/
;/* By Abhay Kagalkar*/
AREA arr,code
ENTRY
main
ldr r0,=data1
ldr r3,=0x40000000
ldr r4,=0x05 ;//length of loop
ldr r1,[r0],#04
sub r4,r4,#01
back
ldr r2,[r0]
cmp r1,r2
bls less ;// branch on low
mov r1,r2
less
add r0,r0,#04
sub r4,r4,#01
cmp r4,#00
bne back
str r1,[r3] ;// smallest value stored in memory location
stop b stop
data1 dcd &64,&05,&96,&10,&65
END

Output Pic :


Download Code:

 To Download the Code click on the link below:

Download




Leave a Reply