$35
Program #1
Objectives
1. Introduction to MASM assembly language
2. Defining variables (integer and string)
3. Using library procedures for I/O
4. Integer arithmetic
Description
Write a MASM program to perform the tasks listed below. Test your program to ensure that it functions correctly.
1. Display your name and program title on the output screen.
2. Display instructions for the user.
3. Prompt the user to enter two numbers.
4. Calculate the sum, difference, product, (integer) quotient and remainder of the numbers.
5. Display a terminating message.
Requirements
1. The main procedure must be divided into sections:
introduction
get the data
calculate the required values
display the results
say goodbye
2. The results of calculations must be stored in named variables before being displayed.
3. The program must be fully documented. This includes a complete header block for identification, description, etc., and a comment
outline to explain each section of code.
4. Submit your text code file (.asm) to Canvas by the due date.
Notes
1. A program shell (template) is available on the course website. See the Week 1 Basics page in Modules.
2. You are not required to handle negative input or negative results.
3. You have a limited number of late days. Try not to use these on the first program.
4. To create, assemble, run, debug, and modify your program, follow the setup instructions available within Canvas on the Syllabus –>
Tools page.
5. Find the assembly language instruction syntax in the textbook.
6. Documentation for the Irvine library procedures is provided in the textbook.
Example Program Operation
Elementary Arithmetic by Wile E. Coyote
Enter 2 numbers, and I'll show you the sum, difference, product, quotient, and remainder.
First number: 37
Second number: 5
37 + 5 = 42
37 - 5 = 32
37 x 5 = 185
37 / 5 = 7 remainder 2
Impressed? Bye!
Extra Credit Options (original definition must be fulfilled)
1. (1 pt) Validate the second number to be less than the first.
2. (1 pt) Display the square of each number. Recall that the square of a number is obtained by mutiplying a number by itself. For
example:
Square of 37 = 1369
Square of 5 = 25
To ensure you receive credit for any extra credit options you did, you must add one print statement to your program output PER EXTRA
CREDIT which describes the extra credit you chose to work on. You will not receive extra credit points unless you do this. The statement
must be formatted as follows...
Program 1 Rubric
--Program Intro--
**EC: DESCRIPTION
--Program prompts, etc—
For example, for extra credit option #1:
Elementary Arithmetic by Wile E. Coyote
**EC: Program verifies second number less than first.
Enter 2 numbers, and I'll show you the sum, difference, product, quotient, and remainder.
First number: 7
Second number: 9
The second number must be less than the first!
Impressed? Bye!
Criteria Ratings Pts
1 pts
2 pts
2 pts
2 pts
Preliminaries - Files Correctly Submitted
Submitted file is correct assignment and is an individual .asm file.
1 pts
Full Marks
0 pts
No Marks
Preliminaries - Program assembles, links
Submitted program assembles and links without need for clarifying
work for TA and/or messages to the student. This assumes the
program is actually an attempt at the assignment. Non-attempts
which compile/link earn no points.
2 pts
Full Marks
0 pts
No Marks
Documentation - Identification Block - Header
Name, OSU Email, Course number, Program number, Date, etc as
per syllabus are included in Identification Block
2 pts
Full Marks
0 pts
No Marks
Documentation - Identification Block - Program Description
Description of functionality and purpose of program is included in
identification block.
2 pts
Full
Marks
1 pts
Lacking detail
Description is present but is lacking in detail with
regard to functionality.
0 pts
No
Marks
Criteria Ratings Pts
5 pts
1 pts
2 pts
1 pts
2 pts
Verification - Program Executes
Program executes and makes some attempt at the assigned
functionality.
5 pts
Full
Marks
2 pts
Failed attempt
Program is an
attempt at the correct
assignment but
simply does not run.
0 pts
Wrong Program
Program executes but is either the
incorrect program or some quickly
mashed together nonsense, submitted
only to 'get a few points'
Completeness - Displays programmer name
Program prints out the programmer's name.
1 pts
Full Marks
0 pts
No Marks
Completeness - Displays Introduction
Program displays the program introduction.
2 pts
Full Marks
0 pts
No Marks
Completeness - Prompts user to input data
Program outputs a data request to user e.g. "Enter a number" twice.
1 pts
Full Marks
0 pts
No Marks
Completeness - Gets data from user
Utilizes ReadDec or ReadInt, gets user-input data, and saves data
to some memory variable (non-register).
2 pts
Full Marks
0 pts
No Marks
Criteria Ratings Pts
2 pts
5 pts
2 pts
Completeness - Displays Results
Program displays results in the form of
(X + Y = M |
X - Y = N |
X * Y = O |
X / Y = Q remainder R)
2 pts
Full Marks
0 pts
No Marks
Correctness - Calculations are correct
Calculations are all correct. Lose 1 point per incorrect calculation
(Sum | Difference | Product | Quotient | Remainder)
5 pts
Full Marks
0 pts
No Marks
Correctness - Original User Data Unchanged
Original variables holding user-entered data (num1, num2) remain
unchanged by all calculations and still hold original user-entered
data at end of execution.
2 pts
Full Marks
0 pts
No Marks
Criteria Ratings Pts
5 pts
5 pts
5 pts
Requirements - Modularized Code Blocks
Main procedure is separated into functional sections, each of which
is described by comments.
5 pts
Blocks
with
Headers
3 pts
Blocks without
Headers
Program is
separated into
logical blocks but
those blocks are
poorly commented
3 pts
Headers without Blocks
Program is not visibly
separated into logical blocks
with whitespace, but limited
headers do indicate some
organizational effort.
0 pts
No
Marks
Requirements - Results stored in named variables
Results of calculations are stored in memory in discrete variables.
Lose 1 point per missing variable usage (Sum | Difference | Product
| Quotient | Remainder)
5 pts
Full Marks
0 pts
No Marks
Coding Style - In-line Comments
In-line comments and block headers describe functionality of
program flow. Should mirror the style guide image.
5 pts
Full Marks
0 pts
No Marks
Criteria Ratings Pts
3 pts
5 pts
0 pts
0 pts
Coding Style - Appropriately Named Identifiers
Identifiers named so that a person reading the code can intuit the
purpose of a variable, constant, or label just by reading its name.
3 pts
Full
Marks
1 pts
Partial
Some identifiers are named well, with others having no
relevance to their functionality.
0 pts
No
Marks
Coding Style - Readability
Program uses readable white-space, indentation, and spacing as
per the Indentation Style Guide. Logical sections are separated by
white space.
5 pts
Full
Marks
3 pts
Marginally Readable
Program is marginally readable but lacks proper
alignment and white space.
0 pts
No
Marks
Late Penalty
Remove points here for late assignments. (Enter negative point
value)
0 pts
Full Marks
0 pts
No Marks
No prohibited macros (see lecture 6) REJECT ASSIGNMENT
None of the assignments are allowed to use .IF, .IFELSE, or related
macros. Only actual assembly code.
0 pts
Full Marks
0 pts
No Marks
Total Points: 50
Criteria Ratings Pts
0 pts
0 pts
Extra Credit (1pt) - validate that num2 is less than num1
Assuming that num1 and num2 are non-zero positive integers, the
code must generate an error if num2 is greater than or equal to
num1.
0 pts
Full Marks
0 pts
No Marks
Extra Credit (1pt) - display mathematical square of the user's
numbers
The code displays the square value of the numbers that the user
entered (see assignment for explanation).
0 pts
Full Marks
0 pts
No Marks