Hello, I'm writing a compiler in C++ which generates x86 assembly code. I'm using masm32 to test generated code. I don't really know assembly, I have to look up a lot of things while writing code. My problem is that when I generate the code for a division, like
4/2
mov edx, 4
push edx
mov edx, 2
pop eax
div edx
mov edx, eax
and assemble it with masm32, after assembling and linking, when I run it, it says text.exe has stopped working. When I've tried the same like this
mov eax, 4
mov ecx, 2
div ecx
it does not work either. What am I doing wrong?