Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/strings.asm @ 815:2a0e5d884fc3
BUGFIX: Fix licence in German
BUGFIX: Fix minor layout bug in surface mode
author | heinrichsweikamp |
---|---|
date | Tue, 12 May 2015 11:30:35 +0200 |
parents | d68c6a6b1f38 |
children |
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) | |
681 | 151 call DISP_standard_color |
123 | 152 bra box_common |
153 box_color_block: ; Use color from WREG | |
681 | 154 call DISP_set_color |
123 | 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 | |
681 | 160 movff WREG,win_color3 |
706 | 161 movff WREG,win_color4 |
162 movff WREG,win_color5 | |
163 movff WREG,win_color6 | |
123 | 164 box_common: |
165 VARARGS_BEGIN | |
166 VARARGS_GET8 win_top | |
167 VARARGS_GET8 win_height | |
168 VARARGS_GET8 win_leftx2 | |
169 VARARGS_GET8 win_width | |
170 VARARGS_END | |
681 | 171 goto DISP_box |
123 | 172 |
173 box_frame_std: | |
681 | 174 call DISP_standard_color |
209
cdba979821ee
frame around logbook scale, some more speed improvements
heinrichsweikamp
parents:
123
diff
changeset
|
175 |
cdba979821ee
frame around logbook scale, some more speed improvements
heinrichsweikamp
parents:
123
diff
changeset
|
176 box_frame_common: |
123 | 177 VARARGS_BEGIN |
178 VARARGS_GET8 win_top | |
179 VARARGS_GET8 win_height | |
180 VARARGS_GET8 win_leftx2 | |
181 VARARGS_GET8 win_width | |
182 VARARGS_END | |
681 | 183 goto DISP_frame |
209
cdba979821ee
frame around logbook scale, some more speed improvements
heinrichsweikamp
parents:
123
diff
changeset
|
184 |
cdba979821ee
frame around logbook scale, some more speed improvements
heinrichsweikamp
parents:
123
diff
changeset
|
185 box_frame_color: |
681 | 186 call DISP_set_color |
209
cdba979821ee
frame around logbook scale, some more speed improvements
heinrichsweikamp
parents:
123
diff
changeset
|
187 bra box_frame_common |