I was assigned to write a program that asks the user to enter an integer test score between 0 and 100. The program should display the appropriate Letter grade. I have already written this code. Now I have to run in a loop so multiple test scores can be entered. and then accumulate a counter of the number of test scores. I have no idea how to even begin this part. Here is my code:
jmp firstLine
;variables
prompt db 'Enter a grade from 0 to 100: '
promptLen = $-prompt
usergrade dw ?
gradeA db 'Your Letter grade is an A '
gradeALen = $-gradeA
gradeB db 'Your Letter grade is a B '
gradeBLen = $-gradeB
gradeC db 'Your Letter grade is a C '
gradeCLen = $-gradeC
gradeD db 'Your Letter grade is a D '
gradeDLen = $-gradeD
gradeF db 'Your Letter grade is a F '
gradeFLen = $-gradeF
firstLine:
mov si, offset prompt ;prompts the user for grade and reads it in
mov cx, promptLen
call putStrng
call getPos
mov usergrade,ax ;stores input to usergrade variable
call crlf
mov bx, 0
mov si, 0
mov ax,0
mov cx,5
LoopTop:
inc ax
mov ax, usergrade
cmp usergrade, 90
jb LetterB
mov si, offset gradeA
mov cx, gradeALen
call putStrng
Loop ExitOut
LetterB:
cmp usergrade, 80
jb LetterC
mov si, offset gradeB
mov cx, gradeBLen
call putStrng
Loop ExitOut
LetterC:
cmp usergrade, 70
jb LetterD
mov si, offset gradeC
mov cx, gradeCLen
call putStrng
Loop ExitOut
LetterD:
cmp usergrade,60
jb LetterF
mov si, offset gradeD
mov cx, gradeDLen
call putStrng
Loop ExitOut
LetterF:
mov si, offset gradeF
mov cx, gradeFLen
call putStrng
ExitOut:
mov ah, 04c
int 021
include ioSubs.inc