-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQUIZ5.asm
112 lines (102 loc) · 1.73 KB
/
QUIZ5.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
TITLE QUIZ5.asm
INCLUDE Irvine32.inc ;//Includes the Irvine32 library of functions
move textequ <mov>
.data
prompt1 BYTE "Array Generation Complete...", 0;
fillArr BYTE ?;
.code
;//=======================================
randNum proc;
mov EAX, 50;//Set the max value of 50
call RandomRange;//Do random stuff
add EAX, 50;//Add 50 to put in 50-100 range
ret;
randNum endp;
;//=======================================
;//=======================================
AlphaGrade proc;
mov ESI, 0;
mov EAX, 0;
mov ECX, 20;
L1:
push ECX;
mov AH, [fillArr + ESI];
cmp AH, 60;
JL F1;
cmp AH, 70;
JL D1;
cmp AH, 80;
JL C1;
cmp AH, 90;
JL B1;
JGE A1;
F1:
mov AL, 'F';
JMP CMP1;
D1:
mov AL, 'D';
JMP CMP1;
C1:
mov AL, 'C';
JMP CMP1;
B1:
mov AL, 'B';
JMP CMP1;
A1:
mov AL, 'A';
JMP CMP1;
CMP1:
call PrintGrade;
add ESI, 1;
pop ECX;
loop L1;
ret;
AlphaGrade endp;
;//=======================================
;//=======================================
PrintGrade proc;
mov EDX, 0;
mov BL, AL;
mov AL, AH;
mov AH, 0;
call WriteInt;
mov CH, 21;
sub CH, CL;
mov DH, CH;
mov DL, 8;
call Gotoxy;
mov AL, BL;
call WriteChar;
mov DL, 0;
add DH, 1;
call Gotoxy;
ret;
PrintGrade endp;
;//=======================================
;//=======================================
genArray proc;
push ECX;
mov ESI, 0;
mov ECX, 20;
L1:
push ECX;
call randNum;
mov [fillArr + ESI], AL;
add ESI, 1;
pop ECX;
loop L1;
pop ECX;
mov EDX, OFFSET prompt1;
call WriteString;
call CRLF;
ret;
genArray endp;
;//=======================================
main proc;//All you must do is change the set values for ESI and ECX, EG: change to testArray1(book array)
call Randomize;
call genArray;
call AlphaGrade;
call WaitMsg;
exit
main endp
end main