Write a program that finds the largest number among two numbers and store the result in any register.
Value1: 0x18345678 (hexidecimal)
Value2: 0x15678245 (hexidecimal)
(Code in ARM assembly language, Using Keil software)
ARM Program to find largest number among the two Numbers.
AREA MAX, CODE, READONLY ENTRY.
START
LDR R0, NUMBERS // load address of first numbers to be compared in register R0
MOV R2, # & 02 // number of values to be compared
EOR R1, R1, R1. // clear register R1
LOOP 1
LDR R3, [RO] // load number
CMP R3, R1 // compare numbers
BCC LOOP2 // Branch if carry is clear
MOV R1, R3 // move register R3 to R1
LOOP 2
ADD RO, RO, #4
SUBD R2, R2, #1
BEN LOOP1
LDR R4= RESULT
STR R1, [R4]
OVER B OVER
AREA ANSWER, READWRITE
NUMBER DCD & 18345678,& 15678245
RESULT DCD 00.
END.
Get Answers For Free
Most questions answered within 1 hours.