Page 1 of 1

What does this bit do?

Posted: Sun Sep 30, 2012 8:04 am
by Roroy

Code: Select all

// Initialise the console, required for printf
console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
After the xfb, the 2 numbers, 20, 20.

Tried changing values, no visible results. Anyone know?
And one more thing, I know it says that this line initialises the console and everything but can someone explain in it more detail.

Thanks and cheers.

Re: What does this bit do?

Posted: Sun Sep 30, 2012 9:12 am
by elhobbs
The console refers to a text console. It is where the text from printf is displayed. Without this call it if not going to display stdout. The parameters to the function describe the screen resolution and the region of the screen to print to. In particular the 20, 20 values set the start x and y values. In this case, do not print right at the edge, start 20 pixels down and 20 pixels from the left edge. If you made small changes to these values it would not be very noticeable.

Re: What does this bit do?

Posted: Sun Sep 30, 2012 10:21 am
by Roroy
I'd also like to ask one more thing.

Regarding this line:

xfb[205 + 105] = 0;

It sets a pixel to the colour black right?

Thing is, the 2 numbers in the square brackets, is the first number the length of pixels from the left hand side of the screen and the second number being the number of pixels from the top of the screen down? And that sets that pixel to 0 which I presume is black colour?

Or does this line do something else?

Re: What does this bit do?

Posted: Sun Sep 30, 2012 10:45 am
by Roroy
Sorry for double posting.
Forgot to add:

Tried changing 20, 20 to 320, 320, still prints text in the same position.
So code is:

Code: Select all

console_init(xfb,320,320,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);

...

printf("\x1b[2;0H");
	

printf("Hello World!");