URGENT: Code for 32 Bit Division

Reply

Join Date: Nov 2006
Posts: 2
Reputation: only_asm is an unknown quantity at this point 
Solved Threads: 0
only_asm only_asm is offline Offline
Newbie Poster

URGENT: Code for 32 Bit Division

 
0
  #1
Nov 15th, 2006
Hi guys!

I need the code for 32 bit division in assembly (8086 architecture) ASAP! Kindly reply to this post!

Thanx!!
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,358
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1463
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: URGENT: Code for 32 Bit Division

 
0
  #2
Nov 15th, 2006
This article might help you.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 134
Reputation: mathematician is an unknown quantity at this point 
Solved Threads: 3
mathematician mathematician is offline Offline
Junior Poster

Re: URGENT: Code for 32 Bit Division

 
0
  #3
Nov 20th, 2006
mov edx, hiword ;load edx with hi word of dividend
mov eax, loword ;load eax with lo word of dividend
mov ebx, divisor ;load ebx with divisor
div ebx ;quotient goes into eax, remainder into edx
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 31
Reputation: mytime19 is an unknown quantity at this point 
Solved Threads: 1
mytime19 mytime19 is offline Offline
Light Poster

Re: URGENT: Code for 32 Bit Division

 
0
  #4
Dec 22nd, 2006
.model SMALL
.386
.DATA
a1 dB 'Enter the first number$'
a2 dB 'Enter the second number$'
A3 DD ?
A4 DD ?
.code
.STARTUP
mov ebx,00000000H
mov edx,00000000H
mov eax,00000000H
mov cl,4

mov dx,offset a1
mov ah,09h
int 21h
MOV EDX,00000000H
mov ah,01
int 21h
sub al,30h
cmp al,09
jbe ar1
sub al,07
ar1:add bl,al
shl ebx,cl
mov ah,01
int 21h
sub al,30h
cmp al,09
jbe ar2
sub al,07
ar2:add bl,al
shl ebx,cl
mov ah,01
int 21h
sub al,30h
cmp al,09
jbe ar3
sub al,07
ar3:add bl,al
shl ebx,cl
mov ah,01
int 21h
sub al,30h
cmp al,09
jbe ar4
sub al,07
ar4:add bl,al
shl ebx,cl
mov ah,01
int 21h
sub al,30h
cmp al,09
jbe ar5
sub al,07
ar5:add bl,al
shl ebx,cl
mov ah,01
int 21h
sub al,30h
cmp al,09
jbe ar6
sub al,07
ar6:add bl,al
shl ebx,cl
mov ah,01
int 21h
sub al,30h
cmp al,09
jbe ar7
sub al,07
ar7:add bl,al
shl ebx,cl
mov ah,01
int 21h
sub al,30h
cmp al,09
jbe ar8
sub al,07
ar8:add bl,al
mov a3,ebx
mov ebx,00000000H
mov dx,offset a2
mov ah,09h
int 21h
MOV EDX,00000000H
mov ah,01
int 21h
sub al,30h
cmp al,09
jbe at1
sub al,07
at1:add bl,al
shl ebx,cl
mov ah,01
int 21h
sub al,30h
cmp al,09
jbe at2
sub al,07
at2:add bl,al
shl ebx,cl
mov ah,01
int 21h
sub al,30h
cmp al,09
jbe at3
sub al,07
at3:add bl,al
shl ebx,cl

mov ah,01
int 21h
sub al,30h
cmp al,09
jbe at4
sub al,07
at4:add bl,al
shl ebx,cl
mov ah,01
int 21h
sub al,30h
cmp al,09
jbe at5
sub al,07
at5:add bl,al
shl ebx,cl
mov ah,01
int 21h
sub al,30h
cmp al,09
jbe at6
sub al,07
at6:add bl,al
shl ebx,cl
mov ah,01
int 21h
sub al,30h
cmp al,09
jbe at7
sub al,07
at7:add bl,al
shl ebx,cl

mov ah,01
int 21h
sub al,30h
cmp al,09
jbe at8
sub al,07
at8:add bl,al

mov edx,00000000H
mov eax,a3
div ebx
mov a4,eax
mov edx,00000000h
mov edx,A4
and edx,0f0000000h
mov cl,28
shr edx,cl
add edx,30h
cmp edx,39h
jbe ad1
add edx,07h
ad1:mov ah,02
int 21h

mov edx,A4
and edx,0f000000h
mov cl,24
shr edx,cl
add edx,30h
cmp edx,39h
jbe ad2
add edx,07h
ad2:mov ah,02
int 21h

mov edx,A4
and edx,00f00000h
mov cl,20
shr edx,cl
add edx,30h
cmp edx,39h
jbe ad3
add edx,07h
ad3:mov ah,02
int 21h

mov edx,A4
and edx,000f0000h
mov cl,16
shr edx,cl
add edx,30h
cmp edx,39h
jbe ad4
add edx,07h
ad4:mov ah,02
int 21h

mov edx,A4
and edx,0000f000h
mov cl,12
shr edx,cl
add edx,30h
cmp edx,39h
jbe ad5
add edx,07h
ad5:mov ah,02
int 21h

mov edx,A4
and edx,00000f00h
mov cl,08
shr edx,cl
add edx,30h
cmp edx,39h
jbe ad6
add edx,07h
ad6:mov ah,02
int 21h

mov edx,A4
and edx,000000f0h
mov cl,04
shr edx,cl
add edx,30h
cmp edx,39h
jbe ad7
add edx,07h
ad7:mov ah,02
int 21h

mov edx,A4
and edx,0000000fh
mov cl,00
shr edx,cl
add edx,30h
cmp edx,39h
jbe ad8
add edx,07h
ad8:mov ah,02
int 21h
.exit
end
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 12,040
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 127
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: URGENT: Code for 32 Bit Division

 
0
  #5
Dec 22nd, 2006
Awesomely efficient code you got there! Very sleek.
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/daniweb
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,358
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1463
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: URGENT: Code for 32 Bit Division

 
0
  #6
Dec 22nd, 2006
Originally Posted by cscgal View Post
Awesomely efficient code you got there! Very sleek.
and its so well documented too!:eek: assembly code should have comments on nearly every line.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 49
Reputation: Purple Avenger is an unknown quantity at this point 
Solved Threads: 0
Purple Avenger Purple Avenger is offline Offline
Light Poster

Re: URGENT: Code for 32 Bit Division

 
0
  #7
Jan 8th, 2007
If you're guaranteed an NPX, just FILD the values and divide them ;->
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 24
Reputation: Ryu is an unknown quantity at this point 
Solved Threads: 0
Ryu Ryu is offline Offline
Newbie Poster

Re: URGENT: Code for 32 Bit Division

 
0
  #8
Jan 11th, 2007
If you ask me, this isn't so efficent when it comes to instruction prefetch caches. These days its better to loop then unroll them.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Assembly Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC