annotate src/menu_processor.asm @ 613:8077ee960199

fix for italian and french language
author heinrichsweikamp
date Wed, 30 Jan 2019 16:27:56 +0100
parents 6dd6b37da7c8
children e76a87e087ef
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
3 ; File menu_processor.asm REFACTORED VERSION V2.99d
0
heinrichsweikamp
parents:
diff changeset
4 ;
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 229
diff changeset
5 ; Routines to handle all hwOS graphic/text menus.
0
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 229
diff changeset
10 ; 2012-11-02 : [jDG] Cleanup for hwOS: removed icons. Added scrolling.
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
11 ; But need a font with lower/upper alpha chars...
0
heinrichsweikamp
parents:
diff changeset
12
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
13 #include "hwos.inc"
0
heinrichsweikamp
parents:
diff changeset
14 #include "convert.inc"
heinrichsweikamp
parents:
diff changeset
15 #include "strings.inc"
heinrichsweikamp
parents:
diff changeset
16 #include "tft.inc"
heinrichsweikamp
parents:
diff changeset
17 #include "varargs.inc"
heinrichsweikamp
parents:
diff changeset
18 #include "wait.inc"
heinrichsweikamp
parents:
diff changeset
19 #include "start.inc"
heinrichsweikamp
parents:
diff changeset
20 #include "surfmode.inc"
heinrichsweikamp
parents:
diff changeset
21 #include "divemode.inc"
heinrichsweikamp
parents:
diff changeset
22 #include "tft_outputs.inc"
heinrichsweikamp
parents:
diff changeset
23 #include "eeprom_rs232.inc"
62
e7c7c7eeea58 show battery voltage in info menu
heinrichsweikamp
parents: 50
diff changeset
24 #include "adc_lightsensor.inc"
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
25 #include "i2c.inc"
229
e1e5876bd777 minor cleanup
mh@mh-THINK
parents: 189
diff changeset
26
0
heinrichsweikamp
parents:
diff changeset
27
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
28 ; NOTE: needs to be identical in .inc and .asm !
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
29 #define MENU_LINES_MAX .7 ; number of lines per screen?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
30 #define MENU_TITLE_FONT WIN_STD ; font needs to contain lower and UPPER chars
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
31 #define MENU_LINE_FONT WIN_SMALL ; font needs to contain lower and UPPER chars
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
32 #define MENU_LEFT .20 ; position of first menu item
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
33 #define MENU_HEIGHT .27 ; spacing between menu lines
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
34 #define MENU_VCENTER .125 ; position on screen
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
35 #define MENU_LINE_MAX_LENGTH .20 ; length in characters
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
36 #define option_item proc_item
0
heinrichsweikamp
parents:
diff changeset
37
heinrichsweikamp
parents:
diff changeset
38 ; Other needed references
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
39 extern aa_wordprocessor
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
40 extern option_inc
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
41 extern option_draw
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
42 extern comm_mode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
43 extern TFT_clear_divemode_menu
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
44 extern TFT_divemask_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
45 extern rtc_set_rtc
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
46 extern divemode_option0_return
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
47 extern TFT_fillup_with_spaces
0
heinrichsweikamp
parents:
diff changeset
48
heinrichsweikamp
parents:
diff changeset
49
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
50 menu_proc CODE
0
heinrichsweikamp
parents:
diff changeset
51
heinrichsweikamp
parents:
diff changeset
52 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
53 ; menu handler.
heinrichsweikamp
parents:
diff changeset
54 ;
heinrichsweikamp
parents:
diff changeset
55 ; Input: TBLPTR = addr of menu block.
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
56 global menu_processor
0
heinrichsweikamp
parents:
diff changeset
57 menu_processor:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
58 banksel common ; bank 1
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
59 btfss divemode ; in divemode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
60 call speed_fastest ; NO - make it quick
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
61 ;---- Read menu block ------------------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
62 VARARGS_BEGIN ; read inline PROM data
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
63 clrf STKPTR ; never return from here
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
64 VARARGS_GET8 item_max ; get number of items
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
65 VARARGS_GET8 menu_flags ; get flags
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
66 VARARGS_GET24 menu_title ; get pointer to menu title
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
67 VARARGS_GET8 menu_center ; vertical position
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
68 movff TBLPTRL, menu_block+0 ; save base address for menu_read_item
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
69 movff TBLPTRH, menu_block+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
70 movff TBLPTRU, menu_block+2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
71 btfss divemode ; in divemode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
72 bra menu_processor0 ; NO
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
73 ; Required for menus with less entries than the calling menu but not so nice when setting up gas 6.... mH
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
74 movlw .1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
75 cpfsgt menupos1 ; only if menupos1 = 1...
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
76 call TFT_clear_divemode_menu ; ... clear the menu!
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
77 ; Draw one frame around the divemode menu
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
78 call TFT_divemask_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
79 WIN_FRAME_COLOR16 dm_menu_row, dm_menu_lower, dm_menu_left ,dm_menu_right ; top, bottom, left, right
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
80 call TFT_standard_color
0
heinrichsweikamp
parents:
diff changeset
81
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
82 bra menu_processor1 ; skip next code segment in divemode
0
heinrichsweikamp
parents:
diff changeset
83
heinrichsweikamp
parents:
diff changeset
84 menu_processor0:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
85 ;---- draw menu title ------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
86 clrf CCP1CON ; stop PWM
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
87 bcf PORTC,2 ; pull PWM out to GND
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
88 call TFT_ClearScreen
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
89 rcall menu_processor_title
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
90 rcall menu_processor_bottom_line
0
heinrichsweikamp
parents:
diff changeset
91
169
dcf3e08f31ac CHANGE: Improve internal logbook usability
heinrichsweikamp
parents: 125
diff changeset
92 menu_processor1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
93 movlw FT_SMALL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
94 movff WREG, win_font
169
dcf3e08f31ac CHANGE: Improve internal logbook usability
heinrichsweikamp
parents: 125
diff changeset
95
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
96 ;---- Select menu type -----------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
97 bra menu_vertical
0
heinrichsweikamp
parents:
diff changeset
98
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
99
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
100 ;=============================================================================
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
101 ; draw menu bottom line
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
102 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
103 global menu_processor_bottom_line,menu_processor_bottom_line_comm
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
104 menu_processor_bottom_line:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
105 ;---- Draw bottom line -----------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
106 TEXT_TINY .5, .240-.16, tNext
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
107 TEXT_TINY .160-.6*.6, .240-.16, tEnter
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
108 WIN_COLOR color_greenish
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
109 menu_processor_bottom_line_comm:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
110 ; Serial Number and Firmware Version
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 607
diff changeset
111 WIN_TINY .32,.240-.16
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
112 STRCPY "#"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
113 call TFT_cat_serial
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
114 STRCAT " v"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
115 call TFT_cat_firmware
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 607
diff changeset
116 STRCAT " "
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
117 call TFT_cat_beta_release
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
118 STRCAT_PRINT ""
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
119 call TFT_standard_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
120 bcf win_invert
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
121 return
0
heinrichsweikamp
parents:
diff changeset
122
heinrichsweikamp
parents:
diff changeset
123 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
124 ; (re-)draw menu title
0
heinrichsweikamp
parents:
diff changeset
125 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
126 menu_processor_title:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
127 WIN_BOX_BLACK .2,.23,.0,.159 ; clear menu title
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
128 MENU_TITLE_FONT .0, .2 ; menu title positioning
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
129 btfss menu_flags,0 ; static or dynamic title?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
130 bra menu_processor_static_title ; static title
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
131 rcall menu_processor_call_title ; dynamic title - add gas, detail and color
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
132 bra menu_processor_title_1
0
heinrichsweikamp
parents:
diff changeset
133
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
134 menu_processor_static_title:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
135 movff menu_title+0,FSR1L ; just copy string
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
136 movff menu_title+1,FSR1H
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
137 call strcpy_text
0
heinrichsweikamp
parents:
diff changeset
138
heinrichsweikamp
parents:
diff changeset
139 menu_processor_title_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
140 WIN_COLOR color_greenish
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
141 movf FSR2L,W ; get title length
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
142 mullw .9 ; convert to half pixels
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
143 bcf STATUS,C ; clear carry
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
144 rrcf PRODL ; /2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
145 movf PRODL,W ; back to WREG
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
146 sublw .80 ; 80 - width
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
147 movwf win_leftx2 ; aligned to center
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
148 movlw .0 ; string termination code
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
149 movff WREG,buffer+.17 ; limit to 17 chars (std font max.)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
150 call aa_wordprocessor
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
151 call TFT_standard_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
152 return
0
heinrichsweikamp
parents:
diff changeset
153
heinrichsweikamp
parents:
diff changeset
154 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
155 ; Call dynamic proc for menu title:
heinrichsweikamp
parents:
diff changeset
156
heinrichsweikamp
parents:
diff changeset
157 menu_processor_call_title:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
158 movff menu_title+2,PCLATU ; execute computed goto
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
159 movff menu_title+1,PCLATH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
160 movf menu_title+0,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
161 movwf PCL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
162
0
heinrichsweikamp
parents:
diff changeset
163 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
164 ; Restart with first icon/line selected
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
165 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
166 global menu_processor_reset
0
heinrichsweikamp
parents:
diff changeset
167 menu_processor_reset:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
168 banksel menustack
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
169 lfsr FSR2,menustack
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
170 clrf POSTINC2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
171 clrf POSTINC2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
172 clrf POSTINC2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
173 clrf POSTINC2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
174 clrf POSTINC2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
175 banksel common
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
176 clrf selected_item
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
177 return
0
heinrichsweikamp
parents:
diff changeset
178
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
179 global menu_processor_pop
0
heinrichsweikamp
parents:
diff changeset
180 menu_processor_pop:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
181 movff menustack+0,selected_item
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
182 movff menustack+1,menustack+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
183 movff menustack+2,menustack+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
184 movff menustack+3,menustack+2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
185 movff menustack+4,menustack+3
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
186 return
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
187
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
188 global menu_processor_double_pop
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
189 menu_processor_double_pop:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
190 movff menustack+1,selected_item
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
191 movff menustack+2,menustack+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
192 movff menustack+3,menustack+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
193 movff menustack+4,menustack+2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
194 return
0
heinrichsweikamp
parents:
diff changeset
195
heinrichsweikamp
parents:
diff changeset
196 menu_processor_push:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
197 movff menustack+3,menustack+4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
198 movff menustack+2,menustack+3
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
199 movff menustack+1,menustack+2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
200 movff menustack+0,menustack+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
201 movff selected_item,menustack+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
202 clrf selected_item
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
203 return
0
heinrichsweikamp
parents:
diff changeset
204
heinrichsweikamp
parents:
diff changeset
205 ;---- Execute menu selection -------------------------------------------------
heinrichsweikamp
parents:
diff changeset
206 do_menu_item:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
207 bcf switch_right ; avoid loops
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
208 call speed_normal ; back to normal speed
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
209 movf selected_item,W ; reread proc address from table
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
210 rcall menu_read_item ; (destroys PROD)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
211 movff selected_item,PRODL ; pass along selected line
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
212 rcall menu_processor_push ; remember where we got from (clears selected_item)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
213 movff proc_item+2,PCLATU ; then execute computed goto
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
214 movff proc_item+1,PCLATH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
215 movf proc_item+0,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
216 movwf PCL
0
heinrichsweikamp
parents:
diff changeset
217
heinrichsweikamp
parents:
diff changeset
218 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
219 ; Get current item from table.
heinrichsweikamp
parents:
diff changeset
220 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
221 ; Input : Item number in WREG, menu_block.
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
222 ; Output : icon_large, text_item, proc_item 16bits pointers.
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
223 ; Trashed: PROD, WREG
0
heinrichsweikamp
parents:
diff changeset
224 ;
heinrichsweikamp
parents:
diff changeset
225 menu_read_item:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
226 mullw .10 ; 10 bytes per item
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
227 movf PRODL,W ; then do a 24 bits add
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
228 addwf menu_block+0,W ; with menu_block, and
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
229 movwf TBLPTRL ; setup TBLPTR
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
230 movf PRODH,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
231 addwfc menu_block+1,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
232 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
233 movlw 0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
234 addwfc menu_block+2,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
235 movwf TBLPTRU
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
236 VARARGS_GET8 value_type ; read 10 bytes of item data
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
237 VARARGS_GET24 dynamic_item
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
238 VARARGS_GET24 proc_item
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
239 VARARGS_GET8 WREG ; skip dummy byte
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
240 VARARGS_GET16 text_item
0
heinrichsweikamp
parents:
diff changeset
241
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
242 return
0
heinrichsweikamp
parents:
diff changeset
243
heinrichsweikamp
parents:
diff changeset
244 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
245 ; Vertical menu - set of line/value to choose from,
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
246 ; entry point to update lines already shown
0
heinrichsweikamp
parents:
diff changeset
247 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
248 global menu_vertical
0
heinrichsweikamp
parents:
diff changeset
249 menu_vertical:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
250 btfss divemode ; in divemode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
251 clrf timeout_counter2 ; NO - reset timeout
0
heinrichsweikamp
parents:
diff changeset
252
heinrichsweikamp
parents:
diff changeset
253 menu_vertical_2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
254 rcall menu_draw_lines ; always re-draw whole menu
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
255 movlw CCP1CON_VALUE ; see hwos.inc
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
256 btfss divemode ; in divemode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
257 movwf CCP1CON ; NO - power-on backlight
0
heinrichsweikamp
parents:
diff changeset
258
heinrichsweikamp
parents:
diff changeset
259 menu_vertical_1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
260 movf selected_item,W ; get current item data
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
261 rcall menu_read_item
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
262 movf proc_item+0,W ; check if proc address is NULL
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
263 iorwf proc_item+1,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
264 bz next_line_menu ; YES - not selectable
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
265 btfss divemode ; in divemode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
266 rcall menu_draw_selected_line ; NO
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
267 btfsc in_color_menu ; in the color scheme menu?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
268 call TFT_show_color_schemes ; YES - update the color schemes
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
269 btfss settime_setdate ; in the set time or set date menu?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
270 bra menu_line_loop_pre2 ; NO - skip all following
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
271 movff month,lo ; new month
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
272 dcfsnz lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
273 movlw .31
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
274 dcfsnz lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
275 movlw .28
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
276 dcfsnz lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
277 movlw .31
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
278 dcfsnz lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
279 movlw .30
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
280 dcfsnz lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
281 movlw .31
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
282 dcfsnz lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
283 movlw .30
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
284 dcfsnz lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
285 movlw .31
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
286 dcfsnz lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
287 movlw .31
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
288 dcfsnz lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
289 movlw .30
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
290 dcfsnz lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
291 movlw .31
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
292 dcfsnz lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
293 movlw .30
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
294 dcfsnz lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
295 movlw .31
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
296 cpfsgt day ; day ok?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
297 bra menu_line_loop_pre1 ; YES
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
298 movlw .1 ; NO - set to 1st
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
299 movwf day
0
heinrichsweikamp
parents:
diff changeset
300
heinrichsweikamp
parents:
diff changeset
301 menu_line_loop_pre1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
302 btfsc switch_right ; enter pressed?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
303 call rtc_set_rtc ; YES - update mins,sec,hours,day,month and year to RTC module
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
304 call TFT_show_time_date_menu ; update clock
0
heinrichsweikamp
parents:
diff changeset
305
heinrichsweikamp
parents:
diff changeset
306 menu_line_loop_pre2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
307 bcf switch_right
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
308 bcf switch_left
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
309 btfss divemode ; in divemode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
310 call speed_normal ; NO
0
heinrichsweikamp
parents:
diff changeset
311
heinrichsweikamp
parents:
diff changeset
312 menu_line_loop_pre3:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
313 btfsc divemode ; in divemode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
314 goto divemode_option0_return ; Yes - return to it
0
heinrichsweikamp
parents:
diff changeset
315
heinrichsweikamp
parents:
diff changeset
316 menu_line_loop:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
317 btfsc switch_right
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
318 bra do_line_menu ; type dependent
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
319 btfsc switch_left
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
320 bra next_line_menu
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
321 btfss quarter_second_update ; 1/4 second?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
322 bra menu_line_loop1 ; NO - not yet...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
323 btfsc menu_update_sensor_mv ; in the "Calibrate" menu?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
324 call TFT_menu_calibrate ; YES - update mV data
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
325 bcf quarter_second_update ; clear flag
113
heinrichsweikamp
parents: 76
diff changeset
326
heinrichsweikamp
parents: 76
diff changeset
327 menu_line_loop1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
328 btfss onesecupdate ; new second?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
329 bra menu_line_loop2 ; NO - not yet...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
330
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
331 IFDEF _rx_functions
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
332 btfsc FLAG_tr_enabled ; TR functions enabled?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
333 call I2C_get_tankdata ; YES - get new tank data
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
334 btfsc menu_update_tank_pres ; in tank setup menu?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
335 call TFT_menu_tank_pres ; YES - update tank press
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
336 ENDIF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
337
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
338 call timeout_surfmode ; timeout on timeout_counter2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
339 call set_dive_modes ; check if divemode must be entered
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
340 call get_battery_voltage ; gets battery voltage
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
341 btfsc settime_setdate ; in the set time or set date menu?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
342 call TFT_show_time_date_menu ; YES - update clock
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
343 bcf onesecupdate ; one second updates done
0
heinrichsweikamp
parents:
diff changeset
344
heinrichsweikamp
parents:
diff changeset
345 menu_line_loop2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
346 btfsc sleepmode ; timeout?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
347 goto restart ; YES - back to surfacemode
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
348 btfsc divemode
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
349 goto restart ; enter divemode if required
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
350
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
351 IFDEF _screendump
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
352 btfsc enable_screen_dumps ; screendump enabled?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
353 call TFT_dump_screen_check ; YES - check if requested and do it
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
354 ELSE
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
355 btfsc disable_comm_mode ; COMM mode disabled (happens during new battery procedure)?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
356 bra menu_line_loop ; YES - loop
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
357 ENDIF
612
6dd6b37da7c8 TODO: screendump debug
heinrichsweikamp
parents: 608
diff changeset
358 btfsc enable_screen_dumps ; screendump enabled?
6dd6b37da7c8 TODO: screendump debug
heinrichsweikamp
parents: 608
diff changeset
359 bra menu_line_loop ; loop and skip the COMM mode
6dd6b37da7c8 TODO: screendump debug
heinrichsweikamp
parents: 608
diff changeset
360
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
361 btfsc vusb_in ; USB plugged in?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
362 call comm_mode ; YES - start COMM mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
363
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
364 bra menu_line_loop ; loop
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
365
0
heinrichsweikamp
parents:
diff changeset
366
heinrichsweikamp
parents:
diff changeset
367 ;---- Move to menu's next line
heinrichsweikamp
parents:
diff changeset
368 next_line_menu:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
369 btfss divemode ; not in divemode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
370 call speed_fastest
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
371 bcf switch_left ; avoid looping
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
372 incf selected_item,F ; select next item
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
373 movf selected_item,W ; index == max ?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
374 cpfseq item_max
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
375 bra menu_vertical_1 ; NO - redraw cursor
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
376 clrf selected_item ; YES - restart for item 0
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
377 bra menu_vertical_1 ; then redraw cursor
0
heinrichsweikamp
parents:
diff changeset
378
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
379 global do_line_menu
0
heinrichsweikamp
parents:
diff changeset
380 do_line_menu:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
381 btfss divemode ; in divemode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
382 call speed_fastest ; NO
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
383 ; bcf switch_right ; avoid looping
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
384 decf menupos1,W ; menu_processor needs 0-5
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
385 btfsc divemode ; only in divemode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
386 movwf selected_item
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
387 movf selected_item,W ; read selected descriptor
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
388 rcall menu_read_item
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
389 movf value_type,W ; switch on data type
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
390 bz menu_do_line_call ; CALL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
391 dcfsnz WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
392 bra menu_do_line_call ; STRING: do as call
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
393 dcfsnz WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
394 bra menu_do_line_option ; OPTION
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
395 dcfsnz WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
396 bra menu_do_line_call ; DYNAMIC: do as call
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
397 bra menu_line_loop_pre3 ; else do nothing
0
heinrichsweikamp
parents:
diff changeset
398
heinrichsweikamp
parents:
diff changeset
399 ;---- CALL
heinrichsweikamp
parents:
diff changeset
400 menu_do_line_call:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
401 rcall do_menu_item ; same as icon menu: calculated goto
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
402 rcall menu_processor_pop ; back to same line,
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
403 bra menu_vertical ; then continue into menu...
0
heinrichsweikamp
parents:
diff changeset
404
heinrichsweikamp
parents:
diff changeset
405 ;---- Call option specific increment subroutine
heinrichsweikamp
parents:
diff changeset
406 menu_do_line_option:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
407 movff option_item+0,FSR0L ; get option handle
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
408 movff option_item+1,FSR0H
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
409 call option_inc ; increment
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
410 movff selected_item,PRODL ; pass selection to callback.
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
411 rcall menu_text_call
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
412 bra menu_vertical_2 ; redraw all lines
0
heinrichsweikamp
parents:
diff changeset
413
heinrichsweikamp
parents:
diff changeset
414 ;-----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
415
heinrichsweikamp
parents:
diff changeset
416 menu_draw_lines_divemode:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
417 movlw dm_menu_item1_row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
418 movff WREG,win_top
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
419 movlw dm_menu_item1_column
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
420 movff WREG,win_leftx2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
421 clrf start_item
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
422 movff item_max,menupos4 ; copy item_max for divemode cursor routine
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
423 bra menu_draw_lines_2
0
heinrichsweikamp
parents:
diff changeset
424
heinrichsweikamp
parents:
diff changeset
425 menu_draw_lines:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
426 btfsc divemode ; in divemode?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
427 bra menu_draw_lines_divemode ; YES
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
428 btfsc menu_flags,0 ; Dynamic title?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
429 rcall menu_processor_title ; YES - redraw it then
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
430 MENU_LINE_FONT MENU_LEFT, 0 ; init start position/font
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
431 movff menu_center,win_top ; computed in menu block.
0
heinrichsweikamp
parents:
diff changeset
432
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
433 ; Does the menu have more than 6 lines ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
434 movf item_max,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
435 addlw -(MENU_LINES_MAX+1) ; (max - 7)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
436 bnn menu_draw_long_menu ; bra if (max >= 7)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
437 clrf start_item
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
438 bra menu_draw_lines_2
0
heinrichsweikamp
parents:
diff changeset
439
heinrichsweikamp
parents:
diff changeset
440 menu_draw_long_menu:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
441 movf selected_item,W ; start at selected-6
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
442 addlw -(MENU_LINES_MAX-1)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
443 btfsc STATUS,N ; is this < 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
444 clrf WREG ; YES - start from top instead
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
445 movwf start_item
0
heinrichsweikamp
parents:
diff changeset
446
heinrichsweikamp
parents:
diff changeset
447 menu_draw_lines_2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
448 movff start_item, menu_item
0
heinrichsweikamp
parents:
diff changeset
449
heinrichsweikamp
parents:
diff changeset
450 menu_draw_lines_1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
451 call TFT_standard_color ; restore color after disabled lines
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
452 movf menu_item,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
453 rcall menu_read_item
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
454 movf value_type,W ; switch on data type
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
455 bz menu_draw_line_call
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
456 dcfsnz WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
457 bra menu_draw_line_string
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
458 dcfsnz WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
459 bra menu_draw_line_option
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
460 dcfsnz WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
461 bra menu_draw_line_dynamic
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
462 bra menu_draw_line_none
0
heinrichsweikamp
parents:
diff changeset
463
heinrichsweikamp
parents:
diff changeset
464 menu_draw_line_string:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
465 movff text_item+0,TBLPTRL ; read not-translated string from PROM
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
466 movff text_item+1,TBLPTRH
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
467 call strcpy_prom ; copy in buffer
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
468 bra menu_draw_line_none
0
heinrichsweikamp
parents:
diff changeset
469
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
470 menu_draw_line_call:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
471 movff text_item+0,FSR1L ; read string from PROM
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
472 movff text_item+1,FSR1H
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
473 call strcpy_text ; copy in buffer
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
474 bra menu_draw_line_none
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
475
0
heinrichsweikamp
parents:
diff changeset
476 menu_draw_line_option:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
477 movff text_item+0,FSR1L ; read string from PROM
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
478 movff text_item+1,FSR1H
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
479 call strcpy_text ; copy in buffer
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
480 movff option_item+0,FSR0L ; retrieve option handle
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
481 movff option_item+1,FSR0H
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
482 btfss settime_setdate ; not in Time/Date menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
483 call option_draw
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
484 bra menu_draw_line_none
0
heinrichsweikamp
parents:
diff changeset
485
heinrichsweikamp
parents:
diff changeset
486 menu_draw_line_dynamic:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
487 lfsr FSR2,buffer
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
488 movff menu_item,PRODL ; pass item to callback
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
489 rcall menu_text_call ; push return address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
490 bra menu_draw_line_none
0
heinrichsweikamp
parents:
diff changeset
491
heinrichsweikamp
parents:
diff changeset
492 ; Computed goto to pointer inside dynamic_item:
heinrichsweikamp
parents:
diff changeset
493 menu_text_call:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
494 movf dynamic_item+0,W ; check if callback is NULL
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
495 iorwf dynamic_item+1,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
496 iorwf dynamic_item+2,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
497 btfsc STATUS,Z
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
498 return ; YES - don't call it
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
499 movff dynamic_item+2,PCLATU ; prepare...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
500 movff dynamic_item+1,PCLATH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
501 movf dynamic_item+0,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
502 movwf PCL ; ...and jump
0
heinrichsweikamp
parents:
diff changeset
503
heinrichsweikamp
parents:
diff changeset
504 menu_draw_line_none:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
505 btfsc divemode ; in divemode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
506 bra menu_draw_line_none_divemode ; YES
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
507 movlw MENU_LINE_MAX_LENGTH
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
508 call TFT_fillup_with_spaces ; fill up FSR2 with spaces (Total string length in #WREG)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
509 clrf WREG
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
510 movff WREG,buffer+MENU_LINE_MAX_LENGTH ; NO - make sure won't be longer than MENU_LINE_MAX_LENGTH ch
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
511 call aa_wordprocessor
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
512 bcf win_invert ; clear flag for inverted output by default
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
513 movlw MENU_HEIGHT ; NO - move to next line
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
514 addwf win_top,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
515 incf menu_item,F ; inc loop counter
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
516 movf start_item,W ; first line (scrolled)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
517 subwf menu_item,W ; current - first
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
518 xorlw MENU_LINES_MAX ; already done 6 lines?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
519 btfsc STATUS,Z
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
520 return ; YES
0
heinrichsweikamp
parents:
diff changeset
521 menu_draw_line_none2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
522 movf menu_item,W ; done item_max lines?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
523 xorwf item_max,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
524 btfss STATUS,Z
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
525 bra menu_draw_lines_1 ; NO - loop...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
526 return
0
heinrichsweikamp
parents:
diff changeset
527
heinrichsweikamp
parents:
diff changeset
528 menu_draw_line_none_divemode:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
529 movlw .10
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
530 call TFT_fillup_with_spaces ; fill up FSR2 with spaces (Total string length in #WREG)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
531 clrf WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
532 movff WREG,buffer+.10
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
533 call aa_wordprocessor ; draw the line
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
534 banksel common
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
535 bcf win_invert ; reset invert flag
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
536 banksel win_top
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
537 movlw .24 ; divemode menu spacing
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
538 addwf win_top,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
539 incf menu_item,F ; inc loop counter
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
540 movlw .3
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
541 cpfseq menu_item ; at pos 4?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
542 bra menu_draw_line_none2 ; NO
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
543 movlw dm_menu_item4_row
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
544 movff WREG,win_top ; reset row
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
545 movlw dm_menu_item4_column
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
546 movff WREG,win_leftx2 ; new column
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
547 bra menu_draw_line_none2 ; done
0
heinrichsweikamp
parents:
diff changeset
548
heinrichsweikamp
parents:
diff changeset
549 ;-----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
550 ; Put a mark in front of the current line
heinrichsweikamp
parents:
diff changeset
551 menu_draw_selected_line:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
552 clrf timeout_counter2 ; reset timeout
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
553 WIN_BOX_BLACK .34,.221,MENU_LEFT-8,MENU_LEFT-2 ; clear left column
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
554 call TFT_standard_color
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
555 WIN_SMALL MENU_LEFT-8, 0 ; arrow symbol only in small font
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
556 movf start_item,W ; first line (scrolled)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
557 subwf selected_item,W ; selected - first
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
558 mullw MENU_HEIGHT ; 30 pixel by line
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
559 movf PRODL,W ; result
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
560 addwf menu_center,W ; added to first line
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
561 movwf win_top ; and stored to pos.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
562 STRCPY_PRINT "\xb7" ; print cursor
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
563 return
0
heinrichsweikamp
parents:
diff changeset
564
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
565 END