📄 main.ls
字号:
1 ; C Compiler for STM8 (COSMIC Software)
2 ; Generator V4.2.8 - 03 Dec 2008
3 ; Optimizer V4.2.8 - 03 Dec 2008
2530 ; 46 void CLK_Init(void)
2530 ; 47 {
2532 switch .text
2533 0000 _CLK_Init:
2537 ; 49 CLK_CKDIVR &= ~0x10; /* 01: fHSI= fHSI RC output/2. */
2539 0000 721950c6 bres _CLK_CKDIVR,#4
2540 ; 53 CLK_CKDIVR = 0;
2542 0004 725f50c6 clr _CLK_CKDIVR
2543 ; 54 }
2546 0008 81 ret
2623 ; 60 void main(void)
2623 ; 61 {
2624 switch .text
2625 0009 _main:
2627 0009 5204 subw sp,#4
2628 00000004 OFST: set 4
2631 ; 62 u8 j = 0, i;
2633 000b 0f01 clr (OFST-3,sp)
2634 ; 64 int timer5s_counter = 0;
2636 000d 5f clrw x
2637 000e 1f02 ldw (OFST-2,sp),x
2638 ; 66 CLK_Init();
2640 0010 adee call _CLK_Init
2642 ; 67 TIM4_DeInit();
2644 0012 cd0000 call _TIM4_DeInit
2646 ; 70 TIM4_TimeBaseInit(TIM4_PRESCALER_128, 250);
2648 0015 ae00fa ldw x,#250
2649 0018 a607 ld a,#7
2650 001a 95 ld xh,a
2651 001b cd0000 call _TIM4_TimeBaseInit
2653 ; 71 TIM4_ITConfig(TIM4_IT_UPDATE, ENABLE);
2655 001e ae0001 ldw x,#1
2656 0021 a601 ld a,#1
2657 0023 95 ld xh,a
2658 0024 cd0000 call _TIM4_ITConfig
2660 ; 73 GPIO_Init( GPIOD, GPIO_PIN_3, GPIO_MODE_OUT_PP_LOW_FAST);
2662 0027 4bc0 push #192
2663 0029 4b08 push #8
2664 002b ae500f ldw x,#20495
2665 002e cd0000 call _GPIO_Init
2667 0031 85 popw x
2668 ; 75 LCD_Init();
2670 0032 cd0000 call _LCD_Init
2672 ; 76 enableInterrupts();
2675 0035 9a rim
2677 ; 78 TIM4_Cmd(ENABLE);
2680 0036 a601 ld a,#1
2681 0038 cd0000 call _TIM4_Cmd
2683 ; 80 LCD_Clear();
2685 003b cd0000 call _LCD_Clear
2687 ; 81 for(i = 0; i < 64; i+=16)
2689 003e 0f04 clr (OFST+0,sp)
2690 0040 L5761:
2691 ; 82 LCD_BufferDrawXDotLine(0, i, 128, LCD_SET);
2693 0040 4b02 push #2
2694 0042 4b80 push #128
2695 0044 7b06 ld a,(OFST+2,sp)
2696 0046 97 ld xl,a
2697 0047 4f clr a
2698 0048 95 ld xh,a
2699 0049 cd0000 call _LCD_BufferDrawXDotLine
2701 004c 85 popw x
2702 ; 81 for(i = 0; i < 64; i+=16)
2704 004d 7b04 ld a,(OFST+0,sp)
2705 004f ab10 add a,#16
2706 0051 6b04 ld (OFST+0,sp),a
2709 0053 a140 cp a,#64
2710 0055 25e9 jrult L5761
2711 ; 83 for(i = 0; i <129; i+=16)
2713 0057 0f04 clr (OFST+0,sp)
2714 0059 L3071:
2715 ; 84 LCD_BufferDrawYDotLine(i, 0, 63, LCD_SET);
2717 0059 4b02 push #2
2718 005b 4b3f push #63
2719 005d 5f clrw x
2720 005e 7b06 ld a,(OFST+2,sp)
2721 0060 95 ld xh,a
2722 0061 cd0000 call _LCD_BufferDrawYDotLine
2724 0064 85 popw x
2725 ; 83 for(i = 0; i <129; i+=16)
2727 0065 7b04 ld a,(OFST+0,sp)
2728 0067 ab10 add a,#16
2729 0069 6b04 ld (OFST+0,sp),a
2732 006b a181 cp a,#129
2733 006d 25ea jrult L3071
2734 ; 92 LCD_BufferDrawLine(0, 0, 31, 63, LCD_SET);
2736 006f 4b02 push #2
2737 0071 4b3f push #63
2738 0073 4b1f push #31
2739 0075 5f clrw x
2740 0076 4f clr a
2741 0077 95 ld xh,a
2742 0078 cd0000 call _LCD_BufferDrawLine
2744 007b 5b03 addw sp,#3
2745 ; 93 LCD_BufferDrawLine(31, 63, 63, 0, LCD_SET);
2747 007d 4b02 push #2
2748 007f 4b00 push #0
2749 0081 4b3f push #63
2750 0083 ae003f ldw x,#63
2751 0086 a61f ld a,#31
2752 0088 95 ld xh,a
2753 0089 cd0000 call _LCD_BufferDrawLine
2755 008c 5b03 addw sp,#3
2756 ; 94 LCD_BufferDrawLine(63, 0, 94, 63, LCD_SET);
2758 008e 4b02 push #2
2759 0090 4b3f push #63
2760 0092 4b5e push #94
2761 0094 5f clrw x
2762 0095 a63f ld a,#63
2763 0097 95 ld xh,a
2764 0098 cd0000 call _LCD_BufferDrawLine
2766 009b 5b03 addw sp,#3
2767 ; 95 LCD_BufferDrawLine(94, 63, 125, 0, LCD_SET);
2769 009d 4b02 push #2
2770 009f 4b00 push #0
2771 00a1 4b7d push #125
2772 00a3 ae003f ldw x,#63
2773 00a6 a65e ld a,#94
2774 00a8 95 ld xh,a
2775 00a9 cd0000 call _LCD_BufferDrawLine
2777 00ac 5b03 addw sp,#3
2778 ; 97 LCD_PutString5x8(22, 0, "STM8 DSO");
2780 00ae ae0031 ldw x,#L1171
2781 00b1 89 pushw x
2782 00b2 5f clrw x
2783 00b3 a616 ld a,#22
2784 00b5 95 ld xh,a
2785 00b6 cd0000 call _LCD_PutString5x8
2787 00b9 85 popw x
2788 ; 98 LCD_PutString5x8(22, 1, "By ifree");
2790 00ba ae0028 ldw x,#L3171
2791 00bd 89 pushw x
2792 00be ae0001 ldw x,#1
2793 00c1 a616 ld a,#22
2794 00c3 95 ld xh,a
2795 00c4 cd0000 call _LCD_PutString5x8
2797 00c7 85 popw x
2798 ; 99 LCD_PutString5x8(22, 2, "1000Hz");
2800 00c8 ae0021 ldw x,#L5171
2801 00cb 89 pushw x
2802 00cc ae0002 ldw x,#2
2803 00cf a616 ld a,#22
2804 00d1 95 ld xh,a
2805 00d2 cd0000 call _LCD_PutString5x8
2807 00d5 85 popw x
2808 ; 100 LCD_PutString5x8(22, 3, "5Vpp");
2810 00d6 ae001c ldw x,#L7171
2811 00d9 89 pushw x
2812 00da ae0003 ldw x,#3
2814 00dd LC002:
2815 00dd a616 ld a,#22
2816 00df 95 ld xh,a
2817 00e0 cd0000 call _LCD_PutString5x8
2818 00e3 85 popw x
2819 ; 101 LCD_BufferToLCD();
2822 00e4 L1271:
2824 00e4 cd0000 call _LCD_BufferToLCD
2825 ; 105 if(flag_10ms_ok)
2827 00e7 3d00 tnz _flag_10ms_ok
2828 00e9 27f9 jreq L1271
2829 ; 107 flag_10ms_ok = 0;
2831 00eb 3f00 clr _flag_10ms_ok
2832 ; 108 keycode = KEY_Scan();
2834 00ed cd0000 call _KEY_Scan
2836 00f0 6b04 ld (OFST+0,sp),a
2837 ; 109 if(GET_KCODE(keycode))
2839 00f2 a53f bcp a,#63
2840 00f4 2728 jreq L7271
2841 ; 111 switch(GET_KTYPE(keycode))
2843 00f6 a4c0 and a,#192
2845 ; 121 break;
2846 00f8 a040 sub a,#64
2847 00fa 270a jreq L5361
2848 00fc a040 sub a,#64
2849 00fe 270b jreq L7361
2850 0100 a040 sub a,#64
2851 0102 270c jreq L1461
2852 0104 2018 jra L7271
2853 0106 L5361:
2854 ; 113 case KTYPE_NORMAL:
2854 ; 114 LCD_PutString5x8(22, 4, "NORMAL");
2856 0106 ae0015 ldw x,#L5371
2858 ; 115 break;
2860 0109 2008 jp LC001
2861 010b L7361:
2862 ; 116 case KTYPE_LONG:
2862 ; 117 LCD_PutString5x8(22, 4, "LONG ");
2864 010b ae000e ldw x,#L7371
2866 ; 118 break;
2868 010e 2003 jp LC001
2869 0110 L1461:
2870 ; 119 case KTYPE_LIANFA:
2870 ; 120 LCD_PutString5x8(22, 4, "LIANFA");
2872 0110 ae0007 ldw x,#L1471
2874 0113 LC001:
2875 0113 89 pushw x
2876 0114 ae0004 ldw x,#4
2877 0117 a616 ld a,#22
2878 0119 95 ld xh,a
2879 011a cd0000 call _LCD_PutString5x8
2880 011d 85 popw x
2881 ; 121 break;
2883 011e L7271:
2884 ; 124 if(++timer5s_counter >= 500)
2886 011e 1e02 ldw x,(OFST-2,sp)
2887 0120 5c incw x
2888 0121 1f02 ldw (OFST-2,sp),x
2889 0123 a301f4 cpw x,#500
2890 0126 2fbc jrslt L1271
2891 ; 126 timer5s_counter = 0;
2893 0128 5f clrw x
2894 0129 1f02 ldw (OFST-2,sp),x
2895 ; 127 LCD_PutString5x8(22, 4, " ");
2897 012b ae0000 ldw x,#L5471
2898 012e 89 pushw x
2899 012f ae0004 ldw x,#4
2901 ; 130 LCD_BufferToLCD();
2904 0132 20a9 jp LC002
2927 ; 149 void assert_failed(void)
2927 ; 150 #endif
2927 ; 151 {
2928 switch .text
2929 0134 _assert_failed:
2933 0134 L7571:
2934 0134 20fe jra L7571
2967 xdef _main
2968 switch .ubsct
2969 0000 _flag_10ms_ok:
2970 0000 00 ds.b 1
2971 xdef _flag_10ms_ok
2972 0001 _flag_2ms_ok:
2973 0001 00 ds.b 1
2974 xdef _flag_2ms_ok
2975 xref _LCD_Clear
2976 xdef _CLK_Init
2977 xref _KEY_Scan
2978 xref _LCD_PutString5x8
2979 xref _LCD_BufferToLCD
2980 xref _LCD_BufferDrawYDotLine
2981 xref _LCD_BufferDrawXDotLine
2982 xref _LCD_BufferDrawLine
2983 xref _LCD_Init
2984 xref _TIM4_ITConfig
2985 xref _TIM4_Cmd
2986 xref _TIM4_TimeBaseInit
2987 xref _TIM4_DeInit
2988 xref _GPIO_Init
2989 xdef _assert_failed
2990 .const: section .text
2991 0000 L5471:
2992 0000 202020202020 dc.b " ",0
2993 0007 L1471:
2994 0007 4c49414e4641 dc.b "LIANFA",0
2995 000e L7371:
2996 000e 4c4f4e472020 dc.b "LONG ",0
2997 0015 L5371:
2998 0015 4e4f524d414c dc.b "NORMAL",0
2999 001c L7171:
3000 001c 3556707000 dc.b "5Vpp",0
3001 0021 L5171:
3002 0021 31303030487a dc.b "1000Hz",0
3003 0028 L3171:
3004 0028 427920696672 dc.b "By ifree",0
3005 0031 L1171:
3006 0031 53544d382044 dc.b "STM8 DSO",0
3026 end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -