annotate src/color_processor.asm @ 629:237931377539

3.07 stable release
author heinrichsweikamp
date Fri, 29 Nov 2019 18:48:11 +0100
parents cd58f7fc86db
children 4050675965ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
3 ; File File color_processor.asm combined next generation V3.03.7
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 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
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
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
62
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
63 color_proc CODE
0
heinrichsweikamp
parents:
diff changeset
64
heinrichsweikamp
parents:
diff changeset
65 ;-----------------------------------------------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
66
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
67 global color_image
0
heinrichsweikamp
parents:
diff changeset
68 color_image:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
69 tblrd*+ ; read image width (in true width / 2)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
70 movff TABLAT,win_width
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
71 tblrd*+ ; read image height
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
72 movff TABLAT,win_height
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
73 rcall get_colors ; read the colors
0
heinrichsweikamp
parents:
diff changeset
74
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
75 tstfsz encoding_format ; image encoded in version 0 format?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
76 bra color_image_1 ; NO
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
77
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
78 ; image encoding version 0 format: compute the overall number of pixels - 1 to draw
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
79 movf win_width,W ; get width into WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
80 mulwf win_height ; multiply by hight
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
81 movff PRODL,overall_pixels+0 ; store product, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
82 movff PRODH,overall_pixels+1 ; ... high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
83 clrf overall_pixels+2 ; clear upper byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
84 bcf STATUS,C ; clear carry flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
85 rlcf overall_pixels+0 ; multiply by 2 via shift left, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
86 rlcf overall_pixels+1 ; ... high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
87 rlcf overall_pixels+2 ; ... upper byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
88 clrf WREG ; decrement by 1 to ease all pixel done detection
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
89 decf overall_pixels+0,F ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
90 subwfb overall_pixels+1,F ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
91 subwfb overall_pixels+2,F ; ...
0
heinrichsweikamp
parents:
diff changeset
92
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
93 color_image_1:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
94 clrf win_width+1 ; clear width, high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
95 bcf STATUS,C ; clear carry flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
96 rlcf win_width+0 ; multiply width x 2 to get the true box width
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
97 rlcf win_width+1 ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
98 call TFT_box_write ; set output box
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
99 Index_out 0x22 ; frame memory data write start
0
heinrichsweikamp
parents:
diff changeset
100
heinrichsweikamp
parents:
diff changeset
101 color_image_loop_xy:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
102 ; prepare to read next pixel count and color
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
103 clrf pixel_count+0 ; clear number of pixels
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
104 clrf pixel_count+1 ; ...
0
heinrichsweikamp
parents:
diff changeset
105
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
106 color_image_read_byte:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
107 tblrd*+ ; get next byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
108 btfss TABLAT,7 ; high bit cleared ?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
109 bra color_image_decode_color; YES - this is a color byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
110 ;bra color_image_decode_count; NO - this is a pixel count byte
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
111
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
112 color_image_decode_count:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
113 ; decode pixel repetition count
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
114 rlcf TABLAT,F ; drop high bit
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
115 movlw .7 ; move 7 bits
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
116 color_image_decode_count_loop:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
117 rlcf TABLAT,F ; get upper bit into carry
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
118 rlcf pixel_count+0,F ; push bit into pixel count (16 bit operation)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
119 rlcf pixel_count+1,F ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
120 decfsz WREG ; decrement loop counter, all bits done?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
121 bra color_image_decode_count_loop ; NO - loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
122 bra color_image_read_byte ; YES - decode next byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
123
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
124 color_image_decode_color:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
125 ; 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
126 movlw 0x7f ; encoding for end-of-image
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
127 cpfslt TABLAT ; color index < end-of-image tag?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
128 return ; NO - done
0
heinrichsweikamp
parents:
diff changeset
129
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
130 ; get pixel color into PROD
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
131 lfsr FSR2,buffer ; set FSR2 pointer to base address of color table
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
132 rlncf TABLAT,W ; get color index * 2 into WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
133 movwf FSR2L ; adjust pointer to selected color
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
134 movff POSTINC2,PRODL ; read color, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
135 movff POSTINC2,PRODH ; read color, high byte
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
136
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
137 tstfsz encoding_format ; image encoded in version 0 format?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
138 bra color_image_pixel ; NO
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
139 ; 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
140 movf pixel_count+0,W ; YES - 24 bit subtraction, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
141 subwf overall_pixels+0,F ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
142 movf pixel_count+1,W ; ... high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
143 subwfb overall_pixels+1,F ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
144 movlw .0 ; ... upper byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
145 subwfb overall_pixels+2,F ; ...
0
heinrichsweikamp
parents:
diff changeset
146
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
147 color_image_pixel:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
148 ; prepare sending of pixels to display
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
149 infsnz pixel_count+0 ; increment pixel repetition count by 1
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
150 incf pixel_count+1 ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
151 incf pixel_count+1 ; because decrement is done first, increment high byte once more
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
152 bsf tft_rs,0 ; RS_H data
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
153 bcf INTCON,GIE ; disable global interrupts
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
154
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
155 btfsc screen_type2 ; display type 2 ?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
156 bra color_image_display2 ; YES
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
157 btfsc screen_type3 ; display type 3 ?
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
158 bra color_image_display3 ; YES
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
159
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
160 movff PRODH,PORTA ; NO - move color high byte to PORTA
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
161 movff PRODL,PORTH ; - move color low byte to PORTH
0
heinrichsweikamp
parents:
diff changeset
162
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
163 color_image_pixel1_loop:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
164 bcf tft_nwr ; toggle write signal
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
165 bsf tft_nwr ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
166 decfsz pixel_count+0 ; decrement pixel counter, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
167 bra color_image_pixel1_loop ; loop if not zero
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
168 decfsz pixel_count+1 ; decrement pixel counter, high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
169 bra color_image_pixel1_loop ; loop if not zero
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
170 bra color_image_pixel_com ; all pixels transmitted
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
171
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
172 color_image_display2:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
173 call convert_for_display2 ; convert 16 bit RGB b'RRRRRGGG GGGBBBBB'
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
174 ; into 24 bit RGB b'RRRRRR00 GGGGGG00 BBBBBB00'
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
175 color_image_pixel2_loop:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
176 movff win_color5,PORTH ; move upper byte to PORTH (DISPLAY is big endian)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
177 bcf tft_nwr ; toggle write signal
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
178 bsf tft_nwr ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
179 movff win_color4,PORTH ; move high byte to PORTH
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
180 bcf tft_nwr ; toggle write signal
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
181 bsf tft_nwr ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
182 movff win_color3,PORTH ; move low byte to PORTH
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
183 bcf tft_nwr ; toggle write signal
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
184 bsf tft_nwr ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
185 decfsz pixel_count+0 ; decrement pixel counter, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
186 bra color_image_pixel2_loop ; loop if not zero
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
187 decfsz pixel_count+1 ; decrement pixel counter, high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
188 bra color_image_pixel2_loop ; loop if not zero
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
189 bra color_image_pixel_com ; all pixels transmitted
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
190
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
191 color_image_display3:
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
192 movff PRODH,PORTH ; move color high byte to PORTH
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
193 bcf tft_nwr ; toggle write signal
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
194 bsf tft_nwr ; ...
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
195 movff PRODL,PORTH ; move color high byte to PORTH
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
196 bcf tft_nwr ; toggle write signal
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
197 bsf tft_nwr ; ...
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
198 decfsz pixel_count+0 ; decrement pixel counter, low byte
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
199 bra color_image_display3 ; loop if not zero
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
200 decfsz pixel_count+1 ; decrement pixel counter, high byte
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
201 bra color_image_display3 ; loop if not zero
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
202 ; bra color_image_pixel_com ; all pixels transmitted
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
203
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
204 color_image_pixel_com:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
205 bsf INTCON,GIE ; re-enable global interrupts
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
206
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
207 tstfsz encoding_format ; image encoded in version 0 format?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
208 bra color_image_loop_xy ; NO - loop to process next byte from image data
0
heinrichsweikamp
parents:
diff changeset
209
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
210 ; image encoding version 0 format: step counter
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
211 clrf WREG ; make a 24 bit decrement
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
212 decf overall_pixels+0 ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
213 subwfb overall_pixels+1,F ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
214 subwfb overall_pixels+2,F ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
215 bnn color_image_loop_xy ; all pixels done? NO - loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
216 return ; YES - done
0
heinrichsweikamp
parents:
diff changeset
217
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
218
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
219 global get_colors
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
220 get_colors:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
221 tblrd*+ ; read number of image colors
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
222 movff TABLAT,lo ; store in lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
223 movf lo,W
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
224 tblrd*+ ; read image encoding format
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
225 movff TABLAT,encoding_format ; store encoding format
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
226 lfsr FSR2,buffer ; set up buffer as storage for the colors
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
227 get_colors_loop:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
228 tblrd*+ ; read color from stored image, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
229 btfss use_custom_colors ; shall use custom colors?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
230 movff TABLAT,POSTINC2 ; NO - copy color read to buffer
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
231 tblrd*+ ; read color from stored image, high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
232 btfss use_custom_colors ; shall use custom colors?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
233 movff TABLAT,POSTINC2 ; NO - copy color read to buffer
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
234 decfsz WREG ; decrement loop counter, done?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
235 bra get_colors_loop ; NO - loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
236 bcf use_custom_colors ; YES - clear custom colors request
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
237 return ; - done
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
238
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
239 END