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