XDEF Menu XREF __SEG_END_SSTACK,pw_set,disp,display_string,menu_option_num,menu_active,menu_selection Variables: Section Constants: Section Code: Section Menu: ;push register and accumulator values for retention PSHA PSHB PSHD PSHX PSHY LDAA menu_active ;do nothing if the menu is not active CMPA #$00 LBEQ Return PrintTopLine: ;all menu items print this line movb #'S',disp movb #'e',disp+1 movb #'l',disp+2 movb #'e',disp+3 movb #'c',disp+4 movb #'t',disp+5 movb #' ',disp+6 movb #'o',disp+7 movb #'p',disp+8 movb #'t',disp+9 movb #'i',disp+10 movb #'o',disp+11 movb #'n',disp+12 movb #':',disp+13 movb #' ',disp+14 movb #' ',disp+15 ;next line ;load the menu option and output the correct lower string LDAA menu_option_num CMPA #$01 LBEQ PrintOption1 CMPA #$02 LBEQ PrintOption2 CMPA #$03 LBEQ PrintOption3 CMPA #$04 LBEQ PrintOption4 CMPA #$05 LBEQ PrintOption5 CMPA #$06 LBEQ PrintOption6 CMPA #$07 LBEQ PrintOption7 Reset: MOVB #$01,menu_option_num LBRA PrintTopLine ;==================== main menu ======================= ; 1. water the plants ; 2. show temperature (adjusts when the pot is turned) ; 3. show time ; 4. set time (passord protected) ; 5. change password (password protected) ;====================================================== PrintOption1: movb #'1',disp+16 movb #'.',disp+17 movb #' ',disp+18 movb #'W',disp+19 movb #'a',disp+20 movb #'t',disp+21 movb #'e',disp+22 movb #'r',disp+23 movb #' ',disp+24 movb #'p',disp+25 movb #'l',disp+26 movb #'a',disp+27 movb #'n',disp+28 movb #'t',disp+29 movb #'s',disp+30 movb #' ',disp+31 movb #0,disp+32 ;string terminator, acts like '\0' ;print the prompt string LDD #disp ;both of these steps are necessary to jsr display_string ;print to the LCD screen ;get out of the menu, do not go to PrintOption2 LBRA Return PrintOption2: movb #'2',disp+16 movb #'.',disp+17 movb #' ',disp+18 movb #'S',disp+19 movb #'h',disp+20 movb #'o',disp+21 movb #'w',disp+22 movb #' ',disp+23 movb #'t',disp+24 movb #'e',disp+25 movb #'m',disp+26 movb #'p',disp+27 movb #'.',disp+28 movb #' ',disp+29 movb #' ',disp+30 movb #' ',disp+31 movb #0,disp+32 ;string terminator, acts like '\0' ;print the prompt string LDD #disp ;both of these steps are necessary to jsr display_string ;print to the LCD screen ;get out of the menu, do not go to PrintOption23 LBRA Return PrintOption3: movb #'3',disp+16 movb #'.',disp+17 movb #' ',disp+18 movb #'S',disp+19 movb #'h',disp+20 movb #'o',disp+21 movb #'w',disp+22 movb #' ',disp+23 movb #'t',disp+24 movb #'i',disp+25 movb #'m',disp+26 movb #'e',disp+27 movb #' ',disp+28 movb #' ',disp+29 movb #' ',disp+30 movb #' ',disp+31 movb #0,disp+32 ;string terminator, acts like '\0' ;print the prompt string LDD #disp ;both of these steps are necessary to jsr display_string ;print to the LCD screen ;get out of the menu, do not go to PrintOption23 LBRA Return PrintOption4: movb #'4',disp+16 movb #'.',disp+17 movb #' ',disp+18 movb #'S',disp+19 movb #'e',disp+20 movb #'t',disp+21 movb #' ',disp+22 movb #'t',disp+23 movb #'i',disp+24 movb #'m',disp+25 movb #'e',disp+26 movb #' ',disp+27 movb #' ',disp+28 movb #' ',disp+29 movb #' ',disp+30 movb #' ',disp+31 movb #0,disp+32 ;string terminator, acts like '\0' ;print the prompt string LDD #disp ;both of these steps are necessary to jsr display_string ;print to the LCD screen ;get out of the menu, do not go to PrintOption23 LBRA Return PrintOption5: movb #'5',disp+16 movb #'.',disp+17 movb #' ',disp+18 movb #'R',disp+19 movb #'e',disp+20 movb #'s',disp+21 movb #'e',disp+22 movb #'t',disp+23 movb #' ',disp+24 movb #'p',disp+25 movb #'a',disp+26 movb #'s',disp+27 movb #'s',disp+28 movb #'w',disp+29 movb #'d',disp+30 movb #'.',disp+31 movb #0,disp+32 ;string terminator, acts like '\0' ;print the prompt string LDD #disp ;both of these steps are necessary to jsr display_string ;print to the LCD screen ;get out of the menu, do not go to PrintOption23 LBRA Return PrintOption6: movb #'6',disp+16 movb #'.',disp+17 movb #' ',disp+18 movb #'P',disp+19 movb #'l',disp+20 movb #'a',disp+21 movb #'n',disp+22 movb #'t',disp+23 movb #' ',disp+24 movb #'s',disp+25 movb #'e',disp+26 movb #'e',disp+27 movb #'d',disp+28 movb #'s',disp+29 movb #' ',disp+30 movb #' ',disp+31 movb #0,disp+32 ;string terminator, acts like '\0' ;print the prompt string LDD #disp ;both of these steps are necessary to jsr display_string ;print to the LCD screen ;get out of the menu, do not go to PrintOption6 BRA Return PrintOption7: movb #'7',disp+16 movb #'.',disp+17 movb #' ',disp+18 movb #'S',disp+19 movb #'h',disp+20 movb #'o',disp+21 movb #'w',disp+22 movb #' ',disp+23 movb #'p',disp+24 movb #'l',disp+25 movb #'o',disp+26 movb #'t',disp+27 movb #' ',disp+28 movb #' ',disp+29 movb #' ',disp+30 movb #' ',disp+31 movb #0,disp+32 ;string terminator, acts like '\0' ;print the prompt string LDD #disp ;both of these steps are necessary to jsr display_string ;print to the LCD screen ;get out of the menu, do not go to PrintOption7 BRA Return Return: ;restore registers and accumulators PULY PULX PULD PULB PULA RTS