VGA code

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.
FS2Death

VGA code

Post by FS2Death »

I can't get this VGA code working. Why? ALL THE TUTORIALS ARE FOR REAL MODE -ORRRRRRRRRRR
THEY ARE LIBRARY DEPENDANT. Now can someone tell me a simple piece of code that changes to VGA mode and back?
FS2Death

Re:VGA code

Post by FS2Death »

This is sad, no one knows how to do it????
Slasher

Re:VGA code

Post by Slasher »

Insults won't help but providing more info on what you want to do will! >:(

void set_mode(int mode);

_set_mode:
push bp
mov bp,sp
mov ax,[bp+4] ;get video mode
int 10h
ret
this is for 16 mode and will NOT WORK IN 32BIT mode
to call from C
set_mode(0x03); text mode 80*25*16 colors
set_mode(0x13); graphics mode 320*200*256 colors
hope it helps, find yourself vga docs
FS2Death

Re:VGA code

Post by FS2Death »

Nice try, but thanks. I need a piece of code that will work in 32 bit mode or as I call it Protected Mode. I have the code to it though, but the problem is that 70% is useless and complicates the code so it is impossible to do anything with it. I found it on the internet while searching for VGA code.
elias

Re:VGA code

Post by elias »

umm yea. youve been pretty rude, so i dont know why anyone should help you, but ill forgive you and help anyways. its not too hard, its just painstaking. you gotta find out the correct values of all the VGA registers for a particular video mode, id say go with 13h, seeing as how its easiest. I dont know about this arcane hardware hacking, but you might have to set aside, I think its 640K, of video memory, and put the memorys address into the vid card. from there, its jsut simple graphics programming, and if you dont know hwo to do that, all it is is putting the correct RGB value in the memory location corresponding to a pixel onscreen. there are plenty of mode 13h tutorials to tell you hwo to do graphics programming. it would be much easier to write your own VGA driver, which is what you will have to do to switch modes.
DarylD

Re:VGA code

Post by DarylD »

Yeah..seriously rude.

Incidentally 0x13H, is 320x200x8bit..giving a 64K framebuffer at 0xA0000. Set this mode before you enter protected mode.

You can then blit pixels to the memory area. Dead simple standard packed pixel stuff (i.e. one pixel is one byte).

You will ultimately need a proper video driver anyway.

Oh..one word of advice, if you are writing an OS, most people find it almost impossible to start coding the GUI for at least a year until several underlying sub-systems are in place. For example caching icons needs memory management and an IO driver which needs ***...you get the idea.

Daryl.
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:VGA code

Post by distantvoices »

fs2death

funny words you use and ... aren't you somewhat unpatient?

You post a question, and about ten or fifteen minutes later you come along moaning about getting no answer???!!!

Gosh, take your brain, and USE it!!

The people here sometimes use GOOGLE to find answers themselves and for other ones. And finding answers needs time.

Think about it and stay polite.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
Peter_Vigren

Re:VGA code

Post by Peter_Vigren »

To FS2Death:

You really should mature a bit before posting here again. As already mentioned you posted your question (which really didn't say anything useful) and just a few minutes later you post again, complaining. First of all, people have other things to do than be on this forum all the time. Second, it takes time to answer questions (understand the question, find the information, consider what could be helpful and finally post it).

And really, use of insulting language will not help at all. I don't know so much about the topic but if I would, I would not help you until you had apologized. I think that those that help you even when you are this rude are great people but I could not be one of them.

However, I can make a hint. I have myself wondered about graphics and found some information about using the BIOS under Protected Mode (letting BIOS be in Virtual Mode).

So until next time:
* Scrap the insulting language.
* Think before you post a question. What are you trying to achieve? For what circumstances should the code be for? Etc...
* Be patient. We are not here to serve you. We are here to try helping if we can (and recieve help in return).
FS2Death

Re:VGA code

Post by FS2Death »

Hmm. Is this a help forum or a commentary? Anyway, I got 320*240 mode to work a long time ago by using dumped registers. Now I am trying to enter 640*480*16. I get an image with a vertical lines. Finally, the words you all call rude are just pep talk.
Therx

Re:VGA code

Post by Therx »

FS2Death wrote: Finally, the words you all call rude are just pep talk.
Have you ever heard of the saying that you're just making the hole deeper. It would be a lot easier to say Sorry than to make excuses.

If you want code go to my.execpc.com/~geezer/osd/graphics/modes.c it looks complicated but if you strip it down to only the mode you want it becomes quite short. (I've only started looking through it and have already simplified it to 225 odd lines - from over 1000 - which I can learn from.)
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:VGA code

Post by distantvoices »

sorry for asking: what is "Pep Talk"?
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
Therx

Re:VGA code

Post by Therx »

Used in sport as the manager's way of encouraging the team
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:VGA code

Post by distantvoices »

well,

we are grown-ups, arent we? we decide ourselves which way we want to be "motivated", don't we?

Thanks for explaining, therx.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
Peter_Vigren

Re:VGA code

Post by Peter_Vigren »

FS2Death wrote: Hmm. Is this a help forum or a commentary?
Well, you tell me. It was you that wrote "This is sad, no one knows how to do it????" in the first place, was it not?
FS2Death wrote: Finally, the words you all call rude are just pep talk.
Well, you must have missunderstood the principes of pep talk. It is supposed to inspire people. Not agitate them.
Tim

Re:VGA code

Post by Tim »

FS2Death: ask politely for help. Do not demand it. What seems like pep talk to you comes across as arrogance to everyone else.

Everyone else: if you can't contribute any VGA code (which is the subject of this thread), don't contribute anything.

BIOS-independent VGA code: http://cvs.sourceforge.net/cgi-bin/view ... ers/video/
Post Reply