I got around to re-implementing sprintf in x86-64 assembly using NASM's macro features: https://github.com/DrewSebastino/x86-64 ... printf.asm
Example usage:
As such, it cannot parse the format string at runtime, although honestly, I have never felt the need to do this. Additionally (and this actually is a problem) there's no floating point support right now, due to having no idea how to implement that sort of thing. If anyone has an idea on what to do for this, I would greatly appreciate it. Everything else (that I know of) is there though.
Example usage:
Code:
mov r15, 1000
sprintf outBuffer, `Value of r15: %#010lX\n%ln`, r15, r10,
write STDOUT_FILENO, outBuffer, r10
stdout:
Value of r15: 0X000003E8
sprintf outBuffer, `Value of r15: %#010lX\n%ln`, r15, r10,
write STDOUT_FILENO, outBuffer, r10
stdout:
Value of r15: 0X000003E8
As such, it cannot parse the format string at runtime, although honestly, I have never felt the need to do this. Additionally (and this actually is a problem) there's no floating point support right now, due to having no idea how to implement that sort of thing. If anyone has an idea on what to do for this, I would greatly appreciate it. Everything else (that I know of) is there though.