Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/pled_outputs.asm @ 516:b498245da3f1
imperial units patch from Vlad
author | heinrichsweikamp |
---|---|
date | Mon, 05 Dec 2011 20:40:10 +0100 |
parents | 2ac77db9c150 |
children | a73a452ca155 |
comparison
equal
deleted
inserted
replaced
515:cc09222a204f | 516:b498245da3f1 |
---|---|
461 btfsc menubit ; Divemode menu active? | 461 btfsc menubit ; Divemode menu active? |
462 bra PLED_display_deko1 ; Yes, do not display deco, only GF (if required) | 462 bra PLED_display_deko1 ; Yes, do not display deco, only GF (if required) |
463 | 463 |
464 ostc_debug 'y' ; Sends debug-information to screen if debugmode active | 464 ostc_debug 'y' ; Sends debug-information to screen if debugmode active |
465 WIN_TOP .80 | 465 WIN_TOP .80 |
466 WIN_LEFT .94 | |
467 WIN_FONT FT_MEDIUM | 466 WIN_FONT FT_MEDIUM |
468 WIN_INVERT .0 ; Init new Wordprocessor | 467 WIN_INVERT .0 ; Init new Wordprocessor |
469 PLED_color_code warn_ceiling ; Color-code Output | 468 PLED_color_code warn_ceiling ; Color-code Output |
470 lfsr FSR2,letter | 469 lfsr FSR2,letter |
471 movff char_O_first_deco_depth,lo ; Ceiling in m | 470 movff char_O_first_deco_depth,lo ; Ceiling in m |
471 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units | |
472 btfss WREG,0 ; Enabled ? | |
473 bra PLED_display_deko3 ; NO | |
474 WIN_LEFT .80 | |
475 clrf hi | |
476 call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63 | |
477 output_16_3 | |
478 call word_processor | |
479 | |
480 WIN_TOP .91 | |
481 WIN_LEFT .115 | |
482 WIN_FONT FT_SMALL | |
483 lfsr FSR2,letter | |
484 STRCPY_PRINT TXT_FOOT2 ; Print 'ft' in small font | |
485 | |
486 WIN_TOP .80 | |
487 WIN_LEFT .130 | |
488 WIN_FONT FT_MEDIUM | |
489 lfsr FSR2,letter | |
490 bra PLED_display_deko4 | |
491 | |
492 PLED_display_deko3: | |
493 WIN_LEFT .94 | |
472 output_99 | 494 output_99 |
473 PUTC TXT_METER_C | 495 PUTC TXT_METER_C |
474 movff char_O_first_deco_time,lo ; length of first stop in m | 496 |
497 PLED_display_deko4: | |
498 movff char_O_first_deco_time,lo ; length of first stop in min | |
475 output_99 | 499 output_99 |
476 STRCAT_PRINT "'" | 500 STRCAT_PRINT "'" |
477 WIN_FONT FT_SMALL | 501 WIN_FONT FT_SMALL |
478 | 502 |
479 ;PLED_display_deko1: | 503 ;PLED_display_deko1: |
480 ostc_debug 'x' ; Sends debug-information to screen if debugmode active | 504 ostc_debug 'x' ; Sends debug-information to screen if debugmode active |
481 | 505 |
482 WIN_TOP .136 | 506 WIN_TOP .136 |
483 WIN_LEFT .140 - 6*7 - 4 ; let space for sign + 5 digits + ' | 507 WIN_LEFT .140 - 6*7 - 4 ; let space for sign + 5 digits + ' |
559 lfsr FSR2,letter | 583 lfsr FSR2,letter |
560 OUTPUTTEXTH .278 ; Max. Depth: | 584 OUTPUTTEXTH .278 ; Max. Depth: |
561 | 585 |
562 movff sim_btm_depth,lo | 586 movff sim_btm_depth,lo |
563 bsf leftbind | 587 bsf leftbind |
588 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units | |
589 btfss WREG,0 ; Enabled ? | |
590 bra PLED_simulator_data_3 ; NO | |
591 clrf hi | |
592 call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63 | |
593 output_16_3 | |
594 STRCAT_PRINT TXT_FOOT4 | |
595 bcf leftbind | |
596 return | |
597 | |
598 PLED_simulator_data_3: | |
564 output_8 | 599 output_8 |
565 STRCAT_PRINT TXT_METER3 | 600 STRCAT_PRINT TXT_METER3 |
566 | 601 |
567 bcf leftbind | 602 bcf leftbind |
568 return | 603 return |
697 movlw '-' | 732 movlw '-' |
698 btfsc neg_flag | 733 btfsc neg_flag |
699 movlw '+' | 734 movlw '+' |
700 movwf POSTINC2 | 735 movwf POSTINC2 |
701 movff divA+0,lo | 736 movff divA+0,lo |
737 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units | |
738 btfss WREG,0 ; Enabled ? | |
739 bra PLED_display_velocity2 ; NO | |
740 clrf hi | |
741 call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63 | |
742 output_16_3 | |
743 OUTPUTTEXTH d'318' ; ft/min | |
744 bra PLED_display_velocity3 | |
745 | |
746 PLED_display_velocity2: | |
702 output_99 | 747 output_99 |
703 OUTPUTTEXT d'83' ; m/min | 748 OUTPUTTEXT d'83' ; m/min |
704 call word_processor | 749 |
750 PLED_display_velocity3: | |
751 call word_processor | |
705 call PLED_standard_color | 752 call PLED_standard_color |
706 bsf pled_velocity_display | 753 bsf pled_velocity_display |
707 return | 754 return |
708 | 755 |
709 PLED_display_velocity_clear: | 756 PLED_display_velocity_clear: |
713 cpfseq lo ; =1? | 760 cpfseq lo ; =1? |
714 bra PLED_display_velocity_clear1 ; No, clear text display | 761 bra PLED_display_velocity_clear1 ; No, clear text display |
715 WIN_BOX_BLACK .20, .90, .65, .75 ; Clear graphic display | 762 WIN_BOX_BLACK .20, .90, .65, .75 ; Clear graphic display |
716 | 763 |
717 PLED_display_velocity_clear1: | 764 PLED_display_velocity_clear1: |
718 movlw d'8' | 765 movlw d'10' |
719 movwf temp1 | 766 movwf temp1 |
720 WIN_TOP .90 | 767 WIN_TOP .90 |
721 WIN_LEFT .0 | 768 WIN_LEFT .0 |
722 bcf pled_velocity_display | 769 bcf pled_velocity_display |
723 bra PLED_display_clear_common_y1 | 770 bra PLED_display_clear_common_y1 |
832 WIN_TOP .75 | 879 WIN_TOP .75 |
833 STRCPY TXT_LAST5 | 880 STRCPY TXT_LAST5 |
834 GETCUSTOM8 d'29' | 881 GETCUSTOM8 d'29' |
835 movwf lo | 882 movwf lo |
836 bsf leftbind | 883 bsf leftbind |
884 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units | |
885 btfss WREG,0 ; Enabled ? | |
886 bra PLED_show_cf11_cf12_cf29_3 ; NO | |
887 clrf hi | |
888 call convert_meters_to_feet2 | |
889 output_16 | |
890 STRCAT_PRINT TXT_FOOT2 | |
891 bcf leftbind | |
892 return | |
893 | |
894 PLED_show_cf11_cf12_cf29_3: | |
837 output_8 | 895 output_8 |
838 STRCAT_PRINT TXT_METER1 | 896 STRCAT_PRINT TXT_METER1 |
839 | 897 |
840 bcf leftbind | 898 bcf leftbind |
841 return | 899 return |
995 call word_processor | 1053 call word_processor |
996 WIN_LEFT .80 | 1054 WIN_LEFT .80 |
997 WIN_TOP .177 | 1055 WIN_TOP .177 |
998 STRCPY "temp:" | 1056 STRCPY "temp:" |
999 SAFE_2BYTE_COPY temperature, lo | 1057 SAFE_2BYTE_COPY temperature, lo |
1058 call convert_celsius_to_fahrenheit | |
1000 call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required | 1059 call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
1001 output_16 | 1060 output_16 |
1002 call word_processor | 1061 call word_processor |
1003 | 1062 |
1004 call get_battery_voltage ; get battery voltage | 1063 call get_battery_voltage ; get battery voltage |
1106 call PLED_standard_color | 1165 call PLED_standard_color |
1107 | 1166 |
1108 movff last_temperature+1,hi | 1167 movff last_temperature+1,hi |
1109 movff last_temperature+0,lo | 1168 movff last_temperature+0,lo |
1110 lfsr FSR2,letter | 1169 lfsr FSR2,letter |
1170 call convert_celsius_to_fahrenheit | |
1111 call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required | 1171 call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
1112 movlw d'3' | 1172 movlw d'3' |
1113 movwf ignore_digits | 1173 movwf ignore_digits |
1114 bsf leftbind ; left orientated output | 1174 bsf leftbind ; left orientated output |
1115 output_16dp d'2' | 1175 output_16dp d'2' |
1116 bcf leftbind | 1176 bcf leftbind |
1177 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units | |
1178 btfss WREG,0 ; Enabled ? | |
1179 bra PLED_show_C ; NO | |
1180 STRCAT_PRINT "°F " | |
1181 return | |
1182 PLED_show_C: | |
1117 STRCAT_PRINT "°C " | 1183 STRCAT_PRINT "°C " |
1118 return | 1184 return |
1119 | 1185 |
1120 PLED_temp_divemode: | 1186 PLED_temp_divemode: |
1121 ostc_debug 'u' ; Sends debug-information to screen if debugmode active | 1187 ostc_debug 'u' ; Sends debug-information to screen if debugmode active |
1131 | 1197 |
1132 movff last_temperature+1,hi | 1198 movff last_temperature+1,hi |
1133 movff last_temperature+0,lo | 1199 movff last_temperature+0,lo |
1134 | 1200 |
1135 lfsr FSR2,letter | 1201 lfsr FSR2,letter |
1202 call convert_celsius_to_fahrenheit | |
1136 call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required | 1203 call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
1137 movlw d'3' | 1204 movlw d'3' |
1138 movwf ignore_digits | 1205 movwf ignore_digits |
1139 bsf leftbind ; left orientated output | 1206 bsf leftbind ; left orientated output |
1140 output_16dp d'2' | 1207 output_16dp d'2' |
1694 | 1761 |
1695 | 1762 |
1696 PLED_depth: | 1763 PLED_depth: |
1697 ostc_debug 'r' ; Sends debug-information to screen if debugmode active | 1764 ostc_debug 'r' ; Sends debug-information to screen if debugmode active |
1698 SAFE_2BYTE_COPY rel_pressure, lo | 1765 SAFE_2BYTE_COPY rel_pressure, lo |
1699 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 1766 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] |
1767 call convert_meters_to_feet ; converts meters to feet | |
1700 | 1768 |
1701 movlw .039 | 1769 movlw .039 |
1702 cpfslt hi | 1770 cpfslt hi |
1703 bra depth_greater_99_84mtr | 1771 bra pled_depth_full_units_only |
1704 | 1772 |
1705 btfsc depth_greater_100m ; Was depth>100m during last call | 1773 btfsc depth_greater_100 ; Was depth>100 during last call |
1706 call PLED_clear_depth ; Yes, clear depth area | 1774 call PLED_clear_depth ; Yes, clear depth area |
1707 bcf depth_greater_100m ; Do this once only... | 1775 bcf depth_greater_100 ; Do this once only... |
1708 | 1776 |
1709 lfsr FSR2,letter | 1777 lfsr FSR2,letter |
1710 | 1778 |
1711 movlw HIGH d'1000' | 1779 movlw HIGH d'1000' |
1712 movwf sub_a+1 | 1780 movwf sub_a+1 |
1716 movff lo,sub_b+0 | 1784 movff lo,sub_b+0 |
1717 incf sub_b+0,F | 1785 incf sub_b+0,F |
1718 movlw d'0' | 1786 movlw d'0' |
1719 addwfc sub_b+1,F ; Add 1mbar offset | 1787 addwfc sub_b+1,F ; Add 1mbar offset |
1720 call sub16 ; sub_c = sub_a - sub_b | 1788 call sub16 ; sub_c = sub_a - sub_b |
1721 btfss neg_flag ; Depth lower then 10m? | 1789 btfss neg_flag ; Depth lower then 10? |
1722 rcall depth_less_10mtr ; Yes, add extra space | 1790 rcall depth_less_10 ; Yes, add extra space |
1723 | 1791 |
1724 WIN_TOP .24 | 1792 WIN_TOP .24 |
1725 WIN_LEFT .0 | 1793 WIN_LEFT .0 |
1726 WIN_FONT FT_LARGE | 1794 WIN_FONT FT_LARGE |
1727 WIN_INVERT .0 ; Init new Wordprocessor | 1795 WIN_INVERT .0 ; Init new Wordprocessor |
1732 movlw LOW d'99' | 1800 movlw LOW d'99' |
1733 movwf sub_a+0 | 1801 movwf sub_a+0 |
1734 movff hi,sub_b+1 | 1802 movff hi,sub_b+1 |
1735 movff lo,sub_b+0 | 1803 movff lo,sub_b+0 |
1736 call sub16 ; sub_c = sub_a - sub_b | 1804 call sub16 ; sub_c = sub_a - sub_b |
1737 btfss neg_flag ; Depth lower then 1m? | 1805 btfss neg_flag ; Depth lower then 1? |
1738 bra pled_depth2 ; Yes, display manual Zero | 1806 bra pled_depth2 ; Yes, display manual Zero |
1739 | 1807 |
1740 bsf leftbind | 1808 bsf leftbind |
1741 bsf ignore_digit4 | 1809 bsf ignore_digit4 |
1742 output_16 ; Full meters in Big font | 1810 output_16 ; Full meters in Big font |
1747 PUTC '0' | 1815 PUTC '0' |
1748 | 1816 |
1749 pled_depth3: | 1817 pled_depth3: |
1750 call word_processor | 1818 call word_processor |
1751 bcf ignore_digit4 | 1819 bcf ignore_digit4 |
1820 | |
1821 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units | |
1822 btfsc WREG,0 ; Enabled ? | |
1823 bra pled_depth6 ; YES, don't print any fractions | |
1752 | 1824 |
1753 WIN_FONT FT_MEDIUM | 1825 WIN_FONT FT_MEDIUM |
1754 WIN_TOP .50 | 1826 WIN_TOP .50 |
1755 WIN_LEFT .40 | 1827 WIN_LEFT .40 |
1756 PLED_color_code warn_depth ; Color-code the output | 1828 PLED_color_code warn_depth ; Color-code the output |
1780 PUTC '0' | 1852 PUTC '0' |
1781 | 1853 |
1782 pled_depth5: | 1854 pled_depth5: |
1783 call word_processor ; decimeters in medium font | 1855 call word_processor ; decimeters in medium font |
1784 bcf ignore_digit5 | 1856 bcf ignore_digit5 |
1857 | |
1858 pled_depth6: | |
1785 WIN_FONT FT_SMALL | 1859 WIN_FONT FT_SMALL |
1786 return | 1860 return |
1787 | 1861 |
1788 depth_greater_99_84mtr: ; Display only in full meters | 1862 pled_depth_full_units_only: ; Display only in full meters or feet |
1789 btfss depth_greater_100m ; Is depth>100m already? | 1863 btfss depth_greater_100 ; Is depth>100 already? |
1790 call PLED_clear_depth ; No, clear depth area and set flag | 1864 call PLED_clear_depth ; No, clear depth area and set flag |
1791 ; Depth is already in hi:lo | 1865 ; Depth is already in hi:lo |
1792 ; Show depth in Full meters | 1866 ; Show depth in Full units |
1793 ; That means ignore figure 4 and 5 | 1867 ; That means ignore figure 4 and 5 |
1794 lfsr FSR2,letter | 1868 lfsr FSR2,letter |
1795 WIN_TOP .24 | 1869 WIN_TOP .24 |
1796 WIN_LEFT .0 | 1870 WIN_LEFT .0 |
1797 WIN_FONT FT_LARGE | 1871 WIN_FONT FT_LARGE |
1805 call word_processor | 1879 call word_processor |
1806 bcf ignore_digit4 | 1880 bcf ignore_digit4 |
1807 WIN_FONT FT_SMALL | 1881 WIN_FONT FT_SMALL |
1808 return | 1882 return |
1809 | 1883 |
1810 depth_less_10mtr: | 1884 depth_less_10: |
1811 PUTC ' ' | 1885 PUTC ' ' |
1812 return | 1886 return |
1813 | 1887 |
1814 PLED_clear_depth ; No, clear depth area and set flag | 1888 PLED_clear_depth ; No, clear depth area and set flag |
1815 WIN_BOX_BLACK .24, .90, .0, .90 ;top, bottom, left, right | 1889 WIN_BOX_BLACK .24, .90, .0, .90 ;top, bottom, left, right |
1816 bsf depth_greater_100m ; Set Flag | 1890 bsf depth_greater_100 ; Set Flag |
1817 return | 1891 return |
1818 | 1892 |
1819 PLED_desaturation_time: | 1893 PLED_desaturation_time: |
1820 movff int_O_desaturation_time+0,lo | 1894 movff int_O_desaturation_time+0,lo |
1821 movff int_O_desaturation_time+1,hi ; Copy | 1895 movff int_O_desaturation_time+1,hi ; Copy |
2175 PLED_max_pressure: | 2249 PLED_max_pressure: |
2176 ostc_debug 'p' ; Sends debug-information to screen if debugmode active | 2250 ostc_debug 'p' ; Sends debug-information to screen if debugmode active |
2177 movff max_pressure+0,lo | 2251 movff max_pressure+0,lo |
2178 movff max_pressure+1,hi | 2252 movff max_pressure+1,hi |
2179 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 2253 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] |
2254 call convert_meters_to_feet ; converts meters to feet | |
2255 | |
2256 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units | |
2257 btfsc WREG,0 ; Enabled ? | |
2258 bra PLED_maxdepth_full_units_only ; YES, don't print any feet fractions | |
2180 | 2259 |
2181 movlw .039 | 2260 movlw .039 |
2182 cpfslt hi | 2261 cpfslt hi |
2183 bra maxdepth_greater_99_84mtr | 2262 bra PLED_maxdepth_full_units_only |
2184 | 2263 |
2185 ; Display normal "xx.y" | 2264 ; Display normal "xx.y" |
2186 lfsr FSR2,letter | 2265 lfsr FSR2,letter |
2187 call PLED_standard_color | 2266 call PLED_standard_color |
2188 WIN_TOP .184 | 2267 WIN_TOP .184 |
2196 bcf show_last3 | 2275 bcf show_last3 |
2197 call word_processor | 2276 call word_processor |
2198 WIN_FONT FT_SMALL | 2277 WIN_FONT FT_SMALL |
2199 return | 2278 return |
2200 | 2279 |
2201 maxdepth_greater_99_84mtr: ; Display only in full meters | 2280 PLED_maxdepth_full_units_only: ; Display only in full units (meters or feet) |
2202 btfss maxdepth_greater_100m ; Is max.depth>100m already? | 2281 btfss maxdepth_greater_100 ; Is max.depth>100 already? |
2203 call PLED_clear_maxdepth ; No, clear maxdepth area and set flag | 2282 call PLED_clear_maxdepth ; No, clear maxdepth area and set flag |
2204 ; max Depth is already in hi:lo | 2283 ; max Depth is already in hi:lo |
2205 ; Show max depth in Full meters | 2284 ; Show max depth in Full units |
2206 ; That means ignore figure 4 and 5 | 2285 ; That means ignore figure 4 and 5 |
2207 lfsr FSR2,letter | 2286 lfsr FSR2,letter |
2208 call PLED_standard_color | 2287 call PLED_standard_color |
2209 WIN_TOP .184 | 2288 WIN_TOP .184 |
2210 WIN_LEFT .0 | 2289 WIN_LEFT .0 |
2220 WIN_FONT FT_SMALL | 2299 WIN_FONT FT_SMALL |
2221 return | 2300 return |
2222 | 2301 |
2223 PLED_clear_maxdepth: | 2302 PLED_clear_maxdepth: |
2224 WIN_BOX_BLACK .184, .215, .0, .41 ;top, bottom, left, right | 2303 WIN_BOX_BLACK .184, .215, .0, .41 ;top, bottom, left, right |
2225 bsf maxdepth_greater_100m ; Set Flag | 2304 bsf maxdepth_greater_100 ; Set Flag |
2226 return | 2305 return |
2227 | 2306 |
2228 PLED_divemins: | 2307 PLED_divemins: |
2229 btfsc menubit ; Divemode menu active? | 2308 btfsc menubit ; Divemode menu active? |
2230 return ; Yes, do not update divetime | 2309 return ; Yes, do not update divetime |
2374 call word_processor | 2453 call word_processor |
2375 | 2454 |
2376 ostc_debug 'U' ; Sends debug-information to screen if debugmode active | 2455 ostc_debug 'U' ; Sends debug-information to screen if debugmode active |
2377 | 2456 |
2378 WIN_TOP .216 | 2457 WIN_TOP .216 |
2379 WIN_LEFT .110 | |
2380 WIN_FONT FT_SMALL | 2458 WIN_FONT FT_SMALL |
2381 call PLED_standard_color | 2459 call PLED_standard_color |
2382 | 2460 |
2383 lfsr FSR2,letter | 2461 lfsr FSR2,letter |
2384 movff avr_rel_pressure+0,lo | 2462 movff avr_rel_pressure+0,lo |
2385 movff avr_rel_pressure+1,hi | 2463 movff avr_rel_pressure+1,hi |
2386 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 2464 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] |
2465 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units | |
2466 btfss WREG,0 ; Enabled ? | |
2467 bra PLED_stopwatch_show3 ; NO | |
2468 WIN_LEFT .124 | |
2469 call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63 | |
2470 bsf ignore_digit4 ; do not display feet fractions | |
2471 output_16 | |
2472 bcf ignore_digit4 | |
2473 bcf leftbind | |
2474 STRCAT_PRINT TXT_FOOT2 | |
2475 return | |
2476 | |
2477 PLED_stopwatch_show3: | |
2478 WIN_LEFT .110 | |
2387 bsf ignore_digit5 ; do not display 1cm depth | 2479 bsf ignore_digit5 ; do not display 1cm depth |
2388 output_16dp d'3' | 2480 output_16dp d'3' |
2389 bcf leftbind | 2481 bcf leftbind |
2390 STRCAT_PRINT TXT_METER1 | 2482 STRCAT_PRINT TXT_METER1 |
2391 return | 2483 return |
2423 movff wait_temp,lo | 2515 movff wait_temp,lo |
2424 output_99x | 2516 output_99x |
2425 call word_processor | 2517 call word_processor |
2426 | 2518 |
2427 ostc_debug 'U' ; Sends debug-information to screen if debugmode active | 2519 ostc_debug 'U' ; Sends debug-information to screen if debugmode active |
2428 WIN_TOP .136 | 2520 WIN_TOP .137 |
2429 WIN_LEFT .90 | |
2430 WIN_FONT FT_MEDIUM | 2521 WIN_FONT FT_MEDIUM |
2431 call PLED_standard_color | 2522 call PLED_standard_color |
2432 lfsr FSR2,letter | 2523 lfsr FSR2,letter |
2433 movff avr_rel_pressure+0,lo | 2524 movff avr_rel_pressure+0,lo |
2434 movff avr_rel_pressure+1,hi | 2525 movff avr_rel_pressure+1,hi |
2435 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 2526 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] |
2527 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units | |
2528 btfss WREG,0 ; Enabled ? | |
2529 bra PLED_stopwatch_show_gauge2 ; NO | |
2530 WIN_LEFT .110 | |
2531 call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63 | |
2532 bsf ignore_digit4 ; do not display feet fractions | |
2533 output_16 | |
2534 bcf ignore_digit4 | |
2535 bcf leftbind | |
2536 call word_processor | |
2537 | |
2538 WIN_TOP .149 | |
2539 WIN_LEFT .145 | |
2540 WIN_FONT FT_SMALL | |
2541 lfsr FSR2,letter | |
2542 STRCPY_PRINT TXT_FOOT2 | |
2543 return | |
2544 | |
2545 PLED_stopwatch_show_gauge2: | |
2546 WIN_LEFT .90 | |
2436 bsf ignore_digit5 ; do not display 1cm depth | 2547 bsf ignore_digit5 ; do not display 1cm depth |
2437 output_16dp d'3' | 2548 output_16dp d'3' |
2438 bcf leftbind | 2549 bcf leftbind |
2439 STRCAT_PRINT TXT_METER1 | 2550 STRCAT_PRINT TXT_METER1 |
2440 WIN_FONT FT_SMALL ; Reset... | 2551 WIN_FONT FT_SMALL ; Reset... |
2445 ; Non-Resettable Average | 2556 ; Non-Resettable Average |
2446 call PLED_divemask_color ; Set Color for Divemode mask | 2557 call PLED_divemask_color ; Set Color for Divemode mask |
2447 DISPLAYTEXTH d'281' ; Avr.Depth | 2558 DISPLAYTEXTH d'281' ; Avr.Depth |
2448 | 2559 |
2449 PLED_total_average_show2: | 2560 PLED_total_average_show2: |
2450 WIN_TOP .192 | 2561 WIN_TOP .193 |
2451 WIN_LEFT .110 | |
2452 WIN_FONT FT_SMALL | 2562 WIN_FONT FT_SMALL |
2453 call PLED_standard_color | 2563 call PLED_standard_color |
2454 | 2564 |
2455 lfsr FSR2,letter | 2565 lfsr FSR2,letter |
2456 movff avr_rel_pressure_total+0,lo | 2566 movff avr_rel_pressure_total+0,lo |
2457 movff avr_rel_pressure_total+1,hi | 2567 movff avr_rel_pressure_total+1,hi |
2458 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 2568 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] |
2569 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units | |
2570 btfss WREG,0 ; Enabled ? | |
2571 bra PLED_total_average_show3 ; NO | |
2572 WIN_LEFT .124 | |
2573 call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63 | |
2574 bsf ignore_digit4 ; do not display feet fractions | |
2575 bcf leftbind | |
2576 output_16 | |
2577 bcf ignore_digit4 | |
2578 STRCAT_PRINT TXT_FOOT2 | |
2579 return | |
2580 | |
2581 PLED_total_average_show3: | |
2582 WIN_LEFT .110 | |
2459 bsf ignore_digit5 ; do not display 1cm depth | 2583 bsf ignore_digit5 ; do not display 1cm depth |
2460 bcf leftbind | 2584 bcf leftbind |
2461 output_16dp d'3' | 2585 output_16dp d'3' |
2462 STRCAT_PRINT TXT_METER1 | 2586 STRCAT_PRINT TXT_METER1 |
2463 return | 2587 return |
2570 return | 2694 return |
2571 | 2695 |
2572 PLED_divemode_simulator_mask: | 2696 PLED_divemode_simulator_mask: |
2573 call PLED_standard_color | 2697 call PLED_standard_color |
2574 DISPLAYTEXT .254 ; Close | 2698 DISPLAYTEXT .254 ; Close |
2699 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units | |
2700 btfss WREG,0 ; Enabled ? | |
2701 bra PLED_divemode_simulator_mask2 ; NO | |
2702 DISPLAYTEXTH .314 ; + 1ft | |
2703 DISPLAYTEXTH .315 ; - 1ft | |
2704 DISPLAYTEXTH .316 ; + 10ft | |
2705 DISPLAYTEXTH .317 ; - 10ft | |
2706 DISPLAYTEXTH .306 ; Quit Sim | |
2707 return | |
2708 | |
2709 PLED_divemode_simulator_mask2: | |
2575 DISPLAYTEXT .250 ; + 1m | 2710 DISPLAYTEXT .250 ; + 1m |
2576 DISPLAYTEXT .251 ; - 1m | 2711 DISPLAYTEXT .251 ; - 1m |
2577 DISPLAYTEXT .252 ; +10m | 2712 DISPLAYTEXT .252 ; +10m |
2578 DISPLAYTEXT .253 ; -10m | 2713 DISPLAYTEXT .253 ; -10m |
2579 DISPLAYTEXTH .306 ; Quit Sim | 2714 DISPLAYTEXTH .306 ; Quit Sim |
2589 ; WREG, PROD, TBLPTR TABLAT. | 2724 ; WREG, PROD, TBLPTR TABLAT. |
2590 ; | 2725 ; |
2591 PLED_decoplan_show_stop: | 2726 PLED_decoplan_show_stop: |
2592 ;---- Print depth ---------------------------------------------------- | 2727 ;---- Print depth ---------------------------------------------------- |
2593 WIN_LEFT .100 | 2728 WIN_LEFT .100 |
2594 | 2729 |
2595 btfss lo,7 ; Bit set ? | 2730 btfss lo,7 ; Bit set ? |
2596 bra PLED_decoplan_std_stop ; No : Just an usual stop. | 2731 bra PLED_decoplan_std_stop ; No : Just an usual stop. |
2597 | 2732 |
2598 movlw b'11111101' ; Yellow. | 2733 movlw b'11111101' ; Yellow. |
2599 call PLED_set_color | 2734 call PLED_set_color |
2604 call PLED_standard_color | 2739 call PLED_standard_color |
2605 | 2740 |
2606 PLED_decoplan_nstd_stop: | 2741 PLED_decoplan_nstd_stop: |
2607 lfsr FSR2,letter | 2742 lfsr FSR2,letter |
2608 bsf leftbind | 2743 bsf leftbind |
2744 GETCUSTOM8 d'63' ; Check CF#63 | |
2745 btfss WREG,0 ; Enabled ? | |
2746 bra PLED_decoplan_nstd_stop2 ; NO | |
2747 movff hi,temp11 ; save hi | |
2748 clrf hi ; | |
2749 call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63 | |
2750 output_16_3 | |
2751 STRCAT_PRINT " " | |
2752 movff temp11,hi ; restore hi | |
2753 bra PLED_decoplan_nstd_stop3 | |
2754 | |
2755 PLED_decoplan_nstd_stop2: | |
2609 output_8 ; outputs into Postinc2! | 2756 output_8 ; outputs into Postinc2! |
2610 STRCAT_PRINT TXT_METER2 | 2757 STRCAT_PRINT TXT_METER2 |
2611 | 2758 |
2759 PLED_decoplan_nstd_stop3: | |
2612 ;---- Print duration ------------------------------------------------- | 2760 ;---- Print duration ------------------------------------------------- |
2613 WIN_LEFT .140 | 2761 WIN_LEFT .140 |
2614 lfsr FSR2,letter | 2762 lfsr FSR2,letter |
2615 | 2763 |
2616 movf lo,W ; Swap hi & lo | 2764 movf lo,W ; Swap hi & lo |
2948 | 3096 |
2949 bcf leftbind | 3097 bcf leftbind |
2950 return ; no, return | 3098 return ; no, return |
2951 | 3099 |
2952 PLED_clear_divemode_menu: | 3100 PLED_clear_divemode_menu: |
2953 WIN_BOX_BLACK .0, .168, .85, .160 ;top, bottom, left, right | 3101 WIN_BOX_BLACK .0, .168, .82, .160 ;top, bottom, left, right |
2954 return | 3102 return |
2955 | 3103 |
2956 PLED_divemenu_cursor: | 3104 PLED_divemenu_cursor: |
2957 ostc_debug 'l' ; Sends debug-information to screen if debugmode active | 3105 ostc_debug 'l' ; Sends debug-information to screen if debugmode active |
2958 | 3106 |
3335 WIN_LEFT .125 | 3483 WIN_LEFT .125 |
3336 WIN_TOP .192 | 3484 WIN_TOP .192 |
3337 lfsr FSR2,letter | 3485 lfsr FSR2,letter |
3338 movff char_O_EAD,lo | 3486 movff char_O_EAD,lo |
3339 bsf leftbind | 3487 bsf leftbind |
3488 GETCUSTOM8 d'63' ; Check CF#63 | |
3489 btfss WREG,0 ; Enabled ? | |
3490 bra PLED_show_end_ead_divemode2 ; NO: return | |
3491 clrf hi ; clear hi | |
3492 call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63 | |
3493 output_16 ; Print EAD w/o leading space. | |
3494 bcf leftbind | |
3495 STRCAT_PRINT TXT_FOOT2 | |
3496 | |
3497 WIN_TOP .216 | |
3498 lfsr FSR2,letter | |
3499 movff char_O_END,lo | |
3500 clrf hi ; clear hi | |
3501 call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63 | |
3502 bsf leftbind | |
3503 output_16 ; Print END w/o leading space. | |
3504 bcf leftbind | |
3505 STRCAT_PRINT TXT_FOOT2 | |
3506 bra PLED_show_end_ead_divemode3 | |
3507 | |
3508 PLED_show_end_ead_divemode2: | |
3340 output_8 ; Print EAD w/o leading space. | 3509 output_8 ; Print EAD w/o leading space. |
3341 STRCAT_PRINT TXT_METER2 | 3510 STRCAT_PRINT TXT_METER2 |
3342 | 3511 |
3343 WIN_TOP .216 | 3512 WIN_TOP .216 |
3344 lfsr FSR2,letter | 3513 lfsr FSR2,letter |
3345 movff char_O_END,lo | 3514 movff char_O_END,lo |
3346 output_8 ; Print END w/o leading space. | 3515 output_8 ; Print END w/o leading space. |
3347 bcf leftbind | 3516 bcf leftbind |
3348 STRCAT_PRINT TXT_METER2 | 3517 STRCAT_PRINT TXT_METER2 |
3349 | 3518 |
3519 PLED_show_end_ead_divemode3: | |
3350 ; Show ppO2[Flush] iff in CCR mode & not in Bailout: | 3520 ; Show ppO2[Flush] iff in CCR mode & not in Bailout: |
3351 btfsc is_bailout ; In bailout mode? | 3521 btfsc is_bailout ; In bailout mode? |
3352 return ; Yes: done. | 3522 return ; Yes: done. |
3353 | 3523 |
3354 btfss FLAG_const_ppO2_mode ; In (true) CCR mode ? | 3524 btfss FLAG_const_ppO2_mode ; In (true) CCR mode ? |
3858 | 4028 |
3859 movff xC+0,lo | 4029 movff xC+0,lo |
3860 movff xC+1,hi ; restore lo and hi with updated value | 4030 movff xC+1,hi ; restore lo and hi with updated value |
3861 | 4031 |
3862 return | 4032 return |
4033 | |
4034 | |
4035 convert_meters_to_feet: ; convert value in lo:hi from meters to feet | |
4036 | |
4037 GETCUSTOM8 d'63' ; Check CF#63 | |
4038 btfss WREG,0 ; Enabled ? | |
4039 return ; NO: return | |
4040 | |
4041 convert_meters_to_feet2: | |
4042 movff lo,xA+0 | |
4043 movff hi,xA+1 | |
4044 | |
4045 movlw LOW d'328' ; 328feet/100m | |
4046 movwf xB+0 | |
4047 movlw HIGH d'328' | |
4048 movwf xB+1 | |
4049 | |
4050 call mult16x16 ; xA*xB=xC (lo:hi * 328) | |
4051 | |
4052 movlw d'50' ; round up | |
4053 addwf xC+0,F | |
4054 movlw 0 | |
4055 addwfc xC+1,F | |
4056 addwfc xC+2,F | |
4057 addwfc xC+3,F | |
4058 | |
4059 movlw d'100' | |
4060 movwf xB+0 | |
4061 clrf xB+1 | |
4062 | |
4063 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
4064 | |
4065 movff xC+0,lo | |
4066 movff xC+1,hi ; restore lo and hi with updated value | |
4067 | |
4068 return | |
4069 | |
4070 convert_celsius_to_fahrenheit: ; convert value in lo:hi from celsius to fahrenheit | |
4071 | |
4072 GETCUSTOM8 d'63' ; Check CF#63 | |
4073 btfss WREG,0 ; Enabled ? | |
4074 return ; NO: return | |
4075 | |
4076 movff lo,xA+0 | |
4077 movff hi,xA+1 | |
4078 | |
4079 movlw d'18' ; 1C = 1.8F | |
4080 movwf xB+0 | |
4081 clrf xB+1 | |
4082 | |
4083 call mult16x16 ;xA*xB=xC (lo:hi * 18) | |
4084 | |
4085 movlw d'10' | |
4086 movwf xB+0 | |
4087 clrf xB+1 | |
4088 | |
4089 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
4090 | |
4091 movlw LOW d'320' ; 0C = 32F | |
4092 addwf xC+0,F | |
4093 movlw HIGH d'320' | |
4094 addwfc xC+1,F | |
4095 | |
4096 movff xC+0,lo | |
4097 movff xC+1,hi ; restore lo and hi with updated value | |
4098 | |
4099 return |