📄 dispfinal.lst
字号:
618 4 }
619 3 else
620 3 {
621 4 if((high_data>disp_ch_strokes[t].code_high)||\
622 4 ((high_data==disp_ch_strokes[t].code_high)&&\
623 4 (low_data>disp_ch_strokes[t].code_low)))
624 4 i=t+1;
625 4 }
626 3 }
627 2 }
628 1 return(0);
629 1 }
630 //---------------------------------------------------------
631 void getaddrone(unsigned char channel)
632 {
633 1 unsigned char data i,pow,j,t,n=0;
634 1 i=receive_buf[1]&0x0f;
635 1 if(i>=12) i-=12;
636 1 disp_lines=i;
637 1 disp_words=receive_buf[2];
638 1 start_blink=receive_buf[3];
639 1 end_blink=receive_buf[4];
640 1 for(j=5;j<29;j++)
641 1 {
642 2 if(receive_buf[j]==0)
643 2 {
644 3 address_buf[n++]=0xef;
645 3 continue;
646 3 }
647 2 else
648 2 {
649 3 if(receive_buf[j]<0x80)
650 3 address_buf[n++]=get_strokes(toupper(receive_buf[j]));
651 3 else
652 3 {
653 4 pow=get_ch_strokes(receive_buf[j],receive_buf[j+1]);
654 4 if(pow!=0)
655 4 {
656 5 j++;
657 5 address_buf[n++]=pow;
658 5 } //is internal existed chinese code
659 4 else //is not internal chinese
660 4 {
661 5 for(t=0;t<32;t++,t++)
662 5 {
663 6 if((receive_buf[j]==character_code[0][t])&&\
664 6 (receive_buf[j+1]==character_code[0][t+1])) //aready exist pregenerated code
665 6 {
666 7 j++;
667 7 address_buf[n++]=0xf0+t/2;
668 7 already=1;
669 7 break;
670 7 }
671 6 }
672 5 if(!already)
673 5 {
674 6 character_code[0][disp_count++]=receive_buf[j++];
675 6 character_code[0][disp_count]=receive_buf[j];
C51 COMPILER V6.12 DISPFINAL 09/08/2004 09:49:09 PAGE 12
676 6 address_buf[n++]=0xf0+disp_count/2;
677 6 if(++disp_count>=32) disp_count=0;
678 6 required=1;
679 6 }
680 5 already=0;
681 5 }
682 4 }
683 3 }
684 2 }
685 1 if(required)
686 1 {
687 2 write_osd_cram(channel);
688 2 required=0;
689 2 }
690 1 write_osd_vram(i,channel);
691 1 }
692 //---------------------------------------------------------
693 void getaddrtwo(unsigned char channel)
694 {
695 1 unsigned char data i,pow,j,t,n=0;
696 1 i=receive_buf[1]&0x0f;
697 1 if(i>=12) i-=12;
698 1 disp_lines=i;
699 1 disp_words=receive_buf[2];
700 1 start_blink=receive_buf[3];
701 1 end_blink=receive_buf[4];
702 1 for(j=5;j<29;j++)
703 1 {
704 2 if(receive_buf[j]==0)
705 2 {
706 3 address_buf[n++]=0xef;
707 3 continue;
708 3 }
709 2 else
710 2 {
711 3 if(receive_buf[j]<0x80)
712 3 address_buf[n++]=get_strokes(toupper(receive_buf[j]));
713 3 else
714 3 {
715 4 pow=get_ch_strokes(receive_buf[j],receive_buf[j+1]);
716 4 if(pow!=0)
717 4 {
718 5 j++;
719 5 address_buf[n++]=pow;
720 5 } //is internal existed chinese code
721 4 else //is not internal chinese
722 4 {
723 5 for(t=0;t<32;t++,t++)
724 5 {
725 6 if((receive_buf[j]==character_code[1][t])&&\
726 6 (receive_buf[j+1]==character_code[1][t+1])) //aready exist pregenerated code
727 6 {
728 7 j++;
729 7 address_buf[n++]=0xf0+t/2;
730 7 already=1;
731 7 break;
732 7 }
733 6 }
734 5 if(!already)
735 5 {
736 6 character_code[1][addr_count++]=receive_buf[j++];
737 6 character_code[1][addr_count]=receive_buf[j];
C51 COMPILER V6.12 DISPFINAL 09/08/2004 09:49:09 PAGE 13
738 6 address_buf[n++]=0xf0+addr_count/2;
739 6 if(++addr_count>=32) addr_count=0;
740 6 required=1;
741 6 }
742 5 already=0;
743 5 }
744 4 }
745 3 }
746 2 }
747 1 if(required)
748 1 {
749 2 write_osd_cram(channel);
750 2 required=0;
751 2 }
752 1 write_osd_vram(i,channel);
753 1 }
754 //---------------------------------------------------------------------
755 void disp_character(void)
756 {
757 1 unsigned char data i;
758 1 i=receive_buf[0]&0x03;
759 1 if(i==0)
760 1 {
761 2 getaddrone(0);
762 2 getaddrtwo(1);
763 2 }
764 1 if(i==1) getaddrone(0);
765 1 if(i==2) getaddrtwo(1); //-
766 1 }
767
768 //--------------------------------------------------------------------
769 void video_change(void)
770 {
771 1 unsigned char i;
772 1 i=receive_buf[0]&0x01;
773 1 if(i) k_4053c=1;
774 1 else k_4053c=0;
775 1 }
776 //----------------------------------------------------------------------
777 void release_alarm(void)
778 {
779 1 alarm=1;
780 1 }
781
782 //--------------------------------------------------------------------
783 void separate_half_date(void)
784 {
785 1 unsigned char data i=0;
786 1 address_buf[i++]=(unsigned char)(real_clock.years/1000);
787 1 address_buf[i++]=(unsigned char)(real_clock.years%1000/100);
788 1 address_buf[i++]=(unsigned char)(real_clock.years%100/10);
789 1 address_buf[i++]=(unsigned char)(real_clock.years%10);
790 1 address_buf[i++]=0xcd;
791 1 address_buf[i++]=real_clock.months/10;
792 1 address_buf[i++]=real_clock.months%10;
793 1 address_buf[i++]=0xcd;
794 1 address_buf[i++]=real_clock.dates/10;
795 1 address_buf[i++]=real_clock.dates%10;
796 1 }
797 //----------------------------------------------------------------------
798 void separate_half_time(void)
799 {
C51 COMPILER V6.12 DISPFINAL 09/08/2004 09:49:09 PAGE 14
800 1 unsigned char data i=0;
801 1 address_buf[i++]=real_clock.hours/10;
802 1 address_buf[i++]=real_clock.hours%10;
803 1 address_buf[i++]=0xe1;
804 1 address_buf[i++]=real_clock.minutes/10;
805 1 address_buf[i++]=real_clock.minutes%10;
806 1 address_buf[i++]=0xe1;
807 1 address_buf[i++]=real_clock.seconds/10;
808 1 address_buf[i++]=real_clock.seconds%10;
809 1 }
810 //---------------------------------------------------------------------------
811 void write_osd_date(void)
812 {
813 1 unsigned char data i;
814 1 separate_half_date();
815 1 while(osd_busy);
816 1 left_shift(((real_clock.date_lines>>3)&0x01)|char_position);
817 1 while(osd_busy);
818 1 left_shift((real_clock.date_lines<<5)|real_clock.date_words);
819 1 while(osd_busy);
820 1 left_shift(char_attribute);
821 1 for(i=0;i<10;i++)
822 1 {
823 2 while(osd_busy);
824 2 left_shift(address_buf[i]);
825 2 }
826 1 }
827 //---------------------------------------------------------------------------
828 void write_osd_time(void)
829 {
830 1 unsigned char data i;
831 1 separate_half_time();
832 1 while(osd_busy);
833 1 left_shift(((real_clock.time_lines>>3)&0x01)|char_position);
834 1 while(osd_busy);
835 1 left_shift((real_clock.time_lines<<5)|real_clock.time_words);
836 1 while(osd_busy);
837 1 left_shift(char_attribute);
838 1 for(i=0;i<8;i++)
839 1 {
840 2 while(osd_busy);
841 2 left_shift(address_buf[i]);
842 2 }
843 1 }
844 //--------------------------------------------------------------------
845 void clear_disp(void)
846 {
847 1 unsigned char data k,i;
848 1 k=receive_buf[0]&0x03;
849 1 oneday=1;
850 1 if(k==0)
851 1 {
852 2 osd1_cs=0;
853 2 osd2_cs=0;
854 2 for(i=0;i<32;i++){
855 3 character_code[0][i]=0;
856 3 character_code[1][i]=0;
857 3 }
858 2 addr_count=0;
859 2 disp_count=0;
860 2 }
861 1 else
C51 COMPILER V6.12 DISPFINAL 09/08/2004 09:49:09 PAGE 15
862 1 {
863 2 if(k==1) {
864 3 osd1_cs=0;
865 3 for(i=0;i<32;i++)
866 3 character_code[0][i]=0;
867 3 disp_count=0;
868 3 }
869 2 else {
870 3 osd2_cs=0;
871 3 for(i=0;i<32;i++)
872 3 character_code[1][i]=0;
873 3 addr_count=0;
874 3 }
875 2 }
876 1 while(osd_busy);
877 1 left_shift(clear_vram);
878 1 delay(1); //5 to 1 ;9.2
879 1 while(osd_busy);
880 1 left_shift(disp_control);
881 1 while(osd_busy);
882 1 {osd1_cs=1;
883 2 osd2_cs=1;}
884 1 }
885 //----------------------------------------------------------------------------
886 void timer_setup(void)
887 {
888 1 oneday=1;
889 1 real_clock.years=((receive_buf[1]&0x0f)*1000l)+(unsigned int)(receive_buf[2]&0x0f)*100\
890 1 +(receive_buf[3]&0x0f)*10+(receive_buf[4]&0x0f);
891 1 real_clock.months=(receive_buf[5]&0x0f)*10+receive_buf[6]&0x0f;
892 1 real_clock.dates=(receive_buf[7]&0x0f)*10+(receive_buf[8]&0x0f);
893 1 real_clock.hours=(receive_buf[9]&0x0f)*10+(receive_buf[10]&0x0f);
894 1 real_clock.minutes=(receive_buf[11]&0x0f)*10+(receive_buf[12]&0x0f);
895 1 real_clock.seconds=(receive_buf[13]&0x0f)*10+(receive_buf[14]&0x0f);
896 1 if(real_clock.years%4==0&&real_clock.years%100!=0||real_clock.years%400==0) leap=1;
897 1 else leap=0;
898 1 }
899 //-------------------------------------------------------------------
900 void timer_position(void)
901 {
902 1 unsigned char i;
903 1 oneday=1;
904 1 for(i=0;i<10;i++)
905 1 address_buf[i]=0xef;
906 1 osd1_cs=0;
907 1 osd2_cs=0;
908 1 while(osd_busy);
909 1 left_shift(((real_clock.date_lines>>3)&0x01)|char_position);
910 1 while(osd_busy);
911 1 left_shift((real_clock.date_lines<<5)|real_clock.date_words);
912 1 while(osd_busy);
913 1 left_shift(char_attribute);
914 1 for(i=0;i<10;i++)
915 1 {
916 2 while(osd_busy);
917 2 left_shift(address_buf[i]);
918 2 }
919 1 osd1_cs=1;
920 1 osd2_cs=1;
921 1 osd1_cs=0;
922 1 osd2_cs=0;
923 1 while(osd_busy);
C51 COMPILER V6.12 DISPFINAL 09/08/2004 09:49:09 PAGE 16
924 1 left_shift(((real_clock.time_lines>>3)&0x01)|char_position);
925 1 while(osd_busy);
926 1 left_shift((real_clock.time_lines<<5)|real_clock.time_words);
927 1 while(osd_busy);
928 1 left_shift(char_attribute);
929 1 for(i=0;i<8;i++)
930 1 {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -