Write a program that displays the same string in four different colors,using a loop. Call the SetTextColor procedure.Any color may be chosen, but you may find it easiest to change the forground color.
Include irvine32.inc
.data
Str BYTE “This is the string”, 0
Color BYTE red,yellow,blue,cyan
.code
Main PROC
Mov ecx,4
Mov edx,OFFSET color
L1:
Mov eax,color+(black*16) ;4 different colors on black background
Call SetTextColor
Call prompt
Call crlf
Inc color
Loop L1
Exit
Main ENDP
;------------------------------------
Prompt PROC USES edx
;------------------------------------
Mov edx,OFFSET str
Call WriteString
Ret
Prompt ENDP
END main
My question is: Can I write the statement ,
Inc color
like this?
I have a slight confusion in it.