Tags: asm, cant, code, doubt, microsoft, msdn, offtopic, project, section, software, vc6, visual, x86

x86 asm code doubt

On Microsoft » Microsoft Visual C & C++

826 words with 2 Comments; publish: Wed, 09 Jan 2008 03:52:00 GMT; (32578.13, « »)


I know this is an offtopic topic, But i cant see a section i the forum to post this kind of questions.

I have a vc6 project in which i uses some assemly code. I am not an expert in assembly programming.

The problem is with the DIV instruction. when ever i try to call DIV an integer overflow occurs.

Here is a sample code



mov ebx, 1

mov eax, 5

div ebx //integer overflow error


Please help to solve the issue


All Comments

Leave a comment...

    • To divide two 32bit integers you need to zero-extend the eax register into edx. Add a mov edx, 0, and you'll be ready to go.
      #1; Tue, 02 Oct 2007 22:42:00 GMT
    • thanx.

      it worked

      #2; Tue, 02 Oct 2007 22:43:00 GMT