Allocate a 6byte array samples and a variable t sum in the R

Allocate a 6-byte array samples and a variable t sum in the RAM area of memory. Initialize the array, samples, with the signed integers. $10, $20. $30. $A0. $B0 and $C0. Write a program which computes the sum of the six integers in the array samples and stores the total sum in the variable t sum. The integers in samples are to be added to the register a from the first integer toward the last (6th) one. i.e.. using the register a as an accumulator. The variable t sum should be accessed only after the total sum is obtained. You are required to use all of the 4 addressing modes, i.e.. extended, constant offset indexed, register offset indexed and auto-increment/decrement indexed addressing modes. Your program should work correctly independent of the contents (integer values) of the array. The auto-increment/decrement indexed addressing mode should be used at least twice in a row. RAMStart = $0800 and ROMStart-$4000. Assemble the program and execute it in the single-step mode with the contents of samples and t sum displayed in the memory window. Do screen-captures (the source, register and memory windows) at each of the following instances: Right after each of the lst, 3rdh and 5th additions is completed and also right after the total sum is stored in t sum. Submit the list file of your code with the 4 sets of screen-captures attached. Also, record the 4 flags (N. Z, C. and V) right after each addition is performed and determine if and when an overflow occurs.

Solution

Here the program looks like

#include<stdio.h>
#include<conio.h>
void main() {
int Array[6];
int j,k, tsum = 0;
int *pointer;

printf(\"\ Enter 6 elements : \");

for (j = 0; j < 6; j++)
scanf(\"%d\", &Array[i]);

pointer = Array; /* a=&a[0] */

for (k = 0; k < 10; k++) {
tsum = tsum + *pointer;
pointer++;
}

printf(\"Sum of array elements : %d\", tsum);
}

 Allocate a 6-byte array samples and a variable t sum in the RAM area of memory. Initialize the array, samples, with the signed integers. $10, $20. $30. $A0. $B

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site