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 4,324 of 4,675   
   Anton Ertl to Paul Edwards   
   Re: 8086 32-bit multiply   
   24 Apr 21 14:01:21   
   
   From: anton@nospicedham.mips.complang.tuwien.ac.at   
      
   Paul Edwards  writes:   
   >On Saturday, April 24, 2021 at 10:51:35 AM UTC+10, wolfgang kern wrote:   
   >   
   >> [x8086 only]   
   >> > ; multiply cx:bx by dx:ax, result in dx:ax   
   >> the result of 32*32 bit doesn't fit into 32 bit.   
   >   
   >Good point. I didn't think of that. I can't multiply   
   >17 bits by 17 bits, one of the registers needs to   
   >be 0. But I assume I need to at least overflow in   
   >a predictable manner.   
      
   The usual way is to produce the lower 32 bits of the result, i.e.,   
   produce a*b mod 2^32.  And thanks to the magic of 2s-complement   
   arithmetic, the result is the same for unsigned multiplication and for   
   signed multiplication (the results for the high 32 bits would differ,   
   but you are not interested in that).   
      
   - anton   
   --   
   M. Anton Ertl                    Some things have to be seen to be believed   
   anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen   
   http://www.complang.tuwien.ac.at/anton/home.html   
      
   --- 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