comparison code_part1/OSTC_code_asm_part1/pled_outputs.asm @ 344:797e2ac42d24 ScreenDump

MERGE with 1.91 main trunk.
author JeanDo
date Sat, 21 May 2011 14:48:07 +0200
parents 06299199dfb9
children 544a96faa9f3 93c0cb14b0d2
comparison
equal deleted inserted replaced
337:6bdf80d7276c 344:797e2ac42d24
103 bra PLED_color_code_gaslist ; Color-code current row in Gaslist (%O2 in "EEDATA") 103 bra PLED_color_code_gaslist ; Color-code current row in Gaslist (%O2 in "EEDATA")
104 104
105 105
106 PLED_color_code_gaslist: ; %O2 in "EEDATA" 106 PLED_color_code_gaslist: ; %O2 in "EEDATA"
107 ; Check very high ppO2 manually 107 ; Check very high ppO2 manually
108 movff amb_pressure+0,xA+0 108 SAFE_2BYTE_COPY amb_pressure,xA
109 movff amb_pressure+1,xA+1
110 movlw d'10' 109 movlw d'10'
111 movwf xB+0 110 movwf xB+0
112 clrf xB+1 111 clrf xB+1
113 call div16x16 ; xC=p_amb/10 112 call div16x16 ; xC=p_amb/10
114 movff xC+0,xA+0 113 movff xC+0,xA+0
141 movwf lo 140 movwf lo
142 movlw d'1' 141 movlw d'1'
143 cpfseq lo ; =1? 142 cpfseq lo ; =1?
144 bra PLED_color_code_ceiling1 ; No, Set to default color 143 bra PLED_color_code_ceiling1 ; No, Set to default color
145 144
146 movff rel_pressure+1,hi 145 SAFE_2BYTE_COPY rel_pressure, lo
147 movff rel_pressure+0,lo
148 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar] 146 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar]
149 movff hi,xA+1 147 movff hi,xA+1
150 movff lo,xA+0 148 movff lo,xA+0
151 movff char_O_first_deco_depth,lo ; Ceiling in m 149 movff char_O_first_deco_depth,lo ; Ceiling in m
152 decf lo,F ; -1 150 decf lo,F ; -1
166 return 164 return
167 165
168 PLED_color_code_depth: 166 PLED_color_code_depth:
169 movff hi,hi_temp 167 movff hi,hi_temp
170 movff lo,lo_temp 168 movff lo,lo_temp
171 movff rel_pressure+1,hi 169 SAFE_2BYTE_COPY rel_pressure, lo
172 movff rel_pressure+0,lo
173 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar] 170 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar]
174 movff lo,sub_a+0 171 movff lo,sub_a+0
175 movff hi,sub_a+1 172 movff hi,sub_a+1
176 GETCUSTOM15 d'43' ; Depth warn [mBar] 173 GETCUSTOM15 d'43' ; Depth warn [mBar]
177 movff lo,sub_b+0 174 movff lo,sub_b+0
837 call word_processor 834 call word_processor
838 835
839 WIN_LEFT .0 836 WIN_LEFT .0
840 WIN_TOP .177 837 WIN_TOP .177
841 STRCPY "amb:" 838 STRCPY "amb:"
842 movff amb_pressure+0,lo 839 SAFE_2BYTE_COPY amb_pressure, lo
843 movff amb_pressure+1,hi
844 output_16 840 output_16
845 call word_processor 841 call word_processor
846 WIN_LEFT .80 842 WIN_LEFT .80
847 WIN_TOP .177 843 WIN_TOP .177
848 STRCPY "temp:" 844 STRCPY "temp:"
849 movff temperature+0,lo 845 SAFE_2BYTE_COPY temperature, lo
850 movff temperature+1,hi
851 output_16 846 output_16
852 call word_processor 847 call word_processor
853 848
854 call get_battery_voltage ; get battery voltage 849 call get_battery_voltage ; get battery voltage
855 WIN_LEFT .0 850 WIN_LEFT .0
946 DISPLAYTEXT .11 ; Exit 941 DISPLAYTEXT .11 ; Exit
947 return 942 return
948 943
949 PLED_temp_surfmode: 944 PLED_temp_surfmode:
950 ostc_debug 'e' 945 ostc_debug 'e'
951 movff temperature+0,last_temperature+0 946 SAFE_2BYTE_COPY temperature, last_temperature
952 movff temperature+1,last_temperature+1
953 WIN_TOP .100 947 WIN_TOP .100
954 WIN_LEFT .1 948 WIN_LEFT .1
955 WIN_FONT FT_SMALL 949 WIN_FONT FT_SMALL
956 WIN_INVERT .0 ; Init new Wordprocessor 950 WIN_INVERT .0 ; Init new Wordprocessor
957 call PLED_standard_color 951 call PLED_standard_color
958 952
959 lfsr FSR2,letter 953 movff last_temperature+1,hi
960 movlw '-' 954 movff last_temperature+0,lo
961 btfsc neg_temp ; Show "-"? 955 lfsr FSR2,letter
962 movwf POSTINC2 ; Yes 956
963 movff temperature+0,lo 957 btfss hi,7 ; Negative temperature ?
964 movff temperature+1,hi 958 bra PLED_temp_surfmode_1 ; No: continue
959
960 PUTC '-' ; Display "-"
961
962 comf hi ; Then, 16bit sign changes.
963 negf lo
964 btfsc STATUS,C
965 incf hi
966
967 PLED_temp_surfmode_1:
965 movlw d'3' 968 movlw d'3'
966 movwf ignore_digits 969 movwf ignore_digits
967 bsf leftbind ; left orientated output 970 bsf leftbind ; left orientated output
968 output_16dp d'2' 971 output_16dp d'2'
969 bcf leftbind 972 bcf leftbind
972 975
973 PLED_temp_divemode: 976 PLED_temp_divemode:
974 ostc_debug 'u' ; Sends debug-information to screen if debugmode active 977 ostc_debug 'u' ; Sends debug-information to screen if debugmode active
975 978
976 ; temperature 979 ; temperature
977 movff temperature+0,last_temperature+0 980 SAFE_2BYTE_COPY temperature, last_temperature
978 movff temperature+1,last_temperature+1
979 981
980 WIN_TOP .216 982 WIN_TOP .216
981 WIN_LEFT .50 983 WIN_LEFT .50
982 WIN_FONT FT_SMALL 984 WIN_FONT FT_SMALL
983 WIN_INVERT .0 ; Init new Wordprocessor 985 WIN_INVERT .0 ; Init new Wordprocessor
984 call PLED_standard_color 986 call PLED_standard_color
985 987
986 lfsr FSR2,letter 988 movff last_temperature+1,hi
987 movlw '-' 989 movff last_temperature+0,lo
988 btfsc neg_temp ; Show "-"? 990
989 movwf POSTINC2 ; Yes 991 lfsr FSR2,letter
990 movff temperature+0,lo 992
991 movff temperature+1,hi 993 btfss hi,7 ; Negative temperature ?
994 bra PLED_temp_divemode_1 ; No: continue
995
996 PUTC '-' ; Display "-"
997
998 comf hi ; Then, 16bit sign changes.
999 negf lo
1000 btfsc STATUS,C
1001 incf hi
1002
1003 PLED_temp_divemode_1:
992 movlw d'3' 1004 movlw d'3'
993 movwf ignore_digits 1005 movwf ignore_digits
994 bsf leftbind ; left orientated output 1006 bsf leftbind ; left orientated output
995 output_16dp d'2' 1007 output_16dp d'2'
996 bcf leftbind 1008 bcf leftbind
1544 bra PLED_confirmbox2 ; Return to Profile Menu, also updates cursor 1556 bra PLED_confirmbox2 ; Return to Profile Menu, also updates cursor
1545 1557
1546 1558
1547 PLED_depth: 1559 PLED_depth:
1548 ostc_debug 'r' ; Sends debug-information to screen if debugmode active 1560 ostc_debug 'r' ; Sends debug-information to screen if debugmode active
1549 movff rel_pressure+1,hi 1561 SAFE_2BYTE_COPY rel_pressure, lo
1550 movff rel_pressure+0,lo
1551 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar] 1562 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar]
1552 1563
1553 movlw .039 1564 movlw .039
1554 cpfslt hi 1565 cpfslt hi
1555 bra depth_greater_99_84mtr 1566 bra depth_greater_99_84mtr
1605 WIN_FONT FT_MEDIUM 1616 WIN_FONT FT_MEDIUM
1606 WIN_TOP .50 1617 WIN_TOP .50
1607 WIN_LEFT .40 1618 WIN_LEFT .40
1608 PLED_color_code warn_depth ; Color-code the output 1619 PLED_color_code warn_depth ; Color-code the output
1609 1620
1610 movff rel_pressure+1,hi 1621 SAFE_2BYTE_COPY rel_pressure, lo
1611 movff rel_pressure+0,lo
1612 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar] 1622 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar]
1613 1623
1614 STRCPY "." 1624 STRCPY "."
1615 1625
1616 movlw HIGH d'9' 1626 movlw HIGH d'9'
1757 call PLED_standard_color ; No 1767 call PLED_standard_color ; No
1758 btfsc high_altitude_mode ; In high altitude mode? 1768 btfsc high_altitude_mode ; In high altitude mode?
1759 call PLED_warnings_color ; Yes, display ambient pressure in red 1769 call PLED_warnings_color ; Yes, display ambient pressure in red
1760 1770
1761 lfsr FSR2,letter 1771 lfsr FSR2,letter
1762 movff amb_pressure+0,lo 1772 SAFE_2BYTE_COPY amb_pressure, lo
1763 movff amb_pressure+1,hi
1764 bsf leftbind 1773 bsf leftbind
1765 output_16 1774 output_16
1766 bcf leftbind 1775 bcf leftbind
1767 STRCAT_PRINT "mbar " 1776 STRCAT_PRINT "mbar "
1768 call PLED_standard_color ; Reset color 1777 call PLED_standard_color ; Reset color
1992 movff max_pressure+1,hi 2001 movff max_pressure+1,hi
1993 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar] 2002 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar]
1994 2003
1995 movlw .039 2004 movlw .039
1996 cpfslt hi 2005 cpfslt hi
1997 bra maxdepth_greater_99_84mtr 2006 bra maxdepth_greater_99_84mtr
1998 2007
1999 ; Display normal "xx.y" 2008 ; Display normal "xx.y"
2000 lfsr FSR2,letter 2009 lfsr FSR2,letter
2001 call PLED_standard_color 2010 call PLED_standard_color
2002 WIN_TOP .184 2011 WIN_TOP .184
2787 movff WREG,win_leftx2 2796 movff WREG,win_leftx2
2788 call PLED_box 2797 call PLED_box
2789 PLED_no_graph_grid: 2798 PLED_no_graph_grid:
2790 2799
2791 ;---- Draw N2 Tissues ---------------------------------------------------- 2800 ;---- Draw N2 Tissues ----------------------------------------------------
2792 lfsr FSR2, char_O_tissue_saturation+.000 ; N2 2801 lfsr FSR2, char_O_tissue_N2_saturation
2793 movlw d'16' 2802 movlw d'16'
2794 movwf wait_temp ; 16 tissues 2803 movwf wait_temp ; 16 tissues
2795 clrf waitms_temp ; Row offset 2804 clrf waitms_temp ; Row offset
2796 2805
2797 movlw .1 2806 movlw .1
2833 2842
2834 decfsz wait_temp,F 2843 decfsz wait_temp,F
2835 bra PLED_tissue_saturation_graph3 2844 bra PLED_tissue_saturation_graph3
2836 2845
2837 ;---- Draw He Tissues ---------------------------------------------------- 2846 ;---- Draw He Tissues ----------------------------------------------------
2838 lfsr FSR2, char_O_tissue_saturation+.016 ; He 2847 lfsr FSR2, char_O_tissue_He_saturation
2839 movlw d'16' 2848 movlw d'16'
2840 movwf wait_temp ; 16 tissues 2849 movwf wait_temp ; 16 tissues
2841 clrf waitms_temp ; Row offset 2850 clrf waitms_temp ; Row offset
2842 2851
2843 PLED_tissue_saturation_graph2: 2852 PLED_tissue_saturation_graph2:
2893 btfsc divemode 2902 btfsc divemode
2894 return 2903 return
2895 2904
2896 movff char_O_gtissue_no,wait_temp ; used as temp 2905 movff char_O_gtissue_no,wait_temp ; used as temp
2897 2906
2898 lfsr FSR1,char_O_tissue_saturation+0 2907 lfsr FSR1,char_O_tissue_N2_saturation
2899 incf wait_temp,F ; make 1-16 of 0-15 2908 movf wait_temp,W ; W <- 0-15
2900 2909 movff PLUSW1,lo ; lo <- FSR1[W]
2901 PLED_tissue_saturation_graph4: ; point to leading tissue...
2902 movff POSTINC1,lo ; copy/overwrite to lo register
2903 decfsz wait_temp,F ; count until zero
2904 bra PLED_tissue_saturation_graph4 ;loop
2905 2910
2906 WIN_TOP .62 2911 WIN_TOP .62
2907 WIN_FONT FT_SMALL 2912 WIN_FONT FT_SMALL
2908 lfsr FSR2,letter 2913 lfsr FSR2,letter
2909 bsf leftbind 2914 bsf leftbind
2982 call word_processor 2987 call word_processor
2983 return 2988 return
2984 2989
2985 PLED_const_ppO2_value2: ; Display SetPoint 2990 PLED_const_ppO2_value2: ; Display SetPoint
2986 ;Show fixed SP value 2991 ;Show fixed SP value
2987 movff amb_pressure+0,xA+0 2992 SAFE_2BYTE_COPY amb_pressure, xA
2988 movff amb_pressure+1,xA+1 2993
2989 movlw d'10' 2994 movlw d'10'
2990 movwf xB+0 2995 movwf xB+0
2991 clrf xB+1 2996 clrf xB+1
2992 ;xA/xB=xC with xA as remainder 2997 ;xA/xB=xC with xA as remainder
2993 call div16x16 ; xC+0=p_amb/10 2998 call div16x16 ; xC+0=p_amb/10
3003 movff xC+0,char_I_const_ppO2 ; No, Overwrite with actual value 3008 movff xC+0,char_I_const_ppO2 ; No, Overwrite with actual value
3004 bra PLED_const_ppO2_value1a 3009 bra PLED_const_ppO2_value1a
3005 3010
3006 PLED_const_ppO2_value1: 3011 PLED_const_ppO2_value1:
3007 ; char_I_const_ppO2 < ppO2[Diluent] -> Not physically possible! -> Display actual value! 3012 ; char_I_const_ppO2 < ppO2[Diluent] -> Not physically possible! -> Display actual value!
3008 movff amb_pressure+0,xA+0 3013 SAFE_2BYTE_COPY amb_pressure, xA
3009 movff amb_pressure+1,xA+1
3010 movlw d'10' 3014 movlw d'10'
3011 movwf xB+0 3015 movwf xB+0
3012 clrf xB+1 3016 clrf xB+1
3013 call div16x16 ; xC=p_amb/10 3017 call div16x16 ; xC=p_amb/10
3014 movff xC+0,xA+0 3018 movff xC+0,xA+0
3228 WIN_FONT FT_SMALL 3232 WIN_FONT FT_SMALL
3229 call PLED_standard_color 3233 call PLED_standard_color
3230 3234
3231 STRCAT_PRINT ") " 3235 STRCAT_PRINT ") "
3232 3236
3233 lfsr FSR1,char_O_tissue_saturation+0 3237 lfsr FSR1,char_O_tissue_N2_saturation
3234 incf wait_temp,F ; make 1-16 of 0-15 3238 movf wait_temp,W ; W <- 0-15
3235 PLED_show_leading_tissue3: ; point to leading tissue... 3239 movff PLUSW1,lo ; lo <- FSR1[W]
3236 movff POSTINC1,lo ; copy/overwrite to lo register
3237 decfsz wait_temp,F ; count until zero
3238 bra PLED_show_leading_tissue3 ;loop
3239 3240
3240 WIN_LEFT .95 3241 WIN_LEFT .95
3241 WIN_TOP .216 3242 WIN_TOP .216
3242 WIN_FONT FT_SMALL 3243 WIN_FONT FT_SMALL
3243 3244