amylyn7 0 Newbie Poster

I need to write a program that displays a single character in all possible combination of foreground and background colors (16x16 = 256). The colors are numbered from 0 to 15, so use a nested loop to generate all possible combinations. The character to be displayed should be obtained from the command line.

Here is my code, but it is definitely not close to being correct.

Thank you in advance for any help :)

INCLUDE Irvine32.inc

.data
colors   BYTE ?
ID       BYTE    "Lab 20", 0
.code
main PROC

	mov ecx, 16
	mov esi, offset colors
	mov eax, 0

L1:
         
	push ecx
	mov al, [esi]
	call SetTextColor
	call Writechar

	mov ecx, 16
	mov esi, offset colors

L2:
			      
	mov al, [esi]
	inc esi 
	call SetTextColor
	call Writechar
	            
	inc ebx
	loop L2

	inc esi
	pop ecx
	loop L1

	exit
main ENDP
END main
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.