posprintf
is a partial implementation of sprintf
that I wrote specifically for GBA game development. It is written in Thumb assembler and should be very fast.
Implemented specifiers:
%d
- different from ANSI. Only works for numbers up to +/- 65,535 (16 bits plus sign).
%l
- different from ANSI. Works up to approximately +/- 500 million or so.
%s
- same as ANSI implementation.
%x
- same as ANSI implementation.
%X
- same as ANSI implementation.
%%
- same as ANSI implementation.
Note: Lead digit padding works only for %d
, %l
, %x
and %X
, and only for digits 1 through 9. (Although if you know your ascii table you can continue to provide bigger numbers; this should not be necessary though as %l
can only display up to 9 characters anyway.) Prefixing a 0
before the number prints leading zeros instead of spaces.
Everything is explained fully on the documentation page.
posprintf
no longer has a license, and has been released to the public domain.