Mercurial > public > hwos_code
comparison src/tft.asm @ 648:aeca5717d9eb
3.17 / 10.72 release
author | heinrichs weikamp |
---|---|
date | Fri, 04 Mar 2022 08:29:36 +0100 |
parents | 5b7fe7777425 |
children | 75e90cd0c2c3 |
comparison
equal
deleted
inserted
replaced
647:357341239438 | 648:aeca5717d9eb |
---|---|
92 Index_out 0x22 ; frame memory data write start | 92 Index_out 0x22 ; frame memory data write start |
93 | 93 |
94 RD_H ; not read | 94 RD_H ; not read |
95 RS_H ; data | 95 RS_H ; data |
96 NCS_L ; not CS | 96 NCS_L ; not CS |
97 clrf PORTH ; data lower | 97 |
98 btfsc less_io_cpu ; less I/O CPU? | |
99 clrf PORTA ; YES, data lower | |
100 btfss less_io_cpu ; less I/O CPU? | |
101 clrf PORTH ; NO, data lower | |
98 | 102 |
99 movlw d'10' | 103 movlw d'10' |
100 movwf tft_temp3 | 104 movwf tft_temp3 |
101 TFT_ClearScreen2: | 105 TFT_ClearScreen2: |
102 movlw d'30' | 106 movlw d'30' |
105 clrf tft_temp1 ; 30*10*256=76800 pixels -> clear complete 240*320 | 109 clrf tft_temp1 ; 30*10*256=76800 pixels -> clear complete 240*320 |
106 bcf INTCON,GIE | 110 bcf INTCON,GIE |
107 TFT_ClearScreen4: | 111 TFT_ClearScreen4: |
108 WR_L | 112 WR_L |
109 WR_H ; tick | 113 WR_H ; tick |
114 btfss less_io_cpu ; less I/O CPU? | |
115 bra TFT_ClearScreen5 ; NO | |
116 WR_L | |
117 WR_H ; tick | |
118 WR_L | |
119 WR_H ; tick | |
120 WR_L | |
121 WR_H ; tick | |
122 TFT_ClearScreen5: | |
110 decfsz tft_temp1,F | 123 decfsz tft_temp1,F |
111 bra TFT_ClearScreen4 | 124 bra TFT_ClearScreen4 |
112 bsf INTCON,GIE | 125 bsf INTCON,GIE |
113 decfsz tft_temp2,F | 126 decfsz tft_temp2,F |
114 bra TFT_ClearScreen3 | 127 bra TFT_ClearScreen3 |
337 movwf TBLPTRL | 350 movwf TBLPTRL |
338 movlw HIGH display0_config_table | 351 movlw HIGH display0_config_table |
339 movwf TBLPTRH | 352 movwf TBLPTRH |
340 movlw UPPER display0_config_table | 353 movlw UPPER display0_config_table |
341 movwf TBLPTRU | 354 movwf TBLPTRU |
342 bcf screen_type1 | 355 btfss less_io_cpu ; less I/O CPU? |
356 bcf screen_type1 ; NO | |
343 | 357 |
344 TFT_boot_com: | 358 TFT_boot_com: |
345 rcall display0_init_loop | 359 rcall display0_init_loop |
346 | 360 |
347 Index_out 0x03 | 361 Index_out 0x03 |
481 RS_L ; command | 495 RS_L ; command |
482 ; btfsc screen_type2 | 496 ; btfsc screen_type2 |
483 ; bra TFT_CmdWrite_screen2 | 497 ; bra TFT_CmdWrite_screen2 |
484 clrf PORTA ; upper | 498 clrf PORTA ; upper |
485 bcf INTCON,GIE | 499 bcf INTCON,GIE |
500 btfsc less_io_cpu ; less I/O CPU? | |
501 bra TFT_CmdWrite_less_io ; YES | |
486 movwf PORTH ; lower | 502 movwf PORTH ; lower |
487 WR_L | 503 WR_L |
488 WR_H ; tick | 504 WR_H ; tick |
489 bsf INTCON,GIE | 505 bsf INTCON,GIE |
490 return | 506 return |
492 ; movwf PORTH ; lower | 508 ; movwf PORTH ; lower |
493 ; WR_L | 509 ; WR_L |
494 ; WR_H ; tick | 510 ; WR_H ; tick |
495 ; return; | 511 ; return; |
496 | 512 |
513 TFT_CmdWrite_less_io: | |
514 WR_L | |
515 WR_H ; tick | |
516 movwf PORTA ; lower | |
517 WR_L | |
518 WR_H ; tick | |
519 bsf INTCON,GIE | |
520 return | |
521 | |
497 global TFT_DataWrite | 522 global TFT_DataWrite |
498 TFT_DataWrite: | 523 TFT_DataWrite: |
499 RS_H ; data | 524 RS_H ; data |
500 ; btfsc screen_type2 | 525 ; btfsc screen_type2 |
501 ; bra TFT_DataWrite_screen2 | 526 ; bra TFT_DataWrite_screen2 |
502 bcf INTCON,GIE | 527 bcf INTCON,GIE |
528 btfsc less_io_cpu ; less I/O CPU? | |
529 bra TFT_DataWrite_less_io ; YES | |
503 movwf PORTH ; lower | 530 movwf PORTH ; lower |
504 WR_L | 531 WR_L |
505 WR_H ; tick | 532 WR_H ; tick |
506 bsf INTCON,GIE | 533 bsf INTCON,GIE |
507 return | 534 return |
508 ;TFT_DataWrite_screen2: | 535 ;TFT_DataWrite_screen2: |
509 ; movwf PORTH ; lower | 536 ; movwf PORTH ; lower |
510 ; WR_L | 537 ; WR_L |
511 ; WR_H ; tick | 538 ; WR_H ; tick |
512 ; return | 539 ; return |
540 TFT_DataWrite_less_io: | |
541 WR_L | |
542 WR_H ; tick | |
543 movwf PORTA ; lower | |
544 WR_L | |
545 WR_H ; tick | |
546 bsf INTCON,GIE | |
547 return | |
513 | 548 |
514 | 549 |
515 ;----------------------------------------------------------------------------- | 550 ;----------------------------------------------------------------------------- |
516 ; Smooth lighting-up of the display: | 551 ; Smooth lighting-up of the display: |
517 ; | 552 ; |
749 rcall TFT_DataWrite_PROD | 784 rcall TFT_DataWrite_PROD |
750 | 785 |
751 Index_out 0x22 ; frame memory data write start | 786 Index_out 0x22 ; frame memory data write start |
752 RS_H ; data | 787 RS_H ; data |
753 bcf INTCON,GIE | 788 bcf INTCON,GIE |
754 movff win_color1,PORTA ; upper | 789 movff win_color1,PORTA ; upper |
755 movff win_color2,PORTH ; lower | 790 btfsc less_io_cpu ; less I/O CPU? |
756 WR_L | 791 bra half_pixel_write_1_display1_l_io ; YES |
757 WR_H ; tick | 792 movff win_color2,PORTH ; lower |
793 WR_L | |
794 WR_H ; tick | |
758 bsf INTCON,GIE | 795 bsf INTCON,GIE |
759 return | 796 return |
760 | 797 |
798 half_pixel_write_1_display1_l_io: | |
799 WR_L | |
800 WR_H ; tick | |
801 movff win_color2,PORTA ; lower | |
802 WR_L | |
803 WR_H ; tick | |
804 bsf INTCON,GIE | |
805 return | |
806 | |
761 half_pixel_write_1_display2: | 807 half_pixel_write_1_display2: |
762 mullw 1 ; copy row to PRODL (PRODH=0) | 808 mullw 1 ; copy row to PRODL (PRODH=0) |
763 ; Row address start | 809 ; Row address start |
764 movlw 0x02 | 810 movlw 0x02 |
765 rcall TFT_CmdWrite | 811 rcall TFT_CmdWrite |
878 bra TFT_DataWrite_PROD_display2 ; YES | 924 bra TFT_DataWrite_PROD_display2 ; YES |
879 btfsc screen_type3 ; screen type 3 ? | 925 btfsc screen_type3 ; screen type 3 ? |
880 bra TFT_DataWrite_PROD_display2 ; YES | 926 bra TFT_DataWrite_PROD_display2 ; YES |
881 bcf INTCON,GIE ; NO - | 927 bcf INTCON,GIE ; NO - |
882 movff PRODH,PORTA ; - move high byte to PORTA | 928 movff PRODH,PORTA ; - move high byte to PORTA |
929 btfsc less_io_cpu ; less I/O CPU? | |
930 bra TFT_DataWrite_PROD_less_io ; YES | |
883 movff PRODL,PORTH ; - move low byte to PORTH | 931 movff PRODL,PORTH ; - move low byte to PORTH |
884 WR_L ; - tick | 932 WR_L ; - tick |
885 WR_H ; - tack | 933 WR_H ; - tack |
886 bsf INTCON,GIE ; - | 934 bsf INTCON,GIE ; - |
887 return ; - done | 935 return ; - done |
888 | 936 |
937 TFT_DataWrite_PROD_less_io: | |
938 WR_L | |
939 WR_H ; tick | |
940 movff PRODL,PORTA ; - move low byte to PORTH | |
941 WR_L ; - tick | |
942 WR_H ; - tack | |
943 bsf INTCON,GIE ; - | |
944 return ; - done | |
945 | |
889 TFT_DataWrite_PROD_display2: | 946 TFT_DataWrite_PROD_display2: |
890 movff PRODH,PORTH ; move high byte to PORTH (display 2 is big endian) | 947 movff PRODH,PORTH ; move high byte to PORTH (display 2 is big endian) |
891 WR_L ; tick | 948 WR_L ; tick |
892 WR_H ; tack | 949 WR_H ; tack |
893 movff PRODL,PORTH ; move low byte to PORTH | 950 movff PRODL,PORTH ; move low byte to PORTH |
1226 movff win_height,PRODL | 1283 movff win_height,PRODL |
1227 | 1284 |
1228 TFT_box3: ; loop width times | 1285 TFT_box3: ; loop width times |
1229 bcf INTCON,GIE | 1286 bcf INTCON,GIE |
1230 movff win_color1,PORTA ; upper | 1287 movff win_color1,PORTA ; upper |
1288 btfsc less_io_cpu ; less I/O CPU? | |
1289 bra TFT_box3_less_io ; YES | |
1231 movff win_color2,PORTH ; lower | 1290 movff win_color2,PORTH ; lower |
1232 WR_L ; tick | 1291 WR_L ; tick |
1233 WR_H ; ... | 1292 WR_H ; ... |
1234 WR_L ; tick | 1293 WR_L ; tick |
1235 WR_H ; ... | 1294 WR_H ; ... |
1252 rcall TFT_CmdWrite | 1311 rcall TFT_CmdWrite |
1253 | 1312 |
1254 ; reset bargraph mode... | 1313 ; reset bargraph mode... |
1255 setf win_bargraph | 1314 setf win_bargraph |
1256 return | 1315 return |
1316 | |
1317 TFT_box3_less_io: | |
1318 WR_L ; tick | |
1319 WR_H ; ... | |
1320 movff win_color2,PORTA ; lower | |
1321 WR_L ; tick | |
1322 WR_H ; ... | |
1323 movff win_color1,PORTA ; upper | |
1324 WR_L ; tick | |
1325 WR_H ; ... | |
1326 movff win_color2,PORTA ; lower | |
1327 WR_L ; tick | |
1328 WR_H ; ... | |
1329 bsf INTCON,GIE | |
1330 decfsz PRODL,F ; row loop finished ? | |
1331 bra TFT_box3 ; NO - continue | |
1332 | |
1333 incf PRODH,F ; column count ++ | |
1334 movf win_bargraph,W ; get width of active bargraph part | |
1335 cpfseq PRODH ; current column == end of active bargraph ? | |
1336 bra TFT_box4 ; NO - just loop | |
1337 clrf win_color1 ; YES - switch to black | |
1338 clrf win_color2 ; - ... | |
1339 bra TFT_box4 ; NO - just loop | |
1257 | 1340 |
1258 TFT_box_display2: | 1341 TFT_box_display2: |
1259 ; Screen 2 | 1342 ; Screen 2 |
1260 movff win_color1,PRODH | 1343 movff win_color1,PRODH |
1261 movff win_color2,PRODL | 1344 movff win_color2,PRODL |
1438 rrcf tft_temp4,F | 1521 rrcf tft_temp4,F |
1439 rrcf tft_temp1,F | 1522 rrcf tft_temp1,F |
1440 | 1523 |
1441 rrcf tft_temp4,F | 1524 rrcf tft_temp4,F |
1442 rrcf tft_temp1,W ; red done | 1525 rrcf tft_temp1,W ; red done |
1443 movwf win_color1 ; set color registers | 1526 ; tft_temp1 (b'RRRRRGGG') done |
1527 movwf win_color1 ; set color registers... | |
1444 return | 1528 return |
1445 | 1529 |
1446 | 1530 |
1447 global convert_for_display2 | 1531 global convert_for_display2 |
1448 convert_for_display2: ; convert 16 bit RGB b'RRRRRGGG GGGBBBBB' into 24 bit RGB b'RRRRRR00 GGGGGG00 BBBBBB00' | 1532 convert_for_display2: ; convert 16 bit RGB b'RRRRRGGG GGGBBBBB' into 24 bit RGB b'RRRRRR00 GGGGGG00 BBBBBB00' |