annotate src/tft.asm @ 627:bf5fee575701

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