To solve this, I understand C, and I'm still a beginner in Assembly so I'm kinda stuck with a little problem here.
I'm having some trouble with taking multiple arguments, maybe count them if I should do that, and use the format arguments in my assembly code.
Trying to add some bytes to a string with many arguments. I know how to put the two first arguments on the stack, but the other arguments after the first is the format (like %s, %d, %c etc) and the first argument is the one that is supposed to be the variable i want to write to. In C, standard main has argument-counter. I might want to count the arguments here aswell!? How can I do that, if that's how It's done?
.globl minisprintf
# Name: minisprintf
# Synopsis: A simplified sprintf
# C-signature: int minisprintf(unsigned char *res, unsigned char *format, ...);
# Registers: AL: for characters
# %ECX: first argument, res
# %EDX: second argument, args
#
minisprintf: # minisprintf
pushl %ebp # start of
movl %esp, %ebp # function
movl 8(%ebp), %ecx # first argument
movl 12(%ebp), %edx # second argument
# other arguments
# checking last byte of string res