Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/display_lowlevel.asm @ 705:55983c4d6b2d
aa fonts processor
author | heinrichsweikamp |
---|---|
date | Mon, 15 Apr 2013 21:13:14 +0200 |
parents | 59e5998931d3 |
children | d68c6a6b1f38 |
rev | line source |
---|---|
681 | 1 ; OSTC - diving computer code |
2 ; Copyright (C) 2009 HeinrichsWeikamp GbR | |
3 | |
4 ; This program is free software: you can redistribute it and/or modify | |
5 ; it under the terms of the GNU General Public License as published by | |
6 ; the Free Software Foundation, either version 3 of the License, or | |
7 ; (at your option) any later version. | |
8 | |
9 ; This program is distributed in the hope that it will be useful, | |
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 ; GNU General Public License for more details. | |
13 | |
14 ; You should have received a copy of the GNU General Public License | |
15 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | |
17 | |
18 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | |
19 ; written: 090801 | |
20 ; History: | |
21 ; 2009-08-30: [MH] last updated. | |
22 ; 2011-01-07: [jDG] Added flip_screen option | |
23 ; known bugs: pixel-write (loogbok curves) not done yet... | |
24 ; ToDo: | |
25 | |
26 WIN_FONT macro win_font_input | |
27 movlw win_font_input | |
28 movff WREG,win_font | |
29 endm | |
30 | |
31 WIN_TOP macro win_top_input | |
32 movlw win_top_input | |
33 movff WREG,win_top | |
34 endm | |
35 | |
36 WIN_LEFT macro win_left_input | |
37 movlw win_left_input | |
38 movff WREG,win_leftx2 | |
39 endm | |
40 | |
41 WIN_INVERT macro win_invert_input | |
42 movlw win_invert_input | |
43 movff WREG,win_invert | |
44 endm | |
45 | |
46 WIN_COLOR macro win_color_input | |
47 movlw win_color_input | |
48 call DISP_set_color | |
49 endm | |
50 | |
51 ;============================================================================= | |
52 | |
53 word_processor: ; word_processor: | |
54 clrf POSTINC2 ; Required, to mark end of string. | |
55 call aa_wordprocessor | |
56 movlb b'00000001' ; Back to Rambank1 | |
57 return | |
58 | |
59 ;============================================================================= | |
60 ; Macro to provides our own interface code. | |
61 ; | |
62 PIXEL_WRITE macro colRegister, rowRegister | |
63 movff colRegister,win_leftx2 | |
64 movff rowRegister,win_top | |
65 call pixel_write | |
66 endm | |
67 | |
68 INIT_PIXEL_WROTE macro colRegister | |
69 movff colRegister,win_leftx2 | |
70 call init_pixel_write | |
71 endm | |
72 | |
73 HALF_PIXEL_WRITE macro rowRegister | |
74 movff rowRegister,win_top | |
75 call half_pixel_write | |
76 endm | |
77 | |
78 ;----------------------------------------------------------------------------- | |
79 ; Init for half_pixel_write | |
80 ; Set column register on DISPLAY device, and current color. | |
81 ; Inputs: win_leftx2 | |
82 ; Outputs: win_color:2 | |
83 ; Trashed: WREG, PROD | |
84 init_pixel_write: | |
85 movff win_leftx2,WREG | |
86 mullw 2 | |
87 rcall pixel_write_col320 ; Start Address Vertical (.0 - .319) | |
88 goto DISP_standard_color | |
89 | |
90 ;----------------------------------------------------------------------------- | |
91 ; Writes two half-pixels at position (win_top,win_leftx2) | |
92 ; Inputs: win_leftx2, win_top, win_color:2 | |
93 ; Trashed: WREG, PROD | |
94 pixel_write: | |
95 movff win_leftx2,WREG | |
96 mullw 2 | |
97 rcall pixel_write_col320 ; Start Address Vertical (.0 - .319) | |
98 rcall half_pixel_write ; Write this half-one. | |
99 | |
100 movff win_leftx2,WREG ; Address of next one | |
101 mullw 2 | |
102 infsnz PRODL ; +1 | |
103 incf PRODH | |
104 rcall pixel_write_col320 | |
105 bra half_pixel_write ; Note: Cmd 0x20 is mandatory, because | |
106 ; of the autoincrement going vertical | |
107 | |
108 ;---- Do the 16bit 319-X-->X, if needed, and send to DISPLAY ------------ | |
109 pixel_write_col320: | |
110 movff win_flags,WREG ; BEWARE: bank0 bit-test | |
684 | 111 btfsc WREG,1 ; Display1 |
112 bra pixel_write_noflip_H_display1 ; Yes. | |
681 | 113 btfss WREG,0 ; 180° rotation ? |
114 bra pixel_write_noflip_H | |
115 | |
116 movf PRODL,W ; 16bits 319 - PROD --> PROD | |
117 sublw LOW(.319) ; 319-W --> W | |
118 movwf PRODL | |
119 movf PRODH,W | |
120 btfss STATUS,C ; Borrow = /CARRY | |
121 incf WREG | |
122 sublw HIGH(.319) | |
123 movwf PRODH | |
124 | |
125 pixel_write_noflip_H: | |
126 movlw 0x21 ; Start Address Vertical (.0 - .319) | |
127 rcall DISP_CmdWrite | |
684 | 128 bra DISP_DataWrite_PROD ; And return... |
129 | |
130 pixel_write_noflip_H_display1: | |
131 movlw 0x06 | |
132 rcall DISP_CmdWrite | |
133 movf PRODH,W | |
134 rcall DISP_DataWrite | |
135 movlw 0x07 | |
136 rcall DISP_CmdWrite | |
137 movf PRODL,W | |
138 rcall DISP_DataWrite | |
681 | 139 |
684 | 140 incf PRODL,F |
141 movlw .0 | |
142 addwfc PRODH,F ;+1 | |
143 | |
144 movlw 0x08 | |
145 rcall DISP_CmdWrite | |
146 movf PRODH,W | |
147 rcall DISP_DataWrite | |
148 movlw 0x09 | |
149 rcall DISP_CmdWrite | |
150 movf PRODL,W | |
151 bra DISP_DataWrite ; And return... | |
152 | |
153 | |
681 | 154 ;----------------------------------------------------------------------------- |
155 ; Writes a vertical line of half-pixel at position (win_top,win_leftx2,win_height). | |
156 ; Inputs: win_leftx2, win_top, win_height, win_color:2 | |
157 ; Trashed: WREG, PROD, TABLAT, TBLPTRL | |
158 half_vertical_line: | |
159 clrf TABLAT ; Loop index. | |
160 | |
161 half_vertical_line_loop: | |
162 movff win_leftx2,WREG ; Init X position. | |
163 mullw 2 | |
164 movf TABLAT,W ; Get loop index | |
165 andlw 1 ; Just low bit | |
166 xorwf PRODL,F ; And use it to jitter current X position | |
167 rcall pixel_write_col320 ; Start Address Vertical (.0 - .319) | |
168 | |
169 movff win_height,WREG ; Index reached height (Bank0 read) ? | |
170 xorwf TABLAT,W | |
171 btfsc STATUS,Z ; Equals ? | |
172 return ; Yes: done. | |
173 movff win_top,WREG ; Y = top + index (Bank0 read) | |
174 addwf TABLAT,W | |
175 rcall half_pixel_write_1 | |
176 incf TABLAT,F ; index++ | |
177 bra half_vertical_line_loop | |
178 | |
179 ;----------------------------------------------------------------------------- | |
180 ; Writes one half-pixel at position (win_top,win_leftx2). | |
181 ; Inputs: win_leftx2, win_top, win_color:2 | |
182 ; Trashed: WREG, PROD | |
183 half_pixel_write: | |
184 movff win_top,WREG ; d'0' ... d'239' | |
185 ; Variant with Y position in WREG. | |
186 half_pixel_write_1: | |
684 | 187 movff win_flags,PRODL ; Display1? win_flags is in bank0... |
188 btfsc PRODL,1 | |
189 bra half_pixel_write_1_display1 ; Yes. | |
190 | |
681 | 191 btfsc PRODL,0 ; 180° rotation ? |
192 sublw .239 ; 239-Y --> Y | |
684 | 193 mullw 1 ; Copy row to PRODL (PRODH=0) |
681 | 194 |
195 movlw 0x20 ; Horizontal Address START:END | |
196 rcall DISP_CmdWrite | |
197 rcall DISP_DataWrite_PROD | |
198 | |
199 movlw 0x22 ; Start Writing Data to GRAM | |
200 rcall DISP_CmdWrite | |
684 | 201 bsf DISPLAY_rs ; Data! |
681 | 202 movff win_color1, PORTD |
203 bcf DISPLAY_rw | |
684 | 204 bsf DISPLAY_rw ; Upper |
681 | 205 movff win_color2, PORTD |
206 bcf DISPLAY_rw | |
684 | 207 bsf DISPLAY_rw ; Lower |
208 return ; Done. | |
209 | |
210 half_pixel_write_1_display1: | |
211 mullw 1 ; Copy row to PRODL (PRODH=0) | |
212 ; Row address start | |
213 movlw 0x02 | |
214 rcall DISP_CmdWrite | |
215 movlw .0 | |
216 rcall DISP_DataWrite | |
217 movlw 0x03 | |
218 rcall DISP_CmdWrite | |
219 movf PRODL,W | |
220 rcall DISP_DataWrite | |
221 | |
222 incf PRODL,F | |
223 | |
224 movlw 0x04 | |
225 rcall DISP_CmdWrite | |
226 movlw .0 | |
227 rcall DISP_DataWrite | |
228 movlw 0x05 | |
229 rcall DISP_CmdWrite | |
230 movf PRODL,W | |
231 rcall DISP_DataWrite | |
232 | |
233 movlw 0x22 ; Start Writing Data to GRAM | |
234 rcall DISP_CmdWrite | |
235 bsf DISPLAY_rs ; Data! | |
236 movff win_color1, PORTD | |
237 bcf DISPLAY_rw | |
238 bsf DISPLAY_rw ; Upper | |
239 movff win_color2, PORTD | |
240 bcf DISPLAY_rw | |
241 bsf DISPLAY_rw ; High | |
681 | 242 movff win_color3, PORTD |
243 bcf DISPLAY_rw | |
684 | 244 bsf DISPLAY_rw ; Lower |
681 | 245 return |
246 | |
684 | 247 |
681 | 248 ; ----------------------------- |
249 ; DISP Display Off | |
250 ; ----------------------------- | |
251 DISP_DisplayOff: | |
252 clrf PORTD | |
253 bcf DISPLAY_hv | |
254 bcf DISPLAY_vdd | |
255 bcf DISPLAY_cs | |
256 bcf DISPLAY_e_nwr | |
257 bcf DISPLAY_rw | |
693 | 258 bcf DISPLAY_rs |
681 | 259 bcf DISPLAY_nreset |
260 return | |
261 | |
262 ;============================================================================= | |
263 ; Fast macros to write to DISPLAY display. | |
264 ; Adding a call/return adds 3 words and a pipeline flush, hence make it | |
265 ; nearly twice slower... | |
266 ; | |
267 ; Input : commande as macro parameter. | |
268 ; Output : NONE | |
269 ; Trash : WREG | |
270 ; | |
271 AA_CMD_WRITE macro cmd | |
272 movlw cmd | |
273 rcall DISP_CmdWrite ; slow but saves a lot of bytes in flash | |
274 endm | |
275 ; | |
276 ; Input : data as macro parameter. | |
277 ; Output : NONE | |
278 ; Trash : WREG | |
279 ; | |
280 AA_DATA_WRITE macro data | |
281 movlw data | |
282 rcall DISP_DataWrite | |
283 endm | |
284 ; | |
285 ; Input : PRODH:L as 16bits data. | |
286 ; Output : NONE | |
287 ; Trash : NONE | |
288 ; | |
289 AA_DATA_WRITE_PROD macro | |
290 rcall DISP_DataWrite_PROD ; slow but saves a lot of bytes in flash | |
291 endm | |
292 | |
293 ;============================================================================= | |
294 ; Output DISPLAY Window Address commands. | |
295 ; Inputs : win_top, win_leftx2, win_height, aa_width. | |
296 ; Output : PortD commands. | |
297 ; Trashed: PROD | |
298 ; | |
299 DISP_box_write: | |
300 movff win_flags,WREG ; Display1? win_flags is in bank0... | |
301 btfsc WREG,1 ; Display1? | |
302 bra DISP_box_write_display1 ; Yes | |
303 | |
304 movff win_leftx2,WREG ; Compute left = 2*leftx2 --> PROD | |
305 mullw 2 | |
306 | |
307 movff win_flags,WREG ; BEWARE: bank0 bit-test | |
308 btfsc WREG,0 ; 180° rotation ? | |
309 bra DISP_box_flip_H ; YES: | |
310 | |
311 ;---- Normal horizontal window --------------------------------------- | |
312 ; Output 0x35 left, | |
313 ; 0x36 right == left + width - 1. | |
314 AA_CMD_WRITE 0x35 ; this is the left border | |
315 AA_DATA_WRITE_PROD ; Output left | |
316 AA_CMD_WRITE 0x21 ; Also the horizontal first pix coord. | |
317 AA_DATA_WRITE_PROD | |
318 | |
319 movf aa_width+0,W,ACCESS ; right = left + width - 1 | |
320 addwf PRODL,F | |
321 movf aa_width+1,W,ACCESS | |
322 addwfc PRODH,F | |
323 decf PRODL,F,A ; decrement result | |
324 btfss STATUS,C | |
325 decf PRODH,F,A | |
326 | |
327 AA_CMD_WRITE 0x36 ; Write and the right border | |
328 AA_DATA_WRITE_PROD | |
329 | |
330 bra DISP_box_noflip_H | |
331 | |
332 ;---- Flipped horizontal window -------------------------------------- | |
333 DISP_box_flip_H: | |
334 ; Output 0x36 flipped(left) = 319-left | |
335 ; 0x35 flipped(right) = 319-right = 320 - left - width | |
336 movf PRODL,W ; 16bits 319 - PROD --> PROD | |
337 sublw LOW(.319) ; 319-W --> W | |
338 movwf PRODL | |
339 movf PRODH,W | |
340 btfss STATUS,C ; Borrow = /CARRY | |
341 incf WREG | |
342 sublw HIGH(.319) | |
343 movwf PRODH | |
344 AA_CMD_WRITE 0x36 ; this is the left border | |
345 AA_DATA_WRITE_PROD ; Output left | |
346 AA_CMD_WRITE 0x21 | |
347 AA_DATA_WRITE_PROD | |
348 | |
349 movf aa_width+0,W ; 16bits PROD - width --> PROD | |
350 subwf PRODL,F ; PRODL - WREG --> PRODL | |
351 movf aa_width+1,W | |
352 subwfb PRODH,F | |
353 infsnz PRODL ; PROD+1 --> PROD | |
354 incf PRODH | |
355 AA_CMD_WRITE 0x35 ; this is the left border | |
356 AA_DATA_WRITE_PROD ; Output left | |
357 | |
358 DISP_box_noflip_H: | |
359 movff win_flags,WREG ; BEWARE: bank0 bit-test | |
360 btfsc WREG,0 ; 180° rotation ? | |
361 bra DISP_box_flip_V | |
362 | |
363 ;---- Normal vertical window ----------------------------------------- | |
364 ; Output 0x37 (top) (bottom) | |
365 movff win_top,PRODH ; top --> PRODH (first byte) | |
366 movff win_height,WREG | |
367 addwf PRODH,W | |
368 decf WREG | |
369 movwf PRODL ; top+height-1 --> PRODL (second byte) | |
370 | |
371 AA_CMD_WRITE 0x37 | |
372 AA_DATA_WRITE_PROD | |
373 | |
374 movff PRODH,PRODL | |
375 clrf PRODH ; Start pixel V coord == top. | |
376 AA_CMD_WRITE 0x20 | |
377 AA_DATA_WRITE_PROD | |
378 | |
379 return | |
380 | |
381 ;---- Flipped vertical window ---------------------------------------- | |
382 ; Output 0x37 flipped(bottom) = 239-bottom = 240 - top - height | |
383 ; flipped(top) = 239-top | |
384 DISP_box_flip_V: | |
385 movff win_top,PRODL | |
386 movff win_height,WREG | |
387 addwf PRODL,W | |
388 sublw .240 ; 240 - top - height | |
389 movwf PRODH ; First byte | |
390 | |
391 movf PRODL,W | |
392 sublw .239 ; 249-top | |
393 movwf PRODL ; --> second byte. | |
394 | |
395 AA_CMD_WRITE 0x37 | |
396 AA_DATA_WRITE_PROD | |
397 | |
398 clrf PRODH ; Start pixel V coord. | |
399 AA_CMD_WRITE 0x20 | |
400 AA_DATA_WRITE_PROD | |
401 | |
402 return | |
403 | |
404 DISP_box_write_display1: | |
405 movff win_leftx2,WREG ; Compute left = 2*leftx2 --> PROD | |
406 mullw 2 | |
407 | |
408 movlw 0x06 | |
409 rcall DISP_CmdWrite | |
410 movf PRODH,W | |
411 rcall DISP_DataWrite | |
412 movlw 0x07 | |
413 rcall DISP_CmdWrite | |
414 movf PRODL,W | |
415 rcall DISP_DataWrite | |
416 | |
417 movf aa_width+0,W,ACCESS ; right = left + width - 1 | |
418 addwf PRODL,F | |
419 movf aa_width+1,W,ACCESS | |
420 addwfc PRODH,F | |
421 decf PRODL,F,A ; decrement result | |
422 btfss STATUS,C | |
423 decf PRODH,F,A | |
424 | |
425 movlw 0x08 | |
426 rcall DISP_CmdWrite | |
427 movf PRODH,W | |
428 rcall DISP_DataWrite | |
429 movlw 0x09 | |
430 rcall DISP_CmdWrite | |
431 movf PRODL,W | |
432 rcall DISP_DataWrite | |
433 | |
434 ;---- Normal vertical window ----------------------------------------- | |
684 | 435 ; Output (top) (bottom) |
681 | 436 movff win_top,PRODH ; top --> PRODH (first byte) |
437 movff win_height,WREG | |
438 addwf PRODH,W | |
439 decf WREG | |
440 movwf PRODL ; top+height-1 --> PRODL (second byte) | |
441 | |
442 movlw 0x02 | |
443 rcall DISP_CmdWrite | |
444 movlw 0x00 | |
445 rcall DISP_DataWrite | |
446 movlw 0x03 | |
447 rcall DISP_CmdWrite | |
448 movf PRODH,W | |
449 rcall DISP_DataWrite | |
450 | |
451 movlw 0x04 | |
452 rcall DISP_CmdWrite | |
453 movlw 0x00 | |
454 rcall DISP_DataWrite | |
455 movlw 0x05 | |
456 rcall DISP_CmdWrite | |
457 movf PRODL,W | |
458 rcall DISP_DataWrite | |
459 return | |
460 | |
461 ;============================================================================= | |
462 ; DISP_frame : draw a frame around current box with current color. | |
463 ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 | |
464 ; Outputs: (none) | |
465 ; Trashed: WREG, PROD, aa_start:2, aa_end:2, win_leftx2, win_width:1 | |
466 global DISP_frame | |
467 DISP_frame: | |
468 movff win_top,aa_start+0 ; Backup everything. | |
469 movff win_height,aa_start+1 | |
470 movff win_leftx2,aa_end+0 | |
471 movff win_width,aa_end+1 | |
472 | |
473 ;---- TOP line ----------------------------------------------------------- | |
474 movlw 1 ; row ~ height=1 | |
475 movff WREG,win_height | |
476 rcall DISP_box | |
477 | |
478 ;---- BOTTOM line -------------------------------------------------------- | |
479 movff aa_start+0,PRODL ; Get back top, | |
480 movff aa_start+1,WREG ; and height | |
481 addwf PRODL,W ; top+height | |
482 decf WREG ; top+height-1 | |
483 movff WREG,win_top ; top+height-1 --> top | |
484 rcall DISP_box | |
485 | |
486 ;---- LEFT column -------------------------------------------------------- | |
487 movff aa_start+0,win_top ; Restore top/height. | |
488 movff aa_start+1,win_height | |
489 movlw 1 ; column ~ width=1 | |
490 movff WREG,win_width | |
491 rcall DISP_box | |
492 | |
493 ;---- RIGHT column ------------------------------------------------------- | |
494 movff aa_end+0,WREG | |
495 movff aa_end+1,PRODL | |
496 addwf PRODL,W | |
497 decf WREG | |
498 movff WREG,win_leftx2 | |
499 bra DISP_box | |
500 | |
501 ;============================================================================= | |
502 ; DISP_box : fills current box with current color. | |
503 ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 | |
504 ; Outputs: (none) | |
505 ; Trashed: WREG, PROD | |
506 | |
507 global DISP_box | |
508 DISP_box: | |
509 ;---- Define Window ------------------------------------------------------ | |
510 movff win_width,WREG | |
511 bcf STATUS,C | |
512 rlcf WREG | |
513 movwf aa_width+0 | |
514 movlw 0 | |
515 rlcf WREG | |
516 movwf aa_width+1 | |
517 rcall DISP_box_write | |
518 | |
519 ;---- Fill Window -------------------------------------------------------- | |
520 movlw 0x22 ; Start Writing Data to GRAM | |
521 rcall DISP_CmdWrite | |
522 | |
523 clrf PRODH ; Column counter. | |
524 bsf DISPLAY_rs ; Data! | |
525 | |
526 DISP_box2: ; Loop height times | |
527 movff win_height,PRODL | |
528 | |
529 DISP_box3: ; loop width times | |
530 movff win_color1,PORTD | |
531 bcf DISPLAY_rw | |
684 | 532 bsf DISPLAY_rw ; Upper |
681 | 533 movff win_color2,PORTD |
534 bcf DISPLAY_rw | |
684 | 535 bsf DISPLAY_rw ; Lower/High |
681 | 536 movff win_flags,WREG ; Display1? win_flags is in bank0... |
537 btfss WREG,1 ; Display1? | |
538 bra DISP_box3a ; No | |
539 movff win_color3,PORTD | |
540 bcf DISPLAY_rw | |
684 | 541 bsf DISPLAY_rw ; Lower |
681 | 542 |
543 DISP_box3a: | |
544 movff win_color1,PORTD | |
545 bcf DISPLAY_rw | |
684 | 546 bsf DISPLAY_rw ; Upper |
681 | 547 movff win_color2,PORTD |
548 bcf DISPLAY_rw | |
684 | 549 bsf DISPLAY_rw ; Lower/High |
681 | 550 movff win_flags,WREG ; Display1? win_flags is in bank0... |
551 btfss WREG,1 ; Display1? | |
552 bra DISP_box3b ; No | |
553 movff win_color3,PORTD | |
554 bcf DISPLAY_rw | |
684 | 555 bsf DISPLAY_rw ; Lower |
681 | 556 |
557 DISP_box3b: | |
558 decfsz PRODL,F ; row loop finished ? | |
559 bra DISP_box3 ; No: continue. | |
560 | |
561 incf PRODH,F ; column count ++ | |
562 | |
563 movff win_bargraph,WREG ; current column == bargraph ? | |
564 cpfseq PRODH | |
565 bra DISP_box4 ; No: just loop. | |
566 | |
567 clrf WREG ; Yes: switch to black | |
568 movff WREG,win_color1 | |
569 movff WREG,win_color2 | |
570 movff WREG,win_color3 ; Yes. | |
571 DISP_box4: | |
572 movff win_width,WREG | |
573 cpfseq PRODH | |
574 bra DISP_box2 | |
575 | |
576 setf WREG ; Reset bargraph mode... | |
577 movff WREG,win_bargraph | |
578 | |
579 movff win_flags,WREG ; Display1? win_flags is in bank0... | |
580 btfsc WREG,1 ; Display1? | |
581 return ; Yes, done. | |
582 | |
583 movlw 0x00 ; NOP, to stop window mode | |
584 bra DISP_CmdWrite ; Returns.... | |
585 | |
586 ;============================================================================= | |
587 ; DISP_ClearScreen: An optimized version of PLEX_box, for full screen black. | |
588 ; Trashed: WREG, PROD | |
589 | |
590 global DISP_ClearScreen | |
591 DISP_ClearScreen: | |
592 movff win_flags,WREG ; Display1? win_flags is in bank0... | |
593 btfsc WREG,1 ; Display1? | |
594 bra DISP_ClearScreen_display1; Yes | |
595 | |
596 movlw 0x35 ; VerticalStartAddress HIGH:LOW | |
597 rcall DISP_CmdWrite | |
598 mullw 0 | |
599 rcall DISP_DataWrite_PROD | |
600 | |
601 movlw 0x36 ; VerticalEndAddress HIGH:LOW | |
602 rcall DISP_CmdWrite | |
603 movlw 0x01 | |
604 rcall DISP_DataWrite | |
605 movlw 0x3F | |
606 rcall DISP_DataWrite | |
607 | |
608 movlw 0x37 ; HorizontalAddress START:END | |
609 rcall DISP_CmdWrite | |
610 movlw 0x00 | |
611 rcall DISP_DataWrite | |
612 movlw 0xEF | |
613 rcall DISP_DataWrite | |
614 | |
615 movlw 0x20 ; Start Address Horizontal (.0 - .239) | |
616 rcall DISP_CmdWrite | |
617 rcall DISP_DataWrite_PROD | |
618 | |
619 movlw 0x21 ; Start Address Vertical (.0 - .319) | |
620 rcall DISP_CmdWrite | |
621 rcall DISP_DataWrite_PROD | |
622 | |
623 movlw 0x22 ; Start Writing Data to GRAM | |
624 rcall DISP_CmdWrite | |
625 | |
626 ; See Page 101 of DISPLAY Driver IC Datasheet how to handle rs/rw clocks | |
627 bsf DISPLAY_rs ; Data! | |
684 | 628 clrf PORTD |
681 | 629 movlw .160 |
630 movwf PRODH | |
631 DISP_ClearScreen2: | |
632 movlw .240 | |
633 movwf PRODL | |
634 DISP_ClearScreen3: | |
635 bcf DISPLAY_rw | |
636 bsf DISPLAY_rw ; Upper | |
637 bcf DISPLAY_rw | |
638 bsf DISPLAY_rw ; Lower | |
639 bcf DISPLAY_rw | |
640 bsf DISPLAY_rw ; Upper | |
641 bcf DISPLAY_rw | |
642 bsf DISPLAY_rw ; Lower | |
643 decfsz PRODL,F | |
644 bra DISP_ClearScreen3 | |
645 decfsz PRODH,F | |
646 bra DISP_ClearScreen2 | |
647 movlw 0x00 ; NOP, to stop Address Update Counter | |
684 | 648 bra DISP_CmdWrite ; And return... |
681 | 649 |
650 DISP_ClearScreen_display1: | |
651 ; Column Address start | |
652 movlw 0x02 | |
653 rcall DISP_CmdWrite | |
654 movlw 0x00 | |
655 rcall DISP_DataWrite | |
656 movlw 0x03 | |
657 rcall DISP_CmdWrite | |
658 movlw 0x00 | |
659 rcall DISP_DataWrite | |
660 | |
661 ; Column Address end | |
662 movlw 0x04 | |
663 rcall DISP_CmdWrite | |
664 movlw 0x00 | |
665 rcall DISP_DataWrite | |
666 movlw 0x05 | |
667 rcall DISP_CmdWrite | |
668 movlw 0xEF | |
669 rcall DISP_DataWrite | |
670 | |
671 ; Row address start | |
672 movlw 0x06 | |
673 rcall DISP_CmdWrite | |
674 movlw 0x00 | |
675 rcall DISP_DataWrite | |
676 movlw 0x07 | |
677 rcall DISP_CmdWrite | |
678 movlw 0x00 | |
679 rcall DISP_DataWrite | |
680 | |
681 ; Row address end | |
682 movlw 0x08 | |
683 rcall DISP_CmdWrite | |
684 movlw 0x01 | |
685 rcall DISP_DataWrite | |
686 movlw 0x09 | |
687 rcall DISP_CmdWrite | |
688 movlw 0x3F | |
689 rcall DISP_DataWrite | |
690 | |
691 movlw 0x22 ; Start Writing Data to GRAM | |
692 rcall DISP_CmdWrite | |
693 | |
694 bsf DISPLAY_rs ; Data! | |
695 | |
696 movlw .160 | |
697 movwf PRODH | |
698 DISP_ClearScreen2_display1: | |
699 movlw .240 | |
700 movwf PRODL | |
684 | 701 clrf PORTD |
681 | 702 DISP_ClearScreen3_display1: |
703 bcf DISPLAY_rw | |
704 bsf DISPLAY_rw ; Upper | |
705 bcf DISPLAY_rw | |
706 bsf DISPLAY_rw ; High | |
707 bcf DISPLAY_rw | |
708 bsf DISPLAY_rw ; Lower | |
709 bcf DISPLAY_rw | |
710 bsf DISPLAY_rw ; Upper | |
711 bcf DISPLAY_rw | |
712 bsf DISPLAY_rw ; High | |
713 bcf DISPLAY_rw | |
714 bsf DISPLAY_rw ; Lower | |
715 decfsz PRODL,F | |
716 bra DISP_ClearScreen3_display1 | |
717 decfsz PRODH,F | |
718 bra DISP_ClearScreen2_display1 | |
719 return | |
720 | |
721 | |
722 ; ----------------------------- | |
723 ; DISP Write Cmd via W | |
724 ; ----------------------------- | |
725 DISP_CmdWrite: | |
726 bcf DISPLAY_rs ; Command! | |
727 movwf PORTD ; Move Data to PORTD | |
728 bcf DISPLAY_rw | |
729 bsf DISPLAY_rw | |
730 return | |
731 | |
732 ; ----------------------------- | |
733 ; DISP Write Display Data via W | |
734 ; ----------------------------- | |
735 DISP_DataWrite: | |
736 bsf DISPLAY_rs ; Data! | |
737 movwf PORTD ; Move Data to PORTD | |
738 bcf DISPLAY_rw | |
739 bsf DISPLAY_rw | |
740 return | |
741 | |
742 ; ----------------------------- | |
743 ; DISP Data Cmd via W | |
744 ; ----------------------------- | |
745 DISP_DataWrite_PROD: | |
746 bsf DISPLAY_rs ; Data! | |
747 movff PRODH,PORTD ; Move high byte to PORTD (DISPLAY is bigendian) | |
748 bcf DISPLAY_rw | |
749 bsf DISPLAY_rw | |
750 movff PRODL,PORTD ; Move low byte to PORTD | |
751 bcf DISPLAY_rw | |
752 bsf DISPLAY_rw | |
753 movff win_flags,WREG ; Display1? win_flags is in bank0... | |
754 btfss WREG,1 ; Display1? | |
755 return ; No, done. | |
705 | 756 movff win_color3,PORTD ; Move low(est) byte to PORTD |
681 | 757 bcf DISPLAY_rw |
758 bsf DISPLAY_rw | |
759 return | |
760 | |
761 | |
762 ; ----------------------------- | |
763 ; DISP Read data into WREG | |
764 ; ----------------------------- | |
765 ; NOTE: you should "setf TRISD" before calling this function, | |
766 ; to make PortD an input port... | |
767 DISP_DataRead: | |
687
a8a36c85e031
ignore screenshots with display1 (for now)
heinrichsweikamp
parents:
684
diff
changeset
|
768 movff win_flags,WREG ; Display1? win_flags is in bank0... |
a8a36c85e031
ignore screenshots with display1 (for now)
heinrichsweikamp
parents:
684
diff
changeset
|
769 btfsc WREG,1 ; Display1? |
a8a36c85e031
ignore screenshots with display1 (for now)
heinrichsweikamp
parents:
684
diff
changeset
|
770 return ; Yes, done. |
681 | 771 bsf DISPLAY_rs ; Data register. |
772 bcf DISPLAY_e_nwr ; Read enable. | |
773 nop | |
774 nop | |
775 nop | |
776 nop | |
777 movf PORTD,W ; Read byte. | |
778 bsf DISPLAY_e_nwr ; release bus. | |
779 return | |
780 | |
781 ; ----------------------------- | |
782 ; DISP boot | |
783 ; ----------------------------- | |
784 DISPLAY_boot: | |
785 movlw LOW 0x17FDC | |
786 movwf TBLPTRL | |
787 movlw HIGH 0x17FDC | |
788 movwf TBLPTRH | |
789 movlw UPPER 0x17FDC | |
790 movwf TBLPTRU | |
791 TBLRD* | |
792 movlw 0x01 | |
793 cpfseq TABLAT ; Display1? | |
794 bra display0_init ; No, Display0 | |
795 | |
796 banksel win_flags | |
797 bsf win_flags,0 | |
798 bsf win_flags,1 | |
799 banksel flag1 | |
800 bcf DISPLAY_hv ; Backlight off | |
801 nop | |
802 bcf DISPLAY_vdd | |
803 WAITMS d'10' | |
804 bsf DISPLAY_vdd | |
805 WAITMS d'100' | |
806 bsf DISPLAY_rw | |
807 nop | |
808 bcf DISPLAY_cs | |
809 nop | |
810 bsf DISPLAY_nreset | |
811 WAITMS d'1' | |
812 bcf DISPLAY_nreset | |
813 WAIT10US d'2' | |
814 bsf DISPLAY_nreset | |
815 WAITMS d'120' | |
816 bsf DISPLAY_e_nwr ; release bus. | |
817 rcall display1_init ; Init sequence | |
818 rcall DISP_ClearScreen | |
819 WAITMS d'60' | |
820 bsf DISPLAY_hv ; Backlight on | |
821 return | |
822 | |
823 display1_init: | |
824 movlw LOW display1_config_table | |
825 movwf TBLPTRL | |
826 movlw HIGH display1_config_table | |
827 movwf TBLPTRH | |
828 movlw UPPER display1_config_table | |
829 movwf TBLPTRU | |
688 | 830 display1_init_loop: |
681 | 831 TBLRD*+ |
832 movlw 0xFF | |
833 cpfseq TABLAT | |
688 | 834 bra display1_config_write ; Write Config pair to Display |
681 | 835 ; Delay ms or quit (return) |
836 TBLRD*+ | |
837 tstfsz TABLAT ; End of config? | |
838 bra $+4 ; No | |
839 return ; Done. | |
840 movf TABLAT,W | |
841 call WAITMSX ; Wait WREG milliseconds | |
688 | 842 bra display1_init_loop ; Loop |
681 | 843 |
688 | 844 display1_config_write: ; With command in WREG |
681 | 845 movf TABLAT,W |
846 rcall DISP_CmdWrite ; Write command | |
847 TBLRD*+ ; Get config | |
848 movf TABLAT,W | |
849 rcall DISP_DataWrite ; Write config | |
688 | 850 bra display1_init_loop ; Loop |
681 | 851 |
852 | |
853 display1_config_table: | |
854 ; Reg, Dat or 0xFF, Delay or 0xFF, 0x00 (End) | |
855 db 0x96,0x01 | |
856 db 0x19,0x87 | |
857 db 0xFF,.10 | |
858 db 0x26,0x80 | |
859 db 0x1B,0x0C | |
860 db 0x43,0x00 | |
861 db 0x20,0x00 | |
862 db 0x1F,0x07 | |
863 db 0x44,0x7F | |
864 db 0x45,0x14 | |
865 db 0x1D,0x05 | |
866 db 0x1E,0x00 | |
867 db 0x1C,0x04 | |
868 db 0x1B,0x14 | |
869 db 0xFF,.40 | |
870 db 0x43,0x80 | |
871 db 0x42,0x08 | |
872 db 0x23,0x95 | |
873 db 0x24,0x95 | |
874 db 0x25,0xFF | |
875 db 0x21,0x10 | |
876 db 0x2B,0x00 | |
877 db 0x95,0x01 | |
878 db 0x1A,0x00 | |
879 db 0x93,0x0F | |
880 db 0x70,0x66 | |
881 db 0x18,0x01 | |
882 db 0x46,0x86 | |
883 db 0x47,0x60 | |
884 db 0x48,0x01 | |
885 db 0x49,0x67 | |
886 db 0x4A,0x46 | |
887 db 0x4B,0x13 | |
888 db 0x4C,0x01 | |
889 db 0x4D,0x67 | |
890 db 0x4E,0x00 | |
891 db 0x4F,0x13 | |
892 db 0x50,0x02 | |
893 db 0x51,0x00 | |
894 db 0x38,0x00 | |
895 db 0x39,0x00 | |
896 db 0x27,0x02 | |
897 db 0x28,0x03 | |
898 db 0x29,0x08 | |
899 db 0x2A,0x08 | |
900 db 0x2C,0x08 | |
901 db 0x2D,0x08 | |
902 db 0x35,0x09 | |
903 db 0x36,0x09 | |
904 db 0x91,0x14 | |
905 db 0x37,0x00 | |
906 db 0x01,0x06 | |
907 db 0x3A,0xA1 | |
908 db 0x3B,0xA1 | |
909 db 0x3C,0xA1 | |
910 db 0x3D,0x00 | |
911 db 0x3E,0x2D | |
912 db 0x40,0x03 | |
913 db 0x41,0xCC | |
914 db 0x0A,0x00 | |
915 db 0x0B,0x00 | |
916 db 0x0C,0x01 | |
917 db 0x0D,0x3F | |
918 db 0x0E,0x00 | |
919 db 0x0F,0x00 | |
920 db 0x10,0x01 | |
921 db 0x11,0x40 | |
922 db 0x12,0x00 | |
923 db 0x13,0x00 | |
924 db 0x14,0x00 | |
925 db 0x15,0x00 | |
926 db 0x02,0x00 | |
927 db 0x03,0x00 | |
928 db 0x04,0x00 | |
929 db 0x05,0xEF | |
930 db 0x06,0x00 | |
931 db 0x07,0x00 | |
932 db 0x08,0x01 | |
933 db 0x09,0x3F | |
934 db 0x16,0x88 | |
935 db 0x72,0x00 | |
936 db 0x22,0x60 | |
937 db 0x94,0x0A | |
938 db 0x90,0x7F | |
939 db 0x26,0x84 | |
940 db 0xFF,.40 | |
941 db 0x26,0xA4 | |
942 db 0x26,0xAC | |
943 db 0xFF,.40 | |
944 db 0x26,0xBC | |
945 db 0x96,0x00 | |
946 db 0xFF,0x00 ; End of table pair | |
947 | |
948 | |
949 display0_init: ; Display0 | |
950 banksel win_flags | |
951 bcf win_flags,1 | |
952 banksel flag1 | |
953 bcf DISPLAY_hv | |
954 WAITMS d'32' | |
955 bsf DISPLAY_vdd | |
956 nop | |
957 bcf DISPLAY_cs | |
958 nop | |
959 bsf DISPLAY_nreset | |
960 WAITMS d'250' ; Standard wake-up | |
961 bsf DISPLAY_e_nwr | |
962 nop | |
963 bcf DISPLAY_nreset | |
964 WAIT10US d'2' | |
965 bsf DISPLAY_nreset | |
966 WAITMS d'10' | |
967 | |
968 movlw 0x24 ; 80-System 8-Bit Mode | |
969 rcall DISP_CmdWrite | |
970 | |
971 movlw 0x02 ; RGB Interface Control (S6E63D6 Datasheet page 42) | |
972 rcall DISP_CmdWrite | |
973 movlw 0x00 ; X X X X X X X RM | |
974 rcall DISP_DataWrite | |
975 movlw 0x00 ; DM X RIM1 RIM0 VSPL HSPL EPL DPL | |
976 rcall DISP_DataWrite ; System Interface: RIM is ignored, Internal Clock | |
977 | |
978 movlw 0x03 ; Entry Mode (S6E63D6 Datasheet page 46) | |
979 rcall DISP_CmdWrite | |
980 movlw 0x00 ; CLS MDT1 MDT0 BGR X X X SS 65k Color | |
981 rcall DISP_DataWrite | |
982 | |
983 ; Change direction for block-writes of pixels | |
984 lfsr FSR0,win_flags | |
684 | 985 movlw b'00000000' ; [flipped] X X I/D1 I/D0 X X X AM |
681 | 986 btfss INDF0,0 ; BANK-SAFE bit test. |
987 movlw b'00110000' ; [normal] X X I/D1 I/D0 X X X AM | |
988 rcall DISP_DataWrite | |
989 | |
688 | 990 movlw LOW display0_config_table |
991 movwf TBLPTRL | |
992 movlw HIGH display0_config_table | |
993 movwf TBLPTRH | |
994 movlw UPPER display0_config_table | |
995 movwf TBLPTRU | |
996 rcall display0_init_loop | |
997 rcall DISP_brightness_full ; Gamma settings... | |
998 rcall DISP_ClearScreen | |
999 bsf DISPLAY_hv ; OLED volatages on | |
1000 return | |
681 | 1001 |
1002 | |
688 | 1003 display0_config_table: |
1004 ; Reg, Dat0, Dat1 or 0xFF,0x00,0x00 for end | |
1005 db 0x18,0x00,0x28,0xF8,0x00,0x0F | |
1006 db 0xF9,0x00,0x0F,0x10,0x00,0x00 | |
1007 db 0x05,0x00,0x01,0xFF,0x00,0x00 | |
681 | 1008 |
1009 | |
1010 DISP_brightness_full: ; Choose between Eco and High... | |
1011 btfsc DISPLAY_brightness_high ; DISPLAY brightness (=0: Eco, =1: High) | |
1012 bra DISP_brightness_full_high | |
1013 ; Mid | |
1014 bsf PORTB,7 | |
1015 bcf PORTB,6 | |
1016 | |
1017 movff win_flags,WREG ; Display1? win_flags is in bank0... | |
1018 btfsc WREG,1 ; Display1? | |
1019 return ; Yes, done. | |
1020 | |
688 | 1021 movlw LOW display0_gamma_high_table |
1022 movwf TBLPTRL | |
1023 movlw HIGH display0_gamma_high_table | |
1024 movwf TBLPTRH | |
1025 movlw UPPER display0_gamma_high_table | |
1026 movwf TBLPTRU | |
1027 bra display0_init_loop ; And return... | |
681 | 1028 |
1029 | |
1030 DISP_brightness_full_high: | |
1031 ; Full | |
1032 bsf PORTB,7 | |
1033 bsf PORTB,6 | |
1034 | |
1035 movff win_flags,WREG ; Display1? win_flags is in bank0... | |
1036 btfsc WREG,1 ; Display1? | |
1037 return ; Yes, done. | |
1038 | |
688 | 1039 movlw LOW display0_gamma_full_table |
1040 movwf TBLPTRL | |
1041 movlw HIGH display0_gamma_full_table | |
1042 movwf TBLPTRH | |
1043 movlw UPPER display0_gamma_full_table | |
1044 movwf TBLPTRU | |
1045 bra display0_init_loop ; And return... | |
681 | 1046 |
1047 | |
1048 DISP_brightness_low: | |
1049 ;Low | |
1050 bcf PORTB,7 | |
1051 bcf PORTB,6 | |
1052 movff win_flags,WREG ; Display1? win_flags is in bank0... | |
1053 btfsc WREG,1 ; Display1? | |
1054 return ; Yes, done. | |
688 | 1055 movlw LOW display0_gamma_low_table |
1056 movwf TBLPTRL | |
1057 movlw HIGH display0_gamma_low_table | |
1058 movwf TBLPTRH | |
1059 movlw UPPER display0_gamma_low_table | |
1060 movwf TBLPTRU | |
1061 bra display0_init_loop ; And return... | |
681 | 1062 |
688 | 1063 display0_init_loop: |
1064 TBLRD*+ | |
1065 movlw 0xFF | |
1066 cpfseq TABLAT | |
1067 bra display0_config_write ; Write Config pair to Display | |
1068 ; Delay ms or quit (return) | |
1069 TBLRD*+ | |
1070 tstfsz TABLAT ; End of config? | |
1071 bra $+4 ; No | |
1072 return ; Done. | |
1073 movf TABLAT,W | |
1074 call WAITMSX ; Wait WREG milliseconds | |
1075 bra display0_init_loop ; Loop | |
681 | 1076 |
688 | 1077 display0_config_write: ; With command in WREG |
1078 movf TABLAT,W | |
1079 rcall DISP_CmdWrite ; Write command | |
1080 TBLRD*+ ; Get config | |
1081 movf TABLAT,W | |
1082 rcall DISP_DataWrite ; Write config | |
1083 TBLRD*+ ; Get config | |
1084 movf TABLAT,W | |
1085 rcall DISP_DataWrite ; Write config | |
1086 bra display0_init_loop ; Loop | |
1087 | |
681 | 1088 |
688 | 1089 display0_gamma_high_table: |
1090 ; Reg, Dat0, Dat1 or 0xFF,0x00,0x00 for end | |
1091 db 0x70,0x1B,0x80,0x71,0x1F,0x00 | |
1092 db 0x72,0x22,0x00,0x73,0x17,0x11 | |
1093 db 0x74,0x1A,0x0E,0x75,0x1D,0x15 | |
1094 db 0x76,0x18,0x11,0x77,0x1E,0x18 | |
1095 db 0x78,0x1D,0x11,0xFF,0x00,0x00 | |
681 | 1096 |
688 | 1097 display0_gamma_full_table: |
1098 ; Reg, Dat0, Dat1 or 0xFF,0x00,0x00 for end | |
1099 db 0x70,0x1F,0x00,0x71,0x23,0x80 | |
1100 db 0x72,0x2A,0x80,0x73,0x15,0x11 | |
1101 db 0x74,0x1C,0x11,0x75,0x1B,0x15 | |
1102 db 0x76,0x1A,0x15,0x77,0x1C,0x18 | |
1103 db 0x78,0x21,0x15,0xFF,0x00,0x00 | |
1104 | |
1105 display0_gamma_low_table: | |
1106 ; Reg, Dat0, Dat1 or 0xFF,0x00,0x00 for end | |
1107 db 0x70,0x14,0x00,0x71,0x17,0x00 | |
1108 db 0x72,0x15,0x80,0x73,0x15,0x11 | |
1109 db 0x74,0x14,0x0B,0x75,0x1B,0x15 | |
1110 db 0x76,0x13,0x0E,0x77,0x1C,0x18 | |
1111 db 0x78,0x15,0x0E,0xFF,0x00,0x00 | |
1112 | |
681 | 1113 |
1114 DISP_set_color:;Converts 8Bit RGB b'RRRGGGBB' into 16Bit RGB b'RRRRRGGG GGGBBBBB' | |
1115 movwf DISPLAY1_temp ; Get 8Bit RGB b'RRRGGGBB' | |
1116 movwf DISPLAY2_temp ; Copy | |
1117 | |
1118 movff win_flags,WREG ; Display1? win_flags is in bank0... | |
1119 btfsc WREG,1 ; Display1? | |
1120 bra DISP_set_color_display1 ; Yes | |
1121 | |
1122 ; Display0 | |
1123 ; Mask Bit 7,6,5,4,3,2 | |
1124 movlw b'00000011' | |
1125 andwf DISPLAY2_temp,F | |
1126 | |
1127 movlw b'00000000' | |
1128 dcfsnz DISPLAY2_temp,F | |
1129 movlw b'01010000' | |
1130 dcfsnz DISPLAY2_temp,F | |
1131 movlw b'10100000' | |
1132 dcfsnz DISPLAY2_temp,F | |
1133 movlw b'11111000' | |
1134 movwf DISPLAY3_temp ; Blue done. | |
1135 | |
1136 movff DISPLAY1_temp, DISPLAY2_temp ; Copy | |
1137 ; Mask Bit 7,6,5,1,0 | |
1138 movlw b'00011100' | |
1139 andwf DISPLAY2_temp,F | |
1140 rrncf DISPLAY2_temp,F | |
1141 rrncf DISPLAY2_temp,F | |
1142 | |
1143 movlw b'00000000' | |
1144 dcfsnz DISPLAY2_temp,F | |
1145 movlw b'00000100' | |
1146 dcfsnz DISPLAY2_temp,F | |
1147 movlw b'00001000' | |
1148 dcfsnz DISPLAY2_temp,F | |
1149 movlw b'00001100' | |
1150 dcfsnz DISPLAY2_temp,F | |
1151 movlw b'00010000' | |
1152 dcfsnz DISPLAY2_temp,F | |
1153 movlw b'00010100' | |
1154 dcfsnz DISPLAY2_temp,F | |
1155 movlw b'00100000' | |
1156 dcfsnz DISPLAY2_temp,F | |
1157 movlw b'00111111' | |
1158 movwf DISPLAY4_temp | |
1159 | |
1160 rrcf DISPLAY4_temp,F | |
1161 rrcf DISPLAY3_temp,F | |
1162 | |
1163 rrcf DISPLAY4_temp,F | |
1164 rrcf DISPLAY3_temp,F | |
1165 | |
1166 rrcf DISPLAY4_temp,F | |
1167 rrcf DISPLAY3_temp,F ; DISPLAY3_temp (b'GGGBBBBB') done. | |
1168 | |
1169 movff DISPLAY1_temp, DISPLAY2_temp ; Copy | |
1170 clrf DISPLAY1_temp | |
1171 | |
1172 rrcf DISPLAY4_temp,F | |
1173 rrcf DISPLAY1_temp,F | |
1174 | |
1175 rrcf DISPLAY4_temp,F | |
1176 rrcf DISPLAY1_temp,F | |
1177 | |
1178 rrcf DISPLAY4_temp,F | |
1179 rrcf DISPLAY1_temp,F ; Green done. | |
1180 | |
1181 ; Mask Bit 4,3,2,1,0 | |
1182 movlw b'11100000' | |
1183 andwf DISPLAY2_temp,F | |
1184 | |
1185 rrncf DISPLAY2_temp,F | |
1186 rrncf DISPLAY2_temp,F | |
1187 rrncf DISPLAY2_temp,F | |
1188 rrncf DISPLAY2_temp,F | |
1189 rrncf DISPLAY2_temp,F | |
1190 | |
1191 movlw b'00000000' | |
1192 dcfsnz DISPLAY2_temp,F | |
1193 movlw b'00000100' | |
1194 dcfsnz DISPLAY2_temp,F | |
1195 movlw b'00001000' | |
1196 dcfsnz DISPLAY2_temp,F | |
1197 movlw b'00001100' | |
1198 dcfsnz DISPLAY2_temp,F | |
1199 movlw b'00010000' | |
1200 dcfsnz DISPLAY2_temp,F | |
1201 movlw b'00010100' | |
1202 dcfsnz DISPLAY2_temp,F | |
1203 movlw b'00100000' | |
1204 dcfsnz DISPLAY2_temp,F | |
1205 movlw b'00111111' | |
1206 movwf DISPLAY4_temp | |
1207 | |
1208 rrcf DISPLAY4_temp,F | |
1209 rrcf DISPLAY1_temp,F | |
1210 | |
1211 rrcf DISPLAY4_temp,F | |
1212 rrcf DISPLAY1_temp,F | |
1213 | |
1214 rrcf DISPLAY4_temp,F | |
1215 rrcf DISPLAY1_temp,F | |
1216 | |
1217 rrcf DISPLAY4_temp,F | |
1218 rrcf DISPLAY1_temp,F | |
1219 | |
1220 rrcf DISPLAY4_temp,F | |
1221 rrcf DISPLAY1_temp,F ; Red done. | |
1222 | |
1223 movff DISPLAY1_temp,win_color1 | |
1224 movff DISPLAY3_temp,win_color2 ; Set Bank0 Color registers... | |
1225 return | |
1226 | |
684 | 1227 DISP_set_color_display1:;Converts 8Bit RGB b'RRRGGGBB' into 24Bit RGB b'00RRRRRR 00GGGGGG 00BBBBBB' |
681 | 1228 ; Mask Bit 7,6,5,4,3,2 |
1229 movlw b'00000011' | |
1230 andwf DISPLAY2_temp,F | |
1231 | |
1232 movlw b'00000000' | |
1233 dcfsnz DISPLAY2_temp,F | |
1234 movlw b'01010000' | |
1235 dcfsnz DISPLAY2_temp,F | |
1236 movlw b'10100000' | |
1237 dcfsnz DISPLAY2_temp,F | |
1238 movlw b'11111000' | |
1239 movff WREG,win_color3 ; B | |
1240 | |
1241 movff DISPLAY1_temp, DISPLAY2_temp ; Copy | |
1242 ; Mask Bit 7,6,5,1,0 | |
1243 movlw b'00011100' | |
1244 andwf DISPLAY2_temp,F | |
1245 rrncf DISPLAY2_temp,F | |
1246 rrncf DISPLAY2_temp,F | |
1247 | |
1248 movlw b'00000000' | |
1249 dcfsnz DISPLAY2_temp,F | |
1250 movlw b'00010000' | |
1251 dcfsnz DISPLAY2_temp,F | |
1252 movlw b'00100000' | |
1253 dcfsnz DISPLAY2_temp,F | |
1254 movlw b'00110000' | |
1255 dcfsnz DISPLAY2_temp,F | |
1256 movlw b'01000000' | |
1257 dcfsnz DISPLAY2_temp,F | |
1258 movlw b'01010000' | |
1259 dcfsnz DISPLAY2_temp,F | |
1260 movlw b'10000000' | |
1261 dcfsnz DISPLAY2_temp,F | |
1262 movlw b'11111100' | |
1263 movff WREG,win_color2 ; G | |
1264 | |
1265 ; Mask Bit 4,3,2,1,0 | |
1266 movlw b'11100000' | |
684 | 1267 andwf DISPLAY1_temp,F |
681 | 1268 |
684 | 1269 rrncf DISPLAY1_temp,F |
1270 rrncf DISPLAY1_temp,F | |
1271 rrncf DISPLAY1_temp,F | |
1272 rrncf DISPLAY1_temp,F | |
1273 rrncf DISPLAY1_temp,F | |
681 | 1274 |
1275 movlw b'00000000' | |
684 | 1276 dcfsnz DISPLAY1_temp,F |
681 | 1277 movlw b'00010000' |
684 | 1278 dcfsnz DISPLAY1_temp,F |
681 | 1279 movlw b'00100000' |
684 | 1280 dcfsnz DISPLAY1_temp,F |
681 | 1281 movlw b'00110000' |
684 | 1282 dcfsnz DISPLAY1_temp,F |
681 | 1283 movlw b'01000000' |
684 | 1284 dcfsnz DISPLAY1_temp,F |
681 | 1285 movlw b'01010000' |
684 | 1286 dcfsnz DISPLAY1_temp,F |
681 | 1287 movlw b'10000000' |
684 | 1288 dcfsnz DISPLAY1_temp,F |
681 | 1289 movlw b'11111100' |
1290 movff WREG,win_color1 ; R | |
1291 return |