Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Step 1: Create a new ASSEMBLY project using Keil Software (1)Make sure you use the M3 option (2)Make sure you name the folder COSC2440_Lab12_YourFirstName_YourLastName Step

Step 1: Create a new ASSEMBLY project using Keil Software (1)Make sure you use the M3 option (2)Make sure you name the folder COSC2440_Lab12_YourFirstName_YourLastName

Step 2: Copy the following template to your assembly file:

; Write Your Macro Here

AREA Lab_12_YourFirstName_YourLastName, CODE, READONLY

EXPORT __main

Array_1 DCD 3, -7, 2, -3, 10

Array_1_Size DCD 5

Array_1_Pointer DCD

Array_1

Array_2 DCD -8, -43, -3

Array_2_Size DCD 3

Array_2_Pointer DCD

Array_2

Array_3 DCD 9, 34, 2, 6, 2, 8, 2

Array_3_Size DCD 7

Array_3_Pointer DCD

Array_3

__main

; Call your macro here for Array 1 Data: Use R5 for Sum of the Array, Use R6 for the Average of the Array

; Call your macro here for Array 2 Data: Use R7 for Sum of the Array, Use R8 for the Average of the Array

; Call your macro here for Array 3 Data: Use R9 for Sum of the Array, Use R10 for the Average of the Array

stop B stop

END

Step 3: Replace the 1st highlighted section with your Macro. Write a macro that will calculate the sum of the array and the average of the array.

(1) You may use some or all of the following registers as temporary variables inside your macro: R0, R1, R2, R3, R4

(2) Your macro must have the correct needed input parameters and result registers. Inputs: Array Size and the Array Results: Sum of the array and the Average of the array

(3)I recommend that you first solve the problem without Macro, then create your macro.

(4)How to point to the array? You need to use LDR to point to the Array Pointer. Example (Of course, you will need to use your parameter names): LDR R0, Array_1_Pointer; Now R0 is pointing to the base address! LDR R1, Array_1_Size

Step 4: Replace the 2nd highlighted section with your 3 calls of your Macro.

1. You are NOT allowed to modify your main EXCEPT for the 3 lines that will call your macro.

2. You should pass the array parameter and not the actual array.

3. For the results, use the registers mentioned in the highlighted section. 4. How to pass the data to your Macro. You just need to pass the label name, Example: Array_1_Pointer, Array_1_Size

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions

Question

Find the Fourier transform of f(t) = cos 2 t[u(t) - u(t - 1)]

Answered: 1 week ago