git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3691
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2005-03-09 Paul Stoffregen <paul AT pjrc.com>
+
+ * device/lib/printf_fast.c: fix leading zero format, eg "%02d"
+
2005-05-09 Raphael Neider <rneider AT web.de>
* src/SDCCopt.c (killDeadCode): fixed bug #1156016
#ifdef FIELD_WIDTH
static bit field_width_flag;
+static bit leading_zero_flag;
static data unsigned char field_width;
#endif
clr _negative_flag
#ifdef FIELD_WIDTH
clr _field_width_flag
+ clr _leading_zero_flag
mov r1, #_field_width
mov @r1, #0
#endif
jnc printf_nondigit2
#ifdef FIELD_WIDTH
printf_digit:
+ jnz printf_digit_2
+ cjne a, _field_width, printf_digit_2
+ setb _leading_zero_flag
+printf_digit_2:
setb _field_width_flag
mov r2, a
mov a, @r1
#ifdef FIELD_WIDTH
jnb _field_width_flag, printf_str_loop
+ clr _leading_zero_flag // never leading zeros for strings
push dpl
push dph
printf_str_fw_loop:
printf_space_loop:
//mov a, #' '
mov a, #32
+ jnb _leading_zero_flag, printf_space_output
+ //mov a, #'0'
+ mov a, #48
+printf_space_output:
lcall printf_putchar
dec _field_width
printf_space: