logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

Write and test a MASM program to perform the following tasks (check the Requirements

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Program Description

Write and test a MASM program to perform the following tasks (check the Requirements section for specifics on program modularization):

• Implement and test two macros for string processing. These macros should use Irvine's ReadString to get input from the user, and WriteString procedures to display output.

。 mGetString: Display a prompt (input parameter, by reference), then get the user's keyboard input into a memory location (output parameter, by reference). You may also need to provide a count (input parameter, by value) for the length of input string you can

accommodate and a provide a number of bytes read (output parameter, by reference) by the macro.

omDisplayString: Print the string which is stored in a specified memory location (input parameter, by reference).

• Implement and test two procedures for signed integers which use string primitive instructions

o ReadVal:

1. Invoke the mGetString macro (see parameter requirements above) to get user input in the form of a string of digits.

2. Convert (using string primitives) the string of ascii digits to its numeric value representation (SDWORD), validating the user's input is a valid number (no letters, symbols, etc).

3. Store this one value in a memory variable (output parameter, by reference).

WriteVal:

1. Convert a numeric SDWORD value (input parameter, by value) to a string of ASCII digits.

2. Invoke the mDisplayString macro to print the ASCII representation of the SDWORD value to the output.

• Write a test program (in main) which uses the ReadVal and WriteVal procedures above to:

1. Get 10 valid integers from the user. Your ReadVal will be called within the loop in main. Do not put your counted loop within ReadVal 2. Stores these numeric values in an array.

3. Display the integers, their sum, and their truncated average.

• Your ReadVal will be called within the loop in main. Do not put your counted loop within ReadVal

Program Requirements

1. User's numeric input must be validated the hard way:

a. Read the user's input as a string and convert the string to numeric form.

b. If the user enters non-digits other than something which will indicate sign (e.g. '+' or '-'), or the number is too large for 32-bit registers,

an error message should be displayed and the number should be discarded.

c. If the user enters nothing (empty input), display an error and re-prompt.

2. ReadInt ReadDec, WriteInt, and WriteDec are not allowed in this program.

3. Conversion routines must appropriately use the LODSB and/or STOSB operators for dealing with strings.

4. All procedure parameters must be passed on the runtime stack using the STDCall calling convention (see Module 7, Exploration 1 - Passing Parameters on the Stack). Strings also must be passed by reference.

5. Prompts, identifying strings, and other memory locations must be passed by address to the macros.

6. Used registers must be saved and restored by the called procedures and macros.

7. The stack frame must be cleaned up by the called procedure.

8. Procedures (except main) must not reference data segment variables by name. There is a significant penalty attached to violations of this rule. Some global constants (properly defined using EQU,=, or TEXTEQU and not redefined) are allowed. These must fit the proper role of a constant in a program (master values used throughout a program which, similar to HI and LO in Project 5).

9. The program must use Register Indirect addressing or string primitives (e.g. STOSD) for integer (SDWORD) array elements, and Base+Offset addressing for accessing parameters on the runtime stack.

10. Procedures may use local variables when appropriate.

11. The program must be fully documented and laid out according to the CS271 Style Guide. This includes a complete header block for identification, description, etc., a comment outline to explain each section of code, and proper procedure headers/documentation.

Notes

1. For this assignment you are allowed to assume that the total sum of the valid numbers will fit inside a 32 bit register.

2. We will be testing this program with positive and negative values.

3. When displaying the average, only display the integer part (that is, drop/truncate any fractional part).

4. Check the Course Syllabus for late submission guidelines.

5. Find the assembly language instruction syntax and help in the CS271 Instructions Guide↓

6. To create, assemble, run, and modify your program, follow the instructions on the course Syllabus Page's "Tools" tab.

 

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

553 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

664 Answers

Hire Me
expert
Husnain SaeedComputer science

938 Answers

Hire Me
expert
Atharva PatilComputer science

960 Answers

Hire Me

Get Free Quote!

408 Experts Online