Nekroze wrote:Code: Select all
volatile unsigned short *where;
where = 0xb8000 + (y * 80 + x);
This is what the 'pointer from integer without a cast' message will about - most warnings are there to tell you that you might have done something wrong (eg, passing 'x' instead of "x" to a char*-accepting function produces this one), but in this case you're right, so it needs a cast.
Also, before you test this code and get weird results, in text modes you have alternating character and attribute bytes. So your offset needs doubling. So the second line I've quoted should be "where = (unsigned short *)(0xb8000 + (y*80 + x)*2)"
Other warnings:
"'struct multiboot_data' declared inside parameter list" - you've put something like this:
Code: Select all
void main(struct multiboot_data { ... } *data)
This is a bad idea usually, because the struct definition is only valid *inside* the function - no other function can create one. It doesn't really matter here, but it'd still be cleaner to put the struct definition separately.
Finally, what I said about warnings being about things which are *usually* wrong: a common example is "if (x = y)"; that's valid, but is usually a typo for "if (x == y)". So you have to tell the compiler that you've taken its warning into account and intended the former behavior, by typing "if ((x = y))"