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