annotate src/menu_processor.asm @ 631:185ba2f91f59

3.09 beta 1 release
author heinrichsweikamp
date Fri, 28 Feb 2020 15:45:07 +0100
parents c40025d8e750
children 4050675965ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
3 ; File menu_processor.asm combined next generation V3.08.6
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"
229
e1e5876bd777 minor cleanup
mh@mh-THINK
parents: 189
diff changeset
27
0
heinrichsweikamp
parents:
diff changeset
28
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
29 ; NOTE: needs to be identical in .inc and .asm !
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
30 #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
31 #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
32 #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
33 #define MENU_LEFT .20 ; position of first menu item
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
34 #define MENU_HEIGHT .27 ; spacing between menu lines
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
35 #define MENU_VCENTER .125 ; position on screen
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
36 #define MENU_LINE_MAX_LENGTH .20 ; length in characters
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
37 #define option_item proc_item
0
heinrichsweikamp
parents:
diff changeset
38
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
39
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
40 extern aa_wordprocessor
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
41 extern option_inc
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
42 extern option_draw
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
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
46 extern divemode_option_divemenu_return
582
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
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
50 menu_proc CODE
0
heinrichsweikamp
parents:
diff changeset
51
heinrichsweikamp
parents:
diff changeset
52 ;=============================================================================
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
53 ; menu handler
0
heinrichsweikamp
parents:
diff changeset
54 ;
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
55 ; Input: TBLPTR = addr of menu block
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
56
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
57 global menu_processor
0
heinrichsweikamp
parents:
diff changeset
58 menu_processor:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
59 ; btfss divemode ; in dive mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
60 ; call request_speed_fastest ; NO - request CPU speed change to fastest speed
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
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
69 movff TBLPTRH, menu_block+1 ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
70 movff TBLPTRU, menu_block+2 ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
71 btfss divemode ; in dive mode?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
72 bra menu_processor0 ; NO
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
73
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
74 ; 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
75 movlw .1
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
76 cpfsgt menu_pos_cur ; only if menu_pos_cur = 1...
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
77 call TFT_clear_divemode_menu ; ... clear the menu!
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
78 ; Draw one frame around the dive mode menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
79 call TFT_divemask_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
80 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
81 call TFT_standard_color
0
heinrichsweikamp
parents:
diff changeset
82
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
83 bra menu_processor1 ; skip next code segment in dive mode
0
heinrichsweikamp
parents:
diff changeset
84
heinrichsweikamp
parents:
diff changeset
85 menu_processor0:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
86 ;---- draw menu title ------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
87 clrf CCP1CON ; stop PWM
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
88 bcf PORTC,2 ; pull PWM out to GND
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
89 call TFT_ClearScreen
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
90 rcall menu_processor_title
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
91 rcall menu_processor_bottom_line
0
heinrichsweikamp
parents:
diff changeset
92
169
dcf3e08f31ac CHANGE: Improve internal logbook usability
heinrichsweikamp
parents: 125
diff changeset
93 menu_processor1:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
94 WIN_FONT FT_SMALL
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 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
103 menu_processor_bottom_line:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
104 ;---- Draw bottom line -----------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
105 TEXT_TINY .5, .240-.16, tNext
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
106 TEXT_TINY .160-.6*.6, .240-.16, tEnter
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
107 goto TFT_standard_color ; ...and return
0
heinrichsweikamp
parents:
diff changeset
108
heinrichsweikamp
parents:
diff changeset
109 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
110 ; (re-)draw menu title
0
heinrichsweikamp
parents:
diff changeset
111 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
112 menu_processor_title:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
113 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
114 MENU_TITLE_FONT .0, .2 ; menu title positioning
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
115 btfss menu_flags,0 ; static or dynamic title?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
116 bra menu_processor_static_title ; static title
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
117 rcall menu_processor_call_title ; dynamic title - add gas, detail and color
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
118 bra menu_processor_title_1
0
heinrichsweikamp
parents:
diff changeset
119
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
120 menu_processor_static_title:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
121 movff menu_title+0,FSR1L ; just copy string
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
122 movff menu_title+1,FSR1H
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
123 call strcpy_text
0
heinrichsweikamp
parents:
diff changeset
124
heinrichsweikamp
parents:
diff changeset
125 menu_processor_title_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
126 WIN_COLOR color_greenish
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
127 movf FSR2L,W ; get title length
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
128 mullw .9 ; convert to half pixels
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
129 bcf STATUS,C ; clear carry
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
130 rrcf PRODL ; /2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
131 movf PRODL,W ; back to WREG
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
132 sublw .80 ; 80 - width
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
133 movwf win_leftx2 ; aligned to center
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
134 movlw .0 ; string termination code
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
135 movff WREG,buffer+.17 ; limit to 17 chars (std font max.)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
136 call aa_wordprocessor
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
137 call TFT_standard_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
138 return
0
heinrichsweikamp
parents:
diff changeset
139
heinrichsweikamp
parents:
diff changeset
140 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
141 ; Call dynamic proc for menu title:
heinrichsweikamp
parents:
diff changeset
142
heinrichsweikamp
parents:
diff changeset
143 menu_processor_call_title:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
144 movff menu_title+2,PCLATU ; execute computed goto
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
145 movff menu_title+1,PCLATH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
146 movf menu_title+0,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
147 movwf PCL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
148
0
heinrichsweikamp
parents:
diff changeset
149 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
150 ; Restart with first icon/line selected
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
151 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
152 global menu_processor_reset
0
heinrichsweikamp
parents:
diff changeset
153 menu_processor_reset:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
154 clrf menustack ; clear first stack position
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
155 clrf menustack_pointer ; set stack pointer to first stack position
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
156 clrf selected_item ; set last menu item to first item
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
157 return
0
heinrichsweikamp
parents:
diff changeset
158
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
159
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
160 global menu_processor_double_pop
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
161 global menu_processor_pop
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
162 menu_processor_double_pop:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
163 decf menustack_pointer,F ; decrement stack pointer
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
164 menu_processor_pop:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
165 decf menustack_pointer,F ; decrement stack pointer
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
166 btfsc menustack_pointer,7 ; did the stack pointer under-run?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
167 clrf menustack_pointer ; YES - reset stack pointer to first stack position
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
168 movf menustack_pointer,W ; load stack pointer into WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
169 lfsr FSR2,menustack ; load base address of menu stack
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
170 movff PLUSW2,selected_item ; retrieve menu item from stack
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
171 return ; done
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
172
0
heinrichsweikamp
parents:
diff changeset
173
heinrichsweikamp
parents:
diff changeset
174 menu_processor_push:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
175 lfsr FSR2,menustack ; load base address of menu stack
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
176 movf menustack_pointer,W ; load stack pointer into WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
177 movff selected_item,PLUSW2 ; save menu item to stack
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
178 incf menustack_pointer,W ; increment stack pointer, park result in WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
179 btfss WREG,3 ; result < 8 ?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
180 movwf menustack_pointer ; YES - update stack pointer
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
181 clrf selected_item ; set to first item in new menu
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
182 return ; done
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
183
0
heinrichsweikamp
parents:
diff changeset
184
heinrichsweikamp
parents:
diff changeset
185 ;---- Execute menu selection -------------------------------------------------
heinrichsweikamp
parents:
diff changeset
186 do_menu_item:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
187 bcf switch_right ; clear left-over button event
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
188 movf selected_item,W ; reread proc address from table
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
189 rcall menu_read_item ; (destroys PROD)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
190 movff selected_item,PRODL ; pass along selected line
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
191 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
192 movff proc_item+2,PCLATU ; then execute computed goto
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
193 movff proc_item+1,PCLATH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
194 movf proc_item+0,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
195 movwf PCL
0
heinrichsweikamp
parents:
diff changeset
196
heinrichsweikamp
parents:
diff changeset
197 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
198 ; Get current item from table.
heinrichsweikamp
parents:
diff changeset
199 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
200 ; Input : Item number in WREG, menu_block.
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
201 ; Output : icon_large, text_item, proc_item 16bits pointers.
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
202 ; Trashed: PROD, WREG
0
heinrichsweikamp
parents:
diff changeset
203 ;
heinrichsweikamp
parents:
diff changeset
204 menu_read_item:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
205 mullw .10 ; 10 bytes per item
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
206 movf PRODL,W ; then do a 24 bits add
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
207 addwf menu_block+0,W ; with menu_block, and
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
208 movwf TBLPTRL ; setup TBLPTR
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
209 movf PRODH,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
210 addwfc menu_block+1,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
211 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
212 movlw 0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
213 addwfc menu_block+2,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
214 movwf TBLPTRU
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
215 VARARGS_GET8 value_type ; read 10 bytes of item data
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
216 VARARGS_GET24 dynamic_item
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
217 VARARGS_GET24 proc_item
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
218 VARARGS_GET8 WREG ; skip dummy byte
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
219 VARARGS_GET16 text_item
0
heinrichsweikamp
parents:
diff changeset
220
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
221 return
0
heinrichsweikamp
parents:
diff changeset
222
heinrichsweikamp
parents:
diff changeset
223 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
224 ; Vertical menu - set of line/value to choose from,
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
225 ; entry point to update lines already shown
0
heinrichsweikamp
parents:
diff changeset
226 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
227 global menu_vertical
0
heinrichsweikamp
parents:
diff changeset
228 menu_vertical:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
229 rcall menu_draw_lines ; always re-draw whole menu
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
230 movlw CCP1CON_VALUE ; see hwos.inc
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
231 btfss divemode ; in dive mode?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
232 movwf CCP1CON ; NO - power-on backlight
0
heinrichsweikamp
parents:
diff changeset
233
heinrichsweikamp
parents:
diff changeset
234 menu_vertical_1:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
235 movf selected_item,W ; copy current menu item selection to WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
236 rcall menu_read_item ; get current menu item data
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
237 movf proc_item+0,W ; check if proc address is NULL
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
238 iorwf proc_item+1,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
239 bz next_line_menu ; YES - not selectable
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
240 btfss divemode ; in dive mode?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
241 rcall menu_draw_selected_line ; NO
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
242 btfss imprint_time_date ; currently imprinting the current time & date?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
243 bra menu_line_loop_pre1 ; NO
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
244 btfss switch_right ; YES - right button pressed, i.e. time or date changed?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
245 bra menu_line_loop_pre1 ; NO
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
246 call TFT_show_time_date_menu_fast ; YES - show a fast response on the screen (may momentarily show an illegal day/month combination)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
247 call rtc_set_rtc ; - update time and date on RTC module (corrects illegal day/month combinations)
0
heinrichsweikamp
parents:
diff changeset
248
heinrichsweikamp
parents:
diff changeset
249 menu_line_loop_pre1:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
250 btfsc imprint_color_schemes ; in the color scheme menu?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
251 call TFT_show_color_schemes ; YES - update the color schemes
0
heinrichsweikamp
parents:
diff changeset
252
heinrichsweikamp
parents:
diff changeset
253 menu_line_loop_pre2:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
254 bcf switch_right ; clear left-over right button event
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
255 bcf switch_left ; clear left-over left button event
0
heinrichsweikamp
parents:
diff changeset
256
heinrichsweikamp
parents:
diff changeset
257 menu_line_loop_pre3:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
258 btfsc divemode ; in dive mode?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
259 goto divemode_option_divemenu_return ; YES - return to it
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
260 ;bra menu_line_loop_surface ; NO - proceed to surface mode dispatcher
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
261
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
262 ; dispatcher for surface mode menus
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
263 menu_line_loop_surface:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
264 call reset_timeout_surfmode ; reset timeout
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
265 menu_line_loop:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
266 call housekeeping ; handle data imprinting, screen dump request, timeout and entering dive mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
267 btfsc switch_right ; right button pressed?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
268 bra do_line_menu ; YES - type dependent
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
269 btfsc switch_left ; left button pressed?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
270 bra next_line_menu ; YES - goto next item
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
271 bra menu_line_loop ; NO to both - loop
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
272
0
heinrichsweikamp
parents:
diff changeset
273
heinrichsweikamp
parents:
diff changeset
274 ;---- Move to menu's next line
heinrichsweikamp
parents:
diff changeset
275 next_line_menu:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
276 bcf switch_left ; clear button event
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
277 incf selected_item,F ; select next item
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
278 movf selected_item,W ; copy item number to WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
279 cpfseq item_max ; item number == max ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
280 bra menu_vertical_1 ; NO - redraw cursor
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
281 clrf selected_item ; YES - wrap-around to first item
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
282 bra menu_vertical_1 ; then redraw cursor
0
heinrichsweikamp
parents:
diff changeset
283
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
284 global do_line_menu
0
heinrichsweikamp
parents:
diff changeset
285 do_line_menu:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
286 decf menu_pos_cur,W ; menu_processor needs 0-5
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
287 btfsc divemode ; in dive mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
288 movwf selected_item ; YES - set selected item from WREG
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
289 movf selected_item,W ; read selected descriptor
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
290 rcall menu_read_item
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
291 movf value_type,W ; switch on data type
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
292 bz menu_do_line_call ; CALL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
293 dcfsnz WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
294 bra menu_do_line_call ; STRING: do as call
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
295 dcfsnz WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
296 bra menu_do_line_option ; OPTION
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
297 dcfsnz WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
298 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
299 bra menu_line_loop_pre3 ; else do nothing
0
heinrichsweikamp
parents:
diff changeset
300
heinrichsweikamp
parents:
diff changeset
301 ;---- CALL
heinrichsweikamp
parents:
diff changeset
302 menu_do_line_call:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
303 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
304 rcall menu_processor_pop ; back to same line,
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
305 bra menu_vertical ; then continue into menu...
0
heinrichsweikamp
parents:
diff changeset
306
heinrichsweikamp
parents:
diff changeset
307 ;---- Call option specific increment subroutine
heinrichsweikamp
parents:
diff changeset
308 menu_do_line_option:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
309 movff option_item+0,FSR0L ; get option handle
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
310 movff option_item+1,FSR0H
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
311 call option_inc ; increment
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
312 movff selected_item,PRODL ; pass selection to callback
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
313 rcall menu_text_call
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
314 bra menu_vertical ; redraw all lines
0
heinrichsweikamp
parents:
diff changeset
315
heinrichsweikamp
parents:
diff changeset
316 ;-----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
317
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
318 global menu_draw_lines_divemode ; entry point for re-drawing of the menu to update color-coding of gases
0
heinrichsweikamp
parents:
diff changeset
319 menu_draw_lines_divemode:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
320 movlw dm_menu_item1_row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
321 movff WREG,win_top
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
322 movlw dm_menu_item1_column
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
323 movff WREG,win_leftx2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
324 clrf start_item
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
325 movff item_max,menu_pos_max ; copy item_max for dive mode cursor routine
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
326 bra menu_draw_lines_2
0
heinrichsweikamp
parents:
diff changeset
327
heinrichsweikamp
parents:
diff changeset
328 menu_draw_lines:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
329 btfsc divemode ; in dive mode?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
330 bra menu_draw_lines_divemode ; YES
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
331 btfsc menu_flags,0 ; dynamic title?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
332 rcall menu_processor_title ; YES - redraw it then
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
333 MENU_LINE_FONT MENU_LEFT, 0 ; initialize start position/font
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
334 movff menu_center,win_top ; computed in menu block
0
heinrichsweikamp
parents:
diff changeset
335
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
336 ; Does the menu have more than 6 lines ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
337 movf item_max,W
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
338 addlw -(MENU_LINES_MAX+1) ;
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
339 bnn menu_draw_long_menu ; bra if >= 7
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
340 clrf start_item
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
341 bra menu_draw_lines_2
0
heinrichsweikamp
parents:
diff changeset
342
heinrichsweikamp
parents:
diff changeset
343 menu_draw_long_menu:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
344 movf selected_item,W ; start at selected-6
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
345 addlw -(MENU_LINES_MAX-1)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
346 btfsc STATUS,N ; is this < 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
347 clrf WREG ; YES - start from top instead
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
348 movwf start_item
0
heinrichsweikamp
parents:
diff changeset
349
heinrichsweikamp
parents:
diff changeset
350 menu_draw_lines_2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
351 movff start_item, menu_item
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
352 WIN_FONT FT_SMALL ; set font size
0
heinrichsweikamp
parents:
diff changeset
353
heinrichsweikamp
parents:
diff changeset
354 menu_draw_lines_1:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
355 call TFT_standard_color ; set default text color
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
356 movf menu_item,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
357 rcall menu_read_item
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
358 movf value_type,W ; switch on data type
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
359 bz menu_draw_line_call
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
360 dcfsnz WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
361 bra menu_draw_line_string
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
362 dcfsnz WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
363 bra menu_draw_line_option
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
364 dcfsnz WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
365 bra menu_draw_line_dynamic
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
366 bra menu_draw_line_none
0
heinrichsweikamp
parents:
diff changeset
367
heinrichsweikamp
parents:
diff changeset
368 menu_draw_line_string:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
369 movff text_item+0,TBLPTRL ; read not-translated string from PROM
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
370 movff text_item+1,TBLPTRH
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
371 call strcpy_prom ; copy in buffer
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
372 bra menu_draw_line_none
0
heinrichsweikamp
parents:
diff changeset
373
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
374 menu_draw_line_call:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
375 movff text_item+0,FSR1L ; read string from PROM
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
376 movff text_item+1,FSR1H
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
377 call strcpy_text ; copy in buffer
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
378 bra menu_draw_line_none
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
379
0
heinrichsweikamp
parents:
diff changeset
380 menu_draw_line_option:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
381 movff text_item+0,FSR1L ; read string from PROM
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
382 movff text_item+1,FSR1H
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
383 call strcpy_text ; copy in buffer
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
384 movff option_item+0,FSR0L ; retrieve option handle
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
385 movff option_item+1,FSR0H
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
386 btfss block_option_value ; display of option value suspended?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
387 call option_draw ; NO - draw option (do not do it when setting time or date)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
388 bra menu_draw_line_none
0
heinrichsweikamp
parents:
diff changeset
389
heinrichsweikamp
parents:
diff changeset
390 menu_draw_line_dynamic:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
391 lfsr FSR2,buffer
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
392 movff menu_item,PRODL ; pass item to callback
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
393 rcall menu_text_call ; push return address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
394 bra menu_draw_line_none
0
heinrichsweikamp
parents:
diff changeset
395
heinrichsweikamp
parents:
diff changeset
396 ; Computed goto to pointer inside dynamic_item:
heinrichsweikamp
parents:
diff changeset
397 menu_text_call:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
398 movf dynamic_item+0,W ; check if callback is NULL
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
399 iorwf dynamic_item+1,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
400 iorwf dynamic_item+2,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
401 btfsc STATUS,Z
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
402 return ; YES - don't call it
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
403 movff dynamic_item+2,PCLATU ; prepare...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
404 movff dynamic_item+1,PCLATH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
405 movf dynamic_item+0,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
406 movwf PCL ; ...and jump
0
heinrichsweikamp
parents:
diff changeset
407
heinrichsweikamp
parents:
diff changeset
408 menu_draw_line_none:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
409 btfsc divemode ; in dive mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
410 bra menu_draw_line_none_divemode ; YES
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
411 movlw MENU_LINE_MAX_LENGTH
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
412 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
413 clrf WREG
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
414 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
415 call aa_wordprocessor
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
416 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
417 movlw MENU_HEIGHT ; NO - move to next line
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
418 addwf win_top,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
419 incf menu_item,F ; inc loop counter
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
420 movf start_item,W ; first line (scrolled)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
421 subwf menu_item,W ; current - first
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
422 xorlw MENU_LINES_MAX ; get max number of lines
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
423 btfsc STATUS,Z ; already done max number of lines?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
424 return ; YES
0
heinrichsweikamp
parents:
diff changeset
425 menu_draw_line_none2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
426 movf menu_item,W ; done item_max lines?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
427 xorwf item_max,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
428 btfss STATUS,Z
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
429 bra menu_draw_lines_1 ; NO - loop...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
430 return
0
heinrichsweikamp
parents:
diff changeset
431
heinrichsweikamp
parents:
diff changeset
432 menu_draw_line_none_divemode:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
433 movlw .10
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
434 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
435 clrf WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
436 movff WREG,buffer+.10
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
437 call aa_wordprocessor ; draw the line
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
438 bcf win_invert ; reset invert flag
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
439 movlw .24 ; dive mode menu spacing
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
440 addwf win_top,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
441 incf menu_item,F ; inc loop counter
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
442 movlw .3
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
443 cpfseq menu_item ; at position 4?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
444 bra menu_draw_line_none2 ; NO
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
445 movlw dm_menu_item4_row
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
446 movff WREG,win_top ; reset row
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
447 movlw dm_menu_item4_column
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
448 movff WREG,win_leftx2 ; new column
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
449 bra menu_draw_line_none2 ; done
0
heinrichsweikamp
parents:
diff changeset
450
heinrichsweikamp
parents:
diff changeset
451 ;-----------------------------------------------------------------------------
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
452 ; draw cursor
0
heinrichsweikamp
parents:
diff changeset
453 menu_draw_selected_line:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
454 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
455 call TFT_standard_color
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
456 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
457 movf start_item,W ; first line (scrolled)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
458 subwf selected_item,W ; selected - first
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
459 mullw MENU_HEIGHT ; 30 pixel by line
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
460 movf PRODL,W ; result
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
461 addwf menu_center,W ; added to first line
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 619
diff changeset
462 movwf win_top ; and stored to position
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
463 STRCPY_PRINT "\xb7" ; print cursor
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
464 return
0
heinrichsweikamp
parents:
diff changeset
465
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
466 END