Mercurial > public > hwos_code
annotate src/tft.asm @ 632:0347acdf6d8e
changelog updates
author | heinrichsweikamp |
---|---|
date | Sat, 29 Feb 2020 16:57:45 +0100 |
parents | 185ba2f91f59 |
children | 4050675965ea |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
631 | 3 ; File tft.asm combined next generation V3.08.8 |
0 | 4 ; |
623 | 5 ; low-level Display Outputs |
0 | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2011-05-24 : [jDG] Cleanups from initial Matthias code. | |
11 | |
275 | 12 #include "hwos.inc" |
0 | 13 #include "wait.inc" |
14 #include "varargs.inc" | |
15 #include "external_flash.inc" | |
16 #include "tft_outputs.inc" | |
17 #include "eeprom_rs232.inc" | |
18 | |
19 ;============================================================================= | |
20 ; Basic bit-level macros | |
21 | |
582 | 22 RD_H macro |
23 bsf tft_rd,0 | |
24 endm | |
0 | 25 |
582 | 26 RD_L macro |
27 bcf tft_rd,0 | |
28 endm | |
0 | 29 |
582 | 30 RS_H macro |
31 bsf tft_rs,0 | |
32 endm | |
0 | 33 |
582 | 34 RS_L macro |
35 bcf tft_rs,0 | |
36 endm | |
0 | 37 |
582 | 38 NCS_H macro |
39 bsf tft_cs,0 | |
40 endm | |
0 | 41 |
582 | 42 NCS_L macro |
43 bcf tft_cs,0 | |
44 endm | |
0 | 45 |
582 | 46 WR_H macro |
47 bsf tft_nwr,0 | |
48 endm | |
0 | 49 |
582 | 50 WR_L macro |
51 bcf tft_nwr,0 | |
52 endm | |
0 | 53 |
54 ;============================================================================= | |
582 | 55 ; Byte-level macros |
56 | |
0 | 57 Index_out macro low_b |
58 movlw low_b | |
59 rcall TFT_CmdWrite | |
60 endm | |
61 | |
62 Parameter_out macro high_b, low_b | |
63 movlw high_b | |
604 | 64 movwf PORTA ; upper |
0 | 65 movlw low_b |
66 rcall TFT_DataWrite | |
67 endm | |
68 | |
69 | |
604 | 70 tft CODE |
582 | 71 |
151 | 72 ;;============================================================================= |
582 | 73 |
74 global TFT_ClearScreen | |
0 | 75 TFT_ClearScreen: |
628 | 76 btfsc screen_type2 ; screen type 2? |
623 | 77 bra TFT_ClearScreen_display2; YES |
628 | 78 btfsc screen_type3 ; screen type 3? |
79 bra TFT_ClearScreen_display3; YES | |
623 | 80 |
604 | 81 Index_out 0x50 ; window horizontal start address |
582 | 82 Parameter_out 0x00, 0x00 ; 0-239 |
604 | 83 Index_out 0x51 ; window horizontal end address |
582 | 84 Parameter_out 0x00, 0xEF ; 0-239 |
604 | 85 Index_out 0x52 ; window vertical start address |
582 | 86 Parameter_out 0x00, 0x00 ; 0-319 |
604 | 87 Index_out 0x53 ; window vertical end address |
582 | 88 Parameter_out 0x01, 0x3F ; 0-319 |
604 | 89 Index_out 0x20 ; frame memory horizontal address |
582 | 90 Parameter_out 0x00, 0x00 ; 0-239 |
604 | 91 Index_out 0x21 ; frame memory vertical address |
582 | 92 Parameter_out 0x01, 0x3F ; 0-319 |
0 | 93 |
604 | 94 Index_out 0x22 ; frame memory data write start |
0 | 95 |
604 | 96 RD_H ; not read |
97 RS_H ; data | |
98 NCS_L ; not CS | |
99 clrf PORTH ; data lower | |
0 | 100 |
101 movlw d'10' | |
102 movwf tft_temp3 | |
103 TFT_ClearScreen2: | |
104 movlw d'30' | |
105 movwf tft_temp2 | |
106 TFT_ClearScreen3: | |
604 | 107 clrf tft_temp1 ; 30*10*256=76800 pixels -> clear complete 240*320 |
582 | 108 bcf INTCON,GIE |
0 | 109 TFT_ClearScreen4: |
110 WR_L | |
604 | 111 WR_H ; tick |
0 | 112 decfsz tft_temp1,F |
113 bra TFT_ClearScreen4 | |
582 | 114 bsf INTCON,GIE |
0 | 115 decfsz tft_temp2,F |
116 bra TFT_ClearScreen3 | |
117 decfsz tft_temp3,F | |
118 bra TFT_ClearScreen2 | |
582 | 119 |
120 movlw 0x00 ; NOP, to stop window mode | |
604 | 121 bra TFT_CmdWrite ; and return |
582 | 122 |
623 | 123 TFT_ClearScreen_display2: |
124 movlw 0x02 ; column address start | |
608 | 125 rcall TFT_CmdWrite |
126 movlw 0x00 | |
127 rcall TFT_DataWrite | |
128 movlw 0x03 | |
129 rcall TFT_CmdWrite | |
130 movlw 0x00 | |
131 rcall TFT_DataWrite | |
132 | |
623 | 133 movlw 0x04 ; column address end |
608 | 134 rcall TFT_CmdWrite |
135 movlw 0x00 | |
136 rcall TFT_DataWrite | |
137 movlw 0x05 | |
138 rcall TFT_CmdWrite | |
139 movlw 0xEF | |
140 rcall TFT_DataWrite | |
141 | |
623 | 142 movlw 0x06 ; row address start |
608 | 143 rcall TFT_CmdWrite |
144 movlw 0x00 | |
145 rcall TFT_DataWrite | |
146 movlw 0x07 | |
147 rcall TFT_CmdWrite | |
148 movlw 0x00 | |
149 rcall TFT_DataWrite | |
150 | |
623 | 151 movlw 0x08 ; row address end |
608 | 152 rcall TFT_CmdWrite |
153 movlw 0x01 | |
154 rcall TFT_DataWrite | |
155 movlw 0x09 | |
156 rcall TFT_CmdWrite | |
157 movlw 0x3F | |
158 rcall TFT_DataWrite | |
159 | |
623 | 160 movlw 0x22 ; start writing data to GRAM |
608 | 161 rcall TFT_CmdWrite |
162 | |
628 | 163 movlw .160 ; 160 x 240 x 6 = 230400 ticks |
164 TFT_ClearScreen_display2_loop0: | |
623 | 165 bsf tft_rs ; data! |
608 | 166 movwf PRODH |
167 clrf PORTH | |
623 | 168 TFT_ClearScreen_display2_loop1: |
608 | 169 movlw .240 |
170 movwf PRODL | |
623 | 171 TFT_ClearScreen_display2_loop2: |
608 | 172 bcf tft_nwr |
623 | 173 bsf tft_nwr ; upper |
608 | 174 bcf tft_nwr |
623 | 175 bsf tft_nwr ; high |
608 | 176 bcf tft_nwr |
623 | 177 bsf tft_nwr ; lower |
608 | 178 bcf tft_nwr |
623 | 179 bsf tft_nwr ; upper |
608 | 180 bcf tft_nwr |
623 | 181 bsf tft_nwr ; high |
608 | 182 bcf tft_nwr |
623 | 183 bsf tft_nwr ; lower |
608 | 184 decfsz PRODL,F |
623 | 185 bra TFT_ClearScreen_display2_loop2 |
608 | 186 decfsz PRODH,F |
623 | 187 bra TFT_ClearScreen_display2_loop1 |
188 return | |
0 | 189 |
628 | 190 TFT_ClearScreen_display3: |
191 movlw 0x35 ; vertical start address HIGH:LOW | |
192 rcall TFT_CmdWrite | |
631 | 193 mullw 0 |
628 | 194 rcall TFT_DataWrite_PROD |
195 | |
196 movlw 0x36 ; vertical end address HIGH:LOW | |
197 rcall TFT_CmdWrite | |
198 movlw 0x01 | |
199 rcall TFT_DataWrite | |
200 movlw 0x3F | |
201 rcall TFT_DataWrite | |
202 | |
203 movlw 0x37 ; horizontal address START:END | |
204 rcall TFT_CmdWrite | |
205 movlw 0x00 | |
206 rcall TFT_DataWrite | |
207 movlw 0xEF | |
208 rcall TFT_DataWrite | |
209 | |
210 movlw 0x20 ; start address horizontal (.0 - .239) | |
211 rcall TFT_CmdWrite | |
212 rcall TFT_DataWrite_PROD | |
213 | |
214 movlw 0x21 ; start address vertical (.0 - .319) | |
215 rcall TFT_CmdWrite | |
216 rcall TFT_DataWrite_PROD | |
217 | |
218 movlw 0x22 ; start writing data to GRAM | |
219 rcall TFT_CmdWrite | |
220 | |
221 movlw .107 ; 107 x 240 x 6 = 154080 ticks (153600 would be enough) | |
222 bra TFT_ClearScreen_display2_loop0 | |
223 | |
224 | |
0 | 225 ;============================================================================= |
582 | 226 |
227 global TFT_DisplayOff | |
0 | 228 TFT_DisplayOff: |
628 | 229 bcf lightsen_power ; power-down light sensor |
631 | 230 btfsc screen_type3 ; screen type 3 ? |
231 bra TFT_DisplayOff_display3 ; YES - screen needs special power-down sequence | |
232 clrf CCP1CON ; NO - stop PWM | |
233 bcf PORTC,2 ; - pull PWM out to GND | |
0 | 234 clrf PORTA |
582 | 235 clrf PORTH |
623 | 236 RD_L ; LOW |
237 RS_L ; LOW | |
238 bcf tft_nwr | |
239 bcf tft_cs | |
240 bcf tft_nreset | |
241 bsf tft_power ; inverted... | |
628 | 242 return |
243 | |
244 TFT_DisplayOff_display3: | |
245 movlw 0x05 | |
246 rcall TFT_CmdWrite | |
247 movlw 0x00 | |
248 rcall TFT_DataWrite | |
249 movlw 0x00 | |
250 rcall TFT_DataWrite | |
251 WAITMS d'32' | |
252 clrf CCP1CON ; stop PWM | |
253 bcf PORTC,2 ; pull PWM out to GND | |
254 WAITMS d'32' | |
255 movlw 0x10 | |
256 rcall TFT_CmdWrite | |
257 movlw 0x00 | |
258 rcall TFT_DataWrite | |
259 movlw 0x01 | |
260 rcall TFT_DataWrite | |
261 WAITMS d'100' | |
262 clrf PORTH | |
263 bcf tft_nwr | |
264 bcf tft_cs | |
265 bcf tft_nreset | |
266 WAITMS d'10' | |
267 bsf tft_power ; inverted... | |
0 | 268 return |
269 | |
270 ; ----------------------------- | |
271 ; TFT boot | |
272 ; ----------------------------- | |
582 | 273 |
274 global TFT_boot | |
0 | 275 TFT_boot: |
623 | 276 ; switch off backlight |
277 clrf CCP1CON ; stop PWM | |
278 bcf PORTC,2 ; pull PWM out to GND | |
279 | |
0 | 280 clrf PORTA |
281 clrf PORTH | |
628 | 282 |
0 | 283 RD_L ; LOW |
284 nop | |
628 | 285 WR_L |
286 nop | |
287 NCS_L ; Not CS | |
0 | 288 nop |
289 bcf tft_nreset | |
290 WAITMS d'1' | |
291 bcf tft_power ; inverted... | |
292 WAITMS d'1' | |
293 RD_H ; Keep high | |
628 | 294 nop |
0 | 295 WAITMS d'2' |
296 bsf tft_nreset | |
461 | 297 WAITMS d'5' |
298 bcf tft_nreset | |
299 WAITMS d'5' | |
300 bsf tft_nreset | |
0 | 301 WAITMS d'150' |
628 | 302 WR_H ; release bus |
604 | 303 bsf lightsen_power ; supply power to light sensor |
0 | 304 |
628 | 305 btfsc screen_type3 ; display type 3 ? |
306 bra TFT_boot_screen3 ; YES | |
307 | |
582 | 308 ; Data Transfer Synchronization |
0 | 309 Parameter_out 0x00, 0x00 |
310 Parameter_out 0x00, 0x00 | |
582 | 311 |
623 | 312 btfsc screen_type2 ; display type 2 ? |
313 bra TFT_boot_screen2 ; YES | |
608 | 314 |
623 | 315 ; Get screen type from Bootloader-Info |
582 | 316 movlw 0x7B |
317 movwf TBLPTRL | |
318 movlw 0xF7 | |
319 movwf TBLPTRH | |
320 movlw 0x01 | |
321 movwf TBLPTRU | |
623 | 322 TBLRD*+ ; reads 0x6E for cR and USB OSTC3, 0x00 for BLE (2 and 3), and 0x02 for display 1 OSTC |
323 movlw 0x02 ; coding for display 1 | |
324 cpfseq TABLAT ; display 1 ? | |
325 bra TFT_boot_0 ; NO - display 0 | |
360 | 326 |
327 TFT_boot_1: | |
582 | 328 ; Init through config table... |
329 movlw 0x74 | |
330 movwf TBLPTRL | |
331 movlw 0xF7 | |
332 movwf TBLPTRH | |
333 movlw 0x01 | |
334 movwf TBLPTRU | |
628 | 335 bsf screen_type1 |
582 | 336 bra TFT_boot_com |
360 | 337 |
441
360acdcda0d7
+BUGFIX: Compatibility with "hwOS Config" fixed
heinrichsweikamp
parents:
436
diff
changeset
|
338 TFT_boot_0: |
582 | 339 ; Init through config table... |
340 movlw LOW display0_config_table | |
341 movwf TBLPTRL | |
342 movlw HIGH display0_config_table | |
343 movwf TBLPTRH | |
344 movlw UPPER display0_config_table | |
345 movwf TBLPTRU | |
628 | 346 bcf screen_type1 |
582 | 347 |
360 | 348 TFT_boot_com: |
582 | 349 rcall display0_init_loop |
0 | 350 |
582 | 351 Index_out 0x03 |
352 btfsc flip_screen ; 180° rotation ? | |
604 | 353 bra TFT_boot2 ; YES |
360 | 354 |
628 | 355 btfss screen_type1 ; display1? |
604 | 356 bra TFT_boot1a ; NO |
582 | 357 Parameter_out 0x10, 0x00 ; display1 |
358 bra TFT_boot3 | |
360 | 359 TFT_boot1a: |
582 | 360 Parameter_out 0x50, 0x20 ; display0 |
361 bra TFT_boot3 | |
152
19ad15f04f60
BUGFIX: Clear Setpoint-Fallback warning when in bailout
heinrichsweikamp
parents:
151
diff
changeset
|
362 TFT_boot2: |
628 | 363 btfss screen_type1 ; display1? |
604 | 364 bra TFT_boot2a ; NO |
582 | 365 Parameter_out 0x10, 0x30 ; display1 |
366 bra TFT_boot3 | |
360 | 367 TFT_boot2a: |
582 | 368 Parameter_out 0x50, 0x10 ; display0 |
152
19ad15f04f60
BUGFIX: Clear Setpoint-Fallback warning when in bailout
heinrichsweikamp
parents:
151
diff
changeset
|
369 TFT_boot3: |
0 | 370 Index_out 0x22 |
225
31088352ee32
BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents:
152
diff
changeset
|
371 rcall TFT_ClearScreen |
0 | 372 Index_out 0x07 |
312 | 373 Parameter_out 0x01, 0x33 |
0 | 374 return |
375 | |
376 display0_config_table: | |
582 | 377 ; Reg, Dat0, Dat1 or 0xFF,0x00,0x00 for end |
378 db 0xA4,0x00,0x01,0xFF,.002,0x00 | |
379 db 0x09,0x00,0x01,0x92,0x04,0x00 | |
380 db 0x93,0x04,0x02,0x94,0x00,0x02 | |
381 db 0x07,0x00,0x00,0x10,0x04,0x30 | |
382 db 0x11,0x02,0x37,0x12,0x11,0x8D | |
383 db 0x13,0x11,0x00,0x01,0x01,0x00 | |
384 db 0x02,0x02,0x00,0x03,0x50,0x20 | |
385 db 0x0A,0x00,0x08,0x0D,0x00,0x00 | |
386 db 0x0E,0x00,0x30,0xFF,.151,0x00 | |
387 db 0x12,0x11,0xBD,0x20,0x00,0x00 | |
388 db 0x21,0x00,0x00,0x30,0x06,0x02 | |
389 db 0x31,0x56,0x0D,0x32,0x05,0x07 | |
390 db 0x33,0x06,0x09,0x34,0x00,0x00 | |
391 db 0x35,0x09,0x06,0x36,0x57,0x05 | |
392 db 0x37,0x0D,0x06,0x38,0x02,0x06 | |
393 db 0x39,0x00,0x00,0xFF,0x00,0x00 | |
0 | 394 |
395 display0_init_loop: | |
582 | 396 TBLRD*+ |
397 movlw 0xFF | |
398 cpfseq TABLAT | |
623 | 399 bra display0_config_write ; write configuration data pair to display |
582 | 400 ; Delay ms or quit (return) |
401 TBLRD*+ | |
623 | 402 tstfsz TABLAT ; end of configuration data? |
604 | 403 bra $+4 ; NO |
404 return ; YES - done | |
582 | 405 movf TABLAT,W |
604 | 406 call WAITMSX ; wait WREG milliseconds |
407 TBLRD*+ ; dummy read (Third byte of delay command) | |
408 bra display0_init_loop ; loop | |
0 | 409 |
604 | 410 display0_config_write: ; with command in WREG |
582 | 411 movf TABLAT,W |
604 | 412 rcall TFT_CmdWrite ; write command |
413 TBLRD*+ ; get config0 | |
582 | 414 movff TABLAT,PORTA |
604 | 415 TBLRD*+ ; get config1 |
582 | 416 movf TABLAT,W |
623 | 417 rcall TFT_DataWrite ; write configuration |
604 | 418 bra display0_init_loop ; loop |
0 | 419 |
623 | 420 |
608 | 421 TFT_boot_screen2: |
623 | 422 rcall display1_init ; initialization sequence |
608 | 423 |
623 | 424 btfss flip_screen ; 180° rotation? |
425 bra TFT_ClearScreen ; NO - done: clear screen and return | |
426 ; flip the GRAM | |
427 Index_out 0x16 | |
428 movlw 0x48 ; flip image in the GRAM (very elegant with display 2...) | |
429 rcall TFT_DataWrite ; Write configuration | |
430 bra TFT_ClearScreen ; clear screen and return | |
608 | 431 |
628 | 432 TFT_boot_screen3: |
433 rcall display1_init ; init sequence | |
434 rcall TFT_ClearScreen | |
435 setf CCPR1L ; duty cycle, 255 is required for OLED | |
436 ; Set brightness | |
437 movff opt_brightness,PRODL ; =0: Eco, =1:Medium, =2:Full | |
438 incf PRODL,F ; +1 | |
439 dcfsnz PRODL,F | |
440 rcall TFT_display3_low | |
441 dcfsnz PRODL,F | |
442 rcall TFT_display3_med | |
443 dcfsnz PRODL,F | |
444 rcall TFT_display3_high | |
445 ; ToDo: Flip.... | |
446 return | |
447 | |
608 | 448 display1_init: |
623 | 449 movlw LOW (0x1F8BC ) |
450 movwf TBLPTRL | |
451 movlw HIGH (0x1F8BC & 0xFFFF) | |
452 movwf TBLPTRH | |
453 movlw UPPER (0x1F8BC ) | |
454 movwf TBLPTRU | |
608 | 455 display1_init_loop: |
623 | 456 TBLRD*+ |
457 movlw 0xFF ; coding for end of configuration or wait step | |
458 cpfseq TABLAT | |
459 bra display1_config_write ; write configuration pair to display | |
460 ; Delay ms or quit (return) | |
461 TBLRD*+ | |
462 tstfsz TABLAT ; end of configuration? | |
463 bra $+4 ; NO - skip return | |
464 return ; YES - done | |
465 movf TABLAT,W ; read waiting time | |
466 call WAITMSX ; wait WREG milliseconds | |
467 bra display1_init_loop ; loop | |
468 display1_config_write: ; with command in WREG | |
469 movf TABLAT,W | |
470 rcall TFT_CmdWrite ; write command | |
471 TBLRD*+ ; get configuration | |
472 movf TABLAT,W | |
473 rcall TFT_DataWrite ; write configuration | |
628 | 474 btfss screen_type3 ; screen 3 ? |
475 bra display1_init_loop ; NO - loop | |
476 ; Screen 3 gets another byte from the table | |
477 TBLRD*+ ; get configuration | |
478 movf TABLAT,W | |
479 rcall TFT_DataWrite ; write configuration | |
623 | 480 bra display1_init_loop ; loop |
608 | 481 |
0 | 482 ;============================================================================= |
623 | 483 |
484 global TFT_CmdWrite | |
608 | 485 TFT_CmdWrite: |
486 RS_L ; command | |
628 | 487 ; btfsc screen_type2 |
488 ; bra TFT_CmdWrite_screen2 | |
608 | 489 clrf PORTA ; upper |
490 bcf INTCON,GIE | |
491 movwf PORTH ; lower | |
492 WR_L | |
493 WR_H ; tick | |
494 bsf INTCON,GIE | |
495 return | |
628 | 496 ;TFT_CmdWrite_screen2: |
497 ; movwf PORTH ; lower | |
498 ; WR_L | |
499 ; WR_H ; tick | |
500 ; return; | |
608 | 501 |
502 global TFT_DataWrite | |
503 TFT_DataWrite: | |
504 RS_H ; data | |
628 | 505 ; btfsc screen_type2 |
506 ; bra TFT_DataWrite_screen2 | |
608 | 507 bcf INTCON,GIE |
623 | 508 movwf PORTH ; lower |
608 | 509 WR_L |
510 WR_H ; tick | |
511 bsf INTCON,GIE | |
512 return | |
628 | 513 ;TFT_DataWrite_screen2: |
514 ; movwf PORTH ; lower | |
515 ; WR_L | |
516 ; WR_H ; tick | |
517 ; return | |
608 | 518 |
623 | 519 |
608 | 520 ;============================================================================= |
0 | 521 ; Smooth lighting-up of the display: |
522 ; | |
523 ; Trashes: WREG, PRODL | |
524 ; Typical usage: | |
604 | 525 ; clrf CCPR1L ; backlight off |
582 | 526 ; [draw splash screen] |
527 ; call TFT_DisplayFadeIn | |
528 | |
529 global TFT_Display_FadeIn | |
0 | 530 TFT_Display_FadeIn: |
623 | 531 movlw CCP1CON_VALUE ; get configuration |
532 movwf CCP1CON ; set configuration | |
604 | 533 bsf tft_is_dimming ; TFT is dimming, ignore ambient sensor |
628 | 534 btfsc screen_type3 |
535 bra TFT_Display_FadeIn_1 | |
604 | 536 clrf CCPR1L ; backlight off - to be sure |
582 | 537 movff max_CCPR1L,PRODL |
0 | 538 TFT_Display_FadeIn_0: |
604 | 539 incf CCPR1L,F ; duty cycle |
582 | 540 WAITMS d'2' |
541 decfsz PRODL,F | |
623 | 542 bra TFT_Display_FadeIn_0 |
604 | 543 bcf tft_is_dimming ; dimming done |
582 | 544 return |
628 | 545 TFT_Display_FadeIn_1: |
546 setf CCPR1L | |
547 return | |
0 | 548 |
549 ;============================================================================= | |
550 ; Smooth lighting-off of the display: | |
551 ; Trashes: WREG, PRODL | |
582 | 552 |
553 global TFT_Display_FadeOut | |
0 | 554 TFT_Display_FadeOut: |
582 | 555 movff max_CCPR1L,PRODL |
604 | 556 bsf tft_is_dimming ; TFT is dimming, ignore ambient sensor |
628 | 557 btfsc screen_type3 |
558 bra TFT_Display_FadeOut_1 | |
0 | 559 TFT_Display_FadeOut_0: |
604 | 560 movff PRODL,CCPR1L ; duty cycle |
582 | 561 WAITMS d'1' |
562 decfsz PRODL,F | |
563 bra TFT_Display_FadeOut_0 | |
628 | 564 TFT_Display_FadeOut_1: |
582 | 565 clrf CCPR1L |
566 return | |
0 | 567 |
568 ;============================================================================= | |
628 | 569 ; OLED brightness control |
570 TFT_display3_high: ; 0x01F8F8 | |
571 movlw LOW (0x01F8F8 ) | |
572 movwf TBLPTRL | |
573 movlw HIGH (0x01F8F8 & 0xFFFF) | |
574 movwf TBLPTRH | |
575 movlw UPPER (0x01F8F8 ) | |
576 movwf TBLPTRU | |
577 bra display1_init_loop ; and return | |
578 | |
579 TFT_display3_med: ; 0x01F91C | |
580 movlw LOW (0x01F91C ) | |
581 movwf TBLPTRL | |
582 movlw HIGH (0x01F91C & 0xFFFF) | |
583 movwf TBLPTRH | |
584 movlw UPPER (0x01F91C ) | |
585 movwf TBLPTRU | |
586 bra display1_init_loop ; and return | |
587 | |
588 TFT_display3_low: ; 0x01F8D4 | |
589 movlw LOW (0x01F8D4 ) | |
590 movwf TBLPTRL | |
591 movlw HIGH (0x01F8D4 & 0xFFFF) | |
592 movwf TBLPTRH | |
593 movlw UPPER (0x01F8D4 ) | |
594 movwf TBLPTRU | |
595 bra display1_init_loop ; and return | |
596 | |
597 ;============================================================================= | |
0 | 598 |
604 | 599 global box_std_block, box_black_block, box_color_block |
0 | 600 |
604 | 601 box_std_block: ; use white color |
582 | 602 setf WREG |
623 | 603 bra box_common |
604 | 604 box_black_block: ; use black color |
582 | 605 clrf WREG |
0 | 606 box_common: |
607 box_color_block: | |
582 | 608 rcall TFT_set_color |
609 VARARGS_BEGIN | |
610 VARARGS_GET8 win_top | |
611 VARARGS_GET8 win_height | |
612 VARARGS_GET8 win_leftx2 | |
613 VARARGS_GET8 win_width | |
614 VARARGS_END | |
615 bra TFT_box | |
0 | 616 |
617 ;----------------------------------------------------------------------------- | |
618 | |
582 | 619 global box_frame_std, box_frame_common, box_frame_color, box_frame_color16 |
0 | 620 |
621 box_frame_std: | |
582 | 622 setf WREG |
623 rcall TFT_set_color | |
0 | 624 box_frame_common: |
582 | 625 VARARGS_BEGIN |
626 VARARGS_GET8 win_top | |
627 VARARGS_GET8 win_height | |
628 VARARGS_GET8 win_leftx2 | |
629 VARARGS_GET8 win_width | |
630 VARARGS_END | |
631 bra TFT_frame | |
0 | 632 box_frame_color: |
582 | 633 rcall TFT_set_color |
0 | 634 box_frame_color16: |
582 | 635 bra box_frame_common |
0 | 636 |
434 | 637 ;;============================================================================= |
638 ;; Init for half_pixel_write | |
639 ;; Set column register on TFT device, and current color. | |
640 ;; Inputs: win_leftx2 | |
641 ;; Outputs: win_color:2 | |
642 ;; Trashed: WREG, PROD | |
582 | 643 ; |
644 ; global init_pixel_write | |
434 | 645 ;init_pixel_write: |
582 | 646 ; movf win_leftx2,W |
647 ; mullw 2 | |
604 | 648 ; rcall pixel_write_col320 ; start address vertical (.0 - .319) |
582 | 649 ; setf WREG |
650 ; bra TFT_set_color | |
0 | 651 |
652 ;----------------------------------------------------------------------------- | |
653 ; Writes two half-pixels at position (win_top,win_leftx2) | |
654 ; Inputs: win_leftx2, win_top, win_color:2 | |
655 ; Trashed: WREG, PROD | |
582 | 656 |
657 global pixel_write | |
0 | 658 pixel_write: |
582 | 659 movf win_leftx2,W |
623 | 660 mullw .2 ; win_leftx2 x 2 -> PRODH:PRODL |
604 | 661 rcall pixel_write_col320 ; start address vertical (.0 - .319) |
662 rcall half_pixel_write ; write this half-one | |
628 | 663 |
604 | 664 movf win_leftx2,W ; address of next one |
623 | 665 mullw .2 ; win_leftx2 x 2 -> PRODH:PRODL |
666 INCI PROD ; PROD++ | |
582 | 667 rcall pixel_write_col320 |
628 | 668 bra half_pixel_write ; and return... note: cmd 0x20 is mandatory, because |
582 | 669 ; of the auto-increment going vertical |
0 | 670 |
671 global pixel_write_col320 | |
672 pixel_write_col320: | |
628 | 673 btfsc screen_type2 ; display type 2 ? |
674 bra pixel_write_col320_d2 ; YES | |
675 btfsc screen_type1 ; display type 1 ? | |
676 bra pixel_write_col320_d1 ; YES | |
677 btfsc screen_type3 ; display type 3 ? | |
678 bra pixel_write_col320_d3 ; YES | |
679 ; NO to all - display type 0 | |
582 | 680 btfss flip_screen ; 180° rotation? |
604 | 681 bra pixel_write_noflip_H ; NO |
682 bra pixel_write_flip_H ; YES | |
623 | 683 pixel_write_col320_d1: ; display type 1 |
582 | 684 btfsc flip_screen ; 180° rotation? |
623 | 685 bra pixel_write_noflip_H ; YES |
604 | 686 pixel_write_flip_H: ; flip d0 |
687 movf PRODL,W ; 16 bits 319 - PROD --> PROD | |
623 | 688 sublw LOW .319 ; 319-W --> W |
582 | 689 movwf PRODL |
690 movf PRODH,W | |
604 | 691 btfss STATUS,C ; borrow = /CARRY |
582 | 692 incf WREG |
623 | 693 sublw HIGH .319 |
582 | 694 movwf PRODH |
151 | 695 |
696 pixel_write_noflip_H: | |
604 | 697 Index_out 0x21 ; frame memory vertical address |
582 | 698 bra TFT_DataWrite_PROD ; and return... |
0 | 699 |
608 | 700 pixel_write_col320_d2: |
623 | 701 movlw 0x06 |
702 rcall TFT_CmdWrite | |
703 movf PRODH,W | |
704 rcall TFT_DataWrite | |
705 movlw 0x07 | |
706 rcall TFT_CmdWrite | |
707 movf PRODL,W | |
708 rcall TFT_DataWrite | |
608 | 709 |
623 | 710 incf PRODL,F |
711 movlw .0 | |
712 addwfc PRODH,F ; +1 | |
608 | 713 |
623 | 714 movlw 0x08 |
715 rcall TFT_CmdWrite | |
716 movf PRODH,W | |
717 rcall TFT_DataWrite | |
718 movlw 0x09 | |
719 rcall TFT_CmdWrite | |
720 movf PRODL,W | |
721 bra TFT_DataWrite ; ... and return | |
608 | 722 |
628 | 723 pixel_write_col320_d3: |
724 movlw 0x21 ; start address vertical (.0 - .319) | |
725 rcall TFT_CmdWrite | |
726 bra TFT_DataWrite_PROD ; and return... | |
727 | |
0 | 728 ;----------------------------------------------------------------------------- |
729 ; Writes one half-pixel at position (win_top,win_leftx2). | |
730 ; Inputs: win_leftx2, win_top, win_color:2 | |
731 ; Trashed: WREG, PROD | |
582 | 732 |
733 global half_pixel_write | |
0 | 734 half_pixel_write: |
628 | 735 movf win_top,W ; d'0' ... d'239' |
736 ; Variant with Y position in WREG | |
0 | 737 half_pixel_write_1: |
628 | 738 btfsc screen_type2 ; display type 2 ? |
739 bra half_pixel_write_1_display2 ; YES | |
740 btfsc screen_type3 ; display type 3 ? | |
741 bra half_pixel_write_1_display3 ; YES | |
608 | 742 |
628 | 743 half_pixel_write_1_display1: |
582 | 744 btfss flip_screen ; 180° rotation? |
745 sublw .239 ; 239-Y --> Y | |
604 | 746 mullw .1 ; copy row to PRODL (PRODH=0) |
747 Index_out 0x20 ; frame memory horizontal address | |
582 | 748 rcall TFT_DataWrite_PROD |
0 | 749 |
604 | 750 Index_out 0x22 ; frame memory data write start |
751 RS_H ; data | |
582 | 752 bcf INTCON,GIE |
604 | 753 movff win_color1,PORTA ; upper |
754 movff win_color2,PORTH ; lower | |
582 | 755 WR_L |
604 | 756 WR_H ; tick |
582 | 757 bsf INTCON,GIE |
758 return | |
0 | 759 |
628 | 760 half_pixel_write_1_display2: |
623 | 761 mullw 1 ; copy row to PRODL (PRODH=0) |
762 ; Row address start | |
763 movlw 0x02 | |
764 rcall TFT_CmdWrite | |
765 movlw .0 | |
766 rcall TFT_DataWrite | |
767 movlw 0x03 | |
768 rcall TFT_CmdWrite | |
769 movf PRODL,W | |
770 rcall TFT_DataWrite | |
608 | 771 |
623 | 772 incf PRODL,F |
608 | 773 |
623 | 774 movlw 0x04 |
775 rcall TFT_CmdWrite | |
776 movlw .0 | |
777 rcall TFT_DataWrite | |
778 movlw 0x05 | |
779 rcall TFT_CmdWrite | |
780 movf PRODL,W | |
781 rcall TFT_DataWrite | |
608 | 782 |
783 movff win_color1,PRODH | |
784 movff win_color2,PRODL | |
785 rcall convert_for_display2 | |
786 | |
623 | 787 movlw 0x22 ; start writing data to GRAM |
788 rcall TFT_CmdWrite | |
789 RS_H ; data | |
790 movff win_color5, PORTH | |
608 | 791 WR_L |
623 | 792 WR_H ; tick |
793 movff win_color4, PORTH | |
608 | 794 WR_L |
623 | 795 WR_H ; tick |
796 movff win_color3, PORTH | |
608 | 797 WR_L |
623 | 798 WR_H ; tick |
799 return | |
608 | 800 |
628 | 801 half_pixel_write_1_display3: |
802 mullw 1 ; copy row to PRODL (PRODH=0) | |
803 | |
804 movlw 0x20 ; horizontal address START:END | |
805 rcall TFT_CmdWrite | |
806 rcall TFT_DataWrite_PROD | |
807 | |
808 movlw 0x22 ; start writing data to GRAM | |
809 rcall TFT_CmdWrite | |
810 RS_H ; data | |
811 movff win_color1, PORTH | |
812 WR_L | |
813 WR_H ; tick | |
814 movff win_color2, PORTH | |
815 WR_L | |
816 WR_H ; tick | |
817 return ; done | |
818 | |
0 | 819 ;----------------------------------------------------------------------------- |
820 ; Writes a vertical line of half-pixel at position (win_top,win_leftx2,win_height). | |
821 ; Inputs: win_leftx2, win_top, win_height, win_color:2 | |
822 ; Trashed: WREG, PROD, TABLAT, TBLPTRL | |
582 | 823 |
0 | 824 global half_vertical_line |
825 half_vertical_line: | |
604 | 826 clrf TABLAT ; loop index |
0 | 827 |
828 half_vertical_line_loop: | |
604 | 829 movf win_leftx2,W ; init X position |
623 | 830 mullw .2 ; win_leftx2 x 2 -> PRODH:PRODL |
604 | 831 movf TABLAT,W ; get loop index |
832 andlw .1 ; just low bit | |
833 xorwf PRODL,F ; and use it to jitter current X position | |
834 rcall pixel_write_col320 ; start address vertical (.0 - .319) | |
0 | 835 |
604 | 836 movf win_height,W ; index reached height (bank0 read) ? |
582 | 837 xorwf TABLAT,W |
604 | 838 btfsc STATUS,Z ; Equal ? |
839 return ; YES - done | |
840 movf win_top,W ; Y = top + index (bank0 read) | |
582 | 841 addwf TABLAT,W |
842 rcall half_pixel_write_1 | |
843 incf TABLAT,F ; index++ | |
844 bra half_vertical_line_loop | |
0 | 845 |
846 ;----------------------------------------------------------------------------- | |
847 ; Writes a horizontal line of half-pixel at position (win_top,win_leftx2,win_width). | |
848 ; Inputs: win_leftx2, win_top, win_width, win_color:2 | |
849 ; Trashed: WREG, PROD, TABLAT, TBLPTRL | |
582 | 850 |
0 | 851 global half_horizontal_line |
852 half_horizontal_line: | |
604 | 853 clrf TABLAT ; loop index |
0 | 854 |
855 half_horizontal_line_loop: | |
604 | 856 movf win_leftx2,W ; init X position |
623 | 857 mullw .2 ; win_leftx2 x 2 -> PRODH:PRODL |
604 | 858 rcall pixel_write_col320 ; start address vertical (.0 - .319) |
859 movf win_width,W ; index reached height (bank0 read) ? | |
582 | 860 xorwf TABLAT,W |
604 | 861 btfsc STATUS,Z ; equal ? |
862 return ; YES - done | |
863 movf win_top,W ; Y = top + index (bank0 read) | |
582 | 864 addwf TABLAT,W |
865 rcall half_pixel_write_1 | |
866 incf TABLAT,F ; index++ | |
867 bra half_horizontal_line_loop | |
0 | 868 |
869 | |
870 ;----------------------------------------------------------------------------- | |
623 | 871 ; TFT Data Command via W |
582 | 872 |
873 global TFT_DataWrite_PROD | |
0 | 874 TFT_DataWrite_PROD: |
623 | 875 ; RD_H ; keep high |
876 RS_H ; data | |
877 btfsc screen_type2 ; screen type 2 ? | |
878 bra TFT_DataWrite_PROD_display2 ; YES | |
628 | 879 btfsc screen_type3 ; screen type 3 ? |
880 bra TFT_DataWrite_PROD_display2 ; YES | |
623 | 881 bcf INTCON,GIE ; NO - |
882 movff PRODH,PORTA ; - move high byte to PORTA | |
883 movff PRODL,PORTH ; - move low byte to PORTH | |
884 WR_L ; - tick | |
885 WR_H ; - tack | |
886 bsf INTCON,GIE ; - | |
887 return ; - done | |
0 | 888 |
608 | 889 TFT_DataWrite_PROD_display2: |
623 | 890 movff PRODH,PORTH ; move high byte to PORTH (display 2 is big endian) |
891 WR_L ; tick | |
892 WR_H ; tack | |
893 movff PRODL,PORTH ; move low byte to PORTH | |
894 WR_L ; tick | |
895 WR_H ; tack | |
628 | 896 btfsc screen_type3 ; screen type 3 ? |
897 return ; YES - done | |
898 movff win_color3,PORTH ; NO - move low(est) byte to PORTH | |
899 WR_L ; - tick | |
900 WR_H ; - tack | |
901 return ; - done | |
623 | 902 |
608 | 903 |
0 | 904 TFT_DataRead_PROD: |
604 | 905 Index_out 0x22 ; frame memory data read start |
360 | 906 TFT_CmdRead_PROD: |
604 | 907 setf TRISA ; port A as input |
908 setf TRISH ; port H as input | |
909 RS_H ; data | |
910 WR_H ; not write | |
911 RD_L ; read | |
582 | 912 nop |
913 nop | |
914 nop | |
604 | 915 RD_H ; tick |
582 | 916 nop |
917 nop | |
918 nop | |
604 | 919 RD_L ; read |
582 | 920 nop |
921 ;nop | |
922 ;nop | |
923 movff PORTA,PRODH | |
924 movff PORTH,PRODL | |
604 | 925 RD_H ; tick |
582 | 926 nop |
604 | 927 clrf TRISA ; port A as output |
928 clrf TRISH ; port H as output | |
0 | 929 return |
930 | |
931 ;============================================================================= | |
604 | 932 ; Output TFT Window Address commands |
933 ; Inputs : win_top, win_leftx2, win_height, win_width | |
934 ; Output : PortA/PortH commands | |
0 | 935 ; Trashed: PROD |
582 | 936 |
937 global TFT_box_write | |
0 | 938 TFT_box_write: |
623 | 939 movf win_leftx2,W ; compute left = 2 * leftx2 --> PROD |
940 mullw .2 ; win_leftx2 x 2 -> PRODH:PRODL | |
0 | 941 |
623 | 942 btfsc screen_type2 ; screen type 2 ? |
943 bra TFT_box_write_display2 ; YES | |
628 | 944 btfsc screen_type3 ; screen type 3 ? |
945 bra TFT_box_write_display3 ; YES | |
608 | 946 |
582 | 947 global TFT_box_write_16bit_win_left |
623 | 948 TFT_box_write_16bit_win_left: ; with column in PRODL:PRODH |
628 | 949 btfsc screen_type1 ; screen type 1 ? |
604 | 950 bra TFT_box_write_16bit_win_left_d1 ; YES |
623 | 951 ; screen type 0 |
582 | 952 btfsc flip_screen ; 180° rotation? |
628 | 953 bra TFT_box_flip_H ; YES |
604 | 954 bra TFT_box_write_16bit_win_left_com ; NO |
582 | 955 TFT_box_write_16bit_win_left_d1: ; Display1 |
956 btfss flip_screen ; 180° rotation? | |
628 | 957 bra TFT_box_flip_H ; NO |
623 | 958 TFT_box_write_16bit_win_left_com: ; YES for screen type 1, NO for type 0 |
582 | 959 ;---- Normal horizontal window --------------------------------------- |
604 | 960 Index_out 0x52 ; window vertical start address |
961 rcall TFT_DataWrite_PROD ; output left | |
962 Index_out 0x21 ; frame memory vertical address | |
963 rcall TFT_DataWrite_PROD ; output left | |
0 | 964 |
582 | 965 movf win_width+0,W ; right = left + width - 1 |
432 | 966 addwf PRODL,F |
967 movf win_width+1,W | |
968 addwfc PRODH,F | |
623 | 969 decf PRODL,F ; right-- |
582 | 970 btfss STATUS,C |
432 | 971 decf PRODH,F |
0 | 972 |
604 | 973 Index_out 0x53 ; window vertical end address |
582 | 974 rcall TFT_DataWrite_PROD |
628 | 975 bra TFT_box_noflip_H |
0 | 976 |
582 | 977 ;---- Flipped horizontal window -------------------------------------- |
628 | 978 TFT_box_flip_H: |
623 | 979 ; calculate new coordinate |
604 | 980 movf PRODL,W ; 16 bits 319 - PROD --> PROD |
623 | 981 sublw LOW .319 ; 319 - WREG --> WREG |
582 | 982 movwf PRODL |
983 movf PRODH,W | |
604 | 984 btfss STATUS,C ; borrow = /CARRY |
582 | 985 incf WREG |
623 | 986 sublw HIGH .319 |
582 | 987 movwf PRODH |
152
19ad15f04f60
BUGFIX: Clear Setpoint-Fallback warning when in bailout
heinrichsweikamp
parents:
151
diff
changeset
|
988 |
604 | 989 Index_out 0x53 ; window vertical start address |
990 rcall TFT_DataWrite_PROD ; output left | |
991 Index_out 0x21 ; frame memory vertical address | |
992 rcall TFT_DataWrite_PROD ; output left | |
151 | 993 |
623 | 994 ; calculate new coordinate |
604 | 995 movf win_width+0,W ; 16 bits PROD - width --> PROD |
582 | 996 subwf PRODL,F ; PRODL - WREG --> PRODL |
997 movf win_width+1,W | |
998 subwfb PRODH,F | |
623 | 999 INCI PROD ; PROD++ |
151 | 1000 |
604 | 1001 Index_out 0x52 ; window vertical end address |
582 | 1002 rcall TFT_DataWrite_PROD |
151 | 1003 |
628 | 1004 TFT_box_noflip_H: |
582 | 1005 btfss flip_screen ; 180° rotation ? |
604 | 1006 bra TFT_box_noflip_V ; NO |
151 | 1007 |
582 | 1008 ;---- Flipped vertical window ----------------------------------------- |
623 | 1009 ; calculate new coordinate |
582 | 1010 movff win_top,PRODH ; top --> PRODH (first byte) |
1011 movf win_height,W | |
1012 addwf PRODH,W | |
432 | 1013 decf WREG |
604 | 1014 movwf PRODL ; top + height - 1 --> PRODL (second byte) |
151 | 1015 |
604 | 1016 Index_out 0x50 ; window horizontal start address |
432 | 1017 movf PRODH,W |
604 | 1018 rcall TFT_DataWrite ; lower (and tick) |
151 | 1019 |
604 | 1020 Index_out 0x51 ; window horizontal end address |
582 | 1021 movf PRODL,W |
604 | 1022 rcall TFT_DataWrite ; lower (and tick) |
582 | 1023 |
604 | 1024 Index_out 0x20 ; frame memory horizontal address |
432 | 1025 movf PRODH,W |
604 | 1026 bra TFT_DataWrite ; lower (and tick) and return |
151 | 1027 |
152
19ad15f04f60
BUGFIX: Clear Setpoint-Fallback warning when in bailout
heinrichsweikamp
parents:
151
diff
changeset
|
1028 TFT_box_noflip_V: |
582 | 1029 ;---- Normal vertical window ---------------------------------------- |
1030 movff win_top,PRODL | |
1031 movf win_height,W | |
1032 addwf PRODL,W | |
1033 sublw .240 ; 240 - top - height | |
604 | 1034 movwf PRODH ; first byte |
0 | 1035 |
432 | 1036 movf PRODL,W |
604 | 1037 sublw .239 ; 239 - top |
1038 movwf PRODL ; --> second byte | |
0 | 1039 |
604 | 1040 Index_out 0x50 ; window horizontal start address |
432 | 1041 movf PRODH,W |
604 | 1042 rcall TFT_DataWrite ; lower (and tick) |
0 | 1043 |
604 | 1044 Index_out 0x51 ; window horizontal end address |
432 | 1045 movf PRODL,W |
604 | 1046 rcall TFT_DataWrite ; lower (and tick) |
0 | 1047 |
604 | 1048 Index_out 0x20 ; frame memory horizontal address |
432 | 1049 movf PRODL,W |
604 | 1050 bra TFT_DataWrite ; lower (and tick) and return |
582 | 1051 |
608 | 1052 |
623 | 1053 TFT_box_write_display2: |
631 | 1054 ; setup left border |
623 | 1055 movlw 0x06 |
1056 rcall TFT_CmdWrite | |
1057 movf PRODH,W | |
1058 rcall TFT_DataWrite | |
1059 movlw 0x07 | |
1060 rcall TFT_CmdWrite | |
1061 movf PRODL,W | |
1062 rcall TFT_DataWrite | |
608 | 1063 |
623 | 1064 movf win_width+0,W ; right = left + width - 1 |
1065 addwf PRODL,F | |
1066 movf win_width+1,W | |
1067 addwfc PRODH,F | |
631 | 1068 decf PRODL,F ; decrement result |
623 | 1069 btfss STATUS,C |
631 | 1070 decf PRODH,F |
608 | 1071 |
631 | 1072 ; setup right border |
623 | 1073 movlw 0x08 |
1074 rcall TFT_CmdWrite | |
1075 movf PRODH,W | |
1076 rcall TFT_DataWrite | |
1077 movlw 0x09 | |
1078 rcall TFT_CmdWrite | |
1079 movf PRODL,W | |
1080 rcall TFT_DataWrite | |
1081 | |
1082 ;---- Normal vertical window ----------------------------------------- | |
1083 ; Output (top) (bottom) | |
1084 movff win_top,PRODH ; top --> PRODH (first byte) | |
1085 movf win_height,W | |
1086 addwf PRODH,W | |
1087 decf WREG | |
1088 movwf PRODL ; top+height-1 --> PRODL (second byte) | |
608 | 1089 |
623 | 1090 movlw 0x02 |
1091 rcall TFT_CmdWrite | |
1092 movlw 0x00 | |
1093 rcall TFT_DataWrite | |
1094 movlw 0x03 | |
1095 rcall TFT_CmdWrite | |
1096 movf PRODH,W | |
1097 rcall TFT_DataWrite | |
608 | 1098 |
623 | 1099 movlw 0x04 |
1100 rcall TFT_CmdWrite | |
1101 movlw 0x00 | |
1102 rcall TFT_DataWrite | |
1103 movlw 0x05 | |
1104 rcall TFT_CmdWrite | |
1105 movf PRODL,W | |
1106 bra TFT_DataWrite ; ... and return | |
0 | 1107 |
628 | 1108 TFT_box_write_display3: |
1109 ;---- Normal horizontal window --------------------------------------- | |
1110 ; Output 0x35 left, | |
631 | 1111 ; 0x36 right == left + width - 1. |
628 | 1112 |
1113 Index_out 0x35 ; window vertical start address | |
1114 rcall TFT_DataWrite_PROD ; output left | |
1115 Index_out 0x21 ; also the horizontal first pix coordinate | |
1116 rcall TFT_DataWrite_PROD ; output left | |
1117 | |
631 | 1118 movf win_width+0,W ; right = left + width - 1 |
628 | 1119 addwf PRODL,F |
631 | 1120 movf win_width+1,W |
628 | 1121 addwfc PRODH,F |
631 | 1122 decf PRODL,F ; decrement result |
628 | 1123 btfss STATUS,C |
631 | 1124 decf PRODH,F |
628 | 1125 |
631 | 1126 Index_out 0x36 ; write and the right border |
628 | 1127 rcall TFT_DataWrite_PROD |
1128 | |
1129 ;---- Normal vertical window ----------------------------------------- | |
1130 ; Output 0x37 (top) (bottom) | |
1131 movff win_top,PRODH ; top --> PRODH (first byte) | |
1132 movff win_height,WREG | |
1133 addwf PRODH,W | |
1134 decf WREG | |
1135 movwf PRODL ; top + height - 1 --> PRODL (second byte) | |
1136 | |
1137 Index_out 0x37 | |
1138 rcall TFT_DataWrite_PROD | |
1139 | |
1140 movff PRODH,PRODL | |
1141 clrf PRODH ; start pixel V coord == top. | |
1142 Index_out 0x20 | |
1143 bra TFT_DataWrite_PROD ; and return... | |
1144 | |
1145 | |
0 | 1146 ;============================================================================= |
604 | 1147 ; TFT_frame : draw a frame around current box with current color |
0 | 1148 ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 |
1149 ; Outputs: (none) | |
1150 ; Trashed: WREG, PROD, aa_start:2, aa_end:2 | |
1151 | |
582 | 1152 global TFT_frame |
1153 TFT_frame: | |
623 | 1154 movff win_top,tft_save_top ; backup everything |
1155 movff win_height,tft_save_height | |
1156 movff win_leftx2,tft_save_left | |
631 | 1157 movff win_width+0,tft_save_width |
0 | 1158 |
582 | 1159 ;---- TOP line ----------------------------------------------------------- |
623 | 1160 movlw .1 ; row ~ height = 1 |
582 | 1161 movwf win_height |
1162 rcall TFT_box | |
0 | 1163 |
582 | 1164 ;---- BOTTOM line -------------------------------------------------------- |
623 | 1165 movff tft_save_top,PRODL ; get back top |
1166 movff tft_save_height,WREG ; get back height | |
1167 addwf PRODL,W ; top + height | |
1168 decf WREG ; top + height - 1 | |
1169 movwf win_top ; top + height - 1 --> top | |
582 | 1170 rcall TFT_box |
0 | 1171 |
582 | 1172 ;---- LEFT column -------------------------------------------------------- |
623 | 1173 movff tft_save_top,win_top ; restore top/height |
1174 movff tft_save_height,win_height | |
1175 movlw .1 ; column ~ width = 1 | |
582 | 1176 movwf win_width+0 |
1177 rcall TFT_box | |
1178 | |
1179 ;---- RIGHT column ------------------------------------------------------- | |
623 | 1180 movff tft_save_left,WREG |
1181 movff tft_save_width,PRODL | |
582 | 1182 addwf PRODL,W |
1183 decf WREG | |
1184 movwf win_leftx2 | |
1185 rcall TFT_box | |
1186 | |
1187 ;---- Restore everything ------------------------------------------------- | |
623 | 1188 movff tft_save_left,win_leftx2 |
631 | 1189 movff tft_save_width,win_width+0 |
582 | 1190 return |
0 | 1191 |
1192 ;============================================================================= | |
604 | 1193 ; TFT_box: fills current box with current color |
1194 ; Inputs : win_top, win_leftx2, win_height, win_width, win_color1, win_color2 | |
0 | 1195 ; Outputs: (none) |
1196 ; Trashed: WREG, PROD | |
1197 | |
582 | 1198 global TFT_box |
0 | 1199 TFT_box: |
582 | 1200 ;---- Define Window ------------------------------------------------------ |
1201 bcf STATUS,C | |
1202 rlcf win_width+0,F | |
1203 rlcf win_width+1,F ; x2 | |
604 | 1204 rcall TFT_box_write ; setup box |
0 | 1205 |
582 | 1206 bcf STATUS,C |
1207 rrcf win_width+1,F ; width /= 2 | |
1208 rrcf win_width+0,F | |
0 | 1209 |
582 | 1210 ;---- Fill Window -------------------------------------------------------- |
604 | 1211 Index_out 0x22 ; frame memory data write start |
1212 clrf PRODH ; column counter | |
1213 RS_H ; data | |
0 | 1214 |
628 | 1215 btfsc screen_type2 ; display type 2 ? |
1216 bra TFT_box_display2 ; YES | |
1217 btfsc screen_type3 ; display type 3 ? | |
1218 bra TFT_box_display3 ; YES | |
1219 | |
604 | 1220 TFT_box2: ; loop height times |
0 | 1221 movff win_height,PRODL |
1222 | |
582 | 1223 TFT_box3: ; loop width times |
623 | 1224 bcf INTCON,GIE |
604 | 1225 movff win_color1,PORTA ; upper |
1226 movff win_color2,PORTH ; lower | |
0 | 1227 WR_L |
604 | 1228 WR_H ; tick |
0 | 1229 WR_L |
604 | 1230 WR_H ; tick |
582 | 1231 bsf INTCON,GIE |
1232 decfsz PRODL,F ; row loop finished ? | |
604 | 1233 bra TFT_box3 ; NO - continue |
0 | 1234 |
582 | 1235 incf PRODH,F ; column count ++ |
628 | 1236 movf win_bargraph,W ; get width of active bargraph part |
1237 cpfseq PRODH ; current column == end of active bargraph ? | |
604 | 1238 bra TFT_box4 ; NO - just loop |
628 | 1239 clrf win_color1 ; YES - switch to black |
604 | 1240 clrf win_color2 ; - ... |
0 | 1241 TFT_box4: |
628 | 1242 movf win_width+0,W ; get total bargraph width |
1243 xorwf PRODH,W ; all columns done? | |
1244 bnz TFT_box2 ; NO - loop | |
0 | 1245 |
582 | 1246 movlw 0x00 ; NOP, to stop window mode |
1247 rcall TFT_CmdWrite | |
0 | 1248 |
604 | 1249 ; reset bargraph mode... |
582 | 1250 setf win_bargraph |
1251 return | |
623 | 1252 |
608 | 1253 TFT_box_display2: |
628 | 1254 ; Screen 2 |
608 | 1255 movff win_color1,PRODH |
1256 movff win_color2,PRODL | |
1257 rcall convert_for_display2 | |
631 | 1258 clrf PRODH ; column counter |
623 | 1259 TFT_box2_display2: ; loop height times |
608 | 1260 movff win_height,PRODL |
623 | 1261 TFT_box3_display2: ; loop width times |
608 | 1262 movff win_color5,PORTH |
623 | 1263 bcf tft_nwr |
1264 bsf tft_nwr ; upper | |
608 | 1265 movff win_color4,PORTH |
1266 bcf tft_nwr | |
623 | 1267 bsf tft_nwr ; high |
608 | 1268 movff win_color3,PORTH |
1269 bcf tft_nwr | |
623 | 1270 bsf tft_nwr ; low |
608 | 1271 |
1272 movff win_color5,PORTH | |
1273 bcf tft_nwr | |
623 | 1274 bsf tft_nwr ; upper |
608 | 1275 movff win_color4,PORTH |
1276 bcf tft_nwr | |
623 | 1277 bsf tft_nwr ; high |
608 | 1278 movff win_color3,PORTH |
1279 bcf tft_nwr | |
623 | 1280 bsf tft_nwr ; low |
1281 decfsz PRODL,F ; row loop finished? | |
1282 bra TFT_box3_display2 ; NO - loop | |
1283 incf PRODH,F ; YES - column count ++ | |
1284 movf win_bargraph,W ; - get bargraph width | |
1285 cpfseq PRODH ; - current column = bargraph ? | |
1286 bra TFT_box4_display2 ; NO | |
1287 clrf win_color5 ; YES - switch to black | |
1288 clrf win_color4 ; - ... | |
1289 clrf win_color3 ; - ... | |
608 | 1290 TFT_box4_display2: |
623 | 1291 movf win_width+0,W ; get width |
1292 cpfseq PRODH ; width loop finished ? | |
1293 bra TFT_box2_display2 ; NO - loop | |
1294 setf win_bargraph ; YES - reset bargraph mode | |
1295 return ; - done | |
0 | 1296 |
628 | 1297 TFT_box_display3: |
1298 ; Screen 3 | |
1299 TFT_box2_display3: ; loop height times | |
1300 movff win_height,PRODL | |
1301 TFT_box3_display3: ; loop width times | |
1302 movff win_color1,PORTH | |
1303 bcf tft_nwr | |
1304 bsf tft_nwr ; upper | |
1305 movff win_color2,PORTH | |
1306 bcf tft_nwr | |
1307 bsf tft_nwr ; high | |
1308 movff win_color1,PORTH | |
1309 bcf tft_nwr | |
1310 bsf tft_nwr ; low | |
1311 movff win_color2,PORTH | |
1312 bcf tft_nwr | |
1313 bsf tft_nwr ; upper | |
1314 decfsz PRODL,F ; row loop finished? | |
1315 bra TFT_box3_display3 ; NO - loop | |
1316 incf PRODH,F ; YES - column count ++ | |
1317 movf win_bargraph,W ; - get bargraph width | |
1318 cpfseq PRODH ; - current column = bargraph ? | |
1319 bra TFT_box4_display3 ; NO | |
1320 clrf win_color1 ; Yes - switch to black | |
1321 clrf win_color2 ; - ... | |
1322 TFT_box4_display3: | |
1323 movf win_width+0,W ; get width | |
1324 cpfseq PRODH ; width loop finished ? | |
1325 bra TFT_box2_display3 ; NO - loop | |
1326 setf win_bargraph ; YES - reset bargraph mode | |
1327 return | |
1328 | |
0 | 1329 ;============================================================================= |
623 | 1330 ; Convert 8 bit RGB b'RRRGGGBB' into 16 bit RGB b'RRRRRGGGGGGBBBBB' |
0 | 1331 |
582 | 1332 global TFT_set_color |
0 | 1333 TFT_set_color: |
631 | 1334 movwf tft_temp1 ; get 8 bit RGB b'RRRGGGBB' into tft_temp1... |
1335 movwf tft_temp2 ; ... and tft_temp2 | |
0 | 1336 |
604 | 1337 ; mask bit 7,6,5,4,3,2 |
0 | 1338 movlw b'00000011' |
1339 andwf tft_temp2,F | |
1340 | |
1341 movlw b'00000000' | |
1342 dcfsnz tft_temp2,F | |
1343 movlw b'01010000' | |
1344 dcfsnz tft_temp2,F | |
1345 movlw b'10100000' | |
1346 dcfsnz tft_temp2,F | |
1347 movlw b'11111000' | |
604 | 1348 movwf tft_temp3 ; blue done |
0 | 1349 |
604 | 1350 movff tft_temp1,tft_temp2 ; copy |
1351 ; mask bit 7,6,5,1,0 | |
0 | 1352 movlw b'00011100' |
1353 andwf tft_temp2,F | |
1354 rrncf tft_temp2,F | |
1355 rrncf tft_temp2,F | |
1356 | |
1357 movlw b'00000000' | |
1358 dcfsnz tft_temp2,F | |
1359 movlw b'00000100' | |
1360 dcfsnz tft_temp2,F | |
1361 movlw b'00001000' | |
1362 dcfsnz tft_temp2,F | |
1363 movlw b'00001100' | |
1364 dcfsnz tft_temp2,F | |
1365 movlw b'00010000' | |
1366 dcfsnz tft_temp2,F | |
1367 movlw b'00010100' | |
1368 dcfsnz tft_temp2,F | |
1369 movlw b'00100000' | |
1370 dcfsnz tft_temp2,F | |
1371 movlw b'00111111' | |
582 | 1372 movwf tft_temp4 |
0 | 1373 |
1374 rrcf tft_temp4,F | |
1375 rrcf tft_temp3,F | |
1376 | |
1377 rrcf tft_temp4,F | |
1378 rrcf tft_temp3,F | |
1379 | |
1380 rrcf tft_temp4,F | |
604 | 1381 rrcf tft_temp3,W ; tft_temp3 (b'GGGBBBBB') done |
1382 movwf win_color2 ; set color registers... | |
0 | 1383 |
604 | 1384 movff tft_temp1,tft_temp2 ; copy |
0 | 1385 clrf tft_temp1 |
1386 | |
1387 rrcf tft_temp4,F | |
1388 rrcf tft_temp1,F | |
1389 | |
1390 rrcf tft_temp4,F | |
1391 rrcf tft_temp1,F | |
1392 | |
1393 rrcf tft_temp4,F | |
604 | 1394 rrcf tft_temp1,F ; green done |
0 | 1395 |
604 | 1396 ; mask bit 4,3,2,1,0 |
0 | 1397 movlw b'11100000' |
1398 andwf tft_temp2,F | |
1399 | |
1400 rrncf tft_temp2,F | |
1401 rrncf tft_temp2,F | |
1402 rrncf tft_temp2,F | |
1403 rrncf tft_temp2,F | |
1404 rrncf tft_temp2,F | |
1405 | |
1406 movlw b'00000000' | |
1407 dcfsnz tft_temp2,F | |
1408 movlw b'00000100' | |
1409 dcfsnz tft_temp2,F | |
1410 movlw b'00001000' | |
1411 dcfsnz tft_temp2,F | |
1412 movlw b'00001100' | |
1413 dcfsnz tft_temp2,F | |
1414 movlw b'00010000' | |
1415 dcfsnz tft_temp2,F | |
1416 movlw b'00010100' | |
1417 dcfsnz tft_temp2,F | |
1418 movlw b'00100000' | |
1419 dcfsnz tft_temp2,F | |
1420 movlw b'00111111' | |
582 | 1421 movwf tft_temp4 |
0 | 1422 |
1423 rrcf tft_temp4,F | |
1424 rrcf tft_temp1,F | |
1425 | |
1426 rrcf tft_temp4,F | |
604 | 1427 rrcf tft_temp1,F |
0 | 1428 |
1429 rrcf tft_temp4,F | |
1430 rrcf tft_temp1,F | |
1431 | |
1432 rrcf tft_temp4,F | |
1433 rrcf tft_temp1,F | |
1434 | |
1435 rrcf tft_temp4,F | |
604 | 1436 rrcf tft_temp1,W ; red done |
1437 movwf win_color1 ; set color registers | |
0 | 1438 return |
623 | 1439 |
1440 | |
608 | 1441 global convert_for_display2 |
623 | 1442 convert_for_display2: ; convert 16 bit RGB b'RRRRRGGG GGGBBBBB' into 24 bit RGB b'RRRRRR00 GGGGGG00 BBBBBB00' |
1443 ; PRODH PRODL win_color5 win_color4 win_color3 | |
1444 ; Red | |
1445 movff PRODH,win_color5 ; = RRRRRGGG | |
1446 bcf win_color5,2 ; = RRRRR0GG | |
1447 btfsc win_color5,7 | |
1448 bsf win_color5,2 ; = RRRRR1GG the lower two bits are ignored by the screen | |
1449 ; Blue | |
1450 movff PRODL,win_color3 | |
1451 rrcf win_color3,F ; = UGGGBBBB and the LSB-blue into carry | |
1452 swapf win_color3,F ; = BBBBUGGG | |
1453 bcf win_color3,3 ; = BBBB0GGG | |
608 | 1454 btfsc STATUS,C |
623 | 1455 bsf win_color3,3 ; = BBBB1GGG |
1456 bcf win_color3,2 ; = BBBBB0GG | |
1457 btfsc win_color3,7 | |
1458 bsf win_color3,2 ; = BBBBB1GG | |
1459 ; Green | |
1460 rrcf PRODH,F | |
1461 rrcf PRODL,F | |
1462 rrcf PRODH,F | |
1463 rrcf PRODL,F | |
1464 rrcf PRODH,F | |
1465 rrcf PRODL,F ; = GGGGGGBB the lower two bits are ignored by the screen | |
1466 movff PRODL,win_color4 | |
608 | 1467 return |
623 | 1468 |
0 | 1469 |
1470 ;============================================================================= | |
1471 | |
604 | 1472 IFDEF _screendump |
1473 | |
623 | 1474 ;----------------------------------------------------------------------------- |
1475 ; Dump screen contents to the UART | |
1476 ; | |
604 | 1477 global TFT_dump_screen_check |
1478 TFT_dump_screen_check: | |
631 | 1479 return |
604 | 1480 btfss vusb_in ; USB (still) plugged in? |
623 | 1481 bcf screen_dump_avail ; NO - disable screen dump function |
631 | 1482 |
1483 SERIAL_CC_RECEIVE WREG ; try to read a byte from RS232 | |
623 | 1484 btfsc rs232_rx_timeout ; anything received? |
631 | 1485 return ; NO - done |
1486 xorlw "l" ; YES - exclusive-or with coding of screen dump command | |
1487 tstfsz WREG ; - screen dump command received? | |
604 | 1488 return ; NO - return |
631 | 1489 ;bra TFT_dump_screen ; YES - serve screen dump request |
623 | 1490 |
631 | 1491 global TFT_dump_screen |
623 | 1492 TFT_dump_screen: |
1493 btfsc screen_type2 ; is this an OSTC with a screen of type 2? | |
631 | 1494 return ; YES - not supported, abort |
623 | 1495 bsf block_sensor_interrupt ; NO - disable sensor interrupts |
631 | 1496 SERIAL_LC_SEND 'l' ; - send command acknowledge |
1497 | |
604 | 1498 |
582 | 1499 ;---- Send DISPLAY box command for the full screen window ------------------- |
604 | 1500 Index_out 0x50 ; window horizontal start address |
582 | 1501 Parameter_out 0x00, 0x00 ; 0-239 |
604 | 1502 Index_out 0x51 ; window horizontal end address |
582 | 1503 Parameter_out 0x00, 0xEF ; 0-239 |
604 | 1504 Index_out 0x52 ; window vertical start address |
582 | 1505 Parameter_out 0x00, 0x00 ; 0-319 |
604 | 1506 Index_out 0x53 ; window vertical end address |
582 | 1507 Parameter_out 0x01, 0x3F ; 0-319 |
0 | 1508 |
582 | 1509 clrf ds_column |
1510 rcall dump_screen_pixel_reset | |
0 | 1511 dump_screen_1: |
582 | 1512 btg LEDr ; LED activity toggle |
631 | 1513 ; dump even column |
604 | 1514 movlw .240 ; 240 lines, once |
582 | 1515 movwf ds_line |
0 | 1516 dump_screen_2: |
604 | 1517 Index_out 0x20 ; frame memory horizontal address |
582 | 1518 movff ds_line,WREG ; d'0' ... d'239' |
604 | 1519 mullw .1 ; copy row to PRODH:L |
582 | 1520 rcall TFT_DataWrite_PROD |
0 | 1521 |
623 | 1522 movff ds_column,WREG ; initialize X position |
1523 mullw .2 ; ds_column x 2 -> PRODH:PRODL | |
604 | 1524 rcall pixel_write_col320 ; start address vertical (.0 - .319) |
0 | 1525 |
582 | 1526 rcall TFT_DataRead_PROD ; read pixel |
1527 rcall dump_screen_pixel | |
0 | 1528 |
582 | 1529 decfsz ds_line,F |
1530 bra dump_screen_2 | |
1531 rcall dump_screen_pixel_flush | |
0 | 1532 |
631 | 1533 ; dump odd column |
604 | 1534 movlw .240 ; 240 lines, twice |
582 | 1535 movwf ds_line |
0 | 1536 dump_screen_3: |
604 | 1537 Index_out 0x20 ; frame memory horizontal address |
582 | 1538 movff ds_line,WREG ; d'0' ... d'239' |
623 | 1539 mullw .1 ; copy row to PRODH:L |
582 | 1540 rcall TFT_DataWrite_PROD |
0 | 1541 |
623 | 1542 movff ds_column,WREG ; initialize X position |
1543 mullw .2 ; ds_column x 2 -> PRODH:PRODL | |
1544 INCI PROD ; PROD++ | |
604 | 1545 rcall pixel_write_col320 ; start address vertical (.0 - .319) |
0 | 1546 |
582 | 1547 rcall TFT_DataRead_PROD ; read pixel |
631 | 1548 rcall dump_screen_pixel ; compress and send pixel |
0 | 1549 |
582 | 1550 decfsz ds_line,F |
1551 bra dump_screen_3 | |
1552 rcall dump_screen_pixel_flush | |
0 | 1553 |
582 | 1554 incf ds_column,F |
1555 movlw .160 | |
1556 cpfseq ds_column | |
1557 bra dump_screen_1 | |
0 | 1558 |
623 | 1559 bcf block_sensor_interrupt ; re-enable sensor interrupts |
604 | 1560 clrf RCREG1 ; clear receive buffer |
1561 bcf RCSTA1,CREN ; clear receiver status | |
631 | 1562 bsf RCSTA1,CREN ; ... |
623 | 1563 bsf screen_dump_avail ; enable screen dump function |
582 | 1564 return |
0 | 1565 |
623 | 1566 ;----------------------------------------------------------------------------- |
0 | 1567 ; Pixel compression |
1568 ; | |
604 | 1569 ; Input : PRODH:L = pixel |
0 | 1570 ; Output: Compressed stream on output. |
1571 ; Compressed format: | |
604 | 1572 ; 0ccccccc : BLACK pixel, repeated ccccccc+1 times (1..128) |
1573 ; 11cccccc : WHITE pixel, repeated cccccc+1 times (1.. 64) | |
1574 ; 10cccccc HIGH LOW : color pixel (H:L) repeated ccccc+1 times (1.. 64) | |
623 | 1575 ; |
0 | 1576 dump_screen_pixel: |
604 | 1577 movf PRODH,W ; compare pixel-high |
582 | 1578 xorwf ds_pixel+1,W |
604 | 1579 bnz dump_screen_pixel_1 ; different -> dump |
0 | 1580 |
604 | 1581 movf PRODL,W ; compare pixel-low |
582 | 1582 xorwf ds_pixel+0,W |
604 | 1583 bnz dump_screen_pixel_1 ; different -> dump |
0 | 1584 |
604 | 1585 incf ds_count,F ; same color: just increment |
582 | 1586 return |
0 | 1587 |
604 | 1588 dump_screen_pixel_1: ; send (pixel,count) tuple |
1589 movf ds_count,W ; is count zero ? | |
1590 bz dump_screen_pixel_2 ; YES - skip sending | |
0 | 1591 |
604 | 1592 movf ds_pixel+1,W ; is this a BLACK pixel ? |
582 | 1593 iorwf ds_pixel+0,W |
604 | 1594 bz dump_screen_pix_black ; YES |
0 | 1595 |
604 | 1596 movf ds_pixel+1,W ; is this a white pixel ? |
582 | 1597 andwf ds_pixel+0,W |
1598 incf WREG | |
604 | 1599 bz dump_screen_pix_white ; YES |
0 | 1600 |
582 | 1601 ; No: write the pixel itself... |
604 | 1602 movlw .64 ; max color pixel on a single byte |
1603 cpfsgt ds_count ; skip if count > 64 | |
582 | 1604 movf ds_count,W ; W <- min(64,count) |
1605 subwf ds_count,F ; ds_count <- ds_count-W | |
604 | 1606 decf WREG ; save as 0..63 |
1607 iorlw b'10000000' ; mark as a color pixel | |
0 | 1608 |
631 | 1609 SERIAL_CC_SEND WREG ; send byte in WREG |
1610 SERIAL_CC_SEND ds_pixel+1 ; send bytes in ds_pixel, high byte first | |
1611 SERIAL_CC_SEND ds_pixel+0 ; low byte last | |
1612 | |
582 | 1613 bra dump_screen_pixel_1 |
0 | 1614 |
1615 dump_screen_pixel_2: | |
604 | 1616 movff PRODH,ds_pixel+1 ; save new pixel color |
582 | 1617 movff PRODL,ds_pixel+0 |
1618 movlw 1 | |
604 | 1619 movwf ds_count ; and set count=1 |
582 | 1620 return |
0 | 1621 |
1622 dump_screen_pix_black: | |
604 | 1623 movlw .128 ; max black pixel on a single byte |
1624 cpfsgt ds_count ; skip if count > 128 | |
582 | 1625 movf ds_count,W ; W <- min(128,count) |
1626 subwf ds_count,F ; ds_count <- ds_count-W | |
604 | 1627 decf WREG ; save as 0..127 |
623 | 1628 |
0 | 1629 dump_screen_pix_3: |
631 | 1630 SERIAL_CC_SEND WREG ; send byte in WREG |
604 | 1631 bra dump_screen_pixel_1 ; more to dump ? |
0 | 1632 |
1633 dump_screen_pix_white: | |
604 | 1634 movlw .64 ; max white pixel on a single byte |
1635 cpfsgt ds_count ; skip if count > 64 | |
582 | 1636 movf ds_count,W ; W <- min(64,count) |
1637 subwf ds_count,F ; ds_count <- ds_count-W | |
631 | 1638 decf WREG ; save as 0..63 |
604 | 1639 iorlw b'11000000' ; mark as a compressed white |
631 | 1640 bra dump_screen_pix_3 ; send pixel |
0 | 1641 |
1642 dump_screen_pixel_flush: | |
582 | 1643 clrf PRODH |
1644 clrf PRODL | |
604 | 1645 rcall dump_screen_pixel_1 ; send it |
0 | 1646 dump_screen_pixel_reset: |
604 | 1647 clrf ds_count ; clear count |
582 | 1648 return |
0 | 1649 |
623 | 1650 ENDIF ; _screendump |
1651 | |
1652 ;============================================================================= | |
604 | 1653 |
582 | 1654 END |