I'm having an issue with a program I'm writing in NASM using SASM, I'm using a variable as a counter and once I modified it and try to to save the new value at the used address in memory I get a segmentation fault. Here are the bits of code concerning the variable:
section.data
p_count DW 0
section.text
global CMAIN
CMAIN:
mov ebp, esp; for correct debugging
mov bx, [p_count]
inc bx
mov [p_count], bx
ret
The program stops running when it arrives at the last line here. Anyone has an idea what the problem could be?