Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/strings.asm @ 295:1a15d75702f7
Menu3 marker bugfix
author | Heinrichsweikamp |
---|---|
date | Thu, 28 Apr 2011 18:14:02 +0200 |
parents | cdba979821ee |
children | 6e456a6398e0 |
rev | line source |
---|---|
97 | 1 ;============================================================================= |
2 ; | |
3 ; File strings.asm | |
4 ; | |
5 ; Implementation code various string functions. | |
6 ; | |
7 ; This program is free software: you can redistribute it and/or modify | |
8 ; it under the terms of the GNU General Public License as published by | |
9 ; the Free Software Foundation, either version 3 of the License, or | |
10 ; (at your option) any later version. | |
11 ; | |
12 ; This program is distributed in the hope that it will be useful, | |
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 ; GNU General Public License for more details. | |
16 ; | |
17 ; You should have received a copy of the GNU General Public License | |
18 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 ; | |
20 ; Copyright (c) 2010, JD Gascuel. | |
21 ;============================================================================= | |
22 ; HISTORY | |
23 ; 2010-12-02 : [jDG] Creation... | |
24 ; | |
25 ; See strings.inc for doc and public calling macros. | |
26 | |
27 VARARGS_BEGIN macro | |
28 movff TOSL, TBLPTRL | |
29 movff TOSH, TBLPTRH | |
30 movff TOSU, TBLPTRU | |
31 endm | |
32 | |
33 VARARGS_GET8 macro register | |
34 tblrd*+ | |
35 movff TABLAT, register | |
36 endm | |
37 | |
38 VARARGS_GET16 macro register | |
39 tblrd*+ | |
40 movff TABLAT, register+0 | |
41 tblrd*+ | |
42 movff TABLAT, register+1 | |
43 endm | |
44 | |
45 VARARGS_ALIGN macro | |
46 btfss TBLPTRL,0 | |
47 local no_tblptr_align | |
48 bra no_tblptr_align | |
49 incf TBLPTRL | |
50 movlw 0 | |
51 addwfc TBLPTRH | |
52 no_tblptr_align: | |
53 endm | |
54 | |
55 VARARGS_END macro | |
56 ; Compute string length (modulo 256): | |
57 movf TOSL,W | |
58 subwf TBLPTRL,W | |
59 | |
60 ; Then 24bit add to return address | |
61 addwf TOSL,F | |
62 movlw 0 ; Clear WREG, but keep carry | |
63 addwfc TOSH,F | |
64 addwfc TOSU,F | |
65 endm | |
66 | |
67 ;============================================================================= | |
68 ; Variants that call word_processor at the end: | |
69 strcpy_block_print: | |
70 lfsr FSR2, letter | |
71 strcat_block_print: | |
72 clrf PRODL,A | |
73 bra strings_common | |
74 | |
75 ; Variants that do not call word_processor at end: | |
76 strcpy_block: | |
77 lfsr FSR2, letter | |
78 strcat_block: | |
79 setf PRODL,A | |
80 | |
81 ; Common part: append the string from PROM return address: | |
82 strings_common: | |
83 VARARGS_BEGIN | |
84 | |
85 strcpy_loop: | |
86 tblrd*+ | |
87 movf TABLAT,W | |
88 movwf POSTINC2 | |
89 bnz strcpy_loop | |
90 movf POSTDEC2,W ; rewind one char in string buffer. | |
91 | |
92 VARARGS_ALIGN | |
93 VARARGS_END | |
94 | |
95 btfsc PRODL,0,A ; Should we print afterward ? | |
96 return ; NO: then return straight away. | |
97 goto word_processor ; ELSE: print it... | |
98 | |
99 ;============================================================================= | |
100 | |
101 start_small_block: | |
102 clrf WREG,A | |
103 movff WREG, win_font ; Need a bank-safe move here ! | |
104 movff WREG, win_invert | |
105 bra start_common | |
106 | |
107 start_small_invert_block: | |
108 clrf WREG,A | |
109 movff WREG, win_font ; Need a bank-safe move here ! | |
110 setf WREG,A | |
111 movff WREG, win_invert | |
112 bra start_common | |
113 | |
114 start_medium_block: | |
115 movlw 1 | |
116 movff WREG, win_font ; Need a bank-safe move here ! | |
117 clrf WREG,A | |
118 movff WREG, win_invert | |
119 bra start_common | |
120 | |
121 start_medium_invert_block: | |
122 movlw 1 | |
123 movff WREG, win_font ; Need a bank-safe move here ! | |
124 movff WREG, win_invert | |
125 bra start_common | |
126 | |
127 start_large_block: | |
128 movlw 2 | |
129 movff WREG, win_font ; Need a bank-safe move here ! | |
130 clrf WREG,A | |
131 movff WREG, win_invert | |
132 bra start_common | |
133 | |
134 start_large_invert_block: | |
135 movlw 2 | |
136 movff WREG, win_font ; Need a bank-safe move here ! | |
137 movlw 1 | |
138 movff WREG, win_invert | |
139 bra start_common | |
140 | |
141 start_common: | |
142 VARARGS_BEGIN | |
143 VARARGS_GET8 win_leftx2 | |
144 VARARGS_GET8 win_top | |
145 VARARGS_END | |
146 return | |
123 | 147 |
148 ;============================================================================= | |
149 | |
150 box_std_block: ; Use standard color (CF#35) | |
151 call PLED_standard_color | |
152 bra box_common | |
153 box_color_block: ; Use color from WREG | |
154 call PLED_set_color | |
155 bra box_common | |
156 box_black_block: ; Use black color | |
157 clrf WREG | |
158 movff WREG,win_color1 ; Bank-safe addressing. | |
159 movff WREG,win_color2 | |
160 box_common: | |
161 VARARGS_BEGIN | |
162 VARARGS_GET8 win_top | |
163 VARARGS_GET8 win_height | |
164 VARARGS_GET8 win_leftx2 | |
165 VARARGS_GET8 win_width | |
166 VARARGS_END | |
167 goto PLED_box | |
168 | |
169 box_frame_std: | |
170 call PLED_standard_color | |
209
cdba979821ee
frame around logbook scale, some more speed improvements
heinrichsweikamp
parents:
123
diff
changeset
|
171 |
cdba979821ee
frame around logbook scale, some more speed improvements
heinrichsweikamp
parents:
123
diff
changeset
|
172 box_frame_common: |
123 | 173 VARARGS_BEGIN |
174 VARARGS_GET8 win_top | |
175 VARARGS_GET8 win_height | |
176 VARARGS_GET8 win_leftx2 | |
177 VARARGS_GET8 win_width | |
178 VARARGS_END | |
179 goto PLED_frame | |
209
cdba979821ee
frame around logbook scale, some more speed improvements
heinrichsweikamp
parents:
123
diff
changeset
|
180 |
cdba979821ee
frame around logbook scale, some more speed improvements
heinrichsweikamp
parents:
123
diff
changeset
|
181 box_frame_color: |
cdba979821ee
frame around logbook scale, some more speed improvements
heinrichsweikamp
parents:
123
diff
changeset
|
182 call PLED_set_color |
cdba979821ee
frame around logbook scale, some more speed improvements
heinrichsweikamp
parents:
123
diff
changeset
|
183 bra box_frame_common |