2 ; int sprintf (char* buf, const char* Format, ...);
4 ; Ullrich von Bassewitz, 1.12.2000
8 .import pushax, addysp, decsp4, _vsprintf
13 ; ----------------------------------------------------------------------------
18 ParamSize: .res 1 ; Number of parameter bytes
20 ; ----------------------------------------------------------------------------
27 sty ParamSize ; Number of param bytes passed in Y
29 ; We have to push buf and format, both in the order they already have on stack.
30 ; To make this somewhat more efficient, we will create space on the stack and
31 ; the do a copy of the complete block instead of pushing each parameter
32 ; separately. Since the size of the arguments passed is the same as the size
33 ; of the fixed arguments, this will allow us to calculate the pointer to the
34 ; fixed size arguments easier (they're just ParamSize bytes away).
38 ; Calculate a pointer to the Format argument
48 ; Now copy both, buf and format
56 ; Load va_list (last and __fastcall__ parameter to vsprintf)
65 ; Cleanup the stack. We will return what we got from vsprintf