Categories: Uncategorized

Assembly language programming

Programming Projects

There are four (4) Programming Projects to be completed as part of this course.

Don't use plagiarized sources. Get Your Custom Essay on
Assembly language programming
This is a Snippet Preview, get a Complete Solution Here
Order Essay

Submit your assembly language source code (.asm file) and screen shots that display your program’s successful execution (the output screen) together in a single file using “.ZIP” format (do NOT submit .rar files).  Screen shots should be in compressed “.JPG” format NOT in bitmap (“.BMP”) format.  Please refer to the Course Documents section for the instructions on how to package program submissions (aka zip files).

Each Project folder below contains the instructions for that Project and the place to submit your work.

Start early.  Do not wait until the last minute to begin working on any of the Programming Projects. Again – I am not a strict due-date enforcer but late assignments will be penalized – but I will not accept any programming projects after 10/11 (the course ends 10/15).

I will grade projects after the due date.

Upload the compressed file in “.ZIP” format using Blackboard. For example, to submit Project 1, click on the “Programming Project 1” folder below. Then click on “Submit Programming Project 1“. Click the “Browse My Computer” button to locate the compressed file you wish to submit. Then click on the “Submit” button. I will not accept projects through email.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

COSC 2425 – Programming Project 1

You will write a simple assembly language program that performs a few arithmetic operations. This will require you to establish your programming environment and create the capability to assemble and execute the other assembly programs that will be part of this course.

Your North Lake College student ID number is a 7-digit number. Begin by splitting your student ID into two different values. Assign the four most significant digits to a variable called ‘left’ and the three least significant digits to a variable called ‘right’.

You must choose the data type that is appropriate for the range of decimal values each variable can store. You will choose a data type when you define each of the variables in your program. Try to make efficient use of memory.

Calculate the sum of the two variables ‘left’ and ‘right’. Store this result in a variable called ‘total’.

Calculate the positive difference between the variables ‘left’ and ‘right’. Store this result in a variable called ‘diff’.

Define a character string called ‘message’ that contains the characters, “Hello World!”.

Define an array of data type WORD called ‘numbers’ that is initialized to the following values: 1, 2, 4, 8, 16, 32, and 64.

Write assembly language code using what you know so far (do not look ahead in the book just yet) to determine the length of ‘numbers’. Store this value in a variable called ‘arrayLength’.

Move the contents of the variable ‘left’ into the EAX register.

Move the contents of the variable ‘right’ into the EBX register.

Move the contents of the variable ‘total’ into the ECX register.

Move the contents of the variable ‘diff’ into the EDX register.

Move the contents of the variable ‘arrayLength’ into the ESI register.

 

Call the author’s DumpReg routine to display the contents of the registers.

Submit your assembly language source code and a screen shot of the output packaged as a single file in “.ZIP” format. Call your file “XYProject1.zip” where “X” and “Y” are your first and last initials respectively. If your name were John L. Smith, the file would be called, “JSProject1.zip”.

 

COSC 2425 – Project 2

Part 1

Implement the following C++ code fragment in assembly language. Use the block structured .IF and .WHILE directives. Assume that all variables are 32-bit integers.

int array[] = {3,1,4,1,5,9,2,6,5,3,5,8,9,7,9,3,2,3,8,4,6,2,6,4};

int lower = 4;

int upper = 9;

int ArraySize = sizeof array / sizeof lower;

int index = 0;

int sum = 0;

while( index < ArraySize )

{

if( array[index] >= lower && array[index] <= upper )

{

sum += array[index];

}

index++;

}

 

Your assembly language program must also display as output the number of times a member of ‘array’ qualified for inclusion into the ‘sum’ and what the final value of the variable ‘sum’ was. (Hint: you may have to add another variable.) Feel free to use the author’s procedures in the book’s link library. Use only the procedures that were introduced in chapter 5.

Part 2

Write an assembly language program that asks the user to enter an integer dollar amount between 1 and 3,000. Your program should display the corresponding class description using the following table. Write the program so that it executes until the user inputs some value that you determine to be the “sentinel value”. Your program must guard against and provide user messages for input values that are outside the valid range.

 

