Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Assembly Expert

Assignment 1: - Conditional Processing

I have a small program that calculates your grades based on the number of points you accumulate over the entire semester. Let's create that program in this lab assignment.

If you look in the syllabus, this class grades are based on the number of points as follows:

Create a program that will ask the user how many students are in the class. There should be no more than 30 students. Verify that, indeed, the user entered up to 30 students. If he did, go further. If not, display a message that says that only 30 students are allowed in the class and jump back to the question of how any students.

Create a table that will display a header "Student ID", "Points", "Grade" as in the example below. Assign a 5 digit Student ID, starting with 00001. Going through each student id, one by one, use the random procedure to generate a random number of points from 300 to 1000. (We assume that a student will get at least 300 points in a semester). For each student, call a procedure CalculateGrades that will take the number of points and output the corresponding letter.

CalculateGrades Procedure

CalculateGrades uses the EAX register to get the number of points, and outputs the character in AL. Create a procedure header made with comments, that has 3 lines: First line a short description, second line RECEIVES:, third line RETURNS: where you write the registers used.

Note: You have an example of such a position header in your textbook, page 229, SetCursorPosition Example.

RandomRange PROC

Generates an unsigned pseudo-random 32-bit integer in the range of 0 through (n-1).

Call args: EAX = n, the range

Return arg: EAX = random (0 to n-1)

Example: Get a random number from 1 to 100  .data ranNum DWORD ?

.code

mov eax,100 ;get random 0 to 99

callRandomRange ;

inceax ;make range 1 to 100

movranNum,eax ;save random number

To generate a 32-bit random number, use the Random32 Procedure:

Random32 PROC

Generates an unsigned pseudo-random 32-bit integer in the range of 0 through FFFFFFFFh.

Call args: None

Return arg: EAX = random (0 to FFFFFFFFh)

Example:

.data ranNum DWORD ?

.code

call Random32

movranNum,eax ;save

Randomize PROC

Re-seeds the random number generator with the current time in hundredths of seconds.

Call args: None

Return arg: None

Example:

call Randomize ;re-seed generator

Requirements

• Make sure you use the stack this time. You should save all the registers you use before using them inside a procedure.

• Do not use conditional directives.

• Your random numbers should not be below 300, and should be able to reach 1000.

• Do not allow more than 30 students to be listed.

• The leading zeros have to be 4 for single digit numbers and 3 for double digit numbers to be consistent with a 5 digit ID.

• Don't forget to Randomize at the beginning of the program! Otherwise, every time you run the program you will have the same generated numbers.

Assignment 2:

Create a project. Take a look at the code ArryScan.asm shown in your textbook Section 6.3.4. Using ArrayScan.asm as an example, write the following project:

Ask the user to input the number of elements of a character array (less than 50 elements). Ask the user to enter a character that he wants to search in the array. Then ask him to input the characters one by one to fill the array. For this use indirect addressing.

Then your program has to search for the desired character in your array. Again, use indirect addressing. If the character is found, display the following message:

"Found the character x at position y in the array." Careful with the position count. The array starts from zero. ts from zero.

Of course, replace x and y with the corresponding character/number.

If it is not found display:

"The character was not found."

Here is an example:

and

Read the text and make sure you understand the code. Write a comment for each line of code you add to the project.

Verify it builds and runs, archive it and upload it in the Student Submissions area.

Assembly, Programming

  • Category:- Assembly
  • Reference No.:- M91417736
  • Price:- $100

Guranteed 48 Hours Delivery, In Price:- $100

Have any Question?


Related Questions in Assembly

Task 1using masm sdk write an assembly language program

TASK 1 Using MASM SDK, write an assembly language program which converts an integer inputted via the console to binary. Your program should be well commented and well formatted. TASK 2 Using MASM SDK, write an assembly l ...

Really need to find a correct answer to this questionwrite

Really need to find a correct answer to this question: Write a MIPS assembly program that can search for a number that is entered by a user in an array with 20 integer number. Make sure it also prints the index of the ar ...

Question a sequence string of one-byte ascii characters is

Question : A sequence (string) of one-byte ASCII characters is stored at memory location $600 onward. A second sequence of equal length is stored at memory location $700 onward. Each sequence ends with the character $0 ( ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As