1 ;--------------------------------------------------------------------------
2 ; cnvfrac.S - conversion routine of 24 bits floating point to ASCII
4 ; Copyright (C) 2004, Vangelis Rokas <vrokas at otenet.gr>
6 ; This library is free software; you can redistribute it and/or modify it
7 ; under the terms of the GNU General Public License as published by the
8 ; Free Software Foundation; either version 2, or (at your option) any
11 ; This library is distributed in the hope that it will be useful,
12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ; GNU General Public License for more details.
16 ; You should have received a copy of the GNU General Public License
17 ; along with this library; see the file COPYING. If not, write to the
18 ; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
21 ; As a special exception, if you link this library with other files,
22 ; some of which are compiled with SDCC, to produce an executable,
23 ; this library does not by itself cause the resulting executable to
24 ; be covered by the GNU General Public License. This exception does
25 ; not however invalidate any other reasons why the executable file
26 ; might be covered by the GNU General Public License.
27 ;--------------------------------------------------------------------------
44 .registers udata_ovr 0x000
100 movff d0x20, POSTDEC1
101 movff d0x21, POSTDEC1
102 movff d0x22, POSTDEC1
103 movff d0x23, POSTDEC1
104 movff d0x24, POSTDEC1
112 btfsc r0x00, 0 ; bit 0
127 decfsz round_digit, f
138 btfsc r0x00, 0 ; bit 0
141 btfsc r0x00, 1 ; bit 1
156 decfsz round_digit, f
167 btfsc r0x00, 0 ; bit 0
170 btfsc r0x00, 1 ; bit 1
173 btfsc r0x00, 2 ; bit 2
188 decfsz round_digit, f
199 btfsc r0x00, 1 ; bit 1
202 btfsc r0x00, 2 ; bit 2
205 btfsc r0x00, 3 ; bit 3
220 decfsz round_digit, f
231 btfsc r0x00, 0 ; bit 0
234 btfsc r0x00, 1 ; bit 1
237 btfsc r0x00, 2 ; bit 2
240 btfsc r0x00, 3 ; bit 3
243 btfsc r0x00, 4 ; bit 4
258 decfsz round_digit, f
269 btfsc r0x00, 0 ; bit 0
272 btfsc r0x00, 1 ; bit 1
275 btfsc r0x00, 2 ; bit 2
278 btfsc r0x00, 3 ; bit 3
281 btfsc r0x00, 4 ; bit 4
284 btfsc r0x00, 5 ; bit 5
299 decfsz round_digit, f
310 btfsc r0x00, 0 ; bit 0
313 btfsc r0x00, 2 ; bit 2
316 btfsc r0x00, 3 ; bit 3
319 btfsc r0x00, 4 ; bit 4
322 btfsc r0x00, 5 ; bit 5
325 btfsc r0x00, 6 ; bit 6
340 decfsz round_digit, f
351 btfsc r0x00, 0 ; bit 0
354 btfsc r0x00, 1 ; bit 1
357 btfsc r0x00, 5 ; bit 5
360 btfsc r0x00, 6 ; bit 6
363 btfsc r0x00, 7 ; bit 7
378 decfsz round_digit, f
389 btfsc r0x00, 0 ; bit 0
392 btfsc r0x00, 1 ; bit 1
395 btfsc r0x00, 2 ; bit 2
398 btfsc r0x00, 3 ; bit 3
401 btfsc r0x00, 4 ; bit 4
404 btfsc r0x00, 5 ; bit 5
407 btfsc r0x00, 6 ; bit 6
410 btfsc r0x00, 7 ; bit 7
413 btfsc r0x01, 0 ; bit 8
428 decfsz round_digit, f
439 btfsc r0x00, 0 ; bit 0
442 btfsc r0x00, 1 ; bit 1
445 btfsc r0x00, 2 ; bit 2
448 btfsc r0x00, 3 ; bit 3
451 btfsc r0x00, 4 ; bit 4
454 btfsc r0x00, 5 ; bit 5
457 btfsc r0x00, 6 ; bit 6
460 btfsc r0x00, 7 ; bit 7
463 btfsc r0x01, 0 ; bit 8
466 btfsc r0x01, 1 ; bit 9
481 decfsz round_digit, f
492 btfsc r0x00, 0 ; bit 0
495 btfsc r0x00, 1 ; bit 1
498 btfsc r0x00, 2 ; bit 2
501 btfsc r0x00, 3 ; bit 3
504 btfsc r0x00, 4 ; bit 4
507 btfsc r0x00, 5 ; bit 5
510 btfsc r0x00, 6 ; bit 6
513 btfsc r0x00, 7 ; bit 7
516 btfsc r0x01, 0 ; bit 8
519 btfsc r0x01, 1 ; bit 9
522 btfsc r0x01, 2 ; bit 10
537 decfsz round_digit, f
548 btfsc r0x00, 0 ; bit 0
551 btfsc r0x00, 1 ; bit 1
554 btfsc r0x00, 2 ; bit 2
557 btfsc r0x00, 3 ; bit 3
560 btfsc r0x00, 4 ; bit 4
563 btfsc r0x00, 5 ; bit 5
566 btfsc r0x00, 6 ; bit 6
569 btfsc r0x00, 7 ; bit 7
572 btfsc r0x01, 1 ; bit 9
575 btfsc r0x01, 2 ; bit 10
578 btfsc r0x01, 3 ; bit 11
593 decfsz round_digit, f
604 btfsc r0x00, 0 ; bit 0
607 btfsc r0x00, 1 ; bit 1
610 btfsc r0x00, 2 ; bit 2
613 btfsc r0x00, 3 ; bit 3
616 btfsc r0x00, 4 ; bit 4
619 btfsc r0x00, 5 ; bit 5
622 btfsc r0x00, 6 ; bit 6
625 btfsc r0x00, 7 ; bit 7
628 btfsc r0x01, 0 ; bit 8
631 btfsc r0x01, 1 ; bit 9
634 btfsc r0x01, 2 ; bit 10
637 btfsc r0x01, 3 ; bit 11
640 btfsc r0x01, 4 ; bit 12
655 decfsz round_digit, f
666 btfsc r0x00, 2 ; bit 2
669 btfsc r0x00, 3 ; bit 3
672 btfsc r0x00, 4 ; bit 4
675 btfsc r0x00, 5 ; bit 5
678 btfsc r0x00, 6 ; bit 6
681 btfsc r0x00, 7 ; bit 7
684 btfsc r0x01, 0 ; bit 8
687 btfsc r0x01, 1 ; bit 9
690 btfsc r0x01, 2 ; bit 10
693 btfsc r0x01, 3 ; bit 11
696 btfsc r0x01, 4 ; bit 12
699 btfsc r0x01, 5 ; bit 13
714 decfsz round_digit, f
725 btfsc r0x00, 0 ; bit 0
728 btfsc r0x00, 1 ; bit 1
731 btfsc r0x00, 2 ; bit 2
734 btfsc r0x00, 3 ; bit 3
737 btfsc r0x00, 4 ; bit 4
740 btfsc r0x00, 5 ; bit 5
743 btfsc r0x00, 6 ; bit 6
746 btfsc r0x00, 7 ; bit 7
749 btfsc r0x01, 0 ; bit 8
752 btfsc r0x01, 1 ; bit 9
755 btfsc r0x01, 2 ; bit 10
758 btfsc r0x01, 3 ; bit 11
761 btfsc r0x01, 4 ; bit 12
764 btfsc r0x01, 5 ; bit 13
767 btfsc r0x01, 6 ; bit 14
782 decfsz round_digit, f
793 btfsc r0x00, 0 ; bit 0
796 btfsc r0x00, 1 ; bit 1
799 btfsc r0x00, 2 ; bit 2
802 btfsc r0x00, 3 ; bit 3
805 btfsc r0x00, 4 ; bit 4
808 btfsc r0x00, 5 ; bit 5
811 btfsc r0x00, 6 ; bit 6
814 btfsc r0x00, 7 ; bit 7
817 btfsc r0x01, 0 ; bit 8
820 btfsc r0x01, 1 ; bit 9
823 btfsc r0x01, 2 ; bit 10
826 btfsc r0x01, 5 ; bit 13
829 btfsc r0x01, 6 ; bit 14
832 btfsc r0x01, 7 ; bit 15
847 decfsz round_digit, f
858 btfsc r0x00, 0 ; bit 0
861 btfsc r0x00, 1 ; bit 1
864 btfsc r0x00, 2 ; bit 2
867 btfsc r0x00, 3 ; bit 3
870 btfsc r0x00, 4 ; bit 4
873 btfsc r0x00, 6 ; bit 6
876 btfsc r0x00, 7 ; bit 7
879 btfsc r0x01, 0 ; bit 8
882 btfsc r0x01, 1 ; bit 9
885 btfsc r0x01, 2 ; bit 10
888 btfsc r0x01, 3 ; bit 11
891 btfsc r0x01, 4 ; bit 12
894 btfsc r0x01, 5 ; bit 13
897 btfsc r0x01, 6 ; bit 14
900 btfsc r0x01, 7 ; bit 15
903 btfsc r0x02, 0 ; bit 16
918 decfsz round_digit, f
929 btfsc r0x00, 1 ; bit 1
932 btfsc r0x00, 2 ; bit 2
935 btfsc r0x00, 3 ; bit 3
938 btfsc r0x00, 4 ; bit 4
941 btfsc r0x00, 5 ; bit 5
944 btfsc r0x00, 6 ; bit 6
947 btfsc r0x00, 7 ; bit 7
950 btfsc r0x01, 0 ; bit 8
953 btfsc r0x01, 1 ; bit 9
956 btfsc r0x01, 4 ; bit 12
959 btfsc r0x01, 5 ; bit 13
962 btfsc r0x01, 6 ; bit 14
965 btfsc r0x01, 7 ; bit 15
968 btfsc r0x02, 0 ; bit 16
971 btfsc r0x02, 1 ; bit 17
986 decfsz round_digit, f
997 btfsc r0x00, 5 ; bit 5
1000 btfsc r0x00, 6 ; bit 6
1003 btfsc r0x00, 7 ; bit 7
1006 btfsc r0x01, 0 ; bit 8
1009 btfsc r0x01, 2 ; bit 10
1012 btfsc r0x01, 3 ; bit 11
1015 btfsc r0x01, 4 ; bit 12
1018 btfsc r0x01, 5 ; bit 13
1021 btfsc r0x01, 6 ; bit 14
1024 btfsc r0x01, 7 ; bit 15
1027 btfsc r0x02, 0 ; bit 16
1030 btfsc r0x02, 1 ; bit 17
1033 btfsc r0x02, 2 ; bit 18
1048 decfsz round_digit, f
1059 btfsc r0x01, 0 ; bit 8
1062 btfsc r0x01, 1 ; bit 9
1065 btfsc r0x01, 2 ; bit 10
1068 btfsc r0x01, 3 ; bit 11
1071 btfsc r0x01, 4 ; bit 12
1074 btfsc r0x01, 5 ; bit 13
1077 btfsc r0x01, 6 ; bit 14
1080 btfsc r0x01, 7 ; bit 15
1083 btfsc r0x02, 1 ; bit 17
1086 btfsc r0x02, 2 ; bit 18
1089 btfsc r0x02, 3 ; bit 19
1104 decfsz round_digit, f
1115 btfsc r0x01, 3 ; bit 11
1118 btfsc r0x01, 4 ; bit 12
1121 btfsc r0x01, 5 ; bit 13
1124 btfsc r0x01, 6 ; bit 14
1127 btfsc r0x01, 7 ; bit 15
1130 btfsc r0x02, 0 ; bit 16
1133 btfsc r0x02, 1 ; bit 17
1136 btfsc r0x02, 2 ; bit 18
1139 btfsc r0x02, 3 ; bit 19
1142 btfsc r0x02, 4 ; bit 20
1157 decfsz round_digit, f
1168 btfsc r0x01, 7 ; bit 15
1171 btfsc r0x02, 0 ; bit 16
1174 btfsc r0x02, 1 ; bit 17
1177 btfsc r0x02, 2 ; bit 18
1180 btfsc r0x02, 3 ; bit 19
1183 btfsc r0x02, 4 ; bit 20
1186 btfsc r0x02, 5 ; bit 21
1201 decfsz round_digit, f
1212 btfsc r0x02, 2 ; bit 18
1215 btfsc r0x02, 3 ; bit 19
1218 btfsc r0x02, 4 ; bit 20
1221 btfsc r0x02, 5 ; bit 21
1224 btfsc r0x02, 6 ; bit 22
1239 decfsz round_digit, f
1250 btfsc r0x02, 5 ; bit 21
1253 btfsc r0x02, 6 ; bit 22
1256 btfsc r0x02, 7 ; bit 23
1271 decfsz round_digit, f
1379 movff PREINC1, d0x24
1380 movff PREINC1, d0x23
1381 movff PREINC1, d0x22
1382 movff PREINC1, d0x21
1383 movff PREINC1, d0x20
1384 movff PREINC1, d0x19
1385 movff PREINC1, d0x18
1386 movff PREINC1, d0x17
1387 movff PREINC1, d0x16
1388 movff PREINC1, d0x15
1389 movff PREINC1, d0x14
1390 movff PREINC1, d0x13
1391 movff PREINC1, d0x12
1392 movff PREINC1, d0x11
1393 movff PREINC1, d0x10
1394 movff PREINC1, d0x09
1395 movff PREINC1, d0x08
1396 movff PREINC1, d0x07
1397 movff PREINC1, d0x06
1398 movff PREINC1, d0x05
1399 movff PREINC1, d0x04
1400 movff PREINC1, d0x03
1401 movff PREINC1, d0x02
1402 movff PREINC1, d0x01
1403 movff PREINC1, d0x00
1410 ;00 0.5000000000000000000000000 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1411 ;01 0.2500000000000000000000000 2 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1412 ;02 0.1250000000000000000000000 1 2 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1413 ;03 0.0625000000000000000000000 0 6 2 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1414 ;04 0.0312500000000000000000000 0 3 1 2 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1415 ;05 0.0156250000000000000000000 0 1 5 6 2 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1416 ;06 0.0078125000000000000000000 0 0 7 8 1 2 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1417 ;07 0.0039062500000000000000000 0 0 3 9 0 6 2 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1418 ;08 0.0019531250000000000000000 0 0 1 9 5 3 1 2 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1419 ;09 0.0009765625000000000000000 0 0 0 9 7 6 5 6 2 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1420 ;10 0.0004882812500000000000000 0 0 0 4 8 8 2 8 1 2 5 0 0 0 0 0 0 0 0 0 0 0 0 0
1421 ;11 0.0002441406250000000000000 0 0 0 2 4 4 1 4 0 6 2 5 0 0 0 0 0 0 0 0 0 0 0 0
1422 ;12 0.0001220703125000000000000 0 0 0 1 2 2 0 7 0 3 1 2 5 0 0 0 0 0 0 0 0 0 0 0
1423 ;13 0.0000610351562500000000000 0 0 0 0 6 1 0 3 5 1 5 6 2 5 0 0 0 0 0 0 0 0 0 0
1424 ;14 0.0000305175781250000000000 0 0 0 0 3 0 5 1 7 5 7 8 1 2 5 0 0 0 0 0 0 0 0 0
1425 ;15 0.0000152587890625000000000 0 0 0 0 1 5 2 5 8 7 8 9 0 6 2 5 0 0 0 0 0 0 0 0
1426 ;16 0.0000076293945312500000000 0 0 0 0 0 7 6 2 9 3 9 4 5 3 1 2 5 0 0 0 0 0 0 0
1427 ;17 0.0000038146972656250000000 0 0 0 0 0 3 8 1 4 6 9 7 2 6 5 6 2 5 0 0 0 0 0 0
1428 ;18 0.0000019073486328125000000 0 0 0 0 0 1 9 0 7 3 4 8 6 3 2 8 1 2 5 0 0 0 0 0
1429 ;19 0.0000009536743164062500000 0 0 0 0 0 0 9 5 3 6 7 4 3 1 6 4 0 6 2 5 0 0 0 0
1430 ;20 0.0000004768371582031250000 0 0 0 0 0 0 4 7 6 8 3 7 1 5 8 2 0 3 1 2 5 0 0 0
1431 ;21 0.0000002384185791015625000 0 0 0 0 0 0 2 3 8 4 1 8 5 7 9 1 0 1 5 6 2 5 0 0
1432 ;22 0.0000001192092895507812500 0 0 0 0 0 0 1 1 9 2 0 9 2 8 9 5 5 0 7 8 1 2 5 0
1433 ;23 0.0000000596046447753906250 0 0 0 0 0 0 0 5 9 6 0 4 6 4 4 7 7 5 3 9 0 6 2 5