Hi I keep getting an error when trying to assemble and run my code and would like to know why. It says there is a syntax error in line 21 and "directive must be in control block" error in line 23. The program is supposed to write a square made up of alternating blue and white vertical bars, as such |. This is my exact hw exercise:
Write a test program that uses INVOKE to call WriteColor-
Char, and displays a color square (10 rows by 20 columns) with alternating pairs of blue and white vertical bars. Call a separate procedure when printing each row of the square.
This is my code so far (I couldn't think of another way to implement this program so I just did a bunch of IF statements for the alternating):

INCLUDE Irvine32.inc


	bluec DWORD 1
	whitec DWORD 15
	letter DWORD '|'
	WriteColorChar PROTO,l1:DWORD,bc:DWORD,wc:DWORD

main PROC

	INVOKE WriteColorChar,letter,bluec,whitec
main ENDP

WriteColorChar PROC,l1:DWORD,bc:DWORD,wc:DWORD
	mov edx,0
	.WHILE edx < 19
	.IF (ecx=0) || (ecx=2) || (ecx=4) || (ecx=6) || (ecx=8) || (ecx=10) || (ecx=12) || (ecx=14) || (ecx=16) || (ecx=18)
	mov eax,bc
	mov eax,wc
	call SetTextColor
	mov eax,0
	mov eax,l1
	call Row1
	add edx,1
	call crlf
	; next row and so on
WriteColorChar ENDP

	call WriteChar

END main
5 Years
Discussion Span
Last Post by datdude07

Uh, = is not equals it should be 2 equal signs == as in (ecx == 0) || (ecx == 2) etc...

The funny thing with macros (yes .if/.while are macros) is the error number will happen after the macro call...

Votes + Comments
great help!

wow totally forgot about that thanks! hey when i run the code all the vertical bars come out blue is there something wrong that i did on my while loop or if statements? Thanks again.


nvm just noticed that I had ecx in the .if statement instead of the edx register which is whats keeping track of the number. Thanks again though you really are a great help!


hey how do i give credit or plus 1 to you? you really have helped me out every time i post here.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.