?? command.lst
字號:
C51 COMPILER V7.07 COMMAND 05/23/2004 18:02:34 PAGE 1
C51 COMPILER V7.07, COMPILATION OF MODULE COMMAND
OBJECT MODULE PLACED IN D:\ABC\COMMAND.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE COMMAND.c LARGE BROWSE DEBUG OBJECTEXTEND OBJECT(D:\ABC\COMMAND.obj)
stmt level source
1 #include <stdio.h>
2 #include <string.h>
3 #include <ctype.h>
4 #include <stdlib.h>
5
6 #ifndef _TYPE_DEFINE
7 #define _TYPE_DEFINE
8 typedef bit BOOL;
9 typedef char Uchar;
10 typedef unsigned char Uint8;
11 typedef unsigned int Uint16;
12 typedef unsigned long Uint32;
13 #endif
14
15 #define GETKEY _getkey() //鍵盤函數
16 #define PROMPT ">" //提示符
17 #define MAX_CMD_NUM 16 //命令數
18 #define MAX_CMD_LENGTH 128 //最大命令長度
19
20 xdata Uint8 CommandBuffer[MAX_CMD_LENGTH];
21
22 struct Str_CMD
23 {
24 Uint8 Command[MAX_CMD_LENGTH];
25 };
26
27 code struct Str_CMD CMD[]=
28 {
29 {"HELP"},
30 {"INIT DISK"},
31 {"LIST DISK"},
32 {"MOUNT DISK "},
33 {"LIST DRIVE"},
34 {"MOUNT DRIVE "},
35 {"DIR"},
36 {"CD "},
37 {"PLAY "},
38 {"STOP"},
39 {"PAUSE"},
40 {"GOON"},
41 {"LVOL "},
42 {"RVOL "},
43 {"AVOL "},
44 {"BASS "}
45 };
46
47 Uint8 AcceptCmd(void);
48 void PrintLogo(void);
49 void Help(void);
50
51 Uint8 AcceptCmd(void)
52 {
53 1 register Uint8 i,keycode;
54 1
55 1 while(1)
C51 COMPILER V7.07 COMMAND 05/23/2004 18:02:34 PAGE 2
56 1 {
57 2 i=0;
58 2 printf("%s",PROMPT);
59 2 keycode=GETKEY;
60 2 while(keycode!=0x0d&&i<MAX_CMD_LENGTH)
61 2 {
62 3 putchar(keycode);
63 3 CommandBuffer[i]=toupper(keycode);
64 3 keycode=GETKEY;
65 3 i++;
66 3 }
67 2 if (i==MAX_CMD_LENGTH)
68 2 printf("\n 命令太長.\n");
69 2 else if (i==0)
70 2 {
71 3 printf("\n");
72 3 }
73 2 else
74 2 {
75 3 putchar(0x0a);
76 3 CommandBuffer[i]=0x00;
77 3 i=0;
78 3 while(i<MAX_CMD_NUM&&strncmp(CMD[i].Command,CommandBuffer,strlen(CMD[i].Command))) i++;
79 3 if (i<MAX_CMD_NUM) return(i); else printf("未知命令.\n");
80 3 }
81 2 }
82 1 }
83
84 void PrintLogo(void)
85 {
86 1 printf("\n");
87 1 printf("**************************** \n");
88 1 printf("* MP3DIY Console * \n");
89 1 printf("* Beta 1 * \n");
90 1 printf("* 2004.05.23 01:00 * \n");
91 1 printf("* http://mp3diy.cable.nu * \n");
92 1 printf("**************************** \n");
93 1 printf("\n");
94 1 }
95
96 void Help(void)
97 {
98 1 register Uint8 i;
99 1 printf("支持如下命令:\n");
100 1 for(i=0;i<MAX_CMD_NUM;i++)
101 1 printf("\t %s\n",CMD[i].Command);
102 1 }
103
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 399 ----
CONSTANT SIZE = 2255 ----
XDATA SIZE = 128 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 + -