When to use VGA text mode buffer

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
User avatar
siavoshkc
Member
Member
Posts: 40
Joined: Wed Feb 19, 2014 11:10 am

When to use VGA text mode buffer

Post by siavoshkc »

In Bare Bones we read "This kernel uses the VGA text mode buffer (located at 0xB8000) as the output device.". Somewhere else I saw that we could send strings to VGA by calling INT 0x12.

First I don't know how this buffer works. Is it a memory mapped I/O which is mapped to VGA memory?

Second why there are two ways to send characters to the VGA?
Check out my FSB Data Integrity Tester at http://fsbdit.sourceforge.net/.

Siavosh
User avatar
pvc
Member
Member
Posts: 201
Joined: Mon Jan 15, 2018 2:27 pm

Re: When to use VGA text mode buffer

Post by pvc »

Both methods work. Ohh… and it's INT 0x10. Using INT 0x10 relies on BIOS routines to display your text. And when you write to 0xB8000, you write directly to VGA memory, skipping BIOS. Using BIOS has its pros and cons. It processes your text so special characters do what they are supposed to do. But it's difficult to use in 32 bit protected mode and VERY difficult in 64 bit mode. On the other hand direct hardware access is fast and easy in all CPU operating modes, but requires you to do the processing yourself, like moving cursor, scrolling, inserting new lines, tabs, etc.

Here is nice description on how to use BIOS for outputing text. http://www.ctyme.com/intr/rb-0106.htm
User avatar
siavoshkc
Member
Member
Posts: 40
Joined: Wed Feb 19, 2014 11:10 am

Re: When to use VGA text mode buffer

Post by siavoshkc »

Sorry about interrupt number and thanks.

Where can I find more about 0xB8000? Is it VGA memory in memory address bus? Is it set by firmware?
Check out my FSB Data Integrity Tester at http://fsbdit.sourceforge.net/.

Siavosh
Octocontrabass
Member
Member
Posts: 5578
Joined: Mon Mar 25, 2013 7:01 pm

Re: When to use VGA text mode buffer

Post by Octocontrabass »

siavoshkc wrote:Where can I find more about 0xB8000?
This is a good starting point.
siavoshkc wrote:Is it VGA memory in memory address bus?
It depends on how the VGA controller is configured. In CGA-compatible text mode, it's VGA memory through some simple address translation. Other modes may use different addresses: 0xB0000 or 0xA0000. Also, VGA can be configured to perform more complex tasks besides simple memory reads/writes when the CPU accesses the VGA MMIO.
siavoshkc wrote:Is it set by firmware?
Yes. The VGA option ROM (which provides INT 0x10) selects between 0xB0000, 0xB8000, or 0xA0000 depending on the desired video mode. The BIOS calls INT 0x10 to set up the initial text mode screen.

Modern PCs must additionally configure the PCI bus for VGA-compatible memory and I/O accesses, before any of the above will work.

VGA is legacy hardware, and modern PCs are transitioning to a legacy-free design, so it may be wise to study graphics modes using a linear frame buffer instead. The bare bones tutorial has not been updated to take this into account yet.
Post Reply