Question: I Wrote an assembly program that displays the same string in four different colors, using a loop. Call the Set- TextColor procedure from the books
I Wrote an assembly program that displays the same string in four different colors, using a loop. Call the Set- TextColor procedure from the books link library. Any colors may be chosen, but you may find it easiest to change the foreground color, but I don't get correct output. Please help me. this is my code;
INCLUDE Irvine32.inc INCLUDELIB Irvine32.lib
; these two lines are only necessary if you're not using Visual Studio INCLUDELIB kernel32.lib INCLUDELIB user32.lib
.data message BYTE "Hello World!",0 colorArray DWORD 0x01, 0x02, 0x04, 0x0E ; change foreground color
.code main PROC mov ecx, 4 ; loop counter mov esi, 0 ; index for color array
loopStart: call SetTextColor ; set text color mov eax, colorArray[esi] ; get current color call SetTextColor ; set current color
; display message mov edx, OFFSET message call WriteString
add esi, 4 ; increment color array index loop loopStart ; repeat loop
exit main ENDP
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
