News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Dos box - division 64 bit by 64 bit

Started by uni.stop, June 21, 2013, 04:56:10 AM

Previous topic - Next topic

uni.stop

Hello,
I'm new here and I don't know if it is the right place to post my problem.

How can I implement 64 bit by 64 bit division in Assembly 8086?
I have already enabled extendeed registers with .386 directive.

Thanks!

dedndave

well - when you multiply a 32-bit value by another 32-bit value, you end up with as many as 64 bits
the opposite holds true when you divide - sort of   :P

but - the easy answer is to use the FPU
80-bit reals (extended reals) have 64-bits of precision

Ray has a nice tutorial to get you started, as well as a lib and some examples...

http://www.ray.masmcode.com/

nidud

#2
deleted

jcfuller

Am I missing something here?
The topic says dosbox so I would assume 16bit assembly ???

James

Gunther

James,

Quote from: jcfuller on June 22, 2013, 12:41:26 AM
Am I missing something here?
The topic says dosbox so I would assume 16bit assembly ???

the entire thing is a bit more tricky, because the thread is inside the 64 bit forum. Let's see what the thread starter has to say.

Gunther
You have to know the facts before you can distort them.

dedndave

you can use 32-bit instructions in 16-bit code   :P

the real question is - what size is the divisor
larger dividends/quotients is easy enough

nidud

#6
deleted

dedndave


    mov     rax,qwDividend
    xor     rdx,rdx
    div     qwDivisor


:P

MichaelW

This seems like an unreasonably difficult assignment for anyone new to programming. The Microsoft RTL function that does this was apparently coded in inline assembly in a naked function, using ~70 32-bit instructions.
Well Microsoft, here's another nice mess you've gotten us into.

dedndave

long division is a good assembler exercise   :P