Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Re-organize the following program ( you may need to add or delete a line/s of co

ID: 3604855 • Letter: R

Question

Re-organize the following program ( you may need to add or delete a line/s of code depending on the IDE you are using) so that the program displays the same string in four

different colors, using a loop. The program should Call the SetTextColor procedure

from the book's link library. Any colors may be chosen, but

you may find it easiest to change the foreground color.

POST COPYABLE SOURCE CODE AND PICTURE OF OUTCOME

** For best appearance, you may want to set your editor's Tab indent size to 5 **

!

INCLUDE Irvine32.inc

.code

main PROC

.data

str1 BYTE "This line is displayed in color",0

mov ecx,4                                                                          ; loop counter

                mov eax, black + (white * 16)    ; black on white backgrouund

               

L1:          call          SetTextColor

                mov       edx,OFFSET str1

                add        eax,2                                                                     ; add 2 to foreground color

                loop       L1

call          WriteString

                exit

END main

main ENDP

call          Crlf

Explanation / Answer

INCLUDE Irvine32.inc

.data

str1 BYTE "This line is displayed in color ",0dh,0ah,0

.code

main PROC

mov ax,yellow +(blue * 16)

call SetTextColor

mov edx,OFFSET str1

call WriteString

mov ax,white +(green * 16)

call SetTextColor

mov edx,OFFSET str1

call WriteString

mov ax,cyan +(light red*16)

call SetTextColor

mov edx,OFFSET str1

call WriteString

mov ax,magenta + (black *16)

call SetTextColor

mov edx,OFFSET str1

call WriteString

exit

main ENDP

END main

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote