Mercurial > public > mk2
annotate code_part1/OSTC_code_c_part2/p3_wordprocessor.c @ 167:cb055a7d75f3
+ Use overlay local vars.
+ Make all private functions static.
+ Merge calc_tissue 2sec and 1min
+ Merge sim_tissue 1min and 10min
+ Expose basic display utilities for c-code.
+ Prepare stand-alone utilities for p2_main.c testing platform.
+ New c utility: int read_custom_function(cf#)
author | JeanDo |
---|---|
date | Mon, 24 Jan 2011 23:31:57 +0100 |
parents | bc3092c41335 |
children |
rev | line source |
---|---|
72 | 1 /* |
2 * OSTC - diving computer code | |
3 * =========================== | |
4 * PART 3 : word processor | |
5 * | |
6 * p3_wordprocessor.c for OSTC Mk.2 | |
7 * Created on: 17.09.2009 | |
8 * Author: christian.w @ heinrichsweikamp.com | |
9 * | |
10 * #include "ostc28.drx.txt" | |
11 * #include "ostc28.tbl.txt" | |
12 * #include "ostc48.tbl.txt" | |
13 * #include "ostc48.drx.txt" | |
14 * #include "ostc90.drx.txt" | |
15 * #include "ostc90.tbl.txt" | |
16 */ | |
17 | |
18 // Copyright (C) 2009 HeinrichsWeikamp GbR | |
19 | |
20 // This program is free software: you can redistribute it and/or modify | |
21 // it under the terms of the GNU General Public License as published by | |
22 // the Free Software Foundation, either version 3 of the License, or | |
23 // (at your option) any later version. | |
24 | |
25 // This program is distributed in the hope that it will be useful, | |
26 // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
27 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
28 // GNU General Public License for more details. | |
29 | |
30 // You should have received a copy of the GNU General Public License | |
31 // along with this program. If not, see <http://www.gnu.org/licenses/>. | |
32 | |
33 | |
34 // ***************************** | |
35 // ** I N T R O D U C T I O N ** | |
36 // ***************************** | |
37 // | |
38 // OSTC | |
39 // | |
40 // code: | |
41 // | |
42 // summary: | |
43 // display routines | |
44 // for the OSTC experimental project | |
45 // written by Christian Weikamp | |
46 // last revision __________ | |
47 // comments added _________ | |
48 // | |
49 // additional files: | |
50 // #include "ostc28.drx.txt" | |
51 // #include "ostc28.tbl.txt" | |
52 // #include "ostc48.tbl.txt" | |
53 // #include "ostc48.drx.txt" | |
54 // #include "ostc90.drx.txt" | |
55 // #include "ostc90.tbl.txt" | |
56 // assembler code (PART 1) for working OSTC experimental plattform | |
57 // C code (PART 2) for working OSTC experimental plattform | |
58 // | |
59 // history: | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
60 // 2010-12-1 : jDG Cleanups to a tighter code. |
72 | 61 |
62 | |
63 // ********************* | |
64 // ** I N C L U D E S ** | |
65 // ********************* | |
66 #include <p18f4685.h> | |
67 | |
68 // ******************************** | |
69 // ** C O N F I G U R A T I O N ** | |
70 // ** for simulation without asm ** | |
71 // ******************************** | |
72 #pragma config OSC = IRCIO67 | |
73 #pragma config FCMEN = OFF | |
74 #pragma config IESO = OFF | |
75 #pragma config PWRT = ON | |
76 #pragma config BOREN = OFF | |
77 #pragma config WDT = OFF | |
78 #pragma config WDTPS = 128 | |
79 #pragma config MCLRE = ON | |
80 #pragma config LPT1OSC = OFF | |
81 #pragma config PBADEN = OFF | |
82 #pragma config DEBUG = OFF | |
83 #pragma config XINST = OFF | |
84 #pragma config LVP = OFF | |
85 #pragma config STVREN = OFF | |
86 | |
87 // **************************** | |
88 // ** D E F I N E S ** | |
89 // ** missing in p18f4685.h ** | |
90 // **************************** | |
91 | |
92 #define WP_FONT_SMALL_HEIGHT 24 | |
93 #define WP_FONT_MEDIUM_HEIGHT 32 | |
94 #define WP_FONT_LARGE_HEIGHT 58 | |
95 #define oled_rw PORTA,2,0 | |
96 #define oled_rs PORTE,0,0 | |
97 | |
98 // *********************** | |
99 // ** V A R I A B L E S ** | |
100 // *********************** | |
101 | |
102 #pragma udata bank0a=0x060 | |
103 // input | |
104 volatile unsigned char wp_stringstore[26]; | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
105 volatile unsigned int wp_color; |
72 | 106 volatile unsigned char wp_top; |
107 volatile unsigned char wp_leftx2; | |
108 volatile unsigned char wp_font; | |
109 volatile unsigned char wp_invert; | |
110 // internal | |
111 volatile unsigned char wp_temp_U8; | |
112 volatile unsigned char wp_txtptr; | |
113 volatile unsigned char wp_char; | |
114 volatile unsigned char wp_command; | |
115 volatile unsigned int wp_data_16bit; | |
116 volatile unsigned int wp_start; | |
117 volatile unsigned int wp_end; | |
118 volatile unsigned int wp_i; | |
119 volatile unsigned char wp_debug_U8; | |
120 | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
121 // Temporary used only inside the wordprocessor.c module |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
122 static unsigned int wp_string_width = 0; |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
123 |
72 | 124 |
125 // ************************* | |
126 // ** P R O T O T Y P E S ** | |
127 // ************************* | |
128 void main(void); | |
129 | |
130 void main_calc_wordprocessor(void); | |
131 | |
132 void wp_write_command(void); | |
133 void wp_write_data(void); | |
134 void wp_set_window(void); | |
135 void wp_set_char_font_small(void); | |
136 void wp_set_char_font_medium(void); | |
137 void wp_set_char_font_large(void); | |
138 void wordprocessor(void); | |
139 | |
140 // ******************************* | |
141 // ** start ** | |
142 // ** necessary for compilation ** | |
143 // ******************************* | |
144 #pragma romdata der_code = 0x0000 | |
145 #pragma code der_start = 0x0000 | |
146 void der_start(void) | |
147 { | |
148 _asm | |
149 goto main | |
150 _endasm | |
151 } | |
152 | |
153 // *********************************** | |
154 // ** main code for simulation / ** | |
155 // ** tests without assembler code ** | |
156 // ** is NOT a part of the OSTC ** | |
157 // *********************************** | |
158 #pragma code main = 0x9000 | |
159 void main(void) | |
160 { | |
161 wp_top = 10; | |
162 wp_leftx2 = 10; | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
163 wp_color = 0xFFFF; |
72 | 164 wp_font = 0; |
165 wp_invert = 0; | |
166 wp_stringstore[0] = ' '; | |
167 wp_stringstore[1] = '!'; | |
168 wp_stringstore[2] = '"'; | |
169 wp_stringstore[3] = ':'; | |
170 wp_stringstore[4] = 0; | |
171 wordprocessor(); | |
172 } | |
173 | |
174 // ****************************************************** | |
175 // ****************************************************** | |
176 // ** THE FOLLOWING CODE HAS TO BE COPPIED TO THE OSTC ** | |
177 // ****************************************************** | |
178 // ****************************************************** | |
179 // *************** | |
180 // *************** | |
181 // ** THE FONTS ** | |
182 // *************** | |
183 // *************** | |
184 // all new for bigscreen | |
185 #pragma romdata font_data_large = 0x09A00 | |
186 rom const rom unsigned int wp_large_data[] = | |
187 { | |
188 #include "ostc90.drx.txt" // length 0x59A | |
189 }; | |
190 #pragma romdata font_table_large = 0x09FA0 | |
191 rom const rom unsigned int wp_large_table[] = | |
192 { | |
193 #include "ostc90.tbl.txt" // length 0x18 | |
194 }; | |
195 #pragma romdata font_table_medium = 0x0A000 | |
196 rom const rom unsigned int wp_medium_table[] = | |
197 { | |
198 #include "ostc48.tbl.txt" // length 0x22 | |
199 }; | |
200 #pragma romdata font_data_medium = 0x0A024 | |
201 rom const rom unsigned int wp_medium_data[] = | |
202 { | |
203 #include "ostc48.drx.txt" // length 0x374 // geht bis einschl. 0xA398 | |
204 }; | |
205 #pragma romdata font_table_small = 0x0A39A | |
206 rom const rom unsigned int wp_small_table[] = | |
207 { | |
208 #include "ostc28.tbl.txt" // length 0xE8 | |
209 }; | |
210 #pragma romdata font_data_small = 0x0A488 | |
211 rom const rom unsigned int wp_small_data[] = | |
212 { | |
213 #include "ostc28.drx.txt" | |
214 }; | |
215 | |
216 // ********************** | |
217 // ********************** | |
218 // ** THE JUMP-IN CODE ** | |
219 // ** for the asm code ** | |
220 // ********************** | |
221 // ********************** | |
222 #pragma code main_wordprocessor = 0x0B468 | |
223 void main_wordprocessor(void) | |
224 { | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
225 _asm |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
226 goto wordprocessor |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
227 _endasm |
72 | 228 } |
229 | |
230 // ********************* | |
231 // ********************* | |
232 // ** THE SUBROUTINES ** | |
233 // ********************* | |
234 // ********************* | |
235 | |
236 #pragma code subroutines2 = 0x0B470 // can be adapted to fit the romdata tables ahead | |
237 | |
238 // ------------ | |
239 // write new // | |
240 // ------------ | |
241 | |
242 void wp_write_command(void) | |
243 { | |
244 _asm | |
245 bcf oled_rs | |
246 movff wp_command,PORTD | |
247 bcf oled_rw | |
248 bsf oled_rw | |
249 _endasm | |
250 } | |
251 | |
252 void wp_write_data(void) | |
253 { | |
254 _asm | |
255 bsf oled_rs | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
256 movff wp_data_16bit+1,PORTD // OLED commands are big endian... |
72 | 257 bcf oled_rw |
258 bsf oled_rw | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
259 movff wp_data_16bit+0,PORTD |
72 | 260 bcf oled_rw |
261 bsf oled_rw | |
262 _endasm | |
263 } | |
264 | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
265 ////////////////////////////////////////////////////////////////////////////// |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
266 |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
267 void wp_char_width(void) |
72 | 268 { |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
269 wp_string_width = 0; |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
270 for(wp_txtptr = 0; wp_txtptr < 26; wp_txtptr++) |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
271 { |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
272 wp_char = wp_stringstore[wp_txtptr]; |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
273 if( wp_char == 0 ) break; |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
274 |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
275 if(wp_font == 2) |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
276 wp_set_char_font_large(); |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
277 else if(wp_font == 1) |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
278 wp_set_char_font_medium(); |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
279 else |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
280 wp_set_char_font_small(); |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
281 |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
282 for(wp_i = wp_start; wp_i<wp_end;wp_i++) |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
283 { |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
284 wp_data_16bit = wp_i ^ 1; |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
285 if(wp_font == 2) |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
286 wp_temp_U8 = ((rom unsigned char*)wp_large_data)[wp_data_16bit]; |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
287 else if(wp_font == 1) |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
288 wp_temp_U8 = ((rom unsigned char*)wp_medium_data)[wp_data_16bit]; |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
289 else |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
290 wp_temp_U8 = ((rom unsigned char*)wp_small_data)[wp_data_16bit]; |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
291 |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
292 wp_temp_U8 = 1 + (wp_temp_U8 & 127); |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
293 wp_string_width += wp_temp_U8; |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
294 } |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
295 } |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
296 |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
297 if(wp_font == 2) |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
298 wp_string_width /= WP_FONT_LARGE_HEIGHT; |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
299 else if(wp_font == 1) |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
300 wp_string_width /= WP_FONT_MEDIUM_HEIGHT; |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
301 else |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
302 wp_string_width /= WP_FONT_SMALL_HEIGHT; |
72 | 303 } |
304 | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
305 ////////////////////////////////////////////////////////////////////////////// |
72 | 306 |
307 void wp_set_window(void) | |
308 { | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
309 // Compute string width (in pixels) |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
310 wp_char_width(); |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
311 |
72 | 312 // x axis start ( 0 - 319) |
313 wp_command = 0x35; | |
314 wp_write_command(); | |
315 wp_data_16bit = ((unsigned int)wp_leftx2) << 1; | |
316 wp_write_data(); | |
317 // x axis end ( 0 - 319) | |
318 wp_command = 0x36; | |
319 wp_write_command(); | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
320 wp_data_16bit = wp_data_16bit + wp_string_width -1; |
72 | 321 wp_write_data(); |
322 // y axis start + end ( 0 - 239 ) | |
323 wp_command = 0x37; | |
324 wp_write_command(); | |
325 // the bottom part | |
326 wp_data_16bit = wp_top; | |
327 if(wp_font == 2) | |
328 wp_data_16bit += WP_FONT_LARGE_HEIGHT; | |
329 else if(wp_font == 1) | |
330 wp_data_16bit += WP_FONT_MEDIUM_HEIGHT; | |
331 else | |
332 wp_data_16bit += WP_FONT_SMALL_HEIGHT; | |
333 wp_data_16bit--; | |
334 if(wp_data_16bit > 239) | |
335 wp_data_16bit = 239; | |
336 // the top part | |
337 wp_data_16bit |= ((unsigned int)wp_top) << 8; | |
338 // all together in one 16bit transfer | |
339 wp_write_data(); | |
340 // start | |
341 wp_command = 0x20; | |
342 wp_write_command(); | |
343 wp_data_16bit = wp_top; | |
344 wp_write_data(); | |
345 wp_command = 0x21; | |
346 wp_write_command(); | |
347 wp_data_16bit = ((unsigned int)wp_leftx2) << 1; | |
348 wp_write_data(); | |
349 } | |
350 | |
351 void wp_set_char_font_small(void) | |
352 { | |
353 if(wp_char == ' ') | |
354 wp_char = '¶'; | |
355 if (wp_char > 0x7E) // skip space between ~ and ¡ | |
356 wp_char -= 34; | |
357 if((wp_char < '!') || (wp_char > 0xA3)) // font has 34 chars after ~ // ¾ + 4 chars limit to end of battery at the moment | |
358 wp_char = 0x82; // ¤ | |
359 wp_start = wp_small_table[wp_char - '!']; | |
360 wp_end = wp_small_table[1 + wp_char - '!']; | |
361 } | |
362 | |
363 void wp_set_char_font_medium(void) | |
364 { | |
365 // space is 3E | |
366 if (wp_char == 0x27) // 0x27 == ' | |
367 wp_char = 0x3B; | |
368 if (wp_char == '"') | |
369 wp_char = 0x3C; | |
370 if (wp_char == 'm') | |
371 wp_char = 0x3D; | |
372 if (wp_char == ' ') | |
373 wp_char = 0x3E; | |
374 if((wp_char < '.') || (wp_char > 0x3E)) | |
375 wp_char = 0x3E; | |
376 wp_start = wp_medium_table[wp_char - '.']; | |
377 wp_end = wp_medium_table[1 + wp_char - '.']; | |
378 } | |
379 void wp_set_char_font_large(void) | |
380 { | |
381 // space is / = 0x2F | |
382 if (wp_char == ' ') | |
383 wp_char = 0x2F; | |
384 if((wp_char < '.') || (wp_char > '9')) | |
385 wp_char = 0x2F; | |
386 wp_start = wp_large_table[wp_char - '.']; | |
387 wp_end = wp_large_table[1 + wp_char - '.']; | |
388 } | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
389 |
72 | 390 void wordprocessor(void) |
391 { | |
392 #define TOPLIMIT 230 | |
393 #define LEFTLIMIT 155 | |
394 | |
395 if(wp_top > TOPLIMIT) | |
396 wp_top = TOPLIMIT; | |
397 if(wp_leftx2 > LEFTLIMIT) | |
398 wp_leftx2 = LEFTLIMIT; | |
399 | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
400 // FIX C18 Bug: avoid crash if TBLPTRU was set somewhere... |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
401 // Should be called once before first PROM read, ie. font |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
402 // definition access... |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
403 _asm |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
404 clrf TBLPTRU, ACCESS |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
405 _endasm |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
406 |
72 | 407 wp_set_window(); |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
408 |
72 | 409 // access to GRAM |
410 wp_command = 0x22; | |
411 wp_write_command(); | |
412 _asm | |
413 bsf oled_rs | |
414 _endasm | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
415 |
72 | 416 wp_txtptr = 0; |
417 wp_char = wp_stringstore[wp_txtptr]; | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
418 |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
419 while( wp_char && (wp_txtptr < 26) ) |
72 | 420 { |
421 if(wp_font == 2) | |
422 wp_set_char_font_large(); | |
423 else if(wp_font == 1) | |
424 wp_set_char_font_medium(); | |
425 else | |
426 wp_set_char_font_small(); | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
427 |
72 | 428 for(wp_i = wp_start; wp_i<wp_end;wp_i++) |
429 { | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
430 wp_data_16bit = wp_i ^ 1; |
72 | 431 if(wp_font == 2) |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
432 wp_temp_U8 = ((rom unsigned char*)wp_large_data)[wp_data_16bit]; |
72 | 433 else if(wp_font == 1) |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
434 wp_temp_U8 = ((rom unsigned char*)wp_medium_data)[wp_data_16bit]; |
72 | 435 else |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
436 wp_temp_U8 = ((rom unsigned char*)wp_small_data)[wp_data_16bit]; |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
437 |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
438 // Manage to get color (or black) into data_16: |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
439 if( wp_invert ) wp_temp_U8 ^= 128; |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
440 if( wp_temp_U8 & 128 ) |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
441 wp_data_16bit = 0; |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
442 else |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
443 wp_data_16bit = wp_color; |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
444 |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
445 // Then send that to screen |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
446 wp_temp_U8 = 1 + (wp_temp_U8 & 127); |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
447 while(wp_temp_U8-- > 0) |
72 | 448 { |
449 _asm | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
450 // wp selected color |
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
451 movff wp_data_16bit+1,PORTD // OLED is big endian. PIC is not. |
72 | 452 bcf oled_rw |
453 bsf oled_rw | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
454 movff wp_data_16bit+0,PORTD |
72 | 455 bcf oled_rw |
456 bsf oled_rw | |
457 _endasm | |
458 } | |
459 } | |
82
bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents:
72
diff
changeset
|
460 |
72 | 461 wp_txtptr++; |
462 wp_char = wp_stringstore[wp_txtptr]; | |
463 } | |
464 wp_command = 0x00; | |
465 wp_write_command(); | |
466 } |