Write a simple program in a high-level language of your choice (C, C++, or Java), that contains an (if-else) condition. Convert the program into assembly language that uses branch instructions we discussed in class.
Added by Katrina B.
Step 1
Sure! Let's go through the steps to create a simple program in Java that contains an if-else condition, and then convert it into assembly language. Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 70 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write a C/C++ program that does the following: - In the C++ program, declare an array of integers (size is your choice) -- your program should work with any array size. - Call an assembly function to compute the average of all elements in the array (pass the array and the size of the array). - Call an assembly function to compute the largest (max) of all elements in the array (pass the array and the size of the array). - Call an assembly function to compute the smallest (min) of all elements in the array (pass the array and the size of the array). - Display the average, min, and max in the C++ program. There should be three assembly files for the three functions.
Akash M.
Procedure: The objective of this lab is to understand and demonstrate the data-processing assembly instructions that are described in Section 6.3. Write an assembly language program that executes all of the following: Arithmetic Instructions: Source registers R1: 0100 0110 1010 0001 1111 0001 1011 0111 R2: 1111 1111 1111 1111 0000 0000 0000 0000 Assembly code: ADD R3, R1, R2 Result: SUB R4, R1, R2 Result: Logical Instructions: Source registers R1: 0100 0110 1010 0001 1111 0001 1011 0111 R2: 1111 1111 1111 1111 0000 0000 0000 0000 Assembly code: AND R3, R1, R2 R3 ORR R4, R1, R2 R4 EOR R5, R1, R2 R5 BIC R6, R1, R2 R6 MVN R7, R2 R7 Result: Shift Instructions: Source register: R5 1111 1111 0001 1100 0001 0000 1110 0111 Assembly Code: LSL RO, R5, #7 RO LSR R1, R5, #17 R1 ASR R2, R5, #3 R2 ROR R3, R5, #21 R3 Result:
Supreeta N.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD