Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

in assembly langauge ( using kip irvine\'s 7th edition) : Create a procedure nam

ID: 3813866 • Letter: I

Question

in assembly langauge ( using kip irvine's 7th edition) :

Create a procedure named CalcGrade that receives an integer value between 0 and 100, and

returns a single capital letter in the AL register. Preserve all other register values between calls to the procedure. The letter returned by the procedure should be according to the following

ranges:

Score 90 to 100 Grade A

Score 80 to 89 Grade B

Score 70 to 79 Grade C

Score 0 to 69 Grade F

Write a test program that generates 10 random integers between 50 and 100, inclusive. Each

time an integer is generated, pass it to the CalcGrade procedure. You can test your program

using a debugger, or if you prefer to use the book’s library, you can display each integer and its

corresponding letter grade. (The Irvine32 library is required for this solution program because it

uses the RandomRange procedure.)

Explanation / Answer

.MODEL SMALL .DATA VAL1 DB ? NL1 DB 0AH,0DH,'ENTER HOW MANY NO U WANT:','$' NL2 DB 0AH,0DH,'ENTER NO:','$' NL3 DB 0AH,0DH,'AVEARGE:','$' .CODE MAIN PROC MOV AX,@DATA MOV DS,AX LEA DX,NL1 MOV AH,09H INT 21H MOV AH,01H INT 21H SUB AL,30H MOV CL,AL MOV BL,AL MOV AL,00 MOV VAL1,AL LBL1: LEA DX,NL2 MOV AH,09H INT 21H MOV AH,01H INT 21H SUB AL,30H ADD AL,VAL1 MOV VAL1,AL LOOP LBL1 LBL2: LEA DX,NL3 MOV AH,09H INT 21H MOV AX,00 MOV AL,VAL1 DIV BL ADD AX,3030H MOV DX,AX MOV AH,02H INT 21H MOV AH,4CH INT 21H MAIN ENDP END MAIN