# HG changeset patch # User JeanDo # Date 1323017168 -3600 # Node ID c9f19a546e64b9fd9fb228b140906f8f7a0c5890 # Parent e7893664bd29cffe58068842cec0ff34f90e7c7b BUGFIX MISSING movlb for gaslist (simulator). diff -r e7893664bd29 -r c9f19a546e64 code_part1/OSTC_code_asm_part1/divemode.asm --- a/code_part1/OSTC_code_asm_part1/divemode.asm Sun Dec 04 17:45:51 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/divemode.asm Sun Dec 04 17:46:08 2011 +0100 @@ -283,7 +283,7 @@ call calc_velocity ; calculate vertical velocity and display if > threshold (every two seconds) ; Calculate CNS - rcall set_actual_ppo2 ; Set char_I_actual_ppO2 + rcall set_actual_ppo2 ; Set char_I_actual_ppO2 clrf WREG movff WREG,char_I_step_is_1min ; Make sure to be in 2sec mode. @@ -298,64 +298,54 @@ call PLED_display_cns ; Show CNS call check_gas_change ; Checks if a better gas should be selected (by user) -; Check for decompression gases if in decomode - btfss dekostop_active - bra reset_decompression_gases ; While in NDL, do not set deompression gas +;NOTE: always set full gas list, because the user can switch gas, +; even in NDL mode... ; Copy all gases to char_I_deco_N2_ratio and char_I_deco_He_ratio divemode_check_decogases: ; CALLed from Simulator, too - clrf EEADRH ; Make sure to select eeprom bank 0 - read_int_eeprom d'7' ; Read He ratio - movff EEDATA,char_I_deco_He_ratio+0 ; And copy into hold register - read_int_eeprom d'6' ; Read O2 ratio - movff char_I_deco_He_ratio+0, wait_temp ; copy into bank1 register - bsf STATUS,C ; - movlw d'100' ; 100% - subfwb wait_temp,W ; minus He - subfwb EEDATA,F ; minus O2 - movff EEDATA, char_I_deco_N2_ratio+0; = N2! +;;;; FIXME BANK1 ??? - read_int_eeprom d'11' ; Read He ratio - movff EEDATA,char_I_deco_He_ratio+1 ; And copy into hold register - read_int_eeprom d'10' ; Read O2 ratio - movff char_I_deco_He_ratio+1, wait_temp ; copy into bank1 register - bsf STATUS,C ; - movlw d'100' ; 100% - subfwb wait_temp,W ; minus He - subfwb EEDATA,F ; minus O2 - movff EEDATA, char_I_deco_N2_ratio+1; = N2! + read_int_eeprom d'7' ; Read He ratio + movff EEDATA,char_I_deco_He_ratio+0 ; And copy into hold register + read_int_eeprom d'6' ; Read O2 ratio + movff char_I_deco_He_ratio+0,WREG ; Get back He -> WREG + addwf EEDATA,W ; O2 + He -> WREG + sublw d'100' ; 100 - (O2 + He) -> WREG + movff WREG, char_I_deco_N2_ratio+0; Push N2 to C code; + + read_int_eeprom d'11' ; Read He ratio + movff EEDATA,char_I_deco_He_ratio+1 ; And copy into hold register + read_int_eeprom d'10' ; Read O2 ratio + movff char_I_deco_He_ratio+1,WREG ; Get back He -> WREG + addwf EEDATA,W ; O2 + He -> WREG + sublw d'100' ; 100 - (O2 + He) -> WREG + movff WREG, char_I_deco_N2_ratio+1; Push N2 to C code; read_int_eeprom d'15' ; Read He ratio movff EEDATA,char_I_deco_He_ratio+2 ; And copy into hold register read_int_eeprom d'14' ; Read O2 ratio - movff char_I_deco_He_ratio+2, wait_temp ; copy into bank1 register - bsf STATUS,C ; - movlw d'100' ; 100% - subfwb wait_temp,W ; minus He - subfwb EEDATA,F ; minus O2 - movff EEDATA, char_I_deco_N2_ratio+2; = N2! + movff char_I_deco_He_ratio+2,WREG ; Get back He -> WREG + addwf EEDATA,W ; O2 + He -> WREG + sublw d'100' ; 100 - (O2 + He) -> WREG + movff WREG, char_I_deco_N2_ratio+2; Push N2 to C code; read_int_eeprom d'19' ; Read He ratio movff EEDATA,char_I_deco_He_ratio+3 ; And copy into hold register read_int_eeprom d'18' ; Read O2 ratio - movff char_I_deco_He_ratio+3, wait_temp ; copy into bank1 register - bsf STATUS,C ; - movlw d'100' ; 100% - subfwb wait_temp,W ; minus He - subfwb EEDATA,F ; minus O2 - movff EEDATA, char_I_deco_N2_ratio+3; = N2! + movff char_I_deco_He_ratio+3,WREG ; Get back He -> WREG + addwf EEDATA,W ; O2 + He -> WREG + sublw d'100' ; 100 - (O2 + He) -> WREG + movff WREG, char_I_deco_N2_ratio+3; Push N2 to C code; read_int_eeprom d'23' ; Read He ratio movff EEDATA,char_I_deco_He_ratio+4; And copy into hold register read_int_eeprom d'22' ; Read O2 ratio - movff char_I_deco_He_ratio+4, wait_temp ; copy into bank1 register - bsf STATUS,C ; - movlw d'100' ; 100% - subfwb wait_temp,W ; minus He - subfwb EEDATA,F ; minus O2 - movff EEDATA, char_I_deco_N2_ratio+4; = N2! + movff char_I_deco_He_ratio+4,WREG ; Get back He -> WREG + addwf EEDATA,W ; O2 + He -> WREG + sublw d'100' ; 100 - (O2 + He) -> WREG + movff WREG, char_I_deco_N2_ratio+4; Push N2 to C code; ; Copy depth of enabled gas into char_I_deco_gas_change ; Note gaslist_active is inited in diveloop_boot, and edited by diff -r e7893664bd29 -r c9f19a546e64 code_part1/OSTC_code_asm_part1/start.asm --- a/code_part1/OSTC_code_asm_part1/start.asm Sun Dec 04 17:45:51 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/start.asm Sun Dec 04 17:46:08 2011 +0100 @@ -98,7 +98,9 @@ call reset_all_cf endif - call deco_clear_tissue ; + call deco_clear_tissue + movlb b'00000001' ; select ram bank 1 + call divemode_check_decogases ; Setup N2/He ratio array call deco_calc_desaturation_time ; calculate desaturation time call deco_clear_CNS_fraction ; clear CNS diff -r e7893664bd29 -r c9f19a546e64 code_part1/OSTC_code_c_part2/p2_deco.c --- a/code_part1/OSTC_code_c_part2/p2_deco.c Sun Dec 04 17:45:51 2011 +0100 +++ b/code_part1/OSTC_code_c_part2/p2_deco.c Sun Dec 04 17:46:08 2011 +0100 @@ -1024,13 +1024,13 @@ ////////////////////////////////////////////////////////////////////////////// // Find current gas in the list (if any). // -// Input: char_I_current_gas. +// Input: char_I_current_gas = 1..6 // -// Output: sim_gas_last_depth, temp_depth_limit. +// Output: sim_gas_last_depth = 0..5, temp_depth_limit. // static void gas_switch_find_current(void) { - assert( 0 <= char_I_current_gas && char_I_current_gas <= (NUM_GAS+1) ); + assert( 0 < char_I_current_gas && char_I_current_gas <= (NUM_GAS+1) ); if( char_I_current_gas <= NUM_GAS ) // Gas1..Gas5 { diff -r e7893664bd29 -r c9f19a546e64 code_part1/OSTC_code_c_part2/p2_deco.o Binary file code_part1/OSTC_code_c_part2/p2_deco.o has changed