6f492c9d3925ac04b048020661439495d7147a71
[fw/sdcc] / device / lib / printf_fast.c
1 /* Fast printf routine for use with sdcc/mcs51
2  * Copyright (c) 2001, Paul Stoffregen, paul@pjrc.com
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17  */
18
19
20 // include support for 32 bit base 10 integers (%ld and %lu)
21 #define LONG_INT
22
23 // include support for minimum field widths (%8d, %20s)
24 #define FIELD_WIDTH
25
26
27 /* extern void putchar(char ); */
28
29
30 static bit long_flag, short_flag, print_zero_flag, negative_flag;
31
32 #ifdef FIELD_WIDTH
33 static bit field_width_flag;
34 static bit leading_zero_flag;
35 static data unsigned char field_width;
36 #endif
37
38
39 void printf_fast(code char *fmt, ...) reentrant
40 {
41         fmt;    /* supress unreferenced variable warning */
42
43         _asm
44
45 printf_begin:
46         mov     a, _bp          // r0 will point to va_args (stack)
47         add     a, #253
48         mov     r0, a           // r0 points to MSB of fmt
49         mov     dph, @r0
50         dec     r0
51         mov     dpl, @r0        // dptr has address of fmt
52         dec     r0
53
54 printf_main_loop:
55         clr     a
56         movc    a, @a+dptr      // get next byte of fmt string
57         inc     dptr
58         //cjne  a, #'%', printf_normal
59         cjne    a, #37, printf_normal
60
61 printf_format:
62         clr     _long_flag
63         clr     _short_flag
64         clr     _print_zero_flag
65         clr     _negative_flag
66 #ifdef FIELD_WIDTH
67         clr     _field_width_flag
68         clr     _leading_zero_flag
69         mov     _field_width, #0
70 #endif
71
72 printf_format_loop:
73         clr     a
74         movc    a, @a+dptr      // get next byte of data format
75         inc     dptr
76
77         /* parse and consume the field width digits, even if */
78         /* we don't build the code to make use of them */
79         add     a, #198
80         jc      printf_nondigit1
81         add     a, #10
82         jnc     printf_nondigit2
83 #ifdef FIELD_WIDTH
84 printf_digit:
85         jnz     printf_digit_2
86         cjne    a, _field_width, printf_digit_2
87         setb    _leading_zero_flag
88 printf_digit_2:
89         setb    _field_width_flag
90         mov     r1, a
91         mov     a, _field_width
92         mov     b, #10
93         mul     ab
94         add     a, r1
95         mov     _field_width, a
96 #endif
97         sjmp    printf_format_loop
98 printf_nondigit1:
99         add     a, #10
100 printf_nondigit2:
101         add     a, #48
102
103
104 printf_format_l:
105         //cjne  a, #'l', printf_format_h
106         cjne    a, #108, printf_format_h
107         setb    _long_flag
108         sjmp    printf_format_loop
109
110 printf_format_h:
111         //cjne  a, #'h', printf_format_s
112         cjne    a, #104, printf_format_s
113         setb    _short_flag
114         sjmp    printf_format_loop
115
116 printf_format_s:
117         //cjne  a, #'s', printf_format_d
118         cjne    a, #115, printf_format_d
119         ljmp    printf_string
120
121 printf_format_d:
122         //cjne  a, #'d', printf_format_u
123         cjne    a, #100, printf_format_u
124         lcall   printf_get_int
125         ljmp    printf_int
126
127 printf_format_u:
128         //cjne  a, #'u', printf_format_c
129         cjne    a, #117, printf_format_c
130         lcall   printf_get_int
131         ljmp    printf_uint
132
133 printf_format_c:
134         //cjne  a, #'c', printf_format_x
135         cjne    a, #99, printf_format_x
136         mov     a, @r0          // Acc has the character to print
137         dec     r0
138         sjmp    printf_char
139
140 printf_format_x:
141         //cjne  a, #'x', printf_normal
142         cjne    a, #120, printf_normal
143         ljmp    printf_hex
144
145 printf_normal:
146         jz      printf_eot
147 printf_char:
148         lcall   printf_putchar
149         sjmp    printf_main_loop
150
151 printf_eot:
152         ljmp    printf_end
153
154
155
156
157         /* print a string... just grab each byte with __gptrget */
158         /* the user much pass a 24 bit generic pointer */
159
160 printf_string:
161         push    dph             // save addr in fmt onto stack
162         push    dpl
163         mov     b, @r0          // b has type of address (generic *)
164         dec     r0
165         mov     dph, @r0
166         dec     r0
167         mov     dpl, @r0        // dptr has address of user's string
168         dec     r0
169
170 #ifdef FIELD_WIDTH
171         jnb     _field_width_flag, printf_str_loop
172         clr     _leading_zero_flag      // never leading zeros for strings
173         push    dpl
174         push    dph
175 printf_str_fw_loop:
176         lcall   __gptrget
177         jz      printf_str_space
178         inc     dptr
179         dec     _field_width
180         mov     a, _field_width
181         jnz     printf_str_fw_loop
182 printf_str_space:
183         lcall   printf_space
184         pop     dph
185         pop     dpl
186 #endif // FIELD_WIDTH
187
188 printf_str_loop:
189         lcall   __gptrget
190         jz      printf_str_done
191         inc     dptr
192         lcall   printf_putchar
193         sjmp    printf_str_loop
194 printf_str_done:
195         pop     dpl             // restore addr withing fmt
196         pop     dph
197         ljmp    printf_main_loop
198
199
200
201
202
203
204
205
206         /* printing in hex is easy because sdcc pushes the LSB first */
207
208 printf_hex:
209         lcall   printf_hex8
210         jb      _short_flag, printf_hex_end
211         lcall   printf_hex8
212         jnb     _long_flag, printf_hex_end
213         lcall   printf_hex8
214         lcall   printf_hex8
215 printf_hex_end:
216         lcall   printf_zero
217         ljmp    printf_main_loop
218 printf_hex8:
219         mov     a, @r0
220         lcall   printf_phex_msn
221         mov     a, @r0
222         dec     r0
223         ljmp    printf_phex_lsn
224
225
226 #ifndef LONG_INT
227 printf_ld_in_hex:
228         //mov   a, #'0'
229         mov     a, #48
230         lcall   printf_putchar
231         //mov   a, #'x'
232         mov     a, #120
233         lcall   printf_putchar
234         mov     a, r0
235         add     a, #4
236         mov     r0, a
237         sjmp    printf_hex
238 #endif
239
240
241         /* printing an integer is not so easy.  For a signed int */
242         /* check if it is negative and print the minus sign and */
243         /* invert it to a positive integer */
244
245 printf_int:
246         mov     a, r5
247         jnb     acc.7, printf_uint      /* check if negative */
248         setb    _negative_flag
249         mov     a, r1                   /* invert integer */
250         cpl     a
251         addc    a, #1
252         mov     r1, a
253         jb      _short_flag, printf_uint
254         mov     a, r2
255         cpl     a
256         addc    a, #0
257         mov     r2, a
258         jnb     _long_flag, printf_uint
259         mov     a, r3
260         cpl     a
261         addc    a, #0
262         mov     r3, a
263         mov     a, r4
264         cpl     a
265         addc    a, #0
266         mov     r4, a
267
268
269         /* printing integers is a lot of work... because it takes so */
270         /* long, the first thing to do is make sure we're doing as */
271         /* little work as possible, then convert the binary int to */
272         /* packed BCD, and finally print each digit of the BCD number */
273
274 printf_uint:
275
276         jb      _short_flag, printf_uint_ck8
277         jnb     _long_flag, printf_uint_ck16
278 printf_uint_ck32:
279         /* it's a 32 bit int... but if the upper 16 bits are zero */
280         /* we can treat it like a 16 bit integer and convert much faster */
281 #ifdef LONG_INT
282         mov     a, r3
283         jnz     printf_uint_begin
284         mov     a, r4
285         jnz     printf_uint_begin
286 #else
287         mov     a, r3
288         jnz     printf_ld_in_hex        ;print long integer as hex
289         mov     a, r4                   ;rather than just the low 16 bits
290         jnz     printf_ld_in_hex
291 #endif
292         clr     _long_flag
293 printf_uint_ck16:
294         /* it's a 16 bit int... but if the upper 8 bits are zero */
295         /* we can treat it like a 8 bit integer and convert much faster */
296         mov     a, r2
297         jnz     printf_uint_begin
298         setb    _short_flag
299 printf_uint_ck8:
300         /* it's an 8 bit int... if it's zero, it's a lot faster to just */
301         /* print the digit zero and skip all the hard work! */
302         mov     a, r1
303         jnz     printf_uint_begin
304 #ifdef FIELD_WIDTH
305         jnb     _field_width_flag, printf_uint_zero
306         dec     _field_width
307         lcall   printf_space
308 #endif
309 printf_uint_zero:
310         //mov   a, #'0'
311         mov     a, #48
312         lcall   printf_putchar
313         ljmp    printf_main_loop
314
315
316 printf_uint_begin:
317         push    dpl
318         push    dph
319         lcall   printf_int2bcd          // bcd number in r3/r2/r7/r6/r5
320
321 #ifdef FIELD_WIDTH
322         jnb     _field_width_flag, printf_uifw_end
323 #ifdef LONG_INT
324 printf_uifw_32:
325         mov     r1, #10
326         jnb     _long_flag, printf_uifw_16
327         mov     a, r3
328         anl     a, #0xF0
329         jnz     printf_uifw_sub
330         dec     r1
331         mov     a, r3
332         anl     a, #0x0F
333         jnz     printf_uifw_sub
334         dec     r1
335         mov     a, r2
336         anl     a, #0xF0
337         jnz     printf_uifw_sub
338         dec     r1
339         mov     a, r2
340         anl     a, #0x0F
341         jnz     printf_uifw_sub
342         dec     r1
343         mov     a, r7
344         anl     a, #0xF0
345         jnz     printf_uifw_sub
346 #endif
347 printf_uifw_16:
348         mov     r1, #5
349         jb      _short_flag, printf_uifw_8
350         mov     a, r7
351         anl     a, #0x0F
352         jnz     printf_uifw_sub
353         dec     r1
354         mov     a, r6
355         anl     a, #0xF0
356         jnz     printf_uifw_sub
357 printf_uifw_8:
358         mov     r1, #3
359         mov     a, r6
360         anl     a, #0x0F
361         jnz     printf_uifw_sub
362         dec     r1
363         mov     a, r5
364         anl     a, #0xF0
365         jnz     printf_uifw_sub
366         dec     r1
367 printf_uifw_sub:
368         ;r1 has the number of digits for the number
369         mov     a, _field_width
370         mov     c, _negative_flag
371         subb    a, r1
372         jc      printf_uifw_end
373         mov     _field_width, a
374
375 #ifdef LONG_INT
376         push    ar3
377         push    ar2
378 #endif
379         push    ar7
380         push    ar6
381         push    ar5
382         lcall   printf_space
383         pop     ar5
384         pop     ar6
385         pop     ar7
386 #ifdef LONG_INT
387         pop     ar2
388         pop     ar3
389 #endif
390 printf_uifw_end:
391 #endif
392
393
394 printf_uint_doit:
395         jnb     _negative_flag, printf_uint_pos
396         //mov   a, #"-"
397         mov     a, #45
398         lcall   printf_putchar
399 printf_uint_pos:
400         jb      _short_flag, printf_uint8
401 #ifdef LONG_INT
402         jnb     _long_flag, printf_uint16
403 printf_uint32:
404         push    ar5
405         push    ar6
406         push    ar7
407         mov     dpl, r2
408         mov     a, r3
409         mov     dph, a
410         lcall   printf_phex_msn
411         mov     a, dph
412         lcall   printf_phex_lsn
413         mov     a, dpl
414         lcall   printf_phex_msn
415         mov     a, dpl
416         lcall   printf_phex_lsn
417         pop     acc
418         mov     dpl, a
419         lcall   printf_phex_msn
420         mov     a, dpl
421         pop     dph
422         pop     dpl
423         sjmp    printf_uint16a
424 #endif
425
426 printf_uint16:
427         mov     dpl, r5
428         mov     dph, r6
429         mov     a, r7
430 printf_uint16a:
431         lcall   printf_phex_lsn
432         mov     a, dph
433         lcall   printf_phex_msn
434         mov     a, dph
435         sjmp    printf_uint8a
436
437 printf_uint8:
438         mov     dpl, r5
439         mov     a, r6
440 printf_uint8a:
441         lcall   printf_phex_lsn
442         mov     a, dpl
443         lcall   printf_phex_msn
444         mov     a, dpl
445         lcall   printf_phex_lsn
446         lcall   printf_zero
447         pop     dph
448         pop     dpl
449         ljmp    printf_main_loop
450
451
452
453
454
455
456
457
458
459
460
461         /* read an integer into r1/r2/r3/r4, and msb into r5 */
462 printf_get_int:
463         mov     a, @r0
464         mov     r1, a
465         mov     r5, a
466         dec     r0
467         jb      _short_flag, printf_get_done
468         mov     r2, ar1
469         mov     a, @r0
470         mov     r1, a
471         dec     r0
472         jnb     _long_flag, printf_get_done
473         mov     r4, ar2
474         mov     r3, ar1
475         mov     a, @r0
476         mov     r2, a
477         dec     r0
478         mov     a, @r0
479         mov     r1, a
480         dec     r0
481 printf_get_done:
482         ret
483
484
485
486
487
488
489
490         /* convert binary number in r4/r3/r2/r1 into bcd packed number
491          * in r3/r2/r7/r6/r5.  The input number is destroyed in the
492          * process, to avoid needing extra memory for the result (and
493          * r1 gets used for temporary storage).  dptr is overwritten,
494          * but r0 is not changed.
495          */
496
497 printf_int2bcd:
498         mov     a, r1
499         anl     a, #0x0F
500         mov     dptr, #_int2bcd_0
501         movc    a, @a+dptr
502         mov     r5, a
503
504         mov     a, r1
505         swap    a
506         anl     a, #0x0F
507         mov     r1, a                   // recycle r1 for holding nibble
508         mov     dptr, #_int2bcd_1
509         movc    a, @a+dptr
510         add     a, r5
511         da      a
512         mov     r5, a
513         mov     a, r1
514         orl     a, #16
515         movc    a, @a+dptr
516         addc    a, #0
517         da      a
518         mov     r6, a
519
520         jnb     _short_flag, printf_i2bcd_16    // if 8 bit int, we're done
521         ret
522
523 printf_i2bcd_16:
524         mov     a, r2
525         anl     a, #0x0F
526         mov     r1, a
527         mov     dptr, #_int2bcd_2
528         movc    a, @a+dptr
529         add     a, r5
530         da      a
531         mov     r5, a
532         mov     a, r1
533         orl     a, #16
534         movc    a, @a+dptr
535         addc    a, r6
536         da      a
537         mov     r6, a
538
539         mov     a, r2
540         swap    a
541         anl     a, #0x0F
542         mov     r1, a
543         mov     dptr, #_int2bcd_3
544         movc    a, @a+dptr
545         add     a, r5
546         da      a
547         mov     r5, a
548         mov     a, r1
549         orl     a, #16
550         movc    a, @a+dptr
551         addc    a, r6
552         da      a
553         mov     r6, a
554         mov     a, r1
555         orl     a, #32
556         movc    a, @a+dptr
557         addc    a, #0
558         da      a
559         mov     r7, a
560
561         jb      _long_flag, printf_i2bcd_32     // if 16 bit int, we're done
562         ret
563
564 printf_i2bcd_32:
565
566 #ifdef LONG_INT
567         mov     a, r3
568         anl     a, #0x0F
569         mov     r1, a
570         mov     dptr, #_int2bcd_4
571         movc    a, @a+dptr
572         add     a, r5
573         da      a
574         mov     r5, a
575         mov     a, r1
576         orl     a, #16
577         movc    a, @a+dptr
578         addc    a, r6
579         da      a
580         mov     r6, a
581         mov     a, r1
582         orl     a, #32
583         movc    a, @a+dptr
584         addc    a, r7
585         da      a
586         mov     r7, a
587         clr     a
588         addc    a, #0
589         mov     r2, a
590
591         mov     a, r3
592         swap    a
593         anl     a, #0x0F
594         mov     r1, a
595         mov     dptr, #_int2bcd_5
596         movc    a, @a+dptr
597         add     a, r5
598         da      a
599         mov     r5, a
600         mov     a, r1
601         orl     a, #16
602         movc    a, @a+dptr
603         addc    a, r6
604         da      a
605         mov     r6, a
606         mov     a, r1
607         orl     a, #32
608         movc    a, @a+dptr
609         addc    a, r7
610         da      a
611         mov     r7, a
612         mov     a, r1
613         orl     a, #48
614         movc    a, @a+dptr
615         addc    a, r2
616         da      a
617         mov     r2, a
618
619         mov     a, r4
620         anl     a, #0x0F
621         mov     r1, a
622         mov     dptr, #_int2bcd_6
623         mov     r3, #0
624         lcall   printf_bcd_add10        // saves 27 bytes, costs 5 cycles
625
626         mov     a, r4
627         swap    a
628         anl     a, #0x0F
629         mov     r1, a
630         mov     dptr, #_int2bcd_7
631 printf_bcd_add10:
632         movc    a, @a+dptr
633         add     a, r5
634         da      a
635         mov     r5, a
636         mov     a, r1
637         orl     a, #16
638         movc    a, @a+dptr
639         addc    a, r6
640         da      a
641         mov     r6, a
642         mov     a, r1
643         orl     a, #32
644         movc    a, @a+dptr
645         addc    a, r7
646         da      a
647         mov     r7, a
648         mov     a, r1
649         orl     a, #48
650         movc    a, @a+dptr
651         addc    a, r2
652         da      a
653         mov     r2, a
654         mov     a, r1
655         orl     a, #64
656         movc    a, @a+dptr
657         addc    a, r3
658         da      a
659         mov     r3, a
660 #endif
661         ret
662
663
664
665
666 #ifdef FIELD_WIDTH
667 printf_space_loop:
668         //mov   a, #' '
669         mov     a, #32
670         jnb     _leading_zero_flag, printf_space_output
671         //mov   a, #'0'
672         mov     a, #48
673 printf_space_output:
674         lcall   printf_putchar
675         dec     _field_width
676 printf_space:
677         mov     a, _field_width
678         jnz     printf_space_loop
679         ret
680 #endif
681
682
683
684
685
686         /* print a hex digit, either upper 4 bit (msn) or lower 4 bits (lsn) */
687
688 printf_phex_msn:
689         swap    a
690 printf_phex_lsn:
691         anl     a, #15
692         jnz     printf_phex_ok
693         jnb     _print_zero_flag, printf_ret
694 printf_phex_ok:
695         setb    _print_zero_flag
696         add     a, #0x90
697         da      a
698         addc    a, #0x40
699         da      a
700 printf_putchar:
701         push    dph
702         push    dpl
703         push    ar0
704         mov     dpl, a
705         lcall   _putchar
706         pop     ar0
707         pop     dpl
708         pop     dph
709 printf_ret:
710         ret
711
712         /* print a zero if all the calls to print the digits ended up */
713         /* being leading zeros */
714
715 printf_zero:
716         jb      _print_zero_flag, printf_ret
717         //mov   a, #'0'
718         mov     a, #48
719         ljmp    printf_putchar
720   
721 printf_end:
722         _endasm;
723 }
724
725
726 /*
727  * #! /usr/bin/perl
728  * for ($d=0; $d < 8; $d++) {
729  *      $n = 16 ** $d;
730  *      for ($p=0; $p < 5; $p++) {
731  *              last unless (((16 ** $d) * 15) / (10 ** ($p * 2))) % 100;
732  *              printf "code unsigned char int2bcd_%d_%d[15] = {", $d, $p;
733  *              for ($i=0; $i < 16; $i++) {
734  *                      printf "0x%02d",
735  *                         (((16 ** $d) * $i) / (10 ** ($p * 2))) % 100;
736  *                      print ", " if $i < 15;
737  *              }
738  *              print "};\n";
739  *      }
740  * }
741  */
742
743
744 code unsigned char int2bcd_0[] = {
745 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
746 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15};
747
748 code unsigned char int2bcd_1[] = {
749 0x00, 0x16, 0x32, 0x48, 0x64, 0x80, 0x96, 0x12,
750 0x28, 0x44, 0x60, 0x76, 0x92, 0x08, 0x24, 0x40,
751 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
752 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02};
753
754 code unsigned char int2bcd_2[] = {
755 0x00, 0x56, 0x12, 0x68, 0x24, 0x80, 0x36, 0x92,
756 0x48, 0x04, 0x60, 0x16, 0x72, 0x28, 0x84, 0x40,
757 0x00, 0x02, 0x05, 0x07, 0x10, 0x12, 0x15, 0x17,
758 0x20, 0x23, 0x25, 0x28, 0x30, 0x33, 0x35, 0x38};
759
760 code unsigned char int2bcd_3[] = {
761 0x00, 0x96, 0x92, 0x88, 0x84, 0x80, 0x76, 0x72,
762 0x68, 0x64, 0x60, 0x56, 0x52, 0x48, 0x44, 0x40,
763 0x00, 0x40, 0x81, 0x22, 0x63, 0x04, 0x45, 0x86,
764 0x27, 0x68, 0x09, 0x50, 0x91, 0x32, 0x73, 0x14,
765 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02,
766 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x06};
767
768 #ifdef LONG_INT
769 code unsigned char int2bcd_4[] = {
770 0x00, 0x36, 0x72, 0x08, 0x44, 0x80, 0x16, 0x52,
771 0x88, 0x24, 0x60, 0x96, 0x32, 0x68, 0x04, 0x40,
772 0x00, 0x55, 0x10, 0x66, 0x21, 0x76, 0x32, 0x87,
773 0x42, 0x98, 0x53, 0x08, 0x64, 0x19, 0x75, 0x30,
774 0x00, 0x06, 0x13, 0x19, 0x26, 0x32, 0x39, 0x45,
775 0x52, 0x58, 0x65, 0x72, 0x78, 0x85, 0x91, 0x98};
776
777 code unsigned char int2bcd_5[] = {
778 0x00, 0x76, 0x52, 0x28, 0x04, 0x80, 0x56, 0x32,
779 0x08, 0x84, 0x60, 0x36, 0x12, 0x88, 0x64, 0x40,
780 0x00, 0x85, 0x71, 0x57, 0x43, 0x28, 0x14, 0x00,
781 0x86, 0x71, 0x57, 0x43, 0x29, 0x14, 0x00, 0x86,
782 0x00, 0x04, 0x09, 0x14, 0x19, 0x24, 0x29, 0x34,
783 0x38, 0x43, 0x48, 0x53, 0x58, 0x63, 0x68, 0x72,
784 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
785 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15};
786
787 code unsigned char int2bcd_6[] = {
788 0x00, 0x16, 0x32, 0x48, 0x64, 0x80, 0x96, 0x12,
789 0x28, 0x44, 0x60, 0x76, 0x92, 0x08, 0x24, 0x40,
790 0x00, 0x72, 0x44, 0x16, 0x88, 0x60, 0x32, 0x05,
791 0x77, 0x49, 0x21, 0x93, 0x65, 0x38, 0x10, 0x82,
792 0x00, 0x77, 0x55, 0x33, 0x10, 0x88, 0x66, 0x44,
793 0x21, 0x99, 0x77, 0x54, 0x32, 0x10, 0x88, 0x65,
794 0x00, 0x16, 0x33, 0x50, 0x67, 0x83, 0x00, 0x17,
795 0x34, 0x50, 0x67, 0x84, 0x01, 0x18, 0x34, 0x51,
796 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
797 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02};
798
799 code unsigned char int2bcd_7[] = {
800 0x00, 0x56, 0x12, 0x68, 0x24, 0x80, 0x36, 0x92,
801 0x48, 0x04, 0x60, 0x16, 0x72, 0x28, 0x84, 0x40,
802 0x00, 0x54, 0x09, 0x63, 0x18, 0x72, 0x27, 0x81,
803 0x36, 0x91, 0x45, 0x00, 0x54, 0x09, 0x63, 0x18,
804 0x00, 0x43, 0x87, 0x30, 0x74, 0x17, 0x61, 0x04,
805 0x48, 0x91, 0x35, 0x79, 0x22, 0x66, 0x09, 0x53,
806 0x00, 0x68, 0x36, 0x05, 0x73, 0x42, 0x10, 0x79,
807 0x47, 0x15, 0x84, 0x52, 0x21, 0x89, 0x58, 0x26,
808 0x00, 0x02, 0x05, 0x08, 0x10, 0x13, 0x16, 0x18,
809 0x21, 0x24, 0x26, 0x29, 0x32, 0x34, 0x37, 0x40};
810 #endif
811
812