Changing Screen Resolution In Mode 13h

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
melgmry0101b
Member
Member
Posts: 109
Joined: Wed Nov 10, 2010 10:49 am

Changing Screen Resolution In Mode 13h

Post by melgmry0101b »

Hi everyone :D ,
Mode 13h is using 320x200 screen resolution , but it doesn't fit my needs.
How can I change the the resolution in mode 13h without entering VBE mode.

I want to change the resolution to 640x400 :)

I have used this code before but i found it takes me in VBE mode and i cant use 0xa0000 .

Code: Select all

	
mov ax,4F02h
mov bx,100h 
int 10h

----------------------------------
Thank you in advance.
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: Changing Screen Resolution In Mode 13h

Post by Combuster »

There is no way you can access 640x400 with just 0xa0000 - VGA's 4bpp 640x400 means 640 * 400 * 0.5 bytes are needed, which is just under 128k. 0xa0000-0xaffff is only 64k. In fact 320x200x8 is the only standard graphics mode you will encounter that is as simple as just 0xa0000-0xaffff.

So either stick to mode 0x13, implement at least one form of bank switching (VGA planes or VBE banks) or use VBE's linear framebuffer support. For the best futureproofing, make sure your code can handle banking, changing framebuffer addresses, and all forms of backbuffer formats. It'll have you set for all forms of native drivers later.
"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 ]
melgmry0101b
Member
Member
Posts: 109
Joined: Wed Nov 10, 2010 10:49 am

Re: Changing Screen Resolution In Mode 13h

Post by melgmry0101b »

OK,
Now i am entering mode VBE with above code ,
What should i do after that ? How to put pixels on the screen or copy them from the screen?
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: Changing Screen Resolution In Mode 13h

Post by Combuster »

Did you RTFM (in this case, the vesa/vbe specification)? What do you need that you can't find in there?
"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 ]
melgmry0101b
Member
Member
Posts: 109
Joined: Wed Nov 10, 2010 10:49 am

Re: Changing Screen Resolution In Mode 13h

Post by melgmry0101b »

From your last post i understood that i have to change to another mode to change the screen resolution.
and this mode is VBE.
Now , i don't know any thing about VBE :cry: , Is it liner memory " An array of pixels " if yes what is the memory address for it , if no what can i do to put a pixel on the screen and read a pixel from it?
-------------
Thank you in advance :D
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Changing Screen Resolution In Mode 13h

Post by Brendan »

Hi,
Mozo40 wrote:From your last post i understood that i have to change to another mode to change the screen resolution.
and this mode is VBE.
VBE isn't a mode. It's a specification (actually called "VESA BIOS Extensions") that defines a software interface that programmers can use to access high resolution video modes.

It's probably best for you to start reading the relevant wiki page; and then find, download and read the VBE specification/s (you'll want "VBE version 1.2" at least, and probably later versions too).


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
melgmry0101b
Member
Member
Posts: 109
Joined: Wed Nov 10, 2010 10:49 am

Re: Changing Screen Resolution In Mode 13h

Post by melgmry0101b »

Thank you very much Brendan,
Post Reply