In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Sparks-R-Fun wrote: Kramer, I agree. Creating a menu for the first time would be much easier in SX/B than trying to create one from scratch in assembler! So I would start there. Here is how I would do it. First I would create the desired logic structure in SX/B. Then, if I needed to present it in assembly language I would use CTRL-L to list the assembly output. Then I would modify the code produced to fit the rest of my assembly program. For example, to process a single byte value as a menu selection I would use the SX/B command [b]LookDown[/b] to check for a valid menu selection followed by a [b]Branch[/b] statement to go to the portion of my code that handles that menu selection. Borrowing from an example in the SX/B help files... [CODE]LOOKDOWN Menu_Selection, "F", "B", "S", Menu_Index ' compare against valid commands BRANCH Menu_Index, Forward, Backward, Stop_Bot ' execute valid command [/CODE] Becomes... [CODE]MOV __PARAM1,#-1 ; LOOKDOWN Menu_Selection, "F", "B", "S", Menu_Index ' compare against valid commands INC __PARAM1 CJNE Menu_Selection,#"F",@$+7 MOV Menu_Index,__PARAM1 INC __PARAM1 CJNE Menu_Selection,#"B",@$+7 MOV Menu_Index,__PARAM1 INC __PARAM1 CJNE Menu_Selection,#"S",@$+7 MOV Menu_Index,__PARAM1 MOV __PARAM1,Menu_Index ; BRANCH Menu_Index, Forward, Backward, Stop_Bot ' execute valid commands TEST __PARAM1 JZ @Forward DEC __PARAM1 JZ @Backward DEC __PARAM1 JZ @Stop_Bot [/CODE] If you examine this example for a while you should be able to figure out how it works. You need to change the variables, the menu options and the branch locations to fit your program. That should not be too difficult. 90% of the menu processing work is already done for you! - Sparks ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=159140#m159168 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)