comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 8:d8b426d71282

1.52 rc2
author heinrichsweikamp
date Sun, 28 Feb 2010 16:19:21 +0100
parents 2b5c52ae3923
children 01510acaeb11
comparison
equal deleted inserted replaced
7:5c4ba624165d 8:d8b426d71282
310 movff char_O_CNS_fraction,lo ; copy into bank1 310 movff char_O_CNS_fraction,lo ; copy into bank1
311 GETCUSTOM8 d'27' ; cns_display_high 311 GETCUSTOM8 d'27' ; cns_display_high
312 subwf lo,W 312 subwf lo,W
313 btfsc STATUS,C 313 btfsc STATUS,C
314 call PLED_display_cns ; Show CNS 314 call PLED_display_cns ; Show CNS
315
316 call check_gas_change ; Checks if a better gas should be selected (by user)
315 317
316 ; Check for decompression gases if in decomode 318 ; Check for decompression gases if in decomode
317 divemode_check_decogases: ; CALLed from Simulator 319 divemode_check_decogases: ; CALLed from Simulator
318 btfss dekostop_active 320 btfss dekostop_active
319 bra reset_decompression_gases ; While in NDL, do not set deompression gas 321 bra reset_decompression_gases ; While in NDL, do not set deompression gas
879 881
880 check_ppO2_3: 882 check_ppO2_3:
881 return ; done 883 return ; done
882 884
883 885
886 check_gas_change: ; Checks if a better gas should be selected (by user)
887 bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
888
889 movff rel_pressure+0,xA+0
890 movff rel_pressure+1,xA+1
891 movlw d'100'
892 movwf xB+0
893 clrf xB+1
894 call div16x16 ; compute depth in full m -> result in xC+0
895
896 check_gas_change1: ; check gas1
897 read_int_eeprom d'27' ; read flag register
898 btfss EEDATA,0 ; check active flag
899 bra check_gas_change2 ; skip inactive gases!
900 movlw d'1'
901 cpfseq active_gas ; is this gas currently selected?
902 bra check_gas_change1x ; No...
903 bra check_gas_change2 ; Yes, skip depth check
904 check_gas_change1x:
905 read_int_eeprom d'28' ; read gas_change_depth
906 movlw d'3'
907 cpfsgt EEDATA ; Change depth>3m?
908 bra check_gas_change2 ; No, Change depth not deep enough, skip!
909 movf xC+0,W ; load depth in m into WREG
910 cpfsgt EEDATA ; gas_change_depth < current depth?
911 bra check_gas_change2 ; No, check next gas
912 movlw d'3'
913 subwf EEDATA,W ; Change depth-3m
914 cpfslt xC+0 ; current depth<Change depth-3m?
915 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
916
917 check_gas_change2: ; check gas2
918 read_int_eeprom d'27' ; read flag register
919 btfss EEDATA,1 ; check active flag
920 bra check_gas_change3 ; skip inactive gases!
921 movlw d'2'
922 cpfseq active_gas ; is this gas currently selected?
923 bra check_gas_change2x ; No...
924 bra check_gas_change3 ; Yes, skip depth check
925 check_gas_change2x:
926 read_int_eeprom d'29' ; read gas_change_depth
927 movlw d'3'
928 cpfsgt EEDATA ; Change depth>3m?
929 bra check_gas_change3 ; No, Change depth not deep enough, skip!
930 movf xC+0,W ; load depth in m into WREG
931 cpfsgt EEDATA ; gas_change_depth < current depth?
932 bra check_gas_change3 ; No, check next gas
933 movlw d'3'
934 subwf EEDATA,W ; Change depth-3m
935 cpfslt xC+0 ; current depth<Change depth-3m?
936 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
937
938 check_gas_change3: ; check gas3
939 read_int_eeprom d'27' ; read flag register
940 btfss EEDATA,2 ; check active flag
941 bra check_gas_change4 ; skip inactive gases!
942 movlw d'3'
943 cpfseq active_gas ; is this gas currently selected?
944 bra check_gas_change3x ; No...
945 bra check_gas_change4 ; Yes, skip depth check
946 check_gas_change3x:
947 read_int_eeprom d'30' ; read gas_change_depth
948 movlw d'3'
949 cpfsgt EEDATA ; Change depth>3m?
950 bra check_gas_change4 ; No, Change depth not deep enough, skip!
951 movf xC+0,W ; load depth in m into WREG
952 cpfsgt EEDATA ; gas_change_depth < current depth?
953 bra check_gas_change4 ; No, check next gas
954 movlw d'3'
955 subwf EEDATA,W ; Change depth-3m
956 cpfslt xC+0 ; current depth<Change depth-3m?
957 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
958
959 check_gas_change4: ; check gas4
960 read_int_eeprom d'27' ; read flag register
961 btfss EEDATA,3 ; check active flag
962 bra check_gas_change5 ; skip inactive gases!
963 movlw d'4'
964 cpfseq active_gas ; is this gas currently selected?
965 bra check_gas_change4x ; No...
966 bra check_gas_change5 ; Yes, skip depth check
967 check_gas_change4x:
968 read_int_eeprom d'31' ; read gas_change_depth
969 cpfsgt EEDATA ; Change depth>3m?
970 bra check_gas_change5 ; No, Change depth not deep enough, skip!
971 movf xC+0,W ; load depth in m into WREG
972 cpfsgt EEDATA ; gas_change_depth < current depth?
973 bra check_gas_change5 ; No, check next gas
974 movlw d'3'
975 subwf EEDATA,W ; Change depth-3m
976 cpfslt xC+0 ; current depth<Change depth-3m?
977 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
978
979 check_gas_change5: ; check gas5
980 read_int_eeprom d'27' ; read flag register
981 btfss EEDATA,4 ; check active flag
982 bra check_gas_change6 ; skip inactive gases!
983 movlw d'5'
984 cpfseq active_gas ; is this gas currently selected?
985 bra check_gas_change5x ; No...
986 bra check_gas_change6 ; Yes, skip depth check
987 check_gas_change5x:
988 read_int_eeprom d'32' ; read gas_change_depth
989 cpfsgt EEDATA ; Change depth>3m?
990 bra check_gas_change6 ; No, Change depth not deep enough, skip!
991 movf xC+0,W ; load depth in m into WREG
992 cpfsgt EEDATA ; gas_change_depth < current depth?
993 bra check_gas_change6 ; No, check next gas
994 movlw d'3'
995 subwf EEDATA,W ; Change depth-3m
996 cpfslt xC+0 ; current depth<Change depth-3m?
997 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
998
999 check_gas_change6: ;Done
1000 call PLED_active_gas_divemode ; Display gas, if required (and with "*" if irequired...)
1001 return
1002
884 calculate_noflytime: 1003 calculate_noflytime:
885 ; calculate nofly time 1004 ; calculate nofly time
886 movff int_O_desaturation_time+0,xA+0 1005 movff int_O_desaturation_time+0,xA+0
887 movff int_O_desaturation_time+1,xA+1 1006 movff int_O_desaturation_time+1,xA+1
888 tstfsz xA+0 ; Desat=0? 1007 tstfsz xA+0 ; Desat=0?
1433 bcf depth_greater_100m ; clear flag 1552 bcf depth_greater_100m ; clear flag
1434 setf last_diluent ; to be displayed after first calculation (range: 0 to 100 [%]) 1553 setf last_diluent ; to be displayed after first calculation (range: 0 to 100 [%])
1435 clrf char_last_pointer 1554 clrf char_last_pointer
1436 bcf dekostop_active 1555 bcf dekostop_active
1437 bcf is_bailout ;=1: CC mode, but bailout active! 1556 bcf is_bailout ;=1: CC mode, but bailout active!
1557 bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
1558
1438 call get_free_EEPROM_location ; get last position in external EEPROM, may be up to 2 secs! 1559 call get_free_EEPROM_location ; get last position in external EEPROM, may be up to 2 secs!
1439 1560
1440 movff last_surfpressure_30min+1,int_I_pres_surface+1 ; HIGH copy surfacepressure to deco routine 1561 movff last_surfpressure_30min+1,int_I_pres_surface+1 ; HIGH copy surfacepressure to deco routine
1441 movff last_surfpressure_30min+0,int_I_pres_surface+0 ; LOW copy surfacepressure to deco routine 1562 movff last_surfpressure_30min+0,int_I_pres_surface+0 ; LOW copy surfacepressure to deco routine
1442 movff temperature+0,mintemp+0 ; Reset Min-Temp registers 1563 movff temperature+0,mintemp+0 ; Reset Min-Temp registers