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