Re: Printing text in 640x480 graphics mode is not working
Posted: Sat May 02, 2015 12:00 pm
I'm not really experienced with VGA, but couldn't it be that the frame buffer is not contiguous?
The Place to Start for Operating System Developers
http://f.osdev.org/
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:1) I can't check it, because i can't print text.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.
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)?catnikita255 wrote:I'm fully filled first line of letters with '1' symbols, so i can see that it's printing it.
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.Roman wrote:I'm not really experienced with VGA, but couldn't it be that the frame buffer is not contiguous?
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.Brendan wrote:Hi,
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:1) I can't check it, because i can't print text.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.
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)?catnikita255 wrote:I'm fully filled first line of letters with '1' symbols, so i can see that it's printing it.
Cheers,
Brendan
Run your code under a debugger; then you can check whatever you want to.catnikita255 wrote: 1) I can't check it, because i can't print text.