Quote:
Originally Posted by flasher86
I am using while() all the time. Also sometimes sprintf (for converting decimals to strings) but printf doesn't work for me. I am curious how sig11 is using printf (have you introduced some nice console?).
Though whole SDK is very buggy. btw sprintf doesn't support long data type. This function acts like it was signed int then.
|
You should to implement two functions fputc() and fwrite(). After this your prinf() will be work.
int fputc(int ch,int handle)
{
if ( ch & 0xFF )
outch1(ch & 0xFF);
if ( ch >> 8 )
outch1(ch >> 8);
return 1;
}
int fwrite(const char* buff,int isize,int count,int handle)
{
int i;
int j = count;
while ( j > 0 ) {
for ( i = 0; i < isize; i++ ) {
int ch = *buff;
outch1(ch & 0xFF);
outch1(ch >> 8);
buff++;
}
j--;
}
return count;
}
where outch1() is your function for output of one char.
My console driver is not ready yet ( cursor is missing, 8x16 font only, CP866 only, no UTF8 support e.t.c. )