flat assembler
Message board for the users of flat assembler.

Index > OS Construction > VBE In Protected Mode?

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
How do I set up VBE for Protected mode?

Currently in my OS I have it set up so that I call the video interrupt in realmode then switch to PMode, but I know there's a PMode structure I can use to change the resolution while in PMode. What is that structure and how do I set it up?

Thanks!

-Rhyno DaGreat
Post 23 Nov 2007, 05:37
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4216
Location: 2018
edfed
to do that, it's by IO ports
as you can change the VGA resolution by the graphic adapter, you can make the same for vesa
just find the related documents, read them and code.
if you find , tell me.
i didn't find any easy ressource

in this document they say at page 77 that vbe 3.0 is a dual mode code


Description:
Download
Filename: vbe3.pdf
Filesize: 271.58 KB
Downloaded: 217 Time(s)

Post 23 Nov 2007, 06:45
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7106
Location: Slovakia
vid
I/O ports are bad way, they don't allow almost anything. Highest you reach is 320x200x256 or 640x480x16. Use VESA.

There may be support in VESA to call it from protected mode, but I am afraid it is very little supported.

If it is 32bit mode, then you make v86 monitor, and call VESA interrupts in v86 code.

If it is 64bit mode, then you have a problem Wink There are two ways:
- you can switch to real mode. this is a big security problem for OS though and shouldn't be done by any real OS.
- you can emulate interrupt. Emulator requires LOT of coding, but can be safe. Windows XP64 uses this method.
Post 23 Nov 2007, 11:26
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
The Pmode vesa interface is not a good idea, as you still need to switch to 16bit PMode, so you should instead go to realmode change mode and then switch back to Pmode.
The big security problem, as vid pointed out, is not a big problem, that is because i can get round any OS simply by taking over the boot process and then i have full control over anything that runs on it, So that like saying do not boot up it a security risk, even vista is susceptible to being taken over on boot up.
Post 23 Nov 2007, 15:24
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
Dex: perhaps you missed the part that XP64 (without a proper video driver installed) actually calls VESA not just on startup, but while running, and uses an emulator to do this - hence security concerns.
Post 24 Nov 2007, 00:03
View user's profile Send private message Visit poster's website Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
Thanks for the help! So much for trying to avoid mode-switching. Laughing
Post 24 Nov 2007, 04:24
View user's profile Send private message Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6029
Location: Poland
MHajduk
rhyno_dagreat

Sorry for my curiosity, but I have to ask you: are you descendant of Welsh settlers in USA? Do you speak Welsh? Very Happy
Post 25 Nov 2007, 12:06
View user's profile Send private message Visit poster's website Reply with quote
tom tobias



Joined: 09 Sep 2003
Posts: 1320
Location: usa
tom tobias
yes, Unol Daleithiau is the Welsh equivalent of the English: USA. However, such interesting and useful tidbits belong in Heap, not Operating systems.
Smile
Post 25 Nov 2007, 16:23
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2796
Location: dank orb
bitRAKE
From what I've read there are only a handfull of cards that support VBE 3.0, and some implementations are just wrong. Although those problems have been worked around by either coding a software driver (different for each card UniVBE), and/or copying the video ROM and patching it.

Google turned up many hits.
Post 25 Nov 2007, 16:44
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7106
Location: Slovakia
vid
Quote:
From what I've read there are only a handfull of cards that support VBE 3.0

mine notebook's BIOS only has VBE 1.0 (even though with all highres modes). forget about linear framebuffer
Post 25 Nov 2007, 17:30
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
vid wrote:
Quote:
From what I've read there are only a handfull of cards that support VBE 3.0

mine notebook's BIOS only has VBE 1.0 (even though with all highres modes). forget about linear framebuffer


Are you 100% sure about that, or have you only queried it inside windows?

_________________
Image - carpe noctem
Post 25 Nov 2007, 17:40
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7106
Location: Slovakia
vid
Quote:
Are you 100% sure about that, or have you only queried it inside windows?

in case you meant exclusive OR, answer is NO Razz (1 xor 1 = 0)

Why would same code emulated beheave differently than when executed directly? any idea how could this happen?
Post 25 Nov 2007, 17:59
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2796
Location: dank orb
bitRAKE
Luckily, my notebook has an Intel chipset which has open source code, and they say VBE 3.0 is supported but I don't know to what extent. Anyone know of a program to explore the implementation?
Post 25 Nov 2007, 18:03
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7106
Location: Slovakia
vid
bitRAKE:

call interrupt 10 with AX=4F00, ES:DI = 200h byte buffer, and on return check word at [edi+2]. Check out any VESA tutorial
Post 25 Nov 2007, 19:14
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2796
Location: dank orb
bitRAKE
Under windows the whole buffer is empty.
Code:
org 100h
push cs
pop es
mov di,200h
mov ax,04F00h
int 10    
In DEBUG I push "p" five times and then "d 200" -- it's all zeroes.

Edit: changed segment to ES. Now it overwrites bytes prior to ES:200 Question
Post 25 Nov 2007, 19:36
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7106
Location: Slovakia
vid
If VESA is supported, AX on return will be 004F, i forgot to write that last time. If it doesn't work "in windows" (eg. under NTVDM emulator), it means you either don't have any VESA, or more likely, NTVDM doesn't emulate VESA.

Quote:
The Pmode vesa interface is not a good idea, as you still need to switch to 16bit PMode, so you should instead go to realmode change mode and then switch back to Pmode.

AFAIK you only need to create 16bit code segment for calling BIOS. Check our VBE3 specs, it deals more in detail with this.
Post 25 Nov 2007, 19:57
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 688
Location: Adelaide
sinsi
bitRAKE, do you mean "int 10" or "int 10h"?
Code:
format binary as 'com'
org 100h

    mov ax,4f00h
    mov di,buffer
    push cs
    pop es
    mov dword [es:di],'VBE2'    ;need this before the call to get VBE 2+ info
    int 10h

    cmp ax,4fh
    jnz .novesa

    cmp dword [es:di],'VESA'
    jnz .novesa

    ;word at [es:di+4] has version e.g. 0102h -> VBE 1.2

.novesa:
    mov ah,4ch
    int 21h

buffer rb 512   ;buffer is 256 bytes for VBE 1 but 512 for VBE2+
    

I have read (somewhere) that in windows you might need a full-screen dos prompt to get some vesa functions.
Post 26 Nov 2007, 08:03
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2796
Location: dank orb
bitRAKE
Thank you. Worked like a charm - forced console to fullscreen on int. Returns VESA version 3.0.
Post 26 Nov 2007, 08:21
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
Iirc NTVDM defers loading/initialization of some of the BIOS emulation until certain other instructions have been called, ie. a INT10 modechange (dunno if it's the BIOS call or the resulting go-fullscreen that triggers this).

NTVDM is a strange beast.
Post 26 Nov 2007, 12:04
View user's profile Send private message Visit poster's website Reply with quote
pfranz



Joined: 13 Jan 2007
Posts: 49
Location: Italy
pfranz
I have a working example of the general VBE protected mode interface in my HwTest version 0.4 found at http://pfranz73.googlepages.com/
To try it, select a video mode WITHOUT 32bit per pixel (that is, 8, 16, 24): if your BIOS supports this interface, it will be selected. You will see Scroll:Prot in the information messages. 32bit selects 4F0A interface for scrolling.
Since previous versions caused troubles to someone, this time I'm testing HwTest on many different configurations, and testing is not over (see the site).
I'm available for any question.
Post 27 Nov 2007, 20:59
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.