annotate src/color_processor.asm @ 635:9a64914a8fca

3.10 re-release addressing some minor issues and language fixes
author heinrichsweikamp
date Thu, 07 May 2020 09:12:59 +0200
parents 4050675965ea
children aeca5717d9eb
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 ;
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
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
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
100 Index_out 0x22 ; frame memory data write start
0
heinrichsweikamp
parents:
diff changeset
101
heinrichsweikamp
parents:
diff changeset
102 color_image_loop_xy:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
103 ; prepare to read next pixel count and color
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
104 clrf pixel_count+0 ; clear number of pixels
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
105 clrf pixel_count+1 ; ...
0
heinrichsweikamp
parents:
diff changeset
106
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
107 color_image_read_byte:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
108 tblrd*+ ; get next image data byte
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
109 btfss TABLAT,7 ; high bit cleared ?
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
110 bra color_image_decode_color; YES - this is color data
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
111 ;bra color_image_decode_count; NO - this is pixel count data
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
112
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
113 color_image_decode_count:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
114 ; decode pixel repetition count
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
115 rlcf TABLAT,F ; drop high bit
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
116 movlw .7 ; move 7 bits
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
117 color_image_decode_count_loop:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
118 rlcf TABLAT,F ; get upper bit into carry
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
119 rlcf pixel_count+0,F ; push bit into pixel count (16 bit operation)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
120 rlcf pixel_count+1,F ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
121 decfsz WREG ; decrement loop counter, all bits done?
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
122 bra color_image_decode_count_loop ; NO - loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
123 bra color_image_read_byte ; YES - decode next byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
124
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
125 color_image_decode_color:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
126 ; 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
127 movlw 0x7f ; encoding for end-of-image
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
128 cpfslt TABLAT ; color index < end-of-image tag?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
129 return ; NO - done
0
heinrichsweikamp
parents:
diff changeset
130
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
131 ; translate color index into pixel color
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
132 lfsr FSR2,buffer ; set FSR2 pointer to base address of color table
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
133 rlncf TABLAT,W ; get color index * 2 into WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
134 movwf FSR2L ; adjust pointer to selected color
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
135 movff POSTINC2,PRODL ; read color, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
136 movff POSTINC2,PRODH ; read color, high byte
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
137
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
138 tstfsz encoding_format ; image encoded in version 0 format?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
139 bra color_image_pixel ; NO
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
140
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
141 ; 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
142 movf pixel_count+0,W ; YES - 24 bit subtraction, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
143 subwf overall_pixels+0,F ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
144 movf pixel_count+1,W ; ... high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
145 subwfb overall_pixels+1,F ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
146 movlw .0 ; ... upper byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
147 subwfb overall_pixels+2,F ; ...
0
heinrichsweikamp
parents:
diff changeset
148
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
149 color_image_pixel:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
150 ; prepare sending the pixels to display
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
151 infsnz pixel_count+0 ; increment pixel repetition count by 1
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
152 incf pixel_count+1 ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
153 incf pixel_count+1 ; because decrement is done first, increment high byte once more
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
154 bsf tft_rs,0 ; RS_H data
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
155 bcf INTCON,GIE ; disable all interrupts
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
156
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
157 btfsc screen_type2 ; display type 2 ?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
158 bra color_image_display2 ; YES
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
159 btfsc screen_type3 ; display type 3 ?
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
160 bra color_image_display3 ; YES
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
161
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
162 movff PRODH,PORTA ; NO - move color high byte to PORTA
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
163 movff PRODL,PORTH ; - move color low byte to PORTH
0
heinrichsweikamp
parents:
diff changeset
164
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
165 color_image_pixel1_loop:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
166 bcf tft_nwr ; toggle write signal
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
167 bsf tft_nwr ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
168 decfsz pixel_count+0 ; decrement pixel counter, low 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 decfsz pixel_count+1 ; decrement pixel counter, high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
171 bra color_image_pixel1_loop ; loop if not zero
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
172 bra color_image_pixel_com ; all pixels transmitted
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
173
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
174 color_image_display2:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
175 call convert_for_display2 ; convert 16 bit RGB b'RRRRRGGG GGGBBBBB'
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
176 ; into 24 bit RGB b'RRRRRR00 GGGGGG00 BBBBBB00'
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
177 color_image_pixel2_loop:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
178 movff win_color5,PORTH ; move upper byte to PORTH (DISPLAY is big endian)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
179 bcf tft_nwr ; toggle write signal
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
180 bsf tft_nwr ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
181 movff win_color4,PORTH ; move high byte to PORTH
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
182 bcf tft_nwr ; toggle write signal
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
183 bsf tft_nwr ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
184 movff win_color3,PORTH ; move low byte to PORTH
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
185 bcf tft_nwr ; toggle write signal
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
186 bsf tft_nwr ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
187 decfsz pixel_count+0 ; decrement pixel counter, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
188 bra color_image_pixel2_loop ; loop if not zero
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
189 decfsz pixel_count+1 ; decrement pixel counter, high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
190 bra color_image_pixel2_loop ; loop if not zero
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
191 bra color_image_pixel_com ; all pixels transmitted
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
192
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
193 color_image_display3:
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
194 movff PRODH,PORTH ; move color high byte to PORTH
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
195 bcf tft_nwr ; toggle write signal
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
196 bsf tft_nwr ; ...
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
197 movff PRODL,PORTH ; move color high byte to PORTH
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
198 bcf tft_nwr ; toggle write signal
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
199 bsf tft_nwr ; ...
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
200 decfsz pixel_count+0 ; decrement pixel counter, low 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 decfsz pixel_count+1 ; decrement pixel counter, high byte
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
203 bra color_image_display3 ; loop if not zero
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
204 ; bra color_image_pixel_com ; all pixels transmitted
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
205
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
206 color_image_pixel_com:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
207 bsf INTCON,GIE ; re-enable all interrupts
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
208
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
209 tstfsz encoding_format ; image encoded in version 0 format?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
210 bra color_image_loop_xy ; NO - loop to process next byte from image data
0
heinrichsweikamp
parents:
diff changeset
211
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
212 ; image encoding version 0 format: step counter
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
213 clrf WREG ; make a 24 bit decrement
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
214 decf overall_pixels+0 ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
215 subwfb overall_pixels+1,F ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
216 subwfb overall_pixels+2,F ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
217 bnn color_image_loop_xy ; all pixels done? NO - loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
218 return ; YES - done
0
heinrichsweikamp
parents:
diff changeset
219
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
220
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
221 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
222 ; Helper Function - set up Pixel-Color Look-Up Table
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
223 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
224 global get_colors
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
225 get_colors:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
226 tblrd*+ ; read number of color indexes
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
227 movf TABLAT,W ; store in lo
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
228 tblrd*+ ; read image encoding format
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
229 movff TABLAT,encoding_format ; store encoding format
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
230 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
231 get_colors_loop:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
232 tblrd*+ ; read color from stored image, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
233 btfss use_custom_colors ; shall use custom colors?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
234 movff TABLAT,POSTINC2 ; NO - copy color read to buffer
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
235 tblrd*+ ; read color from stored image, high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
236 btfss use_custom_colors ; shall use custom colors?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
237 movff TABLAT,POSTINC2 ; NO - copy color read to buffer
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
238 decfsz WREG ; decrement loop counter, done?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
239 bra get_colors_loop ; NO - loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
240 bcf use_custom_colors ; YES - clear custom colors request
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
241 return ; - done
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
242
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
243 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
244
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
245 END