MCS-51单片机应用开发实用子程序.rar

源代码在线查看: 2.4.4多字节有符号数除法.txt

软件大小: 126 K
上传用户: toper810
关键词: MCS 51单片机 应用开发
下载地址: 免注册下载 普通下载 VIP

相关代码

				FDIV: 
				INC	R0 
				MOV	A,@R0
				INC	R0
				ORL	A,@R0
				DEC	R0
				DEC	R0
				JNZ	DIV1
				MOV	@R0,#41H				
				CLR	OV      				
				RET
				 
				DIV1:   
				INC	R1 
				MOV	A,@R1 
				INC	R1 
				ORL	A,@R1 
				DEC	R1 
				DEC	R1 
				JNZ	DIV2 
				SETB	OV 					
				RET 
				DIV2: 
				LCALL	MVR0 				 
				MOV	A,@R0 
				XRL	A,@R1 				
				RLC	A 
				MOV	1FH,C 				
				LCALL	MVR1 				 
				LCALL	DIV3 				
				LJMP	MOV0 				
				DIV3: 
				CLR	C 					
				MOV	A,R4 
				SUBB	A,R7 
				MOV	A,R3 
				SUBB	A,R6 
				JC	DIV4 
				LCALL	RR1 				
				SJMP	DIV3 
				DIV4: 
				CLR	A 					
				XCH	A,R0 				
				PUSH	ACC 
				CLR	A 
				XCH	A,R1 
				PUSH	ACC 
				MOV	A,R2 
				PUSH	ACC 
				MOV	B,#10H 				
				DIV5: 
				CLR	C 
				MOV	A,R1 
				RLC	A 
				MOV	R1,A 
				MOV	A,R0 
				RLC	A 
				MOV	R0,A 
				MOV	A,R4 
				RLC	A 
				MOV	R4,A 
				XCH	A,R3 
				RLC	A 
				XCH	A,R3 
				MOV	F0,C 
				CLR	C 
				SUBB	A,R7 
				MOV	R2,A 
				MOV	A,R3 
				SUBB	A,R6 
				ANL	C,/F0 
				JC	DIV6 
				MOV	R3,A 
				MOV	A,R2 
				MOV	R4,A 
				INC	R1 
				DIV6: 
				DJNZ	B,DIV5 
				MOV	A,R6 					
				CLR	C 
				RRC	A 
				SUBB	A,R3 
				CLR	A 
				ADDC	A,R1 					
				MOV	R4,A 
				CLR	A 
				ADDC	A,R0 
				MOV	R3,A 
				POP	ACC 					
				MOV     	R2,A 
				POP      	ACC 
				MOV    	 R1,A 
				POP     	 ACC 
				MOV     	R0,A 
				MOV     	A,R2 				
				CLR      	C 
				SUBB     	A,R5 
				LCALL    	MD 					
				LJMP     	RLN 					
							

相关资源