//实例9:用P0口、P1 口分别显示加法和减法运算结果
#include
void main(void)
{
unsigned char m,n;
m=43; //即十进制数2x16+11=43
n=60; //即十进制数3x16+12=60
P1=m+n; //P1=103=0110 0111B,结果P1.3、P1.4、P1.7 口的灯被点亮
P0=n-m; //P0=17=0001 0001B,结果P0.0、P0.4的灯被熄灭
}
这是反汇编程序(其中也包含了原来c程序):
92: ?C_STARTUP: LJMP STARTUP1
93:
94: RSEG ?C_C51STARTUP
95:
96: STARTUP1:
97:
98: IF IDATALEN <> 0
C:0x0000 020011 LJMP STARTUP1(C:0011)
3: void main(void)
4: {
5: unsigned char m,n;
6: m=43; //即十进制数2x16+11=43
C:0x0003 7F2B MOV R7,#0x2B
7: n=60; //即十进制数3x16+12=60
C:0x0005 7E3C MOV R6,#0x3C
8: P1=m+n; //P1=103=0110 0111B,结果P1.3、P1.4、P1.7 口的灯被点亮
C:0x0007 EF MOV A,R7
C:0x0008 2E ADD A,R6
C:0x0009 F590 MOV P1(0x90),A
9: P0=n-m; //P0=17=0001 0001B,结果P0.0、P0.4的灯被熄灭
C:0x000B C3 CLR C
C:0x000C EE MOV A,R6
C:0x000D 9F SUBB A,R7
C:0x000E F590 MOV P1(0x90),A
10: }
C:0x0010 22 RET
99: MOV R0,#IDATALEN - 1
C:0x0011 787F MOV R0,#0x7F
100: CLR A
C:0x0013 E4 CLR A
101: IDATALOOP: MOV @R0,A
C:0x0014 F6 MOV @R0,A
102: DJNZ R0,IDATALOOP
C:0x0015 D8FD DJNZ R0,IDATALOOP(C:0014)
151: MOV SP,#?STACK-1
152: ; This code is required if you use L51_BANK.A51 with Banking Mode 4
153: ; EXTRN CODE (?B_SWITCH0)
154: ; CALL ?B_SWITCH0 ; init bank mechanism to code bank 0
C:0x0017 758107 MOV SP(0x81),#0x07
155: LJMP ?C_START
C:0x001A 020003 LJMP main(C:0003)
C:0x001D 00 NOP
我是复制粘贴过来的,程序在编译时没错,想问的是,那些问号是怎么回事,就是这样写的吗?