From bd1e822a439d2c81b131ed736aafae3cbd10281b Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sat, 30 Jan 2021 17:51:55 -0600 Subject: [PATCH] printf: In d/i/o/u/x/X conversions with a precision specified, the 0 flag should be ignored. For example, the output of the following should have only two leading zeros (and the rest of the field width padded with spaces): #include int main(void) { printf("%016.5i\n", 123); } --- stdio.asm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stdio.asm b/stdio.asm index ac2de98..269b218 100644 --- a/stdio.asm +++ b/stdio.asm @@ -3640,9 +3640,12 @@ cn3 _Int2Dec ; ~Format_IntOut entry pd1 lda ~precisionSpecified if the precision was not specified then - bne pd2 + bne pd1a lda #1 use a precision of 1 sta ~precision + bra pd2 +pd1a lda #' ' if the precision was specified then + sta ~paddChar do not do 0 padding pd2 ldx ~precision if the precision is zero then bne pd2a lda ~str+l:~str-2 if the result is ' 0' then