-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathColor_Matrix_Nested_Loop3.asm
52 lines (38 loc) · 1.05 KB
/
Color_Matrix_Nested_Loop3.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
TITLE Color Matrix Nested Loop (main.asm)
COMMENT !
Student: Rachel Nguyen
Class: CSCI 241
Instructor: Ding
Assignment: Ch05, Color_Matrix_Nested_Loop
Due Date: 3/02/21
Description:
This program displays a single character in all possible combinations of foreground and background colors with AL: BKGD|FRGD.
!
INCLUDE Irvine32.inc
DELAYTIME = 800
.data
count DWORD ?
.code
main PROC
mov ecx, 16 ; set outer count loop
mov ebx, 0 ; initalize EBX to black on black
L1:
mov count, ecx ; save outer loop count
mov ecx, 16 ; set inner loop count
L2:
mov eax, ebx ; save color to EAX to call SetTextColor
call SetTextColor
mov al, "X" ; pass char to AL to call WriteChar
call WriteChar
inc ebx ; update new color
loop L2 ; end of columns
mov eax, DELAYTIME ; initalize EAX to call Delay
call Delay
call crlf ; add newline
mov ecx, count ; set outer loop count
loop L1 ; end of rows
mov al, 0Fh ; black on white
call SetTextColor ; restore default color
exit
main ENDP
END main