?? main.ls
字號:
1 ; C Compiler for STM8 (COSMIC Software)
2 ; Generator V4.2.8 - 03 Dec 2008
52 ; 49 void delay_ms(u16 aa)
52 ; 50 {
54 switch .text
55 0000 _delay_ms:
57 0000 89 pushw x
58 0001 89 pushw x
59 00000002 OFST: set 2
62 0002 2014 jra L53
63 0004 L33:
64 ; 54 j=150;
66 0004 ae0096 ldw x,#150
67 0007 1f01 ldw (OFST-1,sp),x
69 0009 L54:
70 ; 55 while(j--);
72 0009 1e01 ldw x,(OFST-1,sp)
73 000b 1d0001 subw x,#1
74 000e 1f01 ldw (OFST-1,sp),x
75 0010 1c0001 addw x,#1
76 0013 a30000 cpw x,#0
77 0016 26f1 jrne L54
78 0018 L53:
79 ; 52 while(aa--)
81 0018 1e03 ldw x,(OFST+1,sp)
82 001a 1d0001 subw x,#1
83 001d 1f03 ldw (OFST+1,sp),x
84 001f 1c0001 addw x,#1
85 0022 a30000 cpw x,#0
86 0025 26dd jrne L33
87 ; 57 }
90 0027 5b04 addw sp,#4
91 0029 81 ret
125 ; 64 void delay_us(u8 aa) {while(aa--);}
126 switch .text
127 002a _delay_us:
129 002a 88 push a
130 00000000 OFST: set 0
133 002b L17:
136 002b 7b01 ld a,(OFST+1,sp)
137 002d 0a01 dec (OFST+1,sp)
138 002f 4d tnz a
139 0030 26f9 jrne L17
143 0032 84 pop a
144 0033 81 ret
168 ; 70 void lcd162a_cls(void)
168 ; 71 {
169 switch .text
170 0034 _lcd162a_cls:
174 ; 72 lcd162a_WriteCommand(0x01); //
176 0034 a601 ld a,#1
177 0036 cd00e4 call _lcd162a_WriteCommand
179 ; 73 }
182 0039 81 ret
235 ; 78 void lcd162a_LocateXY(u8 posx,u8 posy)
235 ; 79 {
236 switch .text
237 003a _lcd162a_LocateXY:
239 003a 89 pushw x
240 003b 88 push a
241 00000001 OFST: set 1
244 ; 82 if(posx==1)
246 003c 9e ld a,xh
247 003d a101 cp a,#1
248 003f 2607 jrne L331
249 ; 84 temp=0x80+posy-1;
251 0041 9f ld a,xl
252 0042 ab7f add a,#127
253 0044 6b01 ld (OFST+0,sp),a
255 0046 2006 jra L531
256 0048 L331:
257 ; 88 temp=0xC0+posy-1;
259 0048 7b03 ld a,(OFST+2,sp)
260 004a abbf add a,#191
261 004c 6b01 ld (OFST+0,sp),a
262 004e L531:
263 ; 90 lcd162a_WriteCommand(temp);
265 004e 7b01 ld a,(OFST+0,sp)
266 0050 cd00e4 call _lcd162a_WriteCommand
268 ; 101 }
271 0053 5b03 addw sp,#3
272 0055 81 ret
327 ; 106 void lcd162a_DispOneChar(u8 x,u8 y,u8 Wdata)
327 ; 107 {
328 switch .text
329 0056 _lcd162a_DispOneChar:
331 0056 89 pushw x
332 00000000 OFST: set 0
335 ; 108 lcd162a_LocateXY(x,y);
337 0057 9f ld a,xl
338 0058 97 ld xl,a
339 0059 7b01 ld a,(OFST+1,sp)
340 005b 95 ld xh,a
341 005c addc call _lcd162a_LocateXY
343 ; 109 lcd162a_WriteData(Wdata);
345 005e 7b05 ld a,(OFST+5,sp)
346 0060 cd011c call _lcd162a_WriteData
348 ; 110 }
351 0063 85 popw x
352 0064 81 ret
424 ; 113 void lcd162a_ePutstr(u8 x,u8 y,u8 *ptr)
424 ; 114 {
425 switch .text
426 0065 _lcd162a_ePutstr:
428 0065 89 pushw x
429 0066 89 pushw x
430 00000002 OFST: set 2
433 ; 115 u8 i,l=0;
435 0067 0f01 clr (OFST-1,sp)
437 0069 2002 jra L722
438 006b L322:
439 ; 119 l++;
441 006b 0c01 inc (OFST-1,sp)
442 006d L722:
443 ; 117 while (ptr[l] >31)
445 006d 7b07 ld a,(OFST+5,sp)
446 006f 97 ld xl,a
447 0070 7b08 ld a,(OFST+6,sp)
448 0072 1b01 add a,(OFST-1,sp)
449 0074 2401 jrnc L02
450 0076 5c incw x
451 0077 L02:
452 0077 02 rlwa x,a
453 0078 f6 ld a,(x)
454 0079 a120 cp a,#32
455 007b 24ee jruge L322
456 ; 122 for (i=0;i<l;i++)
459 007d 0f02 clr (OFST+0,sp)
461 007f 2028 jra L732
462 0081 L332:
463 ; 124 lcd162a_DispOneChar(x,y++,ptr[i]);
465 0081 7b07 ld a,(OFST+5,sp)
466 0083 97 ld xl,a
467 0084 7b08 ld a,(OFST+6,sp)
468 0086 1b02 add a,(OFST+0,sp)
469 0088 2401 jrnc L22
470 008a 5c incw x
471 008b L22:
472 008b 02 rlwa x,a
473 008c f6 ld a,(x)
474 008d 88 push a
475 008e 7b05 ld a,(OFST+3,sp)
476 0090 97 ld xl,a
477 0091 0c05 inc (OFST+3,sp)
478 0093 7b04 ld a,(OFST+2,sp)
479 0095 95 ld xh,a
480 0096 adbe call _lcd162a_DispOneChar
482 0098 84 pop a
483 ; 125 if ( y == 16 )
485 0099 7b04 ld a,(OFST+2,sp)
486 009b a110 cp a,#16
487 009d 2608 jrne L342
488 ; 127 y = 0;
490 009f 0f04 clr (OFST+2,sp)
491 ; 128 x ^= 1;
493 00a1 7b03 ld a,(OFST+1,sp)
494 00a3 a801 xor a, #1
495 00a5 6b03 ld (OFST+1,sp),a
496 00a7 L342:
497 ; 122 for (i=0;i<l;i++)
499 00a7 0c02 inc (OFST+0,sp)
500 00a9 L732:
503 00a9 7b02 ld a,(OFST+0,sp)
504 00ab 1101 cp a,(OFST-1,sp)
505 00ad 25d2 jrult L332
506 ; 131 }
509 00af 5b04 addw sp,#4
510 00b1 81 ret
536 ; 135 void lcd162a_Reset(void)
536 ; 136 {
537 switch .text
538 00b2 _lcd162a_Reset:
542 ; 137 lcd162a_WriteCommand(0x38); //
544 00b2 a638 ld a,#56
545 00b4 ad2e call _lcd162a_WriteCommand
547 ; 138 delay_ms(15);
549 00b6 ae000f ldw x,#15
550 00b9 cd0000 call _delay_ms
552 ; 140 lcd162a_WriteCommand(0x38); //
554 00bc a638 ld a,#56
555 00be ad24 call _lcd162a_WriteCommand
557 ; 141 delay_ms(5);
559 00c0 ae0005 ldw x,#5
560 00c3 cd0000 call _delay_ms
562 ; 143 lcd162a_WriteCommand(0x38); //
564 00c6 a638 ld a,#56
565 00c8 ad1a call _lcd162a_WriteCommand
567 ; 144 delay_ms(5);
569 00ca ae0005 ldw x,#5
570 00cd cd0000 call _delay_ms
572 ; 146 lcd162a_WriteCommand(0x38); //
574 00d0 a638 ld a,#56
575 00d2 ad10 call _lcd162a_WriteCommand
577 ; 147 lcd162a_WriteCommand(0x08); //
579 00d4 a608 ld a,#8
580 00d6 ad0c call _lcd162a_WriteCommand
582 ; 149 lcd162a_cls(); //clear device
584 00d8 cd0034 call _lcd162a_cls
586 ; 151 lcd162a_WriteCommand(0x06); //
588 00db a606 ld a,#6
589 00dd ad05 call _lcd162a_WriteCommand
591 ; 152 lcd162a_WriteCommand(0x0c); //
593 00df a60c ld a,#12
594 00e1 ad01 call _lcd162a_WriteCommand
596 ; 154 }
599 00e3 81 ret
639 ; 160 void lcd162a_WriteCommand(u8 CMD)
639 ; 161 {
640 switch .text
641 00e4 _lcd162a_WriteCommand:
643 00e4 88 push a
644 00000000 OFST: set 0
647 ; 163 LCD_BUSY();
649 00e5 ad6d call _LCD_BUSY
651 ; 165 GPIO_WriteLow(LCDCONT ,LCD162A_RS);
653 00e7 4b02 push #2
654 00e9 ae500a ldw x,#20490
655 00ec cd0000 call _GPIO_WriteLow
657 00ef 84 pop a
658 ; 166 GPIO_WriteLow(LCDCONT ,LCD162A_RW);
660 00f0 4b04 push #4
661 00f2 ae500a ldw x,#20490
662 00f5 cd0000 call _GPIO_WriteLow
664 00f8 84 pop a
665 ; 168 GPIO_WriteHigh(LCDCONT ,LCD162A_E);
667 00f9 4b08 push #8
668 00fb ae500a ldw x,#20490
669 00fe cd0000 call _GPIO_WriteHigh
671 0101 84 pop a
672 ; 169 GPIO_Write(GPIOB,CMD);
674 0102 7b01 ld a,(OFST+1,sp)
675 0104 88 push a
676 0105 ae5005 ldw x,#20485
677 0108 cd0000 call _GPIO_Write
679 010b 84 pop a
680 ; 171 delay_us(5);
682 010c a605 ld a,#5
683 010e cd002a call _delay_us
685 ; 172 GPIO_WriteLow(LCDCONT ,LCD162A_E);
687 0111 4b08 push #8
688 0113 ae500a ldw x,#20490
689 0116 cd0000 call _GPIO_WriteLow
691 0119 84 pop a
692 ; 175 }
695 011a 84 pop a
696 011b 81 ret
735 ; 183 void lcd162a_WriteData(u8 dataW)
735 ; 184 {
736 switch .text
737 011c _lcd162a_WriteData:
739 011c 88 push a
740 00000000 OFST: set 0
743 ; 186 LCD_BUSY();
745 011d ad35 call _LCD_BUSY
747 ; 188 GPIO_WriteLow(LCDCONT ,LCD162A_RW);
749 011f 4b04 push #4
750 0121 ae500a ldw x,#20490
751 0124 cd0000 call _GPIO_WriteLow
753 0127 84 pop a
754 ; 189 GPIO_WriteHigh(LCDCONT ,LCD162A_RS);
756 0128 4b02 push #2
757 012a ae500a ldw x,#20490
758 012d cd0000 call _GPIO_WriteHigh
760 0130 84 pop a
761 ; 190 GPIO_WriteHigh(LCDCONT ,LCD162A_E);
763 0131 4b08 push #8
764 0133 ae500a ldw x,#20490
765 0136 cd0000 call _GPIO_WriteHigh
767 0139 84 pop a
768 ; 193 GPIO_Write(GPIOB,dataW);
770 013a 7b01 ld a,(OFST+1,sp)
771 013c 88 push a
772 013d ae5005 ldw x,#20485
773 0140 cd0000 call _GPIO_Write
775 0143 84 pop a
776 ; 195 delay_us(1);
778 0144 a601 ld a,#1
779 0146 cd002a call _delay_us
781 ; 197 GPIO_WriteLow(LCDCONT ,LCD162A_E);
783 0149 4b08 push #8
784 014b ae500a ldw x,#20490
785 014e cd0000 call _GPIO_WriteLow
787 0151 84 pop a
788 ; 199 }
791 0152 84 pop a
792 0153 81 ret
831 ; 202 u8 LCD_BUSY(void)
831 ; 203 {
832 switch .text
833 0154 _LCD_BUSY:
835 0154 88 push a
836 00000001 OFST: set 1
839 ; 204 u8 temp=0xff;
841 0155 a6ff ld a,#255
842 0157 6b01 ld (OFST+0,sp),a
843 ; 205 GPIO_Init(PortDATA, (GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6 |GPIO_PIN_7 |GPIO_PIN_0), GPIO_MODE_IN_PU_NO_IT );
845 0159 4b40 push #64
846 015b 4bff push #255
847 015d ae5005 ldw x,#20485
848 0160 cd0000 call _GPIO_Init
850 0163 85 popw x
851 ; 207 GPIO_WriteLow(LCDCONT,LCD162A_RS);
853 0164 4b02 push #2
854 0166 ae500a ldw x,#20490
855 0169 cd0000 call _GPIO_WriteLow
857 016c 84 pop a
858 ; 208 GPIO_WriteHigh(LCDCONT,LCD162A_RW);
860 016d 4b04 push #4
861 016f ae500a ldw x,#20490
862 0172 cd0000 call _GPIO_WriteHigh
864 0175 84 pop a
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -