mifarea卡程序mifarea卡程序mifarea卡程序

源代码在线查看: command.src

软件大小: 1887 K
上传用户: haowoainime
关键词: mifarea 程序
下载地址: 免注册下载 普通下载 VIP

相关代码

				; .\out_sst89e564\command.SRC generated from: source\command.c
				; COMPILER INVOKED BY:
				;        C:\Keil\C51\BIN\C51.EXE source\command.c LARGE BROWSE ORDER NOAREGS DEBUG OBJECTEXTEND PRINT(.\command.lst) SRC(.\out_sst89e564\command.SRC)
				
				$NOMOD51
				
				NAME	COMMAND
				
				P0	DATA	080H
				SP	DATA	081H
				DPL	DATA	082H
				DPH	DATA	083H
				PCON	DATA	087H
				TCON	DATA	088H
				TMOD	DATA	089H
				TL0	DATA	08AH
				TL1	DATA	08BH
				TH0	DATA	08CH
				TH1	DATA	08DH
				P1	DATA	090H
				SCON	DATA	098H
				SBUF	DATA	099H
				P2	DATA	0A0H
				IE	DATA	0A8H
				P3	DATA	0B0H
				IP	DATA	0B8H
				T2CON	DATA	0C8H
				T2MOD	DATA	0C9H
				RCAP2L	DATA	0CAH
				RCAP2H	DATA	0CBH
				TL2	DATA	0CCH
				TH2	DATA	0CDH
				PSW	DATA	0D0H
				ACC	DATA	0E0H
				B	DATA	0F0H
				P0_0	BIT	080H.0
				P0_1	BIT	080H.1
				P0_2	BIT	080H.2
				P0_3	BIT	080H.3
				P0_4	BIT	080H.4
				P0_5	BIT	080H.5
				P0_6	BIT	080H.6
				P0_7	BIT	080H.7
				IT0	BIT	088H.0
				IE0	BIT	088H.1
				IT1	BIT	088H.2
				IE1	BIT	088H.3
				TR0	BIT	088H.4
				TF0	BIT	088H.5
				TR1	BIT	088H.6
				TF1	BIT	088H.7
				P1_0	BIT	090H.0
				P1_1	BIT	090H.1
				P1_2	BIT	090H.2
				P1_3	BIT	090H.3
				P1_4	BIT	090H.4
				P1_5	BIT	090H.5
				P1_6	BIT	090H.6
				P1_7	BIT	090H.7
				T2	BIT	090H.0
				T2EX	BIT	090H.1
				RI	BIT	098H.0
				TI	BIT	098H.1
				RB8	BIT	098H.2
				TB8	BIT	098H.3
				REN	BIT	098H.4
				SM2	BIT	098H.5
				SM1	BIT	098H.6
				SM0	BIT	098H.7
				P2_0	BIT	0A0H.0
				P2_1	BIT	0A0H.1
				P2_2	BIT	0A0H.2
				P2_3	BIT	0A0H.3
				P2_4	BIT	0A0H.4
				P2_5	BIT	0A0H.5
				P2_6	BIT	0A0H.6
				P2_7	BIT	0A0H.7
				EX0	BIT	0A8H.0
				ET0	BIT	0A8H.1
				EX1	BIT	0A8H.2
				ET1	BIT	0A8H.3
				ES	BIT	0A8H.4
				ET2	BIT	0A8H.5
				EA	BIT	0A8H.7
				P3_0	BIT	0B0H.0
				P3_1	BIT	0B0H.1
				P3_2	BIT	0B0H.2
				P3_3	BIT	0B0H.3
				P3_4	BIT	0B0H.4
				P3_5	BIT	0B0H.5
				P3_6	BIT	0B0H.6
				P3_7	BIT	0B0H.7
				RXD	BIT	0B0H.0
				TXD	BIT	0B0H.1
				INT0	BIT	0B0H.2
				INT1	BIT	0B0H.3
				T0	BIT	0B0H.4
				T1	BIT	0B0H.5
				WR	BIT	0B0H.6
				RD	BIT	0B0H.7
				PX0	BIT	0B8H.0
				PT0	BIT	0B8H.1
				PX1	BIT	0B8H.2
				PT1	BIT	0B8H.3
				PS	BIT	0B8H.4
				PT2	BIT	0B8H.5
				CP_RL2	BIT	0C8H.0
				C_T2	BIT	0C8H.1
				TR2	BIT	0C8H.2
				EXEN2	BIT	0C8H.3
				TCLK	BIT	0C8H.4
				RCLK	BIT	0C8H.5
				EXF2	BIT	0C8H.6
				TF2	BIT	0C8H.7
				P	BIT	0D0H.0
				FL	BIT	0D0H.1
				OV	BIT	0D0H.2
				RS0	BIT	0D0H.3
				RS1	BIT	0D0H.4
				F0	BIT	0D0H.5
				AC	BIT	0D0H.6
				CY	BIT	0D0H.7
				FST	DATA	0B6H
				WDTC	DATA	0C0H
				WDTD	DATA	085H
				AUXR	DATA	08EH
				AUXR1	DATA	0A2H
				WDTRST	DATA	0A6H
				WDTPRG	DATA	0A7H
				SADDR	DATA	0A9H
				IPH	DATA	0B7H
				IPH0	DATA	0B7H
				SADEN	DATA	0B9H
				IPL	DATA	0B8H
				IPL0	DATA	0B8H
				CCON	DATA	0D8H
				CMOD	DATA	0D9H
				CCAPM0	DATA	0DAH
				CCAPM1	DATA	0DBH
				CCAPM2	DATA	0DCH
				CCAPM3	DATA	0DDH
				CCAPM4	DATA	0DEH
				P5	DATA	0E8H
				CL	DATA	0E9H
				CCAP0L	DATA	0EAH
				CCAP1L	DATA	0EBH
				CCAP2L	DATA	0ECH
				CCAP3L	DATA	0EDH
				CCAP4L	DATA	0EEH
				CH	DATA	0F9H
				CCAP0H	DATA	0FAH
				CCAP1H	DATA	0FBH
				CCAP2H	DATA	0FCH
				CCAP3H	DATA	0FDH
				CCAP4H	DATA	0FEH
				?PR?Command?COMMAND  SEGMENT CODE 
				?XD?Command?COMMAND  SEGMENT XDATA OVERLAYABLE 
				?C_INITSEG           SEGMENT CODE 
				?XD?COMMAND          SEGMENT XDATA 
					EXTRN	CODE (_CommSend)
					EXTRN	CODE (_CommRead)
					EXTRN	CODE (_ParaWrite)
					EXTRN	CODE (_ParaRead)
					EXTRN	CODE (_M1Command)
					EXTRN	CODE (_TcCommand)
					EXTRN	CODE (_SysCommand)
					EXTRN	CODE (_SecCommand)
					EXTRN	CODE (_MifareProExcute)
					PUBLIC	FWI
					PUBLIC	Command
				
					RSEG  ?XD?Command?COMMAND
				?Command?BYTE:
				        len?040:   DS   2
					ORG  2
				        buf?041:   DS   316
				
					RSEG  ?XD?COMMAND
				            FWI:   DS   1
				
					RSEG  ?C_INITSEG
					DB	041H
					DW	FWI
					DB	005H
				
				; /****************************************
				;  * command.c                            *
				;  * Designe by 刘俐训                    *
				;  * check and excute command from host   *
				;  * last update: 05-01-2007              *
				;  ****************************************/
				; 
				; #include "includes.h"
				; #include "MifarePro.h"
				; 
				; void Command(void)
				
					RSEG  ?PR?Command?COMMAND
				Command:
					USING	0
							; SOURCE LINE # 11
				; {
							; SOURCE LINE # 12
				;     unsigned int len = 0;           // 通讯报文长度
							; SOURCE LINE # 13
					CLR  	A
					MOV  	DPTR,#len?040
					MOVX 	@DPTR,A
					INC  	DPTR
					MOVX 	@DPTR,A
				;     unsigned char buf[316];     // 通讯、操作用临时数据缓冲
				;     int limit;
				; 
				;     if((len = CommRead(buf, sizeof(buf)-1)) > 0)
							; SOURCE LINE # 17
					MOV  	R3,#01H
					MOV  	R2,#HIGH (buf?041)
					MOV  	R1,#LOW (buf?041)
					MOV  	R5,#03BH
					MOV  	R4,#01H
					LCALL	_CommRead
					MOV  	DPTR,#len?040
					MOV  	A,R6
					MOVX 	@DPTR,A
					INC  	DPTR
					MOV  	A,R7
					MOVX 	@DPTR,A
					SETB 	C
					SUBB 	A,#00H
					MOV  	A,R6
					SUBB 	A,#00H
					JNC  	$ + 5H
					LJMP 	?C0016
				;     {
							; SOURCE LINE # 18
				;         limit = ParaRead(PARA_LIMIT);
							; SOURCE LINE # 19
					MOV  	R7,#0F7H
					LCALL	_ParaRead
				;---- Variable 'limit?042' assigned to Register 'R6/R7' ----
				;         if(limit < 0)
							; SOURCE LINE # 20
					CLR  	C
					MOV  	A,R6
					XRL  	A,#080H
					SUBB 	A,#080H
					JNC  	?C0002
				;             limit = ParaWrite(PARA_LIMIT, 1);
							; SOURCE LINE # 21
					MOV  	R5,#01H
					MOV  	R7,#0F7H
					LCALL	_ParaWrite
				?C0002:
				;             
				;         if((limit 							; SOURCE LINE # 23
					SETB 	C
					MOV  	A,R7
					SUBB 	A,#00H
					MOV  	A,R6
					XRL  	A,#080H
					SUBB 	A,#080H
					JNC  	?C0003
					MOV  	DPTR,#buf?041
					MOVX 	A,@DPTR
					XRL  	A,#015H
					JZ   	?C0003
				;         {
							; SOURCE LINE # 24
				;             buf[0] = ERRORCMD;
							; SOURCE LINE # 25
					MOV  	A,#02H
					MOVX 	@DPTR,A
				;             buf[1] = 0xaa;
							; SOURCE LINE # 26
					INC  	DPTR
					MOV  	A,#0AAH
					MOVX 	@DPTR,A
				;             len = 2;
							; SOURCE LINE # 27
					MOV  	DPTR,#len?040
					CLR  	A
					MOVX 	@DPTR,A
					INC  	DPTR
					MOV  	A,#02H
					MOVX 	@DPTR,A
				;         }
							; SOURCE LINE # 28
					SJMP 	?C0004
				?C0003:
				;         else
				;         {
							; SOURCE LINE # 30
				;             switch(buf[0])  // buf[0]: cmd target
							; SOURCE LINE # 31
					MOV  	DPTR,#buf?041
					MOVX 	A,@DPTR
					ADD  	A,#0FCH
					JNC  	?C0012
					ADD  	A,#0FAH
					JZ   	?C0007
					DEC  	A
					JZ   	?C0008
					ADD  	A,#0F7H
					JZ   	?C0013
					DEC  	A
					JNZ  	?C0004
				;             {
							; SOURCE LINE # 32
				;                 case SEC:
							; SOURCE LINE # 33
				?C0006:
				;                     len = SecCommand(buf, len);
							; SOURCE LINE # 34
					MOV  	R3,#01H
					MOV  	R2,#HIGH (buf?041)
					MOV  	R1,#LOW (buf?041)
					MOV  	DPTR,#len?040
					MOVX 	A,@DPTR
					MOV  	R4,A
					INC  	DPTR
					MOVX 	A,@DPTR
					MOV  	R5,A
					LCALL	_SecCommand
				;                     break;
							; SOURCE LINE # 35
					SJMP 	?C0020
				;                     
				;                 case IC_M1:
							; SOURCE LINE # 37
				?C0007:
				;                     len = M1Command(buf, len);
							; SOURCE LINE # 38
					MOV  	R3,#01H
					MOV  	R2,#HIGH (buf?041)
					MOV  	R1,#LOW (buf?041)
					MOV  	DPTR,#len?040
					MOVX 	A,@DPTR
					MOV  	R4,A
					INC  	DPTR
					MOVX 	A,@DPTR
					MOV  	R5,A
					LCALL	_M1Command
				?C0017:
				;                     break;
							; SOURCE LINE # 39
					SJMP 	?C0020
				; 				case IC_MPRO:
							; SOURCE LINE # 40
				?C0008:
				; 				    len = MifareProExcute(buf,len);
							; SOURCE LINE # 41
					MOV  	R3,#01H
					MOV  	R2,#HIGH (buf?041)
					MOV  	R1,#LOW (buf?041)
					MOV  	DPTR,#len?040
					MOVX 	A,@DPTR
					MOV  	R4,A
					INC  	DPTR
					MOVX 	A,@DPTR
					MOV  	R5,A
					LCALL	_MifareProExcute
				?C0018:
				; 					break;	 
							; SOURCE LINE # 42
					SJMP 	?C0020
				;                     
				;                 case IC_SAM1:
							; SOURCE LINE # 44
				;                 case IC_SAM2:
							; SOURCE LINE # 45
				;                 case IC_SAM3:
							; SOURCE LINE # 46
				;                 case IC_USER:
							; SOURCE LINE # 47
				?C0012:
				;                     len = TcCommand(buf, len);
							; SOURCE LINE # 48
					MOV  	R3,#01H
					MOV  	R2,#HIGH (buf?041)
					MOV  	R1,#LOW (buf?041)
					MOV  	DPTR,#len?040
					MOVX 	A,@DPTR
					MOV  	R4,A
					INC  	DPTR
					MOVX 	A,@DPTR
					MOV  	R5,A
					LCALL	_TcCommand
				?C0019:
				;                     break;
							; SOURCE LINE # 49
					SJMP 	?C0020
				;                 
				;                 case MCU:
							; SOURCE LINE # 51
				?C0013:
				;                     len = SysCommand(buf, len);
							; SOURCE LINE # 52
					MOV  	R3,#01H
					MOV  	R2,#HIGH (buf?041)
					MOV  	R1,#LOW (buf?041)
					MOV  	DPTR,#len?040
					MOVX 	A,@DPTR
					MOV  	R4,A
					INC  	DPTR
					MOVX 	A,@DPTR
					MOV  	R5,A
					LCALL	_SysCommand
				?C0020:
					MOV  	DPTR,#len?040
					MOV  	A,R6
					MOVX 	@DPTR,A
					INC  	DPTR
					MOV  	A,R7
					MOVX 	@DPTR,A
				;                     break;
							; SOURCE LINE # 53
				;                     
				;                 default:
							; SOURCE LINE # 55
				;                     break;
							; SOURCE LINE # 56
				;             }
							; SOURCE LINE # 57
				;         }
							; SOURCE LINE # 58
				?C0004:
				;         
				;         if(len > 0)
							; SOURCE LINE # 60
					MOV  	DPTR,#len?040
					MOVX 	A,@DPTR
					MOV  	R4,A
					INC  	DPTR
					MOVX 	A,@DPTR
					MOV  	R5,A
					SETB 	C
					SUBB 	A,#00H
					MOV  	A,R4
					SUBB 	A,#00H
					JC   	?C0016
				;             CommSend(buf, len);
							; SOURCE LINE # 61
					MOV  	R3,#01H
					MOV  	R2,#HIGH (buf?041)
					MOV  	R1,#LOW (buf?041)
					LCALL	_CommSend
				;     }
							; SOURCE LINE # 62
				; }
							; SOURCE LINE # 63
				?C0016:
					RET  	
				; END OF Command
				
					END
							

相关资源