Write a program that draws an 8 x 8 chessboard, with alternating gray and white
ID: 3539034 • Letter: W
Question
Write a program that draws an 8 x 8 chessboard, with alternating gray and white squares. You can use the SetTextColor and Gotoxy procedures from the Irvine32 library. Avoid the use of global variables, and use declared parameters in all procedures. Use short procedures that are focused on a single task.
Please note that this must be written using Irvine32. For example:
INCLUDE Irvine32.inc
.data (data variables/members go here)
.....................
.....................
.code
main PROC (main code goes here)
.....................
.....................
main ENDP
END main
Explanation / Answer
TITLE Chess Board INCLUDE Irvine32.inc .data text BYTE "___" loopCnt DWORD 8 .code main PROC mov ecx, 8 L1: mov eax, gray mov eax, ecx call setTextColor mov edx, OFFSET text call writeString mov eax, black mov eax, ecx call setTextColor mov edx, OFFSET text call writeString loop L1 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.