annotate code_part1/OSTC_code_asm_part1/dump_screen.asm @ 831:0cf00ecf3532

CHANGE: Color-code battery % display in surface mode (Charge, Full, Normal)
author heinrichsweikamp
date Tue, 08 Dec 2015 13:44:39 +0100
parents a8a36c85e031
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
330
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
1 ;=============================================================================
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
2 ;
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
3 ; File dump_screen.asm
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
4 ;
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
5 ; Dump screen contains to the serial interface.
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
6 ;
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
7 ; This program is free software: you can redistribute it and/or modify
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
8 ; it under the terms of the GNU General Public License as published by
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
9 ; the Free Software Foundation, either version 3 of the License, or
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
10 ; (at your option) any later version.
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
11 ;
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
12 ; This program is distributed in the hope that it will be useful,
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
15 ; GNU General Public License for more details.
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
16 ;
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
17 ; You should have received a copy of the GNU General Public License
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
18 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
19 ;
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
20 ; Copyright (c) 2011, JD Gascuel.
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
21 ;=============================================================================
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
22 ; HISTORY
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
23 ; 2011-05-08 : [jDG] Creation.
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
24 ;
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
25 ; BUGS :
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
26 ; * ...
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
27 ;=============================================================================
332
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
28 CBLOCK 0x000
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
29 ds_line ; Current line (0..239).
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
30 ds_column ; Current columnx2 (0..159)
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
31 ds_pixel:2 ; Current pixel color.
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
32 ds_count ; Repetition count.
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
33 ENDC
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
34 ;=============================================================================
330
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
35
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
36 ; Manage interface to the OSTC platform:
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
37 dump_screen:
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
38 bcf uart_dump_screen ; clear flag!
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
39
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
40 movlw 'l'
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
41 movwf TXREG ; Send command echo.
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
42 bsf no_sensor_int ; No Sensor Interrupt
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
43 bcf PIE1,RCIE ; no interrupt for UART
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
44 bcf PIR1,RCIF ; clear flag
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
45 bsf LED_blue ; LEDusb ON
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
46 call rs232_wait_tx ; wait for UART
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
47
687
a8a36c85e031 ignore screenshots with display1 (for now)
heinrichsweikamp
parents: 681
diff changeset
48 movff win_flags,WREG ; BEWARE: bank0 bit-test
a8a36c85e031 ignore screenshots with display1 (for now)
heinrichsweikamp
parents: 681
diff changeset
49 btfss WREG,1 ; Display1?
a8a36c85e031 ignore screenshots with display1 (for now)
heinrichsweikamp
parents: 681
diff changeset
50 call dump_screen_0 ; No, dump screen
330
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
51
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
52 bcf no_sensor_int ; Restore Sensor Interrupt
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
53 bcf LED_blue ; Clear led
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
54 bcf LED_red ; Clear led
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
55 bsf PIE1,RCIE ; Interrupt for RS232
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
56 return
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
57
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
58 ;=============================================================================
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
59 ; Dump screen contains to the UART
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
60
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
61 dump_screen_0:
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
62
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 477
diff changeset
63 ;---- Send DISPLAY box command for the full screen window -------------------
331
469f4861c7c1 Debug screen dump
JeanDo
parents: 330
diff changeset
64 mullw 0 ; PRODH:L <- 0
330
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
65
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
66 AA_CMD_WRITE 0x35 ; VerticalStartAddress HIGH:LOW
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
67 AA_DATA_WRITE_PROD ; 00:00
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
68
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
69 AA_CMD_WRITE 0x36 ; VerticalEndAddress HIGH:LOW
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
70 AA_DATA_WRITE 0x01
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
71 AA_DATA_WRITE 0x3F
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
72
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
73 AA_CMD_WRITE 0x37 ; HorizontalAddress START:END
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
74 AA_DATA_WRITE 0x00
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
75 AA_DATA_WRITE 0xEF
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
76
477
1b09cead63a8 BUGFIX dump screen top line in flip mode (OSTC 2N).
JeanDo
parents: 336
diff changeset
77 btfss win_flip_screen ; OSTC 2N have a flipped screen,
1b09cead63a8 BUGFIX dump screen top line in flip mode (OSTC 2N).
JeanDo
parents: 336
diff changeset
78 bra dump_screen_mk2 ; So we should start 239 instead.
1b09cead63a8 BUGFIX dump screen top line in flip mode (OSTC 2N).
JeanDo
parents: 336
diff changeset
79 movlw LOW(.239)
1b09cead63a8 BUGFIX dump screen top line in flip mode (OSTC 2N).
JeanDo
parents: 336
diff changeset
80 movwf PRODL
1b09cead63a8 BUGFIX dump screen top line in flip mode (OSTC 2N).
JeanDo
parents: 336
diff changeset
81 movlw HIGH(.239)
1b09cead63a8 BUGFIX dump screen top line in flip mode (OSTC 2N).
JeanDo
parents: 336
diff changeset
82 movwf PRODH
1b09cead63a8 BUGFIX dump screen top line in flip mode (OSTC 2N).
JeanDo
parents: 336
diff changeset
83 dump_screen_mk2:
1b09cead63a8 BUGFIX dump screen top line in flip mode (OSTC 2N).
JeanDo
parents: 336
diff changeset
84
330
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
85 AA_CMD_WRITE 0x20 ; Start Address Horizontal (.0 - .239)
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
86 AA_DATA_WRITE_PROD ; 00:00
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
87
477
1b09cead63a8 BUGFIX dump screen top line in flip mode (OSTC 2N).
JeanDo
parents: 336
diff changeset
88 mullw 0 ; Make sure PROD is 0 again.
330
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
89 AA_CMD_WRITE 0x21 ; Start Address Vertical (.0 - .319)
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
90 AA_DATA_WRITE_PROD ; 00:00
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
91
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
92 AA_CMD_WRITE 0x22 ; Start reading.
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 477
diff changeset
93 rcall DISP_DataRead ; Dummy pixel to skip.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 477
diff changeset
94 rcall DISP_DataRead ; Dummy pixel to skip.
330
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
95
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
96 movlw .160 ; 160x2 columns
332
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
97 movwf ds_column
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
98 rcall dump_screen_pixel_reset
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
99
330
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
100 dump_screen_1:
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
101 btg LED_red ; LEDactivity toggle
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
102
331
469f4861c7c1 Debug screen dump
JeanDo
parents: 330
diff changeset
103 AA_CMD_WRITE 0x22 ; Re-sync data.
469f4861c7c1 Debug screen dump
JeanDo
parents: 330
diff changeset
104
469f4861c7c1 Debug screen dump
JeanDo
parents: 330
diff changeset
105 setf TRISD ; PortD as input.
330
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
106
332
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
107 ; Dump even column
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
108 movlw .240 ; 240 lines, once.
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
109 movwf ds_line
330
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
110 dump_screen_2:
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 477
diff changeset
111 rcall DISP_DataRead ; read pixel-high byte
332
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
112 movwf PRODH
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 477
diff changeset
113 rcall DISP_DataRead ; read pixel-low byte
332
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
114 movwf PRODL
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
115 rcall dump_screen_pixel
331
469f4861c7c1 Debug screen dump
JeanDo
parents: 330
diff changeset
116
332
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
117 decfsz ds_line,F
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
118 bra dump_screen_2
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
119 rcall dump_screen_pixel_flush
331
469f4861c7c1 Debug screen dump
JeanDo
parents: 330
diff changeset
120
332
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
121 ; Dump odd column
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
122 movlw .240 ; 240 lines, twice.
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
123 movwf ds_line
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
124 dump_screen_3:
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 477
diff changeset
125 rcall DISP_DataRead ; read pixel-high byte
332
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
126 movwf PRODH
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 477
diff changeset
127 rcall DISP_DataRead ; read pixel-low byte
332
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
128 movwf PRODL
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
129 rcall dump_screen_pixel
331
469f4861c7c1 Debug screen dump
JeanDo
parents: 330
diff changeset
130
332
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
131 decfsz ds_line,F
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
132 bra dump_screen_3
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
133 rcall dump_screen_pixel_flush
330
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
134
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
135 clrf TRISD ; Back to normal (PortD as output)
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
136
332
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
137 decfsz ds_column,F
331
469f4861c7c1 Debug screen dump
JeanDo
parents: 330
diff changeset
138 bra dump_screen_1
330
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
139
336
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
140 AA_CMD_WRITE 0x00 ; NOP, to stop Address Update Counter
330
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
141 return
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents:
diff changeset
142
332
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
143 ;=============================================================================
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
144 ; Pixel compression
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
145 ;
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
146 ; Input: PRODH:L = pixel.
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
147 ; Output: Compressed stream on output.
336
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
148 ; Compressed format:
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
149 ; 0ccccccc : BLACK pixel, repeated ccccccc+1 times (1..128).
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
150 ; 11cccccc : WHITE pixel, repeated cccccc+1 times (1..64).
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
151 ; 10cccccc HIGH LOW : color pixel (H:L) repeated ccccc+1 times (1..64).
332
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
152 ;
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
153 dump_screen_pixel:
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
154 movf PRODH,W ; Compare pixel-high
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
155 xorwf ds_pixel+1,W
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
156 bnz dump_screen_pixel_1 ; Different -> dump.
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
157
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
158 movf PRODL,W ; Compare pixel-low
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
159 xorwf ds_pixel+0,W
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
160 bnz dump_screen_pixel_1 ; Different -> dump.
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
161
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
162 incf ds_count,F ; Same color: just increment.
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
163 return
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
164
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
165 dump_screen_pixel_1: ; Send (pixel,count) tuple
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
166 movf ds_count,W ; Is count zero ?
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
167 bz dump_screen_pixel_2 ; Yes: skip sending.
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
168
336
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
169 movf ds_pixel+1,W ; This is a BLACK pixel ?
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
170 iorwf ds_pixel+0,W
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
171 bz dump_screen_pix_black ; YES.
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
172
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
173 movf ds_pixel+1,W ; This is a white pixel ?
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
174 andwf ds_pixel+0,W
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
175 incf WREG
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
176 bz dump_screen_pix_white ; YES.
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
177
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
178 ; No: write the pixel itself...
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
179 movlw .64 ; Max color pixel on a single byte.
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
180 cpfsgt ds_count ; Skip if count > 64
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
181 movf ds_count,W ; W <- min(64,count)
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
182 subwf ds_count,F ; ds_count <- ds_count-W
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
183 decf WREG ; Save as 0..63
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
184 iorlw b'10000000' ; MARK as a color pixel.
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
185
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
186 movwf TXREG
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
187 call rs232_wait_tx ; wait for UART
332
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
188 movff ds_pixel+1,TXREG
336
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
189 call rs232_wait_tx ; wait for UART
332
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
190 movff ds_pixel+0,TXREG
336
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
191 call rs232_wait_tx ; wait for UART
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
192 bra dump_screen_pixel_1
332
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
193
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
194 dump_screen_pixel_2:
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
195 movff PRODH,ds_pixel+1 ; Save new pixel color
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
196 movff PRODL,ds_pixel+0
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
197 movlw 1
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
198 movwf ds_count ; And set count=1.
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
199 return
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
200
336
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
201 dump_screen_pix_black:
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
202 movlw .128 ; Max black pixel on a single byte.
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
203 cpfsgt ds_count ; Skip if count > 128
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
204 movf ds_count,W ; W <- min(128,count)
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
205 subwf ds_count,F ; ds_count <- ds_count-W
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
206 decf WREG ; Save as 0..127
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
207 dump_screen_pix_3:
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
208 movwf TXREG
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
209 call rs232_wait_tx
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
210 bra dump_screen_pixel_1 ; More to dump ?
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
211
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
212 dump_screen_pix_white:
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
213 movlw .64 ; Max white pixel on a single byte.
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
214 cpfsgt ds_count ; Skip if count > 64
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
215 movf ds_count,W ; W <- min(64,count)
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
216 subwf ds_count,F ; ds_count <- ds_count-W
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
217 decf WREG ; Save as 0..63
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
218 iorlw b'11000000' ; MARK as a compressed white.
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
219 bra dump_screen_pix_3
9ee86a19f1fa Beter compression for black/white pixels: ~1sec screen dumps.
JeanDo
parents: 332
diff changeset
220
332
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
221 dump_screen_pixel_flush:
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
222 clrf PRODH
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
223 clrf PRODL
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
224 rcall dump_screen_pixel_1 ; Send it
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
225 dump_screen_pixel_reset:
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
226 clrf ds_count ; But clear count.
1828234369fc Added dump_screen compression. From ~15 to ~2/3 secondes.
JeanDo
parents: 331
diff changeset
227 return