Page 2 of 2

Re: Printing text in 640x480 graphics mode is not working

Posted: Sat May 02, 2015 12:00 pm
by Roman
I'm not really experienced with VGA, but couldn't it be that the frame buffer is not contiguous?

Re: Printing text in 640x480 graphics mode is not working

Posted: Sat May 02, 2015 4:35 pm
by Brendan
Hi,
catnikita255 wrote:
Brendan wrote:Then we need more symptoms - e.g. is the loop doing 8 iterations but the pixels aren't being set or is the loop actually only doing one iteration; is something in "putpixel()" dodgy and interfering with the loop; if you call "vgaPutchar" multiple times do you get the same symptoms for all characters or just the first; etc.
1) I can't check it, because i can't print text.
Anything that causes a difference in observable behaviour can be used to check it. This includes printing text; but also includes (deliberately) triple faulting or doing a "while(forever)" (where you can tell if the computer reboots or not), or making keyboard LEDs flash, or making PC speaker beep, or filling the entire screen with white (or black, or not). Also don't forget that you should be able to execute your code in a virtual machine and watch everything that happens as it happens (e.g. single-stepping in Bochs).
catnikita255 wrote:I'm fully filled first line of letters with '1' symbols, so i can see that it's printing it.
Maybe your "putpixel()" is broken (e.g. and does something like "address = displayMemory + y * 123456789 + x/8", so that it only works properly if y=0) and there's nothing wrong with your "vgaPutchar()". Did you try printing anything on the second line (or any other lines)?


Cheers,

Brendan

Re: Printing text in 640x480 graphics mode is not working

Posted: Sat May 02, 2015 4:39 pm
by Brendan
Hi,
Roman wrote:I'm not really experienced with VGA, but couldn't it be that the frame buffer is not contiguous?
For "640*480 with 16 colour" VGA mode, it's not contiguous - it's 4 planes with 1 bit per pixel; where a single pixel is 4 bits and those 4 bits are spread across all 4 planes. This is what makes it extremely slow if you don't do things right. ;)


Cheers,

Brendan

Re: Printing text in 640x480 graphics mode is not working

Posted: Sun May 03, 2015 12:41 am
by osdever
Brendan wrote:Hi,
catnikita255 wrote:
Brendan wrote:Then we need more symptoms - e.g. is the loop doing 8 iterations but the pixels aren't being set or is the loop actually only doing one iteration; is something in "putpixel()" dodgy and interfering with the loop; if you call "vgaPutchar" multiple times do you get the same symptoms for all characters or just the first; etc.
1) I can't check it, because i can't print text.
Anything that causes a difference in observable behaviour can be used to check it. This includes printing text; but also includes (deliberately) triple faulting or doing a "while(forever)" (where you can tell if the computer reboots or not), or making keyboard LEDs flash, or making PC speaker beep, or filling the entire screen with white (or black, or not). Also don't forget that you should be able to execute your code in a virtual machine and watch everything that happens as it happens (e.g. single-stepping in Bochs).
catnikita255 wrote:I'm fully filled first line of letters with '1' symbols, so i can see that it's printing it.
Maybe your "putpixel()" is broken (e.g. and does something like "address = displayMemory + y * 123456789 + x/8", so that it only works properly if y=0) and there's nothing wrong with your "vgaPutchar()". Did you try printing anything on the second line (or any other lines)?


Cheers,

Brendan
1) I'm using QEMU, is it have single-stepping in it? 2) I'm drawn some figures and they are displaying fine, so my putpixel() is working.

Re: Printing text in 640x480 graphics mode is not working

Posted: Sun May 03, 2015 7:02 am
by osdever
Now i'm writed my vgaPrintStr() function, all lines is displaying, but why it's not displaying letters? Only background color is displaying.

Re: Printing text in 640x480 graphics mode is not working

Posted: Sun May 03, 2015 8:25 am
by iansjack
catnikita255 wrote: 1) I can't check it, because i can't print text.
Run your code under a debugger; then you can check whatever you want to.

Re: Printing text in 640x480 graphics mode is not working

Posted: Sun May 03, 2015 10:46 am
by osdever
No, i'm fixed problem with 1 line, but text is not displaying, only BG color.

Re: Printing text in 640x480 graphics mode is not working

Posted: Sun May 03, 2015 11:42 am
by Candy
Hi.

So far the troubles that you've had seem to be things that you can easily solve in a regular development environment, and are code that is not tied to OS development specifically, so I would recommend you to first try to get the code working in a normal environment (with debuggers and so on, say using SDL for graphics output) and only *then* porting it to a barebones environment.

Re: Printing text in 640x480 graphics mode is not working

Posted: Sun May 03, 2015 1:33 pm
by osdever
Thank you all, now text is displaying fine! I'm so happy now!