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; (32546.88, « »)

Hi,

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

_asm

{

mov ebx, 1

mov eax, 5

div ebx //integer overflow error

}

Please help to solve the issue

Regards

All Comments

Leave a comment...

  • 2 Comments
    • 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