🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.msdos.programmer
Article #804

Re: This is strange, div doesn't work....

#804
From: Scott C. Sadow
Date: Sat, 19 Dec 1992 15:49
28 lines
1198 bytes
In article <1gp6q9INNgdd@aludra.usc.edu>, Michael Duffy (mduffy@aludra.usc.edu) writes:
>I hope someone can help me, 'cause I'm at a loss.
>
>The following code gives me a divide error:
>
> mov  ax,0035h
> mov  dx,01h
> div  dx
>
>It should work.  I don't know why it doesn't.  Could some assembly language
>genius please show me the light?  E-mail please since I don't check this
>group very often.  Thank you much,
>Michael Duffy (mduffy@aludra.usc.edu)
>


The problem is that "DIV <word>" means to divide DX:AX by <word>.
Therefore, the above example is dividing "00010035H" by "0001". This
causes a divide error because the result cannot fit in one word. Try the
following instead:

   MOV   AX,0035H
   XOR   DX,DX
   MOV   BX,01H
   DIV   BX


(this answer was posted because it seemed like something many people w
Technical Details
Message-ID: <1992Dec19.104945@mycro.UUCP>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!swrinde!emory!wa4mei!nanovx!mycro!scott
References: <1gp6q9INNgdd@aludra.usc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!swrinde!emory!wa4mei!nanovx!mycro!scott
From: scott@mycro.UUCP (Scott C. Sadow)
Newsgroups: alt.msdos.programmer
Subject: Re: This is strange, div doesn't work....
Message-ID: <1992Dec19.104945@mycro.UUCP>
Date: Sat, 19 Dec 92 10:49:45 EST
References: <1gp6q9INNgdd@aludra.usc.edu> 
Lines: 28