I'm getting segmentation faults after user input. Here's some code:
SECTION .data
formatd db "%d",0
array db 0,1,2
array1 db 3,4,5
array2 db 6,7,8
SECTION .bss
usrPick: resb 1
SECTION .text
push usrPick ; get users pick from input
push formatd
call scanf
add ESP, 8
mov EAX, usrPick
cmp EAX, byte 2 ;see if usr picked from row1
jg l2 ; if not jump
; ---usr picked from row1---
mov esi, eax ; put usrPick in esi
cmp byte[array + ESI], 'X' ; chk if X is there
je invalid ; if X then invalid
jne xmov ; is not X jump
xmov: ; ---row1---
cmp byte[array + ESI], 'O' ; chk if O is there
je invalid ; if O then invalid
mov byte[array + ESI], 'X' ; put X in row1 array
jmp px ; jmp
The user enters input "0-8" to choose a position on the board. Then I put an "X" in that position and print the array to the screen. It seg faults when user input is entered. Yes, it is tic tac toe.