Hey, I wanted to make an on-screen console for the nspire.
Normal text output works fine, but i wanted an sprintf()-like function to output text, so I made this function:
void c_swrite(struct console *c, char* format, int len, char bgColor, char textColor, ...)
{
char buf[len];
memset(buf,'\0',sizeof(char)*len);
va_list arglist;
va_start(arglist,textColor);
vsprintf(buf,format,arglist);
c_write(c,buf,bgColor,textColor);
va_end(arglist);
}
Always when this function reaches vsprintf, the emulator crashes.
Error at PC=102F45C0: Unaligned read_word: 1800e0ed
Backtrace:
Frame PrvFrame Self Return Start
1800E0B0: 1800E0E8 1800E0B4 1106E9DC 102F4210
1800E0E8: 1109CA20 00000000 1800E934 1106E5A4
I have attached my whole source.
So, what am I doing wrong?