这个是C代码(我用SWITCH语句实验了也是一样的) if(key_1!=0x00) { temp=key_1; if(use_p==0x01) { if((temp&0x01)==1) go_on=1; else go_on=0; } if(use_p==0x02) { if((temp&0x02)==1) go_on=1; else go_on=0; } if(use_p==0x03) { if((temp&0x04)==1) go_on=1; else go_on=0; } if(use_p==0x04) { if((temp&0x08)==1) go_on=1; else go_on=0; } if(use_p==0x05) { if((temp&0x10)==1) go_on=1; else go_on=0; } if(use_p==0x06) { if((temp&0x20)==1) go_on=1; else go_on=0; } if(use_p==0x07) { if((temp&0x40)==1) go_on=1; else go_on=0; } if(use_p==0x08) { if((temp&0x80)==1) go_on=1; else go_on=0; } } 这个是汇编代码: C:0x0776 E54C MOV A,key_1(0x4C) C:0x0778 7003 JNZ C:077D C:0x077A 02080B LJMP C:080B C:0x077D FF MOV R7,A C:0x077E E530 MOV A,use_p(0x30) C:0x0780 B4010A CJNE A,#0x01,C:078D C:0x0783 EF MOV A,R7 C:0x0784 30E004 JNB 0xE0.0,C:078B C:0x0787 D21E SETB go_on(0x23.6) C:0x0789 8002 SJMP C:078D C:0x078B C21E CLR go_on(0x23.6) C:0x078D E530 MOV A,use_p(0x30) C:0x078F B4020D CJNE A,#0x02,C:079F C:0x0792 EF MOV A,R7 C:0x0793 5402 ANL A,#0x02 C:0x0795 FE MOV R6,A C:0x0796 BE0104 CJNE R6,#0x01,C:079D C:0x0799 D21E SETB go_on(0x23.6) C:0x079B 8002 SJMP C:079F C:0x079D C21E CLR go_on(0x23.6) C:0x079F E530 MOV A,use_p(0x30) C:0x07A1 B4030D CJNE A,#0x03,C:07B1 C:0x07A4 EF MOV A,R7 C:0x07A5 5404 ANL A,#0x04 C:0x07A7 FE MOV R6,A C:0x07A8 BE0104 CJNE R6,#0x01,C:07AF C:0x07AB D21E SETB go_on(0x23.6) C:0x07AD 8002 SJMP C:07B1 C:0x07AF C21E CLR go_on(0x23.6) C:0x07B1 E530 MOV A,use_p(0x30) C:0x07B3 B4040D CJNE A,#0x04,C:07C3 C:0x07B6 EF MOV A,R7 C:0x07B7 5408 ANL A,#0x08 C:0x07B9 FE MOV R6,A C:0x07BA BE0104 CJNE R6,#0x01,C:07C1 C:0x07BD D21E SETB go_on(0x23.6) C:0x07BF 8002 SJMP C:07C3 C:0x07C1 C21E CLR go_on(0x23.6) C:0x07C3 E530 MOV A,use_p(0x30) C:0x07C5 B4050D CJNE A,#0x05,C:07D5 C:0x07C8 EF MOV A,R7 C:0x07C9 5410 ANL A,#0x10 C:0x07CB FE MOV R6,A C:0x07CC BE0104 CJNE R6,#0x01,C:07D3 C:0x07CF D21E SETB go_on(0x23.6) C:0x07D1 8002 SJMP C:07D5 C:0x07D3 C21E CLR go_on(0x23.6) C:0x07D5 E530 MOV A,use_p(0x30) C:0x07D7 B4060D CJNE A,#0x06,C:07E7 C:0x07DA EF MOV A,R7 C:0x07DB 5420 ANL A,#0x20 C:0x07DD FE MOV R6,A C:0x07DE BE0104 CJNE R6,#0x01,C:07E5 C:0x07E1 D21E SETB go_on(0x23.6) C:0x07E3 8002 SJMP C:07E7 C:0x07E5 C21E CLR go_on(0x23.6) C:0x07E7 E530 MOV A,use_p(0x30) C:0x07E9 B4070D CJNE A,#0x07,C:07F9 C:0x07EC EF MOV A,R7 C:0x07ED 5440 ANL A,#0x40 C:0x07EF FE MOV R6,A C:0x07F0 BE0104 CJNE R6,#0x01,C:07F7 C:0x07F3 D21E SETB go_on(0x23.6) C:0x07F5 8002 SJMP C:07F9 C:0x07F7 C21E CLR go_on(0x23.6) C:0x07F9 E530 MOV A,use_p(0x30) C:0x07FB B4080D CJNE A,#0x08,C:080B C:0x07FE EF MOV A,R7 C:0x07FF 5480 ANL A,#P0(0x80) C:0x0801 FE MOV R6,A C:0x0802 BE0104 CJNE R6,#0x01,C:0809 C:0x0805 D21E SETB go_on(0x23.6) C:0x0807 8002 SJMP C:080B C:0x0809 C21E CLR go_on(0x23.6) 3542: } 3543: } |