comparison code_part1/OSTC_code_asm_part1/definitions.asm @ 164:999abb01c78f

+ Change data allocation scheme
author JeanDo
date Fri, 21 Jan 2011 01:44:38 +0100
parents 144822282fa3
children 8b5b848db4cd
comparison
equal deleted inserted replaced
163:144822282fa3 164:999abb01c78f
84 c_code_data_stack EQU 0x800 ; Reserve space for C-code data space. Eg.when calling log. 84 c_code_data_stack EQU 0x800 ; Reserve space for C-code data space. Eg.when calling log.
85 85
86 ;Variable definitions 86 ;Variable definitions
87 ; arrays are in hex size!! 20 = .032 87 ; arrays are in hex size!! 20 = .032
88 88
89 CBLOCK 0x060 ;Bank 0 89 ;=============================================================================
90 letter:.026 ;letter buffer 90 ; BANK0 data
91 win_color1 91 ;
92 win_color2 92 bank0 udata 0x060 ;Bank 0
93 win_top ; Box/text position (0..239). 93 letter res .26 ;letter buffer
94 win_height ; Box/text height (1..240) 94 win_color1 res 1
95 win_leftx2 ; Box/text position (0..159) 95 win_color2 res 1
96 win_width ; box width (1..160) 96 win_top res 1 ; Box/text position (0..239).
97 win_font 97 win_height res 1 ; Box/text height (1..240)
98 win_invert 98 win_leftx2 res 1 ; Box/text position (0..159)
99 win_bargraph ; PLED_box swicth to black after this position (0..159). 99 win_width res 1 ; box width (1..160)
100 win_flags ; flip_screen flag, transparent fonts, etc... 100 win_font res 1
101 101 win_invert res 1
102 pressureSum:2 ; Stabilize surface presure by a long averaging window [mbar] 102 win_bargraph res 1 ; PLED_box swicth to black after this position (0..159).
103 pressureCount ; Count of pressure values. 103 win_flags res 1 ; flip_screen flag, transparent fonts, etc...
104 pressureAvg:2 ; save averaged pressure x16, for altimeter_menu 104
105 pressureRef:2 ; Pressure at sea level [mbar] 105 pressureSum res 2 ; Stabilize surface presure by a long averaging window [mbar]
106 altitude:2 ; Last computed altitude [m] 106 pressureCount res 1 ; Count of pressure values.
107 107 pressureAvg res 2 ; save averaged pressure x16, for altimeter_menu
108 ENDC 108 pressureRef res 2 ; Pressure at sea level [mbar]
109 109 altitude res 2 ; Last computed altitude [m]
110 CBLOCK 0x100 ;Bank 1 110
111 wreg_temp ;variables used for context saving during ISR 111 ;=============================================================================
112 status_temp 112 ; BANK1 data
113 bsr_temp 113 ;
114 prod_temp:2 ;Trashed by isr_mult16x16, for sensor compensations 114 bank1 udata 0x100 ;Bank 1
115 115
116 secs ;realtime clock 116 wreg_temp res 1 ;variables used for context saving during ISR
117 mins 117 status_temp res 1
118 hours 118 bsr_temp res 1
119 day 119 prod_temp res 2 ;Trashed by isr_mult16x16, for sensor compensations
120 month 120
121 year 121 secs res 1 ;realtime clock
122 122 mins res 1
123 waitms_temp ;variables required for wait routines 123 hours res 1
124 wait_temp ; " + used to copy data to c code + used for temp/testing 124 day res 1
125 ; never use wait_temp in interrupt routines (isr) and never call any wait routine in interrupts 125 month res 1
126 126 year res 1
127 textnumber ;for textdisplay and textlookup 127
128 textlength 128 waitms_temp res 1 ;variables required for wait routines
129 textaddress:2 129 wait_temp res 1 ; " + used to copy data to c code + used for temp/testing
130 130 ; never use wait_temp in interrupt routines (isr) and never call any wait routine in interrupts
131 average_depth_hold:4 ; Holds Sum of depths (Resettable) 131
132 average_depth_hold_total:4 ; Holds Sum of depths (Non-Resettable) 132 textnumber res 1 ;for textdisplay and textlookup
133 b0_lo ; Temp (calculate_average) 133 textlength res 1
134 b0_hi ; Temp (calculate_average) 134 textaddress res 2
135 average_divesecs:2 ; Used for resetable average depth display 135
136 surface_interval:2 ; Surface Interval [mins] 136 average_depth_hold res 4 ; Holds Sum of depths (Resettable)
137 137 average_depth_hold_total res 4 ; Holds Sum of depths (Non-Resettable)
138 flag1 ;Flag register 33 138 b0_lo res 1 ; Temp (calculate_average)
139 flag2 139 b0_hi res 1 ; Temp (calculate_average)
140 flag3 140 average_divesecs res 2 ; Used for resetable average depth display
141 flag4 141 surface_interval res 2 ; Surface Interval [mins]
142 flag5 ; has to be exacly here, is modified by c-code (no sensor int) 142
143 flag6 143 flag1 res 1 ;Flag register 33
144 flag7 144 flag2 res 1
145 flag8 145 flag3 res 1
146 flag9 146 flag4 res 1
147 flag10 147 flag5 res 1 ; has to be exacly here, is modified by c-code (no sensor int)
148 flag11 148 flag6 res 1
149 flag12 149 flag7 res 1
150 flag13 150 flag8 res 1
151 flag14 151 flag9 res 1
152 flag15 152 flag10 res 1
153 153 flag11 res 1
154 oled1_temp ;Temp variables for display output 154 flag12 res 1
155 oled2_temp 155 flag13 res 1
156 oled3_temp 156 flag14 res 1
157 oled4_temp ; Used in "Displaytext" 157 flag15 res 1
158 158
159 lo ;bin to dec conversion routine 159 oled1_temp res 1 ; Temp variables for display output
160 hi 160 oled2_temp res 1
161 lo_temp 161 oled3_temp res 1
162 hi_temp 162 oled4_temp res 1 ; Used in "Displaytext"
163 temp3 ; used in valconv math 163
164 temp4 ; used in valconv math 164 lo res 1 ; bin to dec conversion routine
165 ignore_digits 165 hi res 1
166 166 lo_temp res 1
167 temp1 ;Multipurpose Temp variables used in valconv math 167 hi_temp res 1
168 temp2 ; used in valconv math 168 temp3 res 1 ; used in valconv math
169 169 temp4 res 1 ; used in valconv math
170 ext_ee_temp1 ; External EEPROM Temp 1 used in I2C EEPROM 170 ignore_digits res 1
171 ext_ee_temp2 ; External EEPROM Temp 2 used in I2C EEPROM 171
172 172 temp1 res 1 ; Multipurpose Temp variables used in valconv math
173 isr1_temp ;ISR temp variables 173 temp2 res 1 ; used in valconv math
174 isr2_temp 174
175 isr3_temp:2 175 ext_ee_temp1 res 1 ; External EEPROM Temp 1 used in I2C EEPROM
176 176 ext_ee_temp2 res 1 ; External EEPROM Temp 2 used in I2C EEPROM
177 timer1int_counter1 ;Timer 1 counter 177
178 timer1int_counter2 ;Timer 1 counter 178 isr1_temp res 1 ; ISR temp variables
179 179 isr2_temp res 1
180 uart1_temp ;RS232 temp variables 180 isr3_temp res 2
181 uart2_temp ;70 181
182 182 timer1int_counter1 res 1 ;Timer 1 counter
183 divA:2 ;math routines 183 timer1int_counter2 res 1 ;Timer 1 counter
184 divB 184
185 xC:4 185 uart1_temp res 1 ;RS232 temp variables
186 xA:2 186 uart2_temp res 1 ;70
187 xB:2 187
188 sub_c:2 188 divA res 2 ;math routines
189 sub_a:2 189 divB res 1
190 sub_b:2 190 xC res 4
191 191 xA res 2
192 dLSB ;Pressure sensor interface 192 xB res 2
193 dMSB 193 sub_c res 2
194 clock_count 194 sub_a res 2
195 ppO2_setpoint_store ; Actual setpoint 195 sub_b res 2
196 W1:2 196
197 W2:2 197 dLSB res 1 ;Pressure sensor interface
198 W3:2 198 dMSB res 1
199 W4:2 ;100 199 clock_count res 1
200 C1:2 200 ppO2_setpoint_store res 1 ; Actual setpoint
201 C2:2 201
202 C3:2 202 ; Pressure/Temperatuse sensor data
203 C4:2 203 W1 res 2 ; Raw (packed) calibration data
204 C5:2 204 W2 res 2
205 C6:2 205 W3 res 2
206 D1:2 206 W4 res 2 ; 100
207 D2:2 207 C1 res 2 ; Decoded calibration data
208 208 C2 res 2
209 isr_divA:2 209 C3 res 2
210 isr_divB 210 C4 res 2
211 isr_xC:4 211 C5 res 2
212 isr_xA:2 212 C6 res 2
213 isr_xB:2 213 D1 res 2 ; raw pressure
214 isr_sub_c:2 214 D2 res 2 ; raw temperature
215 isr_sub_a:2 215
216 isr_sub_b:2 216 isr_divA res 2 ; Data for ISR math subroutines
217 217 isr_divB res 1
218 xdT:2 218 isr_xC res 4
219 xdT2:2 219 isr_xA res 2
220 OFF:2 220 isr_xB res 2
221 SENS:2 221
222 amb_pressure:2 ; ambient pressure [mBar] 222 xdT res 2 ; Tmp for temperature compensation (in ISR)
223 rel_pressure:2 ; amb_pressure - surface pressure [mBar] 223 xdT2 res 2
224 max_pressure:2 ; Max. pressure for the dive [mBar] 224 OFF res 2
225 avr_rel_pressure:2 ; Average rel. pressure (Average depth) for the dive [mBar], Resettable 225 SENS res 2
226 avr_rel_pressure_total:2 ; Average rel. pressure (Average depth) for the dive [mBar], Non-Resettable 226
227 last_pressure:2 227 amb_pressure res 2 ; ambient pressure [mBar]
228 temperature:2 228 rel_pressure res 2 ; amb_pressure - surface pressure [mBar]
229 last_temperature:2 229 max_pressure res 2 ; Max. pressure for the dive [mBar]
230 temperature_temp:2 230 avr_rel_pressure res 2 ; Average rel. pressure (Average depth) for the dive [mBar], Resettable
231 Dx:2 231 avr_rel_pressure_total res 2 ; Average rel. pressure (Average depth) for the dive [mBar], Non-Resettable
232 232 last_pressure res 2
233 last_surfpressure:2 ;Divemode 233 temperature res 2
234 last_surfpressure_15min:2 234 last_temperature res 2
235 last_surfpressure_30min:2 235 temperature_temp res 2
236 divemins:2 ;Minutes 236 Dx res 2
237 divesecs ;seconds 237
238 samplesecs ; counts the seconds until the next sample is stored in divemode 238 last_surfpressure res 2 ; Divemode
239 samplesecs_value ; holds the CF20 value 239 last_surfpressure_15min res 2
240 decodata:2 ;Deco data 240 last_surfpressure_30min res 2
241 mintemp:2 ;min temperature 241 divemins res 2 ; Minutes
242 ProfileFlagByte ; stores number of addional bytes per sample 242 divesecs res 1 ; seconds
243 EventByte ; Stores the Event type plus flags 243 samplesecs res 1 ; counts the seconds until the next sample is stored in divemode
244 AlarmType ; 0= No Alarm 244 samplesecs_value res 1 ; holds the CF20 value
245 decodata res 2 ; Deco data
246 mintemp res 2 ; min temperature
247 ProfileFlagByte res 1 ; stores number of addional bytes per sample
248 EventByte res 1 ; Stores the Event type plus flags
249 AlarmType res 1 ; 0= No Alarm
245 ; 1= SLOW 250 ; 1= SLOW
246 ; 2= DecoStop missed 251 ; 2= DecoStop missed
247 ; 3= DeepStop missed 252 ; 3= DeepStop missed
248 ; 4= ppO2 Low Warning 253 ; 4= ppO2 Low Warning
249 ; 5= ppO2 High Warning 254 ; 5= ppO2 High Warning
250 ; 6= manual marker 255 ; 6= manual marker
251 256
252 divisor_temperature ; divisors for profile storage 257 divisor_temperature res 1 ; divisors for profile storage
253 divisor_deco 258 divisor_deco res 1
254 divisor_tank 259 divisor_tank res 1
255 divisor_ppo2 260 divisor_ppo2 res 1
256 divisor_deco_debug 261 divisor_deco_debug res 1
257 divisor_nuy2 262 divisor_nuy2 res 1
258 263
259 timeout_counter ;Timeout counter variables 264 timeout_counter res 1 ; Timeout counter variables
260 timeout_counter2 265 timeout_counter2 res 1
261 timeout_counter3 ;pre-menu timeout counter 266 timeout_counter3 res 1 ; pre-menu timeout counter
262 267
263 menupos ;cursor position 268 menupos res 1 ; cursor position
264 menupos2 269 menupos2 res 1
265 menupos3 ;used in Logbook, Set Time and divemode 270 menupos3 res 1 ; used in Logbook, Set Time and divemode
266 271
267 eeprom_address:2 ;external EEPROM 272 eeprom_address res 2 ; external EEPROM
268 eeprom_header_address:2 273 eeprom_header_address res 2
269 274
270 divenumber ;Logbook 275 divenumber res 1 ; Logbook
271 276
272 batt_voltage:2 ;Battery voltage in mV 277 batt_voltage res 2 ; Battery voltage in mV
273 278
274 i2c_temp ;I²C timeout counter 279 i2c_temp res 1 ; I²C timeout counter
275 i2c_temp2;200 280 i2c_temp2 res 1 ; 200
276 281
277 sim_pressure:2 ; hold simulated pressure in mBar if in Simulator mode 282 sim_pressure res 2 ; hold simulated pressure in mBar if in Simulator mode
278 283
279 profile_temp:2 ; temp variable for profile view 284 profile_temp res 2 ; temp variable for profile view
280 profile_temp2:2 ; temp variable for profile view 285 profile_temp2 res 2 ; temp variable for profile view
281 286
282 nofly_time:2 ; No Fly time in Minutes (Calculated after Dive) 287 nofly_time res 2 ; No Fly time in Minutes (Calculated after Dive)
283 288
284 cf_checker_counter ; counts custom functions to check for warning symbol 289 cf_checker_counter res 1 ; counts custom functions to check for warning symbol
285 290
286 char_I_O2_ratio ; 02 ratio 291 char_I_O2_ratio res 1 ; 02 ratio
287 292
288 active_gas ; Holds number of active gas 293 active_gas res 1 ; Holds number of active gas
289 294
290 last_diluent ; backup of diluent percentage in const ppO2 mode 295 last_diluent res 1 ; backup of diluent percentage in const ppO2 mode
291 last_ppO2_value ; last calculated ppO2 value 296 last_ppO2_value res 1 ; last calculated ppO2 value
292 297
293 ; ontime_since_last_charge:2 ; Ontime in minutes since last complete charge cycle 298 debug_char res 6 ; For debugmode
294 ; sleeptime_since_last_charge:2; Sleeptime in hours since last complete charge 299
295 300 apnoe_mins res 1 ; single descent minutes for Apnoe mode
296 debug_char:6 ; For debugmode 301 apnoe_secs res 1 ; single descent seconds for Apnoe mode
297 302 apnoe_max_pressure res 2 ; Max. Pressure in Apnoe mode
298 apnoe_mins ; single descent minutes for Apnoe mode 303 apnoe_timeout_counter res 1 ; counts minutes for apnoe timeout
299 apnoe_secs ; single descent seconds for Apnoe mode 304 apnoe_surface_mins res 1 ; Surface interval mins for Apnoe mode
300 apnoe_max_pressure:2 ; Max. Pressure in Apnoe mode 305 apnoe_surface_secs res 1 ; Surface interval secs for Apnoe mode
301 apnoe_timeout_counter ; counts minutes for apnoe timeout 306 customfunction_temp1 res 1 ; start of custom function descriptors
302 apnoe_surface_mins ; Surface interval mins for Apnoe mode 307 customfunction_temp2 res 1 ; used in GETCUSTOM8 and GETCUSTOM15
303 apnoe_surface_secs ; Surface interval secs for Apnoe mode 308
304 customfunction_temp1 ; start of custom function descriptors 309 decoplan_page res 1 ; used in PLED_MultiGF,...
305 customfunction_temp2 ; used in GETCUSTOM8 and GETCUSTOM15 310 temp10 res 1 ; used in customview
306 311
307 decoplan_page ; used in PLED_MultiGF,... 312 fatal_error_code res 1 ; holds error code value
308 temp10 ; used in customview 313
309 314 logbook_temp1 res 1 ; Temp used in logbook display&Divemode&Gassetup
310 fatal_error_code ; holds error code value 315 logbook_temp2 res 1 ; Temp used in logbook display&Divemode&Gassetup
311 316 logbook_temp3 res 1 ; Temp used in logbook display&Divemode&Gassetup
312 logbook_temp1 ; Temp used in logbook display&Divemode&Gassetup 317 logbook_temp4 res 1 ; Temp used in logbook display&Divemode&Gassetup
313 logbook_temp2 ; Temp used in logbook display&Divemode&Gassetup 318 logbook_temp5 res 1 ; Temp used in logbook display&Divemode&Gassetup
314 logbook_temp3 ; Temp used in logbook display&Divemode&Gassetup 319 logbook_temp6 res 1 ; Temp used in logbook display&Divemode&Gassetup
315 logbook_temp4 ; Temp used in logbook display&Divemode&Gassetup 320
316 logbook_temp5 ; Temp used in logbook display&Divemode&Gassetup 321 convert_value_temp res 3 ; used in menu_battery_state_convert_date
317 logbook_temp6 ; Temp used in logbook display&Divemode&Gassetup 322 time_correction_value res 1 ; Adds to Seconds on midnight
318 323
319 convert_value_temp:3 ; used in menu_battery_state_convert_date 324 ;=============================================================================
320 time_correction_value ; Adds to Seconds on midnight
321 ENDC
322
323 CBLOCK 0x700 ;Bank 7
324 ; variables used exclusively in dd:
325 dd_temp_BSR ; has to be first in bank7
326 temp_pointer_row
327 temp_pointer_column
328 temp2_pointer_row
329 temp2_pointer_column
330 temp_selected_char
331 temp_font_HIGH
332 temp_font_LOW
333 temp_font_height
334 temp2_font_height
335 temp_font_width
336 temp2_font_width
337 temp_diff_font_width
338 temp2_diff_font_width
339 temp_font_offset_left
340 temp_font_offset_right
341 temp_pos
342 DDflag
343 dd_oled_brightness_offset ; value will be subtracted from "dd_grayvalue" in dd_font2display_vxxx.asm
344 dd_grayvalue
345 dd2_temp
346 dd3_temp
347 dd_pos_decpoint
348 dd_grayvalue_temp
349 dd_grayvalue_temp2
350 ENDC
351
352 CBLOCK 0x94A ;Bank 9
353 char_O_hash:.16 ; MD2 hash values = d'16'
354 ENDC
355
356 ; C-code Routines 325 ; C-code Routines
357 ; PART 2 326 ; PART 2
358 extern deco_calc_CNS_decrease_15min 327 extern deco_calc_CNS_decrease_15min
359 extern deco_calc_CNS_fraction 328 extern deco_calc_CNS_fraction
360 extern deco_calc_desaturation_time 329 extern deco_calc_desaturation_time
365 extern deco_clear_tissue 334 extern deco_clear_tissue
366 extern deco_hash 335 extern deco_hash
367 extern deco_pull_tissues_from_vault 336 extern deco_pull_tissues_from_vault
368 extern deco_push_tissues_to_vault 337 extern deco_push_tissues_to_vault
369 338
339 ;=============================================================================
370 ;I/O Ports (I=Input, O=Output) 340 ;I/O Ports (I=Input, O=Output)
341 ;
371 #DEFINE sensor_SDO PORTA,1 ;O 342 #DEFINE sensor_SDO PORTA,1 ;O
372 #DEFINE oled_rw PORTA,2 ;0 343 #DEFINE oled_rw PORTA,2 ;0
373 #DEFINE oled_hv PORTA,3 ;O 344 #DEFINE oled_hv PORTA,3 ;O
374 #DEFINE sensor_SDI PORTA,4 ;I 345 #DEFINE sensor_SDI PORTA,4 ;I
375 #DEFINE oled_cs PORTA,5 ;O 346 #DEFINE oled_cs PORTA,5 ;O