annotate src/convert.asm @ 598:e1f0f5e3d4e4

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