home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 3,046 of 4,675   
   James Van Buskirk to Richmond   
   Re: DIV instruction in 64 bit mode with    
   06 Nov 17 10:06:23   
   
   From: not_valid@nospicedham.comcast.net   
      
   "Richmond"  wrote in message news:86wp33ftoy.fsf@example.com...   
      
   > I am trying to divide a number by 10. Not too difficult you would think,   
   > but this instruction:   
      
   > DIV EBX   
      
   > is rejected my NASM in 64 bit mode. So I have zero in EDX and my number   
   > to be divided in EAX so I am expecting EAX=EAX:EDX/EBX with the   
   > remainder in EDX. According to the Intel manual, in 64 bit mode the   
   > default operation size is 32 bits, so this should work. But nasm says   
   > the instruction is not available in 64 bit mode. How do I do it?   
      
   According to 64-ia-32-architectures-software-developer-vol-2a-manual.pdf   
   p. 3-238 this should work.  And indeed when I assemble this file:   
      
   format MS64 coff   
      
   section '.text' code readable executable   
   div bl   
   div dil   
   div bx   
   div ebx   
   div rbx   
      
   with fasm, it assembles to   
      
                                                                   format MS64   
   coff   
      
                                                                   section   
   '.text' code readable executable   
   0000003C: F6 F3                                                 div bl   
   0000003E: 40 F6 F7                                              div dil   
   00000041: 66 F7 F3                                              div bx   
   00000044: F7 F3                                                 div ebx   
   00000046: 48 F7 F3                                              div rbx   
      
   So I suspect that you might be misinterpreting the error message   
   that NASM is giving you.  Do you have a more complete example   
   with an entire *.ASM file, NASM command line, and full error   
   message cut and pasted from the terminal?   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca