VBE:in real mode or in protected mode
VBE:in real mode or in protected mode
I want to do something with graphics.and I read the papersheet of VBE,there 2ways to call the function of it.One is in real mode,easy but in prtected mode,you cann't do anything about it.the other is in protected,there are 10 steps if you wish do in this way,so complicated,what would you do.
thanks in advance
thanks in advance
Re: VBE:in real mode or in protected mode
As far as I know, there are just a few video cards supporting the protected mode interface.
I'd write a VM86 monitor and use the real mode interface.
I'd write a VM86 monitor and use the real mode interface.
- Combuster
- 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: VBE:in real mode or in protected mode
I'd personally start with a VGA driver, being that if you can work with it, everything else is a bonus. But you could have asked the wiki on the pros and cons of all the alternatives.
Re: VBE:in real mode or in protected mode
but if you want to display more clear,VGA maybe seems not enough?Combuster wrote:I'd personally start with a VGA driver, being that if you can work with it, everything else is a bonus. But you could have asked the wiki on the pros and cons of all the alternatives.
I'd personally start with a VGA driver, being that if you can work with it, everything else is a bonus. But you could have asked the wiki on the pros and cons of all the alternatives.
Re: VBE:in real mode or in protected mode
Thats up to you - I personally find 640x480 fine. Im seconding Combuster, separate the graphics from the video driver and you can go with SVGA+ modes later if you wish.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Re: VBE:in real mode or in protected mode
You can use high res vesa modes in pmode, just as easy as realmode, but you can only change modes in realmode, as most will be vesa2 with LFB.
They say theres a a pmode interface in vesa3, but its really 16bit pmode interface, so why not just switch back to realmode to change modes or stick to one mode.
Heres a simple vesa pmode demo
They say theres a a pmode interface in vesa3, but its really 16bit pmode interface, so why not just switch back to realmode to change modes or stick to one mode.
Heres a simple vesa pmode demo
Code: Select all
;************************************
; By Dex
; Assemble with fasm
; c:\fasm Vesa.asm Vesa.bin
;
;************************************
org 0x7C00
use16
;****************************
; Realmode startup code.
;****************************
start:
xor ax,ax
mov ds,ax
mov es,ax
mov ss,ax
mov sp,0x7C00
;****************************
; Vesa start code.
;****************************
mov bx,4112h
mov ax,4f01h
mov di,Mode_Info
mov cx,bx
int 10h
mov ax,4f02h
int 10h
;*****************************
; Setting up, to enter pmode.
;*****************************
cli
lgdt [gdtr]
mov eax, cr0
or al,0x1
mov cr0,eax
jmp 0x10: protected
;*****************************
; Pmode. ;-)
;*****************************
use32
protected:
mov ax,0x8
mov ds,ax
mov es,ax
mov ss,ax
mov esp,0x7C00
;*****************************
; Turn floppy off.
;*****************************
mov dx,3F2h
mov al,0
out dx,al
;*****************************
; Do we have 32 BitsPerPixel.
;*****************************
cmp byte[ModeInfo_BitsPerPixel],32
jne Letsloop
;*****************************
; fade background screen.
;*****************************
fade_screen:
mov edx,[ModeInfo_PhysBasePtr]
mov edi,edx
xor eax,eax
mov al,0xc5
xor ebx,ebx
mov bl,195
DoLoop:
mov cx,640*2
dec eax
rep stosd
dec ebx
jnz DoLoop
Letsloop:
hlt
jmp Letsloop
;*************************************
; GDT.
;*************************************
gdt: dw 0x0000, 0x0000, 0x0000, 0x0000
sys_data: dw 0xFFFF, 0x0000, 0x9200, 0x00CF
sys_code: dw 0xFFFF, 0x0000, 0x9800, 0x00CF
gdt_end:
gdtr: dw gdt_end - gdt - 1
dd gdt
;*************************************
; Make program 510 byte's + 0xaa55
;*************************************
times 510- ($-start) db 0
dw 0xaa55
;*************************************
; Put uninitialized data here.
;*************************************
;=========================================================;
; Vesa Information Block 11/12/03 ;
;---------------------------------------------------------;
; DOS EXTREME OS V0.01 ;
; by Craig Bamford(Dex). ;
; ;
;=========================================================;
;============================== VESA MODE INFORMATION ===========================================
Mode_Info:
ModeInfo_ModeAttributes rw 1
ModeInfo_WinAAttributes rb 1
ModeInfo_WinBAttributes rb 1
ModeInfo_WinGranularity rw 1
ModeInfo_WinSize rw 1
ModeInfo_WinASegment rw 1
ModeInfo_WinBSegment rw 1
ModeInfo_WinFuncPtr rd 1
ModeInfo_BytesPerScanLine rw 1
ModeInfo_XResolution rw 1
ModeInfo_YResolution rw 1
ModeInfo_XCharSize rb 1
ModeInfo_YCharSize rb 1
ModeInfo_NumberOfPlanes rb 1
ModeInfo_BitsPerPixel rb 1
ModeInfo_NumberOfBanks rb 1
ModeInfo_MemoryModel rb 1
ModeInfo_BankSize rb 1
ModeInfo_NumberOfImagePages rb 1
ModeInfo_Reserved_page rb 1
ModeInfo_RedMaskSize rb 1
ModeInfo_RedMaskPos rb 1
ModeInfo_GreenMaskSize rb 1
ModeInfo_GreenMaskPos rb 1
ModeInfo_BlueMaskSize rb 1
ModeInfo_BlueMaskPos rb 1
ModeInfo_ReservedMaskSize rb 1
ModeInfo_ReservedMaskPos rb 1
ModeInfo_DirectColorModeInfo rb 1
; VBE 2.0 extensions
ModeInfo_PhysBasePtr rd 1
ModeInfo_OffScreenMemOffset rd 1
ModeInfo_OffScreenMemSize rw 1
;======================================= START OF PROGRAM ======================================
Re: VBE:in real mode or in protected mode
You configure VESA in your loader, then pass the struct to your kernel, map the LFB, and you're ready to start GUI programming in pmode. If you're using GRUB, then disregard me. I don't know how to do the same using GRUB. A patch is needed I think.
Yes, I see that you have proven it, but my question was, 'How did you know that would work?'.
- KotuxGuy
- Member
- Posts: 96
- Joined: Wed Nov 25, 2009 1:28 pm
- Location: Somewhere within 10ft of my favorite chubby penguin!
Re: VBE:in real mode or in protected mode
Yes, this can be done in GRUB, but you're right: To enable/configure VESA in GRUB Legacy, you need the VBE patch( I saw a thread on the forums about this; search for it ). GRUB 2, however, can configure VESA without a patch.
Give a man Linux, you feed the nearest optician ( Been staring at the PC too long again? ).
Give a man OS X, you feed the nearest NVidia outlet ( I need more GPU power!! )
Give a man Windows, you feed the entire Tylenol company ( Self explanatory )
Give a man OS X, you feed the nearest NVidia outlet ( I need more GPU power!! )
Give a man Windows, you feed the entire Tylenol company ( Self explanatory )
-
- Posts: 13
- Joined: Sun Mar 07, 2010 3:17 pm
Re: VBE:in real mode or in protected mode
<Deleted>
Last edited by aeritharcanum on Sun Feb 28, 2021 11:04 pm, edited 1 time in total.
- KotuxGuy
- Member
- Posts: 96
- Joined: Wed Nov 25, 2009 1:28 pm
- Location: Somewhere within 10ft of my favorite chubby penguin!
Re: VBE:in real mode or in protected mode
This may be off-topic!
Unfortunately, you can't set a new resolution from GRUB without restarting the computer.
Unfortunately, you can't set a new resolution from GRUB without restarting the computer.
Give a man Linux, you feed the nearest optician ( Been staring at the PC too long again? ).
Give a man OS X, you feed the nearest NVidia outlet ( I need more GPU power!! )
Give a man Windows, you feed the entire Tylenol company ( Self explanatory )
Give a man OS X, you feed the nearest NVidia outlet ( I need more GPU power!! )
Give a man Windows, you feed the entire Tylenol company ( Self explanatory )
Re: VBE:in real mode or in protected mode
Could you please give me more information on configure VESA in GRUB2?KotuxGuy wrote:Yes, this can be done in GRUB, but you're right: To enable/configure VESA in GRUB Legacy, you need the VBE patch( I saw a thread on the forums about this; search for it ). GRUB 2, however, can configure VESA without a patch.
Thanks
torshie
- KotuxGuy
- Member
- Posts: 96
- Joined: Wed Nov 25, 2009 1:28 pm
- Location: Somewhere within 10ft of my favorite chubby penguin!
Re: VBE:in real mode or in protected mode
Again, this may be off-topic!
Certainly.
First the gfxterm GRUB 2 module must be loaded. Then in your grub.cfg file:
That will give the highest resolution available.
Or:
Certainly.
First the gfxterm GRUB 2 module must be loaded. Then in your grub.cfg file:
Code: Select all
insmod gfxterm
set gfxmode="1024x768x32,800x600x32,640x480x32,1024x768,800x600,640x480"
Or:
Code: Select all
insmod gfxterm
set gfxmode=[resolution you want]
# Like: 1024x768x32 ( which has 32bpp ), 1024x768 ( which will give the highest bpp )
Give a man Linux, you feed the nearest optician ( Been staring at the PC too long again? ).
Give a man OS X, you feed the nearest NVidia outlet ( I need more GPU power!! )
Give a man Windows, you feed the entire Tylenol company ( Self explanatory )
Give a man OS X, you feed the nearest NVidia outlet ( I need more GPU power!! )
Give a man Windows, you feed the entire Tylenol company ( Self explanatory )
Re: VBE:in real mode or in protected mode
I think using a vm86 is a good way,but must it running on level 3 ?i tend to simplify my kernel which is always running on level 0.
Re: VBE:in real mode or in protected mode
In V86 mode, the privilege level is always 3.
Re: VBE:in real mode or in protected mode
You can try this emulator out in protected mode http://forum.osdev.org/viewtopic.php?f=2&t=21678
"Programmers are tools for converting caffeine into code."