OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 6:42 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Bochs VBE how to return to Text mode?
PostPosted: Fri Jan 06, 2017 9:46 am 
Offline
Member
Member

Joined: Sun May 01, 2016 7:24 am
Posts: 29
After having set the Bochs VBE driver in graphic mode and painted all I wanted on my screen how can I return to text mode?

I cannot find anything into OSDEV wiki and no "official" documentation from Bochs in how to write a driver for this simplified version of VBE...

Thank you for your help!

_________________
Member of the Cosmos OS CoreTeam
Cosmos Official Site
Do you to help us to develop it? Join our chat!


Top
 Profile  
 
 Post subject: Re: Bochs VBE how to return to Text mode?
PostPosted: Fri Jan 06, 2017 9:58 am 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 568
Location: Moscow, Russia
You can use INT 0x10.

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
 Post subject: Re: Bochs VBE how to return to Text mode?
PostPosted: Fri Jan 06, 2017 12:08 pm 
Offline
Member
Member
User avatar

Joined: Sat Dec 27, 2014 9:11 am
Posts: 901
Location: Maadi, Cairo, Egypt
The same way you enabled Bochs VBE you disable it. Instead of writing 0x01 or 0x41 to BGA register 4, write 0x00 to disable the BGA. And then set VGA text mode 3 by uploading the register sequences it requires, which can be found in FreeVGA (I think...) and somewhere in the Wiki.
Way simpler: disable Bochs VBE and then use INT 0x10 as Roman already said.

_________________
You know your OS is advanced when you stop using the Intel programming guide as a reference.


Top
 Profile  
 
 Post subject: Re: Bochs VBE how to return to Text mode?
PostPosted: Fri Jan 06, 2017 1:30 pm 
Offline
Member
Member

Joined: Sun May 01, 2016 7:24 am
Posts: 29
Does not makes sense / is impossible to use VBE to set a text mode?
In the end they are part of the VESA mode numbers: https://en.wikipedia.org/wiki/VESA_BIOS_Extensions#VBE_mode_numbers

I cannot do INT10 as my OS is in protected mode 32 bit so I fear if not possible with a VBE command I need to do this setting VGA registers!

_________________
Member of the Cosmos OS CoreTeam
Cosmos Official Site
Do you to help us to develop it? Join our chat!


Top
 Profile  
 
 Post subject: Re: Bochs VBE how to return to Text mode?
PostPosted: Fri Jan 06, 2017 3:35 pm 
Offline
Member
Member
User avatar

Joined: Thu Aug 06, 2015 6:41 am
Posts: 97
Location: Netherlands
fano1 wrote:
Does not makes sense / is impossible to use VBE to set a text mode?
In the end they are part of the VESA mode numbers: https://en.wikipedia.org/wiki/VESA_BIOS_Extensions#VBE_mode_numbers

Yes, it is possible to set text modes using VBE, but forget mode numbers, they're outdated.
To find text modes you should instead check bit 4 of the ModeAttributes field in the ModeInfoBlock.


Top
 Profile  
 
 Post subject: Re: Bochs VBE how to return to Text mode?
PostPosted: Fri Jan 06, 2017 4:43 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

Just a note (partly because I think fano1 might be wanting to switch from "high resolution graphics mode" to "standard VGA text mode")...

If you use VBE to set a "better than VGA" video mode (which includes a "better than VGA text mode"); and then want to switch to a "standard VGA mode"; then you should use VBE for this and not "int 0x10, ah=0x00". The reason is that when setting non-VGA modes VBE can unlock incompatible "non-VGA" extensions in the video card that "int 0x10, ah=0x00" doesn't expect.

However, (depending on which version?) VBE doesn't report standard VGA modes in its list and doesn't give you "mode information structure" for standard VGA modes. For this case (and only for this case) you need to use fixed (7-bit) mode numbers with VBE.


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.


Top
 Profile  
 
 Post subject: Re: Bochs VBE how to return to Text mode?
PostPosted: Fri Jan 06, 2017 4:47 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
VBE is INT 0x10 AH=0x4F. Unfortunately, Bochs doesn't really make the distinction between "VBE" and "virtual hardware that supports VBE".

If you're trying to set the video mode using VBE, then you need INT 0x10. (VBE also has a protected mode interface, but you still need to use INT 0x10 to find the entry point.)

If you're trying to set the video mode using virtual hardware that supports VBE, write VBE_DISPI_DISABLED to VBE_DISPI_INDEX_ENABLE, and then program it like you would any other VGA-compatible video card.


Top
 Profile  
 
 Post subject: Re: Bochs VBE how to return to Text mode?
PostPosted: Sat Jan 07, 2017 9:09 am 
Offline
Member
Member
User avatar

Joined: Sun Sep 19, 2010 10:05 pm
Posts: 1074
It seems like one of the virtual machines would let you do this, but I can't remember which one.

Try setting the XRES, YRES and BPP registers to zero. And if that doesn't work, check and see what these registers are set to at boot time, and try setting them back to the same values after you are in graphics mode.

_________________
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott


Top
 Profile  
 
 Post subject: Re: Bochs VBE how to return to Text mode?
