I'm having a problem in program trying to access pieces of an array. My array is declared as:

mapping DB 7,0,8,1,9,2,4,3,5,4,6,5,1,6,2,7,3,8

The procedure that uses the function is:

infloop:
	_GetCh noecho
	cmp	al, '@'
	je gameEnd
playerGoes:
	mov si, 0
playerLoop:
	cmp al, [mapping + si]
	add si, 2
	jne playerLoop
	mov si,  OFFSET [mapping + 1]		
	
	mov 	[board + si], 'x'
	call	dboard
	jmp infloop
	mov PlayerTurn, 1
	call    dboard

I get no errors when compiling, but nothing shows up on the game board (I'm making a Tic-Tac-Toe game). What I'm trying to do is map the Num Pad to the elements of the board array. For example, board is the top left box. Board + 1 is the top middle box and so on.

Watch your condition flags. ADD modifies the flags register just as much as CMP does. So you only loop above if SI is not zero...

Also, the last two lines never get called...

Hope this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.