From fedfc3443de7adacb290cc33adb4b8fb63739e41 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Fri, 24 Feb 2023 02:12:19 +0100 Subject: [PATCH] fix for issue #1973 (printf("%c", '\0') doesn't _write '\0' to fd 0) --- libsrc/common/_printf.s | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libsrc/common/_printf.s b/libsrc/common/_printf.s index 840d42127..a0074583e 100644 --- a/libsrc/common/_printf.s +++ b/libsrc/common/_printf.s @@ -502,10 +502,10 @@ DoFormat: ; It is a character jsr GetIntArg ; Get the argument (promoted to int) - sta Buf ; Place it as zero terminated string... - lda #0 - sta Buf+1 ; ...into the buffer - jmp HaveArg ; Done + sta Buf ; Place it into the buffer + ldx #0 + lda #1 ; Buffer length is 1 + jmp HaveArg1 ; Is it an integer? @@ -671,6 +671,7 @@ HaveArg: lda Str ldx Str+1 jsr _strlen ; Get length of argument +HaveArg1: ; Jumped into here from %c handling sta ArgLen stx ArgLen+1