Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/05/03 02:17
Read: times


 
#57829 - RE: 32 bit / 20 bit division
Responding to: ???'s previous message
Dear Abhishek,

I was looking for a general divide routine. But anyway since we were running short of time,
managed with a quick and dirty (?) routine as below :

;32 bit / 24 bit division	
;16 bit quotient
	
DIV32:	CLR C
	
NSUB:	MOV R0, #DIVIDND
	MOV R1, #DIVSOR	
        MOV A,  @R0	; Subtract LSBs
	SUBB A, @R1
	MOV @R0,  A
			
	INC R0
	INC R1
	MOV A, @R0
	SUBB A, @R1
	MOV @R0, A
			
	INC R0
	INC R1
	MOV A, @R0
	SUBB A, @R1
	MOV @R0, A
			
	INC R0		; Subtract MSBs
	INC R1
	MOV A, @R0
	SUBB A, @R1
	MOV @R0, A
			
	JC NOINC	; If carry bit ON, finish div process.
						
	MOV R0, #QUOT	; no carry - increment LSB of quotient 
        MOV A, @R0
	ADD A, #01H
	MOV @R0, A
	JNC NXT		; If LSB quot. value = FFH, inc. MSB of quotient				
	INC QUOT+1		
	
NXT:	JMP NSUB        ; Next Subtraction...
NOINC:	RET 


I am not sure if you were talking about something like above - and if there is any improvement possible to the above -
you are most welcome.

Raghu

List of 10 messages in thread
TopicAuthorDate
32 bit / 20 bit division            01/01/70 00:00      
   RE: 32 bit / 20 bit division            01/01/70 00:00      
      RE: 32 bit / 20 bit division            01/01/70 00:00      
   RE: 32 bit / 20 bit division            01/01/70 00:00      
      RE: 32 bit / 20 bit division            01/01/70 00:00      
      RE: 32 bit / 20 bit division            01/01/70 00:00      
      RE: 32 bit / 20 bit division            01/01/70 00:00      
   RE: 32 bit / 20 bit division            01/01/70 00:00      
      RE: 32 bit / 20 bit division            01/01/70 00:00      
         RE: 32 bit / 20 bit division            01/01/70 00:00      

Back to Subject List