comparison code_part1/OSTC_code_asm_part1/menu_gassetup.asm @ 299:eac799f69360

some cleanup, french and german texts updated
author heinrichsweikamp
date Sat, 30 Apr 2011 08:30:56 +0200
parents ceedf078b2d8
children 9c39cedb662b
comparison
equal deleted inserted replaced
298:880db4afeecc 299:eac799f69360
314 ; Show MOD in m 314 ; Show MOD in m
315 WIN_LEFT .90 315 WIN_LEFT .90
316 lfsr FSR2, letter 316 lfsr FSR2, letter
317 OUTPUTTEXTH .297 ; MOD: 317 OUTPUTTEXTH .297 ; MOD:
318 318
319 GETCUSTOM8 .18 ; ppO2 warnvalue in WREG 319 rcall gassetup_get_mod ; compute MOD based on CF18 into lo:hi
320 mullw d'10' 320
321 movff PRODL,xA+0
322 movff PRODH,xA+1 ; ppO2 in [0.01Bar] * 10
323
324 movf divemins+0,W
325 addlw 0x06
326 movwf EEADR
327 call read_eeprom ; O2 value
328 movff EEDATA,xB+0
329 clrf xB+1
330 call div16x16 ; xA/xB=xC with xA as remainder
331 movlw d'10'
332 subwf xC+0,F ; Subtract 10m...
333 movff xC+0,lo
334 movlw d'0'
335 subwfb xC+1,F
336 movff xC+1,hi
337 output_16 321 output_16
338 STRCAT_PRINT "m " 322 STRCAT_PRINT "m "
339 323
340 WIN_LEFT .20 324 WIN_LEFT .20
341 WIN_TOP .95 325 WIN_TOP .95
644 movlw d'1' 628 movlw d'1'
645 movwf menupos 629 movwf menupos
646 bcf first_FA ; Here: =1: -, =0: + 630 bcf first_FA ; Here: =1: -, =0: +
647 bcf second_FA ; Here: =1: Is first gas 631 bcf second_FA ; Here: =1: Is first gas
648 DISPLAYTEXT .107 ; Depth +/- 632 DISPLAYTEXT .107 ; Depth +/-
649 DISPLAYTEXT .108 ; Change:
650 DISPLAYTEXT .109 ; Default:
651 DISPLAYTEXT .11 ; Exit 633 DISPLAYTEXT .11 ; Exit
652 634
653 next_gas_page1: 635 next_gas_page1:
654 clrf timeout_counter2 636 clrf timeout_counter2
655 bcf menubit2 637 bcf menubit2
688 call word_processor 670 call word_processor
689 671
690 672
691 rcall gassetup_title_bar2 ; Displays the title bar with the current Gas info 673 rcall gassetup_title_bar2 ; Displays the title bar with the current Gas info
692 WIN_TOP .125 674 WIN_TOP .125
693 WIN_LEFT .70 675 WIN_LEFT .20
694 lfsr FSR2,letter 676 lfsr FSR2,letter
677
678 OUTPUTTEXT .108 ; Change:
679
695 ; lo still holds change depth 680 ; lo still holds change depth
696 bsf leftbind 681 bsf leftbind
697 output_8 682 output_8
698 STRCAT_PRINT "m " 683 STRCAT_PRINT "m "
699 684
685 ; Show ppO2 after change depth
700 WIN_TOP .125 686 WIN_TOP .125
701 WIN_LEFT .100 687 WIN_LEFT .110
702 lfsr FSR2,letter 688 lfsr FSR2,letter
703
704 rcall gassetup_show_ppO2 ; Display the ppO2 of the change depth with the current gas 689 rcall gassetup_show_ppO2 ; Display the ppO2 of the change depth with the current gas
705 690
706 movff xC+0,sub_a+0 691 movff xC+0,sub_a+0
707 movff xC+1,sub_a+1 692 movff xC+1,sub_a+1
708 GETCUSTOM8 d'46' ; color-code ppO2 warning [cBar] 693 GETCUSTOM8 d'46' ; color-code ppO2 warning [cBar]
709 mullw d'1' ; ppo2_warning_high*1 694 movwf sub_b+0
710 movff PRODL,sub_b+0 695 clrf sub_b+1
711 movff PRODH,sub_b+1
712 call sub16 ; sub_c = sub_a - sub_b 696 call sub16 ; sub_c = sub_a - sub_b
713 btfss neg_flag 697 btfss neg_flag
714 bra gassetup_color_code_ppo2_1; too high -> Warning Color! 698 bra gassetup_color_code_ppo2_1; too high -> Warning Color!
715 call PLED_standard_color 699 call PLED_standard_color
716 bra gassetup_color_code_ppo2_2 700 bra gassetup_color_code_ppo2_2
729 movwf POSTINC2 713 movwf POSTINC2
730 call word_processor 714 call word_processor
731 715
732 ; Show MOD as "default" 716 ; Show MOD as "default"
733 WIN_TOP .155 717 WIN_TOP .155
734 WIN_LEFT .78 718 WIN_LEFT .20
735 lfsr FSR2, letter 719 lfsr FSR2, letter
736 GETCUSTOM8 .18 ; ppO2 warnvalue in WREG 720
737 mullw d'10' 721 OUTPUTTEXT .109 ; Default:
738 movff PRODL,xA+0 722
739 movff PRODH,xA+1 ; ppO2 in [0.01Bar] * 10 723 rcall gassetup_get_mod ; compute MOD based on CF18 into lo:hi
740
741 movf divemins+0,W
742 addlw 0x06
743 movwf EEADR
744 call read_eeprom ; O2 value
745 movff EEDATA,xB+0
746 clrf xB+1
747 call div16x16 ; xA/xB=xC with xA as remainder
748 movlw d'10'
749 subwf xC+0,F ; Subtract 10m...
750 movff xC+0,lo
751 movlw d'0'
752 subwfb xC+1,F
753 movff xC+1,hi
754 724
755 btfsc second_FA ; Is first gas? 725 btfsc second_FA ; Is first gas?
756 clrf lo ; Yes, display 0m 726 clrf lo ; Yes, display 0m
757 btfsc second_FA ; Is first gas? 727 btfsc second_FA ; Is first gas?
758 clrf hi ; Yes, display 0m 728 clrf hi ; Yes, display 0m
903 bra change_gas_depth_minus ; yes, minus! 873 bra change_gas_depth_minus ; yes, minus!
904 ; +1m 874 ; +1m
905 875
906 incf lo,F ; increase depth 876 incf lo,F ; increase depth
907 movlw d'100' ; Change depth limit + 1 877 movlw d'100' ; Change depth limit + 1
908 cpfseq lo 878 cpfslt lo ; >99?
909 bra change_gas_depth_plus2 879 clrf lo ; Yes, set to zero m
910 movlw d'99' ; Change depth limit 880
911 movwf lo
912 change_gas_depth_plus2: 881 change_gas_depth_plus2:
913 movff lo,EEDATA ; write result 882 movff lo,EEDATA ; write result
914 call write_eeprom ; save result in EEPROM 883 call write_eeprom ; save result in EEPROM
915
916 movlw d'4' 884 movlw d'4'
917 movwf menupos 885 movwf menupos
918 bra next_gas_page1 886 bra next_gas_page1
919 887
920 change_gas_depth_minus: 888 change_gas_depth_minus:
889 ; -1m
921 decf lo,F ; decrease depth 890 decf lo,F ; decrease depth
922 btfss lo,7 ; 255? 891 btfsc lo,7 ; 255?
923 bra change_gas_depth_plus2 ; no, exit 892 clrf lo ; Yes, stay at zero m
924 clrf lo
925 bra change_gas_depth_plus2 ; exit 893 bra change_gas_depth_plus2 ; exit
926 894
927 change_gas_depth_plus_minus: 895 change_gas_depth_plus_minus:
928 btg first_FA 896 btg first_FA
929 movlw d'3' 897 movlw d'3'
930 movwf menupos 898 movwf menupos
931 bra next_gas_page1 899 bra next_gas_page1
932 900
933 change_gas_depth_default: 901 change_gas_depth_default:
934 GETCUSTOM8 .18 ; ppO2 warnvalue in WREG 902 rcall gassetup_get_mod ; compute MOD based on CF18 into lo:hi
935 mullw d'10' 903
936 movff PRODL,xA+0 904 movlw d'99'
937 movff PRODH,xA+1 ; ppO2 in [0.01Bar] * 10 905 cpfslt lo
938 906 movwf lo ; limit to 99m
939 movf divemins+0,W
940 addlw 0x06
941 movwf EEADR
942 call read_eeprom ; O2 value
943 movff EEDATA,xB+0
944 clrf xB+1
945 call div16x16 ; xA/xB=xC with xA as remainder
946 movlw d'10'
947 subwf xC+0,F ; Subtract 10m...
948 movff xC+0,lo
949 movlw d'0'
950 subwfb xC+1,F
951 movff xC+1,hi
952 907
953 movf decodata+0,W ; read current value 908 movf decodata+0,W ; read current value
954 addlw d'28' ; offset in memory 909 addlw d'28' ; offset in memory
955 movwf EEADR 910 movwf EEADR
956 call read_eeprom ; Low-value 911 call read_eeprom ; Low-value
1098 movff xC+0,lo ; ((Depth+10m)*O2)/10 = [0.01Bar] ppO2 1053 movff xC+0,lo ; ((Depth+10m)*O2)/10 = [0.01Bar] ppO2
1099 movff xC+1,hi 1054 movff xC+1,hi
1100 output_16dp d'3' 1055 output_16dp d'3'
1101 OUTPUTTEXT d'150' ; bar: 1056 OUTPUTTEXT d'150' ; bar:
1102 return 1057 return
1058
1059 gassetup_get_mod:
1060 GETCUSTOM8 .18 ; ppO2 warnvalue in WREG
1061 mullw d'10'
1062 movff PRODL,xA+0
1063 movff PRODH,xA+1 ; ppO2 in [0.01Bar] * 10
1064 movf divemins+0,W
1065 addlw 0x06
1066 movwf EEADR
1067 call read_eeprom ; O2 value
1068 movff EEDATA,xB+0
1069 clrf xB+1
1070 call div16x16 ; xA/xB=xC with xA as remainder
1071 movlw d'10'
1072 subwf xC+0,F ; Subtract 10m...
1073 movff xC+0,lo
1074 movlw d'0'
1075 subwfb xC+1,F
1076 movff xC+1,hi
1077 return
1078
1079
1103 1080
1104 ;============================================================================= 1081 ;=============================================================================
1105 ; Make sure first gas is marked active. 1082 ; Make sure first gas is marked active.
1106 ; Note: - Gas are not soted anymore. 1083 ; Note: - Gas are not soted anymore.
1107 ; - Gas with a depth>0 should not be forced active, or it is impossible 1084 ; - Gas with a depth>0 should not be forced active, or it is impossible