Donation Amount (dollars) Class of Donation
$2,000 and above Platinum
$1,500 to $1,999 Gold
$1,000 to $1,499 Silver
$500 to $999 Bronze
$1 to $499 Copper

 

 

COSC 2425 – Programming Project 3

 

Write an assembly language program that reads move review information from a text file and reports the overall scores for each movie as well as identifying the movie with the highest total score. There are four movie reviewers numbered from 1 to 4. They are submitting reviews for five movies, identified by the letters from “A” through “E”. Reviews are reported by using the letter identifying the movie, the review rating, which is a number from 0 to 100, and the reviewer’s identifying number. For example, to report that movie B was rated a score of 87 by reviewer 3, there will be a line in the text file that looks like this:

B,87,3

 

The fields within each record are separated from each other by a comma.

Your program must store the movie review scores in a two-dimensional array (4 rows by 5 columns). Each row represents a reviewer. Each column represents a movie. Initialize the array to zeroes and read the movie review information from a file. After reading and processing the whole file, display a report that shows the total score for each movie and the movie that had the highest total score.

 

Section 9.4 of our textbook discusses two-dimensional arrays. Section 9.4.2 discusses Base-Index Operands and even contains an example of how to calculate a row sum for a two-dimensional array.

Chapter 11 contains an example program named ReadFile.asm that will show you how to prompt the user for a file name, open a file, read its contents, and close the file when you are done. Look in section 11.1.8, Testing the File I/O Procedures.

Each record in a text file is terminated by the two characters, Carriage Return (0Dh) and Line Feed (0Ah).

Assume that you wish to process a text file named “reviews.txt” that is stored on the “C:” drive in the “Data” folder. If you are using a Windows computer, you have two ways to identify the path to the file’s location:

C:/Data/reviews.txt OR C:\\Data\\reviews.txt

Double backslash characters (\) are needed because a single backslash is defined as being the first part of an escape sequence such as newline (\n).

 

Instructions for Downloading reviews.txt

Instructions for Downloading reviews.txt

The file “reviews.txt” is a sample data file that will allow you to test your program before submitting it for grading.

1. Right click on the filename, “reviews.txt”.

2. Choose the “Save Link As…” option.

3. Identify the location on your computer where you wish to store the file.

4. Click on “Save”.

 

 

Sample data file

D,84,2

A,90,3

A,87,4

B,35,4

B,100,1

C,75,1

D,84,1

B,87,2

A,0,2

C,25,2

D,45,3

E,35,3

A,90,1

B,100,3

C,75,3

E,35,1

C,78,4

E,35,2

D,100,4

E,0,4

 

 

 

 

 

 

 

 

 

 

COSC-2425 Programming Project Four

One of the very practical uses of assembly language programming is its ability to optimize the speed and size of computer programs. While programmers do not typically write large-scale applications in assembly language, it is not uncommon to solve a performance bottle neck by replacing code written in a high level language with an assembly language procedure.

In this programming project you will be given a C++ program that generates an array of pseudorandom integers and sorts the array using the selection sort algorithm.

Your job is to write an assembly language procedure that also sorts the array of pseudorandom integers using the selection sort algorithm. The C++ program will time multiple repetitions of the sort performed by both the C++ code and your assembly language procedure. The C++ program will compare the result. If all goes as expected, your assembly language procedure should be faster than the C++ code.

Chapter 13 of your textbook contains a discussion of how to interface an assembly language procedure with a high-level programming language like C++.

The Visual Studio solution for the C++ program that you are given has been packaged and compressed into a file called “ProjectFour.zip”. Create a location on your computer for this project. Download the compressed file, “ProjectFour.zip”, and unpack it into that location in your computer.

Look in the unpacked folder for a file named “ProjectFour.sln”. The “.sln” file extension stands for solution. Double clicking on this file will start up the Visual Studio solution for ProjectFour and allow you to execute the C++ program.

Modify ProjectFour by following these steps:

1. Click on the project name, “ProjectFour” in the Solution Explorer pane.

2. Click on the “Project” choice in the menu bar at the top of the screen.

3. Select “Build Customizations”.

