| ??? 11/24/03 05:58 Read: times |
#59280 - RE: Hierarchical menu structure in assem Responding to: ???'s previous message |
Beats me why a state machine wouldn't work here?
You mention you have 18 menus: the first number is the state number. this could be stored as a variable called curr_menu switch(curr_menu) { case 0: //menu1 level 1 if (key == NEXT_LEVEL) curr_menu = 1; if (key == NEXT_MENU) curr_menu = 3 break; case 1: //menu 1 level 2 if (key == NEXT_LEVEL) curr_menu = 2; if (key == NEXT_MENU) curr_menu = 0 break; case 2: //menu 1 level 3 if (key == NEXT_LEVEL) curr_menu = 2; if (key == NEXT_MENU) curr_menu = 1 break; case 3 //menu 2 level 1 } this could also be implemented in a table: curr_menu indexes into table[NUM_MENUS][2] table: db 1,3 ;next level,next menu db 2,0 ;next level,next menu db 2,1 ;next level,next menu ... .... you could also add pointers to the menu strings and/or code to process the menu table: db 1,3 ;next level,next menu dw menu_str1 dw menu_code1 db 2,0 ;next level,next menu dw menu_str2 dw menu_code2 db 2,1 ;next level,next menu dw menu_str3 dw menu_code3 ..... ..... sure just about everybody has done a menu system before - don't be afraid to try your own as everyone wants something slightly different. |
| Topic | Author | Date |
| Hierarchical menu structure in assembler | 01/01/70 00:00 | |
| RE: Hierarchical menu structure in assembler | 01/01/70 00:00 | |
| RE: Hierarchical menu structure in assem | 01/01/70 00:00 | |
| RE: Hierarchical menu structure in assem | 01/01/70 00:00 | |
| RE: Hierarchical menu structure in assem | 01/01/70 00:00 | |
| RE: Hierarchical menu structure in assem | 01/01/70 00:00 | |
| RE: Hierarchical menu structure in assembler | 01/01/70 00:00 | |
RE: thanks for your input | 01/01/70 00:00 |



