annotate src/color_processor.asm @ 655:c7b7b8a358cd default tip

hwOS tech 3.22 release
author heinrichsweikamp
date Mon, 29 Apr 2024 13:05:18 +0200
parents 75e90cd0c2c3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
3 ; File File color_processor.asm * combined next generation V3.09.4l
0
heinrichsweikamp
parents:
diff changeset
4 ;
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
5 ; Decompress and draw an image
0
heinrichsweikamp
parents:
diff changeset
6 ;
654
75e90cd0c2c3 hwOS sport 10.77 release
heinrichsweikamp
parents: 648
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, heinrichs weikamp gmbh, all right reserved.
0
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
heinrichsweikamp
parents:
diff changeset
10 ; 2010-12-13 : [jDG] Creation.
heinrichsweikamp
parents:
diff changeset
11 ; 2010-12-30 : [jDG] Revised to put temp into ACCESSRAM0
heinrichsweikamp
parents:
diff changeset
12 ;
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
13 ; RATIONALS: The OSTC has a nice color screen, and a std geek attitude impose
0
heinrichsweikamp
parents:
diff changeset
14 ; to show off ... ;-)
heinrichsweikamp
parents:
diff changeset
15 ;
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
16 ; Inputs TBLPTR points to the image description block.
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
17 ; win_top, win_leftx2 the Top/Leftx2 corner here to put the image.
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
18 ; Outputs None
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
19 ; Trashed TBLPTR, TABLAT, FSR2, PROD, win_width, win_height
0
heinrichsweikamp
parents:
diff changeset
20 ;
heinrichsweikamp
parents:
diff changeset
21 ; ImageBloc:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
22 ; db widthx2, height
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
23 ; db nbColors, encoding version
0
heinrichsweikamp
parents:
diff changeset
24 ; dw color0, color1, color2, color3, ...
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
25 ; db packed pixels...
0
heinrichsweikamp
parents:
diff changeset
26 ;
heinrichsweikamp
parents:
diff changeset
27 ; Limitations:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
28 ; * nbColors <= 126
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
29 ; * image width is even
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
30 ; * image left border is on even column, too
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
31 ;
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
32 ;
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
33 ; Compressed format in encoding version 0 and 1:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
34 ; ----------------------------------------------
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
35 ; - 1-3 bytes pixel repetition count, followed by 1 byte pixel color
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
36 ; - bit 7 = 1: byte holds pixel count in bits 6-0
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
37 ; - bit 7 = 0: byte holds pixel color in bits 6-0
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
38 ; - all pixel count bytes accumulate:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
39 ; - 1 byte pixel count: 1xxxxxxx -> 7 bit pixel count
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
40 ; - 2 bytes pixel count: 1yyyyyyy 1xxxxxxx -> 14 bit pixel count
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
41 ; - 3 bytes pixel count: 1zzzzzzz 1yyyyyyy 1xxxxxxx -> 21 bit pixel count
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
42 ;
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
43 ; A pixel repetition count of 0 means one single pixel will be drawn,
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
44 ; a repetition count of 1 means two pixels will be drawn, and so on.
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
45 ; The image is done when all pixels as of width x high parameters have been printed.
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
46 ;
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
47 ;
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
48 ; Compressed format in encoding version 1:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
49 ; ----------------------------------------
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
50 ; As above, but the image is done when a color index equaling 127 is encountered.
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
51 ;
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
52 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
53 ; Pixels are written column by column from left to right, with columns down first.
0
heinrichsweikamp
parents:
diff changeset
54 ;
heinrichsweikamp
parents:
diff changeset
55 ;-----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
56
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
57 #include "hwos.inc"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
58 #include "tft.inc"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
59
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
60 extern convert_for_display2
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
61
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
62 ;=============================================================================
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
63 color_proc CODE
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
64 ;=============================================================================
0
heinrichsweikamp
parents:
diff changeset
65
heinrichsweikamp
parents:
diff changeset
66 ;-----------------------------------------------------------------------------
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
67 ; Print a colored Bitmap Image
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
68 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
69 global color_image
0
heinrichsweikamp
parents:
diff changeset
70 color_image:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
71 tblrd*+ ; read image width (in true width / 2)
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
72 movff TABLAT,win_width+0 ; store in win_width, low byte
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
73 clrf win_width+1 ; clear win_width, high byte
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
74 tblrd*+ ; read image height
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
75 movff TABLAT,win_height ; store in win_height
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
76 rcall get_colors ; read the colors
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
77 tstfsz encoding_format ; image encoded in version 0 format?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
78 bra color_image_1 ; NO
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
79
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
80 ; image encoding version 0 format: compute overall number of pixels - 1
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
81 movf win_width,W ; get image width (/2) into WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
82 mulwf win_height ; multiply with image hight
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
83 movff PRODL,overall_pixels+0 ; store product, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
84 movff PRODH,overall_pixels+1 ; ... high byte
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
85 clrf overall_pixels+2 ; clear product, upper byte
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
86 bcf STATUS,C ; clear carry flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
87 rlcf overall_pixels+0 ; multiply by 2 via shift left, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
88 rlcf overall_pixels+1 ; ... high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
89 rlcf overall_pixels+2 ; ... upper byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
90 clrf WREG ; decrement by 1 to ease all pixel done detection
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
91 decf overall_pixels+0,F ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
92 subwfb overall_pixels+1,F ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
93 subwfb overall_pixels+2,F ; ...
0
heinrichsweikamp
parents:
diff changeset
94
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
95 color_image_1:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
96 bcf STATUS,C ; clear carry flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
97 rlcf win_width+0 ; multiply width x 2 to get the true box width
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
98 rlcf win_width+1 ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
99 call TFT_box_write ; set output box
654
75e90cd0c2c3 hwOS sport 10.77 release
heinrichsweikamp
parents: 648
diff changeset
100 movlw 0x22 ; frame memory data write start
75e90cd0c2c3 hwOS sport 10.77 release
heinrichsweikamp
parents: 648
diff changeset
101 btfsc screen_type4
75e90cd0c2c3 hwOS sport 10.77 release
heinrichsweikamp
parents: 648
diff changeset
102 movlw 0x2C ; Start Writing Data to GRAM (Display 4)
75e90cd0c2c3 hwOS sport 10.77 release
heinrichsweikamp
parents: 648
diff changeset
103 call TFT_CmdWrite
0
heinrichsweikamp
parents:
diff changeset
104 color_image_loop_xy:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
105 ; prepare to read next pixel count and color
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
106 clrf pixel_count+0 ; clear number of pixels
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
107 clrf pixel_count+1 ; ...
0
heinrichsweikamp
parents:
diff changeset
108
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
109 color_image_read_byte:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
110 tblrd*+ ; get next image data byte
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
111 btfss TABLAT,7 ; high bit cleared ?
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
112 bra color_image_decode_color; YES - this is color data
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
113 ;bra color_image_decode_count; NO - this is pixel count data
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
114
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
115 color_image_decode_count:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
116 ; decode pixel repetition count
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
117 rlcf TABLAT,F ; drop high bit
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
118 movlw .7 ; move 7 bits
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
119 color_image_decode_count_loop:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
120 rlcf TABLAT,F ; get upper bit into carry
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
121 rlcf pixel_count+0,F ; push bit into pixel count (16 bit operation)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
122 rlcf pixel_count+1,F ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
123 decfsz WREG ; decrement loop counter, all bits done?
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
124 bra color_image_decode_count_loop ; NO - loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
125 bra color_image_read_byte ; YES - decode next byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
126
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
127 color_image_decode_color:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
128 ; check for end-of-image tag (color index = 0x7F) -- it is assumed that no version 0 image contains 127 colors...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
129 movlw 0x7f ; encoding for end-of-image
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
130 cpfslt TABLAT ; color index < end-of-image tag?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
131 return ; NO - done
0
heinrichsweikamp
parents:
diff changeset
132
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
133 ; translate color index into pixel color
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
134 lfsr FSR2,buffer ; set FSR2 pointer to base address of color table
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
135 rlncf TABLAT,W ; get color index * 2 into WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
136 movwf FSR2L ; adjust pointer to selected color
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
137 movff POSTINC2,PRODL ; read color, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
138 movff POSTINC2,PRODH ; read color, high byte
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
139
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
140 tstfsz encoding_format ; image encoded in version 0 format?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
141 bra color_image_pixel ; NO
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
142
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
143 ; image encoding version 0 format: subtract pixel count from the overall number of pixels to do
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
144 movf pixel_count+0,W ; YES - 24 bit subtraction, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
145 subwf overall_pixels+0,F ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
146 movf pixel_count+1,W ; ... high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
147 subwfb overall_pixels+1,F ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
148 movlw .0 ; ... upper byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
149 subwfb overall_pixels+2,F ; ...
0
heinrichsweikamp
parents:
diff changeset
150
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
151 color_image_pixel:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
152 ; prepare sending the pixels to display
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
153 infsnz pixel_count+0 ; increment pixel repetition count by 1
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
154 incf pixel_count+1 ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
155 incf pixel_count+1 ; because decrement is done first, increment high byte once more
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
156 bsf tft_rs,0 ; RS_H data
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
157 bcf INTCON,GIE ; disable all interrupts
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
158
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
159 btfsc screen_type2 ; display type 2 ?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
160 bra color_image_display2 ; YES
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
161 btfsc screen_type3 ; display type 3 ?
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
162 bra color_image_display3 ; YES
648
aeca5717d9eb 3.17 / 10.72 release
heinrichs weikamp
parents: 634
diff changeset
163
654
75e90cd0c2c3 hwOS sport 10.77 release
heinrichsweikamp
parents: 648
diff changeset
164 ; Screen 0 or 1 or 4
648
aeca5717d9eb 3.17 / 10.72 release
heinrichs weikamp
parents: 634
diff changeset
165 btfsc less_io_cpu ; less I/O CPU?
aeca5717d9eb 3.17 / 10.72 release
heinrichs weikamp
parents: 634
diff changeset
166 bra color_image_pixel1_loop_less_io ; YES
aeca5717d9eb 3.17 / 10.72 release
heinrichs weikamp
parents: 634
diff changeset
167
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
168 movff PRODH,PORTA ; NO - move color high byte to PORTA
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
169 movff PRODL,PORTH ; - move color low byte to PORTH
0
heinrichsweikamp
parents:
diff changeset
170
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
171 color_image_pixel1_loop:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
172 bcf tft_nwr ; toggle write signal
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
173 bsf tft_nwr ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
174 decfsz pixel_count+0 ; decrement pixel counter, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
175 bra color_image_pixel1_loop ; loop if not zero
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
176 decfsz pixel_count+1 ; decrement pixel counter, high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
177 bra color_image_pixel1_loop ; loop if not zero
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
178 bra color_image_pixel_com ; all pixels transmitted
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
179
648
aeca5717d9eb 3.17 / 10.72 release
heinrichs weikamp
parents: 634
diff changeset
180 color_image_pixel1_loop_less_io:
aeca5717d9eb 3.17 / 10.72 release
heinrichs weikamp
parents: 634
diff changeset
181 movff PRODH,PORTA ; NO - move color high byte to PORTA
aeca5717d9eb 3.17 / 10.72 release
heinrichs weikamp
parents: 634
diff changeset
182 bcf tft_nwr ; toggle write signal
aeca5717d9eb 3.17 / 10.72 release
heinrichs weikamp
parents: 634
diff changeset
183 bsf tft_nwr ; ...
aeca5717d9eb 3.17 / 10.72 release
heinrichs weikamp
parents: 634
diff changeset
184 movff PRODL,PORTA ; - move color low byte to PORTH
aeca5717d9eb 3.17 / 10.72 release
heinrichs weikamp
parents: 634
diff changeset
185 bcf tft_nwr ; toggle write signal
aeca5717d9eb 3.17 / 10.72 release
heinrichs weikamp
parents: 634
diff changeset
186 bsf tft_nwr ; ...
aeca5717d9eb 3.17 / 10.72 release
heinrichs weikamp
parents: 634
diff changeset
187 decfsz pixel_count+0 ; decrement pixel counter, low byte
aeca5717d9eb 3.17 / 10.72 release
heinrichs weikamp
parents: 634
diff changeset
188 bra color_image_pixel1_loop_less_io ; loop if not zero
aeca5717d9eb 3.17 / 10.72 release
heinrichs weikamp
parents: 634
diff changeset
189 decfsz pixel_count+1 ; decrement pixel counter, high byte
aeca5717d9eb 3.17 / 10.72 release
heinrichs weikamp
parents: 634
diff changeset
190 bra color_image_pixel1_loop_less_io ; loop if not zero
aeca5717d9eb 3.17 / 10.72 release
heinrichs weikamp
parents: 634
diff changeset
191 bra color_image_pixel_com ; all pixels transmitted
aeca5717d9eb 3.17 / 10.72 release
heinrichs weikamp
parents: 634
diff changeset
192
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
193 color_image_display2:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
194 call convert_for_display2 ; convert 16 bit RGB b'RRRRRGGG GGGBBBBB'
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
195 ; into 24 bit RGB b'RRRRRR00 GGGGGG00 BBBBBB00'
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
196 color_image_pixel2_loop:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
197 movff win_color5,PORTH ; move upper byte to PORTH (DISPLAY is big endian)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
198 bcf tft_nwr ; toggle write signal
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
199 bsf tft_nwr ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
200 movff win_color4,PORTH ; move high byte to PORTH
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
201 bcf tft_nwr ; toggle write signal
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
202 bsf tft_nwr ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
203 movff win_color3,PORTH ; move low byte to PORTH
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
204 bcf tft_nwr ; toggle write signal
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
205 bsf tft_nwr ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
206 decfsz pixel_count+0 ; decrement pixel counter, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
207 bra color_image_pixel2_loop ; loop if not zero
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
208 decfsz pixel_count+1 ; decrement pixel counter, high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
209 bra color_image_pixel2_loop ; loop if not zero
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
210 bra color_image_pixel_com ; all pixels transmitted
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
211
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
212 color_image_display3:
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
213 movff PRODH,PORTH ; move color high byte to PORTH
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
214 bcf tft_nwr ; toggle write signal
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
215 bsf tft_nwr ; ...
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
216 movff PRODL,PORTH ; move color high byte to PORTH
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
217 bcf tft_nwr ; toggle write signal
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
218 bsf tft_nwr ; ...
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
219 decfsz pixel_count+0 ; decrement pixel counter, low byte
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
220 bra color_image_display3 ; loop if not zero
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
221 decfsz pixel_count+1 ; decrement pixel counter, high byte
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
222 bra color_image_display3 ; loop if not zero
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
223 ; bra color_image_pixel_com ; all pixels transmitted
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
224
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
225 color_image_pixel_com:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
226 bsf INTCON,GIE ; re-enable all interrupts
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
227
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
228 tstfsz encoding_format ; image encoded in version 0 format?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
229 bra color_image_loop_xy ; NO - loop to process next byte from image data
0
heinrichsweikamp
parents:
diff changeset
230
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
231 ; image encoding version 0 format: step counter
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
232 clrf WREG ; make a 24 bit decrement
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
233 decf overall_pixels+0 ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
234 subwfb overall_pixels+1,F ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
235 subwfb overall_pixels+2,F ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
236 bnn color_image_loop_xy ; all pixels done? NO - loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
237 return ; YES - done
0
heinrichsweikamp
parents:
diff changeset
238
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
239
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
240 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
241 ; Helper Function - set up Pixel-Color Look-Up Table
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
242 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
243 global get_colors
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
244 get_colors:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
245 tblrd*+ ; read number of color indexes
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
246 movf TABLAT,W ; store in lo
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
247 tblrd*+ ; read image encoding format
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
248 movff TABLAT,encoding_format ; store encoding format
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
249 lfsr FSR2,buffer ; load base address of the look-up table
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
250 get_colors_loop:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
251 tblrd*+ ; read color from stored image, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
252 btfss use_custom_colors ; shall use custom colors?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
253 movff TABLAT,POSTINC2 ; NO - copy color read to buffer
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
254 tblrd*+ ; read color from stored image, high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
255 btfss use_custom_colors ; shall use custom colors?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
256 movff TABLAT,POSTINC2 ; NO - copy color read to buffer
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
257 decfsz WREG ; decrement loop counter, done?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
258 bra get_colors_loop ; NO - loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
259 bcf use_custom_colors ; YES - clear custom colors request
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
260 return ; - done
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
261
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
262 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
263
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
264 END