4. In the Visual C++ Build Customization Files dialog box, check the checkbox next to masm(.targets,.props). Choose OK to save your selection and close the dialog box.

5. On the menu bar, choose “Project”, then choose “Add Existing Item”.

6. In the Add New Item dialog box, select the file named “AsmSelectionSort.asm”. Choose Add to add the file to your project and close the dialog box.

Use Ctrl+F5 or click on “Debug” in the Menu Bar followed by “Start Without Debugging” to execute the program. The MASM assembler will assemble AsmSelectionSort.asm into an object file that is then linked into your project.

A “stub” assembly language procedure has been provided so that you can execute the C++ program to get a feel for how it works. Your job is to improve on the efficiency of the C++ compiled code by writing an assembly language procedure that is faster. Click on the file named “AsmSelectionSort.asm” in the Solution Explorer pane. This file is your starting point for creating an assembly language version of the selection sort routine.

As always, start small. DO NOT be the Cookie Monster and gobble up the whole project at once. Steps you might consider, but are not limited to are:

· Have your assembly language procedure return the number of elements in the array. This will tell you if what is being passed as an argument is the value you expected.

· Have your assembly language procedure return the value of the first element in the array. This will tell you if you understand how to address and retrieve the value of an element in the array.

· Have your procedure return the value of the second (or fifth) element in the array. This will tell you if you understand how to address and retrieve the value of a particular element in the array.

This project will provide you with the opportunity to:

· Link an assembly language procedure to an existing C++ program.

· Create an assembly language version of a C++ program.

· Demonstrate your ability to work with a one-dimensional array.

· Show that you can implement a while loop in assembly language.

· Demonstrate your ability to implement nested loops in assembly language.

· Display your understanding of what an assembly language procedure is and how they can be used.

· Provides a chance for you to show that you understand how to compare values and take conditional action based on the results.

· Observe how assembly language procedures can be used to optimize programs written in a high-level language like C++.

Note- there is one zip file for this project

How to package programming project?

How to Package Programming Projects

The Microsoft Visual Studio Integrated Development Environment (IDE) organizes the programs you write as “Projects”. Each project includes several different types of files. The IDE stores descriptive information and option settings for each program in the files kept in their “Project” folder.

When you are ready to submit your solution to a programming Project, package the folder as a compressed file in “.ZIP” format.

1. Locate the folder that contains the files associated with your programming Project. Look in the “Documents” folder for a folder called “Visual Studio 2012”. Within that folder is a folder called “Projects”. In this example, we are packaging the Hello World project.

2. Right click on the Project folder name. In this case HelloWorld.

3. Click on the “Send to” choice.

4. Click on the “Compressed (zipped) folder” choice.

2.

1.

3.

4.

 

5. This is your chance to override the name suggested by the operating system. The naming procedure for programming Projects is to precede the name of the zipped project file with your initials.

If your name was Joe E. Bagadonutz and you were submitting Project One, you would name the zipped file “JBProjectOne.zip”. The compressed file in “.ZIP” format is the file you will submit (upload) using Blackboard.

Your Instructor will unpack the zipped file and run your program to grade your work.

Include in your zip file:

· your project file

· your .asm file

· a screenshot of your output

Do not send a .rar file.

Phyllis Mugure

Recent Posts

Introduction to psychology | Assignments Market

ASSIGNMENT 08 S01 Introduction to Psychology I Directions: Be sure to save an electronic copy…

3 years ago

Education | Assignments Market

Include a comprehensive, thoughtful and critical analysis to the arguments and perspectives of the readings…

3 years ago

Session 2 Discussion | Assignments Market

Discussion Prompt: Plagiarism As a writer, one of the gravest errors to make is to…

3 years ago

CJL Writing Questions | Assignments Market

Question 1: Write a Hypothetical. Write a legal memorandum analyzing what happened in the following…

3 years ago

short HW all the questions below | Assignments Market

You work at Happy Joe's family restaurant and want to see if customer meal satisfaction…

3 years ago

321 solve … | Assignments Market

The Assignment must be submitted on Blackboard (WORD format only) via allocated folder. Assignments submitted…

3 years ago