This is Assembly Language using Visual Studio 15 MASM Re-organize the following
ID: 3593580 • Letter: T
Question
This is Assembly Language using Visual Studio 15 MASM
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.
** 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
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.