Mercurial > public > hwos_code
comparison src/compass_ops.asm @ 371:fec5eec4c8b7
fix some display issues with display1
author | heinrichsweikamp |
---|---|
date | Wed, 19 Aug 2015 16:27:00 +0200 |
parents | 67e631aa5b8c |
children | 6f3530eb48f9 |
comparison
equal
deleted
inserted
replaced
370:67e631aa5b8c | 371:fec5eec4c8b7 |
---|---|
511 incf xA+1 | 511 incf xA+1 |
512 ; 5. save it to xRDr | 512 ; 5. save it to xRDr |
513 movff xA+0,xRDr+0 | 513 movff xA+0,xRDr+0 |
514 movff xA+1,xRDr+1 | 514 movff xA+1,xRDr+1 |
515 | 515 |
516 ; ; Bearing ? | |
517 ; ; We can skip this xRD180 calculation if no bearing is set | |
518 ; bcf compass_bearing_set | |
519 ; movff compass_bearing+0,sub_a+0 | |
520 ; movff compass_bearing+1,sub_a+1 | |
521 ; movlw d'0' | |
522 ; cpfseq sub_a+1 | |
523 ; bra TFT_dive_compass_bearing ; something set, calculate xRD180 | |
524 ; movlw d'0' | |
525 ; cpfseq sub_a+0 | |
526 ; bra TFT_dive_compass_bearing ; something set, calculate xRD180 | |
527 ; bra TFT_dive_compass_ruler ; no value in the bearing, skip calc | |
528 ; | |
529 ;TFT_dive_compass_bearing: | |
530 ; bsf compass_bearing_set | |
531 | |
532 btfss compass_bearing_set | 516 btfss compass_bearing_set |
533 bra TFT_dive_compass_ruler ; no value in the bearing, skip calc | 517 bra TFT_dive_compass_ruler ; no value in the bearing, skip calc |
534 | 518 |
535 ; we have bearing set, we will need xRD180 calculated | 519 ; we have bearing set, we will need xRD180 calculated |
536 ; xRD180 is xRDr-180 | 520 ; xRD180 is xRDr-180 |
665 movlw d'2' ; avoid thin mess on the side of the display | 649 movlw d'2' ; avoid thin mess on the side of the display |
666 addwf sub_a+0,1 | 650 addwf sub_a+0,1 |
667 btfsc STATUS, C | 651 btfsc STATUS, C |
668 incf sub_a+1 | 652 incf sub_a+1 |
669 ; load the display offset right side into sub_b | 653 ; load the display offset right side into sub_b |
670 movlw high(d'160') | 654 movlw high(d'158') |
671 addwf sub_b+1,1 | 655 addwf sub_b+1,1 |
672 movlw low(d'160') | 656 movlw low(d'158') |
673 addwf sub_b+0,1 | 657 addwf sub_b+0,1 |
674 btfsc STATUS,C | 658 btfsc STATUS,C |
675 incf sub_b+1 | 659 incf sub_b+1 |
676 call subU16 ; sub_c = sub_a - sub_b | 660 call subU16 ; sub_c = sub_a - sub_b |
677 btfss neg_flag ; xRDr>xA(+2) | 661 btfss neg_flag ; xRDr>xA(+2) |
689 ; xRD180 - xCM | 673 ; xRD180 - xCM |
690 call subU16 ; sub_c = sub_a - sub_b | 674 call subU16 ; sub_c = sub_a - sub_b |
691 btfsc neg_flag ; CM>xRD180 | 675 btfsc neg_flag ; CM>xRD180 |
692 return ; no, not on screen | 676 return ; no, not on screen |
693 ; 160 - (X) | 677 ; 160 - (X) |
694 movlw high(d'160') | 678 movlw high(d'158') |
695 movff WREG,sub_a+1 | 679 movff WREG,sub_a+1 |
696 movlw low(d'160') | 680 movlw low(d'158') |
697 movff WREG,sub_a+0 | 681 movff WREG,sub_a+0 |
698 movff sub_c+1,sub_b+1 | 682 movff sub_c+1,sub_b+1 |
699 movff sub_c+0,sub_b+0 | 683 movff sub_c+0,sub_b+0 |
700 call subU16 ; sub_c = sub_a - sub_b | 684 call subU16 ; sub_c = sub_a - sub_b |
701 btfsc neg_flag ; X>160 | 685 btfsc neg_flag ; X>160 |
702 return ; no, not on screen | 686 return ; no, not on screen |
703 ; check if not overflow - this sounds a double check... | 687 ; check if not overflow - this sounds a double check... |
704 movlw d'1' | 688 movlw d'1' |
705 cpfslt sub_c+1 | 689 cpfslt sub_c+1 |
706 return ; high set, >160 | 690 return ; high set, >160 |
707 movlw d'160' | 691 movlw d'158' |
708 cpfslt sub_c+0 | 692 cpfslt sub_c+0 |
709 return ; low >160 | 693 return ; low >160 |
710 ; print the bearing lines on the screen | 694 ; print the bearing lines on the screen |
711 movff sub_c+0,xCM | 695 movff sub_c+0,xCM |
712 bsf compass_bearing_vis | 696 bsf compass_bearing_vis |
832 subfwb xA+0,1 | 816 subfwb xA+0,1 |
833 TFT_dive_compass_ruler_1: | 817 TFT_dive_compass_ruler_1: |
834 ; xA+0 holds the RM, store it to 'lo' | 818 ; xA+0 holds the RM, store it to 'lo' |
835 movff xA+0,lo | 819 movff xA+0,lo |
836 ; init DD to zero, store it to 'hi' | 820 ; init DD to zero, store it to 'hi' |
837 movlw d'0' | 821 clrf hi |
838 movff WREG,hi | |
839 | 822 |
840 TFT_dive_compass_ruler_loop: | 823 TFT_dive_compass_ruler_loop: |
841 ; 1. check if we run of from the display | 824 ; 1. check if we run of from the display |
842 movlw d'160' ; Looks like 160 works because TFT_box limits the dispay | 825 movlw d'159' ; Looks like 159 works because TFT_box limits the dispay |
843 cpfslt lo,1 | 826 cpfslt lo,1 |
844 bra TFT_dive_compass_ruler_lend ; xRM >= W | 827 bra TFT_dive_compass_ruler_lend ; xRM >= W |
845 ; 2. Clear the tick area from DD to RM - in segments to avoid blinking | 828 ; 2. Clear the tick area from DD to RM - in segments to avoid blinking |
846 ; don't do a clear if we are at 0 (zero) otherwise it will blink | 829 ; don't do a clear if we are at 0 (zero) otherwise it will blink |
847 ; because of the width underflow | 830 ; because of the width underflow |
859 movlw d'2' | 842 movlw d'2' |
860 movff WREG,win_width | 843 movff WREG,win_width |
861 movff WREG,win_bargraph | 844 movff WREG,win_bargraph |
862 movff lo,win_leftx2 ; 0..159 | 845 movff lo,win_leftx2 ; 0..159 |
863 call TFT_standard_color | 846 call TFT_standard_color |
864 ; call TFT_box | 847 call TFT_box |
865 movlw dm_custom_compass_tick_bot_top | 848 movlw dm_custom_compass_tick_bot_top |
866 movff WREG,win_top | 849 movff WREG,win_top |
867 movlw dm_custom_compass_tick_height | 850 movlw dm_custom_compass_tick_height |
868 movff WREG,win_height | 851 movff WREG,win_height |
869 call TFT_standard_color ; color in WREG is trashed, must be set again! | 852 call TFT_standard_color ; color in WREG is trashed, must be set again! |
870 ; call TFT_box | 853 call TFT_box |
871 ; 4. If D<82 and RM>79: means we put something over the center line | 854 ; 4. If D<82 and RM>79: means we put something over the center line |
872 ; redraw the center line | 855 ; redraw the center line |
873 movlw d'82' | 856 movlw d'82' |
874 cpfslt hi,1 | 857 cpfslt hi,1 |
875 bra TFT_dive_compass_ruler_loop_zz2 | 858 bra TFT_dive_compass_ruler_loop_zz2 |
881 WIN_BOX_COLOR dm_custom_compass_tick_top_top, dm_custom_compass_tick_bot_bot,.80,.81 ; center line in yellow | 864 WIN_BOX_COLOR dm_custom_compass_tick_top_top, dm_custom_compass_tick_bot_bot,.80,.81 ; center line in yellow |
882 TFT_dive_compass_ruler_loop_zz2: | 865 TFT_dive_compass_ruler_loop_zz2: |
883 ; 5. set D = RM + 2 : position after the 2px tick | 866 ; 5. set D = RM + 2 : position after the 2px tick |
884 movff lo,hi | 867 movff lo,hi |
885 movlw d'2' | 868 movlw d'2' |
886 addwf hi,1 | 869 addwf hi,F |
887 ; 6. set RM = RM + 15 : position to the next tick | 870 ; 6. set RM = RM + 15 : position to the next tick |
888 movlw d'15' | 871 movlw d'15' |
889 addwf lo,1 | 872 addwf lo,F |
890 ; 7. loop | 873 ; 7. loop |
891 bra TFT_dive_compass_ruler_loop | 874 bra TFT_dive_compass_ruler_loop |
892 | 875 |
893 TFT_dive_compass_ruler_lend: ; loop end | 876 TFT_dive_compass_ruler_lend: ; loop end |
894 ; 8. clear the rest of the tick area if D<160 | 877 ; 8. clear the rest of the tick area if D<160 |
895 movlw d'160' | 878 movlw d'160' |
896 cpfslt hi,1 | 879 cpfslt hi |
897 bra TFT_dive_compass_ruler_lend2 ; D >= W | 880 bra TFT_dive_compass_ruler_lend2 ; D >= W |
898 ; 9. position left to end of display to clear the remaining area | 881 ; 9. position left to end of display to clear the remaining area |
899 movlw d'159' | 882 movlw d'159' |
900 movwf lo | 883 movwf lo |
901 ; 10. clear it | 884 ; 10. clear it |
905 ; done with the compass ruler, put the labels on the screen | 888 ; done with the compass ruler, put the labels on the screen |
906 ; get the RD abck to sub_b | 889 ; get the RD abck to sub_b |
907 movff xRD+0,sub_b+0 | 890 movff xRD+0,sub_b+0 |
908 movff xRD+1,sub_b+1 | 891 movff xRD+1,sub_b+1 |
909 ; hi stores the display position | 892 ; hi stores the display position |
910 movlw d'0' | 893 clrf hi |
911 movwf hi | 894 clrf xHI |
912 ; lo stores the last item's display position | 895 ; lo stores the last item's display position |
913 movlw d'0' | 896 clrf lo |
914 movwf lo | 897 clrf xLO |
915 bcf print_compass_label | |
916 | 898 |
917 movlw d'14' | 899 movlw d'14' |
918 movwf up ; up stores the width of hte label | 900 movwf up ; cardinal width in px |
919 movlw low( d'219' ) ; position of the label | 901 movlw low( d'219' ) ; position of the label |
920 movwf sub_a+0 | 902 movwf sub_a+0 |
921 movlw high( d'219' ) | 903 movlw high( d'219' ) |
922 movwf sub_a+1 | 904 movwf sub_a+1 |
923 rcall TFT_dive_compass_label_proc ; check if the label should be on screen | 905 rcall TFT_dive_compass_label_proc ; check if the label should be on screen |
924 btfss print_compass_label ; Yes? | 906 btfss print_compass_label ; Yes? |
925 bra dcr_1 | 907 bra dcr_1 |
926 STRCPY_TEXT_PRINT tSW ; yes - print it | 908 STRCPY_TEXT_PRINT tSW ; yes - print it |
927 dcr_1: | 909 dcr_1: |
928 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker | 910 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker |
929 | 911 |
930 movlw d'7' | 912 movlw d'14' |
931 movwf up ; up stores the width of hte label | 913 movwf up ; cardinal width in px |
932 movlw low( d'267' ) ; position of the label | 914 movlw low( d'267' ) ; position of the label |
933 movwf sub_a+0 | 915 movwf sub_a+0 |
934 movlw high( d'267' ) | 916 movlw high( d'267' ) |
935 movwf sub_a+1 | 917 movwf sub_a+1 |
936 rcall TFT_dive_compass_label_proc ; check if the label should be on screen | 918 rcall TFT_dive_compass_label_proc ; check if the label should be on screen |
939 STRCPY_TEXT_PRINT tW ; yes - print it | 921 STRCPY_TEXT_PRINT tW ; yes - print it |
940 dcr_2: | 922 dcr_2: |
941 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker | 923 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker |
942 | 924 |
943 movlw d'14' | 925 movlw d'14' |
944 movwf up ; up stores the width of hte label | 926 movwf up ; cardinal width in px |
945 movlw low( d'309' ) ; position of the label | 927 movlw low( d'309' ) ; position of the label |
946 movwf sub_a+0 | 928 movwf sub_a+0 |
947 movlw high( d'309' ) | 929 movlw high( d'309' ) |
948 movwf sub_a+1 | 930 movwf sub_a+1 |
949 rcall TFT_dive_compass_label_proc ; check if the label should be on screen | 931 rcall TFT_dive_compass_label_proc ; check if the label should be on screen |
951 bra dcr_3 | 933 bra dcr_3 |
952 STRCPY_TEXT_PRINT tNW ; yes - print it | 934 STRCPY_TEXT_PRINT tNW ; yes - print it |
953 dcr_3: | 935 dcr_3: |
954 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker | 936 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker |
955 | 937 |
956 movlw d'6' | 938 movlw d'14' |
957 movwf up ; up stores the width of hte label | 939 movwf up ; cardinal width in px |
958 movlw low( d'358' ) ; position of the label | 940 movlw low( d'358' ) ; position of the label |
959 movwf sub_a+0 | 941 movwf sub_a+0 |
960 movlw high( d'358' ) | 942 movlw high( d'358' ) |
961 movwf sub_a+1 | 943 movwf sub_a+1 |
962 rcall TFT_dive_compass_label_proc ; check if the label should be on screen | 944 rcall TFT_dive_compass_label_proc ; check if the label should be on screen |
964 bra dcr_4 | 946 bra dcr_4 |
965 STRCPY_TEXT_PRINT tN ; yes - print it | 947 STRCPY_TEXT_PRINT tN ; yes - print it |
966 dcr_4: | 948 dcr_4: |
967 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker | 949 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker |
968 | 950 |
969 movlw d'13' | 951 movlw d'14' |
970 movwf up ; up stores the width of hte label | 952 movwf up ; cardinal width in px |
971 movlw low( d'399' ) ; position of the label | 953 movlw low( d'399' ) ; position of the label |
972 movwf sub_a+0 | 954 movwf sub_a+0 |
973 movlw high( d'399' ) | 955 movlw high( d'399' ) |
974 movwf sub_a+1 | 956 movwf sub_a+1 |
975 rcall TFT_dive_compass_label_proc ; check if the label should be on screen | 957 rcall TFT_dive_compass_label_proc ; check if the label should be on screen |
977 bra dcr_5 | 959 bra dcr_5 |
978 STRCPY_TEXT_PRINT tNE ; yes - print it | 960 STRCPY_TEXT_PRINT tNE ; yes - print it |
979 dcr_5: | 961 dcr_5: |
980 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker | 962 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker |
981 | 963 |
982 movlw d'6' | 964 movlw d'14' |
983 movwf up ; up stores the width of hte label | 965 movwf up ; cardinal width in px |
984 movlw low( d'448' ) ; position of the label | 966 movlw low( d'448' ) ; position of the label |
985 movwf sub_a+0 | 967 movwf sub_a+0 |
986 movlw high( d'448' ) | 968 movlw high( d'448' ) |
987 movwf sub_a+1 | 969 movwf sub_a+1 |
988 rcall TFT_dive_compass_label_proc ; check if the label should be on screen | 970 rcall TFT_dive_compass_label_proc ; check if the label should be on screen |
990 bra dcr_6 | 972 bra dcr_6 |
991 STRCPY_TEXT_PRINT tE ; yes - print it | 973 STRCPY_TEXT_PRINT tE ; yes - print it |
992 dcr_6: | 974 dcr_6: |
993 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker | 975 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker |
994 | 976 |
995 movlw d'13' | 977 movlw d'14' |
996 movwf up ; up stores the width of hte label | 978 movwf up ; cardinal width in px |
997 movlw low( d'489' ) ; position of the label | 979 movlw low( d'489' ) ; position of the label |
998 movwf sub_a+0 | 980 movwf sub_a+0 |
999 movlw high( d'489' ) | 981 movlw high( d'489' ) |
1000 movwf sub_a+1 | 982 movwf sub_a+1 |
1001 rcall TFT_dive_compass_label_proc ; check if the label should be on screen | 983 rcall TFT_dive_compass_label_proc ; check if the label should be on screen |
1003 bra dcr_7 | 985 bra dcr_7 |
1004 STRCPY_TEXT_PRINT tSE ; yes - print it | 986 STRCPY_TEXT_PRINT tSE ; yes - print it |
1005 dcr_7: | 987 dcr_7: |
1006 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker | 988 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker |
1007 | 989 |
1008 movlw d'6' | 990 movlw d'14' |
1009 movwf up ; up stores the width of hte label | 991 movwf up ; cardinal width in px |
1010 movlw low( d'538' ) ; position of the label | 992 movlw low( d'538' ) ; position of the label |
1011 movwf sub_a+0 | 993 movwf sub_a+0 |
1012 movlw high( d'538' ) | 994 movlw high( d'538' ) |
1013 movwf sub_a+1 | 995 movwf sub_a+1 |
1014 rcall TFT_dive_compass_label_proc ; check if the label should be on screen | 996 rcall TFT_dive_compass_label_proc ; check if the label should be on screen |
1017 STRCPY_TEXT_PRINT tS ; yes - print it | 999 STRCPY_TEXT_PRINT tS ; yes - print it |
1018 dcr_8: | 1000 dcr_8: |
1019 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker | 1001 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker |
1020 | 1002 |
1021 movlw d'14' | 1003 movlw d'14' |
1022 movwf up ; up stores the width of hte label | 1004 movwf up ; cardinal width in px |
1023 movlw low( d'579' ) ; position of the label | 1005 movlw low( d'579' ) ; position of the label |
1024 movwf sub_a+0 | 1006 movwf sub_a+0 |
1025 movlw high( d'579' ) | 1007 movlw high( d'579' ) |
1026 movwf sub_a+1 | 1008 movwf sub_a+1 |
1027 rcall TFT_dive_compass_label_proc ; check if the label should be on screen | 1009 rcall TFT_dive_compass_label_proc ; check if the label should be on screen |
1029 bra dcr_9 | 1011 bra dcr_9 |
1030 STRCPY_TEXT_PRINT tSW ; yes - print it | 1012 STRCPY_TEXT_PRINT tSW ; yes - print it |
1031 dcr_9: | 1013 dcr_9: |
1032 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker | 1014 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker |
1033 | 1015 |
1034 movlw d'7' | 1016 movlw d'14' |
1035 movwf up ; up stores the width of hte label | 1017 movwf up ; cardinal width in px |
1036 movlw low( d'627' ) ; position of the label | 1018 movlw low( d'627' ) ; position of the label |
1037 movwf sub_a+0 | 1019 movwf sub_a+0 |
1038 movlw high( d'627' ) | 1020 movlw high( d'627' ) |
1039 movwf sub_a+1 | 1021 movwf sub_a+1 |
1040 rcall TFT_dive_compass_label_proc ; check if the label should be on screen | 1022 rcall TFT_dive_compass_label_proc ; check if the label should be on screen |
1043 STRCPY_TEXT_PRINT tW ; yes - print it | 1025 STRCPY_TEXT_PRINT tW ; yes - print it |
1044 dcr_10: | 1026 dcr_10: |
1045 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker | 1027 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker |
1046 | 1028 |
1047 movlw d'14' | 1029 movlw d'14' |
1048 movwf up ; up stores the width of hte label | 1030 movwf up ; cardinal width in px |
1049 movlw low( d'669' ) ; position of the label | 1031 movlw low( d'669' ) ; position of the label |
1050 movwf sub_a+0 | 1032 movwf sub_a+0 |
1051 movlw high( d'669' ) | 1033 movlw high( d'669' ) |
1052 movwf sub_a+1 | 1034 movwf sub_a+1 |
1053 rcall TFT_dive_compass_label_proc ; check if the label should be on screen | 1035 rcall TFT_dive_compass_label_proc ; check if the label should be on screen |
1055 bra dcr_11 | 1037 bra dcr_11 |
1056 STRCPY_TEXT_PRINT tNW ; yes - print it | 1038 STRCPY_TEXT_PRINT tNW ; yes - print it |
1057 dcr_11: | 1039 dcr_11: |
1058 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker | 1040 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker |
1059 | 1041 |
1060 movlw d'6' | 1042 movlw d'14' |
1061 movwf up ; up stores the width of hte label | 1043 movwf up ; cardinal width in px |
1062 movlw low( d'718' ) ; position of the label | 1044 movlw low( d'718' ) ; position of the label |
1063 movwf sub_a+0 | 1045 movwf sub_a+0 |
1064 movlw high( d'718' ) | 1046 movlw high( d'718' ) |
1065 movwf sub_a+1 | 1047 movwf sub_a+1 |
1066 rcall TFT_dive_compass_label_proc ; check if the label should be on screen | 1048 rcall TFT_dive_compass_label_proc ; check if the label should be on screen |
1119 ; do not forget to clear the right | 1101 ; do not forget to clear the right |
1120 rcall TFT_dive_compass_dir_rclr | 1102 rcall TFT_dive_compass_dir_rclr |
1121 ;bra TFT_dive_compass_text | 1103 ;bra TFT_dive_compass_text |
1122 | 1104 |
1123 TFT_dive_compass_text: | 1105 TFT_dive_compass_text: |
1106 ; Clear some unused space on the right mH | |
1107 WIN_BOX_BLACK dm_custom_compass_tick_top_bot+.1,dm_custom_compass_tick_bot_top-.1,.158,.159 ; top, bottom, left, right | |
1108 | |
1124 ; Text output | 1109 ; Text output |
1125 call TFT_standard_color | 1110 call TFT_standard_color |
1126 WIN_SMALL dm_custom_compass_head_column, dm_custom_compass_head_row | 1111 WIN_SMALL dm_custom_compass_head_column, dm_custom_compass_head_row |
1127 rcall TFT_surface_compass_heading_com ; Show "000° N" | 1112 rcall TFT_surface_compass_heading_com ; Show "000° N" |
1128 return | 1113 return |
1141 ; Input: | 1126 ; Input: |
1142 ; xHI: DD - display'a current position | 1127 ; xHI: DD - display'a current position |
1143 ; xRD: RD - ruler display offset | 1128 ; xRD: RD - ruler display offset |
1144 ; sub_a: RP - item's ruler display offset | 1129 ; sub_a: RP - item's ruler display offset |
1145 ; get the RD abck to sub_b | 1130 ; get the RD abck to sub_b |
1146 movff xHI,hi | 1131 ; movff xHI,hi ; mH |
1147 bcf print_compass_label | 1132 bcf print_compass_label |
1148 ; 1/a. check if it's viewable ? sub_a(RP) >= sub_b(RD) ? | 1133 ; 1/a. check if it's viewable ? sub_a(RP) >= sub_b(RD) ? |
1149 ; set the carry flag if sub_b(xRD) is equal to or greater than sub_a(xRP): | 1134 ; set the carry flag if sub_b(xRD) is equal to or greater than sub_a(xRP): |
1150 movff xRD+0,sub_b+0 | 1135 movff xRD+0,sub_b+0 |
1151 movff xRD+1,sub_b+1 | 1136 movff xRD+1,sub_b+1 |
1156 movff sub_c+0,xC+0 | 1141 movff sub_c+0,xC+0 |
1157 movff sub_c+1,xC+1 | 1142 movff sub_c+1,xC+1 |
1158 | 1143 |
1159 ; 1/b. check if it's viewable ? sub_a(RP)+up(width) < sub_b(RD)+160 | 1144 ; 1/b. check if it's viewable ? sub_a(RP)+up(width) < sub_b(RD)+160 |
1160 ; if already above, no need to process the rest of the labels | 1145 ; if already above, no need to process the rest of the labels |
1161 movff up,WREG ; don't worry about the width, low level call prevents overload | 1146 movff up,WREG ; take care about the width |
1162 ; movlw d'2' ; .. but still avoid thin mess on the side of the display | |
1163 addwf sub_a+0,1 | 1147 addwf sub_a+0,1 |
1164 btfsc STATUS, C | 1148 btfsc STATUS, C |
1165 incf sub_a+1 | 1149 incf sub_a+1 |
1166 | 1150 |
1167 movff xRDr+0,sub_b+0 | 1151 movff xRDr+0,sub_b+0 |
1189 movff WREG,win_top | 1173 movff WREG,win_top |
1190 movff lo,win_leftx2 | 1174 movff lo,win_leftx2 |
1191 movlw FT_SMALL | 1175 movlw FT_SMALL |
1192 movff WREG,win_font | 1176 movff WREG,win_font |
1193 ; 6. retain the new display positions | 1177 ; 6. retain the new display positions |
1194 movff hi,divB ; old-hi will be used by the c_mk : clear+marker printing | 1178 ; movff hi,divB ; old-hi will be used by the c_mk : clear+marker printing mH |
1195 movff lo,hi | 1179 movff lo,hi |
1196 movff up,WREG | 1180 movff up,WREG |
1197 addwf hi,1 | 1181 addwf hi,F |
1198 movff lo,xLO | 1182 movff lo,xLO |
1199 movff hi,xHI | 1183 movff hi,xHI |
1200 return | 1184 return |
1201 | 1185 |
1202 TFT_dive_compass_c_mk: | 1186 TFT_dive_compass_c_mk: |
1255 rcall TFT_dive_compass_mk_print_3 | 1239 rcall TFT_dive_compass_mk_print_3 |
1256 TFT_dive_compass_mk_print_2: | 1240 TFT_dive_compass_mk_print_2: |
1257 ; save hi/lo | 1241 ; save hi/lo |
1258 movff hi,divA+1 | 1242 movff hi,divA+1 |
1259 movff lo,divA+0 | 1243 movff lo,divA+0 |
1260 ; clear the middle of hte bearing marker | 1244 ; clear the middle of the bearing marker |
1261 movff lo,hi | 1245 movff lo,hi |
1262 movlw d'2' | 1246 movlw d'2' |
1263 addwf lo,1 | 1247 addwf lo,1 |
1264 rcall TFT_dive_compass_clr_label | 1248 rcall TFT_dive_compass_clr_label |
1265 ; restore hi/lo | 1249 ; restore hi/lo |
1285 movlw dm_custom_compass_label_row + .9 | 1269 movlw dm_custom_compass_label_row + .9 |
1286 movff WREG,win_top | 1270 movff WREG,win_top |
1287 movlw d'4' | 1271 movlw d'4' |
1288 movff WREG,win_height | 1272 movff WREG,win_height |
1289 TFT_dive_compass_mk_print_4: | 1273 TFT_dive_compass_mk_print_4: |
1274 banksel win_leftx2 | |
1275 movlw .158 | |
1276 cpfslt win_leftx2 | |
1277 bra TFT_dive_compass_mk_print_5 | |
1290 movlw d'2' | 1278 movlw d'2' |
1291 movff WREG,win_width | 1279 movwf win_width |
1292 movff WREG,win_bargraph | 1280 movwf win_bargraph |
1281 banksel common | |
1293 movlw color_green | 1282 movlw color_green |
1294 btfss print_compass_label | 1283 btfss print_compass_label |
1295 movlw color_red | 1284 movlw color_red |
1296 call TFT_set_color | 1285 call TFT_set_color |
1297 call TFT_box | 1286 call TFT_box |
1287 TFT_dive_compass_mk_print_5: | |
1288 banksel common | |
1298 return | 1289 return |
1299 | 1290 |
1300 TFT_dive_compass_clr_label: | 1291 TFT_dive_compass_clr_label: |
1301 return | |
1302 movlw dm_custom_compass_label_row-.2 ; set top & height | 1292 movlw dm_custom_compass_label_row-.2 ; set top & height |
1303 movff WREG,win_top | 1293 movff WREG,win_top |
1304 movlw dm_custom_compass_label_height+.2 | 1294 movlw dm_custom_compass_label_height+.2 |
1305 movff WREG,win_height | 1295 movff WREG,win_height |
1306 rcall TFT_dive_compass_clear | 1296 rcall TFT_dive_compass_clear |
1307 return | 1297 return |
1308 | 1298 |
1309 TFT_dive_compass_clr_ruler: | 1299 TFT_dive_compass_clr_ruler: |
1310 return | |
1311 ; top tick | 1300 ; top tick |
1312 movlw dm_custom_compass_tick_top_top ; set top & height | 1301 movlw dm_custom_compass_tick_top_top ; set top & height |
1313 movff WREG,win_top | 1302 movff WREG,win_top |
1314 movlw dm_custom_compass_tick_height | 1303 movlw dm_custom_compass_tick_height |
1315 movff WREG,win_height | 1304 movff WREG,win_height |
1323 ; return | 1312 ; return |
1324 TFT_dive_compass_clear: | 1313 TFT_dive_compass_clear: |
1325 ; we receive RM in lo and DD in hi | 1314 ; we receive RM in lo and DD in hi |
1326 ; calculate width = RM-D | 1315 ; calculate width = RM-D |
1327 movff hi,WREG | 1316 movff hi,WREG |
1328 subwf lo,0 | 1317 subwf lo,W |
1329 bz TFT_dive_compass_clear3 ; Do nothing if there is nothing to do | 1318 bz TFT_dive_compass_clear3 ; Do nothing if there is nothing to do |
1330 movff WREG,win_width ; RM-DD | 1319 movff WREG,win_width ; RM-DD |
1331 movff WREG,win_bargraph | 1320 movff WREG,win_bargraph |
1332 banksel win_width | 1321 banksel win_width |
1333 movlw .1 | 1322 movlw .1 |