home *** CD-ROM | disk | FTP | other *** search
- Path: 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
-
- 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
-