Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assembly Language MASM Assign PROC Use rotate instructions to put the correct foreground and background colors in the top half of the DWORD. This puts

Assembly Language MASM

Assign PROC

Use rotate instructions to put the correct foreground and background colors in the top half of the DWORD. This puts the color scheme for each letter grade in the top half of the DWORD holding the number and letter grade.

PrintColor PROC

Modifies existing print procedure to print the letter grade in color. Print letter grades in the following scheme ONLY:

As and Bs GREEN on a BLACK BACKGROUND

Cs in YELLOW on a BLACK BACKGROUND

Ds in BLACK on a YELLOW BACKGROUND

Fs in RED on a BLACK BACKGROUND

All numbers will be in the default color (LightGray on Black). You must return the color scheme to the default prior to exiting the program.

.asm file:

include irvine32.inc

.data

Grades dword 50 dup (0)

lenArray byte 0;

.code

main PROC

mov eax, 0

mov ebx, offset lenArray

call userInt

mov ebx, offset Grades

movzx ecx, lenArray

call FillArray

;// Call to your procedures go here

exit

main ENDP

;// procedures

userInt PROC

;// Desc: Gets an unsigned integer input from the user and places that

value in a variable

;// Receives: Offset of variable in EBX

;// Returns: Nothing

.data

promptUser BYTE " Please enter a number <= 50 : ", 0h

oops BYTE "Invalid Entry. Please try again.", 0h

.code

starthere:

call clrscr

mov edx, offset promptUser

call writestring

call readDec

cmp eax, 50d

ja tooBig

mov [ebx], eax

ret

tooBig:

mov edx, offset oops

call writestring

call waitmsg

jmp starthere

userInt ENDP

FillArray PROC

;// Desc: Fills an array with a randomly generated numbers in the range

50 - 100

;// Receives: Offset of a DWORD array in EBX

;// Length of the Array in ECX

;// Returns: Nothing

.code

mov esi, 1 ;// why is this 1? Hint: It's not a mistake

__________________________

call randomize

FillIt:

mov eax, 51d

call randomrange

add eax, 50d ;// what does this do? ______________________

mov[ebx + esi], eax

add esi, 4 ;// why can't we use TYPE here? _____________

loop FillIt

ret

FillArray ENDP

END main

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Guide To Client Server Databases

Authors: Joe Salemi

2nd Edition

1562763105, 978-1562763107

More Books

Students also viewed these Databases questions

Question

3. What are potential solutions?

Answered: 1 week ago

Question

Which team solution is more likely to be pursued and why?

Answered: 1 week ago