Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 513:c9f19a546e64
BUGFIX MISSING movlb for gaslist (simulator).
author | JeanDo |
---|---|
date | Sun, 04 Dec 2011 17:46:08 +0100 |
parents | ed51a7a89d9a |
children | b498245da3f1 |
comparison
equal
deleted
inserted
replaced
512:e7893664bd29 | 513:c9f19a546e64 |
---|---|
281 ; Routines used in the "other second" | 281 ; Routines used in the "other second" |
282 call calc_average_depth ; calculate average depth | 282 call calc_average_depth ; calculate average depth |
283 call calc_velocity ; calculate vertical velocity and display if > threshold (every two seconds) | 283 call calc_velocity ; calculate vertical velocity and display if > threshold (every two seconds) |
284 | 284 |
285 ; Calculate CNS | 285 ; Calculate CNS |
286 rcall set_actual_ppo2 ; Set char_I_actual_ppO2 | 286 rcall set_actual_ppo2 ; Set char_I_actual_ppO2 |
287 clrf WREG | 287 clrf WREG |
288 movff WREG,char_I_step_is_1min ; Make sure to be in 2sec mode. | 288 movff WREG,char_I_step_is_1min ; Make sure to be in 2sec mode. |
289 | 289 |
290 call deco_calc_CNS_fraction ; calculate CNS | 290 call deco_calc_CNS_fraction ; calculate CNS |
291 movlb b'00000001' ; rambank 1 selected | 291 movlb b'00000001' ; rambank 1 selected |
296 subwf lo,W | 296 subwf lo,W |
297 btfsc STATUS,C | 297 btfsc STATUS,C |
298 call PLED_display_cns ; Show CNS | 298 call PLED_display_cns ; Show CNS |
299 call check_gas_change ; Checks if a better gas should be selected (by user) | 299 call check_gas_change ; Checks if a better gas should be selected (by user) |
300 | 300 |
301 ; Check for decompression gases if in decomode | 301 ;NOTE: always set full gas list, because the user can switch gas, |
302 btfss dekostop_active | 302 ; even in NDL mode... |
303 bra reset_decompression_gases ; While in NDL, do not set deompression gas | |
304 | 303 |
305 ; Copy all gases to char_I_deco_N2_ratio and char_I_deco_He_ratio | 304 ; Copy all gases to char_I_deco_N2_ratio and char_I_deco_He_ratio |
306 divemode_check_decogases: ; CALLed from Simulator, too | 305 divemode_check_decogases: ; CALLed from Simulator, too |
307 | |
308 clrf EEADRH ; Make sure to select eeprom bank 0 | 306 clrf EEADRH ; Make sure to select eeprom bank 0 |
309 | 307 |
310 read_int_eeprom d'7' ; Read He ratio | 308 ;;;; FIXME BANK1 ??? |
311 movff EEDATA,char_I_deco_He_ratio+0 ; And copy into hold register | 309 |
312 read_int_eeprom d'6' ; Read O2 ratio | 310 read_int_eeprom d'7' ; Read He ratio |
313 movff char_I_deco_He_ratio+0, wait_temp ; copy into bank1 register | 311 movff EEDATA,char_I_deco_He_ratio+0 ; And copy into hold register |
314 bsf STATUS,C ; | 312 read_int_eeprom d'6' ; Read O2 ratio |
315 movlw d'100' ; 100% | 313 movff char_I_deco_He_ratio+0,WREG ; Get back He -> WREG |
316 subfwb wait_temp,W ; minus He | 314 addwf EEDATA,W ; O2 + He -> WREG |
317 subfwb EEDATA,F ; minus O2 | 315 sublw d'100' ; 100 - (O2 + He) -> WREG |
318 movff EEDATA, char_I_deco_N2_ratio+0; = N2! | 316 movff WREG, char_I_deco_N2_ratio+0; Push N2 to C code; |
319 | 317 |
320 read_int_eeprom d'11' ; Read He ratio | 318 read_int_eeprom d'11' ; Read He ratio |
321 movff EEDATA,char_I_deco_He_ratio+1 ; And copy into hold register | 319 movff EEDATA,char_I_deco_He_ratio+1 ; And copy into hold register |
322 read_int_eeprom d'10' ; Read O2 ratio | 320 read_int_eeprom d'10' ; Read O2 ratio |
323 movff char_I_deco_He_ratio+1, wait_temp ; copy into bank1 register | 321 movff char_I_deco_He_ratio+1,WREG ; Get back He -> WREG |
324 bsf STATUS,C ; | 322 addwf EEDATA,W ; O2 + He -> WREG |
325 movlw d'100' ; 100% | 323 sublw d'100' ; 100 - (O2 + He) -> WREG |
326 subfwb wait_temp,W ; minus He | 324 movff WREG, char_I_deco_N2_ratio+1; Push N2 to C code; |
327 subfwb EEDATA,F ; minus O2 | |
328 movff EEDATA, char_I_deco_N2_ratio+1; = N2! | |
329 | 325 |
330 read_int_eeprom d'15' ; Read He ratio | 326 read_int_eeprom d'15' ; Read He ratio |
331 movff EEDATA,char_I_deco_He_ratio+2 ; And copy into hold register | 327 movff EEDATA,char_I_deco_He_ratio+2 ; And copy into hold register |
332 read_int_eeprom d'14' ; Read O2 ratio | 328 read_int_eeprom d'14' ; Read O2 ratio |
333 movff char_I_deco_He_ratio+2, wait_temp ; copy into bank1 register | 329 movff char_I_deco_He_ratio+2,WREG ; Get back He -> WREG |
334 bsf STATUS,C ; | 330 addwf EEDATA,W ; O2 + He -> WREG |
335 movlw d'100' ; 100% | 331 sublw d'100' ; 100 - (O2 + He) -> WREG |
336 subfwb wait_temp,W ; minus He | 332 movff WREG, char_I_deco_N2_ratio+2; Push N2 to C code; |
337 subfwb EEDATA,F ; minus O2 | |
338 movff EEDATA, char_I_deco_N2_ratio+2; = N2! | |
339 | 333 |
340 read_int_eeprom d'19' ; Read He ratio | 334 read_int_eeprom d'19' ; Read He ratio |
341 movff EEDATA,char_I_deco_He_ratio+3 ; And copy into hold register | 335 movff EEDATA,char_I_deco_He_ratio+3 ; And copy into hold register |
342 read_int_eeprom d'18' ; Read O2 ratio | 336 read_int_eeprom d'18' ; Read O2 ratio |
343 movff char_I_deco_He_ratio+3, wait_temp ; copy into bank1 register | 337 movff char_I_deco_He_ratio+3,WREG ; Get back He -> WREG |
344 bsf STATUS,C ; | 338 addwf EEDATA,W ; O2 + He -> WREG |
345 movlw d'100' ; 100% | 339 sublw d'100' ; 100 - (O2 + He) -> WREG |
346 subfwb wait_temp,W ; minus He | 340 movff WREG, char_I_deco_N2_ratio+3; Push N2 to C code; |
347 subfwb EEDATA,F ; minus O2 | |
348 movff EEDATA, char_I_deco_N2_ratio+3; = N2! | |
349 | 341 |
350 read_int_eeprom d'23' ; Read He ratio | 342 read_int_eeprom d'23' ; Read He ratio |
351 movff EEDATA,char_I_deco_He_ratio+4; And copy into hold register | 343 movff EEDATA,char_I_deco_He_ratio+4; And copy into hold register |
352 read_int_eeprom d'22' ; Read O2 ratio | 344 read_int_eeprom d'22' ; Read O2 ratio |
353 movff char_I_deco_He_ratio+4, wait_temp ; copy into bank1 register | 345 movff char_I_deco_He_ratio+4,WREG ; Get back He -> WREG |
354 bsf STATUS,C ; | 346 addwf EEDATA,W ; O2 + He -> WREG |
355 movlw d'100' ; 100% | 347 sublw d'100' ; 100 - (O2 + He) -> WREG |
356 subfwb wait_temp,W ; minus He | 348 movff WREG, char_I_deco_N2_ratio+4; Push N2 to C code; |
357 subfwb EEDATA,F ; minus O2 | |
358 movff EEDATA, char_I_deco_N2_ratio+4; = N2! | |
359 | 349 |
360 ; Copy depth of enabled gas into char_I_deco_gas_change | 350 ; Copy depth of enabled gas into char_I_deco_gas_change |
361 ; Note gaslist_active is inited in diveloop_boot, and edited by | 351 ; Note gaslist_active is inited in diveloop_boot, and edited by |
362 ; the de-activation menu. So don't reread it from eeprom here. | 352 ; the de-activation menu. So don't reread it from eeprom here. |
363 | 353 |