annotate src/menu_processor.asm @ 648:aeca5717d9eb

3.17 / 10.72 release
author heinrichs weikamp
date Fri, 04 Mar 2022 08:29:36 +0100
parents 7d8a4c60ec1a
children 75e90cd0c2c3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
3 ; File menu_processor.asm * combined next generation V3.12.1
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 "start.inc"
heinrichsweikamp
parents:
diff changeset
19 #include "surfmode.inc"
heinrichsweikamp
parents:
diff changeset
20 #include "divemode.inc"
heinrichsweikamp
parents:
diff changeset
21 #include "tft_outputs.inc"
heinrichsweikamp
parents:
diff changeset
22 #include "eeprom_rs232.inc"
62
e7c7c7eeea58 show battery voltage in info menu
heinrichsweikamp
parents: 50
diff changeset
23 #include "adc_lightsensor.inc"
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
24 #include "i2c.inc"
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
25 #include "rtc.inc"
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
26 #include "wait.inc"
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
27 #include "colorschemes.inc"
229
e1e5876bd777 minor cleanup
mh@mh-THINK
parents: 189
diff changeset
28
0
heinrichsweikamp
parents:
diff changeset
29
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
30 ; NOTE: needs to be identical in .inc and .asm !
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
31 ;
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
32 #define MENU_LINES_MAX .7 ; maximum number of lines per screen
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
33 #define MENU_LEFT .20 ; position of first menu item
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
34 #define MENU_HEIGHT_SURF .27 ; spacing between menu item in surface mode (pixel)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
35 #define MENU_HEIGHT_DIVE .24 ; spacing between menu item in surface mode (pixel)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
36 #define MENU_VCENTER .125 ; position on screen
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
37 #define MAX_LINE_LENGTH_TITLE .17 ; max menu title length (characters)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
38 #define MAX_LINE_LENGTH_SURF .20 ; max menu item length in surface menu (characters)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
39 #define MAX_LINE_LENGTH_DIVE .10 ; max menu item length in dive mode menu (characters)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
40 #define MENU_ITEM_DATA_SIZE .4 ; size of a menu item data block
0
heinrichsweikamp
parents:
diff changeset
41
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
42 ; Alias for easier code reading
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
43 #define option_addr item_funct_addr
0
heinrichsweikamp
parents:
diff changeset
44
heinrichsweikamp
parents:
diff changeset
45
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
46 extern option_adjust_group_member
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
47 extern option_inc
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
48 extern option_dec
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
49 extern option_draw
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
50
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
51 extern rtc_set_rtc
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
52 extern divemode_option_divemenu_return
0
heinrichsweikamp
parents:
diff changeset
53
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
54
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
55 ;=============================================================================
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
56 menu_proc CODE
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
57 ;=============================================================================
0
heinrichsweikamp
parents:
diff changeset
58
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
59
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
60 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
61 ; Entry Point for Menu Processor, called by MENU_BEGIN Macros
0
heinrichsweikamp
parents:
diff changeset
62 ;
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
63 global menu_processor
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
64 menu_processor:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
65 ; read menu header
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
66 VARARGS_BEGIN ; load TBLPTR with start address of the menu header data
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
67 clrf STKPTR ; never return from here
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
68
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
69 VARARGS_GET8 menu_item_count ; get number of items
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
70 VARARGS_GET8 menu_vertical_start ; get vertical start position of 1st menu item
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
71
643
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
72 ; movf menu_vertical_start,W ; excite flags, vertical start = 0, i.e. no menu title text?
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
73 ; bz menu_processor_no_title ; YES - skip reading menu title text address
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
74 ;
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
75 VARARGS_GET16 menu_title_addr ; get address of menu title text
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
76
643
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
77 ;menu_processor_no_title:
0
heinrichsweikamp
parents:
diff changeset
78
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
79 movff TBLPTRL, menu_item_data_start+0 ; store base address of menu items for menu_read_menu_item_data
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
80 movff TBLPTRH, menu_item_data_start+1 ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
81 movff TBLPTRU, menu_item_data_start+2 ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
82
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
83 btfss divemode ; in dive mode?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
84 bra menu_processor_menu_title ; NO - no frame in surface mode menu
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
85
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
86 ; required for menus with less entries than the calling menu but not so nice when setting up gas 6.... mH
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
87 movlw .1 ; menu_pos_cur = 1 ?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
88 cpfsgt menu_pos_cur ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
89 call TFT_clear_divemode_menu ; YES - clear the menu
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
90
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
91 ; draw a frame around the dive mode menu
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
92 movf pallet_color_mask,W ; get mask color into WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
93 WIN_FRAME_COLOR dm_menu_row, dm_menu_lower, dm_menu_left ,dm_menu_right ; top, bottom, left, right
643
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
94
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
95 btfss alt_layout_active ; big menu selected?
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
96 bra menu_processor_menu_body ; No, the normal dive mode menu has no title and footer
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
97
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
98 ; draw menu title
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
99 WIN_BOX_BLACK dm_menu_row+.2,dm_menu_row+.26,dm_menu_left+.2,dm_menu_right-.2 ; clear menu title area
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
100 WIN_SMALL .2, dm_menu_row+.2 ; set menu title font and position
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
101 FONT_COLOR color_greenish ; set menu title font color
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
102 movff menu_title_addr+0,FSR1L ; point to multi-lingual menu title text
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
103 movff menu_title_addr+1,FSR1H ; ...
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
104 call strcpy_text_FSR ; copy translated text into the buffer
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
105 movf FSR2L,W ; get title text length
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
106 mullw .7 ; compute title length in pixels_x2
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
107 bcf STATUS,C ; divide by 2
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
108 rrcf PRODL ; ...
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
109 movf PRODL,W ; get result into WREG
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
110 sublw .80 ; compute 80 (screen center position) - half title width in pixel_x2
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
111 movwf win_leftx2 ; set result as horizontal start position
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
112 movlw MAX_LINE_LENGTH_TITLE ; load max allowed length of a menu title
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
113 movwf FSR2L ; set buffer pointer to end of max length
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
114 clrf INDF2 ; terminate string at max length
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
115 PRINT ; output menu title
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
116
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
117 bra menu_processor_menu_body ; the dive mode menu has no footer
0
heinrichsweikamp
parents:
diff changeset
118
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
119 menu_processor_menu_title:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
120 ; prepare screen
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
121 btfsc screen_type3 ; screen type 3 ?
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
122 bra menu_processor_menu_title1 ; YES - screen type 3 has no backlight
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
123 clrf CCP1CON ; stop PWM
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
124 bcf PORTC,2 ; fade out backlight
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
125 menu_processor_menu_title1:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
126 call TFT_ClearScreen ; clear screen
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
127
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
128 ; draw menu title
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
129 WIN_BOX_BLACK .2,.23,.0,.159 ; clear menu title area
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
130 WIN_STD .0, .2 ; set menu title font and position
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
131 FONT_COLOR color_greenish ; set menu title font color
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
132 movff menu_title_addr+0,FSR1L ; point to multi-lingual menu title text
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
133 movff menu_title_addr+1,FSR1H ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
134 call strcpy_text_FSR ; copy translated text into the buffer
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
135 movf FSR2L,W ; get title text length
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
136 mullw .9 ; compute title length in pixels_x2
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
137 bcf STATUS,C ; divide by 2
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
138 rrcf PRODL ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
139 movf PRODL,W ; get result into WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
140 sublw .80 ; compute 80 (screen center position) - half title width in pixel_x2
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
141 movwf win_leftx2 ; set result as horizontal start position
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
142 movlw MAX_LINE_LENGTH_TITLE ; load max allowed length of a menu title
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
143 movwf FSR2L ; set buffer pointer to end of max length
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
144 clrf INDF2 ; terminate string at max length
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
145 PRINT ; output menu title
0
heinrichsweikamp
parents:
diff changeset
146
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
147 ; draw footer line
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
148 FONT_COLOR_MEMO ; select default color
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
149 WIN_TINY .5, .224 ; tiny font, left position
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
150 STRCPY_TEXT_PRINT tNext ; print "Next"
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
151 WIN_TINY .124, .224 ; tiny font, righ position
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
152 STRCPY_TEXT_PRINT tEnter ; print "Enter"
0
heinrichsweikamp
parents:
diff changeset
153
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
154 menu_processor_menu_body:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
155 FONT_SIZE FT_SMALL ; select font size
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
156 bra menu_vertical ; draw the menu items
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
157
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
158
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
159 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
160 ; Helper Function - call Callback-Function to draw the Menu Item Title
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
161 ;
0
heinrichsweikamp
parents:
diff changeset
162 menu_processor_call_title:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
163 movff menu_title_addr+2,PCLATU ; execute computed goto
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
164 movff menu_title_addr+1,PCLATH ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
165 movf menu_title_addr+0,W ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
166 movwf PCL ; ...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
167
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
168
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
169 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
170 ; Clear all memorized Menu Item Selections and restart with Cursor on first Item
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
171 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
172 global menu_processor_reset
0
heinrichsweikamp
parents:
diff changeset
173 menu_processor_reset:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
174 clrf menustack ; clear first stack position
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
175 clrf menustack_pointer ; set stack pointer to first stack position
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
176 clrf selected_item ; set cursor position to first menu item
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
177 return ; done
0
heinrichsweikamp
parents:
diff changeset
178
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
179
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
180 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
181 ; Pull / Double-Pull Cursor Position from Stack
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
182 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
183 global menu_processor_double_pop
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
184 global menu_processor_pop
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
185 menu_processor_double_pop:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
186 decf menustack_pointer,F ; decrement stack pointer
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
187 menu_processor_pop:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
188 decf menustack_pointer,F ; decrement stack pointer
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
189 btfsc menustack_pointer,7 ; did the stack pointer under-run?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
190 clrf menustack_pointer ; YES - reset stack pointer to first stack position
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
191 movf menustack_pointer,W ; load stack pointer into WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
192 lfsr FSR2,menustack ; load base address of menu stack
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
193 movff PLUSW2,selected_item ; retrieve cursor position from stack
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
194 return ; done
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
195
0
heinrichsweikamp
parents:
diff changeset
196
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
197 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
198 ; Push Cursor Position onto Stack
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
199 ;
0
heinrichsweikamp
parents:
diff changeset
200 menu_processor_push:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
201 lfsr FSR2,menustack ; load base address of menu stack
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
202 movf menustack_pointer,W ; load stack pointer into WREG
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
203 movff selected_item,PLUSW2 ; save cursor position to stack
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
204 incf menustack_pointer,W ; increment stack pointer, park result in WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
205 btfss WREG,3 ; result < 8 ?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
206 movwf menustack_pointer ; YES - update stack pointer
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
207 clrf selected_item ; set cursor to first item in new menu
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
208 return ; done
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
209
0
heinrichsweikamp
parents:
diff changeset
210
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
211 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
212 ; Helper Function - call Menu Item Function
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
213 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
214 menu_call_item_function:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
215 bcf switch_right ; clear button event
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
216 movf selected_item,W ; copy current cursor position to WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
217 rcall menu_read_menu_item_data ; read item function address
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
218 movff selected_item,PRODL ; pass cursor position (menu item number) to call function
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
219 rcall menu_processor_push ; push current cursor position onto stack
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
220 clrf PCLATU ; execute computed goto
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
221 movff item_funct_addr+1,PCLATH ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
222 movf item_funct_addr+0,W ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
223 movwf PCL ; ...
0
heinrichsweikamp
parents:
diff changeset
224
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
225
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
226 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
227 ; Read Menu Item Data
0
heinrichsweikamp
parents:
diff changeset
228 ;
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
229 menu_read_menu_item_data:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
230 cpfsgt menu_item_count ; selected menu item valid? || * Safety Check * to prevent any computed
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
231 clrf WREG ; NO - change selection to first item || goto to an illegal random target address
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
232
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
233 mullw MENU_ITEM_DATA_SIZE ; compute menu item data offset
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
234 movf PRODL,W ; add offset to base address of menu data block and set up TBLPTR
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
235 addwf menu_item_data_start+0,W ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
236 movwf TBLPTRL ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
237 movf PRODH,W ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
238 addwfc menu_item_data_start+1,W ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
239 movwf TBLPTRH ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
240 movlw 0 ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
241 addwfc menu_item_data_start+2,W ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
242 movwf TBLPTRU ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
243
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
244 VARARGS_GET16 item_title_addr ; read address of item title function or title text | with embedded
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
245 VARARGS_GET16 item_funct_addr ; read address of item call function or option definition data | menu item type
0
heinrichsweikamp
parents:
diff changeset
246
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
247 movlw .2 ; probe for menu item type = OPTION
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
248 btfsc item_funct_addr,0 ; is type OPTION?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
249 bra menu_read_menu_item_data_1 ; YES
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
250
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
251 movlw .1 ; probe for menu item type = MENU_CALL
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
252 btfsc item_title_addr,0 ; is type MENU_CALL?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
253 bra menu_read_menu_item_data_1 ; YES
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
254
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
255 movlw .0 ; must be MENU_DYNAMIC
0
heinrichsweikamp
parents:
diff changeset
256
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
257 menu_read_menu_item_data_1:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
258 movwf item_type ; store menu item type
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
259 bcf item_title_addr+0,0 ; strip menu item type encoding from addresses (reset to even addresses)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
260 bcf item_funct_addr+0,0 ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
261
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
262 return ; done
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
263
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
264
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
265 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
266 ; Menu HMI Operation
0
heinrichsweikamp
parents:
diff changeset
267 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
268 global menu_vertical
0
heinrichsweikamp
parents:
diff changeset
269 menu_vertical:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
270 rcall menu_draw_menu_items ; draw all menu items
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
271 movlw CCP1CON_VALUE ; load PWM setting
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
272 btfss divemode ; in dive mode?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
273 movwf CCP1CON ; NO - power-on backlight
0
heinrichsweikamp
parents:
diff changeset
274
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
275 menu_vertical_loop:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
276 movf selected_item,W ; get cursor position into WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
277 rcall menu_read_menu_item_data ; read menu item data
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
278 movf item_funct_addr+0,W ; check if execute function call address is NULL
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
279 iorwf item_funct_addr+1,W ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
280 bz next_line_menu ; YES - not selectable, step cursor to next menu item
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
281 btfsc divemode ; NO - in dive mode?
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
282 bra menu_line_loop_pre1 ; YES - skip next
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
283 rcall menu_draw_cursor_surf ; NO - draw the cursor (main menu style)
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
284 btfss imprint_time_date ; - currently imprinting the current time & date?
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
285 bra menu_line_loop_pre1 ; NO - skip
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
286 btfss switch_right ; YES - right button pressed, i.e. time or date changed?
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
287 bra menu_line_loop_pre1 ; NO - skip
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
288 call TFT_imprint_time_date_fast ; YES - show a fast response on the screen (may momentarily show an illegal day/month combination)
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
289 call rtc_set_rtc ; - update time and date on RTC module (corrects illegal day/month combinations)
0
heinrichsweikamp
parents:
diff changeset
290
heinrichsweikamp
parents:
diff changeset
291 menu_line_loop_pre1:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
292 bcf switch_right ; clear left-over right button event
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
293 bcf switch_left ; clear left-over left button event
0
heinrichsweikamp
parents:
diff changeset
294
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
295 menu_line_loop_pre2:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
296 btfsc divemode ; in dive mode?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
297 goto divemode_option_divemenu_return ; YES - return to it
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
298 call reset_timeout_surfmode ; NO - reset timeout
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
299 ;bra menu_line_loop ; - operate menu HMI
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
300
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
301 menu_line_loop:
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
302 call housekeeping ; handle data imprinting, screen dump request, timeout and entering dive mode
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
303 btfsc switch_right ; right button pressed?
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
304 bra do_line_menu ; YES - execute menu item function
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
305 btfss switch_left ; NO - left button pressed?
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
306 bra menu_line_loop ; NO - loop
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
307 next_line_menu: ; YES - step cursor to next menu item
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
308 bcf switch_left ; - clear button event
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
309 incf selected_item,F ; - increment cursor position to next item
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
310 movf selected_item,W ; - copy new item number to WREG
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
311 cpfseq menu_item_count ; - new item number beyond number of menu items?
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
312 bra menu_vertical_loop ; NO - redraw cursor
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
313 clrf selected_item ; YES - reset cursor position to first item
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
314 bra menu_vertical_loop ; - redraw cursor
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
315
0
heinrichsweikamp
parents:
diff changeset
316
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
317 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
318 ; Execute Menu Item Function
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
319 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
320 global do_line_menu
0
heinrichsweikamp
parents:
diff changeset
321 do_line_menu:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
322 decf menu_pos_cur,W ; get selected menu item (0-5) into WREG
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
323 btfsc divemode ; in dive mode?
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
324 movwf selected_item ; YES - take selected menu item from dive mode
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
325 movf selected_item,W ; copy selected menu item to WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
326 rcall menu_read_menu_item_data ; read menu item data
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
327 movf item_type,W ; switch on menu item type
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
328 bz menu_do_line_call ; -> 0: call (with dynamic title)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
329 dcfsnz WREG ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
330 bra menu_do_line_call ; -> 1: call (with fixed title)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
331 dcfsnz WREG ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
332 bra menu_do_line_option ; -> 2: option
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
333 bra menu_line_loop_pre2 ; else do nothing
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
334
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
335 menu_do_line_call:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
336 rcall menu_call_item_function ; push current cursor position onto stack and call menu item function
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
337 rcall menu_processor_pop ; get back cursor position
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
338 bra menu_vertical ; re-draw the menu
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
339
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
340 menu_do_line_option:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
341 movff option_addr+0,FSR0L ; get address of option definition data
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
342 movff option_addr+1,FSR0H ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
343 btfsc option_addr+1,4 ; shall stop at max value?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
344 bsf option_stop_at_max ; YES - set flag
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
345 btfsc option_addr+1,6 ; is the selected option an option group member?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
346 call option_adjust_group_member ; YES - adjust address to selected group member
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
347 btfss option_addr+1,5 ; shall increment?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
348 call option_inc ; YES - increment option value
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
349 btfsc option_addr+1,5 ; shall decrement?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
350 call option_dec ; YES - decrement option value
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
351 bcf option_stop_at_max ; revert to default (= wrap-around after max value)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
352 bra menu_vertical ; re-draw the menu
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
353
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
354
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
355 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
356 ; Draw all Menu Items
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
357 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
358 menu_draw_menu_items:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
359 btfss divemode ; in dive mode?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
360 bra menu_draw_lines_surfmode ; NO
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
361 ;bra menu_draw_lines_divemode ; YES
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
362
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
363 global menu_draw_lines_divemode
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
364 menu_draw_lines_divemode:
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
365 movff menu_item_count,menu_pos_max ; copy number of item in menu block to menu_pos_max (used by divemode instead of menu_item_count for no reason)
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
366
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
367 IFDEF _big_divemenu
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
368
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
369 btfss alt_layout_active ; big menu selected?
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
370 bra menu_draw_lines_divemode_small ; NO
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
371 ;bra menu_draw_lines_divemode_big ; YES
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
372
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
373 menu_draw_lines_divemode_big:
643
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
374 WIN_STD dm_menu_item1_column+.16,dm_menu_item1_row+.28
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
375 decf menu_pos_cur,W ; get selected item as 0..5 into WREG
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
376 movwf menu_item_start ; set first item to draw = selected item
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
377 bra menu_draw_menu_items_common ; continue with common part
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
378
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
379 ENDIF ; _big_divemenu
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
380
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
381 menu_draw_lines_divemode_small:
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
382 WIN_SMALL dm_menu_item1_column,dm_menu_item1_row
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
383 clrf menu_item_start ; set first item in menu block as first item to draw
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
384 bra menu_draw_menu_items_common ; continue with common part
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
385
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
386 menu_draw_lines_surfmode:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
387 WIN_SMALL MENU_LEFT, 0 ; initialize start position and font
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
388 movff menu_vertical_start,win_top ; set vertical output position
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
389 clrf menu_item_start ; set first item in menu block as first item to draw
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
390
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
391 IFDEF scrolling_menu_enabled
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
392 ; does the menu have more than 7 item ?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
393 movf menu_item_count,W ; get number of menu items
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
394 addlw -(MENU_LINES_MAX+1) ; more than 7 item?
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
395 bn menu_draw_menu_items_common ; NO - continue with common part
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
396 movf selected_item,W ; YES - compute first item to be drawn as current cursor position - 6
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
397 addlw -(MENU_LINES_MAX-1) ; - ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
398 btfsc STATUS,N ; - is this < 0 ?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
399 clrf WREG ; YES - revert to starting from first item
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
400 movwf menu_item_start ; - set first item to be drawn
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
401 ENDIF ; scrolling_menu_enabled
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
402
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
403 menu_draw_menu_items_common:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
404 movff menu_item_start,menu_item_curr ; initialize menu item counter
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
405
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
406 menu_draw_menu_items_loop:
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
407 FONT_COLOR_MEMO ; set default font color (may had been changed by a dynamic title)
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
408 REINIT_BUFFER ; initialize output buffer again
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
409 movf menu_item_curr,W ; get menu item to draw
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
410 rcall menu_read_menu_item_data ; read menu item data
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
411 movf item_type,W ; switch on menu item type:
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
412 bz menu_draw_menu_item_dynamic ; -> 0: call with dynamic title
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
413 dcfsnz WREG ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
414 bra menu_draw_menu_item_call ; -> 1: call with fixed title
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
415 dcfsnz WREG ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
416 bra menu_draw_menu_item_option ; -> 2: option increment
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
417 bra menu_draw_menu_item_print ; no output in case of illegal type
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
418
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
419 menu_draw_menu_item_dynamic:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
420 movf item_title_addr+0,W ; check if call address is NULL
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
421 iorwf item_title_addr+1,W ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
422 btfsc STATUS,Z ; is null?
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
423 bra menu_draw_menu_item_after_print ; YES - no printing on this menu line
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
424 movff menu_item_curr,PRODL ; NO - pass menu item position to call function
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
425 rcall menu_text_call ; - call dynamic title function
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
426 bra menu_draw_menu_item_print ; - print menu item
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
427
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
428 menu_draw_menu_item_call:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
429 movff item_title_addr+0,FSR1L ; point to multi-lingual text
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
430 movff item_title_addr+1,FSR1H ; ...
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
431 call strcat_text_FSR ; copy translated text to buffer
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
432 bra menu_draw_menu_item_print ; print menu item
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
433
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
434 menu_draw_menu_item_option:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
435 movff item_title_addr+0,FSR1L ; point to multi-lingual text
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
436 movff item_title_addr+1,FSR1H ; ...
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
437 call strcat_text_FSR ; copy translated text to buffer
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
438 movff option_addr+0,FSR0L ; hand over address of option definition data
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
439 movff option_addr+1,FSR0H ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
440 btfsc option_addr+1,6 ; is the selected option an option group member?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
441 call option_adjust_group_member ; YES - adjust address to selected group member
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
442 btfss block_option_value ; displaying of option value suspended?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
443 call option_draw ; NO - draw option value
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
444 ;bra menu_draw_menu_item_print ; print menu item
0
heinrichsweikamp
parents:
diff changeset
445
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
446 menu_draw_menu_item_print:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
447 movlw MAX_LINE_LENGTH_SURF ; load maximum length for a surface menu item
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
448 btfsc divemode ; in dive mode?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
449 movlw MAX_LINE_LENGTH_DIVE ; YES - replace with maximum length for a dive mode menu item
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
450 call TFT_buffer_trim_length ; fill up or cut buffer to max length
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
451 PRINT ; print menu item to screen
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
452 ;bra menu_draw_menu_item_after_print ; continue with after-print actions
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
453
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
454 menu_draw_menu_item_after_print:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
455 btfss divemode ; in dive mode?
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
456 bra menu_draw_menu_item_common ; NO
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
457 ;bra menu_draw_menu_item_divemode ; YES
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
458
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
459 menu_draw_menu_item_divemode:
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
460 IFDEF _big_divemenu
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
461 btfsc alt_layout_active ; big menu selected?
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
462 return ; YES - done
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
463 ENDIF
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
464
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
465 movlw .2 ; load a 2
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
466 cpfseq menu_item_curr ; just done menu item 2 (last item in left column) ?
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
467 bra menu_draw_menu_item_common ; NO - continue with common part
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
468 movlw dm_menu_item4_row ; YES - set vertical position for 2nd column
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
469 movff WREG,win_top ; - ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
470 movlw dm_menu_item4_column ; - set horizontal position for 2nd column
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
471 movff WREG,win_leftx2 ; - ...
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
472 bra menu_draw_menu_item_common_1 ; - continue in common part
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
473
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
474 menu_draw_menu_item_common:
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
475 movlw MENU_HEIGHT_SURF ; get menu items vertical spacing for surface mode
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
476 btfsc divemode ; in dive mode?
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
477 movlw MENU_HEIGHT_DIVE ; YES - replace with vertical spacing for dive mode
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
478 addwf win_top,F ; adjust vertical output position
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
479
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
480 menu_draw_menu_item_common_1:
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
481 incf menu_item_curr,F ; increment menu item number
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
482
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
483 IFDEF scrolling_menu_enabled
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
484 btfsc divemode ; in dive mode?
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
485 bra menu_draw_menu_item_common_2 ; YES - skip
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
486 movf menu_item_start,W ; NO - get the number of the menu item that menu drawing started with
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
487 subwf menu_item_curr,W ; - compute how many item have been drawn already
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
488 xorlw MENU_LINES_MAX ; - compare with how max item fit the screen
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
489 btfsc STATUS,Z ; - screen full?
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
490 return ; - YES - done
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
491 ;bra menu_draw_menu_item_common_2 ; NO - continue
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
492 ENDIF ; scrolling_menu_enabled
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
493
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
494 menu_draw_menu_item_common_2:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
495 movf menu_item_curr,W ; get current menu item
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
496 xorwf menu_item_count,W ; compare with total number of menu items, more item to do?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
497 bnz menu_draw_menu_items_loop ; YES - loop
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
498 return ; NO - done
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
499
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
500
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
501 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
502 ; Helper Function - call Function for dynamic Title
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
503 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
504 menu_text_call:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
505 clrf PCLATU ; execute a computed goto
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
506 movff item_title_addr+1,PCLATH ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
507 movf item_title_addr+0,W ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
508 movwf PCL ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
509
0
heinrichsweikamp
parents:
diff changeset
510
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
511 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
512 ; Draw the Cursor (Main Menu Style)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
513 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
514 menu_draw_cursor_surf:
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
515 WIN_LEFT MENU_LEFT-8 ; set horizontal start of cursor column
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
516 WIN_WIDTH .6 ; set width of cursor column
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
517 WIN_HEIGHT .223 ; set preliminary hight of cursor column
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
518
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
519 movf menu_vertical_start,W ; get vertical start of menu items
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
520 movwf win_top ; set vertical start of cursor column
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
521 subwf win_height,F ; final hight = prelim.height - vertical start
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
522
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
523 clrf WREG ; set color to black
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
524 BOX_COLOR ; clear cursor area
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
525
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
526 FONT_SIZE FT_SMALL ; set font size
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
527
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
528 movf menu_item_start,W ; get number of menu item that is on the first line
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
529 subwf selected_item,W ; compute line number of current menu item
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
530
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
531 mullw MENU_HEIGHT_SURF ; multiply line number with vertical menu items spacing
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
532 movf PRODL,W ; get computed vertical offset
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
533 addwf menu_vertical_start,W ; add offset to vertical start position
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
534 movwf win_top ; set final vertical position
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
535 bra menu_draw_cursor_common ; print cursor
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
536
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
537
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
538 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
539 ; Draw the Cursor (Dive Mode Style)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
540 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
541 global menu_draw_cursor_dive
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
542 menu_draw_cursor_dive:
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
543 IFDEF _big_divemenu
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
544 btfss alt_layout_active ; big menu selected?
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
545 bra menu_draw_cursor_dive_small ; NO
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
546 ;bra menu_draw_cursor_dive_big ; YES
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
547
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
548 menu_draw_cursor_dive_big:
643
7d8a4c60ec1a 3.15 release
heinrichsweikamp
parents: 640
diff changeset
549 WIN_STD dm_menu_item1_column,dm_menu_item1_row+.26
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
550 bra menu_draw_cursor_common ; print cursor
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
551 ENDIF ; _big_divemenu
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
552
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
553 menu_draw_cursor_dive_small:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
554 ; clear cursor areas
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
555 WIN_BOX_BLACK dm_menu_row+.1, dm_menu_lower-.1, dm_menu_item1_column-.8, dm_menu_item1_column-.1
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
556 WIN_BOX_BLACK dm_menu_row+.1, dm_menu_lower-.1, dm_menu_item4_column-.8, dm_menu_item4_column-.1
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
557
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
558 FONT_SIZE FT_SMALL ; set font size
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
559
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
560 movlw dm_menu_item1_column-.8 ; load position of left column
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
561 btfsc menu_pos_cur,2 ; cursor at menu item 4..6 ?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
562 movlw dm_menu_item4_column-.8 ; YES - replace with position of right column
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
563 movwf win_leftx2 ; set horizontal position
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
564
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
565 decf menu_pos_cur,W ; get cursor position as 0..5 into WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
566 btfsc menu_pos_cur,2 ; cursor at menu item 4..6 ?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
567 addlw -.3 ; YES - subtract 3 to get line number in right column
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
568
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
569 mullw MENU_HEIGHT_DIVE ; multiply line number (0..2) with vertical menu items spacing
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
570 movf PRODL,W ; get computed vertical offset
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
571 addlw dm_menu_item1_row ; add offset to vertical start position
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
572 movwf win_top ; set final vertical position
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
573 ;bra menu_draw_cursor_common ; print cursor
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
574
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
575
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
576 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
577 ; Helper Function - common Part of drawing the Cursor
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
578 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
579 menu_draw_cursor_common:
640
8c1f1f334275 3.13 release
heinrichsweikamp
parents: 634
diff changeset
580 FONT_COLOR_MEMO ; set font color (may have changed in-between)
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
581 STRCPY_PRINT "\xb7" ; print cursor
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
582 return ; done
0
heinrichsweikamp
parents:
diff changeset
583
heinrichsweikamp
parents:
diff changeset
584 ;-----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
585
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
586 END