Mercurial > public > hwos_code
annotate src/strings.asm @ 603:00b24fb4324d
second method to detect a full charge
author | heinrichsweikamp |
---|---|
date | Thu, 11 Oct 2018 21:06:29 +0200 |
parents | b7eb98dbd800 |
children | ca4556fb60b9 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
560 | 3 ; File strings.asm Version 2.92 = 2.26 |
0 | 4 ; |
5 ; Implementation code various string functions. | |
6 ; | |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2010-12-02 : [jDG] Creation... | |
11 ; | |
12 ; See strings.inc for doc and public calling macros. | |
13 | |
275 | 14 #include "hwos.inc" |
0 | 15 #include "varargs.inc" |
16 | |
17 extern aa_wordprocessor | |
18 | |
19 basic CODE | |
20 ;============================================================================= | |
21 ; Variants that call word_processor at the end: | |
22 global strcpy_block_print | |
23 strcpy_block_print: | |
24 lfsr FSR2, buffer | |
25 global strcat_block_print | |
26 strcat_block_print: | |
27 clrf PRODL,A | |
28 bra strings_common | |
29 | |
30 ; Variants that do not call word_processor at end: | |
31 global strcpy_block | |
32 strcpy_block: | |
33 lfsr FSR2, buffer | |
34 global strcat_block | |
35 strcat_block: | |
36 setf PRODL,A | |
37 | |
38 ; Common part: append the string from PROM return address: | |
39 strings_common: | |
40 VARARGS_BEGIN | |
41 | |
42 rcall strcat_prom | |
43 | |
44 VARARGS_ALIGN | |
45 VARARGS_END | |
46 | |
47 btfsc PRODL,0,A ; Should we print afterward ? | |
48 return ; NO: then return straight away. | |
49 goto aa_wordprocessor ; ELSE: print it... | |
50 | |
51 ;============================================================================= | |
52 ; Copy multi-lingual text from FSR1 12bit pointers, to buffer. | |
53 ; | |
54 ; Input: FSR1 = 12bit pointer to multi-lingual text. | |
55 ; Output: FSR2 points to closing null byte in buffer. | |
56 ; Trashed: TBLPTR, TABLAT. | |
57 global strcpy_text | |
58 strcpy_text: | |
59 rcall text_get_tblptr | |
60 bra strcpy_prom | |
61 | |
62 ; Copy then print multi-lingual text from FSR1 12bit pointers, to buffer. | |
63 ; | |
64 ; Input: FSR1 = 12bit pointer to multi-lingual text. | |
65 ; Output: FSR2 points to closing null byte in buffer. | |
66 ; Trashed: TBLPTR, TABLAT. | |
67 global strcpy_text_print | |
68 strcpy_text_print: | |
69 rcall text_get_tblptr | |
70 bra strcpy_prom_print | |
71 | |
72 ; Append multi-lingual text from FSR1 12bit pointers, to buffer at FRS2. | |
73 ; | |
74 ; Input: FSR1 = 12bit pointer to multi-lingual text. | |
75 ; FSR2 = Current position in buffer. | |
76 ; Output: FSR2 points to closing null byte in buffer. | |
77 ; Trashed: TBLPTR, TABLAT. | |
78 global strcat_text | |
79 strcat_text: | |
80 rcall text_get_tblptr | |
81 bra strcat_prom | |
82 | |
83 ; Append then print multi-lingual text from FSR1 12bit pointers, to buffer at FRS2. | |
84 ; | |
85 ; Input: FSR1 = 12bit pointer to multi-lingual text. | |
86 ; FSR2 = Current position in buffer. | |
87 ; Output: FSR2 points to closing null byte in buffer. | |
88 ; Trashed: TBLPTR, TABLAT. | |
89 global strcat_text_print | |
90 strcat_text_print: | |
91 rcall text_get_tblptr | |
92 bra strcat_prom_print | |
93 | |
94 ;============================================================================= | |
95 ; Get pointer to multilingual texl in TBLPTR | |
96 ; | |
97 ; Input: FSR1 = 12bits of text handle. | |
98 ; opt_language = current language. | |
99 ; Output: TBLPTR = 24bits of PROM address. | |
100 ; | |
101 global text_get_tblptr | |
102 text_get_tblptr: | |
448 | 103 extern text_1_base |
560 | 104 movlw UPPER(text_1_base) ; Complete 12bits to 24bits address. |
0 | 105 movwf TBLPTRU |
448 | 106 movlw HIGH(text_1_base) |
0 | 107 andlw 0xF0 |
108 iorwf FSR1H,W | |
109 movwf TBLPTRH | |
110 movff FSR1L,TBLPTRL | |
111 | |
560 | 112 |
113 movff opt_language,WREG ; Get lang | |
114 bz text_get_lang1 ; 0 == English | |
115 dcfsnz WREG ; 1 == German | |
116 bra text_get_lang2 | |
448 | 117 ; Other ??? Keep language 1 |
0 | 118 |
119 ; Read 2-byte pointer to string | |
448 | 120 text_get_lang1: |
0 | 121 tblrd*+ |
122 movff TABLAT,WREG | |
123 tblrd*+ | |
124 movff WREG,TBLPTRL | |
125 movff TABLAT,TBLPTRH | |
126 return | |
127 | |
128 ; Add correction for German table: | |
448 | 129 text_get_lang2: |
560 | 130 extern text_2_base |
131 movlw LOW(text_2_base) | |
132 addwf TBLPTRL | |
133 movlw HIGH(text_2_base) | |
134 addwfc TBLPTRH | |
135 movlw UPPER(text_2_base) | |
136 addwfc TBLPTRU | |
0 | 137 |
560 | 138 movlw LOW(text_1_base) |
139 subwf TBLPTRL | |
140 movlw HIGH(text_1_base) | |
141 subwfb TBLPTRH | |
142 movlw UPPER(text_1_base) | |
143 subwfb TBLPTRU | |
144 bra text_get_lang1 | |
0 | 145 |
146 ;============================================================================= | |
147 ; Copy a null-terminated string from TBLPTR to buffer. | |
148 ; | |
149 ; Input: TBLPTR : string pointer into PROM. | |
150 ; Output: string in buffer, FSR2 pointer on the closing null byte. | |
151 ; | |
152 global strcpy_prom | |
153 strcpy_prom: | |
154 lfsr FSR2,buffer | |
155 | |
156 ; Append a null-terminated string from TBLPTR to buffer. | |
157 ; | |
158 ; Input: TBLPTR : string pointer into PROM. | |
159 ; FRS2 : current character position. | |
160 ; Output: string in buffer, FSR2 pointer on the closing null byte. | |
161 ; | |
162 global strcat_prom | |
163 strcat_prom: | |
164 tblrd*+ | |
165 movf TABLAT,W | |
166 movwf POSTINC2 | |
167 bnz strcat_prom | |
168 movf POSTDEC2,W ; rewind one char in string buffer. | |
169 return | |
170 | |
171 ;============================================================================= | |
172 ; Variant that calls word processor right-away... | |
173 global strcpy_prom_print | |
174 global strcat_prom_print | |
175 | |
176 strcpy_prom_print: | |
177 lfsr FSR2,buffer | |
178 strcat_prom_print: | |
179 rcall strcat_prom | |
180 goto aa_wordprocessor | |
181 | |
182 ;============================================================================= | |
183 | |
184 global start_tiny_block | |
185 start_tiny_block: | |
186 clrf WREG | |
187 bra start_common | |
188 | |
189 global start_small_block | |
190 start_small_block: | |
191 movlw 1 | |
192 bra start_common | |
193 | |
194 global start_std_block | |
195 start_std_block: | |
196 movlw 2 | |
197 bra start_common | |
198 | |
199 global start_medium_block | |
200 start_medium_block: | |
201 movlw 3 | |
202 bra start_common | |
203 | |
204 global start_large_block | |
205 start_large_block: | |
206 movlw 4 | |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
124
diff
changeset
|
207 ; bra start_common |
0 | 208 start_common: |
560 | 209 movff WREG, win_font ; Need a bank-safe move here ! |
0 | 210 VARARGS_BEGIN |
211 VARARGS_GET8 win_leftx2 | |
212 VARARGS_GET8 win_top | |
213 VARARGS_END | |
124 | 214 lfsr FSR2,buffer ; point to buffer here |
0 | 215 return |
216 | |
217 END |