So right now I am attempting to code minesweeper for a class. The part that I am stuck on is attempting to update all the grid after a user clicks on a blank tile.
Unfortunately whenever I try to run my code it just crashes. Can anyone help?
whitespaceClick PROC uses eax ebx ecx esi edi
call convertXYval
mov GridValues[eax], 250
call updateSurroundings
mov edi, 0
call clearAroundArray
call fillAroundArray
cmp edi, 0 ;if no spaces around it
je done
mov ecx, 8
mov esi, 0
store:
cmp aroundArray[esi], 3
jne skp
mov bh, aroundArrayX[esi]
mov bl, aroundArrayY[esi]
push bx
skp:
inc esi
loop store
mov eax, 0
mov ecx, edi
update:
pop ax
mov X, ah
mov Y, al
call whitespaceClick
loop update
Done:
ret
whitespaceClick ENDP
Notes:
X and Y are variables of type BYTE that are used to keep track of the current location
convertXYval is a procedure that converts the x,y values into a single value that corresponds to the location in an array
fillAroundArray will fill an 8 element array with values (0,1,2,3) and also returns the number of spaces surrounding the current location in edi
whitespaceClick updates the surrounding values to numbers if they are touching bombs