Allow printing prefixes for %x,%X,%b and %o (pass ~base to udec)

This commit is contained in:
2025-07-15 16:31:52 +02:00
parent 87fd5d815a
commit 70ab8b19c3
3 changed files with 111 additions and 15 deletions

View File

@@ -99,6 +99,8 @@ section .rodata
printf12Str db "\nRAX\t%064b\nEAX\t\t\t\t\t%032b\n AX\t\t\t\t\t\t\t%016b\n AH\t\t\t\t\t\t\t%08b\t\n AL\t\t\t\t\t\t\t\t%08b\n",EOS
printf13 db TAB,"printf(",DQUO,"%o | %8o | %08o\n",DQUO,", 1500, 1500, 1500): ",NL,TAB,TAB,EOS
printf13Str db "%o | %8o | %08o\n",EOS
printf14 db TAB,"printf(",DQUO,"%#b | %#08b | %#x | %#8X\n | %#o",DQUO,", 8, 8, 0xABCDEF, 0x12345678, 15): ",NL,TAB,TAB,EOS
printf14Str db "%#b | %#08b | %#x | %#8X | %#o\n",EOS
; strlen()
msgStrlen db NL,"TEST strlen()",NL,EOS
@@ -383,6 +385,17 @@ _start:
mov rdx, 1500
mov rcx, 1500
call printf
; TEST 14
lea rdi, [rel printf14]
call print
lea rdi, [rel printf14Str]
mov rsi, 8
mov rdx, 8
mov rcx, 0xABCDEF
mov r8, 0x12345678
mov r9, 15
call printf
%endif
;---