Hi,
I am at quite a loss as to why C is doing this, it is very strange. I first noticed the problem when I attempted the Kernel in C++ tutorial posted here. For some reason the variables will not increment.
It sounds weird but it is happening, look at this code for example:
Code:
char* video = (char*)0xb8000;
*video = 'A';
video++;
*video = 0x1e;
this code should write a yellow on blue 'A' at 0,0 on the screen, however it comes up with a weird triangle character, this character is produced by the 0x1e, so instead of the video variable being incremented, it is just overwriting the first byte of video memory. If I write the same code like this:
Code:
char* video = (char*)0xb8000;
video[0] = 'A';
video[1] = 0x1e;
then everything goes according to plan. This is really puzzling because I have never seen this before.
I cannot increment variables in any way, none of the following ways work:
Code:
variable++;
variable += 1;
variable = variable + 1;
Has anyone seen this before? or does anyone have any advice for me?
Thanks.