comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 229:85ea09d3b9d8

Nofly should not be reset after dive simulation (bug BB18).
author JeanDo
date Tue, 15 Mar 2011 18:13:51 +0100
parents 6d4e29d80ff3
children 2cbaa01dac26
comparison
equal deleted inserted replaced
228:6d4e29d80ff3 229:85ea09d3b9d8
982 movff int_O_desaturation_time+1,xA+1 982 movff int_O_desaturation_time+1,xA+1
983 tstfsz xA+0 ; Desat=0? 983 tstfsz xA+0 ; Desat=0?
984 bra calculate_noflytime2 984 bra calculate_noflytime2
985 tstfsz xA+1 ; Desat=0? 985 tstfsz xA+1 ; Desat=0?
986 bra calculate_noflytime2 986 bra calculate_noflytime2
987
988 calculate_noflytime_3:
987 ; Desaturation time = zero 989 ; Desaturation time = zero
988 movlw d'1' 990 clrf nofly_time+0 ; Clear nofly time
989 movwf nofly_time+0 ; Clear nofly time
990 clrf nofly_time+1 ; Clear nofly time 991 clrf nofly_time+1 ; Clear nofly time
991 bcf nofly_active ; Clear flag 992 bcf nofly_active ; Clear flag
992 return 993 return
993 994
994 calculate_noflytime2: 995 calculate_noflytime2:
1004 movff int_I_temp+1,xA+1 1005 movff int_I_temp+1,xA+1
1005 tstfsz xA+0 ; Desat=0? 1006 tstfsz xA+0 ; Desat=0?
1006 bra calculate_noflytime_2_final 1007 bra calculate_noflytime_2_final
1007 tstfsz xA+1 ; Desat=0? 1008 tstfsz xA+1 ; Desat=0?
1008 bra calculate_noflytime_2_final 1009 bra calculate_noflytime_2_final
1009 ; noflytime = zero 1010 bra calculate_noflytime_3
1010 movlw d'1' 1011
1011 movwf nofly_time+0 ; Clear nofly time
1012 clrf nofly_time+1 ; Clear nofly time
1013 bcf nofly_active ; Clear flag
1014 return
1015 calculate_noflytime_2_final: 1012 calculate_noflytime_2_final:
1016 movff xA+0,nofly_time+0 1013 movff xA+0,nofly_time+0
1017 movff xA+1,nofly_time+1 1014 movff xA+1,nofly_time+1
1018 bsf nofly_active ; Set flag 1015 bsf nofly_active ; Set flag
1019 return 1016 return
1033 ; calculate desaturation time 1030 ; calculate desaturation time
1034 movff last_surfpressure_30min+0,int_I_pres_respiration+0 ; copy surface air pressure to deco routine 1031 movff last_surfpressure_30min+0,int_I_pres_respiration+0 ; copy surface air pressure to deco routine
1035 movff last_surfpressure_30min+1,int_I_pres_respiration+1 ; 30min old values 1032 movff last_surfpressure_30min+1,int_I_pres_respiration+1 ; 30min old values
1036 1033
1037 GETCUSTOM8 d'12' ; Desaturation multiplier % 1034 GETCUSTOM8 d'12' ; Desaturation multiplier %
1038 movwf wait_temp 1035 movff WREG,char_I_desaturation_multiplier
1039 movff wait_temp,char_I_desaturation_multiplier
1040 1036
1041 ostc_debug 'G' ; Sends debug-information to screen if debugmode active 1037 ostc_debug 'G' ; Sends debug-information to screen if debugmode active
1042 call deco_calc_desaturation_time ; calculate desaturation time 1038 call deco_calc_desaturation_time ; calculate desaturation time
1043 movlb b'00000001' ; select ram bank 1 1039 movlb b'00000001' ; select ram bank 1
1044 rcall calculate_noflytime ; Calc NoFly time 1040 rcall calculate_noflytime ; Calc NoFly time
1045 ostc_debug 'H' ; Sends debug-information to screen if debugmode active 1041 ostc_debug 'H' ; Sends debug-information to screen if debugmode active
1046 ; store header and ... 1042 ; store header and ...
1047 movlw 0xFD ; .... End-of-Profile Bytes 1043 movlw 0xFD ; .... End-of-Profile Bytes
1048 call write_external_eeprom 1044 call write_external_eeprom
1049 movlw 0xFD 1045 movlw 0xFD
1050 call write_external_eeprom 1046 call write_external_eeprom
1051 movlw 0xFE ; This positon will be overwritten for the next profile 1047 movlw 0xFE ; This positon will be overwritten for the next profile
1052 call write_external_eeprom ; and is required to find the newest dive after a firmware reset 1048 call write_external_eeprom ; and is required to find the newest dive after a firmware reset
1053 1049
1054 movff eeprom_header_address+0, eeprom_address+0 ; set header adress 1050 movff eeprom_header_address+0, eeprom_address+0 ; set header adress
1055 movff eeprom_header_address+1, eeprom_address+1 ; write header 1051 movff eeprom_header_address+1, eeprom_address+1 ; write header
1056 1052
1057 movlw 0xFA ; Header start 1053 movlw 0xFA ; Header start
1058 call write_external_eeprom 1054 call write_external_eeprom
1059 movlw 0xFA 1055 movlw 0xFA
1060 call write_external_eeprom 1056 call write_external_eeprom
1061 movlw logbook_profile_version ; Defined in definitions_vxyy.asm 1057 movlw logbook_profile_version ; Defined in definitions_vxyy.asm
1062 call write_external_eeprom 1058 call write_external_eeprom
1063 movf month,W ; Date 1059 movf month,W ; Date
1064 call write_external_eeprom 1060 call write_external_eeprom
1065 movf day,W 1061 movf day,W
1066 call write_external_eeprom 1062 call write_external_eeprom
1067 movf year,W 1063 movf year,W
1068 call write_external_eeprom 1064 call write_external_eeprom