Mercurial > public > hwos_code
comparison src/tft.inc @ 623:c40025d8e750
3.03 beta released
author | heinrichsweikamp |
---|---|
date | Mon, 03 Jun 2019 14:01:48 +0200 |
parents | ca4556fb60b9 |
children | cd58f7fc86db |
comparison
equal
deleted
inserted
replaced
622:02d1386429a6 | 623:c40025d8e750 |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File tft.inc V2.99c | 3 ; File tft.inc combined next generation V3.03.2 |
4 ; | 4 ; |
5 ; Declaring interfaces to the TFT screen and its Oxxx controler | 5 ; Declaring interfaces to the TFT screen and its Oxxx controler |
6 ; | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. |
8 ;============================================================================= | 8 ;============================================================================= |
11 | 11 |
12 ;============================================================================= | 12 ;============================================================================= |
13 ; TFT public subroutines | 13 ; TFT public subroutines |
14 ;============================================================================= | 14 ;============================================================================= |
15 | 15 |
16 ; Writes two half-pixels at position (win_top,win_leftx2) | 16 ;----------------------------------------------------------------------------- |
17 ; Write two half-pixels at position (win_top,win_leftx2) | |
18 ; | |
17 ; Inputs : win_leftx2, win_top, win_color:2 | 19 ; Inputs : win_leftx2, win_top, win_color:2 |
18 ; Outputs: (none) | 20 ; Outputs: (none) |
19 ; Trashed: WREG, PROD | 21 ; Trashed: WREG, PROD |
22 | |
20 extern pixel_write | 23 extern pixel_write |
21 | 24 |
22 ;----------------------------------------------------------------------------- | 25 |
23 ; Writes one half-pixel at position (win_top,win_leftx2) | 26 ;----------------------------------------------------------------------------- |
27 ; Write one half-pixel at position (win_top,win_leftx2) | |
28 ; | |
24 ; Inputs : win_leftx2, win_top, win_color:2 | 29 ; Inputs : win_leftx2, win_top, win_color:2 |
25 ; Outputs: (none) | 30 ; Outputs: (none) |
26 ; Trashed: WREG, PROD | 31 ; Trashed: WREG, PROD |
32 | |
27 extern half_pixel_write | 33 extern half_pixel_write |
28 | 34 |
29 ;----------------------------------------------------------------------------- | 35 |
30 ; Draws a frame around current box with current color | 36 ;----------------------------------------------------------------------------- |
37 ; Draw a frame around current box with current color | |
31 ; Inputs : win_top, win_leftx2, win_height, win_width, win_color1, win_color2 | 38 ; Inputs : win_top, win_leftx2, win_height, win_width, win_color1, win_color2 |
32 ; Outputs: (none) | 39 ; Outputs: (none) |
33 ; Trashed: WREG, PROD, aa_start:2, aa_end:2, win_leftx2, win_width:1 | 40 ; Trashed: WREG, PROD, aa_start:2, aa_end:2, win_leftx2, win_width:1 |
41 | |
34 extern TFT_frame | 42 extern TFT_frame |
35 | 43 |
36 ;----------------------------------------------------------------------------- | 44 |
37 extern TFT_DisplayOff ; Power-off everything (need a boot next) | 45 ;----------------------------------------------------------------------------- |
38 extern TFT_boot ; Initialize screen hardware | 46 extern TFT_DisplayOff ; power-off everything (needs a boot thereafter) |
39 extern TFT_Display_FadeIn ; Smooth lighting | 47 extern TFT_boot ; initialize screen hardware |
40 extern TFT_Display_FadeOut ; Smooth darkening | 48 extern TFT_Display_FadeIn ; smooth lighting up |
49 extern TFT_Display_FadeOut ; smooth darkening down | |
41 extern TFT_ClearScreen | 50 extern TFT_ClearScreen |
42 extern TFT_box_write | 51 extern TFT_box_write |
43 extern TFT_box_write_16bit_win_left ; With column in PRODL:PRODH | 52 extern TFT_box_write_16bit_win_left ; with column in PRODL:PRODH |
44 extern TFT_box | 53 extern TFT_box |
45 extern TFT_box_16bit_win_left ; With column in PRODL:PRODH | 54 extern TFT_box_16bit_win_left ; with column in PRODL:PRODH |
46 extern TFT_DataWrite_PROD | 55 extern TFT_DataWrite_PROD |
47 extern TFT_set_color | 56 extern TFT_set_color |
48 ; extern init_pixel_write | 57 ; extern init_pixel_write |
49 extern pixel_write | 58 extern pixel_write |
50 extern pixel_write_col320 | 59 extern pixel_write_col320 |
54 IFDEF _screendump | 63 IFDEF _screendump |
55 extern TFT_dump_screen | 64 extern TFT_dump_screen |
56 extern TFT_dump_screen_check | 65 extern TFT_dump_screen_check |
57 ENDIF | 66 ENDIF |
58 | 67 |
68 | |
59 ;============================================================================= | 69 ;============================================================================= |
60 ; Low level macros (for aa_wordprocessor and color_processor) | 70 ; Low level macros (for aa_wordprocessor and color_processor) |
61 ; | 71 ; |
62 extern TFT_CmdWrite | 72 extern TFT_CmdWrite |
63 Index_out macro low_b | 73 Index_out macro low_b |
64 movlw low_b | 74 movlw low_b |
65 call TFT_CmdWrite | 75 call TFT_CmdWrite |
66 endm | 76 endm |
67 | 77 |
68 ;============================================================================= | 78 |
69 ; A shortcut for TFT_box and TFT_frame call sequences | 79 ;============================================================================= |
80 ; shortcuts for TFT_box and TFT_frame call sequences | |
70 ; | 81 ; |
71 extern box_frame_std, box_frame_common, box_frame_color, box_frame_color16 | 82 extern box_frame_std, box_frame_common, box_frame_color, box_frame_color16 |
72 extern box_std_block, box_black_block, box_color_block | 83 extern box_std_block, box_black_block, box_color_block |
73 | 84 |
74 ; Erase a given screen area | 85 ; Erase a given screen area |
86 ; | |
75 WIN_BOX_BLACK macro top, bottom, left, right | 87 WIN_BOX_BLACK macro top, bottom, left, right |
76 call box_black_block | 88 call box_black_block |
77 db top, (bottom)-(top)+1, left, (right)-(left)+1 | 89 db top, (bottom)-(top)+1, left, (right)-(left)+1 |
78 endm | 90 endm |
79 | 91 |
92 | |
80 ; Fill a given screen area with standard color (white) | 93 ; Fill a given screen area with standard color (white) |
94 ; | |
81 WIN_BOX_STD macro top, bottom, left, right | 95 WIN_BOX_STD macro top, bottom, left, right |
82 call box_std_block | 96 call box_std_block |
83 db top, (bottom)-(top)+1, left, (right)-(left)+1 | 97 db top, (bottom)-(top)+1, left, (right)-(left)+1 |
84 endm | 98 endm |
85 | 99 |
100 | |
86 ; Fill a given screen area with color from WREG (8 bits rrrgggbb) | 101 ; Fill a given screen area with color from WREG (8 bits rrrgggbb) |
102 ; | |
87 WIN_BOX_COLOR macro top, bottom, left, right | 103 WIN_BOX_COLOR macro top, bottom, left, right |
88 call box_color_block | 104 call box_color_block |
89 db top, (bottom)-(top)+1, left, (right)-(left)+1 | 105 db top, (bottom)-(top)+1, left, (right)-(left)+1 |
90 endm | 106 endm |
91 | 107 |
92 ; Draw a frame in standard color (white) | 108 ; Draw a frame in standard color (white) |
109 ; | |
93 WIN_FRAME_STD macro top, bottom, left, right | 110 WIN_FRAME_STD macro top, bottom, left, right |
94 call box_frame_std | 111 call box_frame_std |
95 db top, (bottom)-(top)+1, left, (right)-(left)+1 | 112 db top, (bottom)-(top)+1, left, (right)-(left)+1 |
96 endm | 113 endm |
97 | 114 |
115 | |
98 ; Draw a frame with color from WREG (8 bits rrrgggbb) | 116 ; Draw a frame with color from WREG (8 bits rrrgggbb) |
117 ; | |
99 WIN_FRAME_COLOR macro top, bottom, left, right | 118 WIN_FRAME_COLOR macro top, bottom, left, right |
100 call box_frame_color | 119 call box_frame_color |
101 db top, (bottom)-(top)+1, left, (right)-(left)+1 | 120 db top, (bottom)-(top)+1, left, (right)-(left)+1 |
102 endm | 121 endm |
103 | 122 |
123 | |
104 ; Draw a frame with color from win_color (16 bits in TFT format) | 124 ; Draw a frame with color from win_color (16 bits in TFT format) |
125 ; | |
105 WIN_FRAME_COLOR16 macro top, bottom, left, right | 126 WIN_FRAME_COLOR16 macro top, bottom, left, right |
106 call box_frame_color16 | 127 call box_frame_color16 |
107 db top, (bottom)-(top)+1, left, (right)-(left)+1 | 128 db top, (bottom)-(top)+1, left, (right)-(left)+1 |
108 endm | 129 endm |
130 | |
109 | 131 |
110 WIN_FONT macro win_font_input | 132 WIN_FONT macro win_font_input |
111 movlw win_font_input | 133 movlw win_font_input |
112 movff WREG,win_font | 134 movff WREG,win_font |
113 endm | 135 endm |
114 | 136 |
137 | |
115 WIN_TOP macro win_top_input | 138 WIN_TOP macro win_top_input |
116 movlw win_top_input | 139 movlw win_top_input |
117 movff WREG,win_top | 140 movff WREG,win_top |
118 endm | 141 endm |
119 | 142 |
120 WIN_HEIGHT macro h | 143 |
121 movlw h | 144 WIN_HEIGHT macro win_hight_input |
145 movlw win_hight_input | |
122 movff WREG,win_height | 146 movff WREG,win_height |
123 endm | 147 endm |
148 | |
124 | 149 |
125 WIN_LEFT macro win_left_input | 150 WIN_LEFT macro win_left_input |
126 movlw win_left_input | 151 movlw win_left_input |
127 movff WREG,win_leftx2 | 152 movff WREG,win_leftx2 |
128 endm | 153 endm |
129 | 154 |
130 WIN_WIDTH macro w | 155 |
131 movlw w | 156 WIN_WIDTH macro win_width_input |
157 movlw win_width_input | |
132 movff WREG,win_width | 158 movff WREG,win_width |
133 endm | 159 endm |
160 | |
134 | 161 |
135 WIN_COLOR macro win_color_input | 162 WIN_COLOR macro win_color_input |
136 movlw win_color_input | 163 movlw win_color_input |
137 call TFT_set_color | 164 call TFT_set_color |
138 endm | 165 endm |
139 | 166 |
140 ;;============================================================================= | |
141 ;; TFT_write_flash_image | |
142 ;; | |
143 ;; Inputs : cx, cy : Image center (in 0..160 x 0..240 range) | |
144 ;; image : flash image header's address | |
145 ;; Outputs: win_top, win_left, win_height, win_width | |
146 ;; image copyed on screen. | |
147 ;; Trashed: PROD, hi, lo | |
148 ;; | |
149 ;; extern TFT_write_flash_image | |
150 ;; extern TFT_write_flash_image_addr | |
151 ;TFT_WRITE_FLASH_IMAGE macro cx, cy, image | |
152 ; If LOW(image) != 0 | |
153 ; Error "Image "image" mis-aligned" | |
154 ; Endif | |
155 ; If (UPPER(image) & 0xF0) != 0x30 | |
156 ; Error "Image "image" not in image flash memory" | |
157 ; Endif | |
158 ; If (cx < 0) || (cx > 160) | |
159 ; Error "Image center's X "cx" not in 0..160 range". | |
160 ; Endif | |
161 ; If (cy < 0) || (cy > 240) | |
162 ; Error "Image center's Y "cy" not in 0..240 range". | |
163 ; Endif | |
164 ; ; Once we know image is aligned, we can use the compact (4 bytes) | |
165 ; ; 12 bit registers to pass the address: | |
166 ; lfsr FSR2, ((image)>>8) & 0xFFF | |
167 ; WIN_LEFT cx | |
168 ; WIN_TOP cy | |
169 ; call TFT_write_flash_image | |
170 ; endm | |
171 | |
172 ;============================================================================= | 167 ;============================================================================= |
173 ; TFT_write_prom_image | 168 ; TFT_write_prom_image |
169 ; | |
174 | 170 |
175 ; image referenced by a label | 171 ; image referenced by a label |
176 TFT_WRITE_PROM_IMAGE_BY_LABEL macro image_label | 172 TFT_WRITE_PROM_IMAGE_BY_LABEL macro image_label |
177 extern image_label | 173 extern image_label |
178 movlw LOW (image_label) | 174 movlw LOW (image_label) |
205 movwf TBLPTRH | 201 movwf TBLPTRH |
206 movlw UPPER (colors_label) | 202 movlw UPPER (colors_label) |
207 movwf TBLPTRU | 203 movwf TBLPTRU |
208 extern get_colors | 204 extern get_colors |
209 call get_colors | 205 call get_colors |
210 bsf use_custom_colors ; will suppress read-in of the colors that come with the image | 206 bsf use_custom_colors ; will suppress reading the colors that come with the image |
211 endm | 207 endm |
212 | 208 |
213 ;============================================================================= | 209 |
214 ; Macro to provide our own interface code | 210 ;============================================================================= |
215 ; | 211 ; Macros to provide our own interface code |
212 ; | |
213 | |
216 PIXEL_WRITE macro colRegister, rowRegister | 214 PIXEL_WRITE macro colRegister, rowRegister |
217 movff colRegister,win_leftx2 | 215 movff colRegister,win_leftx2 |
218 movff rowRegister,win_top | 216 movff rowRegister,win_top |
219 call pixel_write | 217 call pixel_write |
220 endm | 218 endm |
221 | 219 |
220 | |
222 ;INIT_PIXEL_WRITE macro colRegister | 221 ;INIT_PIXEL_WRITE macro colRegister |
223 ; movff colRegister,win_leftx2 | 222 ; movff colRegister,win_leftx2 |
224 ; call init_pixel_write | 223 ; call init_pixel_write |
225 ; endm | 224 ; endm |
226 | 225 |
226 | |
227 HALF_PIXEL_WRITE macro rowRegister | 227 HALF_PIXEL_WRITE macro rowRegister |
228 movff rowRegister,win_top | 228 movff rowRegister,win_top |
229 call half_pixel_write | 229 call half_pixel_write |
230 endm | 230 endm |