📄 main.lst
字号:
C51 COMPILER V6.23a MAIN 11/20/2002 00:44:01 PAGE 1
C51 COMPILER V6.23a, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c LARGE DEBUG OBJECTEXTEND
stmt level source
1 #include <REG52.H> /* special function register declarations */
2 /* for the intended 8051 derivative */
3
4 #include <stdio.h> /* prototype declarations for I/O functions */
5
6 #ifdef MONITOR51 /* Debugging with Monitor-51 needs */
char code reserve [3] _at_ 0x23; /* space for serial interrupt if */
#endif /* Stop Exection with Serial Intr. */
9 /* is enabled */
10 /*------------------------------------------------
11 The main C function. Program execution starts
12 here after stack initialization.
13 ------------------------------------------------*/
14 void main (void) {
15 1
16 1 char *ptr1[4]={"china","chengdu","sichuang","chongqin"};
17 1 /* 指针数组ptr1 的4 个指针分别依此指向4个字符串*/
18 1 int i,*ptr2[3],a[3]={1,2,3},b[3][2]={1,2,3,4,5,6};
19 1 /*------------------------------------------------
20 1 Setup the serial port for 1200 baud at 16MHz.
21 1 ------------------------------------------------*/
22 1 #ifndef MONITOR51
23 1 SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
24 1 TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */
25 1 TH1 = 221; /* TH1: reload value for 1200 baud @ 16MHz */
26 1 TR1 = 1; /* TR1: timer 1 run */
27 1 TI = 1; /* TI: set TI to send first char of UART */
28 1 #endif
29 1 /*------------------------------------------------
30 1 Note that an embedded program never exits (because
31 1 there is no operating system to return to). It
32 1 must loop and execute forever.
33 1 ------------------------------------------------*/
34 1 for (i=0;i<4;i++)
35 1 printf("\n%s",ptr1[i]);/*依此输出ptr1数组4个指针指向的4个字符串*/
36 1 printf("\n") ;
37 1 for(i=0;i<3;i++)
38 1 ptr2[i]=&a[i];/*将整型一维数组a的3个元素的地址传递给指针数组ptr2*/
39 1 for(i=0;i<3;i++)/*依此输出ptr2所指向的3个整型变量的值*/
40 1 printf("%4d",*ptr2[i]) ;
41 1 printf("\n");
42 1 for(i=0;i<3;i++)
43 1 ptr2[i]=b[i];/*传递二维数组b的每行首地址给指针数组的4个指针*/
44 1 for(i=0;i<3;i++)/*按行输出*/
45 1 printf("%4d%4d\n",*ptr2[i],*ptr2[i]+1);
46 1 while (1) {};
47 1 }
48
49
50
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 532 ----
CONSTANT SIZE = 80 ----
C51 COMPILER V6.23a MAIN 11/20/2002 00:44:01 PAGE 2
XDATA SIZE = ---- 41
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -