?? control.lst
字號:
C51 COMPILER V7.02b CONTROL 01/18/2005 19:37:32 PAGE 1
C51 COMPILER V7.02b, COMPILATION OF MODULE CONTROL
OBJECT MODULE PLACED IN CONTROL.OBJ
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE CONTROL.c LARGE BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include <reg52.h> /* special function registers 8052 */
2 #include <rtx51tny.h> /* RTX-51 tiny functions & defines */
3 #include "shellfunc.h"
4
5 #define INIT 0 /* task number of task: init */
6 #define MAIN 1 /* task number of task: poll */
7 #define USER1 2
8 #define USER2 3
9
10
11 #define StatInputCom 0
12 #define StatExeCom 1
13
14
15 static unsigned char ComTable[MaxComNum][MaxLenCom+1]={"com1","com2","com3","com4","com5","com6","com7","o
-ut","close","clr","help","debug"};
16 int State=StatInputCom;
17 unsigned char ch;
18 int ShellEnd=0; /*Shell end flag*/
19 unsigned char ComBuf[MaxLenComBuf+1]; /*store '\0'*/
20 int i=-1; /*ComBuf pointer*/
21 int tem; /*Temp variable*/
22 int ComMatchFlag=0; /*Command match flag*/
23
24 int Matched=0; /*Match flag*/
25
26
27 /******************************************************************************/
28 /* Task 0 'init': Initialize */
29 /******************************************************************************/
30 void TaskInit (void) _task_ INIT { /* program execution starts here */
31 1 serial_init();
32 1 os_create_task (MAIN);
33 1 os_create_task (USER1);
34 1 os_create_task (USER2);
35 1 os_delete_task (INIT); /* stop init task (no longer needed) */
36 1
37 1 }
38
39 /******************************************************************************/
40 /* Task 1 'command': command processor */
41 /******************************************************************************/
42 void TaskPolled (void) _task_ MAIN {
43 1
44 1 PrintStr("\t\t***********************************************\n");
45 1 PrintStr("\t\t* Welcom to use SimpleShell *\n");
46 1 PrintStr("\t\t***********************************************\n\n\n");
47 1
48 1
49 1 PrintStr("> ");
50 1 while(!ShellEnd){
51 2
52 2 switch(State){
53 3 case StatInputCom:{
54 4 if(ch=_getkey()){
C51 COMPILER V7.02b CONTROL 01/18/2005 19:37:32 PAGE 2
55 5 if(ch==13) /*Enter return key*/
56 5 {
57 6 PrintStr("\n");
58 6 ComBuf[i+1]='\0';
59 6 if(i+1==0) PrintStr("> ");
60 6 else
61 6 State=StatExeCom;
62 6 }
63 5 else{
64 6 i=i+1;
65 6 if((i>=MaxLenComBuf)&&(ch!=8)){
66 7 putchar(7);
67 7 i=MaxLenComBuf-1;
68 7 }
69 6 else{
70 7 if(ch==8){
71 8 i=i-2;
72 8 if(i<-1) {i=-1;putchar(7);}
73 8 else{
74 9 putchar(8);
75 9 putchar(' ');
76 9 putchar(8);
77 9 }
78 8 }
79 7 else{
80 8 putchar(ch);
81 8 ComBuf[i]=ch;
82 8 }
83 7 }
84 6 }
85 5 break;
86 5 }
87 4 else{
88 5 os_wait (K_IVL, 10, 0);
89 5 break;
90 5 }
91 4 }
92 3 case StatExeCom:{
93 4 PrintStr("\n");
94 4 if(InterpretCommand(ComBuf,&WordTable)==1&&WordTable.Num!=0)
95 4 {
96 5 strlwr(WordTable.wt[0].Str);
97 5
98 5 for(tem=0;tem<MaxComNum&&!ComMatchFlag;tem++)
99 5 if(strcmp(WordTable.wt[0].Str,ComTable[tem])==0)
100 5 ComMatchFlag=1;
101 5 if(ComMatchFlag){
102 6 tem--;
103 6 switch(tem){
104 7 case 0:{Command1(&WordTable);break;}
105 7 case 1:{Command2(&WordTable);break;}
106 7 case 2:{Command3(&WordTable);break;}
107 7 case 3:{Command4(&WordTable);break;}
108 7 case 4:{Command5(&WordTable);break;}
109 7 case 5:{Command6(&WordTable);break;}
110 7 case 6:{Command7(&WordTable);break;}
111 7 case 7:{DebugOut(&WordTable);break;}
112 7 case 8:
113 7 {
114 8 //ShellEnd=1;
115 8 PrintStr("\n\tThis Command is limited!\n\n");
116 8 break;
C51 COMPILER V7.02b CONTROL 01/18/2005 19:37:32 PAGE 3
117 8 }
118 7 case 9:{clrscr();break;}
119 7 case 10:{DisplayHelpMenu(&WordTable);break;}
120 7 case 11:{DebugChange(&WordTable);break;}
121 7 }
122 6 }
123 5 else
124 5 PrintStr(" Bad command!\n\n");
125 5
126 5 }
127 4 else{
128 5 if(WordTable.Num) PrintStr(" Bad command!\n\n");
129 5 }
130 4
131 4 ComMatchFlag=0;
132 4 State=StatInputCom;
133 4 if(ShellEnd) {PrintStr("\n\n");}
134 4 else PrintStr("> ");
135 4 i=-1;
136 4 break;
137 4 }
138 3 default:{
139 4 //ShellEnd=1;
140 4 PrintStr("System fatal error!\n");
141 4 putchar(7);putchar(7);putchar(7);
142 4 }
143 3 }
144 2 }
145 1 }
146 /******************************************************************************/
147 /* Task 3 用戶任務1 */
148 /******************************************************************************/
149 void TaskUser1 (void) _task_ USER1
150 {
151 1 for(;;){
152 2 if(mDebug&0x1)
153 2 PrintStr("\tUserTask1 is active.\n");
154 2
155 2 os_wait(K_TMO,255,0);
156 2 }
157 1 }
158 /******************************************************************************/
159 /* Task 3 用戶任務2 */
160 /******************************************************************************/
161 void TaskUser2 (void) _task_ USER2
162 {
163 1 int i;
164 1 i=0;
165 1
166 1 for(;;){
167 2 if(mDebug&0x2)
168 2 {
169 3 i=1-i;
170 3 if(i==0)
171 3 {
172 4 P0=0;
173 4 }
174 3 else
175 3 {
176 4 P0=1;
177 4 }
178 3 }
C51 COMPILER V7.02b CONTROL 01/18/2005 19:37:32 PAGE 4
179 2
180 2 os_wait(K_TMO,255,0);
181 2 }
182 1 }
183
184
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 882 ----
CONSTANT SIZE = 256 ----
XDATA SIZE = 211 2
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 + -