📄 menudrive.lst
字号:
C51 COMPILER V7.09 MENUDRIVE 07/09/2005 09:45:19 PAGE 1
C51 COMPILER V7.09, COMPILATION OF MODULE MENUDRIVE
OBJECT MODULE PLACED IN menudrive.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE menudrive.c LARGE BROWSE DEBUG OBJECTEXTEND
line level source
1 //---------------------------------------------
2 // the general menu driver using the tree struct
3 // write by liujianwei 2005-7-1
4 // e-mail:liujianwei@ruyi.com
5 // qq:361299856
6 //---------------------------------------------
7
8
9 //----------------------------------------------------------------------------------
10 // the globle varible declar here
11 //---------------------------------------------------------------------------------
12 #include <keypaddrive.h>
13 #include <lcddrive.h>
14 #define RUNING 0x01
15 #define OVER_RUN 0x00
16 #define NULL 0xffff
17 #define unchar unsigned char
18 typedef struct MENU{
19 unchar Horizon; //heng zuo biao
20 unchar *MenuTitle ;
21 struct MENU *pSonMenu;
22 struct MENU *pFatheMenu;
23 struct MENU *pBrotheNext;
24 struct MENU *pBrothePrev;
25 void (*CurrentOperation)();
26 };
27 void Function0();
28 void Function1();
29 void Function2();
30 void Function3();
31 void Function4();
32 void Function5();
33 void Function6();
34 unchar menu1[]="the menu1";
35 unchar menu2[]="the menu2";
36 unchar menu3[]="the menu3";
37 unchar menu4[]="the menu4";
38 unchar subm5[]="the menu5";
39 unchar subm6[]="the menu6";
40 unchar subm7[]="the menu7";
41
42
43
44
45 struct MENU code MyMenu [7]={
46
47 {0,&menu1 ,NULL,NULL,&MyMenu[1],NULL,Function0 },
48 {1,&menu2 ,&MyMenu[4],NULL,&MyMenu[2],&MyMenu[0],Function1},
49 {2,&menu3 ,NULL,NULL,&MyMenu[3],&MyMenu[1],Function2},
50 {3,&menu4 ,NULL,NULL,NULL,&MyMenu[2],Function3},
51 {0,&subm5 ,&MyMenu[6],&MyMenu[1],&MyMenu[5],NULL,Function4},
52 {1,&subm6 ,NULL,&MyMenu[1],NULL,&MyMenu[4],Function5},
53 {0,&subm7 ,NULL,&MyMenu[4],NULL,NULL,Function6},
54 };
55
C51 COMPILER V7.09 MENUDRIVE 07/09/2005 09:45:19 PAGE 2
56 struct MENU *pCurrentMenu=&MyMenu[0];
57 struct MENU *pCurrentMenu1=&MyMenu[0];
58 unchar MenuStatus=0;
59 unchar CurrentOperations=RUNING;
60
61 //------------------------------------
62 //initialzation menu
63 //------------------------------------
64
65 // pCurrentMenu =&MyMenu[0]; //can't be set here but i don't know why??????????
66
67 // pCurrentMenu1 =&MyMenu[0];
68
69 void MenuFunction()
70 {
71 1 unchar Chars,i;
72 1
73 1 switch(MenuStatus)
74 1
75 1 {
76 2 case 0:
77 2 {
78 3 Chars=GetKey();
79 3 if (Chars==ESC_KEY)
80 3 {
81 4 //ClrScreen();
82 4 if (pCurrentMenu1->pFatheMenu!=NULL)
83 4 {
84 5 pCurrentMenu1=pCurrentMenu1->pFatheMenu;
85 5 pCurrentMenu1=pCurrentMenu1->pSonMenu;
86 5 }
87 4 else
88 4 while(pCurrentMenu1->pBrothePrev!=NULL)
89 4 pCurrentMenu1=pCurrentMenu1->pBrothePrev;
90 4
91 4 i=0;
92 4 while(pCurrentMenu1->pBrotheNext!=NULL)
93 4 {
94 5
95 5 AdressPointSet((6+i*32)%256,(6+i*32)/256);
96 5 DisplayString(pCurrentMenu1->MenuTitle);
97 5 i++;
98 5 pCurrentMenu1=pCurrentMenu1->pBrotheNext;
99 5
100 5 }
101 4 AdressPointSet((6+i*32)%256,(6+i*32)/256);
102 4 DisplayString(pCurrentMenu1->MenuTitle);
103 4 AdressPointSet((GRAPHIC_HOME_ADRESS+6+pCurrentMenu->Horizon*32)%256,(GRAPHIC_HOME_ADRESS+6+pCurren
-tMenu->Horizon*32)/256);
104 4
105 4 GraphicAttribAutoWrite(05,10);
106 4
107 4
108 4 MenuStatus=1;
109 4
110 4 }
111 3
112 3 break;
113 3 }
114 2 case 1:
115 2 {
116 3 switch(GetKey())
C51 COMPILER V7.09 MENUDRIVE 07/09/2005 09:45:19 PAGE 3
117 3 {
118 4 case ENTER_KEY:
119 4
120 4 //ClrScreen();
121 4 if (pCurrentMenu->pSonMenu==NULL)
122 4
123 4 MenuStatus=2;
124 4 else
125 4 {
126 5 pCurrentMenu=pCurrentMenu->pSonMenu;
127 5
128 5
129 5 pCurrentMenu1=pCurrentMenu;
130 5 if (pCurrentMenu1->pFatheMenu!=NULL)
131 5 {
132 6 pCurrentMenu1=pCurrentMenu1->pFatheMenu;
133 6 pCurrentMenu1=pCurrentMenu1->pSonMenu;
134 6 }
135 5 else
136 5 while(pCurrentMenu1->pBrothePrev!=NULL)
137 5 pCurrentMenu1=pCurrentMenu1->pBrothePrev;
138 5 i=0;
139 5 while(pCurrentMenu1->pBrotheNext!=NULL)
140 5 {
141 6 AdressPointSet((6+i*32)%256,(6+i*32)/256);
142 6 DisplayString(pCurrentMenu1->MenuTitle);
143 6 i++;
144 6 pCurrentMenu1=pCurrentMenu1->pBrotheNext;
145 6
146 6 }
147 5 AdressPointSet((6+i*32)%256,(6+i*32)/256);
148 5 DisplayString(pCurrentMenu1->MenuTitle);
149 5 AdressPointSet((GRAPHIC_HOME_ADRESS+6+pCurrentMenu->Horizon*32)%256,(GRAPHIC_HOME_ADRESS+6+pCurren
-tMenu->Horizon*32)/256);
150 5
151 5 GraphicAttribAutoWrite(05,10);
152 5 }
153 4 break;
154 4
155 4 case UP_KEY:
156 4 if (pCurrentMenu->pBrothePrev!=NULL)
157 4 {
158 5 AdressPointSet((GRAPHIC_HOME_ADRESS+6+pCurrentMenu->Horizon*32)%256,(GRAPHIC_HOME_ADRESS+6+pCurrentM
-enu->Horizon*32)/256);
159 5 GraphicAttribAutoWrite(00,10); // clr the 反白显示
160 5 pCurrentMenu=pCurrentMenu->pBrothePrev;
161 5 AdressPointSet((GRAPHIC_HOME_ADRESS+6+pCurrentMenu->Horizon*32)%256,(GRAPHIC_HOME_ADRESS+6+pCurrentM
-enu->Horizon*32)/256);
162 5 GraphicAttribAutoWrite(05,10); //使之反白显示
163 5 }
164 4 break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -