tri2061990
Newbie level 5

Code
;INPUT R7.R6 : dividend 16 BIT , R7->high byte, R6->low byte
; B:divisor
;
;OUTPUT : R7.R6 : quotient
; B : remainder
I can understand how it work,can you explain it to me?
;INPUT R7.R6 : dividend 16 BIT , R7->high byte, R6->low byte
; B:divisor
;
;OUTPUT : R7.R6 : quotient
; B : remainder
Code:
DIV16TO8 :
PUSH 02H ;
PUSH ACC ;
MOV R2,#16 ;
CLR A
DIVIDE :
XCH A,R6
CLR C ;
RLC A ;
XCH A,R6 ;
XCH A,R7 ;
RLC A ;
XCH A,R7
RLC A ;
CJNE A,B,NOT_EQUAL ;
SJMP A_GREATER_EQ_B
NOT_EQUAL :
JC BELOW ; N:
A_GREATER_EQ_B:
SUBB A,B ;Y:
XCH A,R6
ORL A,#1 ;
XCH A,R6 ;
BELOW :
DJNZ R2,DIVIDE ;
XCH A,B ;
POP ACC
POP 02H
RET
I can understand how it work,can you explain it to me?
Last edited: