comparison src/tft.asm @ 152:19ad15f04f60

BUGFIX: Clear Setpoint-Fallback warning when in bailout NEW: 180? display rotation option
author heinrichsweikamp
date Thu, 21 Aug 2014 10:19:03 +0200
parents 5cb177f0948a
children 31088352ee32
comparison
equal deleted inserted replaced
151:5cb177f0948a 152:19ad15f04f60
241 Index_out 0x22 ; Frame Memory Data Write start 241 Index_out 0x22 ; Frame Memory Data Write start
242 242
243 RD_H ; Not Read 243 RD_H ; Not Read
244 RS_H ; Data 244 RS_H ; Data
245 NCS_L ; Not CS 245 NCS_L ; Not CS
246 ; clrf PORTA ; Data Upper
247 clrf PORTH ; Data Lower 246 clrf PORTH ; Data Lower
248 247
249 movlw d'10' 248 movlw d'10'
250 movwf tft_temp3 249 movwf tft_temp3
251 TFT_ClearScreen2: 250 TFT_ClearScreen2:
321 movwf TBLPTRH 320 movwf TBLPTRH
322 movlw UPPER display0_config_table 321 movlw UPPER display0_config_table
323 movwf TBLPTRU 322 movwf TBLPTRU
324 rcall display0_init_loop 323 rcall display0_init_loop
325 324
325 Index_out 0x03
326 btfsc flip_screen ; 180° rotation ?
327 bra TFT_boot2 ; Yes
328 Parameter_out 0x50, 0x20
329 bra TFT_boot3
330 TFT_boot2:
331 Parameter_out 0x50, 0x10
332 TFT_boot3:
326 Index_out 0x22 333 Index_out 0x22
327 ; WAITMS d'81' ; 46 334 ; WAITMS d'81' ; 46
328 call TFT_ClearScreen 335 call TFT_ClearScreen
329 Index_out 0x07 336 Index_out 0x07
330 Parameter_out 0x01, 0x00 337 Parameter_out 0x01, 0x00
629 global TFT_box_write 636 global TFT_box_write
630 TFT_box_write: 637 TFT_box_write:
631 movff win_leftx2,WREG ; Compute left = 2*leftx2 --> PROD 638 movff win_leftx2,WREG ; Compute left = 2*leftx2 --> PROD
632 mullw 2 639 mullw 2
633 640
641 global TFT_box_write_16bit_win_left
642 TFT_box_write_16bit_win_left: ; With column in PRODL:PRODH
634 btfsc flip_screen ; 180° rotation ? 643 btfsc flip_screen ; 180° rotation ?
635 bra DISP_box_flip_H ; Yes 644 bra DISP_box_flip_H ; Yes
636 645
637 global TFT_box_write_16bit_win_left
638 TFT_box_write_16bit_win_left: ; With column in PRODL:PRODH
639 ;---- Normal horizontal window --------------------------------------- 646 ;---- Normal horizontal window ---------------------------------------
640 ; Output 0x35 left,
641 ; 0x36 right == left + width - 1.
642
643 Index_out 0x52 ; Window Vertical Start Address 647 Index_out 0x52 ; Window Vertical Start Address
644 rcall TFT_DataWrite_PROD ; Output left 648 rcall TFT_DataWrite_PROD ; Output left
645 Index_out 0x21 ; Frame Memory Vertical Address 649 Index_out 0x21 ; Frame Memory Vertical Address
646 rcall TFT_DataWrite_PROD ; Output left 650 rcall TFT_DataWrite_PROD ; Output left
647 651
657 rcall TFT_DataWrite_PROD 661 rcall TFT_DataWrite_PROD
658 bra DISP_box_noflip_H 662 bra DISP_box_noflip_H
659 663
660 ;---- Flipped horizontal window -------------------------------------- 664 ;---- Flipped horizontal window --------------------------------------
661 DISP_box_flip_H: 665 DISP_box_flip_H:
662 ; Output 0x36 flipped(left) = 319-left
663 ; 0x35 flipped(right) = 319-right = 320 - left - width
664 movf PRODL,W ; 16bits 319 - PROD --> PROD 666 movf PRODL,W ; 16bits 319 - PROD --> PROD
665 sublw LOW(.319) ; 319-W --> W 667 sublw LOW(.319) ; 319-W --> W
666 movwf PRODL 668 movwf PRODL
667 movf PRODH,W 669 movf PRODH,W
668 btfss STATUS,C ; Borrow = /CARRY 670 btfss STATUS,C ; Borrow = /CARRY
669 incf WREG 671 incf WREG
670 sublw HIGH(.319) 672 sublw HIGH(.319)
671 movwf PRODH 673 movwf PRODH
672 Index_out 0x52 ; Window Vertical Start Address 674
673 rcall TFT_DataWrite_PROD ; Output left 675 Index_out 0x53 ; Window Vertical Start Address
676 rcall TFT_DataWrite_PROD ; Output left
674 Index_out 0x21 ; Frame Memory Vertical Address 677 Index_out 0x21 ; Frame Memory Vertical Address
675 rcall TFT_DataWrite_PROD ; Output left 678 rcall TFT_DataWrite_PROD ; Output left
676 679
677 movff win_width+0,WREG ; right = left + width - 1 680 movff win_width+0,WREG ; 16bits PROD - width --> PROD
678 addwf PRODL,F 681 subwf PRODL,F ; PRODL - WREG --> PRODL
679 movff win_width+1,WREG 682 movff win_width+1,WREG
680 addwfc PRODH,F 683 subwfb PRODH,F
681 decf PRODL,F ; decrement result 684 infsnz PRODL ; PROD+1 --> PROD
682 btfss STATUS,C 685 incf PRODH
683 decf PRODH,F 686
684 687 Index_out 0x52 ; Window Vertical End Address
685 Index_out 0x53 ; Window Vertical End Address
686 rcall TFT_DataWrite_PROD 688 rcall TFT_DataWrite_PROD
687 689
688 DISP_box_noflip_H: 690 DISP_box_noflip_H:
689 btfss flip_screen ; 180° rotation ? 691 btfss flip_screen ; 180° rotation ?
690 bra TFT_box_flip_V ; Yes. 692 bra TFT_box_noflip_V ; No.
691 693
692 ;---- Normal vertical window ----------------------------------------- 694 ;---- Flipped vertical window -----------------------------------------
693 movff win_top,PRODL ; Second byte 695 movff win_top,PRODH ; top --> PRODH (first byte)
694 movff win_height,WREG 696 movff win_height,WREG
695 addwf PRODL,W 697 addwf PRODH,W
696 movwf PRODH ; First byte 698 decf WREG
697 699 movwf PRODL ; top+height-1 --> PRODL (second byte)
698 700
699 Index_out 0x50 ; Window Horizontal Start Address 701 Index_out 0x50 ; Window Horizontal Start Address
700 clrf PORTA ; Upper
701 movf PRODH,W 702 movf PRODH,W
702 rcall TFT_DataWrite ; Lower (and tick) 703 rcall TFT_DataWrite ; Lower (and tick)
703 704
704 Index_out 0x51 ; Window Horizontal End Address 705 Index_out 0x51 ; Window Horizontal End Address
705 clrf PORTA ; Upper
706 movf PRODL,W 706 movf PRODL,W
707 rcall TFT_DataWrite ; Lower (and tick) 707 rcall TFT_DataWrite ; Lower (and tick)
708 708
709 Index_out 0x20 ; Frame Memory Horizontal Address 709 Index_out 0x20 ; Frame Memory Horizontal Address
710 clrf PORTA ; Upper 710 movf PRODH,W
711 movf PRODL,W
712 rcall TFT_DataWrite ; Lower (and tick) 711 rcall TFT_DataWrite ; Lower (and tick)
713 return 712 return
714 713
715 714
716 TFT_box_flip_V: 715 TFT_box_noflip_V:
717 ;---- Flipped vertical window ---------------------------------------- 716 ;---- Normal vertical window ----------------------------------------
718 ; Output 0x37 flipped(bottom) = 239-bottom = 240 - top - height
719 ; flipped(top) = 239-top
720 movff win_top,PRODL 717 movff win_top,PRODL
721 movff win_height,WREG 718 movff win_height,WREG
722 addwf PRODL,W 719 addwf PRODL,W
723 sublw .240 ; 240 - top - height 720 sublw .240 ; 240 - top - height
724 movwf PRODH ; First byte 721 movwf PRODH ; First byte
726 movf PRODL,W 723 movf PRODL,W
727 sublw .239 ; 239-top 724 sublw .239 ; 239-top
728 movwf PRODL ; --> second byte. 725 movwf PRODL ; --> second byte.
729 726
730 Index_out 0x50 ; Window Horizontal Start Address 727 Index_out 0x50 ; Window Horizontal Start Address
731 clrf PORTA ; Upper
732 movf PRODH,W 728 movf PRODH,W
733 rcall TFT_DataWrite ; Lower (and tick) 729 rcall TFT_DataWrite ; Lower (and tick)
734 730
735 Index_out 0x51 ; Window Horizontal End Address 731 Index_out 0x51 ; Window Horizontal End Address
736 clrf PORTA ; Upper
737 movf PRODL,W 732 movf PRODL,W
738 rcall TFT_DataWrite ; Lower (and tick) 733 rcall TFT_DataWrite ; Lower (and tick)
739 734
740 Index_out 0x20 ; Frame Memory Horizontal Address 735 Index_out 0x20 ; Frame Memory Horizontal Address
741 clrf PORTA ; Upper
742 movf PRODL,W 736 movf PRODL,W
743 rcall TFT_DataWrite ; Lower (and tick) 737 rcall TFT_DataWrite ; Lower (and tick)
744 return 738 return
745 739
746 740