VGA Timing: Black screen and cyan vertical lines

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
sebihepp
Member
Member
Posts: 195
Joined: Tue Aug 26, 2008 11:24 am
GitHub: https://github.com/sebihepp

VGA Timing: Black screen and cyan vertical lines

Post by sebihepp »

Hello,

I need some help in programming the CRT-Registers of the VGA-Standard.
I want to set up 720x400 textmode (80x25 chars) and everything works in Bochs.
Only if I test my kernel on real hardware, my monitor shows only black background with
cyan vertical lines. The Mode and the Timing is recogniced correctly by the monitor, so I
think the translation of the Data is wrong. I tried several other timings, longer retrace signals
and longer pauses between them and the next line/screen... Everything I do results in those lines.
If I change timing I change the position of the lines, but nothing else.
There is also some logic in those lines. If I type something (Should be displayed), then there
appear some new lines with the width of one char and on the position of the char.
I made some screenshots to show, what I mean. The first I have done nothing. The second
shows the screen after typing 5 numbers. The next shows after some newlines. And in the
upper left corner ther is a blinking "c000,", wich isn't explained by my monitor book.
Normaly the first screen should show two lines with text, then a empty line and then the prompt.
So everything looks like scrolled down.

By the way: The lines are static. They are not flickering...

I hope someone has an idea, what I can try to solve the problem. I don't know what I should try
next. Neither I know, what causes the lines...

Best regards
Sebihepp

Image
Image
Image
Image
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: VGA Timing: Black screen and cyan vertical lines

Post by Combuster »

I suspect a broken VGA font. That's usually a side effect from switching from graphics to text where video memory contains something that's not font data.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
sebihepp
Member
Member
Posts: 195
Joined: Tue Aug 26, 2008 11:24 am
GitHub: https://github.com/sebihepp

Re: VGA Timing: Black screen and cyan vertical lines

Post by sebihepp »

Hmm, first I will show all registers before switching mode. Perhaps I can see my fault this way.
Then I try to set up a new font. That's a good idea. I thought about wrong color depth, too.

I am starting in TextMode (Grub booting) and only try to set the registers again, because later
if I am in GraphicMode perhaps I want to switch back.

Best regards
Sebihepp
sebihepp
Member
Member
Posts: 195
Joined: Tue Aug 26, 2008 11:24 am
GitHub: https://github.com/sebihepp

Re: VGA Timing: Black screen and cyan vertical lines

Post by sebihepp »

Thanks! I setup a new font and it works.
Now only the colors are not those i want. Every char has its own color on the entire screen.
It seems to be a problem while writing to plane 1 wich contains the attribute byte. I think I
set something wrong, so I write to the wrong plane or I set the wrong reading.

I implemented a VGARegisterDump routine, wich will show me every interessting VGA-register.
Then I will compare the results right after beeing loaded from grub with my settings. Perhaps
I see the failure there.

Best Regards
Sebihepp
sebihepp
Member
Member
Posts: 195
Joined: Tue Aug 26, 2008 11:24 am
GitHub: https://github.com/sebihepp

Re: VGA Timing: Black screen and cyan vertical lines

Post by sebihepp »

Yeah, I got it work.

Although I have already known about the speciality of Port 0x3C0, I made a mistake.
I wrote data to Port 0x3C1. :oops:

Now it works, it works.

Thanks for your help combuster
Sebihepp
Post Reply