From d595ba1903c2d60ac20d58b8c1d3803f2a09b38c Mon Sep 17 00:00:00 2001 From: Kwarde Date: Sun, 20 Jul 2025 23:39:54 +0200 Subject: [PATCH] Little update in printf comment (padding now does take num prefix into account) --- src/console.asm | 1 - src/tests.asm | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/console.asm b/src/console.asm index 1f09794..dd91a6a 100644 --- a/src/console.asm +++ b/src/console.asm @@ -75,7 +75,6 @@ puts: ; %#{x} Use prefix for printed number (non-decimal). Supported specifiers: x, X, b, o. Works in combination with width specifier (see below) ; %[#]n* Pad left, n chars (maximum 64). Supported specifiers: d, i, u, x, X, b, o ; *[#]0n* Pad left with zeroes, n chars (maximum 64). Supported specifiers: d, i, u, x, X, b, o -; NOTE: Prefix not included in padding length, so %#8x for '0x12345678' becomes ' 0x12345678' (and '%#08x' => '0x0012345678') ; Unsupported specifiers are printed as-is ; For all specifiers (except %%) an argument is expected. Mismatch between arguments given and specifiers provided will lead to issues ; diff --git a/src/tests.asm b/src/tests.asm index b2cddf8..6658ca5 100644 --- a/src/tests.asm +++ b/src/tests.asm @@ -64,8 +64,8 @@ section .rodata ; printf() msgPrintf db NL,"TEST printf()",NL,EOS - printf1 db TAB,"printf(",DQUO,"He%ll%0 there%%%%%!%!%\n",DQUO,"): ",NL,TAB,TAB,EOS - printf1Str db "He%ll%0 there%%%%%!%!%\n",EOS + printf1 db TAB,"printf(",DQUO,"He%ll%0 there%v%%%%!%!%\n",DQUO,"): ",NL,TAB,TAB,EOS + printf1Str db "He%ll%0 there%v%%%%!%!%\n",EOS printf2 db TAB,"printf(",DQUO,"Are %s doing %s?\n",DQUO,", printf2Str1, printf2Str2): ",NL,TAB,TAB,EOS printf2Str db "Are %s doing %s?\n",EOS printf2Str1 db "you",EOS