annotate code_part1/OSTC_code_asm_part1/strings.asm @ 782:6f54104ea0ee

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