annotate code_part1/OSTC_code_c_part2/p3_wordprocessor.c @ 103:fe195f766014

Codesize optimized valconv.asm
author JeanDo
date Tue, 14 Dec 2010 11:14:32 +0100
parents bc3092c41335
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
72
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
1 /*
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
2 * OSTC - diving computer code
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
3 * ===========================
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
4 * PART 3 : word processor
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
5 *
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
6 * p3_wordprocessor.c for OSTC Mk.2
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
7 * Created on: 17.09.2009
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
8 * Author: christian.w @ heinrichsweikamp.com
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
9 *
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
10 * #include "ostc28.drx.txt"
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
11 * #include "ostc28.tbl.txt"
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
12 * #include "ostc48.tbl.txt"
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
13 * #include "ostc48.drx.txt"
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
14 * #include "ostc90.drx.txt"
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
15 * #include "ostc90.tbl.txt"
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
16 */
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
17
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
18 // Copyright (C) 2009 HeinrichsWeikamp GbR
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
19
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
20 // This program is free software: you can redistribute it and/or modify
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
21 // it under the terms of the GNU General Public License as published by
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
22 // the Free Software Foundation, either version 3 of the License, or
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
23 // (at your option) any later version.
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
24
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
25 // This program is distributed in the hope that it will be useful,
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
26 // but WITHOUT ANY WARRANTY; without even the implied warranty of
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
27 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
28 // GNU General Public License for more details.
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
29
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
30 // You should have received a copy of the GNU General Public License
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
31 // along with this program. If not, see <http://www.gnu.org/licenses/>.
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
32
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
33
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
34 // *****************************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
35 // ** I N T R O D U C T I O N **
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
36 // *****************************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
37 //
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
38 // OSTC
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
39 //
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
40 // code:
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
41 //
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
42 // summary:
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
43 // display routines
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
44 // for the OSTC experimental project
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
45 // written by Christian Weikamp
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
46 // last revision __________
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
47 // comments added _________
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
48 //
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
49 // additional files:
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
50 // #include "ostc28.drx.txt"
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
51 // #include "ostc28.tbl.txt"
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
52 // #include "ostc48.tbl.txt"
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
53 // #include "ostc48.drx.txt"
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
54 // #include "ostc90.drx.txt"
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
55 // #include "ostc90.tbl.txt"
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
56 // assembler code (PART 1) for working OSTC experimental plattform
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
57 // C code (PART 2) for working OSTC experimental plattform
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
58 //
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
61
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
62
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
63 // *********************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
64 // ** I N C L U D E S **
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
65 // *********************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
66 #include <p18f4685.h>
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
67
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
68 // ********************************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
69 // ** C O N F I G U R A T I O N **
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
70 // ** for simulation without asm **
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
71 // ********************************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
72 #pragma config OSC = IRCIO67
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
73 #pragma config FCMEN = OFF
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
74 #pragma config IESO = OFF
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
75 #pragma config PWRT = ON
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
76 #pragma config BOREN = OFF
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
77 #pragma config WDT = OFF
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
78 #pragma config WDTPS = 128
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
79 #pragma config MCLRE = ON
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
80 #pragma config LPT1OSC = OFF
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
81 #pragma config PBADEN = OFF
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
82 #pragma config DEBUG = OFF
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
83 #pragma config XINST = OFF
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
84 #pragma config LVP = OFF
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
85 #pragma config STVREN = OFF
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
86
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
87 // ****************************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
88 // ** D E F I N E S **
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
89 // ** missing in p18f4685.h **
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
90 // ****************************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
91
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
92 #define WP_FONT_SMALL_HEIGHT 24
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
93 #define WP_FONT_MEDIUM_HEIGHT 32
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
94 #define WP_FONT_LARGE_HEIGHT 58
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
95 #define oled_rw PORTA,2,0
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
96 #define oled_rs PORTE,0,0
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
97
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
98 // ***********************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
99 // ** V A R I A B L E S **
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
100 // ***********************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
101
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
102 #pragma udata bank0a=0x060
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
103 // input
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
106 volatile unsigned char wp_top;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
107 volatile unsigned char wp_leftx2;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
108 volatile unsigned char wp_font;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
109 volatile unsigned char wp_invert;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
110 // internal
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
111 volatile unsigned char wp_temp_U8;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
112 volatile unsigned char wp_txtptr;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
113 volatile unsigned char wp_char;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
114 volatile unsigned char wp_command;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
115 volatile unsigned int wp_data_16bit;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
116 volatile unsigned int wp_start;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
117 volatile unsigned int wp_end;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
118 volatile unsigned int wp_i;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
119 volatile unsigned char wp_debug_U8;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
124
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
125 // *************************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
126 // ** P R O T O T Y P E S **
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
127 // *************************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
128 void main(void);
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
129
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
130 void main_calc_wordprocessor(void);
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
131
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
132 void wp_write_command(void);
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
133 void wp_write_data(void);
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
134 void wp_set_window(void);
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
135 void wp_set_char_font_small(void);
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
136 void wp_set_char_font_medium(void);
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
137 void wp_set_char_font_large(void);
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
138 void wordprocessor(void);
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
139
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
140 // *******************************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
141 // ** start **
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
142 // ** necessary for compilation **
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
143 // *******************************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
144 #pragma romdata der_code = 0x0000
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
145 #pragma code der_start = 0x0000
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
146 void der_start(void)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
147 {
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
148 _asm
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
149 goto main
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
150 _endasm
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
151 }
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
152
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
153 // ***********************************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
154 // ** main code for simulation / **
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
155 // ** tests without assembler code **
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
156 // ** is NOT a part of the OSTC **
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
157 // ***********************************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
158 #pragma code main = 0x9000
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
159 void main(void)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
160 {
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
161 wp_top = 10;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
164 wp_font = 0;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
165 wp_invert = 0;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
166 wp_stringstore[0] = ' ';
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
167 wp_stringstore[1] = '!';
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
168 wp_stringstore[2] = '"';
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
169 wp_stringstore[3] = ':';
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
170 wp_stringstore[4] = 0;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
171 wordprocessor();
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
172 }
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
173
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
174 // ******************************************************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
175 // ******************************************************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
176 // ** THE FOLLOWING CODE HAS TO BE COPPIED TO THE OSTC **
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
177 // ******************************************************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
178 // ******************************************************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
179 // ***************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
180 // ***************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
181 // ** THE FONTS **
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
182 // ***************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
183 // ***************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
184 // all new for bigscreen
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
185 #pragma romdata font_data_large = 0x09A00
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
186 rom const rom unsigned int wp_large_data[] =
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
187 {
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
188 #include "ostc90.drx.txt" // length 0x59A
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
189 };
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
190 #pragma romdata font_table_large = 0x09FA0
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
191 rom const rom unsigned int wp_large_table[] =
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
192 {
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
193 #include "ostc90.tbl.txt" // length 0x18
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
194 };
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
195 #pragma romdata font_table_medium = 0x0A000
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
196 rom const rom unsigned int wp_medium_table[] =
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
197 {
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
198 #include "ostc48.tbl.txt" // length 0x22
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
199 };
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
200 #pragma romdata font_data_medium = 0x0A024
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
201 rom const rom unsigned int wp_medium_data[] =
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
202 {
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
203 #include "ostc48.drx.txt" // length 0x374 // geht bis einschl. 0xA398
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
204 };
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
205 #pragma romdata font_table_small = 0x0A39A
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
206 rom const rom unsigned int wp_small_table[] =
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
207 {
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
208 #include "ostc28.tbl.txt" // length 0xE8
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
209 };
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
210 #pragma romdata font_data_small = 0x0A488
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
211 rom const rom unsigned int wp_small_data[] =
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
212 {
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
213 #include "ostc28.drx.txt"
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
214 };
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
215
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
216 // **********************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
217 // **********************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
218 // ** THE JUMP-IN CODE **
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
219 // ** for the asm code **
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
220 // **********************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
221 // **********************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
222 #pragma code main_wordprocessor = 0x0B468
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
223 void main_wordprocessor(void)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
228 }
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
229
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
230 // *********************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
231 // *********************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
232 // ** THE SUBROUTINES **
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
233 // *********************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
234 // *********************
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
235
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
236 #pragma code subroutines2 = 0x0B470 // can be adapted to fit the romdata tables ahead
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
237
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
238 // ------------
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
239 // write new //
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
240 // ------------
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
241
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
242 void wp_write_command(void)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
243 {
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
244 _asm
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
245 bcf oled_rs
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
246 movff wp_command,PORTD
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
247 bcf oled_rw
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
248 bsf oled_rw
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
249 _endasm
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
250 }
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
251
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
252 void wp_write_data(void)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
253 {
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
254 _asm
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
257 bcf oled_rw
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
260 bcf oled_rw
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
261 bsf oled_rw
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
262 _endasm
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
263 }
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
303 }
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
304
82
bc3092c41335 Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents: 72
diff changeset
305 //////////////////////////////////////////////////////////////////////////////
72
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
306
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
307 void wp_set_window(void)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
312 // x axis start ( 0 - 319)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
313 wp_command = 0x35;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
314 wp_write_command();
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
315 wp_data_16bit = ((unsigned int)wp_leftx2) << 1;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
316 wp_write_data();
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
317 // x axis end ( 0 - 319)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
318 wp_command = 0x36;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
321 wp_write_data();
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
322 // y axis start + end ( 0 - 239 )
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
323 wp_command = 0x37;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
324 wp_write_command();
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
325 // the bottom part
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
326 wp_data_16bit = wp_top;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
327 if(wp_font == 2)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
328 wp_data_16bit += WP_FONT_LARGE_HEIGHT;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
329 else if(wp_font == 1)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
330 wp_data_16bit += WP_FONT_MEDIUM_HEIGHT;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
331 else
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
332 wp_data_16bit += WP_FONT_SMALL_HEIGHT;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
333 wp_data_16bit--;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
334 if(wp_data_16bit > 239)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
335 wp_data_16bit = 239;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
336 // the top part
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
337 wp_data_16bit |= ((unsigned int)wp_top) << 8;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
338 // all together in one 16bit transfer
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
339 wp_write_data();
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
340 // start
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
341 wp_command = 0x20;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
342 wp_write_command();
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
343 wp_data_16bit = wp_top;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
344 wp_write_data();
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
345 wp_command = 0x21;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
346 wp_write_command();
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
347 wp_data_16bit = ((unsigned int)wp_leftx2) << 1;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
348 wp_write_data();
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
349 }
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
350
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
351 void wp_set_char_font_small(void)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
352 {
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
353 if(wp_char == ' ')
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
354 wp_char = '¶';
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
355 if (wp_char > 0x7E) // skip space between ~ and ¡
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
356 wp_char -= 34;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
357 if((wp_char < '!') || (wp_char > 0xA3)) // font has 34 chars after ~ // ¾ + 4 chars limit to end of battery at the moment
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
358 wp_char = 0x82; // ¤
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
359 wp_start = wp_small_table[wp_char - '!'];
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
360 wp_end = wp_small_table[1 + wp_char - '!'];
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
361 }
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
362
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
363 void wp_set_char_font_medium(void)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
364 {
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
365 // space is 3E
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
366 if (wp_char == 0x27) // 0x27 == '
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
367 wp_char = 0x3B;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
368 if (wp_char == '"')
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
369 wp_char = 0x3C;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
370 if (wp_char == 'm')
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
371 wp_char = 0x3D;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
372 if (wp_char == ' ')
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
373 wp_char = 0x3E;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
374 if((wp_char < '.') || (wp_char > 0x3E))
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
375 wp_char = 0x3E;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
376 wp_start = wp_medium_table[wp_char - '.'];
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
377 wp_end = wp_medium_table[1 + wp_char - '.'];
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
378 }
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
379 void wp_set_char_font_large(void)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
380 {
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
381 // space is / = 0x2F
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
382 if (wp_char == ' ')
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
383 wp_char = 0x2F;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
384 if((wp_char < '.') || (wp_char > '9'))
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
385 wp_char = 0x2F;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
386 wp_start = wp_large_table[wp_char - '.'];
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
387 wp_end = wp_large_table[1 + wp_char - '.'];
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
388 }
82
bc3092c41335 Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents: 72
diff changeset
389
72
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
390 void wordprocessor(void)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
391 {
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
392 #define TOPLIMIT 230
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
393 #define LEFTLIMIT 155
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
394
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
395 if(wp_top > TOPLIMIT)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
396 wp_top = TOPLIMIT;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
397 if(wp_leftx2 > LEFTLIMIT)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
398 wp_leftx2 = LEFTLIMIT;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
407 wp_set_window();
82
bc3092c41335 Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents: 72
diff changeset
408
72
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
409 // access to GRAM
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
410 wp_command = 0x22;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
411 wp_write_command();
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
412 _asm
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
413 bsf oled_rs
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
414 _endasm
82
bc3092c41335 Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents: 72
diff changeset
415
72
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
416 wp_txtptr = 0;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
420 {
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
421 if(wp_font == 2)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
422 wp_set_char_font_large();
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
423 else if(wp_font == 1)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
424 wp_set_char_font_medium();
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
425 else
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
426 wp_set_char_font_small();
82
bc3092c41335 Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents: 72
diff changeset
427
72
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
428 for(wp_i = wp_start; wp_i<wp_end;wp_i++)
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
448 {
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
452 bcf oled_rw
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
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
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
455 bcf oled_rw
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
456 bsf oled_rw
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
457 _endasm
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
458 }
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
459 }
82
bc3092c41335 Cleaning up old wordprocessor to make it OLEDSim compatible.
JeanDo
parents: 72
diff changeset
460
72
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
461 wp_txtptr++;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
462 wp_char = wp_stringstore[wp_txtptr];
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
463 }
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
464 wp_command = 0x00;
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
465 wp_write_command();
77f1556457b1 added missing source file
heinrichsweikamp
parents:
diff changeset
466 }