Programming Assignment 2 Solution

$30.00 $24.90

Description

Instructions The objective of this assignment is to prepare your environment to program in assembly and write your first assembly program. When complete, you must have installed: 1) Windows, 2) Visual Studio IDE configured to compile assembly x86 programs, 3) a working sample *project (provided by the author of the textbook), and your first assembly *project.

*Project: for Visual Studio, a project is the set of files/programs needed to develop some application.

Objectives of this assignment:

  • to foster self-reliance to install development tools

  • to ultimately have a programming environment for the next modules

  • to install Visual Studio

  • to configure Visual Studio to develop programs in assembly

  • to test an existing Visual Studio project

  • to write and test a simple Visual Studio project

What you need to do:

You have three tasks:

  1. Install Windows (7 or later) if you do not have it

  1. Install Visual Studio (15 points):

  1. Read “How To Get Started

  1. Install the 32-bit Irvine.zip

  1. Install and run Project32 (10 points)

  1. Write and run your first assembly program

Install Visual Studio (15 points)

Download the file How2InstallVisualStudio.docx (available on Canvas) and follow it to install Visual Studio. If you succeed the installation, mention it in your report, otherwise contact the instructor to help you with the installation.

Read “How To Get Started

This page was posted by Kip Irvine, the author of your textbook (Seventh Edition of the Assembly Language for the x86 Processors). For this course, we will focus on writing, building, and running 32-bit programs. Ignore the sections : “Tutorial: Building and Running a 64-bit Program” and “Building 16-bit Programs (Chapters 14-17)

Install the 32-bit Irvine.zip

The file Irvine.zip is available online and on Canvas. This file contains libraries (needed to compile and execute example codes) and source of the example code described in the textbook. Make sure to expand Irvine.zip such that this folder has the path C:\Irvine.

Install and run Project32 (10 points)

The file Project32 is available online and on Canvas. Install and run Project32 which is a simple assembly program designed to initiate you to assembly and to test your programming environment. Read Sections 3.2.1 (Page 63) and 3.2.2 (Page 65): follow the directions to build, run, and debug the program. Use breakpoints to execute the program step by step. If successful, mention it in your report, otherwise contact your instruction for help

Write and run your first assembly program (15 points)

The objective of this exercise is to write your first assembly program. In order to complete this task, you will need to:

  1. Create a new project

  1. Modify the file main.asm to write your first assembly instructions

  1. Create a new project

The safest way to create a new project is to start from a working existing project. Your instructor prepared for you a template project. Always use this template project to start a new assignment. This template is posted in this assignment on Canvas. Download the zipped file TemplateProject.zip. Unzip the folder and open it. Double-click on the file Project.sln. This should open Visual Studio with the template project. Click on the file main.asm in the Solution Explorer window (top right window in Visual Studio). Build the project. If successful, open a command window and go to the directory containing the template project. Get in the directory Debug and execute Project (type Project at the command prompt and hit return). The program must print out “Hello World”.

  1. Modify the file main.asm to write your first assembly instructions.

For this phase, you should use the template project you built and ran above. Write a program to implement the following actions:

Set EAX to 0FFFDh

Increment EAX (use the instruction inc EAX) Increment EAX

Increment EAX

Set EAX to 0FFFDh

Increment AL (use the instruction inc AL) Increment AL

Increment AL

Build your program and debug it step by step and observe how the content of Register EAX varies. Discuss the new value of EAX after instruction. Were you expecting the final value (after the last instruction)? Explain it.

What you need to turn in:

  • Post on Canvas the following files:

    1. Electronic copy of your report (standalone)

    1. The source code main.asm (standalone)

    1. Your full project folder that will include your modified main.asm. This project folder must be named first named m3-name where name is your last name. Do not have spaces in the file names. After you correctly name the folder, zip it and post it on Canvas.

Your report must:

  • State whether your code works (this should not take more than a sentence). Failing to make this statement can be interpreted that your code does not work correctly and does not meet the requirements

  • Good writing and presentation are expected.

How this assignment will be graded:

Grading will depend on the degree of completion of these tasks: 1) Install Visual Studio (35 points), 2) Install and run Project32 (30 points), and 3) Write, build, run, and debug your first assembly program (35 points). For the last task, you must analyze the results of your first assembly program.