From the docs:
void textprintf_ex(BITMAP *bmp, const FONT *f, int x, int y, int color, int bg, const char *fmt, ...);
Aren't you missing something? ... hint ...
Why do you use assembler? That's just crazy. You won't be able to optimize a function call.
Edit: ...or maybe not that crazy after all.
This should probably work for you if you don't use any format specifiers in your format string:
__asm
{
push format;
push bg;
push color;
push y;
push x;
push f;
push m_Buffer;
call dword ptr[textprintf_ex];
add esp, 28;
}
When it comes to the varadic arguments you might be better off doing a memcpy from the stack, than trying to push a value at a time. Because in the latter case you will have to parse the format string to know the size of all parameters.
You can use &f as the source start and use an offset to the address of a volatile variable located in your function as a reference to the end of the memory block. You will only have to deal with m_Buffer as you do above.