📄 text1.lst
字号:
580 1 write_command_12864(col_12864);
581 1 write_command_12864(row_12864+6);
582 1 for(i=0;i<64;i++)
583 1 write_data_12864(0);
584 1 write_command_12864(col_12864);
585 1 write_command_12864(row_12864+7);
586 1 for(i=0;i<64;i++)
587 1 write_data_12864(0);
588 1 cs1_12864=1;
589 1 cs2_12864=0;
590 1 write_command_12864(col_12864);
591 1 write_command_12864(row_12864+6);
592 1 for(i=0;i<64;i++)
593 1 write_data_12864(0);
594 1 write_command_12864(col_12864);
595 1 write_command_12864(row_12864+7);
596 1 for(i=0;i<64;i++)
597 1 write_data_12864(0);
598 1 cs1_12864=aa;
599 1 cs2_12864=bb;
600 1 }
601
602 uint minn(uint x)
603 {
604 1 uint i;
605 1 i=x/6;
606 1 return(i*6);
607 1 }
608
609
610 uint maxn(uint x)
611 {
612 1 uint i;
613 1 i=x/6;
C51 COMPILER V7.20 TEXT1 07/15/2007 16:48:55 PAGE 11
614 1 return(i*6+6);
615 1 }
616
617
618 void outch(struct index *pz,uchar n)
619 {
620 1 uchar i,j,k,aa,bb,l;
621 1 uint min,max;
622 1 aa=cs1_12864;
623 1 bb=cs2_12864;
624 1 cs1_12864=0;
625 1 cs2_12864=1;
626 1 min=minn(n);
627 1 max=maxn(n);
628 1 l=0;
629 1 for(i=min;i<max;i++)
630 1 {
631 2 k=0;
632 2 if(i==min+4)
633 2 {
634 3 cs1_12864=1;
635 3 cs2_12864=0;
636 3 l=0;
637 3 }
638 2 write_command_12864(col_12864+16*l);
639 2 write_command_12864(row_12864+6);
640 2 for(j=0;j<16;j++)
641 2 {
642 3 if(i==n)
643 3 write_data_12864(~pz->py[i*32+(k++)]);
644 3 else
645 3 write_data_12864(pz->py[i*32+(k++)]);
646 3 }
647 2 write_command_12864(col_12864+16*l);
648 2 write_command_12864(row_12864+7);
649 2 for(j=0;j<16;j++)
650 2 {
651 3 if(i==n)
652 3 write_data_12864(~pz->py[i*32+(k++)]);
653 3 else
654 3 write_data_12864(pz->py[i*32+(k++)]);
655 3 }
656 2 l++;
657 2 }
658 1 cs1_12864=aa;
659 1 cs2_12864=bb;
660 1 }
661
662
663 void hanzi()
664 {
665 1 uchar i,k;
666 1 write_command_12864(row);
667 1 write_command_12864(col);
668 1 k=0;
669 1 for(i=0;i<16;i++)
670 1 write_data_12864(p[staren]->py[starch*32+(k++)]);
671 1 write_command_12864(row+1);
672 1 write_command_12864(col);
673 1 for(i=0;i<16;i++)
674 1 write_data_12864(p[staren]->py[starch*32+(k++)]);
675 1 }
C51 COMPILER V7.20 TEXT1 07/15/2007 16:48:55 PAGE 12
676
677 void next()
678 {
679 1 if((col-col_12864)>47)
680 1 {
681 2 if((cs1_12864==0)&&(cs2_12864==1))
682 2 {
683 3 cs1_12864=1;
684 3 cs2_12864=0;
685 3 col=col_12864;
686 3 }
687 2 else
688 2 {
689 3 col=col_12864;
690 3 row+=2;
691 3 cs1_12864=0;
692 3 cs2_12864=1;
693 3 }
694 2 }
695 1 else
696 1 col+=16;
697 1 }
698
699
700
701 main()
702 {
703 1 uchar i,j,key,input[6];
704 1 TMOD=0x01;
705 1 TH0=0x00;
706 1 TL0=0x00;
707 1 staren=0;
708 1 starch=0;
709 1 dis=0;
710 1 x=0;
711 1 state=0;
712 1 init_lcd_12864();
713 1 row=row_12864+5;
714 1 col=col_12864;
715 1 write_command_12864(row);
716 1 write_command_12864(col);
717 1 for(j=0;j<2;j++)
718 1 {
719 2 for(i=0;i<64;i++)
720 2 write_data_12864(0x80);
721 2 cs1_12864 =1;cs2_12864=0; //右屏
722 2 row=row_12864+5;
723 2 col=col_12864;
724 2 write_command_12864(row);
725 2 write_command_12864(col);
726 2 }
727 1 cs1_12864 =0;cs2_12864=1;
728 1 row=row_12864;col=col_12864;
729 1 write_command_12864(row);
730 1 write_command_12864(col);
731 1 TR0=1;
732 1 row=row_12864;
733 1 col=col_12864;
734 1 while(1)
735 1 {
736 2 key=0;
737 2 while(key==0)
C51 COMPILER V7.20 TEXT1 07/15/2007 16:48:55 PAGE 13
738 2 key=keyscan();
739 2 while(P2!=0xf0)
740 2 P2=0xf0;
741 2 if(state==0)
742 2 {
743 3 length=0;
744 3 staren=0;
745 3 input[length]=change(key);
746 3 length++;
747 3 attempt(input,length);
748 3 state=1;
749 3 out();
750 3 }
751 2 else if(state==1)
752 2 {
753 3 if(key==0x48)
754 3 {
755 4 if(staren<cx-1)
756 4 {
757 5 staren++;
758 5 qing();
759 5 out();
760 5 }
761 4 }
762 3 else if(key==0x88)
763 3 {
764 4 if(staren>0)
765 4 {
766 5 staren--;
767 5 qing();
768 5 out();
769 5 }
770 4 }
771 3 else if(key==0x12)
772 3 {
773 4 if(length>0)
774 4 length--;
775 4 qing();
776 4 staren=0;
777 4 if(length>0)
778 4 {
779 5 attempt(input,length);
780 5 out();
781 5 }
782 4 }
783 3 else if(key==0x11)
784 3 {
785 4 if(p[staren]->py!=NULL)
786 4 {
787 5 starch=0;
788 5 qing();
789 5 outch(p[staren],starch);
790 5 state=2;
791 5 }
792 4 }
793 3 else
794 3 {
795 4 staren=0;
796 4 input[length]=change(key);
797 4 length++;
798 4 attempt(input,length);
799 4 qing();
C51 COMPILER V7.20 TEXT1 07/15/2007 16:48:55 PAGE 14
800 4 out();
801 4 }
802 3 }
803 2 else if(state==2)
804 2 {
805 3 if(key==0x48)
806 3 {
807 4 starch++;
808 4 outch(p[staren],starch);
809 4 }
810 3 else if(key==0x88)
811 3 {
812 4 if(starch>0)
813 4 {
814 5 starch--;
815 5 outch(p[staren],starch);
816 5 }
817 4 }
818 3 else if(key==0x12)
819 3 {
820 4 qing();
821 4 out();
822 4 state=1;
823 4 }
824 3 else if(key==0x11)
825 3 {
826 4 hanzi();
827 4 qing();
828 4 state=0;
829 4 starch=0;
830 4 staren=0;
831 4 cx=0;
832 4 length=0;
833 4 next();
834 4 }
835 3 }
836 2 }
837 1 }
838
839
840 void iii(void) interrupt 1 using 1
841 {
842 1 x++;
843 1 if(x==8)
844 1 {
845 2 dis=~dis;
846 2 write_data_12864(dis);
847 2 row++;
848 2 write_command_12864(row);
849 2 write_command_12864(col);
850 2 write_data_12864(dis);
851 2 row--;
852 2 write_command_12864(row);
853 2 write_command_12864(col);
854 2 x=0;
855 2 }
856 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 2409 ----
CONSTANT SIZE = 35354 ----
C51 COMPILER V7.20 TEXT1 07/15/2007 16:48:55 PAGE 15
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 27 52
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -