annotate src/convert.asm @ 365:d0e3fa3ff2e2

minor
author heinrichsweikamp
date Wed, 12 Aug 2015 17:41:06 +0200
parents 5ad479f2a868
children a5fc007634c5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
heinrichsweikamp
parents:
diff changeset
3 ; File convert.asm
heinrichsweikamp
parents:
diff changeset
4 ;
heinrichsweikamp
parents:
diff changeset
5 ; Converts register values to string
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, Matthias Heinrichs, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
heinrichsweikamp
parents:
diff changeset
10 ; 2007-10-07 : [MH] Creation for OSTC sources
heinrichsweikamp
parents:
diff changeset
11 ; 2010-12-10 : [jDG] Optimize macro size
heinrichsweikamp
parents:
diff changeset
12 ;
heinrichsweikamp
parents:
diff changeset
13
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 225
diff changeset
14 #include "hwos.inc" ; Mandatory header
0
heinrichsweikamp
parents:
diff changeset
15
heinrichsweikamp
parents:
diff changeset
16 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
17
heinrichsweikamp
parents:
diff changeset
18 CBLOCK tmp+0x08 ; space for aa_wordprocessor
heinrichsweikamp
parents:
diff changeset
19 temp3
heinrichsweikamp
parents:
diff changeset
20 temp4
heinrichsweikamp
parents:
diff changeset
21 cvt_flags2
heinrichsweikamp
parents:
diff changeset
22 ; Reserved to tmp+0x10...
heinrichsweikamp
parents:
diff changeset
23 ENDC
heinrichsweikamp
parents:
diff changeset
24
heinrichsweikamp
parents:
diff changeset
25 #define pre_zero_flag cvt_flags2,0
heinrichsweikamp
parents:
diff changeset
26 #define all_zeros_flag cvt_flags2,1
heinrichsweikamp
parents:
diff changeset
27 #define DP_done cvt_flags2,2
heinrichsweikamp
parents:
diff changeset
28 #define DP_done2 cvt_flags2,3
heinrichsweikamp
parents:
diff changeset
29 #define show_last3 cvt_flags2,4
heinrichsweikamp
parents:
diff changeset
30 #define leading_zeros cvt_flags2,5
300
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
31 #define show_last4 cvt_flags2,6
0
heinrichsweikamp
parents:
diff changeset
32
heinrichsweikamp
parents:
diff changeset
33 basic CODE
heinrichsweikamp
parents:
diff changeset
34
heinrichsweikamp
parents:
diff changeset
35 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
36 global output99_call
heinrichsweikamp
parents:
diff changeset
37 output99_call:
heinrichsweikamp
parents:
diff changeset
38 clrf ignore_digits
heinrichsweikamp
parents:
diff changeset
39 incf ignore_digits,F
heinrichsweikamp
parents:
diff changeset
40 clrf temp4
heinrichsweikamp
parents:
diff changeset
41
heinrichsweikamp
parents:
diff changeset
42 global output99
heinrichsweikamp
parents:
diff changeset
43 output99:
heinrichsweikamp
parents:
diff changeset
44 movlw d'99'
heinrichsweikamp
parents:
diff changeset
45 cpfslt lo
heinrichsweikamp
parents:
diff changeset
46 movwf lo ; Limit to 99
heinrichsweikamp
parents:
diff changeset
47 movff lo,lo_temp
heinrichsweikamp
parents:
diff changeset
48 clrf hi_temp
heinrichsweikamp
parents:
diff changeset
49 bcf pre_zero_flag ; do not display leading zeros
heinrichsweikamp
parents:
diff changeset
50
heinrichsweikamp
parents:
diff changeset
51 LCD_val99_2:
heinrichsweikamp
parents:
diff changeset
52 movlw b'00001010' ; 10
heinrichsweikamp
parents:
diff changeset
53 movwf temp2
heinrichsweikamp
parents:
diff changeset
54 clrf temp3
heinrichsweikamp
parents:
diff changeset
55 rcall DEC2ASCII
heinrichsweikamp
parents:
diff changeset
56
heinrichsweikamp
parents:
diff changeset
57 movlw b'00000001' ; 1
heinrichsweikamp
parents:
diff changeset
58 movwf temp2
heinrichsweikamp
parents:
diff changeset
59 clrf temp3
heinrichsweikamp
parents:
diff changeset
60 bsf pre_zero_flag ; last figure, display zero (0)
heinrichsweikamp
parents:
diff changeset
61 rcall DEC2ASCII
heinrichsweikamp
parents:
diff changeset
62 RETURN
heinrichsweikamp
parents:
diff changeset
63
heinrichsweikamp
parents:
diff changeset
64 global output99x_call
heinrichsweikamp
parents:
diff changeset
65
heinrichsweikamp
parents:
diff changeset
66 output99x_call:
heinrichsweikamp
parents:
diff changeset
67 clrf ignore_digits
heinrichsweikamp
parents:
diff changeset
68 incf ignore_digits,F
heinrichsweikamp
parents:
diff changeset
69 clrf temp4
heinrichsweikamp
parents:
diff changeset
70
heinrichsweikamp
parents:
diff changeset
71 movlw d'99'
heinrichsweikamp
parents:
diff changeset
72 cpfslt lo
heinrichsweikamp
parents:
diff changeset
73 movwf lo ; Limit to 99
heinrichsweikamp
parents:
diff changeset
74 movff lo, lo_temp
heinrichsweikamp
parents:
diff changeset
75 clrf hi_temp
heinrichsweikamp
parents:
diff changeset
76 bsf pre_zero_flag ; display leading zeros
heinrichsweikamp
parents:
diff changeset
77 bra LCD_val99_2
heinrichsweikamp
parents:
diff changeset
78
heinrichsweikamp
parents:
diff changeset
79 global output8_call
heinrichsweikamp
parents:
diff changeset
80
heinrichsweikamp
parents:
diff changeset
81 output8_call:
heinrichsweikamp
parents:
diff changeset
82 clrf ignore_digits
heinrichsweikamp
parents:
diff changeset
83 incf ignore_digits,F
heinrichsweikamp
parents:
diff changeset
84 clrf temp4
heinrichsweikamp
parents:
diff changeset
85
heinrichsweikamp
parents:
diff changeset
86 output8:
heinrichsweikamp
parents:
diff changeset
87 movff lo, lo_temp
heinrichsweikamp
parents:
diff changeset
88 clrf hi_temp
heinrichsweikamp
parents:
diff changeset
89 bcf pre_zero_flag ; do not display leading zeros
heinrichsweikamp
parents:
diff changeset
90
heinrichsweikamp
parents:
diff changeset
91 movlw b'01100100' ; 100
heinrichsweikamp
parents:
diff changeset
92 movwf temp2
heinrichsweikamp
parents:
diff changeset
93 clrf temp3
heinrichsweikamp
parents:
diff changeset
94 rcall DEC2ASCII
heinrichsweikamp
parents:
diff changeset
95 bra LCD_val99_2
heinrichsweikamp
parents:
diff changeset
96
300
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
97 global output16_4_call
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
98 output16_4_call: ; limit to 9999
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
99 bsf show_last4
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
100 ; 9999 = 27 0F = [39][15]
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
101 movlw .40
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
102 cpfslt hi ; hi < 40 ?
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
103 bra output16_4_call_2 ; No, hi >= 40, do limit
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
104 ; Yes, hi <= 39
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
105 movlw .39
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
106 cpfseq hi ; hi = 39 ?
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
107 bra output16_4_call_3 ; No, hi < 39, no limit needed
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
108 ; Yes, hi = 39
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
109 movlw .15
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
110 cpfslt lo ; lo < 15
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
111 movwf lo ; No, lo >= 15, set lo = 15.
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
112 ; Yes, lo <= 14 or lo set to =15
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
113 bra output16_4_call_3 ; done.
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
114 output16_4_call_2: ; Set to 9999
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
115 movlw LOW .9999
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
116 movwf lo
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
117 movlw HIGH .9999
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
118 movwf hi
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
119 output16_4_call_3:
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
120 bra output16_call
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
121
0
heinrichsweikamp
parents:
diff changeset
122 global output16_3_call
heinrichsweikamp
parents:
diff changeset
123 global output16_call
heinrichsweikamp
parents:
diff changeset
124 global output16
225
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
125 output16_3_call: ; limit to 999
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
126 bsf show_last3
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
127 ; Limit to 3
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
128 movlw .4
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
129 cpfslt hi
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
130 bra output16_3_call_2
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
131 movlw .3
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
132 cpfseq hi ; =3?
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
133 bra output16_3_call_3 ; No, done.
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
134 movlw .231 ; Limit to 231(+768=999...)
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
135 cpfslt lo
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
136 movwf lo
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
137 bra output16_3_call_3 ; done.
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
138 output16_3_call_2: ; Set to .999
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
139 movlw LOW .999
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
140 movwf lo
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
141 movlw HIGH .999
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
142 movwf hi
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 0
diff changeset
143 output16_3_call_3:
0
heinrichsweikamp
parents:
diff changeset
144 output16_call:
heinrichsweikamp
parents:
diff changeset
145 clrf ignore_digits
heinrichsweikamp
parents:
diff changeset
146 incf ignore_digits,F
heinrichsweikamp
parents:
diff changeset
147 clrf WREG
heinrichsweikamp
parents:
diff changeset
148 output16:
heinrichsweikamp
parents:
diff changeset
149 movwf temp4 ; Passed from output16dp macro, cleared by others.
heinrichsweikamp
parents:
diff changeset
150
heinrichsweikamp
parents:
diff changeset
151 bcf all_zeros_flag ; do not display any zero from here unless there was at least one figure /zero
heinrichsweikamp
parents:
diff changeset
152
heinrichsweikamp
parents:
diff changeset
153 bsf leading_zeros
heinrichsweikamp
parents:
diff changeset
154 tstfsz temp4 ; Display leading zeros at all?
heinrichsweikamp
parents:
diff changeset
155 bcf leading_zeros
heinrichsweikamp
parents:
diff changeset
156
heinrichsweikamp
parents:
diff changeset
157 bsf DP_done2
heinrichsweikamp
parents:
diff changeset
158 tstfsz temp4
heinrichsweikamp
parents:
diff changeset
159 bcf DP_done2 ; decimal point not yet set
heinrichsweikamp
parents:
diff changeset
160
heinrichsweikamp
parents:
diff changeset
161 movff lo, lo_temp
heinrichsweikamp
parents:
diff changeset
162 movff hi, hi_temp
heinrichsweikamp
parents:
diff changeset
163 bcf pre_zero_flag ; do not display leading zeros
heinrichsweikamp
parents:
diff changeset
164
heinrichsweikamp
parents:
diff changeset
165 movlw b'00010000' ; 10000s
heinrichsweikamp
parents:
diff changeset
166 movwf temp2
heinrichsweikamp
parents:
diff changeset
167 movlw b'00100111'
heinrichsweikamp
parents:
diff changeset
168 movwf temp3
300
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
169 btfsc show_last3 ; display only last three figures?
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
170 bra output16_sk5
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
171 btfsc show_last4 ; display only last four figures?
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
172 bra output16_sk5
0
heinrichsweikamp
parents:
diff changeset
173 rcall DEC2ASCII ; No, show all. Here: 5th order digit
300
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
174
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
175 output16_sk5:
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
176 bcf show_last4
0
heinrichsweikamp
parents:
diff changeset
177 movlw b'11101000' ; 1000s
heinrichsweikamp
parents:
diff changeset
178 movwf temp2
heinrichsweikamp
parents:
diff changeset
179 movlw b'00000011'
heinrichsweikamp
parents:
diff changeset
180 movwf temp3
heinrichsweikamp
parents:
diff changeset
181 btfsc DP_done2 ; Is there a decimal point at all?
heinrichsweikamp
parents:
diff changeset
182 bra output16_2 ; no, use normal display mode
heinrichsweikamp
parents:
diff changeset
183
heinrichsweikamp
parents:
diff changeset
184 btfsc all_zeros_flag ; display any zero from here
heinrichsweikamp
parents:
diff changeset
185 bra output16_1 ; there was a figure /zero already
heinrichsweikamp
parents:
diff changeset
186
heinrichsweikamp
parents:
diff changeset
187 bsf pre_zero_flag ; display figure if zero?
heinrichsweikamp
parents:
diff changeset
188 decfsz temp4,W
heinrichsweikamp
parents:
diff changeset
189 bcf pre_zero_flag ; No
heinrichsweikamp
parents:
diff changeset
190
heinrichsweikamp
parents:
diff changeset
191 output16_1:
heinrichsweikamp
parents:
diff changeset
192 btfsc DP_done ; Decimal point set already?
heinrichsweikamp
parents:
diff changeset
193 bsf pre_zero_flag ; Yes, so display the rest
heinrichsweikamp
parents:
diff changeset
194 output16_2:
heinrichsweikamp
parents:
diff changeset
195 btfss show_last3 ; display only last three figures?
heinrichsweikamp
parents:
diff changeset
196 rcall DEC2ASCII ; No, show all. Here: 4th order digit
heinrichsweikamp
parents:
diff changeset
197 bcf show_last3 ; Yes, so display the rest
heinrichsweikamp
parents:
diff changeset
198
heinrichsweikamp
parents:
diff changeset
199 movlw b'01100100' ; 100s
heinrichsweikamp
parents:
diff changeset
200 movwf temp2
heinrichsweikamp
parents:
diff changeset
201 clrf temp3
heinrichsweikamp
parents:
diff changeset
202
heinrichsweikamp
parents:
diff changeset
203 btfsc ignore_digit3 ; Ignore 3rd-5th digit?
heinrichsweikamp
parents:
diff changeset
204 bra output16_5 ; Yes, skip the rest
heinrichsweikamp
parents:
diff changeset
205
heinrichsweikamp
parents:
diff changeset
206 btfsc DP_done2 ; Is there a decimal point at all?
heinrichsweikamp
parents:
diff changeset
207 bra output16_3 ; no, use normal display mode
heinrichsweikamp
parents:
diff changeset
208
heinrichsweikamp
parents:
diff changeset
209 btfsc all_zeros_flag ; display any zero from here
heinrichsweikamp
parents:
diff changeset
210 bra output16_2_1 ; there was a figure /zero already
heinrichsweikamp
parents:
diff changeset
211
heinrichsweikamp
parents:
diff changeset
212 bsf pre_zero_flag ; display figure if zero?
heinrichsweikamp
parents:
diff changeset
213 decfsz temp4,W
heinrichsweikamp
parents:
diff changeset
214 bcf pre_zero_flag ; No
heinrichsweikamp
parents:
diff changeset
215
heinrichsweikamp
parents:
diff changeset
216 output16_2_1:
heinrichsweikamp
parents:
diff changeset
217 btfsc DP_done ; Decimal point set already?
heinrichsweikamp
parents:
diff changeset
218 bsf pre_zero_flag ; Yes, so display the rest
heinrichsweikamp
parents:
diff changeset
219 btfsc DP_done2 ; Is there a decimal point at all?
heinrichsweikamp
parents:
diff changeset
220 bsf pre_zero_flag ; No, so display the rest
heinrichsweikamp
parents:
diff changeset
221 output16_3:
heinrichsweikamp
parents:
diff changeset
222 rcall DEC2ASCII ;3th order digit...
heinrichsweikamp
parents:
diff changeset
223
heinrichsweikamp
parents:
diff changeset
224 movlw b'00001010' ; 10s
heinrichsweikamp
parents:
diff changeset
225 movwf temp2
heinrichsweikamp
parents:
diff changeset
226 clrf temp3
heinrichsweikamp
parents:
diff changeset
227 btfsc DP_done2
heinrichsweikamp
parents:
diff changeset
228 bra output16_4
heinrichsweikamp
parents:
diff changeset
229
heinrichsweikamp
parents:
diff changeset
230 btfsc all_zeros_flag ; display any zero from here
heinrichsweikamp
parents:
diff changeset
231 bra output16_3_1 ; there was a figure /zero already
heinrichsweikamp
parents:
diff changeset
232
heinrichsweikamp
parents:
diff changeset
233 bsf pre_zero_flag
heinrichsweikamp
parents:
diff changeset
234 decfsz temp4,W
heinrichsweikamp
parents:
diff changeset
235 bcf pre_zero_flag
heinrichsweikamp
parents:
diff changeset
236
heinrichsweikamp
parents:
diff changeset
237 output16_3_1:
heinrichsweikamp
parents:
diff changeset
238 btfsc DP_done
heinrichsweikamp
parents:
diff changeset
239 bsf pre_zero_flag
heinrichsweikamp
parents:
diff changeset
240 btfsc DP_done2
heinrichsweikamp
parents:
diff changeset
241 bsf pre_zero_flag
heinrichsweikamp
parents:
diff changeset
242 output16_4:
heinrichsweikamp
parents:
diff changeset
243 btfsc ignore_digit4 ; Ignore 4-5th digit?
heinrichsweikamp
parents:
diff changeset
244 bra output16_5 ; Yes, skip the rest
heinrichsweikamp
parents:
diff changeset
245 rcall DEC2ASCII ; 2nd order digit
heinrichsweikamp
parents:
diff changeset
246
heinrichsweikamp
parents:
diff changeset
247 movlw b'00000001' ; 1s
heinrichsweikamp
parents:
diff changeset
248 movwf temp2
heinrichsweikamp
parents:
diff changeset
249 clrf temp3
heinrichsweikamp
parents:
diff changeset
250 bsf pre_zero_flag
heinrichsweikamp
parents:
diff changeset
251 btfss ignore_digit5 ; Ignore 5th digit?
heinrichsweikamp
parents:
diff changeset
252 rcall DEC2ASCII ; 1st order digit
heinrichsweikamp
parents:
diff changeset
253 bcf ignore_digit5 ; yes, and clear flag
heinrichsweikamp
parents:
diff changeset
254 output16_5:
heinrichsweikamp
parents:
diff changeset
255 bcf ignore_digit4 ; Clear flag
heinrichsweikamp
parents:
diff changeset
256 bcf ignore_digit3 ; Clear flag
heinrichsweikamp
parents:
diff changeset
257 clrf ignore_digits
heinrichsweikamp
parents:
diff changeset
258 incf ignore_digits,F
heinrichsweikamp
parents:
diff changeset
259 bcf DP_done
heinrichsweikamp
parents:
diff changeset
260 RETURN ; Done with convert.asm...
heinrichsweikamp
parents:
diff changeset
261
heinrichsweikamp
parents:
diff changeset
262 DEC2ASCII clrf temp1 ; converts into ASCII code
heinrichsweikamp
parents:
diff changeset
263 DEC2ASCII_2 movf temp3,W
heinrichsweikamp
parents:
diff changeset
264 subwf hi_temp,W
heinrichsweikamp
parents:
diff changeset
265 btfss STATUS,C
heinrichsweikamp
parents:
diff changeset
266 bra DEC2ASCII_4
heinrichsweikamp
parents:
diff changeset
267 bnz DEC2ASCII_3
heinrichsweikamp
parents:
diff changeset
268
heinrichsweikamp
parents:
diff changeset
269 movf temp2,W
heinrichsweikamp
parents:
diff changeset
270 subwf lo_temp,W
heinrichsweikamp
parents:
diff changeset
271 btfss STATUS,C
heinrichsweikamp
parents:
diff changeset
272 bra DEC2ASCII_4
heinrichsweikamp
parents:
diff changeset
273
heinrichsweikamp
parents:
diff changeset
274 DEC2ASCII_3 movf temp3,W
heinrichsweikamp
parents:
diff changeset
275 subwf hi_temp,F
heinrichsweikamp
parents:
diff changeset
276 movf temp2,W
heinrichsweikamp
parents:
diff changeset
277 subwf lo_temp,F
heinrichsweikamp
parents:
diff changeset
278 btfss STATUS,C
heinrichsweikamp
parents:
diff changeset
279 decf hi_temp,F
heinrichsweikamp
parents:
diff changeset
280 incf temp1,F
heinrichsweikamp
parents:
diff changeset
281 bsf pre_zero_flag
heinrichsweikamp
parents:
diff changeset
282 bra DEC2ASCII_2
heinrichsweikamp
parents:
diff changeset
283
heinrichsweikamp
parents:
diff changeset
284 DEC2ASCII_4
heinrichsweikamp
parents:
diff changeset
285 decfsz ignore_digits,F
heinrichsweikamp
parents:
diff changeset
286 return
heinrichsweikamp
parents:
diff changeset
287 incf ignore_digits,F ; so ignore_digits stays zero for the test above
heinrichsweikamp
parents:
diff changeset
288 movlw '0' ; Offset for Ascii-value
heinrichsweikamp
parents:
diff changeset
289 addwf temp1,W
heinrichsweikamp
parents:
diff changeset
290 btfsc pre_zero_flag ; is this a leading zero?
heinrichsweikamp
parents:
diff changeset
291 bra DEC2ASCII_4_1 ; no
heinrichsweikamp
parents:
diff changeset
292 btfsc leftbind
heinrichsweikamp
parents:
diff changeset
293 bra DEC2ASCII_6
heinrichsweikamp
parents:
diff changeset
294 movlw ' ' ; instead of leading zeros a space!
heinrichsweikamp
parents:
diff changeset
295 bra DEC2ASCII_5
heinrichsweikamp
parents:
diff changeset
296 DEC2ASCII_4_1:
heinrichsweikamp
parents:
diff changeset
297 bsf all_zeros_flag ; display any zero from here
heinrichsweikamp
parents:
diff changeset
298 DEC2ASCII_5
heinrichsweikamp
parents:
diff changeset
299 movwf POSTINC2
heinrichsweikamp
parents:
diff changeset
300 DEC2ASCII_6
heinrichsweikamp
parents:
diff changeset
301 decfsz temp4,F ; Set decimal point?
heinrichsweikamp
parents:
diff changeset
302 RETURN ; No
heinrichsweikamp
parents:
diff changeset
303 movlw "." ; Yes
heinrichsweikamp
parents:
diff changeset
304 movwf POSTINC2
heinrichsweikamp
parents:
diff changeset
305 bsf DP_done
heinrichsweikamp
parents:
diff changeset
306 RETURN
heinrichsweikamp
parents:
diff changeset
307
heinrichsweikamp
parents:
diff changeset
308 END