Mercurial > public > hwos_code
comparison src/strings.asm @ 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 strings.asm V2.99c | 3 ; File strings.asm combined next generation V3.03.1 |
4 ; | 4 ; |
5 ; Implementation code various string functions. | 5 ; Implementation code various string functions. |
6 ; | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. |
8 ;============================================================================= | 8 ;============================================================================= |
14 #include "hwos.inc" | 14 #include "hwos.inc" |
15 #include "varargs.inc" | 15 #include "varargs.inc" |
16 | 16 |
17 extern aa_wordprocessor | 17 extern aa_wordprocessor |
18 | 18 |
19 strings CODE | 19 strings CODE |
20 | 20 |
21 ;============================================================================= | 21 ;============================================================================= |
22 | |
22 ; Variants that call word_processor at the end | 23 ; Variants that call word_processor at the end |
23 | |
24 global strcpy_block_print | 24 global strcpy_block_print |
25 global strcat_block_print | |
25 strcpy_block_print: | 26 strcpy_block_print: |
26 lfsr FSR2,buffer | 27 lfsr FSR2,buffer |
27 global strcat_block_print | |
28 strcat_block_print: | 28 strcat_block_print: |
29 clrf PRODL,A | 29 bsf aa_aux_flag ; print afterwards |
30 bra strings_common | 30 bra strings_common |
31 | 31 |
32 | |
33 ; Variants that do not call word_processor at end | 32 ; Variants that do not call word_processor at end |
34 | |
35 global strcpy_block | 33 global strcpy_block |
34 global strcat_block | |
36 strcpy_block: | 35 strcpy_block: |
37 lfsr FSR2,buffer | 36 lfsr FSR2,buffer |
38 global strcat_block | |
39 strcat_block: | 37 strcat_block: |
40 setf PRODL,A | 38 bcf aa_aux_flag ; do not print afterwards |
41 | 39 ;bra strings_common |
42 | 40 |
43 ; Common part: append the string from PROM return address | 41 ; Common part: append the string from PROM return address |
44 | |
45 strings_common: | 42 strings_common: |
46 VARARGS_BEGIN | 43 VARARGS_BEGIN |
47 rcall strcat_prom | 44 rcall strcat_prom |
48 VARARGS_ALIGN | 45 VARARGS_ALIGN |
49 VARARGS_END | 46 VARARGS_END |
50 | 47 |
51 btfsc PRODL,0,A ; ahall we print afterwards? | 48 btfss aa_aux_flag ; shall we print? |
52 return ; NO - then return straight away | 49 return ; NO - then return straight away |
53 goto aa_wordprocessor ; YES - print it... | 50 goto aa_wordprocessor ; YES - print it... |
51 | |
54 | 52 |
55 ;============================================================================= | 53 ;============================================================================= |
56 ; Copy multi-lingual text from FSR1 12 bit pointer to buffer | 54 ; Copy multi-lingual text from FSR1 12 bit pointer to buffer |
57 ; | 55 ; |
58 ; Input: FSR1 = 12 bit pointer to multi-lingual text | 56 ; Input: FSR1 = 12 bit pointer to multi-lingual text |
75 rcall text_get_tblptr | 73 rcall text_get_tblptr |
76 bra strcpy_prom_print | 74 bra strcpy_prom_print |
77 | 75 |
78 ; Append multi-lingual text from FSR1 12 bit pointers to buffer at FRS2 | 76 ; Append multi-lingual text from FSR1 12 bit pointers to buffer at FRS2 |
79 ; | 77 ; |
80 ; Input: FSR1 = 12 bit pointer to multi-lingual text | 78 ; Input: FSR1 = 12 bit pointer to multi-lingual text |
81 ; FSR2 = current position in buffer | 79 ; FSR2 = current position in buffer |
82 ; Output: FSR2 pointing to closing null byte in buffer | 80 ; Output: FSR2 pointing to closing null byte in buffer |
83 ; Trashed: TBLPTR, TABLAT | 81 ; Trashed: TBLPTR, TABLAT |
84 | 82 |
85 global strcat_text | 83 global strcat_text |
86 strcat_text: | 84 strcat_text: |
87 rcall text_get_tblptr | 85 rcall text_get_tblptr |
95 ; Trashed: TBLPTR, TABLAT | 93 ; Trashed: TBLPTR, TABLAT |
96 | 94 |
97 global strcat_text_print | 95 global strcat_text_print |
98 strcat_text_print: | 96 strcat_text_print: |
99 rcall text_get_tblptr | 97 rcall text_get_tblptr |
100 bra strcat_prom_print | 98 bra strcat_prom_print |
101 | 99 |
102 ;============================================================================= | 100 ;============================================================================= |
103 ; Get pointer to multilingual text in TBLPTR | 101 ; Get pointer to multilingual text in TBLPTR |
104 ; | 102 ; |
105 ; Input: FSR1 = 12 bit text handle | 103 ; Input: FSR1 = 12 bit text handle |
106 ; opt_language = current language | 104 ; opt_language = current language |
107 ; Output: TBLPTR = 24 bit PROM address | 105 ; Output: TBLPTR = 24 bit PROM address |
108 | 106 |
109 global text_get_tblptr | 107 global text_get_tblptr |
110 text_get_tblptr: | 108 text_get_tblptr: |
111 extern text_1_base | 109 extern text_1_base |
112 movlw UPPER(text_1_base) ; complete 12 bit address to 24 bit address | 110 movlw UPPER(text_1_base) ; complete 12 bit address to 24 bit address |
152 ENDIF | 150 ENDIF |
153 | 151 |
154 ;============================================================================= | 152 ;============================================================================= |
155 ; Copy a null-terminated string from TBLPTR to buffer | 153 ; Copy a null-terminated string from TBLPTR to buffer |
156 ; | 154 ; |
157 ; Input: TBLPTR : string pointer into PROM | 155 ; Input: TBLPTR : string pointer into PROM |
158 ; Output: string in buffer, FSR2 pointing to the closing null byte | 156 ; Output: string in buffer, FSR2 pointing to the closing null byte |
159 ; | 157 ; |
160 global strcpy_prom | 158 global strcpy_prom |
161 strcpy_prom: | 159 strcpy_prom: |
162 lfsr FSR2,buffer | 160 lfsr FSR2,buffer |
163 ;bra strcat_prom | 161 ;bra strcat_prom |
164 | 162 |
165 ; Append a null-terminated string from TBLPTR to buffer | 163 ; Append a null-terminated string from TBLPTR to buffer |
166 ; | 164 ; |
167 ; Input: TBLPTR : string pointer into PROM | 165 ; Input: TBLPTR : string pointer into PROM |
168 ; FRS2 : current character position | 166 ; FRS2 : current character position |
169 ; Output: string in buffer, FSR2 pointing to the closing null byte | 167 ; Output: string in buffer, FSR2 pointing to the closing null byte |
170 ; | 168 ; |
171 global strcat_prom | 169 global strcat_prom |
172 strcat_prom: | 170 strcat_prom: |
173 tblrd*+ | 171 tblrd*+ ; read a character from PROM |
174 movf TABLAT,W | 172 movf TABLAT,W ; transfer character to WREG |
175 movwf POSTINC2 | 173 movwf POSTINC2 ; transfer character from WREG to output buffer and increment buffer pointer |
176 bnz strcat_prom | 174 bnz strcat_prom ; last character = NULL ? NO - loop |
177 movf POSTDEC2,W ; step back one char | 175 movf POSTDEC2,W ; YES - step back one char |
178 return | 176 return ; - done |
179 | 177 |
180 ;============================================================================= | 178 ;============================================================================= |
181 ; Variant that calls word processor right-away... | 179 ; Variant that calls word processor right-away... |
182 | 180 |
183 global strcpy_prom_print | 181 global strcpy_prom_print |
191 ;============================================================================= | 189 ;============================================================================= |
192 | 190 |
193 global start_tiny_block | 191 global start_tiny_block |
194 start_tiny_block: | 192 start_tiny_block: |
195 clrf WREG | 193 clrf WREG |
196 movff WREG, win_font ; needs a bank-safe move here ! | |
197 bra start_common | 194 bra start_common |
198 | 195 |
199 global start_small_block | 196 global start_small_block |
200 start_small_block: | 197 start_small_block: |
201 movlw 1 | 198 movlw 1 |
202 movff WREG, win_font ; needs a bank-safe move here ! | |
203 bra start_common | 199 bra start_common |
204 | 200 |
205 global start_std_block | 201 global start_std_block |
206 start_std_block: | 202 start_std_block: |
207 movlw 2 | 203 movlw 2 |
208 movff WREG, win_font ; needs a bank-safe move here ! | |
209 bra start_common | 204 bra start_common |
210 | 205 |
211 global start_medium_block | 206 global start_medium_block |
212 start_medium_block: | 207 start_medium_block: |
213 movlw 3 | 208 movlw 3 |
214 movff WREG, win_font ; needs a bank-safe move here ! | |
215 bra start_common | 209 bra start_common |
216 | 210 |
217 global start_large_block | 211 global start_large_block |
218 start_large_block: | 212 start_large_block: |
219 movlw 4 | 213 movlw 4 |
220 movff WREG, win_font ; needs a bank-safe move here ! | 214 bra start_common |
221 ;bra start_common | 215 |
216 IFDEF _huge_font | |
217 global start_huge_block | |
218 start_huge_block: | |
219 movlw 5 | |
220 ;bra start_block_common | |
221 ENDIF | |
222 | 222 |
223 start_common: | 223 start_common: |
224 movff WREG,win_font ; needs a bank-safe move here ! | |
225 | |
224 VARARGS_BEGIN | 226 VARARGS_BEGIN |
225 VARARGS_GET8 win_leftx2 | 227 VARARGS_GET8 win_leftx2 |
226 VARARGS_GET8 win_top | 228 VARARGS_GET8 win_top |
227 VARARGS_END | 229 VARARGS_END |
228 lfsr FSR2,buffer ; point to buffer | 230 lfsr FSR2,buffer ; point to buffer |