annotate src/tft.asm @ 605:5ce603c29750

gas color coding fixed
author heinrichsweikamp
date Sun, 25 Nov 2018 13:21:52 +0100
parents ca4556fb60b9
children d866684249bd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
3 ; File tft.asm ## V2.99c
0
heinrichsweikamp
parents:
diff changeset
4 ;
heinrichsweikamp
parents:
diff changeset
5 ; Managing the TFT screen
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
heinrichsweikamp
parents:
diff changeset
10 ; 2011-05-24 : [jDG] Cleanups from initial Matthias code.
heinrichsweikamp
parents:
diff changeset
11
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 225
diff changeset
12 #include "hwos.inc"
0
heinrichsweikamp
parents:
diff changeset
13 #include "wait.inc"
heinrichsweikamp
parents:
diff changeset
14 #include "varargs.inc"
heinrichsweikamp
parents:
diff changeset
15 #include "external_flash.inc"
heinrichsweikamp
parents:
diff changeset
16 #include "tft_outputs.inc"
heinrichsweikamp
parents:
diff changeset
17 #include "eeprom_rs232.inc"
heinrichsweikamp
parents:
diff changeset
18
heinrichsweikamp
parents:
diff changeset
19 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
20 ; Basic bit-level macros
heinrichsweikamp
parents:
diff changeset
21
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
22 RD_H macro
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
23 bsf tft_rd,0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
24 endm
0
heinrichsweikamp
parents:
diff changeset
25
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
26 RD_L macro
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
27 bcf tft_rd,0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
28 endm
0
heinrichsweikamp
parents:
diff changeset
29
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
30 RS_H macro
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
31 bsf tft_rs,0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
32 endm
0
heinrichsweikamp
parents:
diff changeset
33
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
34 RS_L macro
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
35 bcf tft_rs,0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
36 endm
0
heinrichsweikamp
parents:
diff changeset
37
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
38 NCS_H macro
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
39 bsf tft_cs,0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
40 endm
0
heinrichsweikamp
parents:
diff changeset
41
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
42 NCS_L macro
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
43 bcf tft_cs,0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
44 endm
0
heinrichsweikamp
parents:
diff changeset
45
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
46 WR_H macro
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
47 bsf tft_nwr,0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
48 endm
0
heinrichsweikamp
parents:
diff changeset
49
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
50 WR_L macro
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
51 bcf tft_nwr,0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
52 endm
0
heinrichsweikamp
parents:
diff changeset
53
heinrichsweikamp
parents:
diff changeset
54 ;=============================================================================
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
55 ; Byte-level macros
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
56
0
heinrichsweikamp
parents:
diff changeset
57 Index_out macro low_b
heinrichsweikamp
parents:
diff changeset
58 movlw low_b
heinrichsweikamp
parents:
diff changeset
59 rcall TFT_CmdWrite
heinrichsweikamp
parents:
diff changeset
60 endm
heinrichsweikamp
parents:
diff changeset
61
heinrichsweikamp
parents:
diff changeset
62 Parameter_out macro high_b, low_b
heinrichsweikamp
parents:
diff changeset
63 movlw high_b
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
64 movwf PORTA ; upper
0
heinrichsweikamp
parents:
diff changeset
65 movlw low_b
heinrichsweikamp
parents:
diff changeset
66 rcall TFT_DataWrite
heinrichsweikamp
parents:
diff changeset
67 endm
heinrichsweikamp
parents:
diff changeset
68
heinrichsweikamp
parents:
diff changeset
69
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
70 tft CODE
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
71
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
72 ;;=============================================================================
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
73 ;; TFT_write_flash_image
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
74 ;;
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
75 ;; Inputs: FSR2 = EEPROM address / 256
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
76 ;; win_left, win_top : image CENTER position
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
77 ;; Outputs: win_height, win_width.
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
78 ;; image copied on screen.
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
79 ;; Trashed: PROD, hi, lo
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
80 ;;
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
81 ; global TFT_write_flash_image
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
82 ;TFT_write_flash_image:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
83 ; ; Get back the full 24bit EEPROM address
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
84 ; clrf ext_flash_address+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
85 ; movff FSR2L,ext_flash_address+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
86 ; movf FSR2H,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
87 ; iorlw 0x30
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
88 ; movwf ext_flash_address+2
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
89 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
90 ; ; Read header: width and height
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
91 ; global TFT_write_flash_image_addr
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
92 ;TFT_write_flash_image_addr:
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
93 ; call ext_flash_read_block_start
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
94 ; movff SSP2BUF,win_width+0
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
95 ; movwf SSP2BUF ; write to buffer to initiate new read
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
96 ; btfss SSP2STAT, BF ; next byte ready ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
97 ; bra $-2 ; NO - wait...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
98 ; movff SSP2BUF,win_width+1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
99 ; movwf SSP2BUF ; write to buffer to initiate new read
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
100 ; btfss SSP2STAT, BF ; next byte ready ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
101 ; bra $-2 ; NO - wait...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
102 ; movff SSP2BUF,win_height
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
103 ; movwf SSP2BUF ; write to buffer to initiate new read
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
104 ; btfss SSP2STAT, BF ; next byte ready ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
105 ; bra $-2 ; NO - wait...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
106 ; movff SSP2BUF,WREG ; drop 4th byte
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
107 ; movwf SSP2BUF ; write to buffer to initiate new read
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
108 ; btfss SSP2STAT, BF ; next byte ready ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
109 ; bra $-2 ; NO - wait...
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
110 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
111 ; ; Sanity check on header to avoid badly uploaded images.
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
112 ; iorwf WREG ; check height < 256
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
113 ; bnz TFT_write_flash_image_failed
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
114 ; movf win_width+1,W ; check width < 512
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
115 ; andlw 0xFE
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
116 ; bnz TFT_write_flash_image_failed
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
117 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
118 ; ; Center image on win_top, win_left values
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
119 ; bcf STATUS,C ; clear carry
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
120 ; rrcf win_height,W ; and get height/2
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
121 ; subwf win_top,F ; top -= height/2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
122 ; rrcf win_width+1,W ; get 9th bit into carry
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
123 ; rrcf win_width+0,W ; get width/2 (in 0..320 range)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
124 ; bcf STATUS,C
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
125 ; rrcf WREG,W ; get width/2 in 0..160 range
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
126 ; subwf win_leftx2,F ; left -= width/2
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
127 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
128 ; rcall TFT_box_write ; inputs : win_top, win_leftx2, win_height, win_width (in 1..320 range)
0
heinrichsweikamp
parents:
diff changeset
129 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
130 ; ; Compute number of pixels to move (result on 17 bits !)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
131 ; clrf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
132 ; movf win_width+0,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
133 ; mulwf win_height ; result in PRODL:H
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
134 ; movf win_width+1,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
135 ; bz TFT_write_flash_image_1 ; width > 8bits ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
136 ; movf win_height,W ; YES - add extra
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
137 ; addwf PRODH,F
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
138 ; rlcf TBLPTRU ; and carry into upper register
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
139 ;TFT_write_flash_image_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
140 ; incf PRODH,F ; pre-condition nested loops
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
141 ; incf TBLPTRU,F
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
142 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
143 ; ; Write pixels
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
144 ; Index_out 0x22 ; frame memory data write start
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
145 ; RS_H ; data
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
146 ;
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
147 ;TFT_write_flash_image_loop:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
148 ; btfss SSP2STAT, BF ; buffer full?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
149 ; bra $-2 ; NO - wait...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
150 ; movff SSP2BUF,PORTH ; read lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
151 ; movwf SSP2BUF ; write to buffer to initiate new read
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
152 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
153 ; btfss SSP2STAT, BF ; buffer full?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
154 ; bra $-2 ; NO - wait...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
155 ; movff SSP2BUF,PORTA ; and read hi
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
156 ; movwf SSP2BUF ; write to buffer to initiate new read
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
157 ; WR_L
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
158 ; WR_H ; write 1 pixel
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
159 ;
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
160 ; decfsz PRODL,F
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
161 ; bra TFT_write_flash_image_loop
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
162 ; decfsz PRODH,F
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
163 ; bra TFT_write_flash_image_loop
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
164 ; decfsz TBLPTRU,F
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
165 ; bra TFT_write_flash_image_loop
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
166 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
167 ; btfss SSP2STAT, BF ; buffer full?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
168 ; bra $-2 ; NO - wait
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
169 ; movf SSP2BUF,W ; read dummy byte
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
170 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
171 ; bsf flash_ncs ; CS=1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
172 ; movlw 0x00 ; NOP, to stop window mode
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
173 ; bra TFT_CmdWrite ; this routine "returns"
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
174 ;
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
175 ; ;---- Draw a 4x4 red square in place of missing images...
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
176 ;TFT_write_flash_image_failed:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
177 ; movlw -1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
178 ; addwf win_leftx2,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
179 ; movlw -2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
180 ; addwf win_top,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
181 ; movlw 2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
182 ; movwf win_width+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
183 ; clrf win_width+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
184 ; movlw 4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
185 ; movwf win_height
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
186 ; movlw color_red
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
187 ; rcall TFT_set_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
188 ; goto TFT_box
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
189 ;
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
190 ;;=============================================================================
0
heinrichsweikamp
parents:
diff changeset
191
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
192 global TFT_CmdWrite
0
heinrichsweikamp
parents:
diff changeset
193 TFT_CmdWrite:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
194 RS_L ; command
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
195 clrf PORTA ; upper
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
196 bcf INTCON,GIE
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
197 movwf PORTH ; lower
0
heinrichsweikamp
parents:
diff changeset
198 WR_L
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
199 WR_H ; tick
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
200 bsf INTCON,GIE
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
201 return
0
heinrichsweikamp
parents:
diff changeset
202
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
203 global TFT_DataWrite
0
heinrichsweikamp
parents:
diff changeset
204 TFT_DataWrite:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
205 RS_H ; data
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
206 bcf INTCON,GIE
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
207 movwf PORTH ; lower
0
heinrichsweikamp
parents:
diff changeset
208 WR_L
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
209 WR_H ; tick
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
210 bsf INTCON,GIE
0
heinrichsweikamp
parents:
diff changeset
211 return
heinrichsweikamp
parents:
diff changeset
212
heinrichsweikamp
parents:
diff changeset
213 ;=============================================================================
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
214
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
215 global TFT_ClearScreen
0
heinrichsweikamp
parents:
diff changeset
216 TFT_ClearScreen:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
217 Index_out 0x50 ; window horizontal start address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
218 Parameter_out 0x00, 0x00 ; 0-239
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
219 Index_out 0x51 ; window horizontal end address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
220 Parameter_out 0x00, 0xEF ; 0-239
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
221 Index_out 0x52 ; window vertical start address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
222 Parameter_out 0x00, 0x00 ; 0-319
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
223 Index_out 0x53 ; window vertical end address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
224 Parameter_out 0x01, 0x3F ; 0-319
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
225 Index_out 0x20 ; frame memory horizontal address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
226 Parameter_out 0x00, 0x00 ; 0-239
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
227 Index_out 0x21 ; frame memory vertical address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
228 Parameter_out 0x01, 0x3F ; 0-319
0
heinrichsweikamp
parents:
diff changeset
229
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
230 Index_out 0x22 ; frame memory data write start
0
heinrichsweikamp
parents:
diff changeset
231
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
232 RD_H ; not read
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
233 RS_H ; data
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
234 NCS_L ; not CS
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
235 clrf PORTH ; data lower
0
heinrichsweikamp
parents:
diff changeset
236
heinrichsweikamp
parents:
diff changeset
237 movlw d'10'
heinrichsweikamp
parents:
diff changeset
238 movwf tft_temp3
heinrichsweikamp
parents:
diff changeset
239 TFT_ClearScreen2:
heinrichsweikamp
parents:
diff changeset
240 movlw d'30'
heinrichsweikamp
parents:
diff changeset
241 movwf tft_temp2
heinrichsweikamp
parents:
diff changeset
242 TFT_ClearScreen3:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
243 clrf tft_temp1 ; 30*10*256=76800 pixels -> clear complete 240*320
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
244 bcf INTCON,GIE
0
heinrichsweikamp
parents:
diff changeset
245 TFT_ClearScreen4:
heinrichsweikamp
parents:
diff changeset
246 WR_L
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
247 WR_H ; tick
0
heinrichsweikamp
parents:
diff changeset
248 decfsz tft_temp1,F
heinrichsweikamp
parents:
diff changeset
249 bra TFT_ClearScreen4
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
250 bsf INTCON,GIE
0
heinrichsweikamp
parents:
diff changeset
251 decfsz tft_temp2,F
heinrichsweikamp
parents:
diff changeset
252 bra TFT_ClearScreen3
heinrichsweikamp
parents:
diff changeset
253 decfsz tft_temp3,F
heinrichsweikamp
parents:
diff changeset
254 bra TFT_ClearScreen2
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
255
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
256 movlw 0x00 ; NOP, to stop window mode
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
257 bra TFT_CmdWrite ; and return
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
258
0
heinrichsweikamp
parents:
diff changeset
259
heinrichsweikamp
parents:
diff changeset
260 ;=============================================================================
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
261
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
262 global TFT_DisplayOff
0
heinrichsweikamp
parents:
diff changeset
263 TFT_DisplayOff:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
264 clrf CCPR1L ; PWM OFF
0
heinrichsweikamp
parents:
diff changeset
265 clrf PORTA
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
266 clrf PORTH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
267 RD_L ; LOW
0
heinrichsweikamp
parents:
diff changeset
268 nop
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
269 RS_L ; LOW
0
heinrichsweikamp
parents:
diff changeset
270 bcf tft_nwr
heinrichsweikamp
parents:
diff changeset
271 nop
heinrichsweikamp
parents:
diff changeset
272 bcf tft_cs
heinrichsweikamp
parents:
diff changeset
273 nop
heinrichsweikamp
parents:
diff changeset
274 bcf tft_nreset
heinrichsweikamp
parents:
diff changeset
275 WAITMS d'1'
heinrichsweikamp
parents:
diff changeset
276 bsf tft_power ; inverted...
heinrichsweikamp
parents:
diff changeset
277 bcf lightsen_power ; power-down light sensor
heinrichsweikamp
parents:
diff changeset
278 return
heinrichsweikamp
parents:
diff changeset
279
heinrichsweikamp
parents:
diff changeset
280 ; -----------------------------
heinrichsweikamp
parents:
diff changeset
281 ; TFT boot
heinrichsweikamp
parents:
diff changeset
282 ; -----------------------------
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
283
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
284 global TFT_boot
0
heinrichsweikamp
parents:
diff changeset
285 TFT_boot:
heinrichsweikamp
parents:
diff changeset
286 clrf PORTA
heinrichsweikamp
parents:
diff changeset
287 clrf PORTH
heinrichsweikamp
parents:
diff changeset
288 RD_L ; LOW
heinrichsweikamp
parents:
diff changeset
289 bcf tft_nwr
heinrichsweikamp
parents:
diff changeset
290 nop
heinrichsweikamp
parents:
diff changeset
291 bcf tft_cs
heinrichsweikamp
parents:
diff changeset
292 nop
heinrichsweikamp
parents:
diff changeset
293 bcf tft_nreset
heinrichsweikamp
parents:
diff changeset
294 WAITMS d'1'
heinrichsweikamp
parents:
diff changeset
295 bcf tft_power ; inverted...
heinrichsweikamp
parents:
diff changeset
296 WAITMS d'1'
heinrichsweikamp
parents:
diff changeset
297
heinrichsweikamp
parents:
diff changeset
298 RD_H ; Keep high
heinrichsweikamp
parents:
diff changeset
299 WR_H ;
heinrichsweikamp
parents:
diff changeset
300 NCS_L ; Not CS
heinrichsweikamp
parents:
diff changeset
301
heinrichsweikamp
parents:
diff changeset
302 WAITMS d'2'
heinrichsweikamp
parents:
diff changeset
303 bsf tft_nreset
461
4927ba3bd3b5 repeated init (For screen 2 issues)
heinrichsweikamp
parents: 441
diff changeset
304 WAITMS d'5'
4927ba3bd3b5 repeated init (For screen 2 issues)
heinrichsweikamp
parents: 441
diff changeset
305 bcf tft_nreset
4927ba3bd3b5 repeated init (For screen 2 issues)
heinrichsweikamp
parents: 441
diff changeset
306 WAITMS d'5'
4927ba3bd3b5 repeated init (For screen 2 issues)
heinrichsweikamp
parents: 441
diff changeset
307 bsf tft_nreset
0
heinrichsweikamp
parents:
diff changeset
308 WAITMS d'150'
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
309 bsf lightsen_power ; supply power to light sensor
0
heinrichsweikamp
parents:
diff changeset
310
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
311 ; Data Transfer Synchronization
0
heinrichsweikamp
parents:
diff changeset
312 Parameter_out 0x00, 0x00
heinrichsweikamp
parents:
diff changeset
313 Parameter_out 0x00, 0x00
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
314
441
360acdcda0d7 +BUGFIX: Compatibility with "hwOS Config" fixed
heinrichsweikamp
parents: 436
diff changeset
315 ; Get screentype from Bootloader-Info
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
316 movlw 0x7B
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
317 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
318 movlw 0xF7
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
319 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
320 movlw 0x01
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
321 movwf TBLPTRU
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
322 TBLRD*+ ; reads .110 for cR and USB OSTC3, .0 for BLE (2 and 3), and .2 for display1 OSTC
441
360acdcda0d7 +BUGFIX: Compatibility with "hwOS Config" fixed
heinrichsweikamp
parents: 436
diff changeset
323 movlw 0x02
360acdcda0d7 +BUGFIX: Compatibility with "hwOS Config" fixed
heinrichsweikamp
parents: 436
diff changeset
324 cpfseq TABLAT
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
325 bra TFT_boot_0 ; display0
360
5f142cff43f6 hardware support
heinrichsweikamp
parents: 312
diff changeset
326
5f142cff43f6 hardware support
heinrichsweikamp
parents: 312
diff changeset
327 TFT_boot_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
328 ; Init through config table...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
329 movlw 0x74
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
330 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
331 movlw 0xF7
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
332 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
333 movlw 0x01
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
334 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
335 bsf screen_type
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
336 bra TFT_boot_com
360
5f142cff43f6 hardware support
heinrichsweikamp
parents: 312
diff changeset
337
441
360acdcda0d7 +BUGFIX: Compatibility with "hwOS Config" fixed
heinrichsweikamp
parents: 436
diff changeset
338 TFT_boot_0:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
339 ; Init through config table...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
340 movlw LOW display0_config_table
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
341 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
342 movlw HIGH display0_config_table
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
343 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
344 movlw UPPER display0_config_table
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
345 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
346 bcf screen_type
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
347
360
5f142cff43f6 hardware support
heinrichsweikamp
parents: 312
diff changeset
348 TFT_boot_com:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
349 rcall display0_init_loop
0
heinrichsweikamp
parents:
diff changeset
350
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
351 Index_out 0x03
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
352 btfsc flip_screen ; 180° rotation ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
353 bra TFT_boot2 ; YES
360
5f142cff43f6 hardware support
heinrichsweikamp
parents: 312
diff changeset
354
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
355 btfss screen_type ; display1?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
356 bra TFT_boot1a ; NO
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
357 Parameter_out 0x10, 0x00 ; display1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
358 bra TFT_boot3
360
5f142cff43f6 hardware support
heinrichsweikamp
parents: 312
diff changeset
359 TFT_boot1a:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
360 Parameter_out 0x50, 0x20 ; display0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
361 bra TFT_boot3
152
19ad15f04f60 BUGFIX: Clear Setpoint-Fallback warning when in bailout
heinrichsweikamp
parents: 151
diff changeset
362 TFT_boot2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
363 btfss screen_type ; display1?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
364 bra TFT_boot2a ; NO
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
365 Parameter_out 0x10, 0x30 ; display1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
366 bra TFT_boot3
360
5f142cff43f6 hardware support
heinrichsweikamp
parents: 312
diff changeset
367 TFT_boot2a:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
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
heinrichsweikamp
parents:
diff changeset
370 Index_out 0x22
225
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 152
diff changeset
371 rcall TFT_ClearScreen
0
heinrichsweikamp
parents:
diff changeset
372 Index_out 0x07
312
b2f6a4b01e64 Config table for alternative display
heinrichsweikamp
parents: 275
diff changeset
373 Parameter_out 0x01, 0x33
0
heinrichsweikamp
parents:
diff changeset
374 return
heinrichsweikamp
parents:
diff changeset
375
heinrichsweikamp
parents:
diff changeset
376 display0_config_table:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
377 ; Reg, Dat0, Dat1 or 0xFF,0x00,0x00 for end
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
378 db 0xA4,0x00,0x01,0xFF,.002,0x00
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
379 db 0x09,0x00,0x01,0x92,0x04,0x00
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
380 db 0x93,0x04,0x02,0x94,0x00,0x02
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
381 db 0x07,0x00,0x00,0x10,0x04,0x30
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
382 db 0x11,0x02,0x37,0x12,0x11,0x8D
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
383 db 0x13,0x11,0x00,0x01,0x01,0x00
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
384 db 0x02,0x02,0x00,0x03,0x50,0x20
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
385 db 0x0A,0x00,0x08,0x0D,0x00,0x00
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
386 db 0x0E,0x00,0x30,0xFF,.151,0x00
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
387 db 0x12,0x11,0xBD,0x20,0x00,0x00
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
388 db 0x21,0x00,0x00,0x30,0x06,0x02
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
389 db 0x31,0x56,0x0D,0x32,0x05,0x07
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
390 db 0x33,0x06,0x09,0x34,0x00,0x00
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
391 db 0x35,0x09,0x06,0x36,0x57,0x05
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
392 db 0x37,0x0D,0x06,0x38,0x02,0x06
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
393 db 0x39,0x00,0x00,0xFF,0x00,0x00
0
heinrichsweikamp
parents:
diff changeset
394
heinrichsweikamp
parents:
diff changeset
395 display0_init_loop:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
396 TBLRD*+
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
397 movlw 0xFF
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
398 cpfseq TABLAT
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
399 bra display0_config_write ; write config pair to display
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
400 ; Delay ms or quit (return)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
401 TBLRD*+
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
402 tstfsz TABLAT ; end of config?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
403 bra $+4 ; NO
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
404 return ; YES - done
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
405 movf TABLAT,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
406 call WAITMSX ; wait WREG milliseconds
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
407 TBLRD*+ ; dummy read (Third byte of delay command)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
408 bra display0_init_loop ; loop
0
heinrichsweikamp
parents:
diff changeset
409
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
410 display0_config_write: ; with command in WREG
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
411 movf TABLAT,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
412 rcall TFT_CmdWrite ; write command
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
413 TBLRD*+ ; get config0
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
414 movff TABLAT,PORTA
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
415 TBLRD*+ ; get config1
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
416 movf TABLAT,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
417 rcall TFT_DataWrite ; write config
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
418 bra display0_init_loop ; loop
0
heinrichsweikamp
parents:
diff changeset
419
heinrichsweikamp
parents:
diff changeset
420
heinrichsweikamp
parents:
diff changeset
421 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
422 ; Smooth lighting-up of the display:
heinrichsweikamp
parents:
diff changeset
423 ;
heinrichsweikamp
parents:
diff changeset
424 ; Trashes: WREG, PRODL
heinrichsweikamp
parents:
diff changeset
425 ; Typical usage:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
426 ; clrf CCPR1L ; backlight off
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
427 ; [draw splash screen]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
428 ; call TFT_DisplayFadeIn
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
429
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
430 global TFT_Display_FadeIn
0
heinrichsweikamp
parents:
diff changeset
431 TFT_Display_FadeIn:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
432 movlw CCP1CON_VALUE ; see hwos.inc
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
433 movwf CCP1CON
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
434 bsf tft_is_dimming ; TFT is dimming, ignore ambient sensor
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
435 clrf CCPR1L ; backlight off - to be sure
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
436 movff max_CCPR1L,PRODL
0
heinrichsweikamp
parents:
diff changeset
437 TFT_Display_FadeIn_0:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
438 incf CCPR1L,F ; duty cycle
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
439 WAITMS d'2'
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
440 decfsz PRODL,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
441 bra TFT_Display_FadeIn_0
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
442 bcf tft_is_dimming ; dimming done
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
443 return
0
heinrichsweikamp
parents:
diff changeset
444
heinrichsweikamp
parents:
diff changeset
445 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
446 ; Smooth lighting-off of the display:
heinrichsweikamp
parents:
diff changeset
447 ; Trashes: WREG, PRODL
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
448
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
449 global TFT_Display_FadeOut
0
heinrichsweikamp
parents:
diff changeset
450 TFT_Display_FadeOut:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
451 movff max_CCPR1L,PRODL
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
452 bsf tft_is_dimming ; TFT is dimming, ignore ambient sensor
0
heinrichsweikamp
parents:
diff changeset
453 TFT_Display_FadeOut_0:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
454 movff PRODL,CCPR1L ; duty cycle
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
455 WAITMS d'1'
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
456 decfsz PRODL,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
457 bra TFT_Display_FadeOut_0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
458 clrf CCPR1L
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
459 return
0
heinrichsweikamp
parents:
diff changeset
460
heinrichsweikamp
parents:
diff changeset
461 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
462
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
463 global box_std_block, box_black_block, box_color_block
0
heinrichsweikamp
parents:
diff changeset
464
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
465 box_std_block: ; use white color
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
466 setf WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
467 bra box_common
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
468 box_black_block: ; use black color
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
469 clrf WREG
0
heinrichsweikamp
parents:
diff changeset
470 box_common:
heinrichsweikamp
parents:
diff changeset
471 box_color_block:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
472 rcall TFT_set_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
473 VARARGS_BEGIN
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
474 VARARGS_GET8 win_top
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
475 VARARGS_GET8 win_height
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
476 VARARGS_GET8 win_leftx2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
477 VARARGS_GET8 win_width
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
478 VARARGS_END
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
479 bra TFT_box
0
heinrichsweikamp
parents:
diff changeset
480
heinrichsweikamp
parents:
diff changeset
481 ;-----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
482
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
483 global box_frame_std, box_frame_common, box_frame_color, box_frame_color16
0
heinrichsweikamp
parents:
diff changeset
484
heinrichsweikamp
parents:
diff changeset
485 box_frame_std:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
486 setf WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
487 rcall TFT_set_color
0
heinrichsweikamp
parents:
diff changeset
488 box_frame_common:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
489 VARARGS_BEGIN
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
490 VARARGS_GET8 win_top
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
491 VARARGS_GET8 win_height
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
492 VARARGS_GET8 win_leftx2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
493 VARARGS_GET8 win_width
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
494 VARARGS_END
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
495 bra TFT_frame
0
heinrichsweikamp
parents:
diff changeset
496 box_frame_color:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
497 rcall TFT_set_color
0
heinrichsweikamp
parents:
diff changeset
498 box_frame_color16:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
499 bra box_frame_common
0
heinrichsweikamp
parents:
diff changeset
500
434
a001f170a1f7 hunting a bug in the logbook (Day 3)
heinrichsweikamp
parents: 432
diff changeset
501 ;;=============================================================================
a001f170a1f7 hunting a bug in the logbook (Day 3)
heinrichsweikamp
parents: 432
diff changeset
502 ;; Init for half_pixel_write
a001f170a1f7 hunting a bug in the logbook (Day 3)
heinrichsweikamp
parents: 432
diff changeset
503 ;; Set column register on TFT device, and current color.
a001f170a1f7 hunting a bug in the logbook (Day 3)
heinrichsweikamp
parents: 432
diff changeset
504 ;; Inputs: win_leftx2
a001f170a1f7 hunting a bug in the logbook (Day 3)
heinrichsweikamp
parents: 432
diff changeset
505 ;; Outputs: win_color:2
a001f170a1f7 hunting a bug in the logbook (Day 3)
heinrichsweikamp
parents: 432
diff changeset
506 ;; Trashed: WREG, PROD
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
507 ;
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
508 ; global init_pixel_write
434
a001f170a1f7 hunting a bug in the logbook (Day 3)
heinrichsweikamp
parents: 432
diff changeset
509 ;init_pixel_write:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
510 ; movf win_leftx2,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
511 ; mullw 2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
512 ; rcall pixel_write_col320 ; start address vertical (.0 - .319)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
513 ; setf WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
514 ; bra TFT_set_color
0
heinrichsweikamp
parents:
diff changeset
515
heinrichsweikamp
parents:
diff changeset
516 ;-----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
517 ; Writes two half-pixels at position (win_top,win_leftx2)
heinrichsweikamp
parents:
diff changeset
518 ; Inputs: win_leftx2, win_top, win_color:2
heinrichsweikamp
parents:
diff changeset
519 ; Trashed: WREG, PROD
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
520
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
521 global pixel_write
0
heinrichsweikamp
parents:
diff changeset
522 pixel_write:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
523 movf win_leftx2,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
524 mullw 2 ; win_leftx2 x 2 -> PRODH:PRODL
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
525 rcall pixel_write_col320 ; start address vertical (.0 - .319)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
526 rcall half_pixel_write ; write this half-one
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
527 movf win_leftx2,W ; address of next one
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
528 mullw 2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
529 infsnz PRODL ; +1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
530 incf PRODH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
531 rcall pixel_write_col320
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
532 bra half_pixel_write ; note: Cmd 0x20 is mandatory, because
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
533 ; of the auto-increment going vertical
0
heinrichsweikamp
parents:
diff changeset
534
heinrichsweikamp
parents:
diff changeset
535 global pixel_write_col320
heinrichsweikamp
parents:
diff changeset
536 pixel_write_col320:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
537 btfsc screen_type ; display1?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
538 bra pixel_write_col320_d1 ; YES
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
539 ; Display0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
540 btfss flip_screen ; 180° rotation?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
541 bra pixel_write_noflip_H ; NO
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
542 bra pixel_write_flip_H ; YES
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
543 pixel_write_col320_d1: ; Display1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
544 btfsc flip_screen ; 180° rotation?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
545 bra pixel_write_noflip_H ; YES for d1
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
546 pixel_write_flip_H: ; flip d0
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
547 movf PRODL,W ; 16 bits 319 - PROD --> PROD
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
548 sublw LOW(.319) ; 319-W --> W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
549 movwf PRODL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
550 movf PRODH,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
551 btfss STATUS,C ; borrow = /CARRY
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
552 incf WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
553 sublw HIGH(.319)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
554 movwf PRODH
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
555
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
556 pixel_write_noflip_H:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
557 Index_out 0x21 ; frame memory vertical address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
558 bra TFT_DataWrite_PROD ; and return...
0
heinrichsweikamp
parents:
diff changeset
559
heinrichsweikamp
parents:
diff changeset
560 ;-----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
561 ; Writes one half-pixel at position (win_top,win_leftx2).
heinrichsweikamp
parents:
diff changeset
562 ; Inputs: win_leftx2, win_top, win_color:2
heinrichsweikamp
parents:
diff changeset
563 ; Trashed: WREG, PROD
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
564
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
565 global half_pixel_write
0
heinrichsweikamp
parents:
diff changeset
566 half_pixel_write:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
567 movf win_top,W ; d'0' ... d'239'
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
568 ; Variant with Y position in WREG.
0
heinrichsweikamp
parents:
diff changeset
569 half_pixel_write_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
570 btfss flip_screen ; 180° rotation?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
571 sublw .239 ; 239-Y --> Y
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
572 mullw .1 ; copy row to PRODL (PRODH=0)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
573 Index_out 0x20 ; frame memory horizontal address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
574 rcall TFT_DataWrite_PROD
0
heinrichsweikamp
parents:
diff changeset
575
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
576 Index_out 0x22 ; frame memory data write start
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
577 RS_H ; data
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
578 bcf INTCON,GIE
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
579 movff win_color1,PORTA ; upper
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
580 movff win_color2,PORTH ; lower
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
581 WR_L
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
582 WR_H ; tick
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
583 bsf INTCON,GIE
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
584 return
0
heinrichsweikamp
parents:
diff changeset
585
heinrichsweikamp
parents:
diff changeset
586 ;-----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
587 ; Writes a vertical line of half-pixel at position (win_top,win_leftx2,win_height).
heinrichsweikamp
parents:
diff changeset
588 ; Inputs: win_leftx2, win_top, win_height, win_color:2
heinrichsweikamp
parents:
diff changeset
589 ; Trashed: WREG, PROD, TABLAT, TBLPTRL
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
590
0
heinrichsweikamp
parents:
diff changeset
591 global half_vertical_line
heinrichsweikamp
parents:
diff changeset
592 half_vertical_line:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
593 clrf TABLAT ; loop index
0
heinrichsweikamp
parents:
diff changeset
594
heinrichsweikamp
parents:
diff changeset
595 half_vertical_line_loop:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
596 movf win_leftx2,W ; init X position
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
597 mullw .2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
598 movf TABLAT,W ; get loop index
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
599 andlw .1 ; just low bit
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
600 xorwf PRODL,F ; and use it to jitter current X position
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
601 rcall pixel_write_col320 ; start address vertical (.0 - .319)
0
heinrichsweikamp
parents:
diff changeset
602
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
603 movf win_height,W ; index reached height (bank0 read) ?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
604 xorwf TABLAT,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
605 btfsc STATUS,Z ; Equal ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
606 return ; YES - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
607 movf win_top,W ; Y = top + index (bank0 read)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
608 addwf TABLAT,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
609 rcall half_pixel_write_1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
610 incf TABLAT,F ; index++
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
611 bra half_vertical_line_loop
0
heinrichsweikamp
parents:
diff changeset
612
heinrichsweikamp
parents:
diff changeset
613 ;-----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
614 ; Writes a horizontal line of half-pixel at position (win_top,win_leftx2,win_width).
heinrichsweikamp
parents:
diff changeset
615 ; Inputs: win_leftx2, win_top, win_width, win_color:2
heinrichsweikamp
parents:
diff changeset
616 ; Trashed: WREG, PROD, TABLAT, TBLPTRL
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
617
0
heinrichsweikamp
parents:
diff changeset
618 global half_horizontal_line
heinrichsweikamp
parents:
diff changeset
619 half_horizontal_line:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
620 clrf TABLAT ; loop index
0
heinrichsweikamp
parents:
diff changeset
621
heinrichsweikamp
parents:
diff changeset
622 half_horizontal_line_loop:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
623 movf win_leftx2,W ; init X position
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
624 mullw .2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
625 rcall pixel_write_col320 ; start address vertical (.0 - .319)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
626 movf win_width,W ; index reached height (bank0 read) ?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
627 xorwf TABLAT,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
628 btfsc STATUS,Z ; equal ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
629 return ; YES - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
630 movf win_top,W ; Y = top + index (bank0 read)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
631 addwf TABLAT,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
632 rcall half_pixel_write_1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
633 incf TABLAT,F ; index++
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
634 bra half_horizontal_line_loop
0
heinrichsweikamp
parents:
diff changeset
635
heinrichsweikamp
parents:
diff changeset
636
heinrichsweikamp
parents:
diff changeset
637 ;-----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
638 ; TFT Data Cmd via W
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
639
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
640 global TFT_DataWrite_PROD
0
heinrichsweikamp
parents:
diff changeset
641 TFT_DataWrite_PROD:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
642 ; RD_H ; keep high
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
643 RS_H ; data
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
644 bcf INTCON,GIE
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
645 movff PRODH,PORTA ; move high byte to PORTA
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
646 movff PRODL,PORTH ; move low byte to PORTH
0
heinrichsweikamp
parents:
diff changeset
647 WR_L
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
648 WR_H ; tick
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
649 bsf INTCON,GIE
0
heinrichsweikamp
parents:
diff changeset
650 return
heinrichsweikamp
parents:
diff changeset
651
heinrichsweikamp
parents:
diff changeset
652 TFT_DataRead_PROD:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
653 Index_out 0x22 ; frame memory data read start
360
5f142cff43f6 hardware support
heinrichsweikamp
parents: 312
diff changeset
654 TFT_CmdRead_PROD:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
655 setf TRISA ; port A as input
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
656 setf TRISH ; port H as input
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
657 RS_H ; data
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
658 WR_H ; not write
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
659 RD_L ; read
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
660 nop
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
661 nop
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
662 nop
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
663 RD_H ; tick
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
664 nop
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
665 nop
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
666 nop
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
667 RD_L ; read
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
668 nop
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
669 ;nop
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
670 ;nop
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
671 movff PORTA,PRODH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
672 movff PORTH,PRODL
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
673 RD_H ; tick
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
674 nop
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
675 clrf TRISA ; port A as output
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
676 clrf TRISH ; port H as output
0
heinrichsweikamp
parents:
diff changeset
677 return
heinrichsweikamp
parents:
diff changeset
678
heinrichsweikamp
parents:
diff changeset
679 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
680 ; Output TFT Window Address commands
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
681 ; Inputs : win_top, win_leftx2, win_height, win_width
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
682 ; Output : PortA/PortH commands
0
heinrichsweikamp
parents:
diff changeset
683 ; Trashed: PROD
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
684
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
685 global TFT_box_write
0
heinrichsweikamp
parents:
diff changeset
686 TFT_box_write:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
687 movf win_leftx2,W ; compute left = 2 * leftx2 --> PROD
432
929feb0da4f5 hunting a bug in the logbook (Day 2)
heinrichsweikamp
parents: 431
diff changeset
688 mullw 2
0
heinrichsweikamp
parents:
diff changeset
689
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
690 global TFT_box_write_16bit_win_left
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
691 TFT_box_write_16bit_win_left: ; Wwth column in PRODL:PRODH
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
692 btfsc screen_type ; display1?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
693 bra TFT_box_write_16bit_win_left_d1 ; YES
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
694 ; Display0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
695 btfsc flip_screen ; 180° rotation?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
696 bra DISP_box_flip_H ; YES
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
697 bra TFT_box_write_16bit_win_left_com ; NO
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
698 TFT_box_write_16bit_win_left_d1: ; Display1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
699 btfss flip_screen ; 180° rotation?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
700 bra DISP_box_flip_H ; NO for d1
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
701 ; Yes for d1
361
631cbfea3757 1.85beta release
heinrichsweikamp
parents: 360
diff changeset
702 TFT_box_write_16bit_win_left_com:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
703 ;---- Normal horizontal window ---------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
704 Index_out 0x52 ; window vertical start address
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
705 rcall TFT_DataWrite_PROD ; output left
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
706 Index_out 0x21 ; frame memory vertical address
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
707 rcall TFT_DataWrite_PROD ; output left
0
heinrichsweikamp
parents:
diff changeset
708
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
709 movf win_width+0,W ; right = left + width - 1
432
929feb0da4f5 hunting a bug in the logbook (Day 2)
heinrichsweikamp
parents: 431
diff changeset
710 addwf PRODL,F
929feb0da4f5 hunting a bug in the logbook (Day 2)
heinrichsweikamp
parents: 431
diff changeset
711 movf win_width+1,W
929feb0da4f5 hunting a bug in the logbook (Day 2)
heinrichsweikamp
parents: 431
diff changeset
712 addwfc PRODH,F
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
713 decf PRODL,F ; decrement result
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
714 btfss STATUS,C
432
929feb0da4f5 hunting a bug in the logbook (Day 2)
heinrichsweikamp
parents: 431
diff changeset
715 decf PRODH,F
0
heinrichsweikamp
parents:
diff changeset
716
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
717 Index_out 0x53 ; window vertical end address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
718 rcall TFT_DataWrite_PROD
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
719 bra DISP_box_noflip_H
0
heinrichsweikamp
parents:
diff changeset
720
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
721 ;---- Flipped horizontal window --------------------------------------
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
722 DISP_box_flip_H:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
723 movf PRODL,W ; 16 bits 319 - PROD --> PROD
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
724 sublw LOW(.319) ; 319 - WREG --> WREG
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
725 movwf PRODL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
726 movf PRODH,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
727 btfss STATUS,C ; borrow = /CARRY
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
728 incf WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
729 sublw HIGH(.319)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
730 movwf PRODH
152
19ad15f04f60 BUGFIX: Clear Setpoint-Fallback warning when in bailout
heinrichsweikamp
parents: 151
diff changeset
731
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
732 Index_out 0x53 ; window vertical start address
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
733 rcall TFT_DataWrite_PROD ; output left
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
734 Index_out 0x21 ; frame memory vertical address
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
735 rcall TFT_DataWrite_PROD ; output left
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
736
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
737 movf win_width+0,W ; 16 bits PROD - width --> PROD
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
738 subwf PRODL,F ; PRODL - WREG --> PRODL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
739 movf win_width+1,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
740 subwfb PRODH,F
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
741 infsnz PRODL ; PROD + 1 --> PROD
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
742 incf PRODH
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
743
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
744 Index_out 0x52 ; window vertical end address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
745 rcall TFT_DataWrite_PROD
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
746
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
747 DISP_box_noflip_H:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
748 btfss flip_screen ; 180° rotation ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
749 bra TFT_box_noflip_V ; NO
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
750
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
751 ;---- Flipped vertical window -----------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
752 movff win_top,PRODH ; top --> PRODH (first byte)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
753 movf win_height,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
754 addwf PRODH,W
432
929feb0da4f5 hunting a bug in the logbook (Day 2)
heinrichsweikamp
parents: 431
diff changeset
755 decf WREG
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
756 movwf PRODL ; top + height - 1 --> PRODL (second byte)
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
757
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
758 Index_out 0x50 ; window horizontal start address
432
929feb0da4f5 hunting a bug in the logbook (Day 2)
heinrichsweikamp
parents: 431
diff changeset
759 movf PRODH,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
760 rcall TFT_DataWrite ; lower (and tick)
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
761
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
762 Index_out 0x51 ; window horizontal end address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
763 movf PRODL,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
764 rcall TFT_DataWrite ; lower (and tick)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
765
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
766 Index_out 0x20 ; frame memory horizontal address
432
929feb0da4f5 hunting a bug in the logbook (Day 2)
heinrichsweikamp
parents: 431
diff changeset
767 movf PRODH,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
768 bra TFT_DataWrite ; lower (and tick) and return
151
5cb177f0948a work on flip screen...
heinrichsweikamp
parents: 125
diff changeset
769
152
19ad15f04f60 BUGFIX: Clear Setpoint-Fallback warning when in bailout
heinrichsweikamp
parents: 151
diff changeset
770 TFT_box_noflip_V:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
771 ;---- Normal vertical window ----------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
772 movff win_top,PRODL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
773 movf win_height,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
774 addwf PRODL,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
775 sublw .240 ; 240 - top - height
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
776 movwf PRODH ; first byte
0
heinrichsweikamp
parents:
diff changeset
777
432
929feb0da4f5 hunting a bug in the logbook (Day 2)
heinrichsweikamp
parents: 431
diff changeset
778 movf PRODL,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
779 sublw .239 ; 239 - top
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
780 movwf PRODL ; --> second byte
0
heinrichsweikamp
parents:
diff changeset
781
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
782 Index_out 0x50 ; window horizontal start address
432
929feb0da4f5 hunting a bug in the logbook (Day 2)
heinrichsweikamp
parents: 431
diff changeset
783 movf PRODH,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
784 rcall TFT_DataWrite ; lower (and tick)
0
heinrichsweikamp
parents:
diff changeset
785
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
786 Index_out 0x51 ; window horizontal end address
432
929feb0da4f5 hunting a bug in the logbook (Day 2)
heinrichsweikamp
parents: 431
diff changeset
787 movf PRODL,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
788 rcall TFT_DataWrite ; lower (and tick)
0
heinrichsweikamp
parents:
diff changeset
789
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
790 Index_out 0x20 ; frame memory horizontal address
432
929feb0da4f5 hunting a bug in the logbook (Day 2)
heinrichsweikamp
parents: 431
diff changeset
791 movf PRODL,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
792 bra TFT_DataWrite ; lower (and tick) and return
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
793
0
heinrichsweikamp
parents:
diff changeset
794
heinrichsweikamp
parents:
diff changeset
795 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
796 ; TFT_frame : draw a frame around current box with current color
0
heinrichsweikamp
parents:
diff changeset
797 ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2
heinrichsweikamp
parents:
diff changeset
798 ; Outputs: (none)
heinrichsweikamp
parents:
diff changeset
799 ; Trashed: WREG, PROD, aa_start:2, aa_end:2
heinrichsweikamp
parents:
diff changeset
800
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
801 global TFT_frame
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
802 TFT_frame:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
803 movff win_top,save_top ; backup everything
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
804 movff win_height,save_height
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
805 movff win_leftx2,save_left
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
806 movff win_width,save_width
0
heinrichsweikamp
parents:
diff changeset
807
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
808 ;---- TOP line -----------------------------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
809 movlw .1 ; row ~ height = 1
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
810 movwf win_height
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
811 rcall TFT_box
0
heinrichsweikamp
parents:
diff changeset
812
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
813 ;---- BOTTOM line --------------------------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
814 movff save_top,PRODL ; get back top
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
815 movff save_height,WREG ; get back height
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
816 addwf PRODL,W ; top + height
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
817 decf WREG ; top + height - 1
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
818 movwf win_top ; top + height - 1 --> top
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
819 rcall TFT_box
0
heinrichsweikamp
parents:
diff changeset
820
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
821 ;---- LEFT column --------------------------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
822 movff save_top,win_top ; restore top/height
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
823 movff save_height,win_height
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
824 movlw .1 ; column ~ width = 1
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
825 movwf win_width+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
826 rcall TFT_box
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
827
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
828 ;---- RIGHT column -------------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
829 movff save_left,WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
830 movff save_width,PRODL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
831 addwf PRODL,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
832 decf WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
833 movwf win_leftx2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
834 rcall TFT_box
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
835
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
836 ;---- Restore everything -------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
837 movff save_left,win_leftx2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
838 movff save_width,win_width
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
839 return
0
heinrichsweikamp
parents:
diff changeset
840
heinrichsweikamp
parents:
diff changeset
841 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
842 ; TFT_box: fills current box with current color
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
843 ; Inputs : win_top, win_leftx2, win_height, win_width, win_color1, win_color2
0
heinrichsweikamp
parents:
diff changeset
844 ; Outputs: (none)
heinrichsweikamp
parents:
diff changeset
845 ; Trashed: WREG, PROD
heinrichsweikamp
parents:
diff changeset
846
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
847 global TFT_box
0
heinrichsweikamp
parents:
diff changeset
848 TFT_box:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
849 ;---- Define Window ------------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
850 bcf STATUS,C
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
851 rlcf win_width+0,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
852 rlcf win_width+1,F ; x2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
853 rcall TFT_box_write ; setup box
0
heinrichsweikamp
parents:
diff changeset
854
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
855 global TFT_box_16bit_win_left
83
eb72c8865f47 Test with graphic compass
heinrichsweikamp
parents: 0
diff changeset
856 TFT_box_16bit_win_left:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
857 bcf STATUS,C
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
858 rrcf win_width+1,F ; width /= 2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
859 rrcf win_width+0,F
0
heinrichsweikamp
parents:
diff changeset
860
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
861 ;---- Fill Window --------------------------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
862 Index_out 0x22 ; frame memory data write start
0
heinrichsweikamp
parents:
diff changeset
863
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
864 clrf PRODH ; column counter
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
865 RS_H ; data
0
heinrichsweikamp
parents:
diff changeset
866
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
867 TFT_box2: ; loop height times
0
heinrichsweikamp
parents:
diff changeset
868 movff win_height,PRODL
heinrichsweikamp
parents:
diff changeset
869
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
870 TFT_box3: ; loop width times
436
95ee78f4a974 no screen reboot after logbook exit
heinrichsweikamp
parents: 434
diff changeset
871 bcf INTCON,GIE
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
872 movff win_color1,PORTA ; upper
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
873 movff win_color2,PORTH ; lower
0
heinrichsweikamp
parents:
diff changeset
874 WR_L
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
875 WR_H ; tick
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
876
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
877 ; movff win_color1,PORTA ; upper
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
878 ; movff win_color2,PORTH ; lower
0
heinrichsweikamp
parents:
diff changeset
879 WR_L
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
880 WR_H ; tick
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
881 bsf INTCON,GIE
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
882 decfsz PRODL,F ; row loop finished ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
883 bra TFT_box3 ; NO - continue
0
heinrichsweikamp
parents:
diff changeset
884
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
885 incf PRODH,F ; column count ++
0
heinrichsweikamp
parents:
diff changeset
886
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
887 movf win_bargraph,W ; current column == bargraph ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
888 cpfseq PRODH
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
889 bra TFT_box4 ; NO - just loop
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
890 clrf win_color1 ; Yes - switch to black
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
891 clrf win_color2 ; - ...
0
heinrichsweikamp
parents:
diff changeset
892 TFT_box4:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
893 movf win_width+0,W ; compare ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
894 xorwf PRODH,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
895 bnz TFT_box2 ; Loop not finished
0
heinrichsweikamp
parents:
diff changeset
896
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
897 movlw 0x00 ; NOP, to stop window mode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
898 rcall TFT_CmdWrite
0
heinrichsweikamp
parents:
diff changeset
899
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
900 ; reset bargraph mode...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
901 setf win_bargraph
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
902 return
0
heinrichsweikamp
parents:
diff changeset
903
heinrichsweikamp
parents:
diff changeset
904 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
905 ; Converts 8 bit RGB b'RRRGGGBB' into 16 bit RGB b'RRRRRGGGGGGBBBBB'
0
heinrichsweikamp
parents:
diff changeset
906
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
907 global TFT_set_color
0
heinrichsweikamp
parents:
diff changeset
908 TFT_set_color:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
909 movwf tft_temp1 ; get 8 Bit RGB b'RRRGGGBB'
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
910 movwf tft_temp2 ; copy
0
heinrichsweikamp
parents:
diff changeset
911
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
912 ; mask bit 7,6,5,4,3,2
0
heinrichsweikamp
parents:
diff changeset
913 movlw b'00000011'
heinrichsweikamp
parents:
diff changeset
914 andwf tft_temp2,F
heinrichsweikamp
parents:
diff changeset
915
heinrichsweikamp
parents:
diff changeset
916 movlw b'00000000'
heinrichsweikamp
parents:
diff changeset
917 dcfsnz tft_temp2,F
heinrichsweikamp
parents:
diff changeset
918 movlw b'01010000'
heinrichsweikamp
parents:
diff changeset
919 dcfsnz tft_temp2,F
heinrichsweikamp
parents:
diff changeset
920 movlw b'10100000'
heinrichsweikamp
parents:
diff changeset
921 dcfsnz tft_temp2,F
heinrichsweikamp
parents:
diff changeset
922 movlw b'11111000'
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
923 movwf tft_temp3 ; blue done
0
heinrichsweikamp
parents:
diff changeset
924
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
925 movff tft_temp1,tft_temp2 ; copy
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
926 ; mask bit 7,6,5,1,0
0
heinrichsweikamp
parents:
diff changeset
927 movlw b'00011100'
heinrichsweikamp
parents:
diff changeset
928 andwf tft_temp2,F
heinrichsweikamp
parents:
diff changeset
929 rrncf tft_temp2,F
heinrichsweikamp
parents:
diff changeset
930 rrncf tft_temp2,F
heinrichsweikamp
parents:
diff changeset
931
heinrichsweikamp
parents:
diff changeset
932 movlw b'00000000'
heinrichsweikamp
parents:
diff changeset
933 dcfsnz tft_temp2,F
heinrichsweikamp
parents:
diff changeset
934 movlw b'00000100'
heinrichsweikamp
parents:
diff changeset
935 dcfsnz tft_temp2,F
heinrichsweikamp
parents:
diff changeset
936 movlw b'00001000'
heinrichsweikamp
parents:
diff changeset
937 dcfsnz tft_temp2,F
heinrichsweikamp
parents:
diff changeset
938 movlw b'00001100'
heinrichsweikamp
parents:
diff changeset
939 dcfsnz tft_temp2,F
heinrichsweikamp
parents:
diff changeset
940 movlw b'00010000'
heinrichsweikamp
parents:
diff changeset
941 dcfsnz tft_temp2,F
heinrichsweikamp
parents:
diff changeset
942 movlw b'00010100'
heinrichsweikamp
parents:
diff changeset
943 dcfsnz tft_temp2,F
heinrichsweikamp
parents:
diff changeset
944 movlw b'00100000'
heinrichsweikamp
parents:
diff changeset
945 dcfsnz tft_temp2,F
heinrichsweikamp
parents:
diff changeset
946 movlw b'00111111'
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
947 movwf tft_temp4
0
heinrichsweikamp
parents:
diff changeset
948
heinrichsweikamp
parents:
diff changeset
949 rrcf tft_temp4,F
heinrichsweikamp
parents:
diff changeset
950 rrcf tft_temp3,F
heinrichsweikamp
parents:
diff changeset
951
heinrichsweikamp
parents:
diff changeset
952 rrcf tft_temp4,F
heinrichsweikamp
parents:
diff changeset
953 rrcf tft_temp3,F
heinrichsweikamp
parents:
diff changeset
954
heinrichsweikamp
parents:
diff changeset
955 rrcf tft_temp4,F
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
956 rrcf tft_temp3,W ; tft_temp3 (b'GGGBBBBB') done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
957 movwf win_color2 ; set color registers...
0
heinrichsweikamp
parents:
diff changeset
958
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
959 movff tft_temp1,tft_temp2 ; copy
0
heinrichsweikamp
parents:
diff changeset
960 clrf tft_temp1
heinrichsweikamp
parents:
diff changeset
961
heinrichsweikamp
parents:
diff changeset
962 rrcf tft_temp4,F
heinrichsweikamp
parents:
diff changeset
963 rrcf tft_temp1,F
heinrichsweikamp
parents:
diff changeset
964
heinrichsweikamp
parents:
diff changeset
965 rrcf tft_temp4,F
heinrichsweikamp
parents:
diff changeset
966 rrcf tft_temp1,F
heinrichsweikamp
parents:
diff changeset
967
heinrichsweikamp
parents:
diff changeset
968 rrcf tft_temp4,F
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
969 rrcf tft_temp1,F ; green done
0
heinrichsweikamp
parents:
diff changeset
970
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
971 ; mask bit 4,3,2,1,0
0
heinrichsweikamp
parents:
diff changeset
972 movlw b'11100000'
heinrichsweikamp
parents:
diff changeset
973 andwf tft_temp2,F
heinrichsweikamp
parents:
diff changeset
974
heinrichsweikamp
parents:
diff changeset
975 rrncf tft_temp2,F
heinrichsweikamp
parents:
diff changeset
976 rrncf tft_temp2,F
heinrichsweikamp
parents:
diff changeset
977 rrncf tft_temp2,F
heinrichsweikamp
parents:
diff changeset
978 rrncf tft_temp2,F
heinrichsweikamp
parents:
diff changeset
979 rrncf tft_temp2,F
heinrichsweikamp
parents:
diff changeset
980
heinrichsweikamp
parents:
diff changeset
981 movlw b'00000000'
heinrichsweikamp
parents:
diff changeset
982 dcfsnz tft_temp2,F
heinrichsweikamp
parents:
diff changeset
983 movlw b'00000100'
heinrichsweikamp
parents:
diff changeset
984 dcfsnz tft_temp2,F
heinrichsweikamp
parents:
diff changeset
985 movlw b'00001000'
heinrichsweikamp
parents:
diff changeset
986 dcfsnz tft_temp2,F
heinrichsweikamp
parents:
diff changeset
987 movlw b'00001100'
heinrichsweikamp
parents:
diff changeset
988 dcfsnz tft_temp2,F
heinrichsweikamp
parents:
diff changeset
989 movlw b'00010000'
heinrichsweikamp
parents:
diff changeset
990 dcfsnz tft_temp2,F
heinrichsweikamp
parents:
diff changeset
991 movlw b'00010100'
heinrichsweikamp
parents:
diff changeset
992 dcfsnz tft_temp2,F
heinrichsweikamp
parents:
diff changeset
993 movlw b'00100000'
heinrichsweikamp
parents:
diff changeset
994 dcfsnz tft_temp2,F
heinrichsweikamp
parents:
diff changeset
995 movlw b'00111111'
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
996 movwf tft_temp4
0
heinrichsweikamp
parents:
diff changeset
997
heinrichsweikamp
parents:
diff changeset
998 rrcf tft_temp4,F
heinrichsweikamp
parents:
diff changeset
999 rrcf tft_temp1,F
heinrichsweikamp
parents:
diff changeset
1000
heinrichsweikamp
parents:
diff changeset
1001 rrcf tft_temp4,F
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1002 rrcf tft_temp1,F
0
heinrichsweikamp
parents:
diff changeset
1003
heinrichsweikamp
parents:
diff changeset
1004 rrcf tft_temp4,F
heinrichsweikamp
parents:
diff changeset
1005 rrcf tft_temp1,F
heinrichsweikamp
parents:
diff changeset
1006
heinrichsweikamp
parents:
diff changeset
1007 rrcf tft_temp4,F
heinrichsweikamp
parents:
diff changeset
1008 rrcf tft_temp1,F
heinrichsweikamp
parents:
diff changeset
1009
heinrichsweikamp
parents:
diff changeset
1010 rrcf tft_temp4,F
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1011 rrcf tft_temp1,W ; red done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1012 movwf win_color1 ; set color registers
0
heinrichsweikamp
parents:
diff changeset
1013 return
heinrichsweikamp
parents:
diff changeset
1014
heinrichsweikamp
parents:
diff changeset
1015 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
1016 ; Dump screen contents to the UART
heinrichsweikamp
parents:
diff changeset
1017
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1018 IFDEF _screendump
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1019
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1020 global TFT_dump_screen_check
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1021 global TFT_dump_screen
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1022 TFT_dump_screen_check:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1023 btfss vusb_in ; USB (still) plugged in?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1024 bcf enable_screen_dumps ; NO - clear flag
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1025 call rs232_get_byte ; try to read data from RS232
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1026 btfsc rs232_receive_overflow ; anything received?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1027 return ; NO - return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1028 movlw "l" ; YES - load coding for screendump command
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1029 cpfseq RCREG1 ; screendump command received?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1030 return ; NO - return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1031 TFT_dump_screen: ; YES
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1032 bsf no_sensor_int
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1033 movlw 'l'
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1034 movwf TXREG ; send command echo
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1035 call rs232_wait_tx ; wait for UART
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1036
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1037 ;---- Send DISPLAY box command for the full screen window -------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1038 Index_out 0x50 ; window horizontal start address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1039 Parameter_out 0x00, 0x00 ; 0-239
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1040 Index_out 0x51 ; window horizontal end address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1041 Parameter_out 0x00, 0xEF ; 0-239
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1042 Index_out 0x52 ; window vertical start address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1043 Parameter_out 0x00, 0x00 ; 0-319
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1044 Index_out 0x53 ; window vertical end address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1045 Parameter_out 0x01, 0x3F ; 0-319
0
heinrichsweikamp
parents:
diff changeset
1046
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1047 clrf ds_column
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1048 rcall dump_screen_pixel_reset
0
heinrichsweikamp
parents:
diff changeset
1049 dump_screen_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1050 btg LEDr ; LED activity toggle
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1051 ; Dump even column
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1052 movlw .240 ; 240 lines, once
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1053 movwf ds_line
0
heinrichsweikamp
parents:
diff changeset
1054 dump_screen_2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1055 Index_out 0x20 ; frame memory horizontal address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1056 movff ds_line,WREG ; d'0' ... d'239'
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1057 mullw .1 ; copy row to PRODH:L
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1058 rcall TFT_DataWrite_PROD
0
heinrichsweikamp
parents:
diff changeset
1059
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1060 movff ds_column,WREG ; Init X position
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1061 mullw 2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1062 rcall pixel_write_col320 ; start address vertical (.0 - .319)
0
heinrichsweikamp
parents:
diff changeset
1063
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1064 rcall TFT_DataRead_PROD ; read pixel
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1065 rcall dump_screen_pixel
0
heinrichsweikamp
parents:
diff changeset
1066
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1067 decfsz ds_line,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1068 bra dump_screen_2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1069 rcall dump_screen_pixel_flush
0
heinrichsweikamp
parents:
diff changeset
1070
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1071 ; Dump odd column
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1072 movlw .240 ; 240 lines, twice
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1073 movwf ds_line
0
heinrichsweikamp
parents:
diff changeset
1074 dump_screen_3:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1075 Index_out 0x20 ; frame memory horizontal address
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1076 movff ds_line,WREG ; d'0' ... d'239'
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1077 mullw 1 ; copy row to PRODH:L
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1078 rcall TFT_DataWrite_PROD
0
heinrichsweikamp
parents:
diff changeset
1079
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1080 movff ds_column,WREG ; init X position
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1081 mullw 2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1082 movlw .1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1083 addwf PRODL,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1084 movlw 0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1085 addwfc PRODH,F ; +1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1086 rcall pixel_write_col320 ; start address vertical (.0 - .319)
0
heinrichsweikamp
parents:
diff changeset
1087
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1088 rcall TFT_DataRead_PROD ; read pixel
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1089 rcall dump_screen_pixel
0
heinrichsweikamp
parents:
diff changeset
1090
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1091 decfsz ds_line,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1092 bra dump_screen_3
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1093 rcall dump_screen_pixel_flush
0
heinrichsweikamp
parents:
diff changeset
1094
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1095 incf ds_column,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1096 movlw .160
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1097 cpfseq ds_column
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1098 bra dump_screen_1
0
heinrichsweikamp
parents:
diff changeset
1099
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1100 bcf no_sensor_int
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1101 clrf RCREG1 ; clear receive buffer
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1102 bcf RCSTA1,CREN ; clear receiver status
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1103 bsf RCSTA1,CREN
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1104 bsf enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (screen dump)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1105 return
0
heinrichsweikamp
parents:
diff changeset
1106
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1107 ENDIF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1108
0
heinrichsweikamp
parents:
diff changeset
1109
heinrichsweikamp
parents:
diff changeset
1110 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
1111 ; Pixel compression
heinrichsweikamp
parents:
diff changeset
1112 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1113 ; Input : PRODH:L = pixel
0
heinrichsweikamp
parents:
diff changeset
1114 ; Output: Compressed stream on output.
heinrichsweikamp
parents:
diff changeset
1115 ; Compressed format:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1116 ; 0ccccccc : BLACK pixel, repeated ccccccc+1 times (1..128)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1117 ; 11cccccc : WHITE pixel, repeated cccccc+1 times (1.. 64)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1118 ; 10cccccc HIGH LOW : color pixel (H:L) repeated ccccc+1 times (1.. 64)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1119
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1120 IFDEF _screendump
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1121
0
heinrichsweikamp
parents:
diff changeset
1122 dump_screen_pixel:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1123 movf PRODH,W ; compare pixel-high
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1124 xorwf ds_pixel+1,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1125 bnz dump_screen_pixel_1 ; different -> dump
0
heinrichsweikamp
parents:
diff changeset
1126
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1127 movf PRODL,W ; compare pixel-low
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1128 xorwf ds_pixel+0,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1129 bnz dump_screen_pixel_1 ; different -> dump
0
heinrichsweikamp
parents:
diff changeset
1130
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1131 incf ds_count,F ; same color: just increment
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1132 return
0
heinrichsweikamp
parents:
diff changeset
1133
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1134 dump_screen_pixel_1: ; send (pixel,count) tuple
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1135 movf ds_count,W ; is count zero ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1136 bz dump_screen_pixel_2 ; YES - skip sending
0
heinrichsweikamp
parents:
diff changeset
1137
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1138 movf ds_pixel+1,W ; is this a BLACK pixel ?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1139 iorwf ds_pixel+0,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1140 bz dump_screen_pix_black ; YES
0
heinrichsweikamp
parents:
diff changeset
1141
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1142 movf ds_pixel+1,W ; is this a white pixel ?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1143 andwf ds_pixel+0,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1144 incf WREG
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1145 bz dump_screen_pix_white ; YES
0
heinrichsweikamp
parents:
diff changeset
1146
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1147 ; No: write the pixel itself...
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1148 movlw .64 ; max color pixel on a single byte
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1149 cpfsgt ds_count ; skip if count > 64
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1150 movf ds_count,W ; W <- min(64,count)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1151 subwf ds_count,F ; ds_count <- ds_count-W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1152 decf WREG ; save as 0..63
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1153 iorlw b'10000000' ; mark as a color pixel
0
heinrichsweikamp
parents:
diff changeset
1154
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1155 movwf TXREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1156 call rs232_wait_tx ; wait for UART
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1157 movff ds_pixel+1,TXREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1158 call rs232_wait_tx ; wait for UART
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1159 movff ds_pixel+0,TXREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1160 call rs232_wait_tx ; wait for UART
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1161 bra dump_screen_pixel_1
0
heinrichsweikamp
parents:
diff changeset
1162
heinrichsweikamp
parents:
diff changeset
1163 dump_screen_pixel_2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1164 movff PRODH,ds_pixel+1 ; save new pixel color
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1165 movff PRODL,ds_pixel+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1166 movlw 1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1167 movwf ds_count ; and set count=1
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1168 return
0
heinrichsweikamp
parents:
diff changeset
1169
heinrichsweikamp
parents:
diff changeset
1170 dump_screen_pix_black:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1171 movlw .128 ; max black pixel on a single byte
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1172 cpfsgt ds_count ; skip if count > 128
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1173 movf ds_count,W ; W <- min(128,count)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1174 subwf ds_count,F ; ds_count <- ds_count-W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1175 decf WREG ; save as 0..127
0
heinrichsweikamp
parents:
diff changeset
1176 dump_screen_pix_3:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1177 movwf TXREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1178 call rs232_wait_tx
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1179 bra dump_screen_pixel_1 ; more to dump ?
0
heinrichsweikamp
parents:
diff changeset
1180
heinrichsweikamp
parents:
diff changeset
1181 dump_screen_pix_white:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1182 movlw .64 ; max white pixel on a single byte
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1183 cpfsgt ds_count ; skip if count > 64
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1184 movf ds_count,W ; W <- min(64,count)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1185 subwf ds_count,F ; ds_count <- ds_count-W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1186 decf WREG ; Save as 0..63
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1187 iorlw b'11000000' ; mark as a compressed white
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1188 bra dump_screen_pix_3
0
heinrichsweikamp
parents:
diff changeset
1189
heinrichsweikamp
parents:
diff changeset
1190 dump_screen_pixel_flush:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1191 clrf PRODH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1192 clrf PRODL
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1193 rcall dump_screen_pixel_1 ; send it
0
heinrichsweikamp
parents:
diff changeset
1194 dump_screen_pixel_reset:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1195 clrf ds_count ; clear count
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1196 return
0
heinrichsweikamp
parents:
diff changeset
1197
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1198 ENDIF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1199
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 461
diff changeset
1200 END