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

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

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

相关代码

				MBFSUB:
				SETB	 F0 					
				AS: 
				LCALL	 MVR1 				
				MOV	 C,F0 				
				RRC		 A 
				XRL		 A,@R1 
				MOV	 C,ACC.7 
				ASN: 
				MOV 	 1EH,C 			
				XRL 	 A,@R0				
				RLC 	 A 
				MOV	 F0,C 				
				LCALL 	 MVR0 				
				LCALL 	 AS1 				
				MOV0: 
				INC		 R0 					
				INC 		 R0 
				MOV 	 A,R4 				
				MOV	 @R0,A 
				DEC		 R0 
				MOV	 A,R3 				
				MOV	 @R0,A 
				DEC		 R0 
				MOV 	 A,R2 				
				MOV 	 C,1FH 			
				MOV 	 ACC.7,C 			
				MOV	 @R0,A 
				CLR 	 ACC.7 				
				CLR 	 OV 				
				CJNE	 A,#3FH,MV01			
				SETB 	 OV 			
				MV01: 
				MOV 	 A,@R0 				
				RET 
				MVR0: 
				MOV 	A,@R0 				
				MOV 	C,ACC.7 				
				MOV 	1FH,C 
				MOV	C,ACC.6 				
				MOV 	ACC.7,C 
				MOV 	R2,A 			 
				INC 		R0 
				MOV 	A,@R0 				
				MOV 	R3,A 
				INC 		R0 
				MOV 	A,@R0 				
				MOV 	R4,A 
				DEC 	R0 				
				DEC 	R0 
				RET 
				MVR1: 
				MOV 	A,@R1 				
				MOV 	C,ACC.7 				
				MOV 	1EH,C 
				MOV 	C,ACC.6 				
				MOV 	ACC.7,C 
				MOV 	R5,A 				
				INC 		R1 
				MOV 	A,@R1 				
				MOV 	R6,A 
				INC 		R1 
				MOV 	A,@R1 				
				MOV 	R7,A 
				DEC 	R1 					
				DEC 	R1 
				RET 
				AS1: 
				MOV 	A,R6 			
				ORL 	A,R7 
				JZ 		AS2 					 
				MOV 	A,R3					
				ORL 	A,R4 
				JNZ 		EQ1 
				MOV 	A,R6 				
				MOV 	R3,A 
				MOV 	A,R7 
				MOV 	R4,A 
				MOV 	A,R5 
				MOV 	R2,A 
				MOV 	C,1EH 
				MOV 	1FH,C 
				AS2: 	
				RET 
				EQ1: 
				MOV 	A,R2 				
				XRL 	A,R5 
				JZ 		AS4 					
				JB 		ACC.7,EQ3		
				MOV 	A,R2 				 
				CLR 	C 
				SUBB 	A,R5 
				JC 		EQ4 
				EQ2: 
				CLR 	C 					
				MOV 	A,R6 				
				RRC 	A 
				MOV 	R6,A 
				MOV 	A,R7 
				RRC 	A 
				MOV 	R7,A 
				INC 		R5 				
				ORL 	A,R6 			
				JNZ 		EQ1 				
				MOV 	A,R2 				
				MOV 	R5,A 
				SJMP 	AS4 
				EQ3: 
				MOV 	A,R2 				
				JNB 		ACC.7,EQ2			
				EQ4: 
				CLR		C 
				LCALL 	RR1 				
				ORL 	A,R3 				
				JNZ 		EQ1 					 
				MOV 	A,R5 				
				MOV 	R2,A 
				AS4: 
				JB 		F0,AS5 				
				MOV 	A,R4 				
				ADD 	A,R7 
				MOV 	R4,A 
				MOV 	A,R3 
				ADDC 	A,R6 
				MOV 	R3,A 
				JNC 		AS2 
				LJMP 	RR1 				
				AS5: 
				CLR 	C 					
				MOV 	A,R4 
				SUBB 	A,R7 
				MOV 	B,A 
				MOV 	A,R3 
				SUBB 	A,R6 
				JC 		AS6 
				MOV 	R4,B 				
				MOV 	R3,A 
				LJMP 	RLN 				
				AS6: 
				CPL 		1FH 					
				CLR 	C 					
				MOV 	A,R7 
				SUBB 	A,R4 
				MOV 	R4,A 
				MOV 	A,R6 
				SUBB 	A,R3 
				MOV 	R3,A 
				RLN: 
				MOV 	A,R3 				
				ORL 	A,R4 				
				JNZ 		RLN1 
				MOV 	R2,#0C1H				
				RET 
				RLN1: 
				MOV 	A,R3 
				JB 		ACC.7,RLN2			
				CLR 	C 					
				LCALL 	RL1 
				SJMP 	RLN 				
				RLN2: 
				CLR 	OV 					
				RET 
				RL1: 
				MOV 	A,R4 				
				RLC 	A 					
				MOV 	R4,A 
				MOV 	A,R3 
				RLC 	A 
				MOV 	R3,A 
				DEC 	R2 					
				CJNE 	R2,#0C0H,RL1E			
				CLR 	A 
				MOV 	R3,A					
				MOV 	R4,A 
				MOV 	R2,#0C1H 
				RL1E: 
				CLR 	OV 
				RET 
				RR1: 
				MOV 	A,R3 				
				RRC 	A 					 
				MOV 	R3,A 
				MOV 	A,R4 
				RRC 	A 
				MOV 	R4,A 
				INC 		R2 					
				CLR 	OV 					
				CJNE 	R2,#40H,RR1E			
				MOV 	R2,#3FH 				
				SETB 	OV 
				RR1E: 
				RET
							

相关资源