Question

Write a program that finds the largest number among two numbers and store the result in...

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)

Homework Answers

Answer #1

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.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
1.Write pseudocode for a program that allows the user to input two numbers (X and Y)...
1.Write pseudocode for a program that allows the user to input two numbers (X and Y) and a code C. If the code has value 1, the program should output the larger of X and Y and otherwise output the smaller. Now convert your pseudocode to an assembly language program. Enter the program into the lab software assembler. Assemble the program and execute it with different input data. 2. Write pseudocode for a program that allows the user to input...
Write a simple ARM assembly language program that finds the mean (as an integer) of all...
Write a simple ARM assembly language program that finds the mean (as an integer) of all values of an integer array. When your program starts, you should assume that r0 contains the address of the array and r1 contains the number of integers in the array. When you program finishes, the mean should be stored in r2. You may use other registers as stack registers.
Write a C program Design a program that uses an array to store 10 randomly generated...
Write a C program Design a program that uses an array to store 10 randomly generated integer numbers in the range from 1 to 50. The program should first generate random numbers and save these numbers into the array. It will then provide the following menu options to the user: Display 10 random numbers stored in the array Compute and display the largest number in the array Compute and display the average value of all numbers Exit The options 2...
Write a program that reads in a table of numbers and finds out the average of...
Write a program that reads in a table of numbers and finds out the average of each row and column. This program should first take two numbers as number of rows and columns as input from the user.
Write an assembly language program that reverses all the bits of a 32-bit number. (Without using...
Write an assembly language program that reverses all the bits of a 32-bit number. (Without using RBIT instruction) Write an assembly language program that checks whether an unsigned number is perfect square or not.
python Write a program to find the largest value. Ask the user to enter three numbers....
python Write a program to find the largest value. Ask the user to enter three numbers. Compare them and report the largest one. [Hint: The user is free to enter any three numbers. Some or all of them may be the same. Take this into consideration when you compare the numbers.] The following are some examples. Enter first number: 7 Enter second number: 14 Enter third number: 10.5 The largest number is: 14.0 Enter first number: 17 Enter second number:...
PLEASE COMMENT CODE AND TEST THAT IT WORKS: Write a assembly program to find the largest...
PLEASE COMMENT CODE AND TEST THAT IT WORKS: Write a assembly program to find the largest item in an array and store it in a AX. Hint: Use both Jump and loop instruction to write the program. logic: Assume that the first item of the array is the minimum and store it in AX Write a loop. Inside the loop, compare the each array item with the AX If the array item is less than the AX, update AX with...
using a C++ code find the largest number from two numbers. also considering the case that...
using a C++ code find the largest number from two numbers. also considering the case that the two numbers are equal.
Write an ARM assembly language program that counts the number of 1’s for any value in...
Write an ARM assembly language program that counts the number of 1’s for any value in R0. The program must assemble/compile in KEIL and must be able to run in the KEIL simulator. Generally, R0 may contain any value, but for purpose of this exercise, you may move 0x2345ABCD into R0. The number in R0 does not need be preserved. You may use any other registers as you need. The result, total count of 1’s in R0, should be in...
Write a program that finds and prints all of the prime numbers between 3 and X...
Write a program that finds and prints all of the prime numbers between 3 and X (X is input from the user). A prime number is a number such that 1 and itself are the only numbers that evenly divide it (for example, 3, 5, 7, 11, 13, 17, …). One way to solve this problem is to use a doubly nested loop (a loop inside another loop). The outer loop can iterate from 3 to N while the inner...