Mercurial > public > hwos_code
annotate src/strings.asm @ 533:dfac393b2199
CHANGE: CCR Calibration gas range limited to O2% 21-25 and 95-100 to save button presses
Layout adjustsments in divemode (CCR ppO2(Dil)
author | heinrichsweikamp |
---|---|
date | Mon, 21 Aug 2017 14:55:36 +0200 |
parents | aadfe9f2edaf |
children | b7eb98dbd800 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
3 ; File strings.asm | |
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 |
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 | |
112 movff opt_language,WREG ; Get lang | |
448 | 113 bz text_get_lang1 ; 0 == English |
0 | 114 dcfsnz WREG ; 1 == German |
448 | 115 bra text_get_lang2 |
116 ; Other ??? Keep language 1 | |
0 | 117 |
118 ; Read 2-byte pointer to string | |
448 | 119 text_get_lang1: |
0 | 120 tblrd*+ |
121 movff TABLAT,WREG | |
122 tblrd*+ | |
123 movff WREG,TBLPTRL | |
124 movff TABLAT,TBLPTRH | |
125 return | |
126 | |
127 ; Add correction for German table: | |
448 | 128 text_get_lang2: |
129 extern text_2_base | |
130 movlw LOW(text_2_base) | |
0 | 131 addwf TBLPTRL |
448 | 132 movlw HIGH(text_2_base) |
0 | 133 addwfc TBLPTRH |
448 | 134 movlw UPPER(text_2_base) |
0 | 135 addwfc TBLPTRU |
136 | |
448 | 137 movlw LOW(text_1_base) |
0 | 138 subwf TBLPTRL |
448 | 139 movlw HIGH(text_1_base) |
0 | 140 subwfb TBLPTRH |
448 | 141 movlw UPPER(text_1_base) |
0 | 142 subwfb TBLPTRU |
448 | 143 bra text_get_lang1 |
0 | 144 |
145 ;============================================================================= | |
146 ; Copy a null-terminated string from TBLPTR to buffer. | |
147 ; | |
148 ; Input: TBLPTR : string pointer into PROM. | |
149 ; Output: string in buffer, FSR2 pointer on the closing null byte. | |
150 ; | |
151 global strcpy_prom | |
152 strcpy_prom: | |
153 lfsr FSR2,buffer | |
154 | |
155 ; Append a null-terminated string from TBLPTR to buffer. | |
156 ; | |
157 ; Input: TBLPTR : string pointer into PROM. | |
158 ; FRS2 : current character position. | |
159 ; Output: string in buffer, FSR2 pointer on the closing null byte. | |
160 ; | |
161 global strcat_prom | |
162 strcat_prom: | |
163 tblrd*+ | |
164 movf TABLAT,W | |
165 movwf POSTINC2 | |
166 bnz strcat_prom | |
167 movf POSTDEC2,W ; rewind one char in string buffer. | |
168 return | |
169 | |
170 ;============================================================================= | |
171 ; Variant that calls word processor right-away... | |
172 global strcpy_prom_print | |
173 global strcat_prom_print | |
174 | |
175 strcpy_prom_print: | |
176 lfsr FSR2,buffer | |
177 strcat_prom_print: | |
178 rcall strcat_prom | |
179 goto aa_wordprocessor | |
180 | |
181 ;============================================================================= | |
182 | |
183 global start_tiny_block | |
184 start_tiny_block: | |
185 clrf WREG | |
186 movff WREG, win_font ; Need a bank-safe move here ! | |
187 bra start_common | |
188 | |
189 global start_small_block | |
190 start_small_block: | |
191 movlw 1 | |
192 movff WREG, win_font ; Need a bank-safe move here ! | |
193 bra start_common | |
194 | |
195 global start_std_block | |
196 start_std_block: | |
197 movlw 2 | |
198 movff WREG, win_font ; Need a bank-safe move here ! | |
199 bra start_common | |
200 | |
201 global start_medium_block | |
202 start_medium_block: | |
203 movlw 3 | |
204 movff WREG, win_font ; Need a bank-safe move here ! | |
205 bra start_common | |
206 | |
207 global start_large_block | |
208 start_large_block: | |
209 movlw 4 | |
210 movff WREG, win_font ; Need a bank-safe move here ! | |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
124
diff
changeset
|
211 ; bra start_common |
0 | 212 start_common: |
213 VARARGS_BEGIN | |
214 VARARGS_GET8 win_leftx2 | |
215 VARARGS_GET8 win_top | |
216 VARARGS_END | |
124 | 217 lfsr FSR2,buffer ; point to buffer here |
0 | 218 return |
219 | |
220 END |