📄 main.lst
字号:
C51 COMPILER V6.23a MAIN 11/20/2002 18:04:29 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 #include <stdlib.h>/*使用malloc( )需要*/
6
7 #ifdef MONITOR51 /* Debugging with Monitor-51 needs */
char code reserve [3] _at_ 0x23; /* space for serial interrupt if */
#endif /* Stop Exection with Serial Intr. */
10 /* is enabled */
11 struct data1 /*定义结构体*/
12 {
13 int day,month,year;
14 };
15 struct stu/*定义结构体*/
16 {
17 char name[20];
18 long num;
19 struct data1 birthday;/*嵌套的结构体类型成员*/
20 } ;
21 /*------------------------------------------------
22 The main C function. Program execution starts
23 here after stack initialization.
24 ------------------------------------------------*/
25 void main (void) {
26 1
27 1 struct stu *student;/*定义结构体类型指针*/
28 1 /*------------------------------------------------
29 1 Setup the serial port for 1200 baud at 16MHz.
30 1 ------------------------------------------------*/
31 1 #ifndef MONITOR51
32 1 SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
33 1 TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */
34 1 TH1 = 221; /* TH1: reload value for 1200 baud @ 16MHz */
35 1 TR1 = 1; /* TR1: timer 1 run */
36 1 TI = 1; /* TI: set TI to send first char of UART */
37 1 #endif
38 1 /*------------------------------------------------
39 1 Note that an embedded program never exits (because
40 1 there is no operating system to return to). It
41 1 must loop and execute forever.
42 1 ------------------------------------------------*/
43 1 init_mempool(0x1000,0x500);
44 1 student=malloc(sizeof(struct stu));/*为指针变量分配安全的地址*/
45 1 printf("Input name,number,year,month,day:\n");
46 1 scanf("%s",student->name);/*输入学生姓名、学号、出生年月日*/
47 1 scanf("%ld",&student->num) ;
48 1 scanf("%d%d%d",&student->birthday.year,&student->birthday.month,&student->birthday.day);
49 1 printf("\nOutput name,number,year,month,day\n" );
50 1 /*打印输出各成员项的值*/
51 1 printf("%20s%10ld%10d//%d//%d\n",student->name,student->num,
52 1 student->birthday.year,student->birthday.month,
53 1 student->birthday.day) ;
54 1 while (1) {};
55 1 }
C51 COMPILER V6.23a MAIN 11/20/2002 18:04:29 PAGE 2
56
57
58
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 318 ----
CONSTANT SIZE = 108 ----
XDATA SIZE = ---- 3
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 + -