Assembly Language Programming Assignment program must be in: MASM assembly language / x86 architecture / irvine library procedures Objectives:
1. using register indirect addressing
2. passing parameters
3. generating “random” numbers
4. working with arrays
Description: Write and test a MASM program to perform the following tasks:
1. Introduce the program.
2. Generate ARRAYSIZE random integers in the range [LO = 10 .. HI =
29], storing them in consecutive elements of an array. ARRAYSIZE
should be set to 200. HINT: Use Irvine’s “RandomRange” and
“Randomize” and code from the textbook/slides to generate each
random number.
3. Display the list of integers before sorting, 20 numbers per line
with two spaces between each value.
4. Sort the list in ascending order (i.e., smallest first). Do not
use any textbook-provided sorts.
5. Calculate and display the median value, rounded to the nearest
integer.
6. Display the sorted list, 20 numbers per line with two spaces
between each value.
7. Generate an array counts which holds the number of times each
value [10, 29] is seen in array. For example, counts[0] should
equal the number instances of the value ‘10’ in array. counts[14]
should equal the number of instances of the value ‘24’ in
array.
8. Display the array counts, 20 numbers per line with two spaces
between each value.
Requirements
1. The title, programmer's name, and brief instructions must be
displayed on the screen.
2. LO, HI,and ARRAYSIZE must be declared and used as global
constants.
3. Strings must be passed by reference.
4. The program must be constructed using procedures. At least the
following procedures are required:
A. main
B. introduction {parameters: string1 (reference), string2
(reference), ..)
C. fillArray {parameters: array (reference), LO (value), HI
(value), ARRAYSIZE (value)}
D. sortList {parameters: array (reference), ARRAYSIZE (value)} i.
exchangeElements (for most sorting algorithms): {parameters:
array[i] (reference), array[j] (reference), where i and j are the
indexes of elements to be exchanged}
E. displayMedian {parameters: array (reference), ARRAYSIZE
(value)}
F. displayList {parameters: someArray (reference), ARRAYSIZE
(value), someTitle (reference)}
G. countList {parameters: array (reference), ARRAYSIZE (value),
list (reference), LO (value), ...}
5. Parameters must be passed on the system stack by value or by
reference as noted above.
6. There must be just one procedure to display arrays. This
procedure must be called three times: once to display the unsorted
array, once to display the sorted array, and once to display
counts.
7. All lists must be identified when they are displayed (use the
title parameter for the displayList procedure).
8. Procedures (except main) should not reference .data segment
variables by name. request, array, counts, and titles for the
sorted/unsorted lists should be declared in the .data segment, but
procedures must have them passed by reference. Procedures may use
local variables when appropriate. Global constants must only be
used in main.
9. The program must use register indirect addressing for array
elements.
10. The program must be fully documented. This includes a complete
header block for the program (in your own words) and for each
procedure, and a comment outline to explain each section of
code.
11. The code and the output must be well-formatted.
Example: Sorting and Counting Random integers! Programmed by
Charles This program generates 200 random numbers in the range [10
... 29], displays the original list, sorts the list, displays the
median value, displays the list sorted in ascending order, then
displays the number of instances of each generated value.
Your unsorted random numbers:
11 24 18 19 26 10 19 15 11 20 16 21 21 19 24 18 12 10 19 20
12 13 13 21 13 21 15 20 28 24 28 14 16 20 28 21 29 24 11 19
24 13 22 19 20 10 12 13 13 15 13 26 27 24 17 17 27 21 21 18
15 15 24 25 13 17 26 27 29 27 27 15 29 18 20 21 23 20 12 13
22 15 19 20 22 18 13 16 20 22 15 23 18 22 12 29 18 18 12 24
20 14 16 14 18 18 14 22 18 11 12 21 15 16 21 21 29 13 26 16
17 15 13 21 10 20 12 24 28 10 18 18 19 28 20 26 23 15 16 16
13 22 28 24 24 12 23 15 24 12 18 24 22 15 19 23 13 27 16 24
29 15 24 28 18 23 28 21 16 23 22 10 24 12 20 16 25 17 25 12
23 22 18 15 23 16 13 24 12 13 24 24 14 15 19 13 25 18 28 13
List Median: 19
Your sorted random numbers:
10 10 10 10 10 10 11 11 11 11 12 12 12 12 12 12 12 12 12 12
12 12 12 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13
13 14 14 14 14 14 15 15 15 15 15 15 15 15 15 15 15 15 15 15
15 15 16 16 16 16 16 16 16 16 16 16 16 16 17 17 17 17 17 18
18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 19 19 19 19
19 19 19 19 19 19 20 20 20 20 20 20 20 20 20 20 20 20 20 21
21 21 21 21 21 21 21 21 21 21 21 21 22 22 22 22 22 22 22 22
22 22 23 23 23 23 23 23 23 23 23 24 24 24 24 24 24 24 24 24
24 24 24 24 24 24 24 24 24 24 25 25 25 25 26 26 26 26 26 27
27 27 27 27 27 28 28 28 28 28 28 28 28 28 29 29 29 29 29 29
Your list of instances of each generated number, starting with the
number of 10s:
6 4 13 18 5 16 12 5 17 10 13 13 10 9 19 4 5 6 9 6
Goodbye, and thanks for using my program!
The whole code is being answered using the C Programming Language. The complete code is given below with comments to help the student get better insights of the program.
#include <stdio.h>
#include<stdlib.h>
#include<time.h>// to use the rand() and srand() function
#define lo 10
#define hi 29
#define size 200
void fill_array(int a[],int l,int r,int n)
{
int i;
for(i=0;i<n;i++)
{
int num=(rand()%(r-l+1))+l;
a[i]=num;
}
}
void displayList(int a[],int n)
{
int i;
for(i=0;i<n;i++)
{
if(20%i==0)
printf("\n");
printf("%2d",a[i]);
}
}
void sortList(int a[],int n)
{
int i,j,swap;
for (i=0;i<n-1;i++)
{
for (j=0;j<n-i-1;j++)
{
if (a[j] > a[j+1])
{
swap = a[j];
a[j] = a[j+1];
a[j+1]= swap;
}
}
}
}
void displayMedian(int a[],int n)
{
int median=0;
// if number of elements are even
if(n%2 == 0)
median = (a[(n-1)/2] + a[n/2])/2;
// if number of elements are odd
else
median = a[n/2];
printf("\n The median of the given array is: %d",median);
}
void countList(int a[],int l,int h,int n)
{
int i,j=0,count=0;
int b[20]; //to store the count of elements occuring
int c=a[0];
for(i=0;i<n;i++)
{
if(a[i]==c)
{
count++;
}
else
{
b[j]=count;// to store the count of the first m similar elements at
the jth index
count=1;//to store the count of the next element wich has come now
so count=1 has been made
c=a[i];// store the next element for checking
j++;
}
}
displayList(b,20);
}
int main()
{
int a[size];// declaring array of size='200'
srand(time(0)); // using this function so that the list of random
numbers generated is different each time the code is executed
printf("\n Calling the fill array function:");
fill_array(a,lo,hi,size);
printf("\n The array before sorting is:");
displayList(a,size);
printf("\n Sorting the input array:");
sortList(a,size);
printf("\n Calculating the median of the given array:");
displayMedian(a,size);
printf("\n The sorted array is:");
displayList(a,size);
printf("\n Calculating and displaying the number of times an
element occured in the array:");
countList(a,lo,hi,size);
}
Assembly Language Programming Assignment program must be in: MASM assembly language / x86 architecture / irvine...
A soft drink manufacturer uses fire agents to handle premium distribution for is various products. The marketing director desired to study the timeliness with which the premiums are distributed. Twenty transactions for each agent were selected at random and the time lapse (in days) for handling each transaction was determined. The results follow: Agent 1 Agent 2 Agent 3 Agent 4 Agent 5 24 18 10 15 33 24 20 11 13 22 29 20 8 18 28 20 24...
After discussing the issue with you and others in the Finance department, the manager decided to change the payment terms for Accounts Receivable. The payment time remained at 14 days, but the penalty for late payments was increased. After about 3 months under the new payment terms, you asked the manager to collect a second stratified random sample. The data is presented in the second column of the worksheet (see the tab titled, “Data – Case #2) under the Heading...
1. You are the new data scientist for Fitbit. When viewing the Google Analytics account associated with the Fitbit website., you notice that the Average Time on Site is 82 seconds. - Describe 4 different ways you can provide context for this metric. - For the sub-activity, refer to the attachment below entitled, "Image_Module_11.jpg" (the image is also embedded within the text below). Imagine that you have created an email campaign designed to drive users to your site. The email...
1 A measurement systems experiment involving 20 parts, three operators, and two measurements per part is shown in Table 8E. 12. (a) Estimate the repeatability and reproducibility of the gauge (b) What is the estimate of total gauge variability? (c) If the product specifications are at LSL 6 and USIL - 60, what ca you say about gauge capa bility? TABLE 8E. 12 Measurement Data for Exercise 8.34 Operator 1 Operator 2 Operator 3 Measurements Measurements Measurements Part Number 1...
Therefore, for this program you will read the data in the file named weatherdata_2.txt into arrays for the wind speed and for the temperature. You will then use the stored data to calculate and output the average wind speed and the average temperature. Create a constant with a value of 30 and use that to declare and loop through your arrays and as a divisor to produce your averages. Here is the data file (below). 1. 14 25 2. 12...
Game Point_Differential Assists Rebounds Turnovers Personal_Fouls 1 15 15 38 11 9 2 36 20 43 8 13 3 16 21 29 7 13 4 45 22 46 11 11 5 12 11 40 7 22 6 -10 10 31 13 26 7 11 19 45 11 7 8 12 16 32 16 14 9 3 16 27 18 15 10 19 9 34 17 17 11 40 16 41 9 17 12 44 12 29 9 22 13 16 ...
Will give positive rating! AM/PM Method Assignment # 03: Calculate the early and late dates for the following activities, and create a bar chart. Assuming a Monday to Friday working week and the first activity starting on Dec 01 20XX. 1-Dec Activity A Activity B Activi Activity F Activity G 2 days da 3 da da 2 da Activity C Activity E 3 da 3 da SUNDAY MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY 2 4 Fulil Mocn NW 10 12...
A doctor discovers a particular disease and determines the life expectancy is not good. He gathers the data for his patents and posts it in the table below. The claims that the average life expectancy once the disease presents itself is less than 15 days. Check his claim and make an appropriate report about your findings Patient Days till passing Days -Patient # 1-24 2 -23 3 -13 4 -20 5 -10 6 -18 7 -13 8 -14 9 -24...
The computer-science aptitude score, x, and the achievement score, y (measured by a comprehensive final), were measured for 20 students in a beginning computer-science course. The results were as follows. x 3 15 19 14 21 22 14 21 20 15 17 18 7 5 4 19 17 12 18 13 y 19 19 24 36 27 26 25 28 17 27 21 24 18 18 14 28 21 22 20 21 (a) Find the equation of the line of...
For the data listed(assume sample). a.) Find the following: Mean Mode Median Midrange Range Quartiles Variance Standard Deviation BoxPlot b.) Create a frequency distribution When creating classes use the formula from the Notes on how classes to create. 17 23 14 16 12 26 20 22 14 15 22 18 18 21 21 19 15 21 18 17 15 25 14 30 16 10 20 12 16 17.44 16 14 15 20 20 16 17 16 15 15 19 48...