printf(): Allow padding (spaces or zeroes) for %b

This commit is contained in:
2025-07-12 07:48:21 +02:00
parent 971b1cbb86
commit ee17ec68e0
4 changed files with 88 additions and 36 deletions

View File

@@ -10,6 +10,8 @@ extern min
extern minu
extern max
extern maxu
extern clamp
extern clampu
; console.asm
extern print
extern puts
@@ -88,6 +90,8 @@ section .rodata
printf4Str db "%i|%d|%u , %i|%d|%u",NL,EOS
printf5 db TAB,"printf(",DQUO,"%x|%X , %x|%X\n",DQUO,", 0xabcdeffedcba, 0x069bc0e, 666, -1): ",NL,TAB,TAB,EOS
printf5Str db "%x|%X , %x|%X",NL,EOS
printf6 db TAB,"printf(",DQUO,"%b | %8b | %08b\n",DQUO,", 5, 5, 5): ",NL,TAB,TAB,EOS
printf6Str db "%b | %8b | %08b",NL,EOS
; strlen()
msgStrlen db NL,"TEST strlen()",NL,EOS
@@ -337,6 +341,15 @@ _start:
mov rcx, 666
mov r8, -1
call printf
; TEST 6
lea rdi, [rel printf6]
call print
lea rdi, [rel printf6Str]
mov rsi, 5
mov rdx, 5
mov rcx, 5
call printf
%endif
;---