《Proteus在MCS-51&ARM7系统中的应用百例》逆向之 Chapter 7 《Proteus在MCS-51&ARM7系统中的应用百例》MCS-51例子的C语言版本。

源代码在线查看: main.src

软件大小: 56 K
上传用户: muye0422
关键词: Proteus MCS ARM 51
下载地址: 免注册下载 普通下载 VIP

相关代码

				; .\main.SRC generated from: main.c
				; COMPILER INVOKED BY:
				;        D:\Program Files\Keil 8.08\C51\BIN\C51.EXE main.c BROWSE DEBUG OBJECTEXTEND SRC(.\main.SRC)
				
				$NOMOD51
				
				NAME	MAIN
				
				P0	DATA	080H
				P1	DATA	090H
				P2	DATA	0A0H
				P3	DATA	0B0H
				T0	BIT	0B0H.4
				AC	BIT	0D0H.6
				T1	BIT	0B0H.5
				EA	BIT	0A8H.7
				IE	DATA	0A8H
				RD	BIT	0B0H.7
				ES	BIT	0A8H.4
				IP	DATA	0B8H
				RI	BIT	098H.0
				INT0	BIT	0B0H.2
				CY	BIT	0D0H.7
				TI	BIT	098H.1
				INT1	BIT	0B0H.3
				PS	BIT	0B8H.4
				SP	DATA	081H
				OV	BIT	0D0H.2
				WR	BIT	0B0H.6
				SBUF	DATA	099H
				PCON	DATA	087H
				SCON	DATA	098H
				TMOD	DATA	089H
				TCON	DATA	088H
				P33	BIT	0B0H.3
				IE0	BIT	088H.1
				IE1	BIT	088H.3
				B	DATA	0F0H
				ACC	DATA	0E0H
				ET0	BIT	0A8H.1
				ET1	BIT	0A8H.3
				TF0	BIT	088H.5
				TF1	BIT	088H.7
				RB8	BIT	098H.2
				TH0	DATA	08CH
				EX0	BIT	0A8H.0
				IT0	BIT	088H.0
				TH1	DATA	08DH
				TB8	BIT	098H.3
				EX1	BIT	0A8H.2
				IT1	BIT	088H.2
				P	BIT	0D0H.0
				SM0	BIT	098H.7
				TL0	DATA	08AH
				SM1	BIT	098H.6
				TL1	DATA	08BH
				SM2	BIT	098H.5
				PT0	BIT	0B8H.1
				PT1	BIT	0B8H.3
				RS0	BIT	0D0H.3
				TR0	BIT	088H.4
				RS1	BIT	0D0H.4
				TR1	BIT	088H.6
				PX0	BIT	0B8H.0
				PX1	BIT	0B8H.2
				CLK	BIT	0B0H.1
				DIN	BIT	0B0H.0
				DPH	DATA	083H
				DPL	DATA	082H
				REN	BIT	098H.4
				RXD	BIT	0B0H.0
				TXD	BIT	0B0H.1
				F0	BIT	0D0H.5
				PSW	DATA	0D0H
				?PR?DELAY?MAIN       SEGMENT CODE 
				?DT?DELAY?MAIN       SEGMENT DATA OVERLAYABLE 
				?PR?DISP1?MAIN       SEGMENT CODE 
				?DT?DISP1?MAIN       SEGMENT DATA OVERLAYABLE 
				?PR?main?MAIN        SEGMENT CODE 
				?DT?main?MAIN        SEGMENT DATA OVERLAYABLE 
				?CO?MAIN             SEGMENT CODE 
				?DT?MAIN             SEGMENT DATA 
					EXTRN	CODE (?C_STARTUP)
					PUBLIC	DBUF0
					PUBLIC	TEMP
					PUBLIC	SEGTAB
					PUBLIC	main
					PUBLIC	DISP1
					PUBLIC	DELAY
				
					RSEG  ?DT?main?MAIN
				?main?BYTE:
				      point?246:   DS   1
					ORG  1
				    x_point?247:   DS   2
					ORG  3
				       temp?248:   DS   1
				
					RSEG  ?DT?DISP1?MAIN
				?DISP1?BYTE:
				       num2?142:   DS   1
				
					RSEG  ?DT?DELAY?MAIN
				?DELAY?BYTE:
				          j?040:   DS   1
				
					RSEG  ?DT?MAIN
				           TEMP:   DS   4
				          DBUF0:   DS   4
				
					RSEG  ?CO?MAIN
				SEGTAB:
					DB	03FH
					DB	006H
					DB	05BH
					DB	04FH
					DB	066H
					DB	06DH
					DB	07DH
					DB	007H
					DB	07FH
					DB	06FH
					DB	077H
					DB	07CH
					DB	058H
					DB	05EH
					DB	079H
					DB	071H
					DB	000H
					DB	040H
				
				; #include 
				; #include 
				; typedef unsigned char BYTE;
				; 
				; BYTE DBUF0[4];
				; BYTE TEMP[4];
				; 
				; sbit DIN=P3^0;
				; sbit CLK=P3^1;
				; sbit P33=P3^3;
				; 
				; BYTE code SEGTAB[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,
				;         			0x7D,0x07,0x7F,0x6F,0x77,0x7C,
				;         			0x58,0x5E,0x79,0x71,0x00,0x40};
				; 
				; 
				; void DELAY()
				
					RSEG  ?PR?DELAY?MAIN
				DELAY:
					USING	0
							; SOURCE LINE # 17
				; {
							; SOURCE LINE # 18
				; 	BYTE i=0xAF;
							; SOURCE LINE # 19
				;---- Variable 'i?041' assigned to Register 'R7' ----
					MOV  	R7,#0AFH
				?C0003:
				; 	 
				; 	do
				; 	{	 
							; SOURCE LINE # 22
				; 		BYTE j=0xFF;
							; SOURCE LINE # 23
					MOV  	j?040,#0FFH
				?C0006:
				; 		do
				; 		{
							; SOURCE LINE # 25
				; 			_nop_();
							; SOURCE LINE # 26
					NOP  	
				; 			_nop_();
							; SOURCE LINE # 27
					NOP  	
				; 			_nop_();
							; SOURCE LINE # 28
					NOP  	
				; 		}while(--j);
							; SOURCE LINE # 29
					DJNZ 	j?040,?C0006
				; 	}while(--i);
							; SOURCE LINE # 30
					DJNZ 	R7,?C0003
				; }
							; SOURCE LINE # 31
					RET  	
				; END OF DELAY
				
				; 
				; void DISP1()
				
					RSEG  ?PR?DISP1?MAIN
				DISP1:
					USING	0
							; SOURCE LINE # 33
				; {
							; SOURCE LINE # 34
				; 	BYTE data *p=DBUF0;
							; SOURCE LINE # 35
					MOV  	R7,#LOW (DBUF0)
				;---- Variable 'p?143' assigned to Register 'R7' ----
				; 	BYTE data *q=TEMP+4;
							; SOURCE LINE # 36
					MOV  	R6,#LOW (TEMP+04H)
				;---- Variable 'q?144' assigned to Register 'R6' ----
				; 	BYTE num=5;
							; SOURCE LINE # 37
				;---- Variable 'num?145' assigned to Register 'R5' ----
					MOV  	R5,#05H
				?C0010:
				; 
				; 	do
				; 	{
							; SOURCE LINE # 40
				; 		*q=SEGTAB[*p];
							; SOURCE LINE # 41
					MOV  	R0,AR7
					MOV  	A,@R0
					MOV  	DPTR,#SEGTAB
					MOVC 	A,@A+DPTR
					MOV  	R0,AR6
					MOV  	@R0,A
				; 		p++;
							; SOURCE LINE # 42
					INC  	R7
				; 		q--;	
							; SOURCE LINE # 43
					DEC  	R6
				; 	}while(--num);
							; SOURCE LINE # 44
					DJNZ 	R5,?C0010
				; 
				; 	p=TEMP;
							; SOURCE LINE # 46
					MOV  	R7,#LOW (TEMP)
				; 	num=5;
							; SOURCE LINE # 47
					MOV  	R5,#05H
				?C0013:
				; 		
				; 	do
				; 	{
							; SOURCE LINE # 50
				; 		BYTE num2=8;
							; SOURCE LINE # 51
					MOV  	num2?142,#08H
				; 		ACC=*p;
							; SOURCE LINE # 52
					MOV  	R0,AR7
					MOV  	A,@R0
				?C0016:
				; 		do
				; 		{
							; SOURCE LINE # 54
				; 			#pragma asm
				; 				RLC 	A			
					  RLC 	A			
				; 				MOV 	DIN,C
					  MOV 	DIN,C
				; 			#pragma endasm
				; 
				; 			CLK=0;
							; SOURCE LINE # 60
					CLR  	CLK
				; 			CLK=1;
							; SOURCE LINE # 61
					SETB 	CLK
				; 					
				; 		}while(--num2);
							; SOURCE LINE # 63
					DJNZ 	num2?142,?C0016
				; 		p++;
							; SOURCE LINE # 64
					INC  	R7
				; 	}while(--num);
							; SOURCE LINE # 65
					DJNZ 	R5,?C0013
				; }
							; SOURCE LINE # 66
					RET  	
				; END OF DISP1
				
				; 
				; main()
				
					RSEG  ?PR?main?MAIN
				main:
					USING	0
							; SOURCE LINE # 68
				; {				 
							; SOURCE LINE # 69
				?C0018:
				; 	while(1)
							; SOURCE LINE # 70
				; 	{
							; SOURCE LINE # 71
				; 		BYTE data *point=DBUF0;
							; SOURCE LINE # 72
					MOV  	point?246,#LOW (DBUF0)
				; 		BYTE xdata *x_point;
				; 		BYTE temp;
				; 
				; 		*point++=0x0A;
							; SOURCE LINE # 76
					MOV  	R7,point?246
					INC  	point?246
					MOV  	R0,AR7
					MOV  	@R0,#0AH
				; 		*point++=0x0D;
							; SOURCE LINE # 77
					MOV  	R7,point?246
					INC  	point?246
					MOV  	R0,AR7
					MOV  	@R0,#0DH
				; 		*point++=0x10;
							; SOURCE LINE # 78
					MOV  	R7,point?246
					INC  	point?246
					MOV  	R0,AR7
					MOV  	@R0,#010H
				; 
				; 		x_point=0xFEF3;
							; SOURCE LINE # 80
					MOV  	x_point?247,#0FEH
					MOV  	x_point?247+01H,#0F3H
				; 		*x_point=0;
							; SOURCE LINE # 81
					MOV  	DPL,x_point?247+01H
					MOV  	DPH,x_point?247
					CLR  	A
					MOVX 	@DPTR,A
				?C0020:
				; 		while(!P33);
							; SOURCE LINE # 82
					JNB  	P33,?C0020
				?C0021:
				; 		temp=*x_point;
							; SOURCE LINE # 83
					MOV  	DPL,x_point?247+01H
					MOV  	DPH,x_point?247
					MOVX 	A,@DPTR
					MOV  	temp?248,A
				; 		P1=temp;
							; SOURCE LINE # 84
					MOV  	P1,A
				; 
				; 		*point=_crol_(temp,4)&0x0F;
							; SOURCE LINE # 86
					MOV  	R7,temp?248
					MOV  	R0,#04H
					MOV  	A,R7
					INC  	R0
					SJMP 	?C0024
				?C0023:
					RL   	A
				?C0024:
					DJNZ 	R0,?C0023
					ANL  	A,#0FH
					MOV  	R0,point?246
					MOV  	@R0,A
				; 		point++;
							; SOURCE LINE # 87
					INC  	point?246
				; 		*point=temp&0x0F;
							; SOURCE LINE # 88
					MOV  	A,temp?248
					ANL  	A,#0FH
					MOV  	R0,point?246
					MOV  	@R0,A
				; 		DISP1();
							; SOURCE LINE # 89
					LCALL	DISP1
				; 		DELAY();
							; SOURCE LINE # 90
					LCALL	DELAY
				; 	}	
							; SOURCE LINE # 91
					SJMP 	?C0018
				; END OF main
				
					END
							

相关资源