954,479 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Arrays

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.

tiki_master
Newbie Poster
2 posts since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

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.

Duoas
Postaholic
2,043 posts since Oct 2007
Reputation Points: 1,140
Solved Threads: 229
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You