PostPosted: Sat Jan 07, 2017 10:57 am 
Offline
Member
Member

Joined: Sun May 01, 2016 7:24 am
Posts: 29
Octocontrabass wrote:
If you're trying to set the video mode using virtual hardware that supports VBE, write VBE_DISPI_DISABLED to VBE_DISPI_INDEX_ENABLE, and then program it like you would any other VGA-compatible video card.


Yes I'm using "Bochs VBE Extensions" so it is no real VBE for example I've not found a way to get the ModeInfo structrure that I needed to populate the list of mode the driver will support.

The idea to set XRES, YRES and BPP to 0 could have some validity indeed, setting these values instead at 80,25 and 4 was what I was thinking but this probably would give me some weird very low resolution graphic mode...

_________________
Member of the Cosmos OS CoreTeam
Cosmos Official Site
Do you to help us to develop it? Join our chat!


Top
 Profile  
 
 Post subject: Re: Bochs VBE how to return to Text mode?
PostPosted: Sat Jan 07, 2017 11:37 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
fano1 wrote:
Yes I'm using "Bochs VBE Extensions" so it is no real VBE for example I've not found a way to get the ModeInfo structrure that I needed to populate the list of mode the driver will support.

VBE is just a standard for accessing a driver in the video card's ROM. You access the driver through INT 0x10. The ModeInfo structure is how the ROM driver tells you about the modes it supports.

Since you're writing your own driver, it's up to you to figure out which modes you want to support (and which of those are possible on the hardware). Several modes are standardized by VESA (PDF), but there's nothing stopping you from coming up with your own modes.


Top
 Profile  
 
 Post subject: Re: Bochs VBE how to return to Text mode?
PostPosted: Mon Jan 09, 2017 3:00 am 
Offline
Member
Member

Joined: Sun May 01, 2016 7:24 am
Posts: 29
I've tried to change the mode to text simple setting 80x25@4 bpp but I've obtained a strange big "pixel" on the screen and nothing else!
Setting 0,0,0 gave to me a worst result: only the Bochs title bar remained :shock:

I'll hate to have to resort to set the VGA hardware registers only to return to text mode as my driver is for VBE (the simplified version implemented for the Bochs Graphic Adapter) and - in my opinion - should be a way to return to text mode using that API...

_________________
Member of the Cosmos OS CoreTeam
Cosmos Official Site
Do you to help us to develop it? Join our chat!


Top
 Profile  
 
 Post subject: Re: Bochs VBE how to return to Text mode?
PostPosted: Mon Jan 09, 2017 3:26 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
The Bochs VBE extensions don't support text mode at all. You have to disable the extensions (write VBE_DISPI_DISABLED to VBE_DISPI_INDEX_ENABLE) and then set up text mode using the standard VGA registers.


Top
 Profile  
 
 Post subject: Re: Bochs VBE how to return to Text mode?
PostPosted: Mon Jan 09, 2017 6:02 am 
Offline
Member
Member

Joined: Sun May 01, 2016 7:24 am
Posts: 29
Really annoying as I should do an hybrid driver now only to return to VGA mode!

Another question BGA will support the real VBE or not? I can query the hardware and obtain the video modes supported, return to text mode and so on?

Makes sense to do a "native" driver for BGA? It simulates a Cirrus 3 VGA card if I'm not mistaken...

_________________
Member of the Cosmos OS CoreTeam
Cosmos Official Site
Do you to help us to develop it? Join our chat!


Top
 Profile  
 
 Post subject: Re: Bochs VBE how to return to Text mode?
PostPosted: Mon Jan 09, 2017 7:10 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
fano1 wrote:
Really annoying as I should do an hybrid driver now only to return to VGA mode!

You don't have to return to text mode, you know. You could just display text in a graphics mode instead.

fano1 wrote:
Another question BGA will support the real VBE or not? I can query the hardware and obtain the video modes supported, return to text mode and so on?

When you configure Bochs with BGA (extension=vbe) and VGABIOS-lgpl-latest, you can call VBE through INT 0x10 AH=0x4F.

fano1 wrote:
Makes sense to do a "native" driver for BGA? It simulates a Cirrus 3 VGA card if I'm not mistaken...

BGA (extension=vbe) and Cirrus CL-GD54xx (extension=cirrus) are two completely different video cards.

If you write a native driver for BGA, you can use it in Bochs, QEMU, and VirtualBox. I think it's a good idea.

If you write a native driver for Cirrus CL-GD54xx, you can use it in... some really old computers. Don't bother unless you own an actual Cirrus SVGA card.


Top
 Profile  
 
 Post subject: Re: Bochs VBE how to return to Text mode?
PostPosted: Mon Jan 09, 2017 9:21 am 
Offline
Member
Member

Joined: Sun May 01, 2016 7:24 am
Posts: 29
The only way to drive BGA is using VBE right? There is no way to have a native video driver...

I don't think it is more slower emulating VBE but I have little hopes that using it natively it will have hardware accelerations to draw lines, rectangles and so on...

_________________
Member of the Cosmos OS CoreTeam
Cosmos Official Site
Do you to help us to develop it? Join our chat!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 59 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group