comparison src/tft.asm @ 371:fec5eec4c8b7

fix some display issues with display1
author heinrichsweikamp
date Wed, 19 Aug 2015 16:27:00 +0200
parents 67e631aa5b8c
children 9500b2d3e32b
comparison
equal deleted inserted replaced
370:67e631aa5b8c 371:fec5eec4c8b7
531 bra half_pixel_write ; Note: Cmd 0x20 is mandatory, because 531 bra half_pixel_write ; Note: Cmd 0x20 is mandatory, because
532 ; of the autoincrement going vertical 532 ; of the autoincrement going vertical
533 533
534 global pixel_write_col320 534 global pixel_write_col320
535 pixel_write_col320: 535 pixel_write_col320:
536 btfss flip_screen ; 180° rotation? 536 btfsc screen_type ; display1?
537 bra pixel_write_noflip_H ; No 537 bra pixel_write_col320_d1 ; Yes
538 538 ; Display0
539 btfss flip_screen ; 180° rotation?
540 bra pixel_write_noflip_H ; No
541 bra pixel_write_flip_H ; Yes
542 pixel_write_col320_d1: ; Display1
543 btfsc flip_screen ; 180° rotation?
544 bra pixel_write_noflip_H ; Yes for d1
545 pixel_write_flip_H: ; Flip d0
539 movf PRODL,W ; 16bits 319 - PROD --> PROD 546 movf PRODL,W ; 16bits 319 - PROD --> PROD
540 sublw LOW(.319) ; 319-W --> W 547 sublw LOW(.319) ; 319-W --> W
541 movwf PRODL 548 movwf PRODL
542 movf PRODH,W 549 movf PRODH,W
543 btfss STATUS,C ; Borrow = /CARRY 550 btfss STATUS,C ; Borrow = /CARRY
545 sublw HIGH(.319) 552 sublw HIGH(.319)
546 movwf PRODH 553 movwf PRODH
547 554
548 pixel_write_noflip_H: 555 pixel_write_noflip_H:
549 Index_out 0x21 ; Frame Memory Vertical Address 556 Index_out 0x21 ; Frame Memory Vertical Address
550 bra TFT_DataWrite_PROD 557 bra TFT_DataWrite_PROD ; and return...
551 558
552 ;----------------------------------------------------------------------------- 559 ;-----------------------------------------------------------------------------
553 ; Writes one half-pixel at position (win_top,win_leftx2). 560 ; Writes one half-pixel at position (win_top,win_leftx2).
554 ; Inputs: win_leftx2, win_top, win_color:2 561 ; Inputs: win_leftx2, win_top, win_color:2
555 ; Trashed: WREG, PROD 562 ; Trashed: WREG, PROD
558 movff win_top,WREG ; d'0' ... d'239' 565 movff win_top,WREG ; d'0' ... d'239'
559 ; Variant with Y position in WREG. 566 ; Variant with Y position in WREG.
560 half_pixel_write_1: 567 half_pixel_write_1:
561 btfss flip_screen ; 180° rotation? 568 btfss flip_screen ; 180° rotation?
562 sublw .239 ; 239-Y --> Y 569 sublw .239 ; 239-Y --> Y
563 mullw 1 ; Copy row to PRODL (PRODH=0) 570 mullw 1 ; Copy row to PRODL (PRODH=0)
564 571 Index_out 0x20 ; Frame Memory Horizontal Address
565 Index_out 0x20 ; Frame Memory Horizontal Address
566 rcall TFT_DataWrite_PROD 572 rcall TFT_DataWrite_PROD
567 573
568 Index_out 0x22 ; Frame Memory Data Write start 574 Index_out 0x22 ; Frame Memory Data Write start
569 RS_H ; Data 575 RS_H ; Data
570 movff win_color1,PORTA ; Upper 576 movff win_color1,PORTA ; Upper
571 movff win_color2,PORTH ; Lower 577 movff win_color2,PORTH ; Lower
572 WR_L 578 WR_L
573 WR_H ; Tick 579 WR_H ; Tick
660 nop 666 nop
661 clrf TRISA ; PortA as output 667 clrf TRISA ; PortA as output
662 clrf TRISH ; PortH as output 668 clrf TRISH ; PortH as output
663 return 669 return
664 670
665
666
667 ;TFT_box_check_width:
668 ; tstfsz PRODH ; right border > 256?
669 ; bra TFT_width_check1 ; Yes
670 ; return ; No
671 ;TFT_width_check1:
672 ; movlw .1
673 ; movwf PRODH ; limit to 1
674 ; movlw .64
675 ; cpfsgt PRODL ; right border > 319?
676 ; return
677 ; movwf PRODL ; Yes, limit to 319
678 ; return
679 ;
680 ;TFT_box_check_width_left:
681 ; tstfsz PRODH ; right border > 256?
682 ; bra TFT_width_check_left1 ; Yes
683 ; return
684 ;TFT_width_check_left1:
685 ; movlw .1
686 ; movwf PRODH ; limit to 1
687 ; movlw .64
688 ; cpfsgt PRODL ; right border > 319?
689 ; return
690 ; clrf PRODL ; Yes, set to zero
691 ; clrf PRODH
692 ; return
693
694
695 ;============================================================================= 671 ;=============================================================================
696 ; Output TFT Window Address commands. 672 ; Output TFT Window Address commands.
697 ; Inputs : win_top, win_leftx2, win_height, win_width. 673 ; Inputs : win_top, win_leftx2, win_height, win_width.
698 ; Output : PortA/PortH commands. 674 ; Output : PortA/PortH commands.
699 ; Trashed: PROD 675 ; Trashed: PROD
715 btfss flip_screen ; 180° rotation? 691 btfss flip_screen ; 180° rotation?
716 bra DISP_box_flip_H ; No for d1 692 bra DISP_box_flip_H ; No for d1
717 ; Yes for d1 693 ; Yes for d1
718 TFT_box_write_16bit_win_left_com: 694 TFT_box_write_16bit_win_left_com:
719 ;---- Normal horizontal window --------------------------------------- 695 ;---- Normal horizontal window ---------------------------------------
720 ; rcall TFT_box_check_width_left ; Check the width
721 Index_out 0x52 ; Window Vertical Start Address 696 Index_out 0x52 ; Window Vertical Start Address
722 rcall TFT_DataWrite_PROD ; Output left 697 rcall TFT_DataWrite_PROD ; Output left
723 Index_out 0x21 ; Frame Memory Vertical Address 698 Index_out 0x21 ; Frame Memory Vertical Address
724 rcall TFT_DataWrite_PROD ; Output left 699 rcall TFT_DataWrite_PROD ; Output left
725 700
728 movff win_width+1,WREG 703 movff win_width+1,WREG
729 addwfc PRODH,F 704 addwfc PRODH,F
730 decf PRODL,F ; decrement result 705 decf PRODL,F ; decrement result
731 btfss STATUS,C 706 btfss STATUS,C
732 decf PRODH,F 707 decf PRODH,F
733 ; rcall TFT_box_check_width ; Check the width
734 708
735 Index_out 0x53 ; Window Vertical End Address 709 Index_out 0x53 ; Window Vertical End Address
736 rcall TFT_DataWrite_PROD 710 rcall TFT_DataWrite_PROD
737 bra DISP_box_noflip_H 711 bra DISP_box_noflip_H
738 712
745 btfss STATUS,C ; Borrow = /CARRY 719 btfss STATUS,C ; Borrow = /CARRY
746 incf WREG 720 incf WREG
747 sublw HIGH(.319) 721 sublw HIGH(.319)
748 movwf PRODH 722 movwf PRODH
749 723
750 ; rcall TFT_box_check_width ; Check the width 724 Index_out 0x53 ; Window Vertical Start Address
751
752 Index_out 0x53 ; Window Vertical Start Address
753 rcall TFT_DataWrite_PROD ; Output left 725 rcall TFT_DataWrite_PROD ; Output left
754 Index_out 0x21 ; Frame Memory Vertical Address 726 Index_out 0x21 ; Frame Memory Vertical Address
755 rcall TFT_DataWrite_PROD ; Output left 727 rcall TFT_DataWrite_PROD ; Output left
756 728
757 movff win_width+0,WREG ; 16bits PROD - width --> PROD 729 movff win_width+0,WREG ; 16bits PROD - width --> PROD
758 subwf PRODL,F ; PRODL - WREG --> PRODL 730 subwf PRODL,F ; PRODL - WREG --> PRODL
759 movff win_width+1,WREG 731 movff win_width+1,WREG
760 subwfb PRODH,F 732 subwfb PRODH,F
761 infsnz PRODL ; PROD+1 --> PROD 733 infsnz PRODL ; PROD+1 --> PROD
762 incf PRODH 734 incf PRODH
763
764 ; rcall TFT_box_check_width_left ; Check the width
765 735
766 Index_out 0x52 ; Window Vertical End Address 736 Index_out 0x52 ; Window Vertical End Address
767 rcall TFT_DataWrite_PROD 737 rcall TFT_DataWrite_PROD
768 738
769 DISP_box_noflip_H: 739 DISP_box_noflip_H: