| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- 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
|